|
|
|
@ -70,13 +70,20 @@ |
|
|
|
set [status]=#{status} |
|
|
|
where id=#{id} |
|
|
|
</update> |
|
|
|
<select id="selectByRollNo" resultType="InventoryStock"> |
|
|
|
<select id="selectByRollNo" resultType="com.gaotao.modules.inventoryStock.entity.InventoryStock"> |
|
|
|
SELECT * |
|
|
|
FROM inventory_stock |
|
|
|
WHERE roll_no = #{rollNo} |
|
|
|
AND site = #{site} |
|
|
|
AND bu_no = #{buNo} |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="selectByRollNo2" resultType="com.gaotao.modules.inventoryStock.entity.InventoryStock"> |
|
|
|
SELECT * |
|
|
|
FROM inventory_stock |
|
|
|
WHERE parent_roll_no = #{rollNo} |
|
|
|
AND site = #{site} |
|
|
|
AND bu_no = #{buNo} |
|
|
|
</select> |
|
|
|
|
|
|
|
<update id="updateStockParentRollNo"> |
|
|
|
@ -99,7 +106,7 @@ |
|
|
|
and bu_no = #{buNo} |
|
|
|
</update> |
|
|
|
|
|
|
|
<select id="searchOutboundNotificationDetail" resultType="OutboundNotificationDetailEntity"> |
|
|
|
<select id="searchOutboundNotificationDetail" resultType="com.gaotao.modules.outboundNotification.entity.OutboundNotificationDetailEntity"> |
|
|
|
select site,bu_no,order_no,part_no,part_desc,unit,required_qty,out_warehouse,out_batch_no,created_by,created_date,updated_by, |
|
|
|
updated_date,order_qty,related_order_no,related_order_line_no |
|
|
|
from outbound_notification_detail |
|
|
|
@ -227,4 +234,104 @@ |
|
|
|
AND site = #{site} |
|
|
|
AND bu_no = #{buNo} |
|
|
|
</update> |
|
|
|
|
|
|
|
<!-- 查询出库通知单主记录(关联明细) --> |
|
|
|
<select id="searchOutboundNotificationWithDetail" resultType="com.gaotao.modules.outboundNotification.entity.vo.OutboundNotificationHeadVo"> |
|
|
|
SELECT |
|
|
|
a.site, |
|
|
|
a.bu_no as buNo, |
|
|
|
dbo.get_bu_desc(a.site, a.bu_no) as buDesc, |
|
|
|
a.order_no as orderNo, |
|
|
|
a.order_type as orderType, |
|
|
|
a.order_status as orderStatus, |
|
|
|
a.customer_id as customerId, |
|
|
|
c.customerName, |
|
|
|
a.related_order_no as relatedOrderNo, |
|
|
|
a.related_order_line_no as relatedOrderLineNo, |
|
|
|
a.required_outbound_date as requiredOutboundDate, |
|
|
|
a.remarks, |
|
|
|
a.erp_order_no as erpOrderNo, |
|
|
|
a.erp_order_line_no as erpOrderLineNo, |
|
|
|
a.erp_order_date as erpOrderDate, |
|
|
|
a.created_by as createdBy, |
|
|
|
a.created_date as createdDate, |
|
|
|
a.updated_by as updatedBy, |
|
|
|
a.updated_date as updatedDate, |
|
|
|
a.assigned_by as assignedBy, |
|
|
|
a.assigned_date as assignedDate, |
|
|
|
a.closed_by as closedBy, |
|
|
|
a.closed_date as closedDate, |
|
|
|
a.archived_by as archivedBy, |
|
|
|
a.archived_date as archivedDate, |
|
|
|
a.orderref1, |
|
|
|
a.orderref2, |
|
|
|
a.orderref3, |
|
|
|
a.orderref4, |
|
|
|
a.orderref5, |
|
|
|
a.order_date as orderDate, |
|
|
|
a.close_flag as closeFlag, |
|
|
|
a.out_warehouse as outWarehouse, |
|
|
|
a.customer_order_no as customerOrderNo, |
|
|
|
a.show_in_query_flag as showInQueryFlag, |
|
|
|
<!-- 关联明细信息 --> |
|
|
|
b.part_no as partNo, |
|
|
|
b.part_desc as partDesc, |
|
|
|
b.unit, |
|
|
|
b.required_qty as requiredQty, |
|
|
|
b.out_warehouse as detailOutWarehouse, |
|
|
|
b.out_batch_no as outBatchNo, |
|
|
|
b.order_qty as orderQty, |
|
|
|
b.related_order_no as detailRelatedOrderNo, |
|
|
|
b.related_order_line_no as detailRelatedOrderLineNo, |
|
|
|
<!-- 已扫描数量和未扫描数量 --> |
|
|
|
ISNULL(SUM(e.roll_qty), 0) as rollQty, |
|
|
|
CASE WHEN b.required_qty - ISNULL(SUM(e.roll_qty), 0) > 0 |
|
|
|
THEN ROUND(b.required_qty - ISNULL(SUM(e.roll_qty), 0), 3) |
|
|
|
ELSE 0 |
|
|
|
END as unScanQty |
|
|
|
FROM outbound_notification_head a |
|
|
|
LEFT JOIN Customer c ON a.site = c.site AND a.customer_id = c.CustomerID |
|
|
|
LEFT JOIN outbound_notification_detail b ON a.site = b.site AND a.bu_no = b.bu_no AND a.order_no = b.order_no |
|
|
|
LEFT JOIN so_receive_boxes d ON b.site = d.site AND b.bu_no = d.bu_no AND b.order_no = d.order_no |
|
|
|
LEFT JOIN so_receive_box_rolls e ON b.site = e.site AND b.bu_no = e.bu_no AND d.box_no = e.box_no AND b.part_no = e.part_no |
|
|
|
<where> |
|
|
|
<if test="site != null and site != ''"> |
|
|
|
AND a.site = #{site} |
|
|
|
</if> |
|
|
|
<if test="buNo != null and buNo != ''"> |
|
|
|
AND a.bu_no = #{buNo} |
|
|
|
</if> |
|
|
|
<if test="orderNo != null and orderNo != ''"> |
|
|
|
AND a.order_no LIKE '%' + #{orderNo} + '%' |
|
|
|
</if> |
|
|
|
<if test="orderType != null and orderType != ''"> |
|
|
|
AND a.order_type = #{orderType} |
|
|
|
</if> |
|
|
|
<if test="orderStatus != null and orderStatus != ''"> |
|
|
|
AND a.order_status = #{orderStatus} |
|
|
|
</if> |
|
|
|
<if test="customerId != null and customerId != ''"> |
|
|
|
AND a.customer_id LIKE '%' + #{customerId} + '%' |
|
|
|
</if> |
|
|
|
<if test="customerName != null and customerName != ''"> |
|
|
|
AND c.customerName LIKE '%' + #{customerName} + '%' |
|
|
|
</if> |
|
|
|
<if test="startDate != null"> |
|
|
|
AND a.required_outbound_date >= #{startDate} |
|
|
|
</if> |
|
|
|
<if test="endDate != null"> |
|
|
|
AND #{endDate} >= a.required_outbound_date |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
GROUP BY |
|
|
|
a.site, a.bu_no, a.order_no, a.order_type, a.order_status, a.customer_id, c.customerName, |
|
|
|
a.related_order_no, a.related_order_line_no, a.required_outbound_date, a.remarks, |
|
|
|
a.erp_order_no, a.erp_order_line_no, a.erp_order_date, a.created_by, a.created_date, |
|
|
|
a.updated_by, a.updated_date, a.assigned_by, a.assigned_date, a.closed_by, a.closed_date, |
|
|
|
a.archived_by, a.archived_date, a.orderref1, a.orderref2, a.orderref3, a.orderref4, a.orderref5, |
|
|
|
a.order_date, a.close_flag, a.out_warehouse, a.customer_order_no, a.show_in_query_flag, |
|
|
|
b.part_no, b.part_desc, b.unit, b.required_qty, b.out_warehouse, b.out_batch_no, b.order_qty, |
|
|
|
b.related_order_no, b.related_order_line_no |
|
|
|
ORDER BY a.created_date DESC, b.part_no |
|
|
|
</select> |
|
|
|
</mapper> |