Browse Source

2025-11-17

销售发货装箱优化
master
fengyuan_yang 2 months ago
parent
commit
d90449d35f
  1. 2
      src/main/java/com/gaotao/modules/boxManage/data/SoReceiveBoxesData.java
  2. 4
      src/main/java/com/gaotao/modules/boxManage/data/SoReceiveCasesData.java
  3. 4
      src/main/java/com/gaotao/modules/boxManage/data/SoReceivePalletsData.java
  4. 66
      src/main/resources/mapper/boxManage/BoxForNotificationMapper.xml

2
src/main/java/com/gaotao/modules/boxManage/data/SoReceiveBoxesData.java

@ -10,4 +10,6 @@ public class SoReceiveBoxesData extends SoReceiveBoxesDto {
private String wareHouseName; private String wareHouseName;
private Integer flag; private Integer flag;
private Integer rollsCount; private Integer rollsCount;
private Integer boxCount;
private Integer rollCount;
} }

4
src/main/java/com/gaotao/modules/boxManage/data/SoReceiveCasesData.java

@ -24,6 +24,10 @@ public class SoReceiveCasesData extends SoReceiveCases {
* 上级标签类型 * 上级标签类型
*/ */
private String parentRollType; private String parentRollType;
private Integer boxCountCases;
private Integer boxCountRolls;
private Integer totalQty;
} }

4
src/main/java/com/gaotao/modules/boxManage/data/SoReceivePalletsData.java

@ -9,5 +9,9 @@ import org.apache.ibatis.type.Alias;
public class SoReceivePalletsData extends SoReceivePalletsDto { public class SoReceivePalletsData extends SoReceivePalletsDto {
private Integer flag; private Integer flag;
private Integer boxesCount; private Integer boxesCount;
private Integer palletCount;
private Integer rollCount;
private Integer rollsQty;
} }

66
src/main/resources/mapper/boxManage/BoxForNotificationMapper.xml

@ -20,9 +20,22 @@
s.version, s.version,
w.WareHouseName as wareHouseName, w.WareHouseName as wareHouseName,
s.bu_no, s.bu_no,
ISNULL((SELECT SUM(roll_qty) FROM so_receive_box_rolls t WHERE S.site = t.site AND s.bu_no =t.bu_no AND S.box_no = t.box_no) ,0) AS rollsCount
from so_receive_boxes s
left join warehouse w on s.WareHouseID = w.WareHouseID and s.site = w.site and s.bu_no = w.bu_no
T.box_count as boxCount,
T.roll_count as rollCount,
T.rollsCount as rollsCount
from so_receive_boxes s with(nolock)
left join warehouse w with(nolock) on s.WareHouseID = w.WareHouseID and s.site = w.site and s.bu_no = w.bu_no
left JOIN (
select
a.site,
a.bu_no,
a.order_no,
COUNT(DISTINCT a.box_no) AS box_count, --箱标签张数
COUNT(DISTINCT b.final_roll_no) AS roll_count, --卷标签张数
ISNULL(SUM(roll_qty),0) AS rollsCount --物料总数
from so_receive_boxes a with(nolock)
LEFT join so_receive_box_rolls b with(nolock) on a.site = b.site and a.bu_no = b.bu_no and a.box_no = b.box_no
WHERE a.SITE = #{site} AND a.bu_no = #{buNo} and a.order_no = #{orderNo} group by a.site, a.bu_no, a.order_no) T ON S.site = T.site AND S.bu_no = T.bu_no AND S.order_no = T.order_no
<where> <where>
s.site = #{site} and s.bu_no = #{buNo} s.site = #{site} and s.bu_no = #{buNo}
<if test="orderNo != null and orderNo != ''"> <if test="orderNo != null and orderNo != ''">
@ -210,8 +223,22 @@
s.create_by as createBy, s.create_by as createBy,
s.Remark as remark, s.Remark as remark,
s.site, s.site,
s.bu_no as buNo
FROM so_receive_cases s
s.bu_no as buNo,
agg.box_count_cases as boxCountCases,
agg.box_count_rolls as boxCountRolls,
agg.total_qty as totalQty
FROM so_receive_cases s WITH(NOLOCK)
LEFT JOIN (
SELECT
site,
NotifyNo,
COUNT(DISTINCT cases_no) AS box_count_cases, --盒标签张数
COUNT(DISTINCT roll_no) AS box_count_rolls, --卷标签张数
SUM(roll_qty) AS total_qty --物料总数
FROM so_receive_cases WITH(NOLOCK)
WHERE site = #{site} and NotifyNo = #{notifyNo}
GROUP BY site, NotifyNo
) as agg ON s.site = agg.site AND s.NotifyNo = agg.NotifyNo
<where> <where>
s.site = #{site} AND s.bu_no = #{buNo} s.site = #{site} AND s.bu_no = #{buNo}
<if test="notifyNo != null and notifyNo != ''"> <if test="notifyNo != null and notifyNo != ''">
@ -438,16 +465,25 @@
s.update_date as updateDate, s.update_date as updateDate,
s.update_by as updateBy, s.update_by as updateBy,
s.version, s.version,
(SELECT ISNULL(SUM(P.roll_qty), 0)
FROM so_receive_pallet_boxes T WITH(NOLOCK)
INNER JOIN so_receive_box_rolls P WITH(NOLOCK)
ON P.site = T.site
AND P.bu_no = T.bu_no
AND P.box_no = T.box_no
WHERE T.site = s.site
AND T.bu_no = s.bu_no
AND T.pallet_no = s.pallet_no) as boxesCount
FROM so_receive_pallets s
ISNULL(pallet_count, 0) as palletCount,
ISNULL(boxesCount, 0) as boxesCount,
ISNULL(rollCount, 0) as rollCount,
ISNULL(rollsQty, 0) as rollsQty
FROM so_receive_pallets s with(nolock)
LEFT JOIN (
select
a.site,
a.bu_no,
a.order_no,
COUNT(DISTINCT a.pallet_no) AS pallet_count, -- 托数量
COUNT(DISTINCT B.box_no) AS boxesCount, -- 箱标签张数
COUNT(DISTINCT c.final_roll_no) AS rollCount, -- 卷标签张数
ISNULL(SUM(c.roll_qty), 0) AS rollsQty -- 物料总数
from so_receive_pallets A with(nolock)
INNER JOIN so_receive_pallet_boxes B with(nolock) ON A.site = B.site AND A.pallet_no = B.pallet_no
INNER JOIN so_receive_box_rolls C with(nolock) ON C.site = B.site AND B.box_no = C.box_no
WHERE a.SITE = #{site} AND a.bu_no = #{buNo} and a.order_no = #{orderNo} group by a.site, a.bu_no, a.order_no
) T ON S.site = T.site AND S.bu_no = T.bu_no AND S.order_no = T.order_no
WHERE s.site = #{site} WHERE s.site = #{site}
AND s.bu_no = #{buNo} AND s.bu_no = #{buNo}
AND s.order_no = #{orderNo} AND s.order_no = #{orderNo}

Loading…
Cancel
Save