Browse Source

森语近期调整

huxy 4 months ago
parent
commit
0832be4322
49 changed files with 1590 additions and 506 deletions
  1. 3 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/controller/SyCostAllocationController.java
  2. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/entity/SyCostAllocation.java
  3. 2 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/entity/SyCostAllocationFabric.java
  4. 2 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/SyCostAllocationFabricMapper.java
  5. 2 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/SyCostAllocationIngredientMapper.java
  6. 3 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/xml/SyCostAllocationAccidentMapper.xml
  7. 61 49
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/xml/SyCostAllocationCostpayMapper.xml
  8. 67 65
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/xml/SyCostAllocationFabricMapper.xml
  9. 174 185
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/xml/SyCostAllocationIngredientMapper.xml
  10. 47 16
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/xml/SyCostAllocationMapper.xml
  11. 5 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/xml/SyCostAllocationShipdetailMapper.xml
  12. 25 10
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/service/impl/SyCostAllocationServiceImpl.java
  13. 59 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/costLossReview/controller/SyCostLossReviewController.java
  14. 18 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/costLossReview/entity/CostAllocationReview.java
  15. 4 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/costLossReview/entity/SyCostLossReview.java
  16. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/costLossReview/mapper/SyCostLossReviewMapper.java
  17. 163 14
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/costLossReview/mapper/xml/SyCostLossReviewMapper.xml
  18. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/costLossReview/service/ISyCostLossReviewService.java
  19. 6 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/costLossReview/service/impl/SyCostLossReviewServiceImpl.java
  20. 3 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/letterDeposit/mapper/SyLetterDepositMapper.java
  21. 9 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/letterDeposit/mapper/xml/SyLetterDepositMapper.xml
  22. 19 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/letterDeposit/service/impl/SyLetterDepositServiceImpl.java
  23. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/orderData/mapper/SyOrderDataItemMapper.java
  24. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/orderData/service/ISyOrderDataItemService.java
  25. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/orderData/service/impl/SyOrderDataItemServiceImpl.java
  26. 5 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/orderData/service/impl/SyOrderDataServiceImpl.java
  27. 15 15
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/shippingDetails/controller/SyShippingDetailsController.java
  28. 5 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/shippingDetails/entity/VO/SyPreAssembledPackingListVo.java
  29. 463 13
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/controller/SyShippingOrderController.java
  30. 79 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/entity/SyShippingOrder.java
  31. 93 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/entity/SyShippingOrderItem.java
  32. 7 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/mapper/SyShippingOrderMapper.java
  33. 64 12
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/mapper/xml/SyShippingOrderMapper.xml
  34. 19 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/service/impl/SyShippingOrderServiceImpl.java
  35. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/openApi/mapper/xml/PurchaseWarehousingMapper.xml
  36. 2 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/openApi/service/impl/PurchaseWarehousingServiceImpl.java
  37. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/report/service/impl/FabricLossServiceImpl.java
  38. 8 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/controller/SyPreAssembledPackingListController.java
  39. 11 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/entity/SyPreAssembledPackingList.java
  40. 2 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/entity/SyPreAssembledPackingListItem.java
  41. 39 43
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/mapper/xml/SyPreAssembledPackingListMapper.xml
  42. 7 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/service/impl/SyPreAssembledPackingListServiceImpl.java
  43. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/service/impl/SyPackingListFabricServiceImpl.java
  44. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/controller/SyPackingListTailoringController.java
  45. 2 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/mapper/SyPackingListTailoringMapper.java
  46. 2 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/mapper/xml/syPackingListTailoringItemMapper.xml
  47. 8 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/mapper/xml/syPackingListTailoringMapper.xml
  48. 67 41
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/service/impl/SyPackingListTailoringServiceImpl.java
  49. 4 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/syPlanStatistics/controller/SyPlanStatisticsController.java

+ 3 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/controller/SyCostAllocationController.java

@@ -184,7 +184,9 @@ public class SyCostAllocationController {
                             fabric1.setRemarks(fabric2.getRemarks());
                             for(SyCostAllocationFabric pilosity2 : fabric2.getPilosityFewerList()){
                                 for (SyCostAllocationFabric pilosity1 : fabric1.getPilosityFewerList()){
-                                    if (pilosity2.getGoodsName().equals(pilosity1.getGoodsName())
+                                    if (pilosity1.getGoodsName()!=null  &&pilosity2.getGoodsName()!=null
+                                        &&pilosity2.getGoodsName().equals(pilosity1.getGoodsName())
+                                        &&pilosity1.getPlanQuantity()!=null &&pilosity2.getPlanQuantity()!=null
                                         &&pilosity2.getPlanQuantity().doubleValue()==pilosity1.getPlanQuantity().doubleValue()
                                         &&pilosity2.getRemarks()!=null){
                                         pilosity1.setRemarks(pilosity2.getRemarks());

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/entity/SyCostAllocation.java

@@ -253,4 +253,9 @@ public class SyCostAllocation implements Serializable {
     //销售订单总数量
     private BigDecimal salerIquantity;
 
+    //标记(A)数量
+    private java.math.BigDecimal signNumA;
+    //标记(B)数量
+    private java.math.BigDecimal signNumB;
+
 }

+ 2 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/entity/SyCostAllocationFabric.java

@@ -29,7 +29,9 @@ import io.swagger.annotations.ApiModelProperty;
 public class SyCostAllocationFabric implements Serializable {
     private static final long serialVersionUID = 1L;
 
+    //余下数据
     List<SyRemaining> syRemaining = new ArrayList<>();
+    //转入数据
     List<SyTransfer> syTransfers = new ArrayList<>();
 
     //多发少发点进去的链接集合

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

@@ -32,6 +32,8 @@ public interface SyCostAllocationFabricMapper extends BaseMapper<SyCostAllocatio
 	List<SyTransfer> queryTransferByFabric(@Param("code") String code,@Param("goodName") String goodName);
 	@DS("multi-three")
 	List<SyRemaining> queryRemainingByFabric(@Param("code") String code, @Param("goodName") String goodName);
+	@DS("multi-three")
+	List<SyRemaining> queryRemainingByFabric2(@Param("code") String code, @Param("goodName") String goodName);
 
 	//面料sheet多发少发链接
 	@DS("multi-three")

+ 2 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/SyCostAllocationIngredientMapper.java

@@ -26,6 +26,8 @@ public interface SyCostAllocationIngredientMapper extends BaseMapper<SyCostAlloc
 	@DS("multi-three")
 	List<SyCostAllocationIngredient> queryByCostIngredient1(@Param("code") String code);
 	@DS("multi-three")
+	List<SyCostAllocationIngredient> queryByCostIngredient2(@Param("code") String code);
+	@DS("multi-three")
 	List<SyTransfer> queryTransferByIngredient(@Param("code") String code, @Param("goodName") String goodName);
 	@DS("multi-three")
 	List<SyRemaining> queryRemainingByIngredient(@Param("code") String code);

+ 3 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/xml/SyCostAllocationAccidentMapper.xml

@@ -38,7 +38,7 @@
 					left join UFDATA_101_2021.dbo.Inventory inv on inv.cInvCode=a.cInvCode
 					left join UFDATA_101_2021.dbo.Vendor ven on ven.cVenCode=ah.cvencode
 					where cPBVBillType='03'
-					 and inv.cInvName='事故单'  and ah.cDefine2 like CONCAT(#{code},'%')
+					 and inv.cInvName='事故单'  and ah.cDefine2 like CONCAT('%',#{code},'%')
 					group by ah.cPBVCode,ven.cVenAbbName,ah.cDefine2
 
 		union all
@@ -49,7 +49,7 @@
 					left join UFDATA_102_2021.dbo.Inventory inv on inv.cInvCode=a.cInvCode
 					left join UFDATA_102_2021.dbo.Vendor ven on ven.cVenCode=ah.cvencode
 					where cPBVBillType='03'
-					 and inv.cInvName='事故单'  and ah.cDefine2 like CONCAT(#{code},'%')
+					 and inv.cInvName='事故单'  and ah.cDefine2 like CONCAT('%',#{code},'%')
 					group by ah.cPBVCode,ven.cVenAbbName,ah.cDefine2
 
 		union all
@@ -60,7 +60,7 @@
 					left join UFDATA_103_2021.dbo.Inventory inv on inv.cInvCode=a.cInvCode
 					left join UFDATA_103_2021.dbo.Vendor ven on ven.cVenCode=ah.cvencode
 					where cPBVBillType='03'
-					 and inv.cInvName='事故单'  and ah.cDefine2 like CONCAT(#{code},'%')
+					 and inv.cInvName='事故单'  and ah.cDefine2 like CONCAT('%',#{code},'%')
 					group by ah.cPBVCode,ven.cVenAbbName,ah.cDefine2;
 	-->
 

+ 61 - 49
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/xml/SyCostAllocationCostpayMapper.xml

@@ -17,32 +17,32 @@
 	</select>
 
 	<select id="queryByCostPay" resultType="org.jeecg.modules.cost.entity.SyCostAllocationCostpay">
-		SELECT 101 as setNo,
-		sp.cSPVCode as disbursementSlipNo,
-		sp.cDefine10 as invoicenum,
-		sp.cMaker as preparedBy,
-		ex.cExpName as expenseItem,
-		v.cVenName as processUnit,
-			case when sps.cExpCode='00011' and sp.Cexch_Name='美元' then  sps.iMoney*sp.iexchrate
+	SELECT 101 as setNo,
+				 sp.cSPVCode as disbursementSlipNo,
+				 sp.cDefine10 as invoicenum,
+				 sp.cMaker as preparedBy,
+				 ex.cExpName as expenseItem,
+				 v.cVenName as processUnit,
+				case when sps.cExpCode='00011' and sp.Cexch_Name='美元' then  sps.iMoney*sp.iexchrate
 					when sps.cExpCode='00011' and sp.Cexch_Name='人民币' then sps.iMoney end as shuiemoney,
 		case when sps.cExpCode!='00011' and sp.Cexch_Name='美元' then sps.iMoney*sp.iexchrate
 				 when sps.cExpCode!='00011' and sp.Cexch_Name='人民币' then sps.iMoney end as disbursedLocalmoney,
 		case when sps.cExpCode!='00011' and sp.Cexch_Name ='美元' then sps.iMoney end as disbursedOriginalmoney
-		FROM
-		UFDATA_101_2021.dbo.SalePayVouch sp
+		FROM  UFDATA_101_2021.dbo.SalePayVouch sp
 		INNER JOIN UFDATA_101_2021.dbo.SalePayVouchs sps ON sp.id = sps.id
+		--费用支出对应销售订单号改动 取值通过关联销售取值
+		INNER JOIN UFDATA_101_2021.dbo.SO_SOMain soso on soso.id=sp.iSourceId
 		INNER JOIN UFDATA_101_2021.dbo.ExpenseItem ex on sps.cExpCode=ex.cExpCode
 		LEFT JOIN UFDATA_101_2021.dbo.Vendor v ON sp.cvencode= v.cVenCode
-		where sp.cSOCode
-		in (
-		SELECT s.cSOCode FROM UFDATA_101_2021.dbo.SO_SODetails s
-			JOIN (
-			SELECT od.cInvCode,od.isosid FROM UFDATA_101_2021.dbo.OM_MOMain om
-			LEFT JOIN UFDATA_101_2021.dbo.OM_MODetails od ON om.MOID = od.MOID
-			WHERE om.iVerifyStateNew = 2 AND om.cCode LIKE CONCAT(#{code},'%')
-			) o ON s.isosid = o.isosid AND s.cInvCode = o.cInvCode
-			GROUP BY s.cSOCode
-		)
+		where soso.cSOCode IN
+		--销售订单号取值范围改动
+		(select cSOCode from UFDATA_101_2021.dbo.so_somain  where cSOCode like CONCAT('%',#{code},'%')
+		union all
+		select SOSOS.cSOCode
+		from UFDATA_101_2021.dbo.om_momain ommo
+		left join UFDATA_101_2021.dbo.OM_MODetails ommos on ommos.MOID=ommo.MOID
+		left join UFDATA_101_2021.dbo.SO_SODetails sosos on sosos.iSOsID=OMMOS.isosid AND SOSOS.cInvCode=OMMOS.cInvCode
+		WHERE OMMO.cCode LIKE  CONCAT('%',#{code},'%'))
 		union all
 		SELECT 102 as setNo,
 				 sp.cSPVCode as disbursementSlipNo,
@@ -55,22 +55,28 @@
 		case when sps.cExpCode!='00011' and sp.Cexch_Name='美元' then sps.iMoney*sp.iexchrate
 				 when sps.cExpCode!='00011' and sp.Cexch_Name='人民币' then sps.iMoney end as disbursedLocalmoney,
 		case when sps.cExpCode!='00011' and sp.Cexch_Name ='美元' then sps.iMoney end as disbursedOriginalmoney
-			 FROM
-				 UFDATA_102_2021.dbo.SalePayVouch sp
-				 INNER JOIN UFDATA_102_2021.dbo.SalePayVouchs sps ON sp.id = sps.id
-				 INNER JOIN UFDATA_102_2021.dbo.ExpenseItem ex on sps.cExpCode=ex.cExpCode
-				 LEFT JOIN UFDATA_102_2021.dbo.Vendor v ON sp.cvencode= v.cVenCode
-				 where sp.cSOCode
-			 in (
-				 SELECT s.cSOCode FROM SO_SODetails s
-					 JOIN (
-					 SELECT od.cInvCode,od.isosid FROM UFDATA_102_2021.dbo.OM_MOMain om
-					 LEFT JOIN UFDATA_102_2021.dbo.OM_MODetails od ON om.MOID = od.MOID
-					 WHERE om.iVerifyStateNew = 2 AND om.cCode LIKE CONCAT(#{code},'%')
-					 ) o ON s.isosid = o.isosid AND s.cInvCode = o.cInvCode
-					 GROUP BY s.cSOCode
-				 )
+		FROM  UFDATA_102_2021.dbo.SalePayVouch sp
+		INNER JOIN UFDATA_102_2021.dbo.SalePayVouchs sps ON sp.id = sps.id
+		--费用支出对应销售订单号改动 取值通过关联销售取值
+		INNER JOIN UFDATA_102_2021.dbo.SO_SOMain soso on soso.id=sp.iSourceId
+		INNER JOIN UFDATA_102_2021.dbo.ExpenseItem ex on sps.cExpCode=ex.cExpCode
+		LEFT JOIN UFDATA_102_2021.dbo.Vendor v ON sp.cvencode= v.cVenCode
+		--销售订单号取值范围改动
+		where soso.cSOCode IN
+		(select cSOCode from UFDATA_102_2021.dbo.so_somain  where cSOCode like CONCAT('%',#{code},'%')
+		union all
+		select SOSOS.cSOCode
+		from UFDATA_102_2021.dbo.om_momain ommo
+		left join UFDATA_102_2021.dbo.OM_MODetails ommos on ommos.MOID=ommo.MOID
+		left join UFDATA_102_2021.dbo.SO_SODetails sosos on sosos.iSOsID=OMMOS.isosid AND SOSOS.cInvCode=OMMOS.cInvCode
+		WHERE OMMO.cCode LIKE  CONCAT('%',#{code},'%')
 		union all
+		select SOSOS.cSOCode
+		from UFDATA_102_2021.dbo.PO_Pomain POPO
+		left join UFDATA_102_2021.dbo.PO_Podetails POPOS on POPOS.POID=POPO.POID
+		left join UFDATA_102_2021.dbo.SO_SODetails sosos on sosos.iSOsID=POPOS.iorderdid AND SOSOS.cInvCode=POPOS.cInvCode
+		WHERE POPO.cPOID LIKE  CONCAT('%',#{code},'%'))
+		UNION ALL
 		SELECT 103 as setNo,
 				 sp.cSPVCode as disbursementSlipNo,
 				 sp.cDefine10 as invoicenum,
@@ -82,20 +88,26 @@
 		case when sps.cExpCode!='00011' and sp.Cexch_Name='美元' then sps.iMoney*sp.iexchrate
 				 when sps.cExpCode!='00011' and sp.Cexch_Name='人民币' then sps.iMoney end as disbursedLocalmoney,
 		case when sps.cExpCode!='00011' and sp.Cexch_Name ='美元' then sps.iMoney end as disbursedOriginalmoney
-			 FROM
-				 UFDATA_103_2021.dbo.SalePayVouch sp
-				 INNER JOIN UFDATA_103_2021.dbo.SalePayVouchs sps ON sp.id = sps.id
-				 INNER JOIN UFDATA_103_2021.dbo.ExpenseItem ex on sps.cExpCode=ex.cExpCode
-				 LEFT JOIN UFDATA_103_2021.dbo.Vendor v ON sp.cvencode= v.cVenCode
-				 where sp.cSOCode
-			 in (
-				 SELECT s.cSOCode FROM SO_SODetails s
-					 JOIN (
-					 SELECT od.cInvCode,od.isosid FROM UFDATA_103_2021.dbo.OM_MOMain om
-					 LEFT JOIN UFDATA_103_2021.dbo.OM_MODetails od ON om.MOID = od.MOID
-					 WHERE om.iVerifyStateNew = 2 AND om.cCode LIKE CONCAT(#{code},'%')
-					 ) o ON s.isosid = o.isosid AND s.cInvCode = o.cInvCode
-					 GROUP BY s.cSOCode
-				 );
+		FROM  UFDATA_103_2021.dbo.SalePayVouch sp
+		INNER JOIN UFDATA_103_2021.dbo.SalePayVouchs sps ON sp.id = sps.id
+		--费用支出对应销售订单号改动 取值通过关联销售取值
+		INNER JOIN UFDATA_103_2021.dbo.SO_SOMain soso on soso.id=sp.iSourceId
+		INNER JOIN UFDATA_103_2021.dbo.ExpenseItem ex on sps.cExpCode=ex.cExpCode
+		LEFT JOIN UFDATA_103_2021.dbo.Vendor v ON sp.cvencode= v.cVenCode
+		--销售订单号取值范围改动
+		where soso.cSOCode IN
+		(select cSOCode from UFDATA_103_2021.dbo.so_somain  where cSOCode like CONCAT('%',#{code},'%')
+		union all
+		select SOSOS.cSOCode
+		from UFDATA_103_2021.dbo.om_momain ommo
+		left join UFDATA_103_2021.dbo.OM_MODetails ommos on ommos.MOID=ommo.MOID
+		left join UFDATA_103_2021.dbo.SO_SODetails sosos on sosos.iSOsID=OMMOS.isosid AND SOSOS.cInvCode=OMMOS.cInvCode
+		WHERE OMMO.cCode LIKE  CONCAT('%',#{code},'%')
+		union all
+		select SOSOS.cSOCode
+		from UFDATA_103_2021.dbo.PO_Pomain POPO
+		left join UFDATA_103_2021.dbo.PO_Podetails POPOS on POPOS.POID=POPO.POID
+		left join UFDATA_103_2021.dbo.SO_SODetails sosos on sosos.iSOsID=POPOS.iorderdid AND SOSOS.cInvCode=POPOS.cInvCode
+		WHERE POPO.cPOID LIKE  CONCAT('%',#{code},'%'))
 	</select>
 </mapper>

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

@@ -18,8 +18,8 @@
 
 	<select id="queryByCostFabric2" parameterType="java.lang.String" resultType="org.jeecg.modules.cost.entity.SyCostAllocationFabric">
 
-select cInvName as goodsName from UFDATA_103_2021.dbo.VIEW_FabricLoss_Cost_Cloth
-where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
+		select cInvName as goodsName from UFDATA_103_2021.dbo.VIEW_FabricLoss_Cost_Cloth
+		where trim(cSOCode) like CONCAT('%',#{code},'%') and cSOCode not like '%样%'
 
 	</select>
 	<!--	通过视图查询-->
@@ -40,8 +40,8 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
 		(
 		select vim.cInvCode, max(vim.goodsName) as goodsName,sum(vim.unitConsumption) as unitConsumption,sum(vim.planQuantity) as planQuantity,
 		sum(vim.usageQuantity) as usageQuantity from
-		(select max(cInvCode) cInvCode,count(1) a from UFDATA_103_2021.dbo.cost_allocation_fabric_view
-		where trim(cCode) like CONCAT(#{code},'%') GROUP BY cInvCode)
+		(select max(cInvCode) cInvCode,count(1) a from UFDATA_103_2021.dbo.cost_allocation_fabric_view2
+		where trim(cCode) like CONCAT('%',#{code},'%') GROUP BY cInvCode)
 		vif
 		join(
 		select om.cCode as cCode,oti.cInvCode,max(oti.cInvName) as goodsName,sum(ot.iQuantity)/sum(od.iQuantity) as unitConsumption,sum(ot.iQuantity) as planQuantity,
@@ -53,7 +53,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
 		join UFDATA_101_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
 
 		WHERE om.iVerifyStateNew = 2
-		and om.cCode like CONCAT(#{code},'%') 	and omi.cInvCcode like '19%'
+		and om.cCode like CONCAT('%',#{code},'%') 	and omi.cInvCcode like '19%'
 		and (om.cCloser is null or ( (od.iReceivedQTY is not null or od.iReceivedQTY != 0) and (ot.iSendQTY is not null or ot.iSendQTY !=0) ) or om.cCloser='asuser')
 		GROUP BY om.cCode,oti.cInvCode
 		) vim on vim.cInvCode = vif.cInvCode
@@ -71,7 +71,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
 		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.cPOID like CONCAT(#{code},'%')
+		and om.cPOID like CONCAT('%',#{code},'%')
 		) and r.cBusType = '普通采购'
 		GROUP BY i.cInvCode
 		union all
@@ -84,7 +84,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
 		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 om.cCode like CONCAT(#{code},'%')
+		and om.cCode like CONCAT('%',#{code},'%')
 		) and r.cBusType = '委外加工'
 		GROUP BY i.cInvCode
 		)tab1
@@ -98,7 +98,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
 		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},'%')
+		and omi.cInvCcode like '19%' and om.cCode like CONCAT('%',#{code},'%')
 		)
 		GROUP BY i.cInvCode
 		)tab2 on tab2.cInvCode=tab1.cInvCode
@@ -123,8 +123,8 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
 		(
 		select vif.cInvCode, max(vim.goodsName) as goodsName,sum(vim.unitConsumption) as unitConsumption,sum(vim.planQuantity) as planQuantity,
 		sum(vim.usageQuantity) as usageQuantity from (
-		select cInvCode from UFDATA_103_2021.dbo.cost_allocation_fabric_view
-		where trim(cCode) like CONCAT(#{code},'%')
+		select cInvCode from UFDATA_103_2021.dbo.cost_allocation_fabric_view2
+		where trim(cCode) like CONCAT('%',#{code},'%')
 		GROUP BY cInvCode ) vif
 		join (
 		select oti.cInvCode as cInvCode,max(oti.cInvName) as goodsName,sum(ot.iQuantity)/sum(od.iQuantity) as unitConsumption,sum(ot.iQuantity) as planQuantity,
@@ -135,7 +135,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
 		join UFDATA_103_2021.dbo.Inventory oti on oti.cInvCode=ot.cInvCode
 		join UFDATA_103_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
 		WHERE om.iVerifyStateNew = 2
-		and om.cCode like CONCAT(#{code},'%')
+		and om.cCode like CONCAT('%',#{code},'%')
 		and omi.cInvCcode like '19%'
 		and (om.cCloser is null or ( (od.iReceivedQTY is not null or od.iReceivedQTY != 0) and (ot.iSendQTY is not null or ot.iSendQTY !=0) ) or om.cCloser='asuser')
 		GROUP BY oti.cInvCode
@@ -154,7 +154,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
 		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.cPOID like CONCAT(#{code},'%')
+		and om.cPOID like CONCAT('%',#{code},'%')
 		) and r.cBusType = '普通采购'
 		GROUP BY i.cInvCode
 		union all
@@ -167,7 +167,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
 		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 om.cCode like CONCAT(#{code},'%')
+		and om.cCode like CONCAT('%',#{code},'%')
 		) and r.cBusType = '委外加工'
 		GROUP BY i.cInvCode
 		)tab1
@@ -181,7 +181,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
 		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},'%')
+		and omi.cInvCcode like '19%' and om.cCode like CONCAT('%',#{code},'%')
 		)
 		GROUP BY i.cInvCode
 		)tab2 on tab2.cInvCode=tab1.cInvCode
@@ -209,7 +209,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
 		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},'%')
+		and om.cPOID like CONCAT('%',#{code},'%')
 		)
 		GROUP BY i.cInvName,rs.cBatch,rs.cFree1
 		union all
@@ -221,7 +221,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
 		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},'%')
+		and om.cCode like CONCAT('%',#{code},'%')
 		)
 		GROUP BY i.cInvName,rs.cBatch,rs.cFree1
 		)tab1
@@ -235,11 +235,13 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
 		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},'%')
+		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
+		)tab2 on tab2.cInvName=tab1.cInvName and tab2.cBatch=tab1.cBatch
+		and (tab1.cfree1=tab2.cfree1 or tab1.cfree1 is null and tab2.cfree1 is null )
 		where tab2.jian-isnull(tab1.purchaseQuantity,0) > 0 and tab2.cinvName = #{goodName}
+		and tab2.cBatch not  like CONCAT('%',#{code},'%')
 
 		union all
 
@@ -258,7 +260,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
 		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},'%')
+		and om.cPOID like CONCAT('%',#{code},'%')
 		)
 		GROUP BY i.cInvName,rs.cBatch,rs.cFree1
 		union all
@@ -270,7 +272,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
 		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},'%')
+		and om.cCode like CONCAT('%',#{code},'%')
 		)
 		GROUP BY i.cInvName,rs.cBatch,rs.cFree1
 		)tab1
@@ -284,12 +286,13 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
 		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},'%')
+		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
+		)tab2 on tab2.cInvName=tab1.cInvName and tab2.cBatch=tab1.cBatch
+		and (tab1.cfree1=tab2.cfree1 or tab1.cfree1 is null and tab2.cfree1 is null )
 		where tab2.jian-isnull(tab1.purchaseQuantity,0) > 0 and tab2.cinvName = #{goodName}
-
+		and tab2.cBatch not  like CONCAT('%',#{code},'%')
     </select>
 
 
@@ -310,7 +313,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
 		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},'%')
+		and om.cPOID like CONCAT('%',#{code},'%')
 		)
 		GROUP BY i.cInvName,rs.cBatch,rs.cFree1
 		union all
@@ -322,7 +325,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
 		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},'%')
+		and om.cCode like CONCAT('%',#{code},'%')
 		)
 		GROUP BY i.cInvName,rs.cBatch,rs.cFree1
 		)tab1
@@ -336,7 +339,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
 		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},'%')
+		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
@@ -360,7 +363,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
 		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},'%')
+		and om.cPOID like CONCAT('%',#{code},'%')
 		)
 		GROUP BY i.cInvName,rs.cBatch,rs.cFree1
 		union all
@@ -372,7 +375,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
 		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},'%')
+		and om.cCode like CONCAT('%',#{code},'%')
 		)
 		GROUP BY i.cInvName,rs.cBatch,rs.cFree1
 		)tab1
@@ -386,7 +389,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
 		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},'%')
+		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
@@ -399,32 +402,32 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
 	<!--	面料余下数量链接方法-->
 	<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
-	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.OM_MOMaterials ot on ot.MoDetailsID=od.MODetailsID
-	join UFDATA_101_2021.dbo.Inventory oti on oti.cInvCode=ot.cInvCode
-	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},'%') and oti.cInvName = #{goodName}
-	and (oti.cInvCcode like '03%' or oti.cInvCcode like '04%') and oti.cInvCCode != '0399' and oti.cInvCCode != '0499'
-	GROUP BY oti.cInvName,ot.cFree1
-
-	union all
-
-	select oti.cInvName as goodsName,ot.cFree1 as color,max(om.ccode) as planCode,sum(ot.iQuantity) as number
-	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.OM_MOMaterials ot on ot.MoDetailsID=od.MODetailsID
-	join UFDATA_103_2021.dbo.Inventory oti on oti.cInvCode=ot.cInvCode
-	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},'%') and oti.cInvName = #{goodName}
-	and (oti.cInvCcode like '03%' or oti.cInvCcode like '04%') and oti.cInvCCode != '0399' and oti.cInvCCode != '0499'
-	GROUP BY oti.cInvName,ot.cFree1
+		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.OM_MOMaterials ot on ot.MoDetailsID=od.MODetailsID
+		join UFDATA_101_2021.dbo.Inventory oti on oti.cInvCode=ot.cInvCode
+		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},'%') and oti.cInvName = #{goodName}
+		and (oti.cInvCcode like '03%' or oti.cInvCcode like '04%') and oti.cInvCCode != '0399' and oti.cInvCCode != '0499'
+		GROUP BY oti.cInvName,ot.cFree1
+
+		union all
+
+		select oti.cInvName as goodsName,ot.cFree1 as color,max(om.ccode) as planCode,sum(ot.iQuantity) as number
+		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.OM_MOMaterials ot on ot.MoDetailsID=od.MODetailsID
+		join UFDATA_103_2021.dbo.Inventory oti on oti.cInvCode=ot.cInvCode
+		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},'%') and oti.cInvName = #{goodName}
+		and (oti.cInvCcode like '03%' or oti.cInvCcode like '04%') and oti.cInvCCode != '0399' and oti.cInvCCode != '0499'
+		GROUP BY oti.cInvName,ot.cFree1
 	</select>
 
 	<!--	面料余下数量链接方法-->
 	<select id="queryRemainingByFabric" resultType="org.jeecg.modules.cost.entity.SyRemaining">
 		select a.cfree1 color,a.cInvName goodsName,a.comcode planCode,purchaseQuantity2-purchaseQuantity1 as number
