LEFT JOIN Supplier sup WITH(NOLOCK) ON h.site = sup.site AND (NULLIF(LTRIM(RTRIM(h.customer_id)), '') IS NULL OR c.CustomerID IS NULL) AND LTRIM(RTRIM(h.customer_id)) = sup.SupplierID
LEFT JOIN Supplier sup WITH(NOLOCK) ON h.site = sup.site AND (NULLIF(LTRIM(RTRIM(h.customer_id)), '') IS NULL OR c.CustomerID IS NULL) AND LTRIM(RTRIM(h.customer_id)) = sup.SupplierID
LEFT JOIN WareHouse wh WITH(NOLOCK) ON h.site = wh.site AND h.bu_no = wh.bu_no AND h.out_warehouse = wh.WareHouseID
LEFT JOIN WareHouse wh WITH(NOLOCK) ON h.site = wh.site AND h.bu_no = wh.bu_no AND h.out_warehouse = wh.WareHouseID
LEFT JOIN outbound_notification_detail d WITH(NOLOCK) ON h.site = d.site AND h.bu_no = d.bu_no AND h.order_no = d.order_no
LEFT JOIN outbound_notification_detail d WITH(NOLOCK) ON h.site = d.site AND h.bu_no = d.bu_no AND h.order_no = d.order_no
LEFT JOIN part p WITH(NOLOCK) ON d.site = p.site AND d.bu_no = p.bu_no AND d.part_no = p.partNo
LEFT JOIN WareHouse dwh WITH(NOLOCK) ON d.site = dwh.site AND d.bu_no = dwh.bu_no AND d.out_warehouse = dwh.WareHouseID
LEFT JOIN WareHouse dwh WITH(NOLOCK) ON d.site = dwh.site AND d.bu_no = dwh.bu_no AND d.out_warehouse = dwh.WareHouseID
LEFT JOIN um WITH(NOLOCK) ON d.site = um.site AND d.unit = um.UMID
LEFT JOIN um WITH(NOLOCK) ON d.site = um.site AND d.unit = um.UMID
LEFT JOIN erp_department dep WITH(NOLOCK) ON h.department_no = dep.department_no
LEFT JOIN erp_department dep WITH(NOLOCK) ON h.department_no = dep.department_no
@ -94,6 +96,9 @@
<iftest="query.partDesc != null and query.partDesc != ''">
<iftest="query.partDesc != null and query.partDesc != ''">
AND d.part_desc LIKE '%' + #{query.partDesc} + '%'
AND d.part_desc LIKE '%' + #{query.partDesc} + '%'
</if>
</if>
<iftest="query.spec != null and query.spec != ''">
AND p.Spec LIKE '%' + #{query.spec} + '%'
</if>
<iftest="query.startDate != null">
<iftest="query.startDate != null">
AND h.required_outbound_date >= #{query.startDate}
AND h.required_outbound_date >= #{query.startDate}
</if>
</if>
@ -126,6 +131,7 @@
LEFT JOIN Customer c WITH(NOLOCK) ON h.site = c.site AND LTRIM(RTRIM(h.customer_id)) = c.CustomerID
LEFT JOIN Customer c WITH(NOLOCK) ON h.site = c.site AND LTRIM(RTRIM(h.customer_id)) = c.CustomerID
LEFT JOIN Supplier sup WITH(NOLOCK) ON h.site = sup.site AND (NULLIF(LTRIM(RTRIM(h.customer_id)), '') IS NULL OR c.CustomerID IS NULL) AND LTRIM(RTRIM(h.customer_id)) = sup.SupplierID
LEFT JOIN Supplier sup WITH(NOLOCK) ON h.site = sup.site AND (NULLIF(LTRIM(RTRIM(h.customer_id)), '') IS NULL OR c.CustomerID IS NULL) AND LTRIM(RTRIM(h.customer_id)) = sup.SupplierID
LEFT JOIN outbound_notification_detail d WITH(NOLOCK) ON h.site = d.site AND h.bu_no = d.bu_no AND h.order_no = d.order_no
LEFT JOIN outbound_notification_detail d WITH(NOLOCK) ON h.site = d.site AND h.bu_no = d.bu_no AND h.order_no = d.order_no
LEFT JOIN part p WITH(NOLOCK) ON d.site = p.site AND d.bu_no = p.bu_no AND d.part_no = p.partNo
<where>
<where>
h.site IN (SELECT site FROM AccessSite WHERE UPPER(userID) = UPPER(#{userName}))
h.site IN (SELECT site FROM AccessSite WHERE UPPER(userID) = UPPER(#{userName}))
AND h.bu_no IN (SELECT bu_no FROM AccessBu WHERE UPPER(username) = UPPER(#{userName}))
AND h.bu_no IN (SELECT bu_no FROM AccessBu WHERE UPPER(username) = UPPER(#{userName}))
@ -156,6 +162,9 @@
<iftest="query.partDesc != null and query.partDesc != ''">
<iftest="query.partDesc != null and query.partDesc != ''">
AND d.part_desc LIKE '%' + #{query.partDesc} + '%'
AND d.part_desc LIKE '%' + #{query.partDesc} + '%'
</if>
</if>
<iftest="query.spec != null and query.spec != ''">
AND p.Spec LIKE '%' + #{query.spec} + '%'
</if>
<iftest="query.startDate != null">
<iftest="query.startDate != null">
AND h.required_outbound_date >= #{query.startDate}
AND h.required_outbound_date >= #{query.startDate}