Browse Source

面辅料、托书、成本分配表调整

huxy 11 months ago
parent
commit
4016471a4e
18 changed files with 329 additions and 93 deletions
  1. 104 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/xml/SyCostAllocationFabricMapper.xml
  2. 77 36
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/service/impl/SyCostAllocationServiceImpl.java
  3. 15 13
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/letterDeposit/mapper/xml/SyLetterDepositMapper.xml
  4. 8 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/shippingDetails/controller/SyShippingDetailsController.java
  5. 12 11
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/shippingDetails/mapper/xml/SyShippingDetailsMapper.xml
  6. 16 9
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/shippingDetails/service/impl/SyShippingDetailsServiceImpl.java
  7. 5 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/controller/SyShippingOrderController.java
  8. 3 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/entity/SyShippingOrderItem.java
  9. 2 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/entity/VO/SyPackingList.java
  10. 3 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/mapper/SyShippingOrderMapper.java
  11. 16 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/mapper/xml/SyShippingOrderMapper.xml
  12. 5 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/service/impl/SyShippingOrderServiceImpl.java
  13. 11 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/controller/SyPreAssembledPackingListController.java
  14. 12 8
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/mapper/xml/SyPreAssembledPackingListMapper.xml
  15. 5 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/vo/SyPreAssembledPackingListVo.java
  16. 24 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/mapper/xml/SyPackingListFabricItemMapper.xml
  17. 10 6
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/service/impl/SyPackingListFabricServiceImpl.java
  18. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/service/impl/SyPackingListTailoringServiceImpl.java

+ 104 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/xml/SyCostAllocationFabricMapper.xml

@@ -192,6 +192,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
 
 
 <!--	面料转入数量链接方法-->
+
 	<select id="queryTransferByFabric" resultType="org.jeecg.modules.cost.entity.SyTransfer">
 
 		select
@@ -292,6 +293,109 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
     </select>
 
 