-		from (select i.cInvCode,rs.cBatch,sum(rs.iQuantity) purchaseQuantity1 ,cfree1,cInvName,comcode
+		from (select i.cInvCode,rs.cBatch,sum(rs.iQuantity) purchaseQuantity1 ,cfree1,cInvName,max(comcode) comcode
 			from UFDATA_101_2021.dbo.rdrecords11 rs
 			join UFDATA_101_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
 			where comcode in (
@@ -434,10 +437,10 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
 			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},'%')
+			and om.cCode like CONCAT('%',#{code},'%')
 			)
 			and cInvName=#{goodName}
-			GROUP BY i.cInvCode,rs.cBatch,cfree1,cInvName ,comcode) a
+			GROUP BY i.cInvCode,rs.cBatch,cfree1,cInvName ) a
 		left join (select i.cInvCode,sum(rs.iQuantity) as purchaseQuantity2,rs.cBatch as cBatch,cfree1,cInvName,comcode
 			from UFDATA_101_2021.dbo.rdrecords01 rs
 			join UFDATA_101_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
@@ -448,7 +451,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
 			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.cPOID like CONCAT(#{code},'%')
+			and om.cPOID like CONCAT('%',#{code},'%')
 			) and r.cBusType = '普通采购'
 			and cInvName=#{goodName}
 			GROUP BY i.cInvCode,rs.cBatch,cfree1,cInvName,comcode ) b
@@ -460,22 +463,21 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
 
 <!--	多发少发链接-->
 	<select id="querypilosityFewer" parameterType="java.lang.String" resultType="org.jeecg.modules.cost.entity.SyCostAllocationFabric">
-select
-		tab.planQuantity as planQuantity,tab.color, tab.goodsName,isnull(tab1.purchaseQuantity,0) as purchaseQuantity,(isnull(tab.usageQuantity,0) - tab.planQuantity) as pilosityFewer
-
-		from
-		(
+		select  tab.planQuantity as planQuantity,tab.color, tab.goodsName,
+		isnull(tab1.purchaseQuantity,0) as purchaseQuantity,
+		(isnull(tab.usageQuantity,0) - tab.planQuantity) as pilosityFewer
+		from(
 		select ot.cFree1 as color,max(oti.cInvName) as cInvName,max(oti.cInvName)+ ' '+ ot.cFree1 as goodsName,sum(ot.iQuantity) as planQuantity,sum(ot.iSendQTY) as usageQuantity
 		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.OM_MOMaterials ot on ot.MoDetailsID=od.MODetailsID
 		join UFDATA_101_2021.dbo.Inventory oti on oti.cInvCode=ot.cInvCode
 		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},'%') and oti.cInvName = #{goodName}
+		WHERE om.iVerifyStateNew = 2  and omi.cInvCcode like '19%' and om.cCode like CONCAT('%',#{code},'%') and oti.cInvName = #{goodName}
 		GROUP BY ot.cFree1
 		) tab
 		left join
-	 (
+	   (
 		select rs.cFree1 as color,max(i.cInvName) as cInvName,sum(rs.iQuantity) as purchaseQuantity,max(rs.cBatch) as cBatch from UFDATA_101_2021.dbo.rdrecords01 rs
 		join UFDATA_101_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
 		where iordercode in (
@@ -484,9 +486,9 @@ select
 		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.cPOID like CONCAT(#{code},'%')
+		 and om.cPOID like CONCAT('%',#{code},'%')
 		)  and i.cInvName = #{goodName}
-		 and rs.cBatch like CONCAT(#{code},'%')
+		 and rs.cBatch like CONCAT('%',#{code},'%')
 		GROUP BY rs.cFree1
 		)tab1 on tab1.cInvName=tab.cInvName and tab1.color = tab.color
 
@@ -505,7 +507,7 @@ select
 		join UFDATA_103_2021.dbo.OM_MOMaterials ot on ot.MoDetailsID=od.MODetailsID
 		join UFDATA_103_2021.dbo.Inventory oti on oti.cInvCode=ot.cInvCode
 		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},'%') and oti.cInvName = #{goodName}
+		WHERE om.iVerifyStateNew = 2  and omi.cInvCcode like '19%' and om.cCode like CONCAT('%',#{code},'%') and oti.cInvName = #{goodName}
 		GROUP BY ot.cFree1
 		) tab
 		left join
@@ -518,9 +520,9 @@ select
 		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.cPOID like CONCAT(#{code},'%')
+		 and om.cPOID like CONCAT('%',#{code},'%')
 		)  and i.cInvName = #{goodName}
-		 and rs.cBatch like CONCAT(#{code},'%')
+		 and rs.cBatch like CONCAT('%',#{code},'%')
 		GROUP BY rs.cFree1
 		)tab1 on tab1.cInvName=tab.cInvName and tab1.color = tab.color
 

+ 174 - 185
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/xml/SyCostAllocationIngredientMapper.xml

@@ -28,11 +28,12 @@
 			,iNoTaxMoney as priceExcludingtax
 			,0 as ingredientsTransferQuantity
 		FROM dbo.VIEW_FabricLoss_Cost_Assist
-		where cPoid like CONCAT(#{code},'%') and
+		where cPoid like CONCAT('%',#{code},'%') and
 		(cVenAbbName !='宁波森语' and cVenAbbName !='马菲羊')
 	</select>-->
 
 	<select id="queryByCostIngredient1" resultType="org.jeecg.modules.cost.entity.SyCostAllocationIngredient">
+ 
 SELECT   	case when (a.iQuantityIn-b.usageQuantity)/a.iQuantityIn   <![CDATA[<=]]> 0 then '0'
 				else (a.iQuantityIn-b.usageQuantity)/a.iQuantityIn end as loss
 			,a.cVenAbbName  AS supper
@@ -55,173 +56,161 @@ SELECT   	case when (a.iQuantityIn-b.usageQuantity)/a.iQuantityIn   <![CDATA[<=]
 		select  t5.cInvCode,t5.goodsName,sum(t5.dosage) as dosage,sum(t5.usageQuantity) as usageQuantity,
         STRING_AGG(t5.supper,',') as supper,sum(t5.rmbAmount) as rmbAmount,sum(t5.usdAmount) as usdAmount,
         sum(t5.priceExcludingtax) as priceExcludingtax,sum(t5.cost) as cost  from (
-    	select t4.cInvCode,t4.ccode,t4.goodsName,max(t4.dosage) as dosage,max(t4.usageQuantity) as usageQuantity,
-        STRING_AGG(t4.supper,',') as supper,sum(t4.rmbAmount) as rmbAmount,sum(t4.usdAmount) as usdAmount,
-        sum(t4.priceExcludingtax) as priceExcludingtax,sum(t4.cost) as cost from(
-            SELECT t3.ccode,t3.cInvCode,t3.goodsName,avg( t3.dosage ) AS dosage,
-                    SUM ( t3.usageQuantity ) AS usageQuantity,t3.cVenAbbName AS supper,
-                    SUM ( t3.rmbAmount ) AS rmbAmount,SUM ( t3.usdAmount ) AS usdAmount,
-                    SUM ( t3.priceExcludingtax ) AS priceExcludingtax,
-                    SUM ( t3.totalCost )/sum(totalSum) AS cost
-                    FROM(
-                    SELECT t1.ccode as ccode,t1.cInvCode,t1.goodsName,t1.dosage,t1.usageQuantity,
-                    t2.cVenAbbName,t2.rmbAmount,t2.usdAmount,t2.priceExcludingtax,t2.totalCost,t2.totalSum
-                    FROM
-                    (SELECT ot.cInvCode,od.isosid,om.ccode,oti.cInvName AS goodsName,
-                    SUM (ot.iUnitQuantity) AS dosage,SUM (ot.iSendQTY) AS usageQuantity
-                    FROM UFDATA_103_2021.dbo.cost_allocation_accessories_view vif
-                    join UFDATA_103_2021.dbo.om_momain om on om.ccode = vif.cCode
-                    JOIN UFDATA_103_2021.dbo.OM_MODetails od ON om.moid= od.moid
-                    JOIN UFDATA_103_2021.dbo.OM_MOMaterials ot ON ot.MoDetailsID= od.MODetailsID and ot.cInvCode = vif.cInvCode
-                    JOIN UFDATA_103_2021.dbo.Vendor v ON om.cVenCode= v.cVenCode
-                    JOIN UFDATA_103_2021.dbo.Inventory oti ON oti.cInvCode= ot.cInvCode
-                    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 om.ccode,ot.cInvCode,od.isosid,om.ccode,oti.cInvName ) AS t1
-                left join (
-                    SELECT ven.cVenAbbName AS cVenAbbName,bi.cInvCode,pod.isosid,SUM ( bi.iSum ) AS rmbAmount,
-                    SUM ( bi.iOriSum ) AS usdAmount,SUM ( bi.iMoney ) AS priceExcludingtax,
-                    sum ( bi.iCost*bi.iPBVQuantity) AS totalCost ,sum ( bi.iPBVQuantity) AS totalSum
-                    FROM
-                    UFDATA_103_2021.dbo.om_momain pom
-                    JOIN UFDATA_103_2021.dbo.OM_MODetails pod ON pod.MOID  = pom.MOID
-                    JOIN UFDATA_103_2021.dbo.PurBillVouchs bi ON bi.iPOsID= pod.MODetailsID
-                    JOIN UFDATA_103_2021.dbo.PurBillVouch bm ON bm.PBVID= bi.PBVID
-                    JOIN UFDATA_103_2021.dbo.Vendor ven ON bm.cVenCode = ven.cVenCode
-                    JOIN UFDATA_103_2021.dbo.Inventory oti ON oti.cInvCode= pod.cInvCode
-                    GROUP BY bi.cInvCode,pod.isosid,ven.cVenAbbName
-                union all
-            SELECT ven.cVenAbbName AS cVenAbbName,bi.cInvCode,pod.iorderdid as isosid,SUM ( bi.iSum ) AS rmbAmount,
-                    SUM ( bi.iOriSum ) AS usdAmount,SUM ( bi.iMoney ) AS priceExcludingtax,
-                    sum ( bi.iCost*bi.iPBVQuantity) AS totalCost ,sum ( bi.iPBVQuantity) AS totalSum
-                    FROM UFDATA_103_2021.dbo.PO_Pomain pom
-                    JOIN UFDATA_103_2021.dbo.PO_Podetails pod ON pod.POID  = pom.POID
-                    JOIN UFDATA_103_2021.dbo.PurBillVouchs bi ON bi.iPOsID= pod.ID
-                    JOIN UFDATA_103_2021.dbo.PurBillVouch bm ON bm.PBVID= bi.PBVID
-                    JOIN UFDATA_103_2021.dbo.Vendor ven ON bm.cVenCode = ven.cVenCode
-                    JOIN UFDATA_103_2021.dbo.Inventory oti ON oti.cInvCode= pod.cInvCode
-
-                    where pom.cPOID like CONCAT(#{code},'%')
-                    GROUP BY bi.cInvCode,pod.iorderdid,ven.cVenAbbName
-                    ) AS t2
-                    on
-                    t1.cInvCode= t2.cInvCode
-                    AND t2.isosid= t1.isosid
-                    ) t3
-                    GROUP BY
-                    t3.ccode,t3.cInvCode,t3.goodsName,t3.cVenAbbName
-            union all
-
-    select t3.ccode as ccode,t3.cInvCode,t3.goodsName,avg(t3.dosage) as dosage,sum(t3.usageQuantity) as usageQuantity,
-        max(t3.cVenAbbName) as supper,sum(t3.rmbAmount) as rmbAmount,sum(t3.usdAmount) as usdAmount,
-        sum(t3.priceExcludingtax) as priceExcludingtax,sum(t3.iCost) as cost from (
-            select t1.ccode as ccode,t1.cInvCode,t1.goodsName,t1.dosage,t1.usageQuantity,t2.cVenAbbName,
-            t2.rmbAmount,t2.usdAmount,t2.priceExcludingtax,t2.iCost from (
-            select ot.cInvCode,od.isosid,om.ccode,oti.cInvName as goodsName,
-            sum(ot.iUnitQuantity) as dosage,sum(ot.iSendQTY) as usageQuantity
-            from UFDATA_103_2021.dbo.cost_allocation_accessories_view vif
-            join UFDATA_101_2021.dbo.om_momain om on om.ccode = vif.cCode
-            join UFDATA_101_2021.dbo.OM_MODetails od on om.moid=od.moid
-            join UFDATA_101_2021.dbo.OM_MOMaterials ot on ot.MoDetailsID=od.MODetailsID and ot.cInvCode = vif.cInvCode
-            JOIN UFDATA_101_2021.dbo.Vendor v ON om.cVenCode= v.cVenCode
-            join UFDATA_101_2021.dbo.Inventory oti on oti.cInvCode=ot.cInvCode
-            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 om.ccode,ot.cInvCode,od.isosid,om.ccode,oti.cInvName
-            ) as t1,
-            (
-            select max(ven.cVenAbbName) as cVenAbbName,
-            bi.cInvCode,pod.iorderdid,sum(bi.iSum) as rmbAmount,sum(bi.iOriSum) as usdAmount
-            ,sum(bi.iMoney) as priceExcludingtax,max(bi.iCost) as iCost
-            from UFDATA_101_2021.dbo.PO_Pomain pom
-            join UFDATA_101_2021.dbo.PO_Podetails pod on pod.POID  = pom.POID
-            join UFDATA_101_2021.dbo.PurBillVouchs bi  on bi.iPOsID=pod.ID
-            join UFDATA_101_2021.dbo.PurBillVouch bm  on bm.PBVID=bi.PBVID
-            join UFDATA_101_2021.dbo.Vendor ven on bm.cVenCode = ven.cVenCode
-            join UFDATA_101_2021.dbo.Inventory oti on oti.cInvCode=pod.cInvCode
-            where pom.cVenCode != 'T010001' and pom.cVenCode != 'T020001'
-            GROUP BY bi.cInvCode,pod.iorderdid) as t2 where t1.cInvCode=t2.cInvCode and t1.isosid = t2.iorderdid
-            ) t3  GROUP BY t3.ccode,t3.cInvCode,t3.goodsName
-
-            union all
-
-            select t3.ccode,t3.cInvCode,t3.goodsName,avg(t3.dosage) as dosage,sum(t3.usageQuantity) as usageQuantity,max(t3.cVenAbbName) as supper,sum(t3.rmbAmount) as rmbAmount,sum(t3.usdAmount) as usdAmount,sum(t3.priceExcludingtax) as priceExcludingtax,sum(t3.iCost) as cost from (
-
-            select t1.ccode,t1.cInvCode,t1.goodsName,t1.dosage,t1.usageQuantity,t2.cVenAbbName,t2.rmbAmount,t2.usdAmount,t2.priceExcludingtax,t2.iCost from (select ot.cInvCode,od.isosid,om.ccode,oti.cInvName as goodsName,sum(ot.iUnitQuantity) as dosage,sum(ot.iSendQTY) as usageQuantity
-
-            from UFDATA_103_2021.dbo.cost_allocation_accessories_view vif
-            join UFDATA_101_2021.dbo.om_momain om on om.ccode = vif.cCode
-            join UFDATA_101_2021.dbo.OM_MODetails od on om.moid=od.moid
-            join UFDATA_101_2021.dbo.OM_MOMaterials ot on ot.MoDetailsID=od.MODetailsID and ot.cInvCode = vif.cInvCode
-            JOIN UFDATA_101_2021.dbo.Vendor v ON om.cVenCode= v.cVenCode
-            join UFDATA_101_2021.dbo.Inventory oti on oti.cInvCode=ot.cInvCode
-            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 om.ccode,ot.cInvCode,od.isosid,om.ccode,oti.cInvName
-            ) as t1
-            left join (
-            select max(ven.cVenAbbName) as cVenAbbName,
-            bi.cInvCode,pod.iorderdid,sum(bi.iSum) as rmbAmount,sum(bi.iOriSum) as usdAmount
-            ,sum(bi.iMoney) as priceExcludingtax,max(bi.iCost) as iCost
-            from UFDATA_101_2021.dbo.PO_Pomain pom
-            join UFDATA_101_2021.dbo.PO_Podetails pod on pod.POID  = pom.POID
-            join UFDATA_103_2021.dbo.HY_DZ_K7_SYNERGISMLOGDID hy on pod.id = hy.predid
-
-            join UFDATA_102_2021.dbo.PO_Podetails pd on pd.iorderdid=hy.did
-            join UFDATA_102_2021.dbo.PO_Pomain pm on pd.POID  = pm.POID
-            join UFDATA_102_2021.dbo.PurBillVouchs bi  on bi.iPOsID=pd.ID
-            join UFDATA_102_2021.dbo.PurBillVouch bm  on bm.PBVID=bi.PBVID
-            join UFDATA_102_2021.dbo.Vendor ven on bm.cVenCode = ven.cVenCode
-            join UFDATA_102_2021.dbo.Inventory oti on oti.cInvCode=pd.cInvCode
-            where pm.cVenCode != 'T020001' and pom.cpoid LIKE CONCAT(#{code},'%')
-            GROUP BY bi.cInvCode,pod.iorderdid) as t2 on t1.cInvCode=t2.cInvCode and t2.iorderdid=t1.isosid
-            ) t3  GROUP BY t3.ccode,t3.cInvCode,t3.goodsName
-
-            union all
-            select t3.ccode,t3.cInvCode,t3.goodsName,avg(t3.dosage) as dosage,sum(t3.usageQuantity) as usageQuantity,max(t3.cVenAbbName) as supper,sum(t3.rmbAmount) as rmbAmount,sum(t3.usdAmount) as usdAmount,sum(t3.priceExcludingtax) as priceExcludingtax,sum(t3.iCost) as cost from (
-
-            select t1.ccode,t1.cInvCode,t1.goodsName,t1.dosage,t1.usageQuantity,t2.cVenAbbName,t2.rmbAmount,t2.usdAmount,t2.priceExcludingtax,t2.iCost from (select ot.cInvCode,od.isosid,om.ccode,oti.cInvName as goodsName,sum(ot.iUnitQuantity) as dosage,sum(ot.iSendQTY) as usageQuantity
-
-            from UFDATA_103_2021.dbo.cost_allocation_accessories_view vif
-            join UFDATA_101_2021.dbo.om_momain om on om.ccode = vif.cCode
-            join UFDATA_101_2021.dbo.OM_MODetails od on om.moid=od.moid
-            join UFDATA_101_2021.dbo.OM_MOMaterials ot on ot.MoDetailsID=od.MODetailsID and ot.cInvCode = vif.cInvCode
-            JOIN UFDATA_101_2021.dbo.Vendor v ON om.cVenCode= v.cVenCode
-            join UFDATA_101_2021.dbo.Inventory oti on oti.cInvCode=ot.cInvCode
-            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 om.ccode,ot.cInvCode,od.isosid,om.ccode,oti.cInvName
-            ) as t1,
-            (
-            select max(ven.cVenAbbName) as cVenAbbName,
-            bi.cInvCode,pod.iorderdid,sum(bi.iSum) as rmbAmount,sum(bi.iOriSum) as usdAmount
-            ,sum(bi.iMoney) as priceExcludingtax,max(bi.iCost) as iCost
-            from UFDATA_101_2021.dbo.PO_Pomain pom
-            join UFDATA_101_2021.dbo.PO_Podetails pod on pod.POID  = pom.POID
-            join UFDATA_103_2021.dbo.HY_DZ_K7_SYNERGISMLOGDID hy on pod.id = hy.predid
-
-            join UFDATA_103_2021.dbo.OM_MODetails pd on pd.isosid=hy.did
-            join UFDATA_103_2021.dbo.OM_MOMain pm on pd.MOID  = pm.MOID
-            left join UFDATA_103_2021.dbo.PurBillVouchs bi  on bi.iPOsID=pd.MODetailsID
-            left join UFDATA_103_2021.dbo.PurBillVouch bm  on bm.PBVID=bi.PBVID
-            join UFDATA_103_2021.dbo.Vendor ven on bm.cVenCode = ven.cVenCode
-            join UFDATA_103_2021.dbo.Inventory oti on oti.cInvCode=pd.cInvCode
-            where pom.cpoid LIKE CONCAT(#{code},'%')
-            GROUP BY bi.cInvCode,pod.iorderdid) as t2 where t1.cInvCode=t2.cInvCode and t2.iorderdid=t1.isosid
-            ) t3  GROUP BY t3.ccode,t3.cInvCode,t3.goodsName) t4
-            GROUP BY t4.cInvCode,t4.goodsName,t4.ccode) t5
+
+
+
+
+		select t4.cInvCode,t4.ccode,t4.goodsName,max(t4.dosage) as dosage,max(t4.usageQuantity) as usageQuantity,
+		STRING_AGG(t4.supper,',') as supper,sum(t4.rmbAmount) as rmbAmount,sum(t4.usdAmount) as usdAmount,
+		sum(t4.priceExcludingtax) as priceExcludingtax,sum(本币单价) as cost from(
+
+		select OMMO.计划单号,ommo.ccode,ommo.cVenAbbName,OMMO.cInvCode,cInvCCode,OMMO.goodsName,OMMO.dosage,OMMO.usageQuantity,入库数量,
+		POPO1.cVenAbbName AS supper,popo1.iOriSum as usdAmount,POPO1.iSum as rmbAmount,popo1.iNoTaxMoney as priceExcludingtax,
+		popo1.原币单价,POPO1.本币单价,POPO1.iQuantityIn AS 购入数量,POPO1.iQuantityInvoice AS 发票数量,
+		popo1.iQuantitySettle as 结算数量
+		from
+		(
+		SELECT OMMO.计划单号,ommo.ccode,OMMO.cVenAbbName,OMMO.cInvCode,cInvCCode,OMMO.goodsName,OMMO.dosage,OMMO.usageQuantity,ISNULL(入库数量,0) AS 入库数量
+		FROM
+		(select #{code} AS 计划单号,ommo.ccode,'101' AS 账套,Vendor.cVenAbbName,inv_z.cInvCode,inv_z.cInvCCode,
+		inv_z.cInvName as goodsName,avg(ommoms.iUnitQuantity) as dosage,sum(ommoms.iSendQTY) as usageQuantity
+		from
+		UFDATA_101_2021.dbo.OM_MOMaterials ommoms inner join UFDATA_101_2021.dbo.OM_MODetails ommos on ommos.MODetailsID=ommoms.MoDetailsID
+		inner join UFDATA_101_2021.dbo.om_momain ommo on ommo.MOID=ommos.MOID
+		inner join UFDATA_101_2021.dbo.Inventory inv_c on inv_c.cInvCode=ommos.cInvCode
+		inner join UFDATA_101_2021.dbo.Inventory inv_z on inv_z.cInvCode=ommoms.cInvCode
+		inner join UFDATA_101_2021.dbo.Vendor on vendor.cVenCode=ommo.cVenCode
+		where left(inv_c.cInvCCode,2)='19' and (left(inv_z.cInvCCode,2) not in ('02','03','04') or inv_z.cInvCCode in ('0299','0399','0499'))
+		and ommo.ccode like CONCAT('%',#{code},'%') and isnull(ommos.cbCloser,'asuser')='asuser'
+		group by Vendor.cVenAbbName,inv_z.cInvCode,inv_z.cInvName,inv_z.cInvCCode,ommo.ccode) as ommo left join
+		(
+		select #{code} AS 计划单号,'101' AS 账套,inv.cInvCode,inv.cInvName,popo.cVenCode,sum(isnull(popos.iReceivedQTY,0)+isnull(popos.iArrQTY,0))AS 入库数量
+		from
+		UFDATA_101_2021.dbo.po_pomain popo inner join UFDATA_101_2021.dbo.PO_Podetails popos on popo.POID=popos.POID
+		inner join UFDATA_101_2021.dbo.Inventory inv on inv.cInvCode=popos.cInvCode
+		where popo.cPOID like CONCAT('%',#{code},'%') and (left(inv.cInvCCode,2) not in ('02','03','04') or inv.cInvCCode in ('0299','0399','0499'))
+		and isnull(popos.cbCloser,'asuser')='asuser'
+		group by inv.cInvCode,inv.cInvName,popo.cVenCode) as popo on
+		popo.计划单号=ommo.计划单号 and popo.cInvCode=ommo.cInvCode
+		WHERE  (OMMO.cInvCCode not in ('0299','0399','0499') or ISNULL(popo.cVenCode,0)!='T020001')
+
+		UNION ALL
+
+		SELECT OMMO.计划单号,OMMO.CCODE , cVenAbbName,OMMO.cInvCode,cInvCCode,OMMO.goodsName,OMMO.dosage,OMMO.usageQuantity,NULL AS 入库数量
+		FROM
+		(select #{code} AS 计划单号,ommo.ccode,Vendor.cVenAbbName,inv_z.cInvCode,inv_z.cInvCCode,inv_z.cInvName as goodsName,
+		avg(ommoms.iUnitQuantity) as dosage,sum(ommoms.iSendQTY) as usageQuantity
+		from
+		UFDATA_103_2021.dbo.OM_MOMaterials ommoms inner join UFDATA_103_2021.dbo.OM_MODetails ommos on ommos.MODetailsID=ommoms.MoDetailsID
+		inner join UFDATA_103_2021.dbo.om_momain ommo on ommo.MOID=ommos.MOID
+		inner join UFDATA_103_2021.dbo.Inventory inv_c on inv_c.cInvCode=ommos.cInvCode
+		inner join UFDATA_103_2021.dbo.Inventory inv_z on inv_z.cInvCode=ommoms.cInvCode
+		inner join UFDATA_103_2021.dbo.Vendor on vendor.cVenCode=ommo.cVenCode
+		where left(inv_c.cInvCCode,2)='19' and (left(inv_z.cInvCCode,2) not in ('02','03','04') or inv_z.cInvCCode in ('0299','0399','0499'))
+		and ommo.ccode like CONCAT('%',#{code},'%') and isnull(ommos.cbCloser,'asuser')='asuser'
+		group by ommo.ccode,inv_z.cInvCode,inv_z.cInvName,inv_z.cInvCCode,Vendor.cVenAbbName)
+		AS OMMO LEFT JOIN
+		(SELECT #{code} AS 计划单号,OMMO.cVenCode,OMMO.CCODE FROM UFDATA_103_2021.dbo.om_momain ommo inner join UFDATA_103_2021.dbo.OM_MODetails ommos on ommo.MOID=ommos.MOID
+		inner join UFDATA_103_2021.dbo.Inventory inv on inv.cInvCode=ommos.cInvCode WHERE INV.cInvCCode IN ('0299','0399','0499')
+		and ommo.ccode like CONCAT('%',#{code},'%') and isnull(ommos.cbCloser,'asuser')='asuser')
+		AS POPO ON POPO.cVenCode=OMMO.cInvCode AND POPO.计划单号=OMMO.计划单号
+		WHERE POPO.cCode IS NULL
+
+		) AS OMMO
+		left join (select #{code} as 计划单号, cVenAbbName,cInvCode,sum(iOriSum) as iOriSum,sum(iSum) as iSum,
+		sum(iNoTaxMoney) as iNoTaxMoney,sum(iQuantityIn) as iQuantityIn,sum(iQuantityInvoice) as iQuantityInvoice,
+		sum(iQuantitySettle) as iQuantitySettle
+		,(CASE WHEN sum(iQuantityIn)!=0 THEN round(sum(iOriSum)/sum(iQuantityIn),5) ELSE 0 END) AS  原币单价
+		,(CASE WHEN sum(iQuantityIn)!=0 THEN round(sum(iSum)/sum(iQuantityIn),5) ELSE 0 END) AS  本币单价
+		from  VIEW_FabricLoss_Cost_Assist
+		where cPoid like  CONCAT('%',#{code},'%')  and cVenAbbName!='宁波森语'
+		group by cVenAbbName,cInvCode)
+		AS POPO1 ON POPO1.cInvCode=OMMO.cInvCode
+
+		) t4 GROUP BY t4.cInvCode,t4.goodsName,t4.ccode
+
+
+            ) t5
 			GROUP BY t5.cInvCode,t5.goodsName
             ) b
             on a.cinvcode=b.cinvcode and a.cinvname=b.goodsname
 
-            WHERE cPoid LIKE CONCAT(#{code},'%') AND (cVenAbbName != '宁波森语' AND cVenAbbName != '马菲羊') and a.iQuantityIn>0
+            WHERE cPoid LIKE CONCAT('%',#{code},'%') AND (cVenAbbName != '宁波森语' AND cVenAbbName != '马菲羊') and a.iQuantityIn>0
         </select>
 
+
+
+	<select id="queryByCostIngredient2" resultType="org.jeecg.modules.cost.entity.SyCostAllocationIngredient">
+		select OMMO.计划单号 ,ommo.cVenAbbName,OMMO.cInvCode goodsCode,cInvCCode,OMMO.goodsName,OMMO.dosage,OMMO.usageQuantity,入库数量,
+		POPO1.cVenAbbName AS supper,popo1.iOriSum as usdAmount,POPO1.iSum as rmbAmount,popo1.iNoTaxMoney as priceExcludingtax,
+		popo1.原币单价,POPO1.本币单价 cost,POPO1.iQuantityIn AS purchaseQuantity,POPO1.iQuantityInvoice AS 发票数量,
+		case when isnull(iQuantityIn,0)-isnull(usageQuantity,0)   <![CDATA[<=]]> 0 then 0
+		else isnull(iQuantityIn,0)-isnull(usageQuantity,0) end as ingredientsRemainingQuantity,
+		case when isnull(usageQuantity,0)-isnull(iQuantityIn,0)  <![CDATA[<=]]> 0 then 0
+		else isnull(usageQuantity,0)-isnull(iQuantityIn,0) end as ingredientsTransferQuantity,
+		case when  isnull(usageQuantity,0)-isnull(iQuantityIn,0)  <![CDATA[<=]]> 0 then 0
+		else  (isnull(usageQuantity,0)-isnull(iQuantityIn,0))*isnull(POPO1.本币单价,0) end as transferCost,
+		case when  iQuantityIn  = 0 then '0'
+		when (iQuantityIn-usageQuantity)/iQuantityIn   <![CDATA[<=]]> 0 then '0'
+		else (iQuantityIn-usageQuantity)/iQuantityIn end as loss,
+		popo1.iQuantitySettle as 结算数量
+		from
+		(
+		SELECT OMMO.计划单号,OMMO.cVenAbbName,OMMO.cInvCode,cInvCCode,OMMO.goodsName,OMMO.dosage,OMMO.usageQuantity,ISNULL(入库数量,0) AS 入库数量
+		FROM
+		(select #{code} AS 计划单号,'101' AS 账套,Vendor.cVenAbbName,inv_z.cInvCode,inv_z.cInvCCode,
+		inv_z.cInvName as goodsName,avg(ommoms.iUnitQuantity) as dosage,sum(ommoms.iSendQTY) as usageQuantity
+		from
+		UFDATA_101_2021.dbo.OM_MOMaterials ommoms inner join UFDATA_101_2021.dbo.OM_MODetails ommos on ommos.MODetailsID=ommoms.MoDetailsID
+		inner join UFDATA_101_2021.dbo.om_momain ommo on ommo.MOID=ommos.MOID
+		inner join UFDATA_101_2021.dbo.Inventory inv_c on inv_c.cInvCode=ommos.cInvCode
+		inner join UFDATA_101_2021.dbo.Inventory inv_z on inv_z.cInvCode=ommoms.cInvCode
+		inner join UFDATA_101_2021.dbo.Vendor on vendor.cVenCode=ommo.cVenCode
+		where left(inv_c.cInvCCode,2)='19' and (left(inv_z.cInvCCode,2) not in ('02','03','04') or inv_z.cInvCCode in ('0299','0399','0499'))
+		and ommo.ccode like CONCAT('%',#{code},'%') and isnull(ommos.cbCloser,'asuser')='asuser'
+		group by Vendor.cVenAbbName,inv_z.cInvCode,inv_z.cInvName,inv_z.cInvCCode) as ommo left join
+		(select #{code} AS 计划单号,'101' AS 账套,inv.cInvCode,inv.cInvName,popo.cVenCode,sum(isnull(popos.iReceivedQTY,0)+isnull(popos.iArrQTY,0))AS 入库数量
+		from
+		UFDATA_101_2021.dbo.po_pomain popo inner join UFDATA_101_2021.dbo.PO_Podetails popos on popo.POID=popos.POID
+		inner join UFDATA_101_2021.dbo.Inventory inv on inv.cInvCode=popos.cInvCode
+		where popo.cPOID like CONCAT('%',#{code},'%') and (left(inv.cInvCCode,2) not in ('02','03','04') or inv.cInvCCode in ('0299','0399','0499'))
+		and isnull(popos.cbCloser,'asuser')='asuser'
+		group by inv.cInvCode,inv.cInvName,popo.cVenCode) as popo on
+		popo.计划单号=ommo.计划单号 and popo.cInvCode=ommo.cInvCode
+ 		WHERE  (OMMO.cInvCCode not in ('0299','0399','0499') or ISNULL(popo.cVenCode,0)!='T020001'  or 入库数量=0)
+		UNION ALL
+		SELECT OMMO.计划单号,OMMO.CCODE,OMMO.cInvCode,cInvCCode,OMMO.goodsName,OMMO.dosage,OMMO.usageQuantity,NULL AS 入库数量
+		FROM
+		(select #{code} AS 计划单号,ommo.ccode,inv_z.cInvCode,inv_z.cInvCCode,inv_z.cInvName as goodsName,
+		avg(ommoms.iUnitQuantity) as dosage,sum(ommoms.iSendQTY) as usageQuantity
+		from
+		UFDATA_103_2021.dbo.OM_MOMaterials ommoms inner join UFDATA_103_2021.dbo.OM_MODetails ommos on ommos.MODetailsID=ommoms.MoDetailsID
+		inner join UFDATA_103_2021.dbo.om_momain ommo on ommo.MOID=ommos.MOID
+		inner join UFDATA_103_2021.dbo.Inventory inv_c on inv_c.cInvCode=ommos.cInvCode
+		inner join UFDATA_103_2021.dbo.Inventory inv_z on inv_z.cInvCode=ommoms.cInvCode
+		inner join UFDATA_103_2021.dbo.Vendor on vendor.cVenCode=ommo.cVenCode
+		where left(inv_c.cInvCCode,2)='19' and (left(inv_z.cInvCCode,2) not in ('02','03','04') -- or inv_z.cInvCCode in ('0299','0399','0499')
+
+		)and ommo.ccode like CONCAT('%',#{code},'%') and isnull(ommos.cbCloser,'asuser')='asuser'
+		group by ommo.ccode,inv_z.cInvCode,inv_z.cInvName,inv_z.cInvCCode) AS OMMO
+		LEFT JOIN (SELECT #{code} AS 计划单号,OMMO.cVenCode,OMMO.CCODE FROM UFDATA_103_2021.dbo.om_momain ommo inner join UFDATA_103_2021.dbo.OM_MODetails ommos on ommo.MOID=ommos.MOID
+		inner join UFDATA_103_2021.dbo.Inventory inv on inv.cInvCode=ommos.cInvCode WHERE INV.cInvCCode IN ('0299','0399','0499')
+		and ommo.ccode like CONCAT('%',#{code},'%') and isnull(ommos.cbCloser,'asuser')='asuser') AS POPO
+		ON POPO.cVenCode=OMMO.cInvCode AND POPO.计划单号=OMMO.计划单号
+		WHERE POPO.cCode IS NULL
+		) AS OMMO
+		left join (select #{code} as 计划单号, cVenAbbName,cInvCode,sum(iOriSum) as iOriSum,sum(iSum) as iSum,
+		sum(iNoTaxMoney) as iNoTaxMoney,sum(iQuantityIn) as iQuantityIn,sum(iQuantityInvoice) as iQuantityInvoice
+		,sum(iQuantitySettle) as iQuantitySettle
+		,(CASE WHEN sum(iQuantityIn)!=0 THEN round(sum(iOriSum)/sum(iQuantityIn),5) ELSE 0 END) AS  原币单价
+		,(CASE WHEN sum(iQuantityIn)!=0 THEN round(sum(iSum)/sum(iQuantityIn),5) ELSE 0 END) AS  本币单价
+		from  VIEW_FabricLoss_Cost_Assist
+		where cPoid like  CONCAT('%',#{code},'%')  and cVenAbbName!='宁波森语'
+		group by cVenAbbName,cInvCode)
+		AS POPO1 ON POPO1.cInvCode=OMMO.cInvCode
+	</select>
+
+
     <!--	<select id="queryByCostIngredient1" resultType="org.jeecg.modules.cost.entity.SyCostAllocationIngredient">-->
 <!--		select tab.*,isnull(tab1.purchaseQuantity,0) as purchaseQuantity,-->
 <!--		case when isnull(tab2.jian,0)-isnull(tab1.purchaseQuantity,0) <![CDATA[<=]]> 0 then 0-->
@@ -257,7 +246,7 @@ SELECT   	case when (a.iQuantityIn-b.usageQuantity)/a.iQuantityIn   <![CDATA[<=]
 <!--		om.iVerifyStateNew = 2-->
 
 <!--		AND omi.cInvCcode LIKE '19%'-->
-<!--		AND om.cCode LIKE CONCAT(#{code},'%')-->
+<!--		AND om.cCode LIKE CONCAT('%',#{code},'%')-->
 <!--	GROUP BY om.ccode,ot.cInvCode,od.isosid,om.ccode,oti.cInvName ) AS t1-->
 
 <!--		left join (SELECT ven.cVenAbbName AS cVenAbbName,bi.cInvCode,pod.isosid,SUM ( bi.iSum ) AS rmbAmount,SUM ( bi.iOriSum ) AS usdAmount,-->
@@ -281,7 +270,7 @@ SELECT   	case when (a.iQuantityIn-b.usageQuantity)/a.iQuantityIn   <![CDATA[<=]
 <!--		JOIN UFDATA_103_2021.dbo.Vendor ven ON bm.cVenCode = ven.cVenCode-->
 <!--		JOIN UFDATA_103_2021.dbo.Inventory oti ON oti.cInvCode= pod.cInvCode-->
 
-<!--		where pom.cPOID like CONCAT(#{code},'%')-->
+<!--		where pom.cPOID like CONCAT('%',#{code},'%')-->
 <!--		GROUP BY bi.cInvCode,pod.iorderdid,ven.cVenAbbName-->
 <!--		) AS t2-->
 <!--		on-->
@@ -293,7 +282,7 @@ SELECT   	case when (a.iQuantityIn-b.usageQuantity)/a.iQuantityIn   <![CDATA[<=]
 <!--		) t4-->
 <!--		where t4.cInvCode not in(-->
 <!--		select cInvCode from UFDATA_103_2021.dbo.cost_allocation_fabric_view vif-->
-<!--		where trim(vif.cCode) like CONCAT(#{code},'%')-->
+<!--		where trim(vif.cCode) like CONCAT('%',#{code},'%')-->
 <!--		)-->
 <!--		GROUP BY t4.cInvCode,t4.goodsName-->
 
@@ -309,7 +298,7 @@ SELECT   	case when (a.iQuantityIn-b.usageQuantity)/a.iQuantityIn   <![CDATA[<=]
 <!--		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.cPOID LIKE CONCAT(#{code},'%')-->
+<!--		and om.cPOID LIKE CONCAT('%',#{code},'%')-->
 <!--		) and r.cBusType = '普通采购'-->
 <!--		GROUP BY i.cInvCode,i.cInvName-->
 <!--		UNION ALL-->
@@ -322,7 +311,7 @@ SELECT   	case when (a.iQuantityIn-b.usageQuantity)/a.iQuantityIn   <![CDATA[<=]
 <!--		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 om.cCode like CONCAT(#{code},'%')-->
+<!--		and om.cCode like CONCAT('%',#{code},'%')-->
 <!--		) and r.cBusType = '委外加工'-->
 <!--		GROUP BY i.cInvCode,i.cInvName-->
 <!--		)tab1 on tab1.cInvName=tab.goodsName and tab1.cInvCode=tab.cInvCode-->
@@ -336,7 +325,7 @@ SELECT   	case when (a.iQuantityIn-b.usageQuantity)/a.iQuantityIn   <![CDATA[<=]
 <!--		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},'%')-->
+<!--		and omi.cInvCcode like '19%' and om.cCode LIKE CONCAT('%',#{code},'%')-->
 <!--		)-->
 <!--		GROUP BY i.cInvCode,i.cInvName&#45;&#45;,rs.cBatch-->
 <!--		)tab2 on tab2.cInvName=tab.goodsName and tab2.cInvCode=tab.cInvCode-->
@@ -370,7 +359,7 @@ SELECT   	case when (a.iQuantityIn-b.usageQuantity)/a.iQuantityIn   <![CDATA[<=]
 <!--		join UFDATA_101_2021.dbo.Inventory oti on oti.cInvCode=ot.cInvCode-->
 <!--		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},'%')-->
+<!--		and om.cCode LIKE CONCAT('%',#{code},'%')-->
 <!--		group by om.ccode,ot.cInvCode,od.isosid,om.ccode,oti.cInvName-->
 <!--		) as t1,-->
 <!--		(-->
@@ -401,7 +390,7 @@ SELECT   	case when (a.iQuantityIn-b.usageQuantity)/a.iQuantityIn   <![CDATA[<=]
 <!--		join UFDATA_101_2021.dbo.Inventory oti on oti.cInvCode=ot.cInvCode-->
 <!--		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},'%')-->
+<!--		and om.cCode LIKE CONCAT('%',#{code},'%')-->
 <!--		group by om.ccode,ot.cInvCode,od.isosid,om.ccode,oti.cInvName-->
 <!--		) as t1-->
 <!--		left join (-->
@@ -418,7 +407,7 @@ SELECT   	case when (a.iQuantityIn-b.usageQuantity)/a.iQuantityIn   <![CDATA[<=]
 <!--		join UFDATA_102_2021.dbo.PurBillVouch bm  on bm.PBVID=bi.PBVID-->
 <!--		join UFDATA_102_2021.dbo.Vendor ven on bm.cVenCode = ven.cVenCode-->
 <!--		join UFDATA_102_2021.dbo.Inventory oti on oti.cInvCode=pd.cInvCode-->
-<!--		where pm.cVenCode != 'T020001' and pom.cpoid LIKE CONCAT(#{code},'%')-->
+<!--		where pm.cVenCode != 'T020001' and pom.cpoid LIKE CONCAT('%',#{code},'%')-->
 <!--		GROUP BY bi.cInvCode,pod.iorderdid) as t2 on t1.cInvCode=t2.cInvCode and t2.iorderdid=t1.isosid-->
 <!--		) t3  GROUP BY t3.ccode,t3.cInvCode,t3.goodsName-->
 
@@ -435,7 +424,7 @@ SELECT   	case when (a.iQuantityIn-b.usageQuantity)/a.iQuantityIn   <![CDATA[<=]
 <!--		join UFDATA_101_2021.dbo.Inventory oti on oti.cInvCode=ot.cInvCode-->
 <!--		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},'%')-->
+<!--		and om.cCode LIKE CONCAT('%',#{code},'%')-->
 <!--		group by om.ccode,ot.cInvCode,od.isosid,om.ccode,oti.cInvName-->
 <!--		) as t1,-->
 <!--		(-->
@@ -452,13 +441,13 @@ SELECT   	case when (a.iQuantityIn-b.usageQuantity)/a.iQuantityIn   <![CDATA[<=]
 <!--		left join UFDATA_103_2021.dbo.PurBillVouch bm  on bm.PBVID=bi.PBVID-->
 <!--		join UFDATA_103_2021.dbo.Vendor ven on bm.cVenCode = ven.cVenCode-->
 <!--		join UFDATA_103_2021.dbo.Inventory oti on oti.cInvCode=pd.cInvCode-->
-<!--		where pom.cpoid LIKE CONCAT(#{code},'%')-->
+<!--		where pom.cpoid LIKE CONCAT('%',#{code},'%')-->
 <!--		GROUP BY bi.cInvCode,pod.iorderdid) as t2 where t1.cInvCode=t2.cInvCode and t2.iorderdid=t1.isosid-->
 <!--		) t3  GROUP BY t3.ccode,t3.cInvCode,t3.goodsName-->
 <!--		) t4-->
 <!--		where t4.cInvCode not in(-->
 <!--		select cInvCode from UFDATA_103_2021.dbo.cost_allocation_fabric_view vif-->
-<!--		where trim(vif.cCode) like CONCAT(#{code},'%')-->
+<!--		where trim(vif.cCode) like CONCAT('%',#{code},'%')-->
 <!--		)-->
 <!--		GROUP BY t4.cInvCode,t4.goodsName-->
 
@@ -474,7 +463,7 @@ SELECT   	case when (a.iQuantityIn-b.usageQuantity)/a.iQuantityIn   <![CDATA[<=]
 <!--		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.cPOID LIKE CONCAT(#{code},'%')-->
+<!--		and om.cPOID LIKE CONCAT('%',#{code},'%')-->
 <!--		)  and r.cBusType = '普通采购'-->
 <!--		GROUP BY i.cInvCode,i.cInvName-->
 <!--		UNION ALL-->
@@ -487,7 +476,7 @@ SELECT   	case when (a.iQuantityIn-b.usageQuantity)/a.iQuantityIn   <![CDATA[<=]
 <!--		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 om.cCode like CONCAT(#{code},'%')-->
+<!--		and om.cCode like CONCAT('%',#{code},'%')-->
 <!--		) and r.cBusType = '委外加工'-->
 <!--		GROUP BY i.cInvCode,i.cInvName-->
 <!--		)tab1 on tab1.cInvName=tab.goodsName and tab1.cInvCode=tab.cInvCode-->
@@ -501,7 +490,7 @@ SELECT   	case when (a.iQuantityIn-b.usageQuantity)/a.iQuantityIn   <![CDATA[<=]
 <!--		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},'%')-->
+<!--		and omi.cInvCcode like '19%' and om.cCode LIKE CONCAT('%',#{code},'%')-->
 <!--		)-->
 <!--		GROUP BY i.cInvCode,i.cInvName-->
 <!--		)tab2 on tab2.cInvName=tab.goodsName and tab2.cInvCode=tab.cInvCode-->
@@ -547,7 +536,7 @@ SELECT   	case when (a.iQuantityIn-b.usageQuantity)/a.iQuantityIn   <![CDATA[<=]
 						 GROUP BY pod.cInvCode,pod.iorderdid
 				 ) pb on pb.cInvCode=ot.cInvCode and pb.iorderdid=od.isosid
 				WHERE om.iVerifyStateNew = 2  and omi.cInvCcode like '19%'
-							and om.cCode LIKE CONCAT(#{code},'%') and (oti.cInvCcode like '05%' or oti.cInvCcode like '06%'
+							and om.cCode LIKE CONCAT('%',#{code},'%') and (oti.cInvCcode like '05%' or oti.cInvCcode like '06%'
 							or oti.cInvCcode like '07%' or oti.cInvCCode = '0399' or oti.cInvCCode = '0499')
 							and oti.cInvName = #{goodName}
 				GROUP BY oti.cInvName
@@ -562,7 +551,7 @@ SELECT   	case when (a.iQuantityIn-b.usageQuantity)/a.iQuantityIn   <![CDATA[<=]
 		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.cPOID like CONCAT(#{code},'%')
+		and om.cPOID like CONCAT('%',#{code},'%')
 		)
 		GROUP BY i.cInvCode,i.cInvName,rs.cBatch
 		)tab1 on tab1.cInvName=tab.goodsName
@@ -577,7 +566,7 @@ SELECT   	case when (a.iQuantityIn-b.usageQuantity)/a.iQuantityIn   <![CDATA[<=]
 						JOIN UFDATA_103_2021.dbo.OM_MOMaterials ot ON ot.MoDetailsID= od.MODetailsID
 						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},'%')
+						and omi.cInvCcode like '19%' and om.cCode like CONCAT('%',#{code},'%')
 						and (om.cCloser is null or ( (od.iReceivedQTY is not null or od.iReceivedQTY != 0) and (ot.iSendQTY is not null or ot.iSendQTY !=0) )or om.cCloser='asuser')
 
 				) and (i.cInvCcode like '05%' or i.cInvCcode like '06%' or i.cInvCcode like '07%'
@@ -606,7 +595,7 @@ SELECT   	case when (a.iQuantityIn-b.usageQuantity)/a.iQuantityIn   <![CDATA[<=]
 						GROUP BY p.cInvCode,p.iorderdid
 				 ) pb on pb.cInvCode=ot.cInvCode and pb.iorderdid=od.isosid
 				WHERE om.iVerifyStateNew = 2  and omi.cInvCcode like '19%'
-							and om.cCode LIKE CONCAT(#{code},'%') and (oti.cInvCcode like '05%' or oti.cInvCcode like '06%'
+							and om.cCode LIKE CONCAT('%',#{code},'%') and (oti.cInvCcode like '05%' or oti.cInvCcode like '06%'
 							or oti.cInvCcode like '07%' or oti.cInvCCode = '0399' or oti.cInvCCode = '0499')
 							and oti.cInvName = #{goodName}
 				GROUP BY oti.cInvName
@@ -621,7 +610,7 @@ SELECT   	case when (a.iQuantityIn-b.usageQuantity)/a.iQuantityIn   <![CDATA[<=]
 		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.cPOID like CONCAT(#{code},'%')
+		and om.cPOID like CONCAT('%',#{code},'%')
 		)
 		GROUP BY i.cInvCode,i.cInvName,rs.cBatch
 		)tab1 on tab1.cInvName=tab.goodsName
@@ -635,7 +624,7 @@ SELECT   	case when (a.iQuantityIn-b.usageQuantity)/a.iQuantityIn   <![CDATA[<=]
 						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},'%')
+									and omi.cInvCcode like '19%' and om.cCode like CONCAT('%',#{code},'%')
 				) and (i.cInvCcode like '05%' or i.cInvCcode like '06%' or i.cInvCcode like '07%'
 						or i.cInvCCode = '0399' or i.cInvCCode = '0499' or i.cInvCCode = '0299')
 				GROUP BY i.cInvName,rs.cBatch
@@ -674,7 +663,7 @@ SELECT   	case when (a.iQuantityIn-b.usageQuantity)/a.iQuantityIn   <![CDATA[<=]
 						 GROUP BY pod.cInvCode,pod.iorderdid
 				 ) pb on pb.cInvCode=ot.cInvCode and pb.iorderdid=od.isosid
 		WHERE om.iVerifyStateNew = 2  and omi.cInvCcode like '19%'
-					and om.cCode LIKE CONCAT(#{code},'%') and (oti.cInvCcode like '05%' or oti.cInvCcode like '06%'
+					and om.cCode LIKE CONCAT('%',#{code},'%') and (oti.cInvCcode like '05%' or oti.cInvCcode like '06%'
 					or oti.cInvCcode like '07%' or oti.cInvCCode = '0399' or oti.cInvCCode = '0499')
 
 		GROUP BY oti.cInvName
@@ -695,7 +684,7 @@ SELECT   	case when (a.iQuantityIn-b.usageQuantity)/a.iQuantityIn   <![CDATA[<=]
 				GROUP BY p.cInvCode,p.iorderdid
 		 ) pb on pb.cInvCode=ot.cInvCode and pb.iorderdid=od.isosid
 		WHERE om.iVerifyStateNew = 2  and omi.cInvCcode like '19%'
-					and om.cCode LIKE CONCAT(#{code},'%') and (oti.cInvCcode like '05%' or oti.cInvCcode like '06%'
+					and om.cCode LIKE CONCAT('%',#{code},'%') and (oti.cInvCcode like '05%' or oti.cInvCcode like '06%'
 					or oti.cInvCcode like '07%' or oti.cInvCCode = '0399' or oti.cInvCCode = '0499')
 
 		GROUP BY oti.cInvName

+ 47 - 16
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/xml/SyCostAllocationMapper.xml

@@ -37,7 +37,7 @@
                      inner JOIN UFDATA_101_2021.dbo.OM_MODetails od ON om.MOID = od.MOID
    inner JOIN (select MOID,max(iSendQTY) as iSendQTY from UFDATA_101_2021.dbo.OM_MOMaterials GROUP BY MOID) ot on ot.MOID=om.MOID
       WHERE
-                     om.iVerifyStateNew = 2  and om.cCode like CONCAT(#{code},'%')
+                     om.iVerifyStateNew = 2  and om.cCode like CONCAT('%',#{code},'%')
                      and (om.cCloser is null or ( (od.iReceivedQTY is not null or od.iReceivedQTY != 0) and (ot.iSendQTY is not null or ot.iSendQTY !=0) )or om.cCloser='asuser')
                      ) o ON s.isosid  = o.isosid AND s.cInvCode = o.cInvCode
         inner JOIN UFDATA_101_2021.dbo.Vendor v ON o.supplierCode= v.cVenCode
@@ -67,7 +67,7 @@
                      inner JOIN UFDATA_103_2021.dbo.OM_MODetails od ON om.MOID = od.MOID
    inner JOIN (select MOID,max(iSendQTY) as iSendQTY from UFDATA_103_2021.dbo.OM_MOMaterials GROUP BY MOID) ot on ot.MOID=om.MOID
       WHERE
-                     om.iVerifyStateNew = 2  and om.cCode like CONCAT(#{code},'%')
+                     om.iVerifyStateNew = 2  and om.cCode like CONCAT('%',#{code},'%')
                      and (om.cCloser is null or ( (od.iReceivedQTY is not null or od.iReceivedQTY != 0) and (ot.iSendQTY is not null or ot.iSendQTY !=0) )or om.cCloser='asuser')
                      ) o ON a.isosid  = o.isosid AND a.cInvCode = o.cInvCode
         inner JOIN UFDATA_103_2021.dbo.Vendor v ON o.supplierCode= v.cVenCode
@@ -103,9 +103,9 @@
                      FROM
                      UFDATA_103_2021.dbo.OM_MOMain om
                      inner JOIN UFDATA_103_2021.dbo.OM_MODetails od ON om.MOID = od.MOID
-   inner JOIN (select MOID,max(iSendQTY) as iSendQTY from UFDATA_103_2021.dbo.OM_MOMaterials GROUP BY MOID) ot on ot.MOID=om.MOID
-    WHERE
-                     om.iVerifyStateNew = 2  and om.cCode like CONCAT(#{code},'%')
+                     inner JOIN (select MOID,max(iSendQTY) as iSendQTY from UFDATA_103_2021.dbo.OM_MOMaterials GROUP BY MOID) ot on ot.MOID=om.MOID
+                     WHERE
+                     om.iVerifyStateNew = 2  and om.cCode like CONCAT('%',#{code},'%')
                      and (om.cCloser is null or ( (od.iReceivedQTY is not null or od.iReceivedQTY != 0) and (ot.iSendQTY is not null or ot.iSendQTY !=0) )or om.cCloser='asuser')
                      ) o ON a.isosid  = o.isosid AND a.cInvCode = o.cInvCode
         inner JOIN UFDATA_103_2021.dbo.Vendor v ON o.supplierCode= v.cVenCode
@@ -126,7 +126,7 @@
             max(o.omCode) as planNum,max(s1.cdefine22) as poStyleNum,max(pe.cPersonName) as exportSales,
             max(ss1.cSOCode) as garmentContractno,max(de.cDepName) as department,
             max(cu.cCusAbbName) as customerShortame,v.cVenAbbName as processUnit,
-            max(ss1.iTaxRate) as taxrate,max(ss1.cMaker) as preparedBy,sum(s.iNatSum) as salesordersLocaltotal,
+            max(ss1.iTaxRate) as taxrate,max(ss1.cMaker) as preparedBy,sum(s1.iNatSum) as salesordersLocaltotal,
             sum(s.iSum) as salesrrdersOriginaltotal,sum(o.iQuantity) as planQuantity
         FROM  UFDATA_103_2021.dbo.SO_SODetails a
         inner JOIN UFDATA_103_2021.dbo.SO_SOMain b on b.ID= a.ID
@@ -140,7 +140,7 @@
                      inner JOIN UFDATA_103_2021.dbo.OM_MODetails od ON om.MOID = od.MOID
                         inner JOIN (select MOID,max(iSendQTY) as iSendQTY from UFDATA_103_2021.dbo.OM_MOMaterials GROUP BY MOID) ot on ot.MOID=om.MOID
                            WHERE
-                     om.iVerifyStateNew = 2  and om.cCode like CONCAT(#{code},'%')
+                     om.iVerifyStateNew = 2  and om.cCode like CONCAT('%',#{code},'%')
                      and (om.cCloser is null or ( (od.iReceivedQTY is not null or od.iReceivedQTY != 0) and (ot.iSendQTY is not null or ot.iSendQTY !=0) )or om.cCloser='asuser')
                      ) o ON a.isosid  = o.isosid AND a.cInvCode = o.cInvCode
         inner JOIN UFDATA_103_2021.dbo.Vendor v ON o.supplierCode= v.cVenCode
@@ -161,6 +161,37 @@
         inner join UFDATA_101_2021.dbo.Person j on j.cPersonCode=ss1.cPersonCode
         inner JOIN UFDATA_101_2021.dbo.Customer cu ON ss1.cCusCode = cu.cCusCode
         WHERE cc.cCusCode in ('0001') and ss.cCusCode in ('T020001') and c.cInvCcode like '19%' GROUP BY v.cVenAbbName
+        UNION ALL
+
+		SELECT max(ss.iExchRate) as exchangeRate,min(s.iTaxUnitPrice) as soPrice,'101' as pkOrg,
+            max(o.omCode) as planNum,max(s.cdefine22) as poStyleNum,max(pe.cPersonName) as exportSales,
+            max(ss.cSOCode) as garmentContractno,max(de.cDepName) as department,
+            max(cc.cCusAbbName) as customerShortame,v.cVenAbbName as processUnit,
+            max(ss.iTaxRate) as taxrate,max(ss.cMaker) as preparedBy,sum(s.iNatSum) as salesordersLocaltotal,
+            sum(s.iSum) as salesrrdersOriginaltotal,sum(o.iQuantity) as planQuantity
+        FROM  UFDATA_103_2021.dbo.SO_SODetails s
+        inner JOIN UFDATA_103_2021.dbo.SO_SOMain ss on ss.ID= s.ID
+        inner JOIN (
+                     SELECT
+                     om.cCode AS omCode,
+                     om.MOID AS ompoId,od.MODetailsID AS ompoIdItem,
+                     om.cVenCode AS supplierCode,od.cInvCode,od.isosid,od.iQuantity
+                     FROM
+                     UFDATA_103_2021.dbo.OM_MOMain om
+                     inner JOIN UFDATA_103_2021.dbo.OM_MODetails od ON om.MOID = od.MOID
+   inner JOIN (select MOID,max(iSendQTY) as iSendQTY from UFDATA_103_2021.dbo.OM_MOMaterials GROUP BY MOID) ot on ot.MOID=om.MOID
+      WHERE
+                     om.iVerifyStateNew = 2  and om.cCode like CONCAT('%',#{code},'%')
+                     and (om.cCloser is null or ( (od.iReceivedQTY is not null or od.iReceivedQTY != 0) and (ot.iSendQTY is not null or ot.iSendQTY !=0) )or om.cCloser='asuser')
+                     ) o ON s.isosid  = o.isosid AND s.cInvCode = o.cInvCode
+        inner JOIN UFDATA_103_2021.dbo.Vendor v ON o.supplierCode= v.cVenCode
+        inner JOIN UFDATA_103_2021.dbo.Inventory c on c.cInvCode=s.cInvCode
+        inner JOIN UFDATA_103_2021.dbo.Person  pe ON ss.cPersonCode = pe.cPersonCode
+        inner JOIN UFDATA_103_2021.dbo.Department de ON ss.cDepCode = de.cDepCode
+        inner JOIN UFDATA_103_2021.dbo.Customer cc ON ss.cCusCode = cc.cCusCode
+        WHERE c.cInvCcode like '19%' GROUP BY v.cVenAbbName
+
+
 
 
     /* UNION ALL
@@ -234,7 +265,7 @@
                      inner JOIN UFDATA_101_2021.dbo.OM_MODetails od ON om.MOID = od.MOID
    inner JOIN (select MOID,max(iSendQTY) as iSendQTY from UFDATA_101_2021.dbo.OM_MOMaterials GROUP BY MOID) ot on ot.MOID=om.MOID
       WHERE
-                     om.iVerifyStateNew = 2  and om.cCode like CONCAT(#{code},'%')
+                     om.iVerifyStateNew = 2  and om.cCode like CONCAT('%',#{code},'%')
                      and (om.cCloser is null or ( (od.iReceivedQTY is not null or od.iReceivedQTY != 0) and (ot.iSendQTY is not null or ot.iSendQTY !=0) )or om.cCloser='asuser')
                      ) o ON s.isosid  = o.isosid AND s.cInvCode = o.cInvCode
         inner JOIN UFDATA_101_2021.dbo.Vendor v ON o.supplierCode= v.cVenCode
@@ -259,7 +290,7 @@
                      inner JOIN UFDATA_103_2021.dbo.OM_MODetails od ON om.MOID = od.MOID
    inner JOIN (select MOID,max(iSendQTY) as iSendQTY from UFDATA_103_2021.dbo.OM_MOMaterials GROUP BY MOID) ot on ot.MOID=om.MOID
       WHERE
-                     om.iVerifyStateNew = 2  and om.cCode like CONCAT(#{code},'%')
+                     om.iVerifyStateNew = 2  and om.cCode like CONCAT('%',#{code},'%')
                      and (om.cCloser is null or ( (od.iReceivedQTY is not null or od.iReceivedQTY != 0) and (ot.iSendQTY is not null or ot.iSendQTY !=0) )or om.cCloser='asuser')
                      ) o ON a.isosid  = o.isosid AND a.cInvCode = o.cInvCode
         inner JOIN UFDATA_103_2021.dbo.Vendor v ON o.supplierCode= v.cVenCode
@@ -292,7 +323,7 @@
                      inner JOIN UFDATA_103_2021.dbo.OM_MODetails od ON om.MOID = od.MOID
    inner JOIN (select MOID,max(iSendQTY) as iSendQTY from UFDATA_103_2021.dbo.OM_MOMaterials GROUP BY MOID) ot on ot.MOID=om.MOID
     WHERE
-                     om.iVerifyStateNew = 2  and om.cCode like CONCAT(#{code},'%')
+                     om.iVerifyStateNew = 2  and om.cCode like CONCAT('%',#{code},'%')
                      and (om.cCloser is null or ( (od.iReceivedQTY is not null or od.iReceivedQTY != 0) and (ot.iSendQTY is not null or ot.iSendQTY !=0) )or om.cCloser='asuser')
                      ) o ON a.isosid  = o.isosid AND a.cInvCode = o.cInvCode
         inner JOIN UFDATA_103_2021.dbo.Vendor v ON o.supplierCode= v.cVenCode
@@ -322,7 +353,7 @@
                      inner JOIN UFDATA_103_2021.dbo.OM_MODetails od ON om.MOID = od.MOID
                         inner JOIN (select MOID,max(iSendQTY) as iSendQTY from UFDATA_103_2021.dbo.OM_MOMaterials GROUP BY MOID) ot on ot.MOID=om.MOID
                            WHERE
-                     om.iVerifyStateNew = 2  and om.cCode like CONCAT(#{code},'%')
+                     om.iVerifyStateNew = 2  and om.cCode like CONCAT('%',#{code},'%')
                      and (om.cCloser is null or ( (od.iReceivedQTY is not null or od.iReceivedQTY != 0) and (ot.iSendQTY is not null or ot.iSendQTY !=0) )or om.cCloser='asuser')
                      ) o ON a.isosid  = o.isosid AND a.cInvCode = o.cInvCode
         inner JOIN UFDATA_103_2021.dbo.Vendor v ON o.supplierCode= v.cVenCode
@@ -359,7 +390,7 @@
 	join UFDATA_101_2021.dbo.PurBillVouch pb on pb.PBVID  = pbs.PBVID
 	join UFDATA_101_2021.dbo.Inventory omi on omi.cInvCode=pbs.cInvCode
 		join UFDATA_101_2021.dbo.SO_SOMain so on pd.csoordercode = so.csocode
-	where pm.cPOID like CONCAT(#{code},'%') and (omi.cInvCcode like '03%' or omi.cInvCcode like '04%') and omi.cInvCCode != '0399' and omi.cInvCCode != '0499' and omi.cInvCCode != '0299'
+	where pm.cPOID like CONCAT('%',#{code},'%') and (omi.cInvCcode like '03%' or omi.cInvCcode like '04%') and omi.cInvCCode != '0399' and omi.cInvCCode != '0499' and omi.cInvCCode != '0299'
 	 and omi.cInvCCode != '07'and omi.cInvCCode != '06'and omi.cInvCCode != '05' and pb.cVenCode not in('T010001','T020001')
    group by omi.cInvName
 	UNION ALL
@@ -371,7 +402,7 @@ select omi.cInvName as cInvName,sum(pbs.iOriSum) as iOriSum,sum(round(pbs.iOriSu
 	join UFDATA_102_2021.dbo.PurBillVouch pb on pb.PBVID  = pbs.PBVID
 	join UFDATA_102_2021.dbo.Inventory omi on omi.cInvCode=pbs.cInvCode
 		join UFDATA_102_2021.dbo.SO_SOMain so on pd.csoordercode = so.csocode
-	where pm.cPOID like CONCAT(#{code},'%') and (omi.cInvCcode like '03%' or omi.cInvCcode like '04%') and omi.cInvCCode != '0399' and omi.cInvCCode != '0499' and omi.cInvCCode != '0299'
+	where pm.cPOID like CONCAT('%',#{code},'%') and (omi.cInvCcode like '03%' or omi.cInvCcode like '04%') and omi.cInvCCode != '0399' and omi.cInvCCode != '0499' and omi.cInvCCode != '0299'
 	 and omi.cInvCCode != '07'and omi.cInvCCode != '06'and omi.cInvCCode != '05' and pb.cVenCode not in('T010001','T020001')
 group by omi.cInvName
 		UNION ALL
@@ -384,7 +415,7 @@ select omi.cInvName as cInvName,sum(pbs.iOriSum) as iOriSum,sum(round(pbs.iOriSu
 	join UFDATA_103_2021.dbo.PurBillVouch pb on pb.PBVID  = pbs.PBVID
 	join UFDATA_103_2021.dbo.Inventory omi on omi.cInvCode=pbs.cInvCode
 		join UFDATA_103_2021.dbo.SO_SOMain so on pd.csoordercode = so.csocode
-	where pm.cPOID like CONCAT(#{code},'%') and (omi.cInvCcode like '03%' or omi.cInvCcode like '04%') and omi.cInvCCode != '0399' and omi.cInvCCode != '0499' and omi.cInvCCode != '0299'
+	where pm.cPOID like CONCAT('%',#{code},'%') and (omi.cInvCcode like '03%' or omi.cInvCcode like '04%') and omi.cInvCCode != '0399' and omi.cInvCCode != '0499' and omi.cInvCCode != '0299'
 	and omi.cInvCCode != '07'and omi.cInvCCode != '06'and omi.cInvCCode != '05' and pb.cVenCode not in('T010001','T020001')
 	group by omi.cInvName
 		) t where t.iOriSum is not null group by t.cInvName
@@ -409,8 +440,8 @@ select sum(iquantity) as salerIquantity from UFDATA_102_2021.dbo.SO_SODetails a
 </foreach>
 union all
 select sum(iquantity) as salerIquantity from UFDATA_103_2021.dbo.SO_SODetails a
-		inner join UFDATA_102_2021.dbo.SO_SOMain b on a.ID = b.ID
-	inner JOIN UFDATA_102_2021.dbo.Customer cu ON b.cCusCode = cu.cCusCode
+		inner join UFDATA_103_2021.dbo.SO_SOMain b on a.ID = b.ID
+	inner JOIN UFDATA_103_2021.dbo.Customer cu ON b.cCusCode = cu.cCusCode
  WHERE b.cCusCode not in ('0001','T020001')
  and a.csocode in
 <foreach collection="csocode" item="value" index="index" open="(" separator="," close=")">

+ 5 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/xml/SyCostAllocationShipdetailMapper.xml

@@ -18,7 +18,7 @@
 
 	<select id="queryByCostShipdetail" resultType="org.jeecg.modules.cost.entity.SyCostAllocationShipdetail">
 
-		select* from VIEW_fenpei_chuyunmingxi where ccode like  CONCAT(#{code},'%') order by outdata;
+		select* from VIEW_fenpei_chuyunmingxi where ccode like  CONCAT('%',#{code},'%') order by outdata;
 	</select>
 
 	<!--<select id="queryByCostShipdetail" resultType="org.jeecg.modules.cost.entity.SyCostAllocationShipdetail">
@@ -39,7 +39,7 @@ left join UFDATA_101_2021.dbo.om_momain ommo on ommo.moid=ommos.moid
 left join UFDATA_101_2021.dbo.SO_SODetails sd on sd.iSOsID = ommos.isosid
 	left join UFDATA_101_2021.dbo.Inventory inv on pbvs.cInvCode = inv.cInvCode
 group by pbv.cDefine10,pbvs.cInvCode,pbvs.cFree1,pbvs.cFree2,pbv.cBusType,inv.cInvCCode,ommo.ccode,ommo.cVenCode,pbvs.cDefine28
-having ommo.ccode like CONCAT(#{code},'%') AND pbv.cBusType='委外加工' and inv.cInvCCode like '19%') as pbv
+having ommo.ccode like CONCAT('%',#{code},'%') AND pbv.cBusType='委外加工' and inv.cInvCCode like '19%') as pbv
 left join
 &#45;&#45; 根据外销发票号 加物料编码以及自由项组合计算 销售发票合计数量
 (select sbv.cDefine10,sum(sbvs.iQuantity) as iQuantity,sbvs.cInvCode,sbvs.cFree1,sbvs.cFree2,min(sbv.dDate) as dDate,max(sbv.iExchRate) as iExchRate,sbvs.cSOCode as cSOCode,max(sbvs.iTaxUnitPrice) AS exportUnitPrice,sum(sbvs.iSum) as exportPrice,sum(sbvs.iNatSum) as rmbAmount,max(sbv.cexch_name) as cexch_name,sbvs.cDefine28 as cDefine28
@@ -91,7 +91,7 @@ GROUP BY sbv.cDefine10,sbv.iExchRate,sbv.cSOCode
 									 left join UFDATA_103_2021.dbo.PurBillVouch pb  on bi.PBVID =pb.PBVID 
 									 	left join UFDATA_103_2021.dbo.Inventory inv on bi.cInvCode = inv.cInvCode
 									 WHERE
-									 om.iVerifyStateNew = 2  and om.cCode like CONCAT(#{code},'%') and inv.cInvCCode like '19%'
+									 om.iVerifyStateNew = 2  and om.cCode like CONCAT('%',#{code},'%') and inv.cInvCCode like '19%'
 									 GROUP BY od.csoordercode
 									 ) o ON a.csocode = o.csoordercode 
 						inner JOIN UFDATA_103_2021.dbo.Vendor v ON o.supplierCode= v.cVenCode
@@ -150,7 +150,7 @@ GROUP BY sbv.cDefine10,sbv.iExchRate,sbv.cSOCode
 									  left join UFDATA_103_2021.dbo.PurBillVouch pb  on bi.PBVID =pb.PBVID 
 										left join UFDATA_103_2021.dbo.Inventory inv on bi.cInvCode = inv.cInvCode
 									 WHERE
-									 om.iVerifyStateNew = 2  and om.cCode like CONCAT(#{code},'%') and inv.cInvCCode like '19%'
+									 om.iVerifyStateNew = 2  and om.cCode like CONCAT('%',#{code},'%') and inv.cInvCCode like '19%'
 									 GROUP BY od.csoordercode
 									 ) o ON a.csocode = o.csoordercode 
 						inner JOIN UFDATA_103_2021.dbo.Vendor v ON o.supplierCode= v.cVenCode
@@ -210,7 +210,7 @@ UNION ALL
 									  left join UFDATA_103_2021.dbo.PurBillVouch pb  on bi.PBVID =pb.PBVID 
 										left join UFDATA_103_2021.dbo.Inventory inv on bi.cInvCode = inv.cInvCode
 									 WHERE
-									 om.iVerifyStateNew = 2  and om.cCode like CONCAT(#{code},'%') and inv.cInvCCode like '19%'
+									 om.iVerifyStateNew = 2  and om.cCode like CONCAT('%',#{code},'%') and inv.cInvCCode like '19%'
 									 GROUP BY od.csoordercode
 									 ) o ON a.csocode = o.csoordercode 
 						inner JOIN UFDATA_103_2021.dbo.Vendor v ON o.supplierCode= v.cVenCode

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

@@ -226,21 +226,32 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
         if (syLossReport1 != null){
             //人民币面料含税成本和不含税成本
             fabricLoss1 = JSON.parseObject(JSON.toJSONString(syLossReport1.getContent()), FabricLoss.class);
-            syCostAllocation.setFabriccostIncludestax(new BigDecimal(fabricLoss1.getActualMoney()));
+
+            BigDecimal fabariccostIncludestax=new BigDecimal("0");
+            for (FabricCostInvoice fabricCostInvoice : fabricLoss1.getFabricCostInvoiceList()){
+                if (fabricCostInvoice.getIMoney()!=null){
+                    fabariccostIncludestax=fabariccostIncludestax.add(new BigDecimal(fabricCostInvoice.getIMoney())).setScale(2, RoundingMode.HALF_UP) ;
+                }
+            }
+//            syCostAllocation.setFabriccostIncludestax(new BigDecimal(fabricLoss1.getActualMoney()));// 实际总金额
+            syCostAllocation.setFabriccostIncludestax(fabariccostIncludestax);// 实际总金额
+            System.out.println("fabricCostInvoiceList\t"+fabricLoss1.getFabricCostInvoiceList());
+            System.out.println("fabricCostInvoiceList.SIZE\t"+fabricLoss1.getFabricCostInvoiceList().size());
+            System.out.println("面辅料人名币含税成本\t"+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());
+//            System.out.println("面辅料人名币含税成本\t"+syCostAllocation.getFabriccostInc ludestax());
+//            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());
+//            System.out.println("面辅料美元含税成本\t"+syCostAllocation.getFabriccostInc ludestaxUsd());
+//            System.out.println("面辅料美元不含税成本\t"+syCostAllocation.getFabriccostNotincludestaxUsd());
         }
 
         /*如果出现多供应商的情况拼接 供应商*/
         for (int i=0;i<list.size();i++) {
             SyCostAllocation objs = list.get(i);
-            if(i>0){
+            if(i>0&&syCostAllocation.getProcessUnit()!=null && objs.getProcessUnit()!=null && syCostAllocation.getProcessUnit().indexOf(objs.getProcessUnit())<0){
                 syCostAllocation.setProcessUnit(syCostAllocation.getProcessUnit()+","+objs.getProcessUnit());
             }
         }
@@ -273,7 +284,9 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
             if(oConvertUtils.isEmpty(Fabric.getFabrictransferQuantity())){
                 Fabric.setFabrictransferQuantity(BigDecimal.ZERO);
             }
-            if(0!=Fabric.getFabrictransferQuantity().compareTo(BigDecimal.ZERO)){
+            //转入数量、余下数量
+            if(0!=Fabric.getFabrictransferQuantity().compareTo(BigDecimal.ZERO) || 0!=Fabric.getFabricremainingQuantity().compareTo(BigDecimal.ZERO)){
+                System.out.println("goodsName\t"+Fabric.getGoodsName()+"Fabric.getFabrictransferQuantity()\t"+Fabric.getFabrictransferQuantity());
                 List<SyTransfer> transferlist  = syCostAllocationFabricMapper.queryTransferByFabric(plannum,Fabric.getGoodsName());
                 BigDecimal cost = new BigDecimal(BigInteger.ZERO);
                 BigDecimal quantity = new BigDecimal(BigInteger.ZERO);
@@ -379,6 +392,7 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
 //                System.out.println("面辅料美元含税成本\t"+syCostAllocation.getFabriccostIncludestaxUsd());
 //                System.out.println("面辅料美元不含税成本\t"+syCostAllocation.getFabriccostNotincludestaxUsd());
                 Fabric.setSyRemaining(syRemaining);
+                System.out.println("余下数量\n"+syRemaining);
             }
 
             //多发少发链接结合赋值
@@ -439,7 +453,7 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
         }
 
         //查询U8数据 辅料数据关联临时表
-        List<SyCostAllocationIngredient> list4 = syCostAllocationIngredientMapper.queryByCostIngredient1(plannum);
+        List<SyCostAllocationIngredient> list4 = syCostAllocationIngredientMapper.queryByCostIngredient2(plannum);
         HashMap<String,List<SyCostAllocationIngredient>> stringListHashMap=new HashMap();//物料名称+物料编码
         HashMap<String,List<SyCostAllocationIngredient>> stringListHashMap2=new HashMap();//物料名称+物料编码+供应商
         List<SyCostAllocationIngredient> ingredients4=new ArrayList<>();//重新赋值
@@ -507,6 +521,7 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
                            allocationIngredient1.setIngredientsRemainingQuantity(ingredientsRemainingQuantity);
                        }else{
                            allocationIngredient1.setIngredientsRemainingQuantity(BigDecimal.ZERO);
+                           allocationIngredient1.setTransferCost(BigDecimal.ZERO);
                        }
 //                       allocationIngredient1.setIngredientsRemainingQuantity(allocationIngredient1.getPurchaseQuantity().subtract(ingredient.getUsageQuantity()));
                        //转入数量
@@ -679,11 +694,11 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
             }
             //人民币(不含税)算占比
             if(oConvertUtils.isNotEmpty(syCostAllocationCostpay.getDisbursedLocalmoney())){
-                syCostAllocationCostpay.setDisbursedLocalmoney(syCostAllocationCostpay.getDisbursedLocalmoney().multiply(zhanBi));
+                syCostAllocationCostpay.setDisbursedLocalmoney(syCostAllocationCostpay.getDisbursedLocalmoney().multiply(zhanBi).setScale(2,BigDecimal.ROUND_HALF_UP));
             }
             //美元算占比
             if(oConvertUtils.isNotEmpty(syCostAllocationCostpay.getDisbursedOriginalmoney())){
-                syCostAllocationCostpay.setDisbursedOriginalmoney(syCostAllocationCostpay.getDisbursedOriginalmoney().multiply(zhanBi));
+                syCostAllocationCostpay.setDisbursedOriginalmoney(syCostAllocationCostpay.getDisbursedOriginalmoney().multiply(zhanBi).setScale(2,BigDecimal.ROUND_HALF_UP));
             }
 
             //费用支出单原币本币汇总 并 赋值给表头(运杂费)

+ 59 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/costLossReview/controller/SyCostLossReviewController.java

@@ -4,6 +4,7 @@ import com.alibaba.excel.EasyExcel;
 import com.alibaba.excel.ExcelWriter;
 import com.alibaba.excel.write.metadata.WriteSheet;
 import com.alibaba.excel.write.metadata.fill.FillConfig;
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -16,6 +17,9 @@ import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.base.controller.JeecgController;
 import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.modules.cost.entity.SyCostAllocation;
+import org.jeecg.modules.cost.entity.SyCostJson;
+import org.jeecg.modules.cost.service.ISyCostAllocationService;
 import org.jeecg.modules.cost.vo.SyCostAllocationPage;
 import org.jeecg.modules.documents.costLossReview.entity.CostAllocationReview;
 import org.jeecg.modules.documents.costLossReview.entity.FabricLossReview;
@@ -44,6 +48,7 @@ import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.*;
+import java.math.BigDecimal;
 import java.sql.Wrapper;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -54,6 +59,8 @@ import java.util.stream.Collectors;
 @RestController
 @RequestMapping("/orderData/syCostLossReview")
 public class SyCostLossReviewController extends JeecgController<SyOrderData, ISyOrderDataService> {
+    @Autowired
+    private ISyCostAllocationService syCostAllocationService;
    @Autowired
    private ISyCostLossReviewService syCostLossReviewService;
     @Autowired
@@ -89,9 +96,13 @@ public class SyCostLossReviewController extends JeecgController<SyOrderData, ISy
            if(syCostLossReview.getFstatus()!=null && syCostLossReview.getFstatus()!="" || oConvertUtils.isNotEmpty(syCostLossReview.getFfirstApproveDateB())){
                //查面损的数据
                List<String> statusList = new ArrayList<>();
-               String statusSplit[] = syCostLossReview.getFstatus().split(",");
-               for(String str:statusSplit){
-                   statusList.add(str);
+               if(syCostLossReview.getFstatus()!=null){
+                   String statusSplit[] = syCostLossReview.getFstatus().split(",");
+                   for(String str:statusSplit){
+                       statusList.add(str);
+                   }
+               }else{
+                   statusList=null;
                }
                List<String> list= syCostLossReviewService.queryCodeByfstatus(statusList,syCostLossReview.getFfirstApproveDateB(),syCostLossReview.getFfirstApproveDateE());
                if(list.size()<1){
@@ -338,6 +349,31 @@ public class SyCostLossReviewController extends JeecgController<SyOrderData, ISy
         IPage<CostAllocationReview> pageList = syCostLossReviewService.queryCostAllocation(statusList,sy,page);
 
         for(CostAllocationReview li:pageList.getRecords()){
+
+            SyCostAllocation syCostAllocation=new SyCostAllocation();
+            List<AccessorItem> accessorItemList = new ArrayList<>();
+            List<SyCostJson> list = syCostAllocationService.queryByCostJson(li.getPlanNum(),0,1);
+            if(list.size()>0){
+                syCostAllocation = JSON.parseObject(JSON.toJSONString(list.get(0).getCostInfo()), SyCostAllocation.class);
+                syCostAllocation.setAttachs(list.get(0).getAttachs());
+
+                if (org.jeecg.modules.system.util.oConvertUtils.isNotEmpty(syCostAllocation.getGarmentContractno())) {
+                    accessorItemList = fabricLossMapper.getSoAccList(Arrays.asList(syCostAllocation.getGarmentContractno().split(",")));
+                    accessorItemList.forEach(e -> e.setFileurl("/report/FabricLoss/getFile?fileId=" + e.getCFileId() + "&filename=" + e.getFilename()));
+                }
+                syCostAllocation.setAccessorItemList(accessorItemList);
+                Result.OK(syCostAllocation);
+            }
+            li.setSyCostAllocation(syCostAllocation);
+
+            li.setSignA("");
+            li.setSignB("");
+            if (li.getSignNumA()!=null&&li.getSignNumA().doubleValue()>0){
+                li.setSignA("red");
+            }
+            if (li.getSignNumB()!=null&&li.getSignNumB().doubleValue()>0.8){
+                li.setSignB("blue");
+            }
             //查询指派人
             String name = syCostLossReviewMapper.querySyApprovalAssignedBy2(li.getPlanNum());
             if(oConvertUtils.isNotEmpty(name)){
@@ -536,7 +572,26 @@ public class SyCostLossReviewController extends JeecgController<SyOrderData, ISy
             }
 
         }
-        IPage<CostAllocationReview> pageList = syCostLossReviewService.queryCostAllocation(statusList,sy,page);
+        IPage<CostAllocationReview> pageList = syCostLossReviewService.queryCostAllocation2(statusList,sy,page);
+
+        for(CostAllocationReview li:pageList.getRecords()){
+            li.setSignA("");
+            li.setSignB("");
+            if (li.getSignNumA()!=null&&li.getSignNumA().doubleValue()>0){
+                li.setSignA("red");
+            }
+            if (li.getSignNumB()!=null&&li.getSignNumB().doubleValue()>0.8){
+                li.setSignB("blue");
+            }
+            //查询指派人
+            String name = syCostLossReviewMapper.querySyApprovalAssignedBy2(li.getPlanNum());
+            if(oConvertUtils.isNotEmpty(name)){
+                li.setApprovalMan(name);
+            }else{
+                li.setApprovalMan("");
+            }
+
+        }
         //获取模板输入流
         InputStream inStream = new FileInputStream("D:\\单证模板\\成本分配列表.xlsx");
         //通过poi创建表对象

+ 18 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/costLossReview/entity/CostAllocationReview.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import org.jeecg.modules.cost.entity.SyCostAllocation;
 import org.jeecgframework.poi.excel.annotation.Excel;
 import org.springframework.format.annotation.DateTimeFormat;
 
@@ -131,4 +132,21 @@ public class CostAllocationReview {
     private java.math.BigDecimal pkorgAmountrmb;
     //附件
     private String attachs;
+
+    //标记(A)数量
+//    @TableField(exist = false)
+    private java.math.BigDecimal signNumA;
+    //标记(B)数量
+//    @TableField(exist = false)
+    private java.math.BigDecimal signNumB;
+
+    //标记(A)
+    @TableField(exist = false)
+    private String signA;
+    //标记(B)
+    @TableField(exist = false)
+    private String signB;
+
+    @TableField(exist = false)
+    private SyCostAllocation syCostAllocation;
 }

+ 4 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/costLossReview/entity/SyCostLossReview.java

@@ -50,8 +50,10 @@ public class SyCostLossReview {
 	@ApiModelProperty(value = "制单人")
 	private String maker;
 
+	//交单日期
 	private String fsubmitDate;
 
+	//返单日期
 	private String frejectDate;
 
 	private String ffirstApproveDate;
@@ -72,8 +74,10 @@ public class SyCostLossReview {
 
 	private String crejectDate;
 
+	//初审通过日期
 	private String cfirstApproveDate;
 
+	//终审通过日期
 	private String cfinalApproveDate;
 
 	private String cstatus;

+ 1 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/costLossReview/mapper/SyCostLossReviewMapper.java

@@ -31,6 +31,7 @@ public interface SyCostLossReviewMapper extends BaseMapper<SyCostLossReview> {
 
     IPage<FabricLossReview> querySyFabricLossReport(@Param("status") List<String> status,@Param("sy")FabricLossReview sy, Page<FabricLossReview> page);
     IPage<CostAllocationReview> queryCostAllocation(@Param("status") List<String> status,@Param("sy")CostAllocationReview sy, Page<CostAllocationReview> page);
+    IPage<CostAllocationReview> queryCostAllocation2(@Param("status") List<String> status,@Param("sy")CostAllocationReview sy, Page<CostAllocationReview> page);
 
     List<SyCostLossReview> querySyFabricLossByCode();
     List<SyCostLossReview> querySyFabricLossByCode2();

+ 163 - 14
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/costLossReview/mapper/xml/SyCostLossReviewMapper.xml

@@ -11,14 +11,14 @@
         pe.cPersonName as salesman,cMaker as maker from UFDATA_103_2021.dbo.OM_MOMain s
         JOIN UFDATA_103_2021.dbo.Department de ON s.cDepCode = de.cDepCode
         JOIN UFDATA_103_2021.dbo.Person  pe ON s.cPersonCode = pe.cPersonCode
-        where cCode like 'sy%' and CHARINDEX('-',cCode)>0
+        where cCode like 'sy%' and CHARINDEX('-',cCode)>0 and cCode not like '%样%'
 
         union all
         select LEFT(cPOID,CHARINDEX('-',cPOID)-1) as planNo,cAuditDate as dverifyDate,de.cDepName as department,
         pe.cPersonName as salesman,cMaker as maker from UFDATA_103_2021.dbo.PO_Pomain s
         JOIN UFDATA_103_2021.dbo.Department de ON s.cDepCode = de.cDepCode
         JOIN UFDATA_103_2021.dbo.Person  pe ON s.cPersonCode = pe.cPersonCode
-        where cPOID like 'sy%' and CHARINDEX('-',cPOID)>0
+        where cPOID like 'sy%' and CHARINDEX('-',cPOID)>0 and cPOID not like '%样%'
 
         union all
 
@@ -26,21 +26,21 @@
         pe.cPersonName as salesman,cMaker as maker from UFDATA_101_2021.dbo.OM_MOMain s
         JOIN UFDATA_101_2021.dbo.Department de ON s.cDepCode = de.cDepCode
         JOIN UFDATA_101_2021.dbo.Person  pe ON s.cPersonCode = pe.cPersonCode
-        where cCode like 'sy%' and CHARINDEX('-',cCode)>0
+        where cCode like 'sy%' and CHARINDEX('-',cCode)>0 and cCode not like '%样%'
 
         union all
         select LEFT(cPOID,CHARINDEX('-',cPOID)-1) as planNo,cAuditDate as dverifyDate,de.cDepName as department,
         pe.cPersonName as salesman,cMaker as maker from UFDATA_101_2021.dbo.PO_Pomain s
         JOIN UFDATA_101_2021.dbo.Department de ON s.cDepCode = de.cDepCode
         JOIN UFDATA_101_2021.dbo.Person  pe ON s.cPersonCode = pe.cPersonCode
-        where cPOID like 'sy%' and CHARINDEX('-',cPOID)>0
+        where cPOID like 'sy%' and CHARINDEX('-',cPOID)>0 and cPOID not like '%样%'
 
         union all
         select LEFT(cPOID,CHARINDEX('-',cPOID)-1) as planNo,cAuditDate as dverifyDate,de.cDepName as department,
         pe.cPersonName as salesman,cMaker as maker from UFDATA_102_2021.dbo.PO_Pomain s
         JOIN UFDATA_102_2021.dbo.Department de ON s.cDepCode = de.cDepCode
         JOIN UFDATA_102_2021.dbo.Person  pe ON s.cPersonCode = pe.cPersonCode
-        where cPOID like 'sy%' and CHARINDEX('-',cPOID)>0
+        where cPOID like 'sy%' and CHARINDEX('-',cPOID)>0 and cPOID not like '%样%'
 
         ) t
         where PATINDEX('%[吖-咗]%', planNo)=0 and PATINDEX('%.%', planNo)=0 and PATINDEX('%/%', planNo)=0
@@ -261,14 +261,155 @@ GROUP BY planNo;
     </select>
 
     <select id="queryCostAllocation" resultType="org.jeecg.modules.documents.costLossReview.entity.CostAllocationReview">
-        select a.plan_num as planNum,a.first_approve_date as approvalDate,b.assigned_by as approvalMan,a.create_time as createTime,a.attachs,
+        select a.plan_num as planNum ,b.assigned_by as approvalMan,a.create_time as createTime,a.attachs,
+
+--         cost_info ->> '$.rmbExportamount'-
+--         cost_info ->> '$.fabriccostNotincludestax'-
+--         cost_info ->> '$.excipiencostNotincludestax'-
+--         cost_info ->>'$.rmbProcesscost'-
+--         cost_info ->> '$.rmbExpense' as signNumA,
+--
+--         abs(ROUND((cost_info ->> '$.rmbExportamount'-
+--         cost_info ->> '$.fabriccostNotincludestax'-
+--         cost_info ->> '$.excipiencostNotincludestax'-
+--         cost_info ->>'$.rmbProcesscost'-
+--         cost_info ->> '$.rmbExpense')/cost_info ->> '$.usdTotalexportprice',6)) as signNumB,
+
+        cost_info ->> '$.signNumA'  AS signNumA,
+        cost_info ->> '$.signNumB'  AS signNumB,
+
+        cost_info ->> '$.poStyleNum'  AS poStyleNum,
+        cost_info ->> '$.exportSales'  AS exportSales,
+        cost_info ->> '$.garmentContractno'  AS garmentContractno,
+        cost_info ->> '$.department'  AS department,
+        cost_info ->> '$.customerShortame'  AS customerShortame,
+        cost_info ->> '$.processUnit'  AS processUnit,
+        IF(UNIX_TIMESTAMP(cost_info ->> '$.outdata' )=0,cost_info ->> '$.outdata',UNIX_TIMESTAMP(cost_info ->> '$.outdata' )*1000)AS outdata,
+        cost_info ->> '$.planQuantity'  AS planQuantity,
+        cost_info ->> '$.actualShipquantity'  AS actualShipquantity,
+        cost_info ->> '$.shortseveral'  AS shortseveral,
+        cost_info ->> '$.shortvalue'  AS shortvalue,
+        cost_info ->> '$.fabricshortcost'  AS fabricshortcost,
+        cost_info ->> '$.preparedBy'  AS preparedBy,
+        status,
+        cost_info ->> '$.pkorgAmount'  AS pkorgAmount,
+        cost_info ->> '$.pkorgAmountrmb'  AS pkorgAmountrmb,
+        (select processing_time from sy_cost_approval_history
+        where plan_no=a.plan_num and stuta='驳回'
+        order by processing_time limit 1)  AS rejectDate,
+        (select processing_time from sy_cost_approval_history
+        where plan_no=a.plan_num and stuta='审批通过'
+        order by processing_time desc limit 1)  AS finalApproveDate,
+        (select processing_time from sy_cost_approval_history
+        where plan_no=a.plan_num and stuta='审批通过'
+        order by processing_time desc limit 1)  AS approvalDate,
+        cost_info ->> '$.usdTotalexportprice'  AS usdTotalexportprice,
+        cost_info ->> '$.rmbExportamount'  AS rmbExportamount,
+        cost_info ->> '$.fabriccostNotincludestax'  AS fabriccostNotincludestax,
+        cost_info ->> '$.excipiencostNotincludestax'  AS excipiencostNotincludestax,
+        cost_info ->> '$.rmbProcesscost'  AS rmbProcesscost,
+        cost_info ->> '$.usdProcesscost'  AS usdProcesscost,
+        cost_info ->> '$.rmbExpense'  AS rmbExpense,
+        cost_info ->> '$.usdExpense'  AS usdExpense,
+        cost_info ->> '$.accidentcnyAmount'  AS accidentcnyAmount,
+        cost_info ->> '$.accidentUsdamount'  AS accidentUsdamount,
+        cost_info ->> '$.remarks'  AS remarks
+        from sy_cost_json a
+        left join sy_cost_approval_history b on a.plan_num = b.plan_no
+        where 1=1
+        <if test="sy.createTime != null and sy.createTime !=''">
+            AND date_format( a.create_time, '%Y-%m-%d' )= date_format(#{sy.createTime},'%Y-%m-%d');
+        </if>
+        <if test="sy.approvalMan != null and sy.approvalMan !=''">
+            AND b.assigned_by LIKE CONCAT('%',#{sy.approvalMan},'%')
+        </if>
+        <if test="sy.approvalDate != null and sy.approvalDate !=''">
+            AND a.first_approve_date LIKE CONCAT('%',#{sy.approvalDate},'%')
+        </if>
+        <if test="sy.planNum != null and sy.planNum !=''">
+            AND a.plan_num LIKE CONCAT('%',#{sy.planNum},'%')
+        </if>
+        <if test="sy.poStyleNum != null and sy.poStyleNum !=''">
+            AND JSON_EXTRACT( a.cost_info, '$.poStyleNum' ) like CONCAT('%',#{sy.poStyleNum},'%')
+        </if>
+        <if test="sy.exportSales != null and sy.exportSales !=''">
+            AND JSON_EXTRACT( a.cost_info, '$.exportSales' ) LIKE CONCAT('%',#{sy.exportSales},'%')
+        </if>
+        <if test="sy.garmentContractno != null and sy.garmentContractno !=''">
+            AND JSON_EXTRACT( a.cost_info, '$.garmentContractno' ) LIKE CONCAT('%',#{sy.garmentContractno},'%')
+        </if>
+        <if test="sy.department != null and sy.department !=''">
+            AND JSON_EXTRACT( a.cost_info, '$.department' ) = #{sy.department}
+        </if>
+        <if test="sy.customerShortame != null and sy.customerShortame !=''">
+            AND JSON_EXTRACT( a.cost_info, '$.customerShortame' ) like CONCAT('%',#{sy.customerShortame},'%')
+        </if>
+        <if test="sy.processUnit != null and sy.processUnit !=''">
+            AND JSON_EXTRACT( a.cost_info, '$.processUnit') like CONCAT('%',#{sy.processUnit},'%')
+        </if>
+        <if test="sy.outdata != null and sy.outdata !=''">
+            AND JSON_EXTRACT( a.cost_info, '$.outdata' ) = CONVERT(#{sy.outdata},UNSIGNED)
+        </if>
+
+        <if test="sy.planQuantity != null and sy.planQuantity !=''">
+            AND JSON_EXTRACT( a.cost_info, '$.planQuantity' ) = #{sy.planQuantity}
+        </if>
+        <if test="sy.actualShipquantity != null and sy.actualShipquantity !=''">
+            AND JSON_EXTRACT( a.cost_info, '$.actualShipquantity' ) = #{sy.actualShipquantity}
+        </if>
+        <if test="sy.shortseveral != null and sy.shortseveral !=''">
+            AND JSON_EXTRACT( a.cost_info, '$.shortseveral' ) = #{sy.shortseveral}
+        </if>
+        <if test="sy.shortvalue != null and sy.shortvalue !=''">
+            AND JSON_EXTRACT( a.cost_info, '$.shortvalue') = #{sy.shortvalue}
+        </if>
+        <if test="sy.fabricshortcost != null and sy.fabricshortcost !=''">
+            AND JSON_EXTRACT( a.cost_info, '$.fabricshortcost' ) = #{sy.fabricshortcost}
+        </if>
+        <if test="sy.preparedBy != null and sy.preparedBy !=''">
+            AND JSON_EXTRACT( a.cost_info, '$.preparedBy' ) LIKE CONCAT('%',#{sy.preparedBy},'%')
+        </if>
+        <if test='sy.rejectDate != null and sy.rejectDate !="" and sy.rejectDate == "1"'>
+            AND b.stuta = '驳回'
+        </if>
+        <if test="sy.status != null and sy.status !=''">
+            AND a.status in
+            <foreach collection="status" item="value" index="index" open="(" separator="," close=")">
+                #{value}
+            </foreach>
+        </if>
+        group by a.plan_num
+
+    </select>
+
+
+
+
+    <select id="queryCostAllocation2" resultType="org.jeecg.modules.documents.costLossReview.entity.CostAllocationReview">
+        select a.plan_num as planNum ,b.assigned_by as approvalMan,a.create_time as createTime,a.attachs,
+
+--         cost_info ->> '$.rmbExportamount'-
+--         cost_info ->> '$.fabriccostNotincludestax'-
+--         cost_info ->> '$.excipiencostNotincludestax'-
+--         cost_info ->>'$.rmbProcesscost'-
+--         cost_info ->> '$.rmbExpense' as signNumA,
+--
+--         abs(ROUND((cost_info ->> '$.rmbExportamount'-
+--         cost_info ->> '$.fabriccostNotincludestax'-
+--         cost_info ->> '$.excipiencostNotincludestax'-
+--         cost_info ->>'$.rmbProcesscost'-
+--         cost_info ->> '$.rmbExpense')/cost_info ->> '$.usdTotalexportprice',6)) as signNumB,
+
+        cost_info ->> '$.signNumA'  AS signNumA,
+        cost_info ->> '$.signNumB'  AS signNumB,
+
         cost_info ->> '$.poStyleNum'  AS poStyleNum,
         cost_info ->> '$.exportSales'  AS exportSales,
         cost_info ->> '$.garmentContractno'  AS garmentContractno,
         cost_info ->> '$.department'  AS department,
         cost_info ->> '$.customerShortame'  AS customerShortame,
         cost_info ->> '$.processUnit'  AS processUnit,
-        cost_info ->> '$.outdata'  AS outdata,
+        IF(UNIX_TIMESTAMP(cost_info ->> '$.outdata' )=0,left(FROM_UNIXTIME(cost_info ->> '$.outdata'/1000),10),left(cost_info ->> '$.outdata',10 ))AS outdata,
         cost_info ->> '$.planQuantity'  AS planQuantity,
         cost_info ->> '$.actualShipquantity'  AS actualShipquantity,
         cost_info ->> '$.shortseveral'  AS shortseveral,
@@ -279,11 +420,14 @@ GROUP BY planNo;
         cost_info ->> '$.pkorgAmount'  AS pkorgAmount,
         cost_info ->> '$.pkorgAmountrmb'  AS pkorgAmountrmb,
         (select processing_time from sy_cost_approval_history
-        where plan_no=#{sy.planNum} and stuta='驳回'
+        where plan_no=a.plan_num and stuta='驳回'
         order by processing_time limit 1)  AS rejectDate,
         (select processing_time from sy_cost_approval_history
-        where plan_no=#{sy.planNum} and stuta='审批通过'
+        where plan_no=a.plan_num and stuta='审批通过'
         order by processing_time desc limit 1)  AS finalApproveDate,
+        (select processing_time from sy_cost_approval_history
+        where plan_no=a.plan_num and stuta='审批通过'
+        order by processing_time desc limit 1)  AS approvalDate,
         cost_info ->> '$.usdTotalexportprice'  AS usdTotalexportprice,
         cost_info ->> '$.rmbExportamount'  AS rmbExportamount,
         cost_info ->> '$.fabriccostNotincludestax'  AS fabriccostNotincludestax,
@@ -365,8 +509,13 @@ GROUP BY planNo;
 
     <select id="querySyFabricLossByCode" resultType="org.jeecg.modules.documents.costLossReview.entity.SyCostLossReview">
         select UPPER(plan_code) as planNo,
-        submit_date as fsubmitDate,
-        reject_date as frejectDate,
+        (select processing_time from sy_approval_history
+        where plan_no = plan_code and stuta='提交'
+        order by processing_time limit 1) as fsubmitDate,
+        (select processing_time from sy_approval_history
+        where plan_no = plan_code and stuta='驳回'
+        order by processing_time limit 1) as frejectDate,
+--         reject_date as frejectDate,
         first_approve_date as ffirstApproveDate,
         final_approve_date as ffinalApproveDate,
         status as fstatus
@@ -375,13 +524,13 @@ GROUP BY planNo;
     </select>
 
     <select id="querySyFabricLossByCode2" resultType="org.jeecg.modules.documents.costLossReview.entity.SyCostLossReview">
-        select 	a.plan_num as planNo,
+        select 	UPPER(a.plan_num) as planNo,
         a.status cstatus,
         (select processing_time from sy_cost_approval_history
         where plan_no=a.plan_num and stuta='提交' order by processing_time limit 1) csubmitDate,
         a.first_approve_date as cfirstApproveDate, -- 初审通过日期
         (select processing_time from sy_cost_approval_history
-        where plan_no=a.plan_num and stuta='驳回' order by processing_time limit 1)  AS crejectDate, -- 返单日期
+        where plan_no=a.plan_num and stuta='驳回' order by processing_time limit 1)  AS frejectDate, -- 返单日期
         (select processing_time from sy_cost_approval_history
         where plan_no=a.plan_num and stuta='审批通过' order by processing_time desc limit 1)  AS cfinalApproveDate, -- 终审通过日期
         cost_info ->> '$.remarks'  AS remarks
@@ -460,7 +609,7 @@ GROUP BY planNo;
         select plan_code as cCode
         from sy_fabric_loss_report
         where 1=1
-        <if test='status !="" and status != null'>
+        <if test='status !="" and status != null '>
             and status in
             <foreach collection="status" item="value" index="index" open="(" separator="," close=")">
                 #{value}

+ 1 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/costLossReview/service/ISyCostLossReviewService.java

@@ -23,6 +23,7 @@ public interface ISyCostLossReviewService extends IService<SyCostLossReview> {
      List<SyCostLossReview> queryMakerByplanNo();
      IPage<FabricLossReview> querySyFabricLossReport(List<String> status,FabricLossReview sy, Page<FabricLossReview> page);
      IPage<CostAllocationReview> queryCostAllocation(List<String> status,CostAllocationReview sy, Page<CostAllocationReview> page);
+     IPage<CostAllocationReview> queryCostAllocation2(List<String> status,CostAllocationReview sy, Page<CostAllocationReview> page);
      List<SyCostLossReview> querySyFabricLossByCode();
      List<SyCostLossReview> querySyFabricLossByCode2();
      List<SyCostLossReview> queryCostAllocationByCode();

+ 6 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/costLossReview/service/impl/SyCostLossReviewServiceImpl.java

@@ -59,6 +59,12 @@ public class SyCostLossReviewServiceImpl extends ServiceImpl<SyCostLossReviewMap
         return syCostLossReviewMapper.queryCostAllocation(status,sy, page);
     }
 
+    @Override
+    public IPage<CostAllocationReview> queryCostAllocation2(List<String> status,CostAllocationReview sy, Page<CostAllocationReview> page) {
+        return syCostLossReviewMapper.queryCostAllocation2(status,sy, page);
+    }
+
+
     @Override
     public List<SyCostLossReview> querySyFabricLossByCode() {
         return syCostLossReviewMapper.querySyFabricLossByCode();

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

@@ -29,6 +29,9 @@ public interface SyLetterDepositMapper extends BaseMapper<SyLetterDeposit> {
     //删除预托书子表
     public void syLetterDepositItemDelete(@Param("id") String id);
 
+    //删除预托书子表
+    public void syLetterDepositItemDelete2(@Param("id") String id);
+
     //新增人民币
     public void syRmbAdd(@Param("rmbList") List<SyRmb> rmbList);
     //新增美元

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

@@ -27,6 +27,15 @@ on a.id = b.sy_pre_assembled_packing_list_id
 
     </update>
 
+    <update id="syLetterDepositItemDelete2">
+
+        update sy_pre_assembled_packing_list  set Container_Number=null , Depositary_Receipt_No=null ,Is_Reference=0
+        where id in
+        (select sy_pre_assembled_packing_list_id
+        from sy_letter_deposit_item
+		where sy_letter_deposit_id =#{id} and del_flag=0)
+
+    </update>
 
     <insert id="syRmbAdd">
         insert into sy_rmb (id, sy_letter_deposit_id, freight_forwarder, amount, item_column,del_flag,freight_forwarder_name,item_column_name,is_pull)

+ 19 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/letterDeposit/service/impl/SyLetterDepositServiceImpl.java

@@ -29,6 +29,7 @@ import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
 
@@ -263,11 +264,17 @@ public class SyLetterDepositServiceImpl extends ServiceImpl<SyLetterDepositMappe
         String id = syLetterDeposit.getId();
         if(oConvertUtils.isNotEmpty(id)){
             //删除子表
+//            syLetterDepositMapper.syLetterDepositItemDelete2(syLetterDepositEdit.getId());
             syLetterDepositMapper.syLetterDepositItemDelete(id);
             //删除主表
             syLetterDeposit.setDelFlag("1");
             updateById(syLetterDeposit);
 
+            List<String> ids=new ArrayList<>();
+            for (SyLetterDepositItem item : syLetterDepositEdit.getSyLetterDepositItemList()){
+                ids.addAll(Arrays.asList(item.getSyPreAssembledPackingListItemId().split(",")));
+            }
+            System.out.println("ids\t"+ids);
 //            //删除人民币
 //            syLetterDepositMapper.syRmbDelete(id);
 //            //删除美元
@@ -278,15 +285,22 @@ public class SyLetterDepositServiceImpl extends ServiceImpl<SyLetterDepositMappe
                 //li.setSyPreAssembledPackingListItemId(li.getPreIds());
                  //修改预装箱单主表参照状态
                 SyPreAssembledPackingList entity = syPreAssembledPackingListService.getById(li.getSyPreAssembledPackingListId());
-//                if(entity.getIsReference() != 2) {
+                if(entity.getIsReference() != 2) {
                     SyPreAssembledPackingList entit = new SyPreAssembledPackingList();
-                    entit.setId(li.getSyPreAssembledPackingListId());
-                    entit.setContainerNumber(li.getContainerNumber());
-                    if (entity.getIsReference()<2){
+                    System.out.println("li.getSyPreAssembledPackingListId\t"+li.getSyPreAssembledPackingListId());
+                    if (ids.contains(li.getSyPreAssembledPackingListItemId())){
+                        entit.setId(li.getSyPreAssembledPackingListId());
+                        entit.setContainerNumber(li.getContainerNumber());
+                        entit.setDepositaryReceiptNo(syLetterDepositEdit.getDepositaryReceiptNo());
+                        entit.setIsReference(1);
+                    }else{
+                        entit.setId(li.getSyPreAssembledPackingListId());
+                        entit.setContainerNumber("");
+                        entit.setDepositaryReceiptNo("");
                         entit.setIsReference(0);
                     }
                     syPreAssembledPackingListService.updateById(entit);
-//                }
+                }
 
             }
             //新增

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/orderData/mapper/SyOrderDataItemMapper.java

@@ -25,7 +25,7 @@ public interface SyOrderDataItemMapper extends BaseMapper<SyOrderDataItem> {
      @DS("multi-three")
      List<Map<String,String>> querySupplierType();
 
-     void deleteByID(@Param("id") String id);
+     int deleteByID(@Param("id") String id);
      void deleteByOrderID(@Param("id") String id);
 
      String queryItemMub(@Param("id") String id);

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/orderData/service/ISyOrderDataItemService.java

@@ -18,7 +18,7 @@ public interface ISyOrderDataItemService extends IService<SyOrderDataItem> {
     IPage<SyOrderDataItem> queryList(String syOrderDataId, Page<SyOrderDataItem> page);
     List<Map<String,String>> querySupplier();
     List<Map<String,String>> querySupplierType();
-    void deleteByID(String id);
+    int deleteByID(String id);
     void deleteByOrderID( String id);
     String queryItemMub(String id);
 }

+ 2 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/orderData/service/impl/SyOrderDataItemServiceImpl.java

@@ -41,8 +41,8 @@ public class SyOrderDataItemServiceImpl extends ServiceImpl<SyOrderDataItemMappe
     }
 
     @Override
-    public void deleteByID(String id) {
-        syOrderDataItemMapper.deleteByID(id);
+    public int deleteByID(String id) {
+       return syOrderDataItemMapper.deleteByID(id);
     }
 
     @Override

+ 5 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/orderData/service/impl/SyOrderDataServiceImpl.java

@@ -60,6 +60,7 @@ public class SyOrderDataServiceImpl extends ServiceImpl<SyOrderDataMapper, SyOrd
         Result<T> result =new Result<>();
         //得到系统时间
         Date day=new Date();
+        int newCount=0;
         int count=0;
         //定义集合
         List<Map<String, Object>> sumlist = new ArrayList<>();
@@ -262,7 +263,7 @@ public class SyOrderDataServiceImpl extends ServiceImpl<SyOrderDataMapper, SyOrd
                         }else {
                             idsID.add(sy2.getId());
                             //更新数据前 删除旧数据防止id冲突
-                            syOrderDataItemService.deleteByID(sy2.getId());
+                           count=count+syOrderDataItemService.deleteByID(sy2.getId());
 
                         }
                     }
@@ -301,6 +302,7 @@ public class SyOrderDataServiceImpl extends ServiceImpl<SyOrderDataMapper, SyOrd
                         }
                         if(isNewOrder){
                             syOrderDataItemService.save(sy2);
+                            newCount++;
                             continue;
                         }
 
@@ -421,7 +423,7 @@ public class SyOrderDataServiceImpl extends ServiceImpl<SyOrderDataMapper, SyOrd
                     updateById(sy);
                     isNewOrder=false;
                 }
-                count=syItemList.size();
+//                count=syItemList.size();
                 if(syItemList.size() !=0){
                     save(sy);
                     //回写拉取的数据状态 1
@@ -455,7 +457,7 @@ public class SyOrderDataServiceImpl extends ServiceImpl<SyOrderDataMapper, SyOrd
             return result;
         }
         if (count>0){
-            result.setMessage("同步成功!!!");
+            result.setMessage("同步成功,更新"+(newCount-count)+"条数据");
         }else{
             result.setMessage("暂无需要同步数据!!!");
         }

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

@@ -768,9 +768,9 @@ public class SyShippingDetailsController extends JeecgController<SyShippingDetai
 //					  return result;
 //				  }
 				  if(syPreList.get(index).getAccount().equals("101")){
-					  params = ("成衣工厂*STYLE*PO NO.*分销点*CTN NO. FROM*CTN NO. TO*item NO./SKU NO./UPC NO./PACKS CODE*PREACKSKU*" + builder + "PCS/PACK*COLOUR*计划装箱数量*N.W/CTN*G.W/CTN*L(CM)*W(CM)*H(CM)*BUYER*配码规格*PACKS/CTN*PCS/CTN*PACK QTY*TTL CTNS*TTL PCS*TTL N.W*TTL G.W*TTL CBM*发运明细子表ID*发运明细分组ID*发运明细主表ID*申报要素ID").split("\\*");
+					  params = ("成衣工厂*STYLE*PO NO.*分销点*CTN NO. FROM*CTN NO. TO*item NO./SKU NO./UPC NO./PACKS CODE*PREACKSKU*" + builder + "PCS/PACK*COLOUR*计划装箱数量*N.W/CTN*G.W/CTN*L(CM)*W(CM)*H(CM)*BUYER*配码规格*PACKS/CTN*PCS/CTN*PACK QTY*TTL CTNS*TTL PCS*TTL N.W*TTL G.W*TTL CBM*发运明细子表ID*发运明细分组ID*发运明细主表ID*申报要素ID*采购/委外订单").split("\\*");
 				  }else {
-					  params = ("成衣工厂*款号*小po*分销点*起始箱号*结束箱号*item NO./SKU NO./UPC NO./PACKS CODE*PREACKSKU*" + builder + "件数/包*颜色*计划装箱数量*净重/箱*毛重/箱*长*宽*高*客户简称*配码规格*包数/箱*件数/箱*包数*箱数*总件数*总净重*总毛重*总体积*发运明细子表ID*发运明细分组ID*发运明细主表ID*申报要素ID").split("\\*");
+					  params = ("成衣工厂*款号*小po*分销点*起始箱号*结束箱号*item NO./SKU NO./UPC NO./PACKS CODE*PREACKSKU*" + builder + "件数/包*颜色*计划装箱数量*净重/箱*毛重/箱*长*宽*高*客户简称*配码规格*包数/箱*件数/箱*包数*箱数*总件数*总净重*总毛重*总体积*发运明细子表ID*发运明细分组ID*发运明细主表ID*申报要素ID*采购/委外订单").split("\\*");
 				  }
 				  String[] params1 =syPreList.get(index).toString(builder.toString(),builder1.toString()).split("\\*");
 				  String[] params2= {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","AA","AB","AC","AD","AE","AF","AG","AH","AI","AJ","AK","AL","AM","AN","AO","AP","AQ","AR","AS","AT","AU","AV","AW","AX","AY","AZ"};
@@ -785,7 +785,7 @@ public class SyShippingDetailsController extends JeecgController<SyShippingDetai
 				  String sunBox = "";
 				  String pcspack = "";//件数/每包
 
-
+				  int wideNum=1;
 				  Row row1 = sheet.createRow(0);
 				  Row row2 = sheet.createRow(1);
 
@@ -820,12 +820,12 @@ public class SyShippingDetailsController extends JeecgController<SyShippingDetai
 					  cell.setCellValue(params[x]);
 
 					  //设置单元格宽度
-					  if(x > params.length-5){
+					  if(x > params.length-5-wideNum){
 						  sheet.setColumnWidth(x,500);
 					  }else{
 						  sheet.setColumnWidth(x,3000);
 					  }
-					  if(x > 7 && x < params.length-21){
+					  if(x > 7 && x < params.length-21-wideNum){
 						  Cell cell1 = row2.createCell(x);
 						  cell1.setCellValue(" ");
 					  }else{
@@ -833,50 +833,50 @@ public class SyShippingDetailsController extends JeecgController<SyShippingDetai
 						  cell1.setCellValue(params1[x]);
 					  }
 					  //计算箱数
-					  if(x == params.length-9){
+					  if(x == params.length-9-wideNum){
 						  Cell cell1 = row2.createCell(x);
 						  cell1.setCellFormula("SUM(F2-E2+1)");
 						  //cell1.setCellValue("=");
 					  }
 					  //总件数=所有尺码值*箱数
-					  if(x == params.length-8){
+					  if(x == params.length-8-wideNum){
 						  Cell cell1 = row2.createCell(x);
 						  cell1.setCellFormula("SUM("+params2[8]+"2:"+params2[size]+"2)*"+box+"2");
 						  //cell1.setCellValue("=");
 					  }
 					  //总净重
-					  if(x == params.length-7){
+					  if(x == params.length-7-wideNum){
 						  Cell cell1 = row2.createCell(x);
 						  cell1.setCellFormula("ROUND(SUM("+net+"2*"+box+"2),2)");
 					  }
 					  //总毛重
-					  if(x == params.length-6){
+					  if(x == params.length-6-wideNum){
 						  Cell cell1 = row2.createCell(x);
 						  cell1.setCellFormula("ROUND(SUM("+gross+"2*"+box+"2),2)");
 					  }
 					  //总体积 =长*宽*高*总箱数/1000000
-					  if(x == params.length-5){
+					  if(x == params.length-5-wideNum){
 						  Cell cell1 = row2.createCell(x);
 						  cell1.setCellFormula("ROUND(SUM("+length+"2*"+wide+"2*"+heigt+"2*"+sunBox+"2/1000000),3)");
 					  }
 
 					  //件数/箱 =所有尺码值
-					  if(x == params.length-11){
+					  if(x == params.length-11-wideNum){
 						  Cell cell1 = row2.createCell(x);
 						  cell1.setCellFormula("SUM("+params2[8]+"2:"+params2[size]+"2)");
 					  }
 					  //包数/箱 =件数/箱除以件数/包
-					  if(x == params.length-12){
+					  if(x == params.length-12-wideNum){
 						  Cell cell1 = row2.createCell(x);
 						  cell1.setCellFormula("SUM("+params2[8]+"2:"+params2[size]+"2)/"+pcspack+"2");
 					  }
 					  //包数 =包数/箱乘以箱数
-					  if(x == params.length-10){
+					  if(x == params.length-10-wideNum){
 						  Cell cell1 = row2.createCell(x);
 						  cell1.setCellFormula("SUM("+params2[8]+"2:"+params2[size]+"2)/"+pcspack+"2*SUM(F2-E2+1)");
 					  }
                      //配码规格设置文本
-					  if(x == params.length-13){
+					  if(x == params.length-13-wideNum){
 						  Cell cell1 = row2.createCell(x);
 						  CellStyle textStyle = workbook.createCellStyle();
 						  DataFormat dataFormat = workbook.createDataFormat();
@@ -889,7 +889,7 @@ public class SyShippingDetailsController extends JeecgController<SyShippingDetai
 				  }
 				  index++;
 
-				  CellRangeAddressList cellRangeAddressList = new CellRangeAddressList(1, 1, params.length-13, params.length-13);
+				  CellRangeAddressList cellRangeAddressList = new CellRangeAddressList(1, 1, params.length-13-wideNum, params.length-13-wideNum);
 				  DataValidationHelper helper = sheet.getDataValidationHelper();
 
 				  DataValidationConstraint constraint = helper.createExplicitListConstraint(splitpeima);

+ 5 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/shippingDetails/entity/VO/SyPreAssembledPackingListVo.java

@@ -151,6 +151,9 @@ public class SyPreAssembledPackingListVo {
     @ApiModelProperty(value = "数组")
     private List<SizeTable> sizeTables;
 
+    @Excel(name = "采购/委外订单号", width = 15)
+    @ApiModelProperty(value = "采购/委外订单号")
+    private String purOrSubOrder;
     //订单号
     private String orderNumber;
     //款号
@@ -197,6 +200,7 @@ public class SyPreAssembledPackingListVo {
         this.elenmentId = syShippingDetailsVo.getElementsId();
         this.distributionPointSlash = syShippingDetailsVo.getDistributionPoint();
         this.supplier = syShippingDetailsVo.getSupplier();
+        this.purOrSubOrder = syShippingDetailsVo.getPurOrSubOrder();
     }
 
     public SyPreAssembledPackingListVo(){
@@ -208,7 +212,7 @@ public class SyPreAssembledPackingListVo {
         return garmentFactory+"*"+itemNumber+"*"+smallPo+"*"+distributionPoint+"*"+""+
                 "*"+""+"*"+""+"*"+""+"*"+builder+""+"*"+color+"*"+plannedShippingQuantity+
                 "*"+""+"*"+""+"*"+""+"*"+""+"*"+""+"*"+
-                customerAbb+"*"+codingRules+"*"+""+"*"+""+"*"+""+"*"+""+"*"+""+"*"+""+"*"+""+"*"+""+"*"+builder1+"*"+groupId+"*"+id+"*"+elenmentId;
+                customerAbb+"*"+codingRules+"*"+""+"*"+""+"*"+""+"*"+""+"*"+""+"*"+""+"*"+""+"*"+""+"*"+builder1+"*"+groupId+"*"+id+"*"+elenmentId+"*"+purOrSubOrder;
     }
 
 

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

@@ -16,12 +16,14 @@ import javax.servlet.http.HttpServletResponse;
 
 import com.alibaba.excel.EasyExcel;
 import com.alibaba.excel.ExcelWriter;
+import com.alibaba.excel.enums.WriteDirectionEnum;
+import com.alibaba.excel.metadata.data.WriteCellData;
 import com.alibaba.excel.write.metadata.WriteSheet;
 import com.alibaba.excel.write.metadata.fill.FillConfig;
 import com.alibaba.excel.write.metadata.fill.FillWrapper;
 import com.baomidou.mybatisplus.annotation.TableField;
-import org.apache.poi.ss.usermodel.Row;
-import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
@@ -49,6 +51,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.system.base.controller.JeecgController;
 import org.jeecg.modules.documents.syShippingOrder.service.impl.SyShippingOrderItemServiceImpl;
 import org.jeecg.modules.documents.syShippingOrder.tool.TopinYin;
+import org.jeecg.modules.spapl.entity.SizeTable;
 import org.jeecg.modules.splfi.entity.SyPackingListFabricItem;
 import org.jeecg.modules.splfi.service.impl.SyPackingListFabricItemServiceImpl;
 import org.jeecg.modules.splt.entity.SyPackingListTailoringItem;
@@ -128,6 +131,22 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
 		if(oConvertUtils.isNotEmpty(syShippingOrder.getClientAbbreviation())){
 			queryWrapper.eq("b.client_abbreviation",syShippingOrder.getClientAbbreviation());
 		}
+
+
+//		最终船期
+		if(oConvertUtils.isNotEmpty(syShippingOrder.getTheFinalShippingDate())){
+			queryWrapper.eq("a.the_Final_Shipping_Date",syShippingOrder.getTheFinalShippingDate());
+		}
+//		供应商
+		if(oConvertUtils.isNotEmpty(syShippingOrder.getSupplier())){
+			queryWrapper.like("b.supplier",syShippingOrder.getSupplier());
+		}
+//		款号
+		if(oConvertUtils.isNotEmpty(syShippingOrder.getStyleNum())){
+			queryWrapper.like("b.style_Number",syShippingOrder.getStyleNum());
+		}
+
+
 		if(oConvertUtils.isNotEmpty(smailPo)){
 			QueryWrapper<SyShippingOrderItem> queryWrapper1 = new QueryWrapper<>();
 			queryWrapper1.eq("smail_po",smailPo).eq("del_flag",0);
@@ -135,7 +154,7 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
 			queryWrapper.eq("a.id",list.get(0).getSyShippingOrderItemId());
 		}
 		if(oConvertUtils.isNotEmpty(syShippingOrder.getShippingOrderNumber())){
-			queryWrapper.likeRight("a.shipping_order_number",syShippingOrder.getShippingOrderNumber().trim());
+			queryWrapper.like("a.shipping_order_number",syShippingOrder.getShippingOrderNumber().trim());
 		}
 		if(oConvertUtils.isNotEmpty(syShippingOrder.getExportInvoiceNo())){
 			queryWrapper.eq("a.export_invoice_no",syShippingOrder.getExportInvoiceNo());
@@ -664,10 +683,12 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
 			 int sort = 1;
 			 // 只要不是成品,需要做汇总操作,汇总条件为报关品名+HSCODE
 			 if (entity.getReadyFabric().equals("成衣")) {
+
 				 readyFabric = "申报要素-成衣";
 				 list = syShippingOrderMapper.queryEelement(id);
 
 				 for (SyShippingOrderItem li : list) {
+					 entity.setGender(li.getGender());
 				 	 li.setSize(sort);
 				 	 sort++;
 					 totalGrossWeight = totalGrossWeight.add(li.getGrossWeight());
@@ -685,6 +706,8 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
 					 if(oConvertUtils.isEmpty(li.getDeclarationTotalPrice())){
 						 li.setDeclarationTotalPrice(li.getTotalPrice());
 					 }
+					 entity.setSupplier(li.getSupplier());
+
 				 }
 			 } else {
 				 readyFabric = "申报要素-面辅料";
@@ -706,6 +729,12 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
 					 if(oConvertUtils.isEmpty(li.getDeclarationTotalPrice())){
 						 li.setDeclarationTotalPrice(li.getTotalPrice());
 					 }
+					 entity.setGender(li.getGender());
+//					 li.setColour(entity.getColour());
+//					 li.setCustomsCode(entity.getCustomsCode());
+//					 li.setSubSectionDescription(entity.getSubSectionDescription());
+//					 System.out.println("colour\t"+entity.getColour()+"\tcustomsCode\t"
+//					 +entity.getCustomsCode()+"\tsubSectionDescription\t"+entity.getSubSectionDescription());
 				 }
 
 			 }
@@ -746,24 +775,195 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
 			 }
 
 
-			 if (testName.equals("-结汇发票")) {
+//			 if (testName.equals("-结汇发票")) {
+			 //结汇资料
+//			 if (testName.equals("-结汇资料")) {
+//				 //获取模板输入流
+////				 InputStream inStream = new FileInputStream("D:\\单证模板\\报关信息-结汇发票.xlsx");
+//				 InputStream inStream = new FileInputStream("D:\\单证模板\\报关信息-结汇资料成衣.xlsx");
+//				 //通过poi创建表对象
+//				 XSSFWorkbook workbook = new XSSFWorkbook(inStream);
+//				 //遍历复制sheet
+//				 ByteArrayOutputStream bos = new ByteArrayOutputStream();
+//				 //写到流
+//				 workbook.write(bos);
+//				 ServletOutputStream outputStream = response.getOutputStream();
+//				 ByteArrayInputStream is = new ByteArrayInputStream(bos.toByteArray());
+//				 ExcelWriter excelWriter = EasyExcel.write(outputStream).withTemplate(is).build();
+//
+//				 //填充配置, 这里的意义是给模板中的集合数据添加新行, 保证导出不会错乱
+//				 FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();
+//
+//				 WriteSheet writeSheet1 = EasyExcel.writerSheet("CL").build();
+//
+//
+//				 //查询数据字典-公司抬头
+//				 List<DictModel> test = sysDictService.queryDictItemsByCode("company_title");
+//				 if (test.size()!=0) {
+//					 for (DictModel te : test) {
+//						 if (list.get(0).getPkOrg().equals(te.getText())) {
+//							 String split[] = test.get(0).getValue().split("\\+");
+////							 String split[] = te.getValue().split("\\+");
+//							 System.out.println("特.getText\t"+te.getText());
+//							 entity.setClientAbbreviation(split[1]);
+//							 entity.setCorporationAddress(split[2]);
+//							 entity.setCorporationTel(split[3]);
+//							 entity.setFax(split[4]);
+//						 }
+//					 }
+//				 }
+//				 excelWriter.fill(entity, fillConfig, writeSheet1);
+//				 excelWriter.fill(list, fillConfig, writeSheet1);
+//				 excelWriter.fill(new FillWrapper("list", list), fillConfig, writeSheet1);
+//				 //关流
+//				 excelWriter.finish();
+//				 inStream.close();
+//			 } else
+			 if (testName.equals("-结汇资料")) {
 				 //获取模板输入流
-				 InputStream inStream = new FileInputStream("D:\\单证模板\\报关信息-结汇发票.xlsx");
+//				 InputStream inStream = new FileInputStream("D:\\单证模板\\报关信息-结汇发票.xlsx");
+				 InputStream inStream = new FileInputStream("D:\\单证模板\\报关信息-结汇资料成衣.xlsx");
 				 //通过poi创建表对象
 				 XSSFWorkbook workbook = new XSSFWorkbook(inStream);
+
+				 int sheetNum=17;
+				 //获得页签
+				 Iterator sheets=workbook.sheetIterator();
+				 entity.setSizeTables(syShippingOrderMapper.querySizes(entity.getId()));//获取主表尺码
+
+				 for(SyShippingOrderItem li : list){
+					 QueryWrapper queryWrapperItem=new QueryWrapper();
+					 queryWrapperItem.eq("a.sy_shipping_order_item_id",entity.getId());
+					 queryWrapperItem.eq("a.elements_Id",li.getElementsId());
+					 queryWrapperItem.eq("a.style_Number",li.getStyleNumber());
+					 queryWrapperItem.eq("a.smail_Po",li.getSmailPo());
+					 queryWrapperItem.eq("round(a.unit_Price,2)",li.getUnitPrice());
+
+					 List<SizeTable> sizeItemTables=syShippingOrderMapper.queryItemSizes(entity.getId() ,queryWrapperItem);
+					 li.setSizeTables(sizeItemTables);
+				 }
+
+				 if (sheets.hasNext()){
+					 Sheet sheet=(Sheet)sheets.next();
+
+					 CellStyle style=sheet.getRow(10).getCell(10).getCellStyle();//样式
+
+					 List<Object> entityStrs=entity.toString2();
+
+					 Row row2=sheet.getRow(16);
+
+					 Row row3 = sheet.getRow(15);
+
+					 int cellTitleNum=6;
+
+					 //Quantity/Size per carton 35
+
+
+					 cellTitleNum+=19;
+					 for (int i=1;i<entityStrs.size();i++){
+						 cellTitleNum++;
+//						 if( i<4){
+//							 Cell cellsizeAll2=row3.getCell(i);
+//							 cellsizeAll2.setCellStyle(style);
+//							 cellsizeAll2.setCellValue(entityStrs.get(i).toString());
+//							 CellRangeAddress region2 = new CellRangeAddress( 15, 16,i, i);
+//							 sheet.addMergedRegion(region2);
+//						 }else if(i==4){
+//							 Cell cellsizeAll2=row3.getCell(3);
+//							 cellsizeAll2.setCellStyle(style);
+//							 cellsizeAll2.setCellValue(entityStrs.get(3).toString());
+//							 CellRangeAddress region2 = new CellRangeAddress( 15, 16,3, 5);
+//							 sheet.addMergedRegion(region2);
+//						 }else
+						 if(i==5){
+							 Cell cellsizeAll=row3.getCell(6);
+							 cellsizeAll.setCellStyle(style);
+							 cellsizeAll.setCellValue(entityStrs.get(i).toString());
+//					 CellRangeAddress region = new CellRangeAddress( 15, 15,cellTitleNum, cellTitleNum+entity.getSizeTables().size()-1);
+							 CellRangeAddress region = new CellRangeAddress( 15, 15,6, 6+19);
+							 sheet.addMergedRegion(region);
+						 }
+						 else if(i==entityStrs.size()-5){
+							 Cell cellsizeAll2=row3.getCell(cellTitleNum);
+							 cellsizeAll2.setCellStyle(style);
+							 cellsizeAll2.setCellValue(entityStrs.get(i).toString());
+//							 System.out.println("cellTitleNum2\t"+cellTitleNum+"\t\t"+entityStrs.get(i).toString());
+							 CellRangeAddress region2 = new CellRangeAddress( 15, 15,cellTitleNum, cellTitleNum+2);
+							 sheet.addMergedRegion(region2);
+							 cellTitleNum--;
+						 }
+						 else if(i>entityStrs.size()-5&&i!=entityStrs.size()-1){
+							 Cell cellsizeAll2=row2.getCell(cellTitleNum);
+							 cellsizeAll2.setCellStyle(style);
+							 cellsizeAll2.setCellValue(entityStrs.get(i).toString());
+//							 System.out.println("cellTitleNum3\t"+(cellTitleNum)+"\t\t"+entityStrs.get(i).toString());
+						 } else if(i==entityStrs.size()-1){
+							 CellRangeAddress region2 = new CellRangeAddress( 15, 16,cellTitleNum, cellTitleNum);
+							 sheet.addMergedRegion(region2);
+							 Cell cellsizeAll2=row3.getCell(cellTitleNum);
+							 cellsizeAll2.setCellStyle(style);
+							 cellsizeAll2.setCellValue(entityStrs.get(i).toString());
+						 }
+						 else{
+							 Cell cellsizeAll2=row3.getCell(cellTitleNum);
+							 cellsizeAll2.setCellStyle(style);
+							 cellsizeAll2.setCellValue(entityStrs.get(i).toString());
+							 CellRangeAddress region2 = new CellRangeAddress( 15, 16,cellTitleNum, cellTitleNum);
+							 sheet.addMergedRegion(region2);
+						 }
+					 }
+					 int cellNum=6;
+					 for (SizeTable sizeTable : entity.getSizeTables()){
+						 Cell cell=row2.createCell(cellNum);
+						 cell.setCellValue(sizeTable.getSize());
+						 cell.setCellStyle(style);
+						 cellNum++;
+					 }
+
+					 for(SyShippingOrderItem item : list){
+
+						 Row row=sheet.createRow(sheetNum);
+						 List<Object> arrs=item.toString2();
+						 int arrNum=arrs.size();
+						 for (int i=0;i<arrNum;i++){
+							 Cell cell=null;
+						 	 if (i>5+item.getSizeTables().size()){
+								 cell=row.createCell(i+20-item.getSizeTables().size());
+							 }else{
+								 cell=row.createCell(i);
+							 }
+							 if(arrs.get(i)!=null){
+								 cell.setCellValue(arrs.get(i).toString());
+								 cell.setCellStyle(style);
+							 }else{
+								 cell.setCellValue("");
+								 cell.setCellStyle(style);
+							 }
+						 }
+						 sheetNum++;
+					 }
+					 //调整行高
+					 for (int i=1;i<=20-entity.getSizeTables().size();i++){
+						 sheet.setColumnWidth(i+5+entity.getSizeTables().size(),1);
+					 }
+
+//					 for (int i=1;i<=20-list.size();i++){
+////						 sheet.setRowBreak(i+16+list.size(),true);
+//						 Row row=sheet.getRow(i+1+list.size());
+//						 sheet.removeRow(row);
+//					 }
+				 }
+
 				 //遍历复制sheet
 				 ByteArrayOutputStream bos = new ByteArrayOutputStream();
-				 //写到流
+				 //写到流 alibaba:easyexcel
 				 workbook.write(bos);
-				 ServletOutputStream outputStream = response.getOutputStream();
-				 ByteArrayInputStream is = new ByteArrayInputStream(bos.toByteArray());
-				 ExcelWriter excelWriter = EasyExcel.write(outputStream).withTemplate(is).build();
 
 				 //填充配置, 这里的意义是给模板中的集合数据添加新行, 保证导出不会错乱
 				 FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();
 
-				 WriteSheet writeSheet1 = EasyExcel.writerSheet("结汇发票").build();
-
+				 WriteSheet writeSheet1 = EasyExcel.writerSheet("PL").build();
+				 FillConfig fillConfig2 = FillConfig.builder().direction(WriteDirectionEnum.HORIZONTAL).build();
 
 				 //查询数据字典-公司抬头
 				 List<DictModel> test = sysDictService.queryDictItemsByCode("company_title");
@@ -771,6 +971,7 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
 					 for (DictModel te : test) {
 						 if (list.get(0).getPkOrg().equals(te.getText())) {
 							 String split[] = test.get(0).getValue().split("\\+");
+//							 String split[] = te.getValue().split("\\+");
 							 entity.setClientAbbreviation(split[1]);
 							 entity.setCorporationAddress(split[2]);
 							 entity.setCorporationTel(split[3]);
@@ -778,13 +979,46 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
 						 }
 					 }
 				 }
+
+				 ServletOutputStream outputStream = response.getOutputStream();
+				 ByteArrayInputStream is = new ByteArrayInputStream(bos.toByteArray());
+				 ExcelWriter excelWriter = EasyExcel.write(outputStream).withTemplate(is).build();
+
 				 excelWriter.fill(entity, fillConfig, writeSheet1);
 				 excelWriter.fill(list, fillConfig, writeSheet1);
+				 excelWriter.fill(new FillWrapper("list", list), fillConfig, writeSheet1);
+				 excelWriter.fill(new FillWrapper("list2", list), fillConfig2, writeSheet1);
+
+				 //关流
+//				 excelWriter.finish();
+
+//				 inStream.close();
+
+
+//				 InputStream inStream = new FileInputStream("D:\\单证模板\\报关信息-结汇资料成衣.xlsx");
+				 //通过poi创建表对象
+//				 XSSFWorkbook workbook2 = new XSSFWorkbook(inStream);
+//				 //遍历复制sheet
+//				 ByteArrayOutputStream bos2 = new ByteArrayOutputStream();
+//				 //写到流
+//				 workbook2.write(bos2);
+//				 ServletOutputStream outputStream2 = response.getOutputStream();
+//				 ByteArrayInputStream is2 = new ByteArrayInputStream(bos2.toByteArray());
+//				 ExcelWriter excelWriter2 = EasyExcel.write(outputStream2).withTemplate(is2).build();
+
+				 //填充配置, 这里的意义是给模板中的集合数据添加新行, 保证导出不会错乱
+//				 FillConfig fillConfig1 = FillConfig.builder().forceNewRow(Boolean.TRUE).build();
+
+				 WriteSheet writeSheet2 = EasyExcel.writerSheet("CI").build();
+
+
+				 excelWriter.fill(entity, fillConfig, writeSheet2);
+				 excelWriter.fill(list, fillConfig, writeSheet2);
+				 excelWriter.fill(new FillWrapper("list", list), fillConfig, writeSheet2);
 				 //关流
 				 excelWriter.finish();
 				 inStream.close();
 
-
 			 }
 
 			 if (isAhaa.equals("国内")) {
@@ -1101,7 +1335,7 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
 
 					 }
 
-			 }else{  //国外
+			 } else{  //国外
 
 				 //获取对应模板
 				 TemplateExportParams params = new TemplateExportParams("D:\\单证模板\\"+testName+".xlsx");
@@ -1622,4 +1856,220 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
 		 return result;
 	 }
 
+
+	 /**
+	  * 批量定时推送发票
+	  * @param ids
+	  * @return
+	  */
+	 @GetMapping(value = "/updateTimeStutaBatch")
+	 public Result<String> updateTimeStutaBatch(String [] ids){
+		 Result<String> result = new Result<String>();
+
+		 if(oConvertUtils.isEmpty(ids)){
+			 result.setResult("推送失败,ID为空!");
+			 result.setSuccess(false);
+			 return result;
+		 }
+		 List<String> arrayIds=new ArrayList<>();
+		 for (String id : ids){
+		 	arrayIds.add(id);
+		 }
+
+		 List<SyShippingOrder> entitys = syShippingOrderService.listByIds(arrayIds);
+		 for (SyShippingOrder entity: entitys){
+			 entity.setTimeStuta(1);
+			 syShippingOrderService.updateById(entity);
+		 }
+
+		 result.setResult("推送成功!");
+		 result.setSuccess(true);
+		 return result;
+	 }
+
+
+
+	 /**
+	  * 推送U8费用支出单
+	  * @param ids
+	  * @return
+	  */
+	 @GetMapping("/expensesU8Batch")
+	 public Result<Integer> expensesU8Batch(String[] ids) throws IllegalAccessException {
+		 Result<Integer> result = new Result<Integer>();
+
+
+		 if(oConvertUtils.isEmpty(ids)){
+			 result.setSuccess(false);
+			 result.setMessage("未获取到ID!");
+			 result.setResult(0);
+			 return result;
+		 }
+
+		 result.setResult(0);
+		 result.setSuccess(false);
+		 String message="";
+
+		 try {
+		 	for(String id : ids){
+				 SimpleDateFormat sf = new SimpleDateFormat("yyyy-M-dd 00:00:00.000");
+
+				 //总毛重
+				 BigDecimal totalNetWeight = BigDecimal.ZERO;
+
+				 Map<String,Object> map = new HashMap<>();
+				 List<Map<String,Object>> listmap = new ArrayList<>();
+				 List<Map<String,Object>> rmbmap = new ArrayList<>();
+				 List<Map<String,Object>> usdmap = new ArrayList<>();
+				 List<SyShippingOrderItem> itemList;
+
+				 //查询主表信息
+				 SyShippingOrder entity = syShippingOrderService.getById(id);
+				 if(oConvertUtils.isEmpty(entity.getTheFinalShippingDate())){
+//					 result.setResult(0);
+//					 result.setMessage("推送失败!请维护最终船期!");
+					 message+="托书号"+entity.getShippingOrderNumber()+"推送失败!请维护最终船期!\t";
+					 continue;
+//					 result.setSuccess(false);
+//					 return result;
+
+				 }
+				 String rateDate = sf.format(entity.getShippingOrderDate());
+				 //判断是否已提交
+				 if(entity.getTheDocumentsState().equals("0")){
+//					 result.setResult(0);
+//					 result.setMessage("推送失败!请先提交单据!");
+					 message+="托书号"+entity.getShippingOrderNumber()+"推送失败!请先提交单据!\t";
+					 continue;
+//					 result.setSuccess(false);
+//					 return result;
+
+				 }
+				 //转map
+				 Field[] fields = entity.getClass().getDeclaredFields();
+				 for (Field field : fields) {
+					 field.setAccessible(true);
+					 map.put(field.getName(), field.get(entity));
+				 }
+
+				 //查询子表信息
+				 if(entity.getReadyFabric().equals("成衣")){
+					 itemList  = syShippingOrderMapper.qeuryItemInfo(entity.getId());
+				 }else{
+					 itemList =syShippingOrderMapper.qeuryItemInfoTa(entity.getId());
+				 }
+
+				 //集合转map
+				 for (SyShippingOrderItem li : itemList) {
+					 totalNetWeight = totalNetWeight.add(li.getGrossWeight());
+					 Field[] fieldsList = li.getClass().getDeclaredFields();
+					 Map<String, Object> mapList = new HashMap<String, Object>();
+					 for (Field field : fieldsList) {
+						 field.setAccessible(true);
+						 mapList.put(field.getName(), field.get(li));
+					 }
+					 listmap.add(mapList);
+				 }
+
+				 //总毛重可能不对,重新替换
+				 map.put("totalGrossWeight",totalNetWeight);
+
+				 //查询人民币信息
+				 List<SyRmb> rmbList = syShippingOrderMapper.rmbList(entity.getId());
+				 if(rmbList.size()!=0) {
+					 //集合转map
+					 for (SyRmb li : rmbList) {
+						 Field[] fieldsList = li.getClass().getDeclaredFields();
+						 Map<String, Object> mapList = new HashMap<String, Object>();
+						 for (Field field : fieldsList) {
+							 field.setAccessible(true);
+							 mapList.put(field.getName(), field.get(li));
+						 }
+						 rmbmap.add(mapList);
+					 }
+				 }
+
+				 //查询美元信息
+				 List<SyUsd> usdList = syShippingOrderMapper.usdList(entity.getId());
+				 if(usdList.size()!=0) {
+					 //集合转map
+					 for (SyUsd li : usdList) {
+						 Field[] fieldsList = li.getClass().getDeclaredFields();
+						 Map<String, Object> mapList = new HashMap<String, Object>();
+						 for (Field field : fieldsList) {
+							 field.setAccessible(true);
+							 mapList.put(field.getName(), field.get(li));
+						 }
+						 usdmap.add(mapList);
+					 }
+				 }
+
+				 //判断是否有美元或者人民币信息
+				 if(rmbmap.size()==0 && usdmap.size()==0){
+//					 result.setResult(0);
+//					 result.setMessage("托书号"+entity.getShippingOrderNumber()+"推送失败,无运费信息推送!+\n");
+					 message+="托书号"+entity.getShippingOrderNumber()+"推送失败,无运费信息推送!\t";
+//					 result.setSuccess(false);
+//					 return result;
+					 continue;
+
+				 }
+				 //查询装箱单子表,获取销售订单主表ID
+				 for (Map<String, Object> li : listmap) {
+					 //查面料
+					 SyPackingListFabricItem fabricEntity = syPackingListFabricItemService.getById(li.get("tailoringFabricItemId").toString());
+					 SyPackingListTailoringItem tailoringEntity = syPackingListTailoringItemService.getById(li.get("tailoringFabricItemId").toString());
+					 if (oConvertUtils.isNotEmpty(fabricEntity)) {
+						 //获取业务员编码、销售部门编码、客户简称
+						 li.put("orderId", fabricEntity.getSyOrderDataId());// = syShippingOrderMapper.querySOMain();
+					 } else if (oConvertUtils.isNotEmpty(tailoringEntity)) {
+						 li.put("orderId", tailoringEntity.getSyOrderDataId());//  = syShippingOrderMapper.querySOMain(tailoringEntity.getSyOrderDataId());
+					 } else {
+//						 result.setResult(0);
+//						 result.setMessage("推送失败!未找到订单相关信息!");
+						 message+="托书号"+entity.getShippingOrderNumber()+"推送失败!未找到订单相关信息!\t";
+						 continue;
+//						 result.setSuccess(false);
+//						 return result;
+					 }
+				 }
+
+				 map.put("rateDate",rateDate);
+				 int i = 0;
+				 if (itemList.get(0).getPkOrg().equals("101")) {
+					 i = syShippingOrderService.saveSalePayVouchOne(map, listmap, rmbmap, usdmap);
+				 } else if (itemList.get(0).getPkOrg().equals("102")) {
+					 i = syShippingOrderService.saveSalePayVouchTwo(map, listmap, rmbmap, usdmap);
+				 } else if (itemList.get(0).getPkOrg().equals("103")) {
+					 i = syShippingOrderService.saveSalePayVouchThree(map, listmap, rmbmap, usdmap);
+				 }
+
+				 if (i > 0) {
+					 //修改人民币推送状态
+					 syShippingOrderMapper.updateRmbIspull(entity.getId());
+					 //修改人民币推送状态
+					 syShippingOrderMapper.updateUsdIspull(entity.getId());
+					 //修改同步状态
+					 entity.setSyStuta("1");
+					 syShippingOrderService.updateById(entity);
+					 result.setResult(1);
+//					 result.setMessage("推送成功!");
+					 message+="托书号"+entity.getShippingOrderNumber()+"推送成功!";
+					 result.setSuccess(true);
+				 } else {
+//					 result.setResult(0);
+//					 result.setMessage("推送失败!请联系管理员");
+					 message+="托书号"+entity.getShippingOrderNumber()+"推送失败!请联系管理员";
+//					 result.setSuccess(false);
+				 }
+			}
+		 	result.setMessage(message);
+		 }catch (Exception e){
+			 e.printStackTrace();
+			 result.setResult(0);
+			 result.setMessage("推送失败!请联系管理员");
+			 result.setSuccess(false);
+		 }
+		 return result;
+	 }
 }

+ 79 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/entity/SyShippingOrder.java

@@ -2,6 +2,7 @@ package org.jeecg.modules.documents.syShippingOrder.entity;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
@@ -17,6 +18,7 @@ import lombok.experimental.Accessors;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import org.jeecg.modules.documents.letterDeposit.entity.SyRmb;
 import org.jeecg.modules.documents.letterDeposit.entity.SyUsd;
+import org.jeecg.modules.spapl.entity.SizeTable;
 import org.springframework.format.annotation.DateTimeFormat;
 import org.jeecgframework.poi.excel.annotation.Excel;
 
@@ -97,6 +99,7 @@ public class SyShippingOrder {
 	private String latestDateOfShipment;
 	/**最终船期*/
 	@Excel(name = "最终船期", width = 20, format = "yyyy-MM-dd")
+	@DateTimeFormat(pattern="yyyy-MM-dd")
     @ApiModelProperty(value = "最终船期")
 	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
 	private java.util.Date theFinalShippingDate;
@@ -301,7 +304,7 @@ public class SyShippingOrder {
 	@TableField(exist = false)
 	private String ddate;
 
-	/**
+	/** PRIMARK STORES LIMITED
 	 * 打印使用字段
 	 */
 	@TableField(exist = false)
@@ -355,4 +358,79 @@ public class SyShippingOrder {
 	//报关总金额(结汇发票使用)
 	@TableField(exist = false)
 	private BigDecimal totalDeclarationTotalPrice;
+	//供应商
+	@TableField(exist = false)
+	private String supplier;
+	//款号
+	@TableField(exist = false)
+	private String styleNum;
+	//净价总金额
+	@TableField(exist = false)
+	private BigDecimal totalNetPrice;
+
+
+	//gender
+	@TableField(exist = false)
+	private String gender;
+
+	/**二维表格*/
+	@TableField(exist = false)
+	//@ExcelCollection(name="二维表格")
+	@ApiModelProperty(value = "二维表格")
+	private List<SizeTable> sizeTables;
+
+//	public List<SizeTable>  sizeTablesList(){
+//		List<SizeTable>  sizes=new ArrayList<>();
+//		List<String> arrays=new ArrayList<>();
+//		arrays.add("S");
+//		arrays.add("M");
+//		arrays.add("L");
+//		arrays.add("XL");
+//		arrays.add("2XL");
+//		arrays.add("3XL");
+//		arrays.add("4XL");
+//		arrays.add("5XL");
+//		arrays.add("6XL");
+//		arrays.add("4XL");
+//		arrays.add("5XL");
+//		arrays.add("6XL");
+////		arrays.add("4XL");
+////		arrays.add("5XL");
+////		arrays.add("6XL");
+////		arrays.add("4XL");
+////		arrays.add("5XL");
+//		for (String size : arrays){
+//			SizeTable sizeTable=new SizeTable();
+//			sizeTable.setSize(size);
+//			sizeTable.setNum(1);
+//			sizes.add(sizeTable);
+//		}
+//		return sizes;
+//	}
+
+	public List<Object> toString2(){
+		List<Object> strings=new ArrayList();
+
+//		strings.add("Order No.:");
+//		strings.add("Kimball No.:");
+//		strings.add("Description of Goods");
+//		strings.add("Carton number");
+		strings.add("Quantity/Size per carton");
+//		for (SizeTable sizeTable : sizeTables){
+//			strings.add(sizeTable.getNum());
+//		}
+		strings.add("Total Number of units/ carton");
+		strings.add("Total number of cartons");
+		strings.add("TOTAL QUANTITY");
+		strings.add("Net weight per carton");
+		strings.add("TOTAL Net weight");
+		strings.add("Gross weight per carton");
+		strings.add("TOTAL Gross weight");
+		strings.add("Measurement per carton ( CM)");
+		strings.add("L");
+		strings.add("W");
+		strings.add("H");
+		strings.add("TOTAL CBM");
+		return strings;
+	}
 }

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

@@ -2,7 +2,11 @@ package org.jeecg.modules.documents.syShippingOrder.entity;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.List;
+
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -14,6 +18,7 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import org.jeecg.modules.spapl.entity.SizeTable;
 import org.springframework.format.annotation.DateTimeFormat;
 import org.jeecgframework.poi.excel.annotation.Excel;
 
@@ -351,4 +356,92 @@ public class SyShippingOrderItem {
 	@TableField(exist = false)
 	private BigDecimal declarationTotalPrice;
 
+
+	//颜色
+	@TableField(exist = false)
+	private String colour;
+
+	@TableField(exist = false)
+	private String subSectionDescription;
+
+	@TableField(exist = false)
+	private String customsCode;
+
+	/**起始箱号*/
+	@TableField(exist = false)
+	private String startingBoxNumber;
+
+	/**结束箱号*/
+	@TableField(exist = false)
+	private String endCaseNumber;
+
+	/**二维表格*/
+	@TableField(exist = false)
+	private List<SizeTable> sizeTables;
+
+
+	@TableField(exist = false)
+	private BigDecimal netWeight2;
+
+	@TableField(exist = false)
+	private BigDecimal grossWeight2;
+
+	//件数/箱
+	@TableField(exist = false)
+	private BigDecimal piecesBox;
+
+	//gender
+	@TableField(exist = false)
+	private String gender;
+
+	public List<Object> toString2(){
+		List<Object> strings=new ArrayList();
+		strings.add(smailPo);
+		strings.add(styleNumber);
+		strings.add(englishName);
+		strings.add(startingBoxNumber);
+		strings.add("-");
+		strings.add(endCaseNumber);
+
+		for (SizeTable sizeTable : sizeTables){
+			strings.add(sizeTable.getNum());
+		}
+
+		strings.add(piecesBox);
+		strings.add(boxNumber);
+		strings.add(number);
+		strings.add(netWeight2);
+		strings.add(netWeight);
+		strings.add(grossWeight2);
+		strings.add(grossWeight);
+		strings.add(outerBoxLength);
+		strings.add(outerBoxWidth);
+		strings.add(outerBoxHeight);
+		strings.add(volume);
+		return strings;
+	}
+
+
+	public List<Object> toString3(){
+		List<Object> strings=new ArrayList();
+
+		strings.add("Order No.:");
+		strings.add("Kimball No.:");
+		strings.add("Description of Goods");
+		strings.add("Carton number");
+		strings.add("Quantity/Size per carton");
+		strings.add("Total Number of units/ carton");
+		strings.add("Total number of cartons");
+		strings.add("TOTAL QUANTITY");
+		strings.add("Net weight per carton");
+		strings.add("TOTAL Net weight");
+		strings.add("Gross weight per carton");
+		strings.add("TOTAL Gross weight");
+		strings.add("Measurement per carton ( CM)");
+		strings.add("L");
+		strings.add("W");
+		strings.add("H");
+		strings.add("TOTAL CBM");
+		return strings;
+	}
 }

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

@@ -12,6 +12,7 @@ import org.jeecg.modules.documents.syShippingOrder.entity.SyShippingOrder;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.jeecg.modules.documents.syShippingOrder.entity.SyShippingOrderItem;
 import org.jeecg.modules.documents.syShippingOrder.entity.VO.SyPackingList;
+import org.jeecg.modules.spapl.entity.SizeTable;
 
 /**
  * @Description: 托书主表实体类
@@ -49,6 +50,12 @@ public interface SyShippingOrderMapper extends BaseMapper<SyShippingOrder> {
     //查询报关要素明细信息(传主表ID)
     public List<SyShippingOrderItem> queryEelement(@Param("id") String id);
 
+    //获取尺码
+    public List<SizeTable> querySizes(@Param("id") String id);
+
+    //获取尺码子表
+    public List<SizeTable> queryItemSizes(@Param("id")String id, @Param("ew") QueryWrapper<SyPackingList> queryWrapper);
+
     //合并按钮(新增界面使用)
     public List<SyPackingList> syShippingOrderMerge(@Param("ids") List<String> ids);
 

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

@@ -14,7 +14,7 @@ b.gross_weight as grossWeight,b.volume as volume,sum(b.number*b.unit_price) as t
 a.the_final_shipping_date as theFinalShippingDate,a.export_invoice_no as exportInvoiceNo,
 b.order_number as orderNumber,a.shipping_order_date as shippingOrderDate,b.smail_po as smailPo,b.ready_fabric as readyFabric,
 b.pk_org as pkOrg,a.del_flag as delFlag,b.distribution_point as distributionPoint, a.the_documents_state as theDocumentsState,
-a.sy_stuta as syStuta,a.is_ahaa as isAhaa
+a.sy_stuta as syStuta,a.is_ahaa as isAhaa,sum(b.number*b.declaration_Unit_Price) as totalNetPrice
  from sy_shipping_order a
 left join sy_shipping_order_item b
 ON a.id = b.sy_shipping_order_item_id
@@ -182,7 +182,8 @@ d.terms_of_deliveryvalue as termsOfDeliveryvalue
 <!--    面料托书发票-->
     <select id="queryEelementMerge" resultType="org.jeecg.modules.documents.syShippingOrder.entity.SyShippingOrderItem">
 
-select GROUP_CONCAT(a.id) as id,b.hs_code as hsCode,b.declaration_name as declarationName,b.english_product_name as englishProductName,case when ready_fabric != '辅料' then sum(c.meter) else sum(c.actual_declared_quantity) end as meter,sum(a.number) as number,a.unit_price as unitPrice,
+select Colour,
+ substring( TRIM(english_Name),1, INSTR(TRIM(english_Name), ' ')) as gender, GROUP_CONCAT(a.id) as id,b.hs_code as hsCode,b.declaration_name as declarationName,b.english_product_name as englishProductName,case when ready_fabric != '辅料' then sum(c.meter) else sum(c.actual_declared_quantity) end as meter,sum(a.number) as number,a.unit_price as unitPrice,
 round(sum(a.total_price),2) as totalPrice,a.declaration_unit_price as declarationUnitPrice,(a.number*a.declaration_unit_price) as declarationTotalPrice,round(sum(a.gross_weight),2) as grossWeight,round(sum(a.net_weight),2) as netWeight,'KG' as pcs,a.volume as volume,a.pk_org as pkOrg,
 'USD' as curr,'CHINA' as dree,'宁波其他/宁波象山县' as place,'照章征税' as certificate,a.style_number as styleNumber,a.smail_po as smailPo,sum(a.box_number) as boxNumber,
 a.order_number as orderNumber,a.client_abbreviation as clientAbbreviation,'CTNS' as ctns,'KGS' as kgs,'CBM' as cbm,c.factory_Unit_Price as factoryUnitPrice,
@@ -204,25 +205,72 @@ select case when t.istc ='0' then '否' else '是' end as isTc,t.preDate,t.suppl
 round(sum(t.totalPrice),2) as totalPrice,round(sum(t.declarationTotalPrice),2) as declarationTotalPrice,round(sum(t.grossWeight),2) as grossWeight,round(sum(t.netWeight),2) as netWeight,t.pcs,t.pacs,
 round(sum(t.volume),3) as volume,t.declarationUnitPrice,t.curr,t.dree,t.place,t.certificate,t.styleNumber,t.smailPo,t.orderNumber,t.ctns,t.kgs,t.cbm,pkOrg,t.factoryUnitPrice,
 t.outerBoxLength,t.outerBoxWidth,t.outerBoxHeight,t.hod,t.unIt,t.emp,GROUP_CONCAT(DISTINCT t.purchaseOutsourcingOrderNo) as purchaseOutsourcingOrderNo,t.packId,t.salesman,t.earliestDeliveryDate,t.declarationUnit,
-t.clientAbbreviation,t.pcGw,t.priceGw from (
+t.clientAbbreviation,t.pcGw,t.priceGw,t.colour as colour,t.english_Name,t.elementsId,SUBSTRING(TRIM(t.english_Name),1, INSTR(TRIM(t.english_Name), ' ')) as gender,t.starting_box_number,t.end_case_number,
+-- t.Customs_Code,
+t.pieces_Box,t.net_Weight netWeight2,t.gross_Weight grossWeight2  from (
 select a.declaration_unit_price as declarationUnitPrice,sum(a.number*a.declaration_unit_price) as declarationTotalPrice,del.istc as isTc,DATE_FORMAT(a.pre_shipment_date,'%y-%m-%d') as preDate,a.garment_factory as garmentFactory,a.supplier,GROUP_CONCAT(a.id) as id,b.hs_code as hsCode,b.declaration_name as declarationName,b.english_product_name as englishProductName,sum(a.number) as number,a.unit_price as unitPrice,
 sum(a.number*a.unit_price) as totalPrice,a.gross_weight as grossWeight,a.net_weight as netWeight,a.master_metering as pcs,a.volume as volume,a.elements_Id as elementsId,
 'USD' as curr,'CHINA' as dree,'宁波其他/宁波象山县' as place,'照章征税' as certificate,a.style_number as styleNumber,a.smail_po as smailPo,a.box_number as boxNumber,
 a.order_number as orderNumber,a.client_abbreviation as clientAbbreviation,'PCS' as pacs,'CTNS' as ctns,'KGS' as kgs,'CBM' as cbm,c.salesman as salesman,'PC' as pcGw,'/PC' as priceGw,
 c.factory_Unit_Price as factoryUnitPrice,c.outer_box_length as outerBoxLength,c.outer_box_width as outerBoxWidth,c.outer_box_height as outerBoxHeight,c.hod as hod,min(c.hod) as earliestDeliveryDate,
-a.pk_org as pkOrg,round((a.unit_price*0.9),2) as unIt,'' as emp,a.purchase_outsourcing_order_no as purchaseOutsourcingOrderNo,c.pack_id as packId,b.declaration_unit as declarationUnit
+a.pk_org as pkOrg,round((a.unit_price*0.9),2) as unIt,'' as emp,a.purchase_outsourcing_order_no as purchaseOutsourcingOrderNo,c.pack_id as packId,b.declaration_unit as declarationUnit,
+
+c.colour,a.english_Name,starting_box_number,end_case_number,
+--  d.Customs_Code,
+c.pieces_Box,c.net_Weight,c.gross_Weight
+
  from sy_shipping_order_item a
 left join sy_declaration_elements b
 on a.elements_Id = b.id
+-- left join sy_shipping_order d
+-- on a.sy_Shipping_Order_Item_Id = d.id
 left join sy_packing_list_tailoring_item c
 on a.tailoring_fabric_item_id = c.id
-left join (select is_tc as istc,item_number as itemNumber,inventory_code as inventoryCode,order_number as orderNumber from sy_shipping_details_item where del_flag = '0' group by item_number,inventory_code,order_number) del
+left join (select is_tc as istc,item_number as itemNumber,inventory_code as inventoryCode,order_number as orderNumber
+from sy_shipping_details_item where del_flag = '0' group by item_number,inventory_code,order_number) del
 on a.style_number = del.itemNumber and b.inventory_code = del.inventoryCode and a.order_number = del.orderNumber
 where a.sy_shipping_order_item_id =#{id}
-group by c.group_id) t group by t.elementsId,t.styleNumber,t.smailPo,t.unitPrice order by t.supplier,t.salesman,t.styleNumber,t.smailPo,t.unitPrice
+group by c.group_id) t
+group by t.elementsId,t.styleNumber,t.smailPo,t.unitPrice order by t.supplier,t.salesman,t.styleNumber,t.smailPo,t.unitPrice
+
+    </select>
+
+
+    <select id="queryItemSizes" parameterType="java.lang.String" resultType="org.jeecg.modules.spapl.entity.SizeTable">
+
+        select  a.size,b.proportion num,a.num ordernum from
+        (select DISTINCT  c.size ,b.num
+        from sy_shipping_order_item a
+        left join sy_packing_list_tailoring_item c
+        on a.tailoring_fabric_item_id = c.id
+        left join sizetable b
+        on c.size=b.size
+        where a.sy_shipping_order_item_id  =#{id}) a
+        left join
+        (select DISTINCT a.number/a.box_number proportion,c.size
+        from sy_shipping_order_item a
+        left join sy_packing_list_tailoring_item c
+        on a.tailoring_fabric_item_id = c.id
+        left join sizetable b
+        on c.size=b.size
+        ${ew.customSqlSegment}) b
+        on a.size=b.size
+        order by ordernum
 
     </select>
 
+    <select id="querySizes" parameterType="java.lang.String" resultType="org.jeecg.modules.spapl.entity.SizeTable">
+
+       select distinct c.size,b.num
+        from sy_shipping_order_item a
+        left join sy_packing_list_tailoring_item c
+        on a.tailoring_fabric_item_id = c.id
+        left join sizetable b
+        on c.size=b.size
+        where a.sy_shipping_order_item_id=#{id}
+        ORDER BY num ;
+
+    </select>
 
 
 <!--    托书新增页合并按钮-->
@@ -291,21 +339,25 @@ group by c.group_id) t group by t.elementsId,t.styleNumber,t.smailPo,t.unitPrice
     <select id="qeuryItemInfo" resultType="org.jeecg.modules.documents.syShippingOrder.entity.SyShippingOrderItem">
 
 select sum(t.grossWeight) as grossWeight,t.orderNumber,t.tailoringFabricItemId,t.pkOrg from (
-select a.order_number as orderNumber,a.gross_weight as grossWeight,
-a.tailoring_fabric_item_id as tailoringFabricItemId,a.pk_org as pkOrg
+select IF(INSTR(c.sy_order_data_id, '-')>0, if(LEFT(c.order_number, INSTR(c.order_number,'-(')-1)=''
+,c.order_number,LEFT(c.order_number, INSTR(c.order_number,'-(')-1)) , c.order_number) as orderNumber,
+a.gross_weight as grossWeight,a.tailoring_fabric_item_id as tailoringFabricItemId,a.pk_org as pkOrg
 from sy_shipping_order_item a
 left join sy_packing_list_tailoring_item c
 on a.tailoring_fabric_item_id = c.id
-where a.del_flag = 0 and a.sy_shipping_order_item_id = #{id}  group by c.group_id) t  group by t.orderNumber
+where a.del_flag = 0 and a.sy_shipping_order_item_id = #{id}  group by c.group_id,a.order_Number) t  group by t.orderNumber
     </select>
 
     <select id="qeuryItemInfoTa" resultType="org.jeecg.modules.documents.syShippingOrder.entity.SyShippingOrderItem">
 
 select sum(t.grossWeight) as grossWeight,t.orderNumber,t.tailoringFabricItemId,t.pkOrg from (
-select a.order_number as orderNumber,sum(a.gross_weight) as grossWeight,
-a.tailoring_fabric_item_id as tailoringFabricItemId,a.pk_org as pkOrg
+select IF(INSTR(c.sy_order_data_id, '-')>0, if(LEFT(c.order_number, INSTR(c.order_number,'-(')-1)='',
+c.order_number,LEFT(c.order_number, INSTR(c.order_number,'-(')-1)) , c.order_number) as orderNumber,
+sum(a.gross_weight) as grossWeight,a.tailoring_fabric_item_id as tailoringFabricItemId,a.pk_org as pkOrg
 from sy_shipping_order_item a
-where a.del_flag = 0 and a.sy_shipping_order_item_id = #{id}  group by a.group_id) t  group by t.orderNumber
+left join sy_packing_list_fabric_item c
+on a.tailoring_fabric_item_id = c.id
+where a.del_flag = 0 and a.sy_shipping_order_item_id = #{id}  group by a.group_id,orderNumber) t  group by t.orderNumber
     </select>
 
 

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

@@ -642,7 +642,7 @@ public class SyShippingOrderServiceImpl extends ServiceImpl<SyShippingOrderMappe
      */
     public Integer saveSalePayVouch(Map<String,Object> map1,List<Map<String,Object>> itemList,List<Map<String,Object>> rmbList,List<Map<String,Object>> usdList){
 
-        //主表集合
+        //主表集合 grossWeight
         List<Map<String,Object>> listmap = new ArrayList<>();
         //子表集合
         List<Map<String,Object>> listmaps = new ArrayList<>();
@@ -669,6 +669,13 @@ public class SyShippingOrderServiceImpl extends ServiceImpl<SyShippingOrderMappe
             String dd = sf1.format(new Date());
             String rateSplit[] = dd.split("-");
             rate = syShippingOrderMapper.queryU8Rate(rateSplit[0], rateSplit[1]);
+
+            if (!map1.get("readyFabric").toString().equals("成衣")){
+                SimpleDateFormat sf3 = new SimpleDateFormat("yyyy-M-dd");
+                String dd2 = sf3.format(map1.get("theFinalShippingDate"));
+                String rateSplit2[] = dd2.split("-");
+                rate = syShippingOrderMapper.queryU8Rate(rateSplit2[0], rateSplit2[1]);
+            }
             if(oConvertUtils.isEmpty(rate)){
                 nflat = "1";
             }else{
@@ -825,6 +832,7 @@ public class SyShippingOrderServiceImpl extends ServiceImpl<SyShippingOrderMappe
                         maps.put("cbSysBarCode", "||SA09|"+cCode+"|"+ii);
                         Double usdMoney = Double.parseDouble(df.format(imoney))*Double.parseDouble(nflat);
                         maps.put("INatMoney", df.format(usdMoney));
+                        maps.put("iexchrate", nflat);//汇率
                         maps.put("iMoney", df.format(imoney));
                         maps.put("cExpCode",usd.get("itemColumn"));//项目编码
                         maps.put("ID", id);
@@ -839,11 +847,19 @@ public class SyShippingOrderServiceImpl extends ServiceImpl<SyShippingOrderMappe
                     if(sumMoney.compareTo(sumImoney) > 0){
                         BigDecimal mo = sumMoney.subtract(sumImoney).setScale(2,BigDecimal.ROUND_HALF_UP);
                         listmaps.get(listmaps.size()-1).put("iMoney",(new BigDecimal(listmaps.get(listmaps.size()-1).get("iMoney").toString()).add(mo)));
-                        listmaps.get(listmaps.size()-1).put("INatMoney",(new BigDecimal(listmaps.get(listmaps.size()-1).get("INatMoney").toString()).add(mo)));
+                        BigDecimal iMoney=new BigDecimal(listmaps.get(listmaps.size()-1).get("iMoney").toString());
+                        BigDecimal iexchrate =new BigDecimal(listmaps.get(listmaps.size()-1).get("iexchrate").toString());
+                        BigDecimal INatMoney=iMoney.multiply(iexchrate).setScale(2,BigDecimal.ROUND_HALF_UP);
+                        listmaps.get(listmaps.size()-1).put("INatMoney",INatMoney);
+//                        listmaps.get(listmaps.size()-1).put("INatMoney",(new BigDecimal(listmaps.get(listmaps.size()-1).get("INatMoney").toString()).add(mo)));
                     }else{
                         BigDecimal mo = sumImoney.subtract(sumMoney).setScale(2,BigDecimal.ROUND_HALF_UP);
                         listmaps.get(listmaps.size()-1).put("iMoney",(new BigDecimal(listmaps.get(listmaps.size()-1).get("iMoney").toString()).subtract(mo)));
-                        listmaps.get(listmaps.size()-1).put("INatMoney",(new BigDecimal(listmaps.get(listmaps.size()-1).get("INatMoney").toString()).subtract(mo)));
+                        BigDecimal iMoney=new BigDecimal(listmaps.get(listmaps.size()-1).get("iMoney").toString());
+                        BigDecimal iexchrate =new BigDecimal(listmaps.get(listmaps.size()-1).get("iexchrate").toString());
+                        BigDecimal INatMoney=iMoney.multiply(iexchrate).setScale(2,BigDecimal.ROUND_HALF_UP);
+                        listmaps.get(listmaps.size()-1).put("INatMoney",INatMoney);
+//                        listmaps.get(listmaps.size()-1).put("INatMoney",(new BigDecimal(listmaps.get(listmaps.size()-1).get("INatMoney").toString()).add(mo)));
                     }
             }
         }

+ 1 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/openApi/mapper/xml/PurchaseWarehousingMapper.xml

@@ -1010,6 +1010,7 @@
            AND isnull(cFree8,'') = isnull(#{map.cFree8},'')
            AND isnull(cFree9,'') = isnull(#{map.cFree9},'')
            AND isnull(cFree10,'') = isnull(#{map.cFree10},'')
+            AND isnull(cInvCode,'') = isnull(#{map.cInvCode},'')
     </select>
 
     <select id="getOM_MOMaterialsByMoIdAndCinvcode" resultType="java.util.HashMap" parameterType="java.util.HashMap">

+ 2 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/openApi/service/impl/PurchaseWarehousingServiceImpl.java

@@ -848,6 +848,7 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
                 if(OM_MOMaterialsList!=null&&OM_MOMaterialsList.size()>0){
                     if(OM_MOMaterialsList.size()>0){
                         vouchsMap.put("iomids",OM_MOMaterialsList.get(0).get("MOMaterialsID"));//委外订单自件id
+                        vouchsMap.put("cInvCode2",OM_MOMaterialsList.get(0).get("cInvCode"));//委外订单自件id
                         //回写调拨数量
                         //已领数量
 //                        BigDecimal iSendQTY=getDecimalNew(String.valueOf(OM_MOMaterialsList.get(0).get("iSendQTY")));//已领数量
@@ -928,7 +929,7 @@ public class PurchaseWarehousingServiceImpl extends ServiceImpl<PurchaseWarehous
                 JSONArray itemJsonArray=new JSONArray();
                 for(Map<String,Object> m:transVouchsList){
                     JSONObject saveItemJson=new JSONObject();
-                    saveItemJson.put("CINVCODE",m.get("cInvCode"));
+                    saveItemJson.put("CINVCODE",m.get("cInvCode2"));
                     saveItemJson.put("IQUANTITY",m.get("iTVQuantity"));
                     saveItemJson.put("CBATCH",m.get("cTVBatch"));
                     saveItemJson.put("CBMEMO",m.get("cbMemo"));

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

@@ -86,7 +86,7 @@ public class FabricLossServiceImpl extends ServiceImpl<FabricLossMapper, FabricL
 			ret.setSuccess(true);
 			ret.setCCode(code);
 
-			// 设置面损表头、不含总成本
+			// 设置面损表头、不含总成本 actualMoney
 			setHeadInfo(ret);
 			// 设置采购入库订单,不含来源余纱和其他入库的纱。分配数量、余纱、采购损耗不设置,等委外出库使用再算
 			setPoOrderList(ret, editData);

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

@@ -1660,15 +1660,18 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
                     Cell cell = row.createCell(i);//横向
                     cell.setCellStyle(cellStyle2);
                     if(i>5&&i<5+list.getSizeTables().size()+1){
+//                        System.out.println("args1\t"+args1[5]);
                         Cell cell2= row.createCell(5);
                         cell2.setCellStyle(cellStyle);
                         cell2.setCellValue(args1[5]);
                         continue;
                     }else if(i<5){
+//                        System.out.println("args1[i]\t"+args1[i]);
                         cell.setCellValue(args1[i]);
                         cell.setCellStyle(cellStyle);
                     }
-                    else if(i>5+list.getSizeTables().size()&&i<10+list.getSizeTables().size()){
+                    else if(i>5+list.getSizeTables().size()&&i<12+list.getSizeTables().size()){
+//                        System.out.println("args1[i-list.getSizeTables().size()]\t"+args1[i-list.getSizeTables().size()]);
                         cell.setCellValue(args1[i-list.getSizeTables().size()]);
                         cell.setCellStyle(cellStyle);
                     }
@@ -1792,7 +1795,7 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
             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();//客户名称
+//                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()));
@@ -1800,9 +1803,9 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
                 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(" ");
-                }
+//                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));

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

@@ -246,6 +246,15 @@ public class SyPreAssembledPackingList implements Serializable {
 	@TableField(exist = false)
 	private BigDecimal packs;
 
+	@ApiModelProperty(value = "ITEM NO./SKU NO./UPC NO./PACKS CODE")
+	@TableField(exist = false)
+	private String itemCode;
+
+	//佣金
+	@ApiModelProperty(value = "佣金")
+	@TableField(exist = false)
+	private BigDecimal ymoney;
+
 	public SyPreAssembledPackingList(){
 
 	}
@@ -270,6 +279,8 @@ public class SyPreAssembledPackingList implements Serializable {
 				productName+ ","+
 				"UNIT PRICE:"+ ","+
 				price+ ","+
+				"KICKBACK:"+","+
+				ymoney+ ","+
 				"MERCHANDISER:"+ ","+
 				salesman+ ",_____"+
 

+ 2 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/entity/SyPreAssembledPackingListItem.java

@@ -422,7 +422,8 @@ public class SyPreAssembledPackingListItem implements Serializable {
 //					packs=new BigDecimal(parsms[20]);//包数
 					packs=boxNumber.multiply(packBox);//包数
 //				}
-			System.out.println("\t包数/箱\t"+packBox+"\t件数/包\t"+totalPack+"\t包数\t"+packs);
+//			System.out.println("\t包数/箱\t"+packBox+"\t件数/包\t"+totalPack+"\t包数\t"+packs);
+			System.out.println("\t箱数\t"+boxNumber+"\t件数/包\t"+totalPack+"\t包数\t"+packs+"\t总数\t"+total);
 			this.totalNetWeight=this.boxNumber.multiply(this.netWeight);
 			this.totalGrossWeight=this.boxNumber.multiply(this.grossWeight);
 			this.totalVolume=this.boxNumber.multiply(this.outerBoxLength).multiply(this.outerBoxWidth).multiply(this.outerBoxHeight).divide(new BigDecimal(1000000));

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

@@ -102,54 +102,49 @@
 
     <select id="selectPage4" resultType="org.jeecg.modules.spapl.vo.SyPreAssembledPackingListVo">
     /*获取汇总数据*/
+    select small_po,distribution_point,container_number,
+    garment_factory,depositary_receipt_no,colour,
+    inventory_name,spur_or_sub_order,itemCode,
+    document_No,order_number,item_number,
+    customer_abbreviation,preDeliveryDate,
+    sum(total) total,sum(totalboxes) totalboxes,
+    sum(totalnetweight) totalnetweight,
+    sum(totalgrossweight) totalgrossweight,
+    sum(totalvolume) totalvolume,
+    sum(totalprice) totalprice
+    from (
     SELECT
-        a.id,/*主键id*/
-        a.document_No,/*单据号*/
-        a.order_number,/*订单号*/
-        a.item_number, /*款号*/
-	    c.english_product_name englishProductName ,/*中文品名*/
-	    c.declaration_name  productName,/*英文品名*/
-        a.size_range,/*尺码范围*/
-        a.customer,/*客户名称*/
-        a.container_code,/*集装箱号*/
-        a.container_number,/*集装箱代号*/
-        a.u8_remarks,/*备注*/
-        b.garment_factory,/*成衣工厂*/
-        a.depositary_receipt_no,/*预托书号*/
-        a.memo,/*备注*/
-        a.order_type,/*订单类型*/
-        a.customer_abbreviation,/*客户简称*/
-        a.`update_time`,/*修改日期*/
-        a.`status`,/*单据状态*/
-        a.`push_Status`,/*推送状态*/
-        a.is_Reference,/*是否被参照*/
-        b.master_Metering,/*计量单位*/
-        b.hod as  preDeliveryDate,/*预发货日期*/
-
-        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,/*颜色*/
-        b.distribution_point/*分销点*/
+            a.document_No,/*单据号*/
+            a.order_number,/*订单号*/
+            a.item_number, /*款号*/
+            a.customer_abbreviation,/*客户简称*/
+            b.hod as  preDeliveryDate,/*预发货日期*/
+            b.small_po,/*小po*/
+            b.distribution_point,/*分销点*/
+            a.container_number,/*集装箱代号*/
+            b.garment_factory,/*成衣工厂*/
+            a.depositary_receipt_no,/*预托书号*/
+            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,/*总价*/
+            a.spur_or_sub_order,/*采购委外订单号*/
+            b.inventory_name,/*存货名称*/
+            b.colour,/*颜色*/
+            IF(a.customer_Abbreviation='BIG W' OR a.customer_Abbreviation ='BL', b.item_code,'') itemCode
     FROM Sy_Pre_Assembled_Packing_List  a
     LEFT JOIN Sy_Pre_Assembled_Packing_List_item  b
     ON a.id=b.sy_pre_assembled_packing_list_id  AND b.del_flag='0'
-    left join sy_declaration_elements c
-    on a.elements_Id=c.id
     ${ew.customSqlSegment}
-    /*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*/
+    GROUP BY b.group_id ) t
+    GROUP BY small_po,distribution_point,container_number,
+    garment_factory,depositary_receipt_no,colour,
+    inventory_name,spur_or_sub_order,itemCode,
+    document_No,order_number,item_number,
+    customer_abbreviation,preDeliveryDate
+    ORDER BY item_Number,small_Po,itemCode
 	</select>
 
     <select id="selectPage3" resultType="org.jeecg.modules.spapl.entity.SyPreAssembledPackingList">
@@ -377,6 +372,7 @@
         b.distribution_Point,
         SUBSTRING(b.hod,1,10)  hod,
         b.supplier,
+        b.ymoney,
         b.Unit_Price  price,
         d.material_Composition,
         declaration_name productName,

+ 7 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/service/impl/SyPreAssembledPackingListServiceImpl.java

@@ -930,9 +930,11 @@ public class SyPreAssembledPackingListServiceImpl extends ServiceImpl<SyPreAssem
 			bool=false;
 		}
 
+		long startTime2 = System.currentTimeMillis();
 		syPreAssembledPackingListItemMapper.insertBatch(listItems);
 		long endTime = System.currentTimeMillis();
-		System.out.println("批量插入时间:" + (endTime - startTime) + "ms");
+		System.out.println("批量插入时间:" + (endTime - startTime2) + "ms");
+		System.out.println("操作总和时间插入时间:" + (endTime - startTime) + "ms");
 		saveBatch(lists);
 		return bool;
 	}
@@ -977,8 +979,12 @@ public class SyPreAssembledPackingListServiceImpl extends ServiceImpl<SyPreAssem
 					if (map.get(size.getSize())==null){
 						BigDecimal sub=new BigDecimal(size.getProportion()).multiply(item.getBoxNumber());
 						System.out.println("sub\t"+sub);
+						if(sub.intValue()>0){
+							System.out.println("测试数据\t");
+						}
 						total3=total3.subtract(sub);
 					}else{
+						System.out.println("无数据total\t"+item.getTotal());
 						//ids+=""+map.get(size.getSize())+",";//获取出运明细子表id
 					}
 //					System.out.println("尺码\t"+size.getSize()+"\t数量\t"+size.getProportion());

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

@@ -2348,7 +2348,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 							"b.id as u8pid,\n" +
 							"b.id as syPackingListFabricId,\n" +
 							"left(b.iordercode,ISNULL(NULLIF(CHARINDEX('-',b.iordercode)-1,-1),len(b.iordercode))) as planLotNumber,\n" +
-							"b.csocode as orderNumber,\n" +
+							"b.iordercode as orderNumber,\n" +
 							"b.cBatch as dyelotNumber ,"+
 							account + " as account,\n" +
 							"0  as delflag,\n" +
@@ -2643,7 +2643,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 //					syPackingListFabric.setRemarks("TC证书");
 //				} getCustomsDeclarationUnitPrice
 //			}
-			//System.out.println("codes.size\t"+codes.size());
+			//System.out.println("codes.size\t"+codes.size()); iTaxUnitPrice
 			System.out.println("codes\t"+codes);
 			List<Map<String,Object>> invoices=getInvoices(customers.get(customer));
 			JSONObject  jsonObject1=new JSONObject();

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/controller/SyPackingListTailoringController.java

@@ -2020,7 +2020,7 @@ public class SyPackingListTailoringController implements Job {
 			 if(listTailorings.size()==0){
 			 	return "未在装箱单找到对应单据";
 			 }
-			 //List<SyPackingListFabricItem> listFabricItems=syPackingListFabricItemService.queryByList(id);//获取托书下所有的主表信
+			 //List<SyPackingListFabricItem> listFabricItems=syPackingListFabricItemService.queryByList(id);//获取托书下所有的主表信 CustomsDeclarationUnitPrice
 			 Map<String,Object> mapdate=syPackingListTailoringService.getSyShippingOrder(listTailorings.get(0).getId());//获取一些日期信息
 			 Map<String,List<SyPackingListTailoring>> listMap=new HashMap<>();
 			 //Map<String,List<String>> listStrMap=new HashMap<>();

+ 2 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/mapper/SyPackingListTailoringMapper.java

@@ -95,4 +95,6 @@ public interface SyPackingListTailoringMapper extends BaseMapper<SyPackingListTa
     public Map<String,Object> getSoMainCode(String id);
 
     void updateTimeStatus();
+
+    Map<String, Object> getAccount2(@Param("params1")String params1,@Param("params2") String params2);
 }

+ 2 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/mapper/xml/syPackingListTailoringItemMapper.xml

@@ -356,6 +356,8 @@
 			#{value}
 		</foreach>
 		)
+
+
 	</select>
 
 	<select id="getiTaxPrice" parameterType="java.lang.String" resultType="java.lang.String">

+ 8 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/mapper/xml/syPackingListTailoringMapper.xml

@@ -419,6 +419,14 @@
          ) )
     </select>
 
+    <select id="getAccount2" parameterType="java.lang.String" resultType="java.util.HashMap">
+         select popos.iorderdid iorderdid,popos.ivouchrowno ivouchrowno
+         FROM UFDATA_102_2021.dbo.so_sodetails soso
+         LEFT JOIN UFDATA_102_2021.dbo.po_podetails popos
+         ON popos.iorderdid=soso.iSOsID
+         WHERE soso.cSOCode = #{params1}
+          AND soso.iSOsID = #{params2}
+    </select>
 
     <update id="updateTimeStatus" >
         update sy_shipping_order set time_Stuta=0

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

@@ -6,6 +6,7 @@ import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.googlecode.aviator.utils.ArrayHashMap;
 import org.hibernate.engine.jdbc.Size;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.exception.JeecgBootException;
@@ -369,7 +370,7 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 		syPreAssembledPackingListMapper.updateById(syPreAssembledPackingList);
 		syPackingListTailoring.setContainerCode(syPreAssembledPackingList.getContainerCode());//集装箱代号
 		syPackingListTailoring.setContainerNumber(syPreAssembledPackingList.getContainerNumber());//集装箱号
-		//syPackingListTailoring.setExportInvoiceNo(syPreAssembledPackingList);//外销发票号
+		//syPackingListTailoring.setExportInvoiceNo(syPreAssembledPackingList);//外销发-票号
 		syPackingListTailoring.setDepositaryReceiptNo(syPreAssembledPackingList.getDepositaryReceiptNo());//预托书号
 		syPackingListTailoring.setBusinessTypeValue(syPreAssembledPackingList.getBusinessTypeValue());//业务类型
 		syPackingListTailoring.setSalesman(syPreAssembledPackingList.getSalesman());//业务员
@@ -875,6 +876,7 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 							item1.setOmpoIdItem(syPreItem.getOmpoIdItem());//子表id
 							item1.setOmpoAccount(syPreItem.getOmpoAccount());//子表id
 							item1.setPacks(syPreItem.getPacks());//包数
+							item1.setYmoney(syPreItem.getYmoney());//佣金
 							item1.setPackBox(syPreItem.getPackBox());//包数/箱
 							item1.setTotalPack(syPreItem.getTotalPack());//件数/包
 							item1.setSyOrderDataId(syPreItem.getSyOrderDataId());//订单数据子表id
@@ -1176,19 +1178,19 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 			map4.put("CMAKER",createBy);//制单人
 			//map4.put("CMEMO",main.getMemo());//备注
 
-			JSONObject map5=new JSONObject();//采购发票
-			map5.put("CVOUCHCODE",pushsno002.replaceAll("DZ",orderNumber));//发票号
-			map5.put("DDATE",date2);//发票日期(格式2015-01-01)
-			map5.put("CTYPE","专用");//发票类型(01:专用 02:普票)
+			JSONObject map5=new JSONObject();//采购发-
+			map5.put("CVOUCHCODE",pushsno002.replaceAll("DZ",orderNumber));//发-票号
+			map5.put("DDATE",date2);//发-票日期(格式2015-01-01)
+			map5.put("CTYPE","专用");//发-票类型(01:专用 02:普票)
 			map5.put("CMAKER",createBy);//制单人
 			map5.put("CHANDLER",createBy);//审核人
 			//map5.put("CMEMO",main.getMemo());//备注
 
 
-			JSONObject map6=new JSONObject();//销售发票
-			map6.put("CVOUCHCODE",pushsno005.replaceAll("DZ",orderNumber));//发票号
-			map6.put("DDATE",date2);//发票日期(yyyy-MM-dd)
-			map6.put("CTYPE","普通");//发票类型(普通,专用)
+			JSONObject map6=new JSONObject();//销售发-
+			map6.put("CVOUCHCODE",pushsno005.replaceAll("DZ",orderNumber));//发-票号
+			map6.put("DDATE",date2);//发-票日期(yyyy-MM-dd)
+			map6.put("CTYPE","普通");//发-票类型(普通,专用)
 			map6.put("CMAKER",createBy);//制单人名称
 			map6.put("CVERIFIER",createBy);//制单人名称
 			//map6.put("CMEMO",main.getMemo());//备注
@@ -1491,10 +1493,15 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 					}else{
 
 					}
+					Map<String,Object> ivouchrownos=new HashMap<>();
 					//String params1="UFDATA_103_2021";//当前数据库
 					String params3= (String) map.get("cOrderCode");//销售订单号
 					String params5=mapSort.get(item.getId());//当前数据库行号
-					Map<String,Object> ivouchrownos =syPackingListTailoringMapper.getIvouchrowno(params1,params2,params3,params4,params5);
+//					if (mapt.get("account").equals("102")&&mapt.get("account1").equals("102")){
+//						ivouchrownos =syPackingListTailoringMapper.getAccount2(params3,params5);
+//					}else{
+						ivouchrownos =syPackingListTailoringMapper.getIvouchrowno(params1,params2,params3,params4,params5);
+//					}
 					//orderIrowno.setIrowno(ivouchrowno);//获取行号
 					System.out.println("销售订单子表的行号\t"+ivouchrownos);
 					mapSort.put(item.getId(),ivouchrownos.get("iorderdid").toString());
@@ -1561,7 +1568,7 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 				mapt.put("account","101");//账套号
 				mapt.put("error","101账套未推送");
 			}else if(mapt.get("customerCode").equals("0001")&&!mapt.get("account").equals("102")){
-				map6.put("CTYPE","专用");//发票类型(普通,专用)
+				map6.put("CTYPE","专用");//发-票类型(普通,专用)
 				mapt.put("account","102");//账套号
 				mapt.put("error","102账套未推送");
 			}else{
@@ -1583,7 +1590,7 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 				maps.put(recordings[i].split("-")[0],map);
 			}
 			String account=mapList.getJSONObject(0).get("CACCID").toString();//获取账套号
-			//System.out.println("采购发票供应商编码\t"+mapt.get("CVENCODE"));
+			//System.out.println("采购发-票供应商编码\t"+mapt.get("CVENCODE"));
 			if (maps.containsKey(account)){
 				switch (maps.get(account).get("index")){
 					case "1":	//代表已完成第一道
@@ -1607,9 +1614,9 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 //									System.out.println("mapItems4\t"+mapItems5);
 //								}
 //							}
-//							text(mapList5,mapt.get("ordertype")+"发票单");
-//							JSONArray resturn5 = InterfaceConnUtils.doPost(mapList5,"purinvoice_import");//采购发票单
-//							recording=result(main,resturn5,mapt.get("ordertype")+"发票单",((Map) mapList.get(0)).get("CACCID").toString(),"2");//采购发票单
+//							text(mapList5,mapt.get("ordertype")+"发-票单");
+//							JSONArray resturn5 = InterfaceConnUtils.doPost(mapList5,"purinvoice_import");//采购发-票单
+//							recording=result(main,resturn5,mapt.get("ordertype")+"发-票单",((Map) mapList.get(0)).get("CACCID").toString(),"2");//采购发-票单
 //							recording(main,recording);
 //							this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(org.jeecg.modules.system.util.oConvertUtils.maxNumber(resturn5.getJSONObject(0).get("U8ReceiptNo").toString()),"109");
 //						}
@@ -1667,9 +1674,9 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 //								}
 //							}
 //						}
-//						text(mapList6,"销售发票单");
-//						JSONArray resturn6 = InterfaceConnUtils.doPost(mapList6,"saleinvoice_import");//销售发票单
-//						recording=result(main,resturn6,"销售发票单",((Map) mapList.get(0)).get("CACCID").toString(),"5");//销售发票单
+//						text(mapList6,"销售发-票单");
+//						JSONArray resturn6 = InterfaceConnUtils.doPost(mapList6,"saleinvoice_import");//销售发-票单
+//						recording=result(main,resturn6,"销售发-票单",((Map) mapList.get(0)).get("CACCID").toString(),"5");//销售发-票单
 //						recording(main,recording);
 				}
 				return account+"账套推送成功!";
@@ -1701,9 +1708,9 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 //		}
 
 //		if(!((Map) mapList.get(0)).get("CACCID").toString().equals("102")*//*||mapt.get("CVENCODE").equals("T020001")*//*){
-//			text(mapList5,mapt.get("ordertype")+"发票单");
-//			JSONArray resturn5 = InterfaceConnUtils.doPost(mapList5,"purinvoice_import");//采购发票单
-//			recording=result(main,resturn5,mapt.get("ordertype")+"发票单",((Map) mapList.get(0)).get("CACCID").toString(),"2");//采购发票单
+//			text(mapList5,mapt.get("ordertype")+"发-票单");
+//			JSONArray resturn5 = InterfaceConnUtils.doPost(mapList5,"purinvoice_import");//采购发-票单
+//			recording=result(main,resturn5,mapt.get("ordertype")+"发-票单",((Map) mapList.get(0)).get("CACCID").toString(),"2");//采购发-票单
 //			recording(main,recording);
 //			this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(org.jeecg.modules.system.util.oConvertUtils.maxNumber(resturn5.getJSONObject(0).get("U8ReceiptNo").toString()),"109");
 //		}
@@ -1762,9 +1769,9 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 				}
 			}
 		}
-		text(mapList6,"销售发票单");
-		JSONArray resturn6 = InterfaceConnUtils.doPost(mapList6,"saleinvoice_import");//销售发票单
-		recording=result(main,resturn6,"销售发票单",((Map) mapList.get(0)).get("CACCID").toString(),"5");//销售发票单
+		text(mapList6,"销售发-票单");
+		JSONArray resturn6 = InterfaceConnUtils.doPost(mapList6,"saleinvoice_import");//销售发-票单
+		recording=result(main,resturn6,"销售发-票单",((Map) mapList.get(0)).get("CACCID").toString(),"5");//销售发-票单
 		recording(main,recording);*/
 		//this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(org.jeecg.modules.system.util.oConvertUtils.maxNumber(resturn6.getJSONObject(0).get("U8ReceiptNo").toString()),"120");
 		return mapList.getJSONObject(0).get("CACCID").toString()+"账套推送成功!";
@@ -2018,7 +2025,7 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 	}
 
 	/**
-	 * 采购委外发票 推送发票接口
+	 * 采购委外发票 推送发-票接口
 	 * @param listTailorings
 	 * @param maps
 	 * @return
@@ -2042,9 +2049,9 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 		}
 		Map<String,List<SyPackingListTailoringItem>> listTailoringItemMaps=getListTailoringItemMaps(customers,listTailorings);//key:供应商编码,value:对应子表
 		Map<String,List<SyPackingListTailoring>> listTailoringMaps=getListTailoringMaps(customers,listTailorings);//key:供应商编码,value:对应主表
-		Map<String,List<SyPackingListTailoring>> codeMaps=new HashMap<>();//key:传入销售发票单id,value:主表数据
+		Map<String,List<SyPackingListTailoring>> codeMaps=new HashMap<>();//key:传入销售发-票单id,value:主表数据
 		JSONArray jsonArrays1=new JSONArray();
-		String code=redisUtil.get("pushsno002").toString();//发票号
+		String code=redisUtil.get("pushsno002").toString();//发-票号
 
 		for (String customer : customers.keySet()){
 			SyPackingListTailoring syPackingListTailoring=listTailoringMaps.get(customer).get(0);
@@ -2075,7 +2082,7 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 			JSONObject  jsonObject1=new JSONObject();
 			code=org.jeecg.modules.system.util.oConvertUtils.addOne(code);
 			code=orderNumber+code.substring(code.indexOf("0"));
-			redisUtil.set("pushsno002", code);//采购委外发票单
+			redisUtil.set("pushsno002", code);//采购委外发-票单
 			codeMaps.put(code,listTailoringMaps.get(customer));
 //			String istc=syPackingListTailoring.getIsTc();
 //			if (istc!=null&&istc.equals("1")){
@@ -2086,11 +2093,11 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 //				}
 //			}
 			//jsonObject1.put("CMEMO",syPackingListTailoring.getMemo());//备注
-			jsonObject1.put("CVOUCHCODE",code);//发票号
+			jsonObject1.put("CVOUCHCODE",code);//发-票号
 			jsonObject1.put("CMAKER","进出口平台管理员");//制单人
 			jsonObject1.put("CHANDLER","进出口平台管理员");//审核人
 			jsonObject1.put("CACCID",account);//账套号
-			jsonObject1.put("CTYPE","专用");//发票类型
+			jsonObject1.put("CTYPE","专用");//发-票类型
 
 			jsonObject1.put("CGLTYPE","入库单");//上游单据
 			System.out.println("syPackingListTailoring.getLatestDateOfShipment2()\t"+syPackingListTailoring.getLatestDateOfShipment2());
@@ -2131,13 +2138,14 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 			}
 			JSONArray jsonArrays=new JSONArray();
 			List<Object> autoIds=new ArrayList<>();
+			BigDecimal dzMoney=new BigDecimal("0");//单证金额合计
+			BigDecimal u8Money=new BigDecimal("0");//u8金额合计
 			for (SyPackingListTailoringItem item : listTailoringItems){
 				JSONObject  jsonObject=new JSONObject();
 				jsonObject.put("IQUANTITY",item.getTotal());//净重
 				jsonObject.put("size",item.getSize());//尺码
 				jsonObject.put("CINVCODE",item.getInventoryCode());//存货编码
 				jsonObject.put("POAUTOIDCOL","Autoid");//对应类型
-
 				String istc2=item.getIsTc();
 				if (istc2!=null&&istc2.equals("1")){
 //					if(item.getMemo()!=null){
@@ -2147,7 +2155,6 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 //					}
 				}
 				jsonObject.put("CBMEMO",item.getMemo());//备注
-
 				for (Map<String,Object> map : invoices){
 					if(Double.parseDouble(map.get("iQuantity").toString())==Double.parseDouble(jsonObject.get("IQUANTITY").toString())&&
 					   map.get("cInvCode").toString().equalsIgnoreCase(item.getInventoryCode())&&map.get("cFree2").equals(item.getSize())
@@ -2166,6 +2173,10 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 							BigDecimal unitPrice=new BigDecimal(map.get("iOriTaxCost").toString());
 							jsonObject.put("IORITAXCOST",unitPrice.multiply(item.getAccountPrice()));//改成使用报关单价*成衣参考单价
 						}
+						BigDecimal u8Price=new BigDecimal(jsonObject.get("IORITAXCOST").toString());
+						dzMoney=dzMoney.add(item.getTotal().multiply(u8Price));//单证合计
+						u8Money=u8Money.add(u8Price.multiply(item.getTotal()).setScale(2, RoundingMode.HALF_UP));//单证合计
+						jsonObject.put("IORIMONEY",item.getTotal().multiply(u8Price).setScale(2, RoundingMode.HALF_UP));//改成使用报关单价*成衣参考单价
 						getcFree(jsonObject,map);
 						jsonObject.put("CDEFINE28",item.getSmallPo());//小po
 						break;
@@ -2175,6 +2186,18 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 				jsonObject.put("CDEFINE33",item.getDeclarationName());//存货名称
 				jsonArrays.add(jsonObject);
 			}
+//			System.out.println("dzMoney\t"+dzMoney+"\tu8Money\t"+u8Money);
+			dzMoney=dzMoney.setScale(2, RoundingMode.HALF_UP);
+//			System.out.println("dzMoney\t"+dzMoney+"\tu8Money\t"+u8Money);
+//			System.out.println("dzMoney.compareTo(u8Money)t"+dzMoney.compareTo(u8Money));
+			if(dzMoney.compareTo(u8Money)!=0){
+				BigDecimal dividePrice =dzMoney.subtract(u8Money);
+//				System.out.println("IORIMONEY\t"+jsonArrays.getJSONObject(jsonArrays.size()-1).get("IORIMONEY").toString());
+				BigDecimal ioriMoney=new BigDecimal(jsonArrays.getJSONObject(jsonArrays.size()-1).get("IORIMONEY").toString());
+				jsonArrays.getJSONObject(jsonArrays.size()-1).put("IORIMONEY",ioriMoney.add(dividePrice));
+//				System.out.println("IORIMONEY\t"+jsonArrays.getJSONObject(jsonArrays.size()-1).get("IORIMONEY").toString());
+			}
+//			jsonObject.put("IORIMONEY",item.getUnitPrice());//金额
 			jsonObject1.put("DETAILList",jsonArrays);
 			jsonArrays1.add(jsonObject1);
 			//Map<String,List<String>> maps=new HashMap<>();//key:客户编码-字符,value:主表id-数组 用于区分维度完成分组条件
@@ -2187,9 +2210,12 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 		}
 		System.out.println("jsonArrays1\n"+jsonArrays1);
 		text(jsonArrays1,"测试合并推送成衣采购发票");
-		JSONArray resturnJsonArrays = InterfaceConnUtils.doPost(jsonArrays1,"purinvoice_import");//采购发票单
+//		if(true){
+//			return "推送成功";
+//		}
+		JSONArray resturnJsonArrays = InterfaceConnUtils.doPost(jsonArrays1,"purinvoice_import");//采购发-票单
 		Map<String,String> codeMaps2 =new HashMap<>();
-		if(maps.get("account1").equals("101")||account.equals("103")){//账套只有101或者账套是103的为委外发票
+		if(maps.get("account1").equals("101")||account.equals("103")){//账套只有101或者账套是103的为委外发-
 			codeMaps2 = result(resturnJsonArrays,"委外发票",account);
 		}else{
 			codeMaps2 = result(resturnJsonArrays,"采购发票",account);
@@ -2248,9 +2274,9 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 		System.out.println(account+"销售customers\t"+customers);
 		Map<String,List<SyPackingListTailoringItem>> listTailoringItemMaps=getListTailoringItemMaps(customers,listTailorings);//key:供应商编码,value:子表数据
 		Map<String,List<SyPackingListTailoring>> listTailoringMaps=getListTailoringMaps(customers,listTailorings);//key:供应商编码,value:主表数据
-		Map<String,List<SyPackingListTailoring>> codeMaps=new HashMap<>();//key:传入销售发票单id,value:主表数据
+		Map<String,List<SyPackingListTailoring>> codeMaps=new HashMap<>();//key:传入销售发-票单id,value:主表数据
 		JSONArray jsonArrays1=new JSONArray();
-		String code=redisUtil.get("pushsno005").toString();//发票号
+		String code=redisUtil.get("pushsno005").toString();//发-票号
 		for (String customer : customers.keySet()){
 			SyPackingListTailoring syPackingListTailoring=listTailoringMaps.get(customer).get(0);
 			List<SyPackingListTailoringItem> listFabricItems=listTailoringItemMaps.get(customer);
@@ -2273,11 +2299,11 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 			code=orderNumber+code.substring(code.indexOf("0"));
 			redisUtil.set("pushsno005", code);//采购委外入库单
 			codeMaps.put(code,listTailoringMaps.get(customer));
-			jsonObject1.put("CVOUCHCODE",code);//发票号
+			jsonObject1.put("CVOUCHCODE",code);//发-票号
 			jsonObject1.put("CMAKER","进出口平台管理员");//制单人
 			jsonObject1.put("CVERIFIER","进出口平台管理员");//审核人
 			jsonObject1.put("CACCID",account);//账套号
-			jsonObject1.put("CTYPE","普通");//发票类型
+			jsonObject1.put("CTYPE","普通");//发-票类型
 			jsonObject1.put("CGLTYPE","销售出库单");//上游单据
 			jsonObject1.put("CDEFINE13",syPackingListTailoring.getShippingOrderNumber().replace("&","(-)"));// 客户名称
 			jsonObject1.put("CDEFINE11",syPackingListTailoring.getEndCustomer().replace("&","(-)"));//最终客户
@@ -2291,7 +2317,7 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 			if(order.get("cCusCode").equals("T020001")&&!account.equals("101")){
 				//maps.put("account","101");//账套号
 			}else if(order.get("cCusCode").equals("0001")&&!account.equals("102")){
-				jsonObject1.put("CTYPE","专用");//发票类型(普通,专用)
+				jsonObject1.put("CTYPE","专用");//发-票类型(普通,专用)
 				//maps.put("account","102");//账套号
 			}else{
 				//maps.put("account","104");//账套号
@@ -2397,7 +2423,7 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 		}
 		text(jsonArrays1,"测试合并推送成衣销售发票");
 		//System.out.println("jsonArrays1\t"+jsonArrays1);
-		JSONArray resturnJsonArrays = InterfaceConnUtils.doPost(jsonArrays1,"saleinvoice_import");//销售发票单
+		JSONArray resturnJsonArrays = InterfaceConnUtils.doPost(jsonArrays1,"saleinvoice_import");//销售发-票单
 		Map<String,String> codeMaps2 = result(resturnJsonArrays,"销售发票",account);
 		for (String code1 : codeMaps.keySet()){
 			List<SyPackingListTailoring> listTailoringList=codeMaps.get(code1);
@@ -2573,7 +2599,7 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 	}
 
 /*	*//**
-	 * 采购发票
+	 * 采购发-
 	 * @param codes,listTailorings
 	 * @return
 	 *//*

+ 4 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/syPlanStatistics/controller/SyPlanStatisticsController.java

@@ -91,7 +91,10 @@ public class SyPlanStatisticsController extends JeecgController<SyPlanStatistics
 //		Page<SyPlanStatistics> page = new Page<SyPlanStatistics>(0, 10);
 //		queryWrapper.eq("del_flag",0);
 //		IPage<SyPlanStatistics> pageList = syPlanStatisticsService.page(page, queryWrapper);
-		if(syPlanStatistics.getId()==null){
+		QueryWrapper queryWrapper=new QueryWrapper();
+		queryWrapper.eq("plan_num",syPlanStatistics.getPlanNum());
+		SyPlanStatistics statistics=syPlanStatisticsService.getOne(queryWrapper);
+		if(syPlanStatistics.getId()==null&&statistics==null){
 			syPlanStatisticsService.save(syPlanStatistics);
 		}else {
 			syPlanStatisticsService.updateById(syPlanStatistics);