diff --git a/src/main/resources/mapper/otherInbound/OtherInboundMapper.xml b/src/main/resources/mapper/otherInbound/OtherInboundMapper.xml index eab847c..d019d91 100644 --- a/src/main/resources/mapper/otherInbound/OtherInboundMapper.xml +++ b/src/main/resources/mapper/otherInbound/OtherInboundMapper.xml @@ -14,7 +14,9 @@ SUM(CASE WHEN pr.hardtag_in_flag = '已入库' THEN 1 ELSE 0 END) AS labelinCount, -- 已入库标签数 COUNT(DISTINCT pr.roll_no) AS totalLabels, -- 需入库标签数 SUM(CASE WHEN pr.hardtag_in_flag = '已入库' THEN ISNULL(pr.roll_qty, 0) ELSE 0 END) AS totalinLabels, -- 已入库物料总数 - SUM(CAST(D.required_qty AS float)) as labelCount --需入库总数 + SUM(CAST(D.required_qty AS float)) as labelCount, --需入库总数 + d.related_order_no AS relatedOrderNo, -- 关联单号 + d.related_order_line_no AS relatedOrderLineNo -- 关联行号 FROM inbound_notification_head h INNER JOIN inbound_notification_detail d ON h.site = d.site and h.bu_no = d.bu_no and h.order_no = d.order_no LEFT JOIN po_order_roll_no pr ON d.site = pr.site and d.bu_no = pr.bu_no and d.inspection_no = pr.inspection_no AND d.part_no = pr.part_no @@ -29,7 +31,7 @@ - GROUP BY h.site,h.bu_no,h.order_no,h.required_inbound_date + GROUP BY h.site,h.bu_no,h.order_no,h.required_inbound_date,d.related_order_no,d.related_order_line_no ORDER BY h.required_inbound_date DESC @@ -45,7 +47,9 @@ SUM(CASE WHEN hardtag_in_flag = '已入库' then 1 else 0 end) labelinCount, --已入库标签数 COUNT(DISTINCT pr.roll_no) as totalLabels , --需入库标签数 SUM(CASE WHEN hardtag_in_flag = '已入库' then CAST(roll_qty AS float) else 0 end) totalinLabels,--已入库物料总数 - SUM(CAST(D.required_qty AS float)) as labelCount --需入库总数 + SUM(CAST(D.required_qty AS float)) as labelCount, --需入库总数 + d.related_order_no as relatedOrderNo, --关联单号 + d.related_order_line_no as relatedOrderLineNo --关联行号 FROM inbound_notification_head h INNER JOIN inbound_notification_detail d ON h.site = d.site and h.bu_no = d.bu_no and h.order_no = d.order_no LEFT JOIN po_order_roll_no pr ON d.site = pr.site and d.bu_no = pr.bu_no and d.inspection_no = pr.inspection_no AND d.part_no = pr.part_no @@ -53,7 +57,7 @@ h.site = #{site} AND h.bu_no = #{buNo} AND h.order_no = #{inboundNo} - GROUP BY h.order_no, h.site, h.bu_no, h.required_inbound_date + GROUP BY h.order_no, h.site, h.bu_no, h.required_inbound_date, d.related_order_no, d.related_order_line_no diff --git a/src/main/resources/mapper/salesReturn/SalesReturnMapper.xml b/src/main/resources/mapper/salesReturn/SalesReturnMapper.xml index ad01c3d..7db328d 100644 --- a/src/main/resources/mapper/salesReturn/SalesReturnMapper.xml +++ b/src/main/resources/mapper/salesReturn/SalesReturnMapper.xml @@ -15,7 +15,9 @@ 0 AS labelinCount, -- 已入库标签数 0 AS totalLabels, -- 需入库标签数 0 AS totalinLabels, -- 已入库物料总数 - ISNULL(d.required_qty, 0) AS labelCount -- 需入库总数 + ISNULL(d.required_qty, 0) AS labelCount, -- 需入库总数 + d.related_order_no AS relatedOrderNo, -- 关联单号 + d.related_order_line_no AS relatedOrderLineNo -- 关联行号 FROM inbound_notification_head h INNER JOIN inbound_notification_detail d ON h.order_no = d.order_no AND h.site = d.site WHERE h.site = #{site} and h.bu_no in (select bu_no from AccessBu where username = #{userName}) @@ -36,7 +38,9 @@ h.bu_no, h.order_no, h.required_inbound_date, - d.required_qty + d.required_qty, + d.related_order_no, + d.related_order_line_no ORDER BY h.required_inbound_date DESC @@ -53,7 +57,9 @@ 0 as labelinCount, --已入库标签数 0 as totalLabels, --需入库标签数 0 as totalinLabels,--已入库物料总数 - SUM(CAST(D.required_qty AS float)) as labelCount --需入库总数 + SUM(CAST(D.required_qty AS float)) as labelCount, --需入库总数 + d.related_order_no as relatedOrderNo, --关联单号 + d.related_order_line_no as relatedOrderLineNo --关联行号 FROM inbound_notification_head h INNER JOIN inbound_notification_detail d ON h.order_no = d.order_no AND h.site = d.site WHERE @@ -61,7 +67,7 @@ AND h.bu_no = #{buNo} AND h.order_no = #{returnNo} AND h.order_type = '销售退货' - GROUP BY h.order_no, h.site, h.bu_no, d.in_batch_no, d.required_qty + GROUP BY h.order_no, h.site, h.bu_no, d.in_batch_no, d.required_qty, d.related_order_no, d.related_order_line_no