+
+	<!--	面料转入数量链接方法-->
+	<!--<select id="queryTransferByFabric" resultType="org.jeecg.modules.cost.entity.SyTransfer">
+
+		select
+		tab2.cinvName as goodsName,tab2.cFree1 as color,tab2.cBatch as planCode,
+		tab2.jian-isnull(tab1.purchaseQuantity,0) as number
+		from
+		(
+		select i.cInvName,sum(rs.iQuantity) as purchaseQuantity,rs.cBatch,rs.cFree1 from UFDATA_101_2021.dbo.rdrecords01 rs
+		join UFDATA_101_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
+		where cPOID in (
+		select distinct om.cPOID
+		from UFDATA_101_2021.dbo.PO_POmain om
+		join UFDATA_101_2021.dbo.PO_PODetails od on om.poid=od.poid
+		join UFDATA_101_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
+		WHERE om.cVerifier is not null  and (om.cCloser is null or om.cCloser!='asuser')
+		and om.cPOID like CONCAT(#{code},'%')
+		)
+		GROUP BY i.cInvName,rs.cBatch,rs.cFree1
+		union all
+		select i.cInvName,sum(rs.iQuantity) as purchaseQuantity,rs.cBatch,rs.cFree1 from UFDATA_101_2021.dbo.rdrecords01 rs
+		join UFDATA_101_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
+		where cPOID in (
+		select distinct om.cCode
+		from UFDATA_101_2021.dbo.om_momain om
+		join UFDATA_101_2021.dbo.OM_MODetails od on om.moid=od.moid
+		join UFDATA_101_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
+		WHERE om.cVerifier is not null  and omi.cInvCcode like '19%'
+		and om.cCode like CONCAT(#{code},'%')
+		)
+		GROUP BY i.cInvName,rs.cBatch,rs.cFree1
+		)tab1
+		right join
+		(
+		select i.cInvName,sum(rs.iQuantity) as jian,rs.cBatch,rs.cFree1 from UFDATA_101_2021.dbo.rdrecords11 rs
+		join UFDATA_101_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
+		where comcode in (
+		select distinct om.ccode
+		from UFDATA_101_2021.dbo.om_momain om
+		join UFDATA_101_2021.dbo.OM_MODetails od on om.moid=od.moid
+		join UFDATA_101_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
+		WHERE om.iVerifyStateNew = 2
+		and omi.cInvCcode like '19%' and om.cCode like CONCAT(#{code},'%')
+		)
+		GROUP BY i.cInvName,rs.cBatch,rs.cFree1
+		)tab2 on tab2.cInvName=tab1.cInvName and tab2.cBatch=tab1.cBatch and tab1.cfree1=tab2.cfree1
+		where /*tab2.jian-isnull(tab1.purchaseQuantity,0) > 0 and */
+		tab2.jian-isnull(tab1.purchaseQuantity,0) != 0 and
+		tab2.cinvName = #{goodName}
+
+		union all
+
+		select
+		tab2.cinvName as goodsName,tab2.cFree1 as color,tab2.cBatch as planCode,
+		tab2.jian-isnull(tab1.purchaseQuantity,0) as number
+		from
+		(
+
+		select i.cInvName,sum(rs.iQuantity) as purchaseQuantity,rs.cBatch,rs.cFree1 from UFDATA_103_2021.dbo.rdrecords01 rs
+		join UFDATA_103_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
+		where cPOID in (
+		select distinct om.cPOID
+		from UFDATA_103_2021.dbo.PO_POmain om
+		join UFDATA_103_2021.dbo.PO_PODetails od on om.poid=od.poid
+		join UFDATA_103_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
+		WHERE om.cVerifier is not null and (om.cCloser is null or om.cCloser!='asuser')
+		and om.cPOID like CONCAT(#{code},'%')
+		)
+		GROUP BY i.cInvName,rs.cBatch,rs.cFree1
+		union all
+		select i.cInvName,sum(rs.iQuantity) as purchaseQuantity,rs.cBatch,rs.cFree1 from UFDATA_103_2021.dbo.rdrecords01 rs
+		join UFDATA_103_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
+		where cPOID in (
+		select distinct om.cCode
+		from UFDATA_103_2021.dbo.om_momain om
+		join UFDATA_103_2021.dbo.OM_MODetails od on om.moid=od.moid
+		join UFDATA_103_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
+		WHERE om.cVerifier is not null  and omi.cInvCcode like '19%'
+		and om.cCode like CONCAT(#{code},'%')
+		)
+		GROUP BY i.cInvName,rs.cBatch,rs.cFree1
+		)tab1
+		right join
+		(
+		select i.cInvName,sum(rs.iQuantity) as jian,rs.cBatch,rs.cFree1 from UFDATA_103_2021.dbo.rdrecords11 rs
+		join UFDATA_103_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
+		where comcode in (
+		select distinct om.ccode
+		from UFDATA_103_2021.dbo.om_momain om
+		join UFDATA_103_2021.dbo.OM_MODetails od on om.moid=od.moid
+		join UFDATA_103_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
+		WHERE om.iVerifyStateNew = 2
+		and omi.cInvCcode like '19%' and om.cCode like CONCAT(#{code},'%')
+		)
+		GROUP BY i.cInvName,rs.cBatch,rs.cFree1
+		)tab2 on tab2.cInvName=tab1.cInvName and tab2.cBatch=tab1.cBatch and tab1.cfree1=tab2.cfree1
+		where /*tab2.jian-isnull(tab1.purchaseQuantity,0) > 0 and */
+		tab2.jian-isnull(tab1.purchaseQuantity,0) != 0 and
+		tab2.cinvName = #{goodName}
+
+    </select>-->
+
 	<!--	面料余下数量链接方法-->
 	<select id="queryRemainingByFabric2" resultType="org.jeecg.modules.cost.entity.SyRemaining">
 		select oti.cInvName as goodsName,ot.cFree1 as color,max(om.ccode) as planCode,sum(ot.iQuantity) as number

+ 77 - 36
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/service/impl/SyCostAllocationServiceImpl.java

@@ -227,9 +227,13 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
             fabricLoss1 = JSON.parseObject(JSON.toJSONString(syLossReport1.getContent()), FabricLoss.class);
             syCostAllocation.setFabriccostIncludestax(new BigDecimal(fabricLoss1.getActualMoney()));
             syCostAllocation.setFabriccostNotincludestax(syCostAllocation.getFabriccostIncludestax().divide(new BigDecimal(1.13),2,BigDecimal.ROUND_HALF_UP));
+//            System.out.println("面辅料人名币含税成本\t"+syCostAllocation.getFabriccostIncludestax());
+//            System.out.println("面辅料人名币不含税成本\t"+syCostAllocation.getFabriccostNotincludestax());
             //美元面料含税成本和不含税成本
             syCostAllocation.setFabriccostIncludestaxUsd(syCostAllocation.getFabriccostIncludestax().divide(syCostAllocation.getExchangeRate(),2,BigDecimal.ROUND_HALF_UP));
             syCostAllocation.setFabriccostNotincludestaxUsd(syCostAllocation.getFabriccostIncludestaxUsd().divide(new BigDecimal(1.13),2,BigDecimal.ROUND_HALF_UP));
+//            System.out.println("面辅料美元含税成本\t"+syCostAllocation.getFabriccostIncludestaxUsd());
+//            System.out.println("面辅料美元不含税成本\t"+syCostAllocation.getFabriccostNotincludestaxUsd());
         }
 
         /*如果出现多供应商的情况拼接 供应商*/
@@ -264,22 +268,19 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
                   -- 4.根据第三步的采购订单用计划号not like ,找出所有不是本次采购的采购订单
             2.余下:从采购起手,找到所有的采购入库,然后关联材料出库,排除掉自己使用的 就是余下的
             * */
-            //若余下数量不为0则给转入数据对象赋值
-            if(oConvertUtils.isEmpty(Fabric.getFabricremainingQuantity())){
-                Fabric.setFabricremainingQuantity(BigDecimal.ZERO);
+            //若转入数量不为0则给转入数据对象赋值
+            if(oConvertUtils.isEmpty(Fabric.getFabrictransferQuantity())){
+                Fabric.setFabrictransferQuantity(BigDecimal.ZERO);
             }
-            if(Fabric.getFabricremainingQuantity().compareTo(BigDecimal.ZERO) != 0 ){
-                List<SyRemaining> syRemaining  = syCostAllocationFabricMapper.queryRemainingByFabric(plannum,Fabric.getGoodsName());
+            if(0!=Fabric.getFabrictransferQuantity().compareTo(BigDecimal.ZERO)){
+                List<SyTransfer> transferlist  = syCostAllocationFabricMapper.queryTransferByFabric(plannum,Fabric.getGoodsName());
                 BigDecimal cost = new BigDecimal(BigInteger.ZERO);
-                for (SyRemaining syRemain:syRemaining) {
-                    System.out.println("Fabric.fabricremainingQuantity\t"+Fabric.getFabricremainingQuantity());
-                    System.out.println("syRemain.number\t"+syRemain.getNumber());
-                    System.out.println("syRemainList\n"+syRemain);
-//                    syRemain.setNumber(Fabric.getFabricremainingQuantity().toString());
+                BigDecimal quantity = new BigDecimal(BigInteger.ZERO);
+                for (SyTransfer syTransfer:transferlist) {
                     //查询单证面损数据
                     SyFabricLossReport syFabricLossReport = null;
                     QueryWrapper<SyFabricLossReport> queryWrapper = new QueryWrapper<>();
-                    queryWrapper.eq("plan_code", syRemain.getPlanCode());
+                    queryWrapper.eq("plan_code", syTransfer.getPlanCode());
                     List<SyFabricLossReport> syFabricLossReportList = syFabricLossReportService.list(queryWrapper);
                     if (syFabricLossReportList.size()>0){
                         syFabricLossReport = syFabricLossReportList.get(0);
@@ -289,30 +290,46 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
                     if (syFabricLossReport != null){
                         fabricLoss = JSON.parseObject(JSON.toJSONString(syFabricLossReport.getContent()), FabricLoss.class);
                         for (FabricOMOrder fabricOMOrder:fabricLoss.getFabricOMOrderList2()) {
-                            if(fabricOMOrder.getCInvName().equals(syRemain.getGoodsName())){
+                            if(fabricOMOrder.getCInvName().equals(syTransfer.getGoodsName())){
                                 Double unitCost=fabricOMOrder.getFabricMoOrderRKList().stream().mapToDouble(FabricMoOrderRK::getIPrice).average().orElse(0d);
-                                syRemain.setUnitCost(new BigDecimal(unitCost));
-                                syRemain.setCost(syRemain.getUnitCost().multiply(new BigDecimal(syRemain.getNumber())));
-                                cost=cost.add(syRemain.getCost());
+                                syTransfer.setUnitCost(new BigDecimal(unitCost).setScale(2, RoundingMode.HALF_UP));
+                                syTransfer.getUnitCost();
+                                BigDecimal unitCost1=syTransfer.getUnitCost();
+                                BigDecimal number2=new BigDecimal(syTransfer.getNumber()).setScale(4, RoundingMode.HALF_UP);
+                                syTransfer.setCost(unitCost1.multiply(number2).setScale(2, RoundingMode.HALF_UP));
+//                                System.out.println("GoodsName\t"+syTransfer.getGoodsName()+"UnitCost\t"+syTransfer.getUnitCost());
+//                                syTransfer.setCost(syTransfer.getUnitCost().multiply(new BigDecimal(syTransfer.getNumber())));
+                                cost=cost.add(syTransfer.getCost());
                             }
                         }
                     }
+                    quantity=quantity.add(new BigDecimal(syTransfer.getNumber()));
                 }
-                Fabric.setRemainingQuantitycost(cost);
-                Fabric.setSyRemaining(syRemaining);
+                Fabric.setSyTransfers(transferlist);
+                Fabric.setFabrictransferQuantity(quantity);
+                Fabric.setTransferCost(cost);
             }
-            //若转入数量不为0则给转入数据对象赋值
-            if(oConvertUtils.isEmpty(Fabric.getFabrictransferQuantity())){
-                Fabric.setFabrictransferQuantity(BigDecimal.ZERO);
+
+            //若余下数量不为0则给转入数据对象赋值
+            if(oConvertUtils.isEmpty(Fabric.getFabricremainingQuantity())){
+                Fabric.setFabricremainingQuantity(BigDecimal.ZERO);
+            }else if (Fabric.getFabrictransferQuantity().doubleValue()>0){
+                Fabric.setFabricremainingQuantity(Fabric.getPurchaseQuantity().add(Fabric.getFabrictransferQuantity()).subtract(Fabric.getUsageQuantity()));
             }
-            if(0!=Fabric.getFabrictransferQuantity().compareTo(BigDecimal.ZERO)){
-                List<SyTransfer> transferlist  = syCostAllocationFabricMapper.queryTransferByFabric(plannum,Fabric.getGoodsName());
+            Fabric.setRemainingQuantitycost(new BigDecimal("0"));
+            if(Fabric.getFabricremainingQuantity().compareTo(BigDecimal.ZERO) != 0 ){
+                List<SyRemaining> syRemaining  = syCostAllocationFabricMapper.queryRemainingByFabric(plannum,Fabric.getGoodsName());
                 BigDecimal cost = new BigDecimal(BigInteger.ZERO);
-                for (SyTransfer syTransfer:transferlist) {
+                for (SyRemaining syRemain:syRemaining) {
+//                    System.out.println("Fabric.fabricremainingQuantity\t"+Fabric.getFabricremainingQuantity());
+//                    System.out.println("syRemain.number\t"+syRemain.getNumber());
+//                    System.out.println("syRemainList\n"+syRemain);
+//                    syRemain.setNumber(Fabric.getFabricremainingQuantity().toString());
                     //查询单证面损数据
                     SyFabricLossReport syFabricLossReport = null;
                     QueryWrapper<SyFabricLossReport> queryWrapper = new QueryWrapper<>();
-                    queryWrapper.eq("plan_code", syTransfer.getPlanCode());
+//                    queryWrapper.eq("plan_code", syRemain.getPlanCode());
+                    queryWrapper.eq("plan_code", plannum);
                     List<SyFabricLossReport> syFabricLossReportList = syFabricLossReportService.list(queryWrapper);
                     if (syFabricLossReportList.size()>0){
                         syFabricLossReport = syFabricLossReportList.get(0);
@@ -322,22 +339,42 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
                     if (syFabricLossReport != null){
                         fabricLoss = JSON.parseObject(JSON.toJSONString(syFabricLossReport.getContent()), FabricLoss.class);
                         for (FabricOMOrder fabricOMOrder:fabricLoss.getFabricOMOrderList2()) {
-                            if(fabricOMOrder.getCInvName().equals(syTransfer.getGoodsName())){
+//                            System.out.println("fabricOMOrder.cColor\t"+fabricOMOrder.getCColor()+"\tsyRemain.color\t"+syRemain.getColor());
+                            if(fabricOMOrder.getCInvName().equals(syRemain.getGoodsName())&&
+                                    fabricOMOrder.getCColor()!=null&&syRemain.getColor()!=null&&
+                                    fabricOMOrder.getCColor().equals(syRemain.getColor())){
                                 Double unitCost=fabricOMOrder.getFabricMoOrderRKList().stream().mapToDouble(FabricMoOrderRK::getIPrice).average().orElse(0d);
-                                syTransfer.setUnitCost(new BigDecimal(unitCost).setScale(2, RoundingMode.HALF_UP));
-                                syTransfer.getUnitCost();
-                                BigDecimal unitCost1=syTransfer.getUnitCost();
-                                BigDecimal number2=new BigDecimal(syTransfer.getNumber()).setScale(4, RoundingMode.HALF_UP);
-                                syTransfer.setCost(unitCost1.multiply(number2).setScale(2, RoundingMode.HALF_UP));
-//                                System.out.println("GoodsName\t"+syTransfer.getGoodsName()+"UnitCost\t"+syTransfer.getUnitCost());
-//                                syTransfer.setCost(syTransfer.getUnitCost().multiply(new BigDecimal(syTransfer.getNumber())));
-                                cost=cost.add(syTransfer.getCost());
+                                syRemain.setUnitCost(new BigDecimal(unitCost));
+                                syRemain.setCost(syRemain.getUnitCost().multiply(new BigDecimal(syRemain.getNumber())));
+//                                cost=cost.add(syRemain.getCost()).setScale(2, RoundingMode.HALF_UP);
+                                cost=cost.add(syRemain.getCost());
+//                                System.out.println("数量\t"+syRemain.getNumber()+"\t成本\t"+syRemain.getUnitCost()+"\t余下数量的成本\t"+cost);
                             }
                         }
                     }
                 }
-                Fabric.setSyTransfers(transferlist);
-                Fabric.setTransferCost(cost);
+                Fabric.setRemainingQuantitycost(cost);
+                BigDecimal costUsd=cost.divide(syCostAllocation.getExchangeRate(),4,BigDecimal.ROUND_HALF_UP);
+                System.out.println("\t含税合计人民币总价\t"+syCostAllocation.getFabriccostIncludestax()+"\t需要减去的人民币\t"+cost);
+//                System.out.println("\t不含税合计人民币总价\t"+syCostAllocation.getFabriccostNotincludestax()+"\t需要减去的人民币\t"+cost);
+//                System.out.println("\t含税合计美元总价\t"+syCostAllocation.getFabriccostIncludestaxUsd()+"\t需要减去的美元\t"+costUsd);
+//                System.out.println("\t不含税合计美元总价\t"+syCostAllocation.getFabriccostNotincludestaxUsd()+"\t需要减去的美元\t"+costUsd);
+//                System.out.println("面辅料人名币含税成本\t"+syCostAllocation.getFabriccostIncludestax());
+//                System.out.println("面辅料人名币不含税成本\t"+syCostAllocation.getFabriccostNotincludestax());
+                if(syCostAllocation!=null&&syCostAllocation.getFabriccostIncludestax()!=null){
+//                    syCostAllocation.setFabriccostIncludestax(syCostAllocation.getFabriccostIncludestax().subtract(cost).setScale(2, RoundingMode.HALF_UP));
+//                    syCostAllocation.setFabriccostIncludestaxUsd(syCostAllocation.getFabriccostIncludestaxUsd().subtract(costUsd).setScale(2, RoundingMode.HALF_UP));
+                }
+
+//                syCostAllocation.setFabriccostNotincludestax(syCostAllocation.getFabriccostNotincludestax().subtract(cost));
+//                System.out.println("\t不含税合计人民币总价\t"+syCostAllocation.getFabriccostNotincludestax());
+//                System.out.println("面辅料美元含税成本\t"+syCostAllocation.getFabriccostIncludestaxUsd());
+//                System.out.println("面辅料美元不含税成本\t"+syCostAllocation.getFabriccostNotincludestaxUsd());
+//                syCostAllocation.setFabriccostNotincludestaxUsd(syCostAllocation.getFabriccostNotincludestaxUsd().subtract(costUsd));
+////                System.out.println("余下数量的总成本\t"+Fabric.getRemainingQuantitycost());
+//                System.out.println("面辅料美元含税成本\t"+syCostAllocation.getFabriccostIncludestaxUsd());
+//                System.out.println("面辅料美元不含税成本\t"+syCostAllocation.getFabriccostNotincludestaxUsd());
+                Fabric.setSyRemaining(syRemaining);
             }
 
             //多发少发链接结合赋值
@@ -579,7 +616,11 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
 
         //清空单号 不让它显示在查询框上
         syCostAllocation.setPlanNum(plannum);
-
+        if (syCostAllocation.getShortvalue()!=null&&syCostAllocation.getShortvalue().intValue()>0){
+            BigDecimal shortvalue=(syCostAllocation.getSalesrrdersOriginaltotal().subtract(syCostAllocation.getUsdTotalexportprice())).multiply(syCostAllocation.getExchangeRate());
+            System.out.println("shortvalue\t"+shortvalue);
+            syCostAllocation.setShortvalue(shortvalue);
+        }
         return syCostAllocation;
     }
 

+ 15 - 13
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/letterDeposit/mapper/xml/SyLetterDepositMapper.xml

@@ -106,25 +106,27 @@ hod,salesman,sales_Department as salesDepartment,spur_or_sub_order as spurOrSubO
     </select>
 
     <select id="printItem" resultType="org.jeecg.modules.documents.letterDeposit.entity.SyLetterDepositItem">
-
          select itemNumber,sum(boxNumber) as boxNumber,smallPo,sum(total) as total,sum(totalGrossWeight) as totalGrossWeight,
          sum(totalNetWeight) as totalNetWeight,sum(totalVolume) as totalVolume,containerCode,containerNumber,
-         unitPrice,sum(totalPrice) as totalPrice,hod,salesman,salesDepartment,GROUP_CONCAT(DISTINCT spurOrSubOrder) as spurOrSubOrder,supplier,englishName,pcs,ctns,kgs,cbm,
-         t.clientAbbreviation,t.hod,case when t.isTc = '0' then '否' else '是' end as isTc,sum(packs) as packs
-          from(
- select a.item_number as itemNumber,a.small_po as smallPo,round(sum(a.total),2) as total,round(a.box_number,0) as boxNumber,
-round(a.total_gross_weight,2) as totalGrossWeight,round(a.total_net_weight,2) as totalNetWeight,round(a.total_volume,3) as totalVolume,
-a.container_code as containerCode,a.container_number as containerNumber,a.unit_price as unitPrice,sum(a.total_price) as totalPrice,letter_groupid as letterGroupid,
-DATE_FORMAT(a.hod,'%y-%m-%d') as hod,a.salesman,a.sales_Department as salesDepartment,a.spur_or_sub_order as spurOrSubOrder,a.supplier,a.client_abbreviation as clientAbbreviation,
-c.english_product_name as englishName,'PCS' as pcs, 'CTNS' as ctns,'KGS' as kgs,'CBM' as cbm,b.is_tc as isTc,d.packs as packs
+         unitPrice,sum(totalPrice) as totalPrice,hod,salesman,salesDepartment,GROUP_CONCAT(DISTINCT spurOrSubOrder) as spurOrSubOrder,
+         supplier,englishName,pcs,ctns,kgs,cbm,t.clientAbbreviation,t.hod,case when t.isTc = '0' then '否' else '是' end as isTc,sum(packs) as packs
+         from(select a.item_number as itemNumber,a.small_po as smallPo,round(sum(a.total),2) as total,round(a.box_number,0) as boxNumber,
+         round(a.total_gross_weight,2) as totalGrossWeight,round(a.total_net_weight,2) as totalNetWeight,round(a.total_volume,3) as totalVolume,
+         a.container_code as containerCode,a.container_number as containerNumber,a.unit_price as unitPrice,sum(a.total_price) as totalPrice,
+         letter_groupid as letterGroupid,DATE_FORMAT(a.hod,'%y-%m-%d') as hod,a.salesman,a.sales_Department as salesDepartment,
+         a.spur_or_sub_order as spurOrSubOrder,a.supplier,a.client_abbreviation as clientAbbreviation,c.english_product_name as englishName,
+         'PCS' as pcs, 'CTNS' as ctns,'KGS' as kgs,'CBM' as cbm,b.is_tc as isTc,d.packs as packs
          from sy_letter_deposit_item a
          left join sy_pre_assembled_packing_list b
          on a.sy_pre_assembled_packing_list_id = b.id
-         left join(select sy_pre_assembled_packing_list_id as sy_pre_assembled_packing_list_id,packs as packs from sy_pre_assembled_packing_list_item where del_flag = '0' group by sy_pre_assembled_packing_list_id) d
-         on d.sy_pre_assembled_packing_list_id = b.id
+         left join(select id  ,packs as packs
+         from sy_pre_assembled_packing_list_item where del_flag = '0' ) d
+         on d.id = a.sy_pre_assembled_packing_list_item_id
          left join sy_declaration_elements c
          on b.elements_id = c.id
-         where a.del_flag = 0 and a.sy_letter_deposit_id = #{id}  group by groupid  order by a.item_number,a.small_po desc
-         ) t GROUP BY t.itemNumber,t.smallPo,t.unitPrice order by t.supplier,t.salesman,t.itemNumber,t.smallPo,t.unitPrice
+         where a.del_flag = 0 and a.sy_letter_deposit_id = #{id}
+         group by groupid  order by a.item_number,a.small_po desc
+         ) t GROUP BY t.itemNumber,t.smallPo,t.unitPrice
+         order by t.supplier,t.salesman,t.itemNumber,t.smallPo,t.unitPrice
     </select>
 </mapper>

+ 8 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/shippingDetails/controller/SyShippingDetailsController.java

@@ -388,6 +388,9 @@ public class SyShippingDetailsController extends JeecgController<SyShippingDetai
 				itemIds.add(id);
 			}
 		}
+		if(itemIds.size()==0){
+			throw new JeecgBootException("未获取到勾选数据ID!");
+		}
 		//查询是否已提交
         QueryWrapper<SyShippingDetailsItem> queryWrapper = new QueryWrapper();
 		queryWrapper.in("id",itemIds).eq("submit_status","1");
@@ -1606,7 +1609,11 @@ public class SyShippingDetailsController extends JeecgController<SyShippingDetai
 
 			 	li.setPreDeliveryDate1(sf.format(li.getPreDeliveryDate()));
 				 orderQuantity = orderQuantity.add(new BigDecimal(li.getShipmentQuantity()));
-				 BigDecimal p = new BigDecimal(li.getSalesUnitPrice()).multiply(li.getOrderQuantity());
+//				 System.out.println("new BigDecimal(li.getShipmentQuantity()\t"+li.getShipmentQuantity());
+				 BigDecimal p = new BigDecimal(li.getSalesUnitPrice()).multiply(new BigDecimal(li.getShipmentQuantity()));
+				 System.out.print("li.getSalesUnitPrice()\t"+li.getSalesUnitPrice());
+				 System.out.print("\tli.getShipmentQuantity()\t"+li.getShipmentQuantity());
+				 System.out.println("\torderQuantity\t"+orderQuantity);
 				 li.setPrice(p.setScale(4,BigDecimal.ROUND_DOWN).doubleValue());
 				 price = price.add(p);
 

+ 12 - 11
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/shippingDetails/mapper/xml/SyShippingDetailsMapper.xml

@@ -66,7 +66,8 @@ a.end_customer) as endCustomer,
 
 
 <select id="queryShippingDetails" resultType="org.jeecg.modules.documents.shippingDetails.entity.VO.SyShippingDetailsVo">
-    select e.declaration_name as declarationName,e.hs_code as hsCode,e.english_product_name as englishProductName,a.create_time as createTime,b.is_reference as isReference,a.id as id,GROUP_CONCAT(b.id) as itemIds,a.document_no as documentNo,a.document_date as documentDate,b.order_number as orderNumber,a.push_state,b.submit_status as submitStatus,
+    select /*e.declaration_name as declarationName,e.hs_code as hsCode,e.english_product_name as englishProductName,*/a.create_time as createTime,b.is_reference as isReference,
+    a.id as id,GROUP_CONCAT(b.id) as itemIds,a.document_no as documentNo,a.document_date as documentDate,b.order_number as orderNumber,a.push_state,b.submit_status as submitStatus,
     b.customer_abbreviation as customerAbbreviation,b.sales_department as salesDepartment,b.salesman as salesman,a.customer as customer,b.specification_and_model as specificationAndModel,
     b.small_po as smallPo,b.pack_id as packId,b.pre_delivery_date as preDeliveryDate,b.order_date as orderDate,b.inventory_ccode as inventoryCcode,
     sum(b.shipment_quantity) as shipmentQuantity,b.customs_declaration_unit_price as customsDeclarationUnitPrice,round(sum(b.order_quantity),4) as orderQuantity,
@@ -89,7 +90,7 @@ a.end_customer) as endCustomer,
      from sy_shipping_details a
 left join sy_shipping_details_item b
 on a.id = b.shipping_details_id and b.del_flag = 0
-left join sy_declaration_elements e  on b.elements_id = e.id
+/*left join sy_declaration_elements e  on b.elements_id = e.id*/
 ${ew.customSqlSegment} and  b.inventory_ccode LIKE '19%' and a.del_flag = 0
 GROUP BY b.group_id
 
@@ -314,21 +315,21 @@ ${ew.customSqlSegment}
 
     <select id="excelItem" resultType="org.jeecg.modules.documents.shippingDetails.entity.VO.SyShippingDetailsVo">
         select a.document_date as documentDate,a.document_no as documentNo,b.salesman as salesman,b.submit_status as submitStatus,
-       b.order_number as orderNumber,b.item_number as itemNumber,b.colour,b.pre_delivery_date as preDeliveryDate,b.sales_unit_price as salesUnitPrice,
+        b.order_number as orderNumber,b.item_number as itemNumber,b.colour,b.pre_delivery_date as preDeliveryDate,b.sales_unit_price as salesUnitPrice,
         b.inventory_code as inventoryCode,b.inventory_name as inventoryName,c.declaration_name as declarationName,a.create_by as createBy,a.create_time as createTime,
         b.material_composition as materialComposition,b.guangpei_gate_width as guangpeiGateWidth,b.weight as weight,b.is_reference as isReference,
         b.excess_quantity as excessQuantity,c.declaration_unit as masterMetering,b.garment_factory as garmentFactory,b.shipment_quantity as shipmentQuantity,
         b.id as itemIds,a.id as id,b.elements_id as elementsId,b.r_supplier_code as rSupplierCode,b.r_supplier as rSupplier,b.account as account,b.group_id as groupId,
         b.supplier,b.supplier_code as supplierCode,b.specification_and_model as specificationAndModel,b.inventory_ccode as inventoryCcode,b.order_quantity as orderQuantity
          from sy_shipping_details a
-left join sy_shipping_details_item b
-on a.id = b.shipping_details_id
-left join sy_declaration_elements c
-on b.elements_id = c.id
-left join sy_order_data_item d
-on b.sy_order_data_item_id = d.id
-${ew.customSqlSegment}
-and a.del_flag = 0 and b.del_flag = 0 and b.inventory_ccode NOT LIKE '19%'
+        left join sy_shipping_details_item b
+        on a.id = b.shipping_details_id
+        left join sy_declaration_elements c
+        on b.elements_id = c.id
+        left join sy_order_data_item d
+        on b.sy_order_data_item_id = d.id
+        ${ew.customSqlSegment}
+        and a.del_flag = '0' and b.del_flag = '0' and b.inventory_ccode NOT LIKE '19%'
     </select>
 
 

+ 16 - 9
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/shippingDetails/service/impl/SyShippingDetailsServiceImpl.java

@@ -66,13 +66,15 @@ public class SyShippingDetailsServiceImpl extends ServiceImpl<SyShippingDetailsM
 
 
     /**
-     * 新增发运明细
+     * 新增发运明细 surplusNum shipment_quantity shipmentquantity
      * @param syShippingDetails
      * @return
      */
     @Override
     public SyShippingDetails syShippingDetailsAdd(SyShippingDetails syShippingDetails) throws ParseException {
 
+        System.out.println("syShippingDetailsListYin\n"+syShippingDetails);
+
         int sort = 1;
         List<SyShippingDetailsItem> syShippingDetailsItemList = new ArrayList<>();
          String syId = syShippingDetails.getId();
@@ -81,14 +83,13 @@ public class SyShippingDetailsServiceImpl extends ServiceImpl<SyShippingDetailsM
          syShippingDetails.setId(id);
          //设置单据号(F2206201305854)
         if(oConvertUtils.isEmpty(syId)){
-        SimpleDateFormat sf = new SimpleDateFormat("yyMMddHHmmss");
-        SimpleDateFormat sf1 = new SimpleDateFormat("yyyy-MM-dd");
-        String createTime = sf.format(new Date());
-        syShippingDetails.setDocumentNo("F"+createTime);
-        syShippingDetails.setState("0");//状态
-        String date = sf1.format(new Date());
-        syShippingDetails.setDocumentDate(sf1.parse(date));
-
+            SimpleDateFormat sf = new SimpleDateFormat("yyMMddHHmmss");
+            SimpleDateFormat sf1 = new SimpleDateFormat("yyyy-MM-dd");
+            String createTime = sf.format(new Date());
+            syShippingDetails.setDocumentNo("F"+createTime);
+            syShippingDetails.setState("0");//状态
+            String date = sf1.format(new Date());
+            syShippingDetails.setDocumentDate(sf1.parse(date));
         }
 
         //新增子表
@@ -137,6 +138,9 @@ public class SyShippingDetailsServiceImpl extends ServiceImpl<SyShippingDetailsM
                 if(ids.contains(li.getSyOrderDataItemId())){
                     entity.setGroupId(gourpid);
                 }
+//                if (li.getSurplusNum().doubleValue()>0){
+//                    throw new JeecgBootException("");
+//                }
 
                 //设置物料成分 和 是否TC
                 //根据款号物料名称查询相同数据并赋值,(2023.03.14现改为:订单号+款号+账套+物料)
@@ -175,6 +179,8 @@ public class SyShippingDetailsServiceImpl extends ServiceImpl<SyShippingDetailsM
                 //报关要素
                 entity.setElementsId(elementId);
 
+                entity.setShipmentQuantity(li.getSurplusNum());
+
                 syShippingDetailsItemList.add(entity);
 
                 //设置主表客户
@@ -185,6 +191,7 @@ public class SyShippingDetailsServiceImpl extends ServiceImpl<SyShippingDetailsM
                 //orderDataItem.setSurplusNum(orderDataItem.getSurplusNum().subtract(li.getQuantity()));
                 //syOrderDataItemService.updateById(orderDataItem);
 
+//                System.out.println("syShippingDetailItemSSSSS"+sort+"\t"+entity.getShipmentQuantity()+"\tsurplusNum"+sort+"\t"+li.getSurplusNum());
             }
 
 

+ 5 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/controller/SyShippingOrderController.java

@@ -135,7 +135,7 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
 			queryWrapper.eq("a.id",list.get(0).getSyShippingOrderItemId());
 		}
 		if(oConvertUtils.isNotEmpty(syShippingOrder.getShippingOrderNumber())){
-			queryWrapper.like("a.shipping_order_number",syShippingOrder.getShippingOrderNumber().trim());
+			queryWrapper.likeRight("a.shipping_order_number",syShippingOrder.getShippingOrderNumber().trim());
 		}
 		if(oConvertUtils.isNotEmpty(syShippingOrder.getExportInvoiceNo())){
 			queryWrapper.eq("a.export_invoice_no",syShippingOrder.getExportInvoiceNo());
@@ -159,7 +159,11 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
 		//queryWrapper.orderByDesc("a.create_time");
 		//queryWrapper.groupBy("a.shipping_order_number");
 		Page<SyShippingOrder> page = new Page<SyShippingOrder>(pageNo, pageSize);
+//		page.setSearchCount(false);
+		long startTime = System.currentTimeMillis();
 		IPage<SyShippingOrder> pageList = syShippingOrderService.syShippingOrderPageList(page, queryWrapper,type);
+		long endTime2 = System.currentTimeMillis();
+		System.out.println("查询时间:" + (endTime2 - startTime) + "ms");
 
 		result.setSuccess(true);
 		result.setMessage("查询成功!");

+ 3 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/entity/SyShippingOrderItem.java

@@ -208,6 +208,9 @@ public class SyShippingOrderItem {
 	@ApiModelProperty(value = "单位")
 	private String masterMetering;
 
+	//成衣或面辅料分组ID
+	private String tailoringFabricGroupId;
+
 	@Excel(name = "报关单价", width = 15)
 	@ApiModelProperty(value = "报关单价")
 	private BigDecimal declarationUnitPrice;

+ 2 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/entity/VO/SyPackingList.java

@@ -144,4 +144,6 @@ public class SyPackingList {
     private String hsCode;
     //报关品名
     private String declarationName;
+    //成衣或面辅料分组ID
+    private String tailoringFabricGroupId;
 }

+ 3 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/mapper/SyShippingOrderMapper.java

@@ -24,6 +24,9 @@ public interface SyShippingOrderMapper extends BaseMapper<SyShippingOrder> {
     //分页列表查询成衣
     IPage<SyShippingOrder> syShippingOrderPageList(IPage<SyShippingOrder> page, @Param("ew") QueryWrapper<SyShippingOrder> queryWrapper,@Param("type") String type);
 
+/*    //分页列表查询成衣
+    int getCount(IPage<SyShippingOrder> page, @Param("ew") QueryWrapper<SyShippingOrder> queryWrapper );*/
+
     //查询装箱单-成衣
     IPage<SyPackingList> queryTailoring(IPage<SyPackingList> page, @Param("ew") QueryWrapper<SyPackingList> queryWrapper);
 

+ 16 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/mapper/xml/SyShippingOrderMapper.xml

@@ -18,21 +18,33 @@ a.sy_stuta as syStuta,a.is_ahaa as isAhaa
  from sy_shipping_order a
 left join sy_shipping_order_item b
 ON a.id = b.sy_shipping_order_item_id
-<if test='type == "成衣"'>
+<!--<if test='type == "成衣"'>
     left join sy_packing_list_tailoring_item c
     on b.tailoring_fabric_item_id = c.id
 </if>
         <if test='type == "面辅料"'>
             left join sy_packing_list_fabric_item c
             on b.tailoring_fabric_item_id = c.id
-        </if>
+        </if>-->
 
  ${ew.customSqlSegment}
-group by c.group_id order by a.create_time desc) t group by t.shippingOrderNumber
+/*group by c.group_id*/
+group by tailoring_Fabric_Group_Id
+order by a.create_time desc) t
+group by t.shippingOrderNumber
 
     </select>
 
-
+<!--
+    <select id="getCount" resultType="org.jeecg.modules.documents.syShippingOrder.entity.SyShippingOrder">
+        select count(1)
+		(select count(1)
+        from sy_shipping_order a
+        left join sy_shipping_order_item b
+        ON a.id = b.sy_shipping_order_item_id
+        ${ew.customSqlSegment}
+        group by shipping_Order_Number ) a
+    </select>-->
 
 <!--    查询装箱单-成衣-->
   <select id="queryTailoring" resultType="org.jeecg.modules.documents.syShippingOrder.entity.VO.SyPackingList">

+ 5 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/service/impl/SyShippingOrderServiceImpl.java

@@ -78,7 +78,9 @@ public class SyShippingOrderServiceImpl extends ServiceImpl<SyShippingOrderMappe
      */
     @Override
     public IPage<SyShippingOrder> syShippingOrderPageList(IPage<SyShippingOrder> page, QueryWrapper<SyShippingOrder> queryWrapper,String type) {
-        return syShippingOrderMapper.syShippingOrderPageList(page, queryWrapper,type);
+        IPage<SyShippingOrder> page1=syShippingOrderMapper.syShippingOrderPageList(page, queryWrapper,type);
+//        page1.setTotal();
+        return page1;
     }
 
     /**
@@ -168,6 +170,7 @@ public class SyShippingOrderServiceImpl extends ServiceImpl<SyShippingOrderMappe
                         SyShippingOrderItem syShippingOrderItem =  new SyShippingOrderItem();
 
                         syShippingOrderItem.setId(oConvertUtils.id());
+                        syShippingOrderItem.setTailoringFabricGroupId(itemli.getGroupId());
                         syShippingOrderItem.setSyShippingOrderItemId(id);
                         //设置创建人
                         syShippingOrderItem.setCreateBy(sysUser.getRealname());
@@ -259,6 +262,7 @@ public class SyShippingOrderServiceImpl extends ServiceImpl<SyShippingOrderMappe
                     for(SyPackingListTailoringItem lit:itemslist){
                         SyShippingOrderItem syShippingOrderItem =  new SyShippingOrderItem();
 
+                        syShippingOrderItem.setTailoringFabricGroupId(lit.getGroupId());
                         totalGrossWeight = totalGrossWeight.add(lit.getGrossWeight());//总毛重
                         totalNetWeight = totalNetWeight.add(lit.getNetWeight());//总净重
 

+ 11 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/controller/SyPreAssembledPackingListController.java

@@ -1787,14 +1787,24 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
             sysCount.setTotalGrossWeight(new BigDecimal("0"));
             sysCount.setTotalNetWeight(new BigDecimal("0"));
             sysCount.setTotalVolume(new BigDecimal("0"));
+            System.out.println("depositaryReceiptNomains\t"+mains.size());
             for (int i=0; i < mains.size(); i++) {//循环
                 String depositaryReceiptNo=mains.get(i).getDepositaryReceiptNo()==null?"空":mains.get(i).getDepositaryReceiptNo();//预托书号
                 String containerNumber=mains.get(i).getContainerNumber()==null?"空":mains.get(i).getContainerNumber();//集装箱代号-->改为集装箱号
+                String customerAbbreviation=mains.get(i).getCustomerAbbreviation()==null?"空":mains.get(i).getCustomerAbbreviation();//客户名称
+
                 sysCount.setTotal(sysCount.getTotal().add(mains.get(i).getTotal()));
                 sysCount.setTotalBoxes(sysCount.getTotalBoxes().add(mains.get(i).getTotalBoxes()));
                 sysCount.setTotalGrossWeight(sysCount.getTotalGrossWeight().add(mains.get(i).getTotalGrossWeight()));
                 sysCount.setTotalNetWeight(sysCount.getTotalNetWeight().add(mains.get(i).getTotalNetWeight()));
                 sysCount.setTotalVolume(sysCount.getTotalVolume().add(mains.get(i).getTotalVolume()));
+//                System.out.println("mainsItemCode"+i+"\t");
+                if(!customerAbbreviation.equals("BIG W")&&!customerAbbreviation.equals("BL")){
+                    mains.get(i).setItemCode(" ");
+                }
+//                System.out.println("mainsItemCode2"+i+"\t");
+                System.out.println("maps.containsKey(depositaryReceiptNo+containerNumber)"+maps.containsKey(depositaryReceiptNo+containerNumber));
+                System.out.println("maps.getname\t"+maps.keySet()+"\tdepositaryReceiptNo+containerNumber\t"+(depositaryReceiptNo+containerNumber));
                 if(maps.containsKey(depositaryReceiptNo+containerNumber)){
                     List<SyPreAssembledPackingListVo> sys= (List<SyPreAssembledPackingListVo>) maps.get(depositaryReceiptNo+containerNumber);
                     sys.add(mains.get(i));
@@ -1806,6 +1816,7 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
                 }
             }
             int num=0;
+            System.out.println("depositaryReceiptNo+containerNumber+maps\t"+maps.size());
             for (String key : maps.keySet()) {
                 List<SyPreAssembledPackingListVo> sys = (List<SyPreAssembledPackingListVo>) maps.get(key);
                 SyPreAssembledPackingListVo sysGroupCount=new SyPreAssembledPackingListVo();//单个分组的汇总

+ 12 - 8
jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/mapper/xml/SyPreAssembledPackingListMapper.xml

@@ -121,19 +121,21 @@
         a.customer_abbreviation,/*客户简称*/
         a.`update_time`,/*修改日期*/
         a.`status`,/*单据状态*/
-        a.total_Boxes totalboxes,/*总箱数*/
         a.`push_Status`,/*推送状态*/
         a.is_Reference,/*是否被参照*/
         b.master_Metering,/*计量单位*/
-        a.total,/*件数*/
         b.hod as  preDeliveryDate,/*预发货日期*/
-        a.total_net_weight totalnetweight,/*总净重*/
-        a.total_gross_weight totalgrossweight,/*总毛重*/
-        a.total_volume totalvolume,/*总体积*/
-        a.total_price totalprice,/*总价*/
+
+        sum(b.total) total,/*件数*/
+        b.box_Number totalboxes,/*总箱数*/
+        b.total_net_weight totalnetweight,/*总净重*/
+        b.total_gross_weight totalgrossweight,/*总毛重*/
+        b.total_volume totalvolume,/*总体积*/
+        b.total_price totalprice,/*总价*/
         /*sum(b.total) totalquantity,*/
         b.factory_Unit_Price factoryUnitPrice,/*工厂单价*/
         a.spur_or_sub_order,/*采购委外订单号*/
+        b.item_code itemCode,/*ITEM NO./SKU NO./UPC NO./PACKS CODE*/
         b.inventory_name,/*存货名称*/
         b.small_po,/*小po*/
         b.colour,/*颜色*/
@@ -144,8 +146,10 @@
     left join sy_declaration_elements c
     on a.elements_Id=c.id
     ${ew.customSqlSegment}
-    GROUP BY a.id
-    ORDER BY b.garment_Factory,a.item_Number,b.small_Po
+    /*GROUP BY a.id*/
+    GROUP BY b.group_id
+    ORDER BY item_Number,b.small_Po,b.item_code
+    /*ORDER BY b.garment_Factory,a.item_Number,b.small_Po,b.item_code*/
 	</select>
 
     <select id="selectPage3" resultType="org.jeecg.modules.spapl.entity.SyPreAssembledPackingList">

+ 5 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/vo/SyPreAssembledPackingListVo.java

@@ -207,6 +207,9 @@ public class SyPreAssembledPackingListVo {
 	@ApiModelProperty(value = "是否被参照(0:无,1:被预托书参照,2:被装箱单参照)")
 	private Integer isReference;
 
+	@ApiModelProperty(value = "ITEM NO./SKU NO./UPC NO./PACKS CODE")
+	private String itemCode;
+
 	public String str(){
 		//单据号	订单号	款号	客户(简称)	预发货日期	小po	分销点	存货名称	颜色
 		//采购/委外订单号	数量 	箱数	总净重	总毛重	总体积	集装箱代号	集装箱号	预托书号	成衣工厂
@@ -228,6 +231,7 @@ public class SyPreAssembledPackingListVo {
 		//containerCode+","+
 		containerNumber+","+
 		depositaryReceiptNo+","+
-		garmentFactory;
+		garmentFactory+","+
+		itemCode;
 	}
 }

+ 24 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/mapper/xml/SyPackingListFabricItemMapper.xml

@@ -25,7 +25,7 @@
 			 and del_flag=0
 	</select>
 
-	<select id="selectGroupIds" parameterType="java.lang.String" resultType="org.jeecg.modules.splfi.entity.SyPackingListFabricItem">
+<!--	<select id="selectGroupIds" parameterType="java.lang.String" resultType="org.jeecg.modules.splfi.entity.SyPackingListFabricItem">
 		SELECT sy_shipping_details_item_id,sum(net_Weight) net_Weight,sum(actual_Declared_Quantity) actual_Declared_Quantity,master_Metering
 		FROM  sy_packing_list_fabric_item WHERE sy_shipping_details_item_id in
 		<foreach collection="ids" item="value" index="index" open="(" separator="," close=")">
@@ -33,6 +33,29 @@
 		</foreach>
 		and del_flag=0
 		group by sy_shipping_details_item_id
+	</select>-->
+
+
+	<select id="selectGroupIds" parameterType="java.lang.String" resultType="org.jeecg.modules.splfi.entity.SyPackingListFabricItem">
+		select a.sy_shipping_details_item_id,a.master_Metering,IFNULL(b.net_Weight, 0) as net_Weight
+		,IFNULL(b.actual_Declared_Quantity, 0) actual_Declared_Quantity from
+		(SELECT sy_shipping_details_item_id,master_Metering
+		FROM  sy_packing_list_fabric_item
+		WHERE sy_shipping_details_item_id in
+			<foreach collection="ids" item="value" index="index" open="(" separator="," close=")">
+				#{value}
+			</foreach>
+			group by sy_shipping_details_item_id) a
+		left join
+		(SELECT sy_shipping_details_item_id,sum(net_Weight) net_Weight,sum(actual_Declared_Quantity) actual_Declared_Quantity
+		FROM  sy_packing_list_fabric_item
+		WHERE sy_shipping_details_item_id in
+			<foreach collection="ids" item="value" index="index" open="(" separator="," close=")">
+				#{value}
+			</foreach>
+		 	and del_flag=0
+			group by sy_shipping_details_item_id) b
+		on a.sy_shipping_details_item_id=b.sy_shipping_details_item_id
 	</select>
 
 	<select id="getSyShippingDetailsData" parameterType="java.lang.String" resultType="org.jeecg.modules.splfi.entity.SyPackingListFabricItem">

+ 10 - 6
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/service/impl/SyPackingListFabricServiceImpl.java

@@ -339,6 +339,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 			if(item2.getMasterMetering()!=null&&item2.getMasterMetering().equals("KG")){
 				actualDeclaredQuantity=item2.getNetWeight();
 			}
+			System.out.println("ItemsActualDeclaredQuantity\t"+actualDeclaredQuantity);
 			BigDecimal remainingQuantity=shipmentQuantity.subtract(actualDeclaredQuantity);//剩余数量
 			BigDecimal excessQuantity=new BigDecimal("0");//超发数量
 			if(actualDeclaredQuantity.doubleValue()>shipmentQuantity.doubleValue()){
@@ -353,6 +354,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 			updateWrapper.eq("sy_shipping_details_item_id",item.getId());
 			syPackingListFabricItemMapper.update(null,updateWrapper);
 		}
+		System.out.println("remaining_Quantity+excess_Quantity+items\n"+items3);
 		iSyShippingDetailsItemService.updateBatchById(items3);
 		/*QueryWrapper queryWrapper=new QueryWrapper();
 		queryWrapper.eq("sy_shipping_details_item_id", syShippingDetailsItemId);//出运明细id
@@ -468,9 +470,11 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 //			}
 			itemIds.add(item.getSyShippingDetailsItemId());
 		}
-		updateQuantitys(null,itemIds);
 		syPackingListFabricItemMapper.deleteByMainId(id);
-		syPackingListFabricMapper.deleteByMainId(id);
+		int row=syPackingListFabricMapper.deleteByMainId(id);
+		if (row>0){
+			updateQuantitys(null,itemIds);
+		}
 	}
 
 	/**
@@ -514,11 +518,11 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 				}
 			}
 		}
+		syPackingListFabricItemMapper.deleteByMainIds(ids);
+		syPackingListFabricMapper.deleteByMainIds(ids);
 		if(idItems.size()>0){
 			updateQuantitys(maps,idItems);
 		}
-		syPackingListFabricItemMapper.deleteByMainIds(ids);
-		syPackingListFabricMapper.deleteByMainIds(ids);
 	}
 
 	/**
@@ -1621,8 +1625,8 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 					Map<String,Object> orderDataItem2=new HashMap<>();
 					if (mapt.get("number").equals("one")){
 						String id=item.getSyOrderDataItemId();
-						if ((id.indexOf('('))>-1){
-							id=id.substring(3,id.indexOf("(")-1);
+						if ((id.indexOf('-'))>-1){
+							id=id.substring(3,id.indexOf("-"));
 						}else{
 							id=id.substring(3);
 						}

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/service/impl/SyPackingListTailoringServiceImpl.java

@@ -1315,7 +1315,7 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 						orderDataItem=syPackingListTailoringMapper.getOmOrPoItem2("PO_PoDetails", "ID='"+item.getOmpoIdItem()+"'","ID");
 					}else{
 						if(orderData!=null&&orderData.containsKey("id")){
-							orderDataItem=syPackingListTailoringMapper.getOmOrPoItem2("PO_PoDetails", "poid='"+orderData.get("id")+"' and iSOsID ='"+
+							orderDataItem=syPackingListTailoringMapper.getOmOrPoItem2("PO_PoDetails", "poid='"+orderData.get("id")+"' and iorderdid ='"+
 							((Map<String,String>)mapt.get("itemSort")).get(item.getId())+"'","ID");//根据行号获取信息
 						}
 					}