Browse Source

森语近期调整

huxy 9 months ago
parent
commit
de87ab1c2b
19 changed files with 722 additions and 350 deletions
  1. 4 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/entity/SyCostAllocationIngredient.java
  2. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/SyCostAllocationIngredientMapper.java
  3. 492 287
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/xml/SyCostAllocationIngredientMapper.xml
  4. 8 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/xml/SyCostAllocationMapper.xml
  5. 136 19
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/service/impl/SyCostAllocationServiceImpl.java
  6. 6 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/letterDeposit/service/impl/SyLetterDepositServiceImpl.java
  7. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/shippingDetails/controller/SyShippingDetailsController.java
  8. 2 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/shippingDetails/mapper/xml/SyShippingDetailsMapper.xml
  9. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/entity/SyShippingOrderItem.java
  10. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/mapper/xml/SyShippingOrderMapper.xml
  11. 3 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/controller/SyPreAssembledPackingListController.java
  12. 9 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/entity/SyPreAssembledPackingListItem.java
  13. 9 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/controller/SyPackingListFabricController.java
  14. 17 11
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/service/impl/SyPackingListFabricServiceImpl.java
  15. 7 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/controller/SyPackingListTailoringController.java
  16. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/entity/PushJob.java
  17. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/mapper/SyPackingListTailoringMapper.java
  18. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/mapper/xml/syPackingListTailoringMapper.xml
  19. 21 10
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/service/impl/SyPackingListTailoringServiceImpl.java

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

@@ -70,6 +70,10 @@ public class SyCostAllocationIngredient implements Serializable {
     @Excel(name = "货物名称", width = 15)
     @ApiModelProperty(value = "货物名称")
     private String goodsName;
+    /**货物编码*/
+    @Excel(name = "货物编码", width = 15)
+    @ApiModelProperty(value = "货物编码")
+    private String goodsCode;
     /**转入数量*/
     @Excel(name = "转入数量", width = 15)
     @ApiModelProperty(value = "转入数量")

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

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

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

@@ -16,293 +16,498 @@
 			 sy_cost_allocation_id = #{id} 		
 	</select>
 
+<!--	<select id="queryByCostIngredient1" resultType="org.jeecg.modules.cost.entity.SyCostAllocationIngredient">
+		SELECT cPoid,
+			cAccount
+			,cVenAbbName  AS supper
+			,cInvCode
+			,cInvName as goodsName
+			,iQuantityIn as purchaseQuantity
+			,iSum as rmbAmount
+			,iOriSum as usdAmount
+			,iNoTaxMoney as priceExcludingtax
+			,0 as ingredientsTransferQuantity
+		FROM dbo.VIEW_FabricLoss_Cost_Assist
+		where cPoid like CONCAT(#{code},'%') and
+		(cVenAbbName !='宁波森语' and cVenAbbName !='马菲羊')
+	</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
-		else isnull(tab2.jian,0)-isnull(tab1.purchaseQuantity,0) end
-		as ingredientsTransferQuantity,
-		case when isnull(tab2.jian,0)-isnull(tab1.purchaseQuantity,0) <![CDATA[<=]]> 0 then isnull(tab1.purchaseQuantity,0)-tab.usageQuantity
-		else (isnull(tab2.jian,0)-isnull(tab1.purchaseQuantity,0))+isnull(tab1.purchaseQuantity,0)-tab.usageQuantity end
-		as ingredientsRemainingQuantity,
-		(tab1.purchaseQuantity-tab.usageQuantity)/tab1.purchaseQuantity as loss,
-		case when isnull(tab2.jian,0)-isnull(tab1.purchaseQuantity,0) <![CDATA[<=]]> 0 then 0
-		else (isnull(tab2.jian,0)-isnull(tab1.purchaseQuantity,0))*tab.cost end as transferCost
-		from
-		(
-
-		select t4.cInvCode,t4.goodsName,max(t4.dosage) as dosage,sum(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,t3.cVenAbbName AS supper,avg( t3.dosage ) AS dosage,SUM ( t3.usageQuantity ) AS usageQuantity,
-
-		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
-		) 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},'%')
-		)
-		GROUP BY t4.cInvCode,t4.goodsName
-
-		) tab
-		left join
-		(
-		select i.cInvCode,i.cInvName,sum(rs.iQuantity) as purchaseQuantity from UFDATA_103_2021.dbo.rdrecords01 rs
-		join UFDATA_103_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
-		join UFDATA_103_2021.dbo.rdrecord01 r on rs.ID = r.ID
-		where cPOID in (
-		select om.cPOID
-		from UFDATA_103_2021.dbo.PO_POmain om
-		join UFDATA_103_2021.dbo.PO_PODetails od on om.POID=od.POID
-		join UFDATA_103_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
-		WHERE om.cVerifier is not null
-		and om.cPOID LIKE CONCAT(#{code},'%')
-		) and r.cBusType = '普通采购'
-		GROUP BY i.cInvCode,i.cInvName
-		UNION ALL
-		select i.cInvCode,i.cInvName,sum(rs.iQuantity) as purchaseQuantity from UFDATA_103_2021.dbo.rdrecords01 rs
-		join UFDATA_103_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
-		join UFDATA_103_2021.dbo.rdrecord01 r on rs.ID = r.ID
-		where cPOID in (
-		select om.cCode
-		from UFDATA_103_2021.dbo.om_momain om
-		join UFDATA_103_2021.dbo.OM_MODetails od on om.MOID=od.MOID
-		join UFDATA_103_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
-		WHERE om.cVerifier is not null
-		and 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
-		left join
-		(
-		select i.cInvCode,i.cInvName,sum(rs.iQuantity) as jian from UFDATA_103_2021.dbo.rdrecords11 rs
-		join UFDATA_103_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
-		where comcode in (
-		select distinct om.cCode
-		from UFDATA_103_2021.dbo.om_momain om
-		join UFDATA_103_2021.dbo.OM_MODetails od on om.moid=od.moid
-		join UFDATA_103_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
-		WHERE om.iVerifyStateNew = 2
-		and omi.cInvCcode like '19%' and om.cCode LIKE CONCAT(#{code},'%')
-		)
-		GROUP BY i.cInvCode,i.cInvName--,rs.cBatch
-		)tab2 on tab2.cInvName=tab.goodsName and tab2.cInvCode=tab.cInvCode
-
-		union all
-
-
-
-		select tab.*,isnull(tab1.purchaseQuantity,0) as purchaseQuantity,
-		case when isnull(tab2.jian,0)-isnull(tab1.purchaseQuantity,0) <![CDATA[<=]]> 0 then 0
-		else isnull(tab2.jian,0)-isnull(tab1.purchaseQuantity,0) end
-		as ingredientsTransferQuantity,
-		case when isnull(tab2.jian,0)-isnull(tab1.purchaseQuantity,0) <![CDATA[<=]]> 0 then isnull(tab1.purchaseQuantity,0)-tab.usageQuantity
-		else (isnull(tab2.jian,0)-isnull(tab1.purchaseQuantity,0))+isnull(tab1.purchaseQuantity,0)-tab.usageQuantity end
-		as ingredientsRemainingQuantity,
-		(tab1.purchaseQuantity-tab.usageQuantity)/tab1.purchaseQuantity as loss,case when isnull(tab2.jian,0)-isnull(tab1.purchaseQuantity,0) <![CDATA[<=]]> 0 then 0
-		else (isnull(tab2.jian,0)-isnull(tab1.purchaseQuantity,0))*tab.cost end as transferCost
-		from
-		(
-
-		select t4.cInvCode,max(t4.goodsName) as 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 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
-		where t4.cInvCode not in(
-		select cInvCode from UFDATA_103_2021.dbo.cost_allocation_fabric_view vif
-		where trim(vif.cCode) like CONCAT(#{code},'%')
-		)
-		GROUP BY t4.cInvCode,t4.goodsName
-
-		) tab
-		left join
-		(
-		select i.cInvCode,i.cInvName,sum(rs.iQuantity) as purchaseQuantity from UFDATA_101_2021.dbo.rdrecords01 rs
-		join UFDATA_101_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
-		join UFDATA_101_2021.dbo.rdrecord01 r on rs.ID = r.ID
-		where cPOID in (
-		select om.cPOID
-		from UFDATA_101_2021.dbo.PO_POmain om
-		join UFDATA_101_2021.dbo.PO_PODetails od on om.POID=od.POID
-		join UFDATA_101_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
-		WHERE om.cVerifier is not null
-		and om.cPOID LIKE CONCAT(#{code},'%')
-		)  and r.cBusType = '普通采购'
-		GROUP BY i.cInvCode,i.cInvName
-		UNION ALL
-		select i.cInvCode,i.cInvName,sum(rs.iQuantity) as purchaseQuantity from UFDATA_101_2021.dbo.rdrecords01 rs
-		join UFDATA_101_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
-		join UFDATA_101_2021.dbo.rdrecord01 r on rs.ID = r.ID
-		where cPOID in (
-		select om.cCode
-		from UFDATA_101_2021.dbo.om_momain om
-		join UFDATA_101_2021.dbo.OM_MODetails od on om.MOID=od.MOID
-		join UFDATA_101_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
-		WHERE om.cVerifier is not null
-		and 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
-		left join
-		(
-		select i.cInvCode,i.cInvName,sum(rs.iQuantity) as jian from UFDATA_101_2021.dbo.rdrecords11 rs
-		join UFDATA_101_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
-		where comcode in (
-		select distinct om.cCode
-		from UFDATA_101_2021.dbo.om_momain om
-		join UFDATA_101_2021.dbo.OM_MODetails od on om.moid=od.moid
-		join UFDATA_101_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
-		WHERE om.iVerifyStateNew = 2
-		and omi.cInvCcode like '19%' and om.cCode LIKE CONCAT(#{code},'%')
-		)
-		GROUP BY i.cInvCode,i.cInvName
-		)tab2 on tab2.cInvName=tab.goodsName and tab2.cInvCode=tab.cInvCode
-
-		
-	</select>
+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
+			,a.cInvCode as goodsCode
+			,a.cInvName as goodsName
+			,isnull(a.iQuantityIn,0) as purchaseQuantity
+			,a.iSum as rmbAmount
+			,a.iOriSum as usdAmount
+			,case when isnull(a.iQuantityIn,0)-isnull(b.usageQuantity,0)  <![CDATA[<=]]> 0 then 0
+				else isnull(a.iQuantityIn,0)-isnull(b.usageQuantity,0) end as ingredientsRemainingQuantity
+			,a.iNoTaxMoney as priceExcludingtax
+			,case when isnull(b.usageQuantity,0)-isnull(a.iQuantityIn,0) <![CDATA[<=]]> 0 then 0
+				else isnull(b.usageQuantity,0)-isnull(a.iQuantityIn,0) end as ingredientsTransferQuantity
+			,case when  isnull(b.usageQuantity,0)-isnull(a.iQuantityIn,0) <![CDATA[<=]]> 0 then 0
+				else  (isnull(b.usageQuantity,0)-isnull(a.iQuantityIn,0))*isnull(b.cost,0) end as transferCost,*
+    FROM dbo.VIEW_FabricLoss_Cost_Assist  a
+    inner join
+    (
+
+		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
+			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
+        </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-->
+<!--		else isnull(tab2.jian,0)-isnull(tab1.purchaseQuantity,0) end-->
+<!--		as ingredientsTransferQuantity,-->
+<!--		case when isnull(tab2.jian,0)-isnull(tab1.purchaseQuantity,0) <![CDATA[<=]]> 0 then isnull(tab1.purchaseQuantity,0)-tab.usageQuantity-->
+<!--		else (isnull(tab2.jian,0)-isnull(tab1.purchaseQuantity,0))+isnull(tab1.purchaseQuantity,0)-tab.usageQuantity end-->
+<!--		as ingredientsRemainingQuantity,-->
+<!--		(tab1.purchaseQuantity-tab.usageQuantity)/tab1.purchaseQuantity as loss,-->
+<!--		case when isnull(tab2.jian,0)-isnull(tab1.purchaseQuantity,0) <![CDATA[<=]]> 0 then 0-->
+<!--		else (isnull(tab2.jian,0)-isnull(tab1.purchaseQuantity,0))*tab.cost end as transferCost-->
+<!--		from-->
+<!--		(-->
+
+<!--		select t4.cInvCode,t4.goodsName,max(t4.dosage) as dosage,sum(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,t3.cVenAbbName AS supper,avg( t3.dosage ) AS dosage,SUM ( t3.usageQuantity ) AS usageQuantity,-->
+
+<!--		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-->
+<!--		) 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},'%')-->
+<!--		)-->
+<!--		GROUP BY t4.cInvCode,t4.goodsName-->
+
+<!--		) tab-->
+<!--		left join-->
+<!--		(-->
+<!--		select i.cInvCode,i.cInvName,sum(rs.iQuantity) as purchaseQuantity from UFDATA_103_2021.dbo.rdrecords01 rs-->
+<!--		join UFDATA_103_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode-->
+<!--		join UFDATA_103_2021.dbo.rdrecord01 r on rs.ID = r.ID-->
+<!--		where cPOID in (-->
+<!--		select om.cPOID-->
+<!--		from UFDATA_103_2021.dbo.PO_POmain om-->
+<!--		join UFDATA_103_2021.dbo.PO_PODetails od on om.POID=od.POID-->
+<!--		join UFDATA_103_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode-->
+<!--		WHERE om.cVerifier is not null-->
+<!--		and om.cPOID LIKE CONCAT(#{code},'%')-->
+<!--		) and r.cBusType = '普通采购'-->
+<!--		GROUP BY i.cInvCode,i.cInvName-->
+<!--		UNION ALL-->
+<!--		select i.cInvCode,i.cInvName,sum(rs.iQuantity) as purchaseQuantity from UFDATA_103_2021.dbo.rdrecords01 rs-->
+<!--		join UFDATA_103_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode-->
+<!--		join UFDATA_103_2021.dbo.rdrecord01 r on rs.ID = r.ID-->
+<!--		where cPOID in (-->
+<!--		select om.cCode-->
+<!--		from UFDATA_103_2021.dbo.om_momain om-->
+<!--		join UFDATA_103_2021.dbo.OM_MODetails od on om.MOID=od.MOID-->
+<!--		join UFDATA_103_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode-->
+<!--		WHERE om.cVerifier is not null-->
+<!--		and 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-->
+<!--		left join-->
+<!--		(-->
+<!--		select i.cInvCode,i.cInvName,sum(rs.iQuantity) as jian from UFDATA_103_2021.dbo.rdrecords11 rs-->
+<!--		join UFDATA_103_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode-->
+<!--		where comcode in (-->
+<!--		select distinct om.cCode-->
+<!--		from UFDATA_103_2021.dbo.om_momain om-->
+<!--		join UFDATA_103_2021.dbo.OM_MODetails od on om.moid=od.moid-->
+<!--		join UFDATA_103_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode-->
+<!--		WHERE om.iVerifyStateNew = 2-->
+<!--		and omi.cInvCcode like '19%' and om.cCode LIKE CONCAT(#{code},'%')-->
+<!--		)-->
+<!--		GROUP BY i.cInvCode,i.cInvName&#45;&#45;,rs.cBatch-->
+<!--		)tab2 on tab2.cInvName=tab.goodsName and tab2.cInvCode=tab.cInvCode-->
+
+<!--		union all-->
+
+
+
+<!--		select tab.*,isnull(tab1.purchaseQuantity,0) as purchaseQuantity,-->
+<!--		case when isnull(tab2.jian,0)-isnull(tab1.purchaseQuantity,0) <![CDATA[<=]]> 0 then 0-->
+<!--		else isnull(tab2.jian,0)-isnull(tab1.purchaseQuantity,0) end-->
+<!--		as ingredientsTransferQuantity,-->
+<!--		case when isnull(tab2.jian,0)-isnull(tab1.purchaseQuantity,0) <![CDATA[<=]]> 0 then isnull(tab1.purchaseQuantity,0)-tab.usageQuantity-->
+<!--		else (isnull(tab2.jian,0)-isnull(tab1.purchaseQuantity,0))+isnull(tab1.purchaseQuantity,0)-tab.usageQuantity end-->
+<!--		as ingredientsRemainingQuantity,-->
+<!--		(tab1.purchaseQuantity-tab.usageQuantity)/tab1.purchaseQuantity as loss,case when isnull(tab2.jian,0)-isnull(tab1.purchaseQuantity,0) <![CDATA[<=]]> 0 then 0-->
+<!--		else (isnull(tab2.jian,0)-isnull(tab1.purchaseQuantity,0))*tab.cost end as transferCost-->
+<!--		from-->
+<!--		(-->
+
+<!--		select t4.cInvCode,max(t4.goodsName) as 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 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-->
+<!--		where t4.cInvCode not in(-->
+<!--		select cInvCode from UFDATA_103_2021.dbo.cost_allocation_fabric_view vif-->
+<!--		where trim(vif.cCode) like CONCAT(#{code},'%')-->
+<!--		)-->
+<!--		GROUP BY t4.cInvCode,t4.goodsName-->
+
+<!--		) tab-->
+<!--		left join-->
+<!--		(-->
+<!--		select i.cInvCode,i.cInvName,sum(rs.iQuantity) as purchaseQuantity from UFDATA_101_2021.dbo.rdrecords01 rs-->
+<!--		join UFDATA_101_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode-->
+<!--		join UFDATA_101_2021.dbo.rdrecord01 r on rs.ID = r.ID-->
+<!--		where cPOID in (-->
+<!--		select om.cPOID-->
+<!--		from UFDATA_101_2021.dbo.PO_POmain om-->
+<!--		join UFDATA_101_2021.dbo.PO_PODetails od on om.POID=od.POID-->
+<!--		join UFDATA_101_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode-->
+<!--		WHERE om.cVerifier is not null-->
+<!--		and om.cPOID LIKE CONCAT(#{code},'%')-->
+<!--		)  and r.cBusType = '普通采购'-->
+<!--		GROUP BY i.cInvCode,i.cInvName-->
+<!--		UNION ALL-->
+<!--		select i.cInvCode,i.cInvName,sum(rs.iQuantity) as purchaseQuantity from UFDATA_101_2021.dbo.rdrecords01 rs-->
+<!--		join UFDATA_101_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode-->
+<!--		join UFDATA_101_2021.dbo.rdrecord01 r on rs.ID = r.ID-->
+<!--		where cPOID in (-->
+<!--		select om.cCode-->
+<!--		from UFDATA_101_2021.dbo.om_momain om-->
+<!--		join UFDATA_101_2021.dbo.OM_MODetails od on om.MOID=od.MOID-->
+<!--		join UFDATA_101_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode-->
+<!--		WHERE om.cVerifier is not null-->
+<!--		and 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-->
+<!--		left join-->
+<!--		(-->
+<!--		select i.cInvCode,i.cInvName,sum(rs.iQuantity) as jian from UFDATA_101_2021.dbo.rdrecords11 rs-->
+<!--		join UFDATA_101_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode-->
+<!--		where comcode in (-->
+<!--		select distinct om.cCode-->
+<!--		from UFDATA_101_2021.dbo.om_momain om-->
+<!--		join UFDATA_101_2021.dbo.OM_MODetails od on om.moid=od.moid-->
+<!--		join UFDATA_101_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode-->
+<!--		WHERE om.iVerifyStateNew = 2-->
+<!--		and omi.cInvCcode like '19%' and om.cCode LIKE CONCAT(#{code},'%')-->
+<!--		)-->
+<!--		GROUP BY i.cInvCode,i.cInvName-->
+<!--		)tab2 on tab2.cInvName=tab.goodsName and tab2.cInvCode=tab.cInvCode-->
+
+
+<!--	</select>-->
 
 
 	<!--	辅料转入数量链接方法-->
@@ -471,7 +676,7 @@
 		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%'
 					or oti.cInvCcode like '07%' or oti.cInvCCode = '0399' or oti.cInvCCode = '0499')
-					and oti.cInvName = #{goodName}
+
 		GROUP BY oti.cInvName
 
 		union all
@@ -492,7 +697,7 @@
 		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%'
 					or oti.cInvCcode like '07%' or oti.cInvCCode = '0399' or oti.cInvCCode = '0499')
-					and oti.cInvName = #{goodName}
+
 		GROUP BY oti.cInvName
     </select>
 </mapper>

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

@@ -211,8 +211,14 @@
 */
     </select>
 
+
+    <!-- 获取 头信息 主要是成衣委外及源头订单信息 -->
     <select id="queryByCostHead2" resultType="java.lang.String">
-        -- SS23-RPI-59960,SS23-PRI-59960-2
+		select distinct contractno from VIEW_FabricLoss_Head_Clothes where (trim(cCode) like '%${code}%' and cCode not like '%样%')
+	</select>
+
+    <!--<select id="queryByCostHead2" resultType="java.lang.String">
+        &#45;&#45; SS23-RPI-59960,SS23-PRI-59960-2
 
       SELECT DISTINCT ss.cSOCode
         FROM  UFDATA_101_2021.dbo.SO_SODetails s
@@ -340,7 +346,7 @@
 
 
 
-    </select>
+    </select>-->
 
     <select id="queryPurBillVouchByFabric" resultType="org.jeecg.modules.cost.entity.SyCostAllocation">
 

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

@@ -192,14 +192,15 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
         }
         syCostAllocation = list.get(0);
 //        System.out.println("Arrays.asList(syCostAllocation.getGarmentContractno().split(\",\"))\t"+Arrays.asList(syCostAllocation.getGarmentContractno().split(",")));
-        List<String> strs=Arrays.asList(syCostAllocation.getGarmentContractno().split(",")).stream().distinct().collect(Collectors.toList());
-        List<String> strs3= syCostAllocationMapper.queryByCostHead2(plannum);
+        List<String> strs3=Arrays.asList(syCostAllocation.getGarmentContractno().split(",")).stream().distinct().collect(Collectors.toList());
+        List<String> strs= syCostAllocationMapper.queryByCostHead2(plannum);
 //        System.out.println("获取成衣strs.size\t"+strs.size());
         syCostAllocation.setGarmentContractno(strs.toString().substring(1,strs.toString().length()-1));
         // 销售订单附件
         List<AccessorItem> accessorItemList = new ArrayList<>();
         if (org.jeecg.modules.system.util.oConvertUtils.isNotEmpty(syCostAllocation.getGarmentContractno())) {
-            accessorItemList = fabricLossMapper.getSoAccList(Arrays.asList(syCostAllocation.getGarmentContractno().split(",")));
+            accessorItemList = fabricLossMapper.getSoAccList(strs);
+//            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);
@@ -227,13 +228,13 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
             fabricLoss1 = JSON.parseObject(JSON.toJSONString(syLossReport1.getContent()), FabricLoss.class);
             syCostAllocation.setFabriccostIncludestax(new BigDecimal(fabricLoss1.getActualMoney()));
             syCostAllocation.setFabriccostNotincludestax(syCostAllocation.getFabriccostIncludestax().divide(new BigDecimal(1.13),2,BigDecimal.ROUND_HALF_UP));
-//            System.out.println("面辅料人名币含税成本\t"+syCostAllocation.getFabriccostIncludestax());
-//            System.out.println("面辅料人名币不含税成本\t"+syCostAllocation.getFabriccostNotincludestax());
+            System.out.println("面辅料人名币含税成本\t"+syCostAllocation.getFabriccostIncludestax());
+            System.out.println("面辅料人名币不含税成本\t"+syCostAllocation.getFabriccostNotincludestax());
             //美元面料含税成本和不含税成本
             syCostAllocation.setFabriccostIncludestaxUsd(syCostAllocation.getFabriccostIncludestax().divide(syCostAllocation.getExchangeRate(),2,BigDecimal.ROUND_HALF_UP));
             syCostAllocation.setFabriccostNotincludestaxUsd(syCostAllocation.getFabriccostIncludestaxUsd().divide(new BigDecimal(1.13),2,BigDecimal.ROUND_HALF_UP));
-//            System.out.println("面辅料美元含税成本\t"+syCostAllocation.getFabriccostIncludestaxUsd());
-//            System.out.println("面辅料美元不含税成本\t"+syCostAllocation.getFabriccostNotincludestaxUsd());
+            System.out.println("面辅料美元含税成本\t"+syCostAllocation.getFabriccostIncludestaxUsd());
+            System.out.println("面辅料美元不含税成本\t"+syCostAllocation.getFabriccostNotincludestaxUsd());
         }
 
         /*如果出现多供应商的情况拼接 供应商*/
@@ -318,7 +319,10 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
             }
             Fabric.setRemainingQuantitycost(new BigDecimal("0"));
             if(Fabric.getFabricremainingQuantity().compareTo(BigDecimal.ZERO) != 0 ){
+                long startTime = System.currentTimeMillis();
                 List<SyRemaining> syRemaining  = syCostAllocationFabricMapper.queryRemainingByFabric(plannum,Fabric.getGoodsName());
+                long endTime2 = System.currentTimeMillis();
+                System.out.println("查询面料余下数量所耗时:" + (endTime2 - startTime) + "ms");
                 BigDecimal cost = new BigDecimal(BigInteger.ZERO);
                 for (SyRemaining syRemain:syRemaining) {
 //                    System.out.println("Fabric.fabricremainingQuantity\t"+Fabric.getFabricremainingQuantity());
@@ -436,6 +440,115 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
 
         //查询U8数据 辅料数据关联临时表
         List<SyCostAllocationIngredient> list4 = syCostAllocationIngredientMapper.queryByCostIngredient1(plannum);
+        HashMap<String,List<SyCostAllocationIngredient>> stringListHashMap=new HashMap();//物料名称+物料编码
+        HashMap<String,List<SyCostAllocationIngredient>> stringListHashMap2=new HashMap();//物料名称+物料编码+供应商
+        List<SyCostAllocationIngredient> ingredients4=new ArrayList<>();//重新赋值
+        HashMap<String,BigDecimal> stringBigDecimalHashMap=new HashMap();//获取转入数量 syf107
+        for (SyCostAllocationIngredient ingredient : list4){
+//            System.out.println("物料名称---"+ingredient.getGoodsName()+"\t编码---"+ingredient.getGoodsCode()+"\t转入数量---"+ingredient.getIngredientsTransferQuantity());
+            if (stringListHashMap.containsKey(ingredient.getGoodsName()+ingredient.getGoodsCode())){
+                List<SyCostAllocationIngredient> ingredients=stringListHashMap.get(ingredient.getGoodsName()+ingredient.getGoodsCode());
+                ingredients.add(ingredient);
+                BigDecimal transferQuantity=new BigDecimal("0");
+                for (SyCostAllocationIngredient ingredient1 : ingredients){
+                    transferQuantity=transferQuantity.add(ingredient1.getIngredientsTransferQuantity());
+                }
+                stringBigDecimalHashMap.put(ingredient.getGoodsName()+ingredient.getGoodsCode(),transferQuantity);
+                stringListHashMap.put(ingredient.getGoodsName()+ingredient.getGoodsCode(),ingredients);
+            }else{
+                List<SyCostAllocationIngredient> ingredients=new ArrayList<>();
+                ingredients.add(ingredient);
+                stringListHashMap.put(ingredient.getGoodsName()+ingredient.getGoodsCode(),ingredients);
+            }
+
+            if (stringListHashMap2.containsKey(ingredient.getGoodsName()+ingredient.getGoodsCode()+ingredient.getSupper())){
+                List<SyCostAllocationIngredient> ingredients=stringListHashMap2.get(ingredient.getGoodsName()+ingredient.getGoodsCode()+ingredient.getSupper());
+                ingredients.add(ingredient);
+                stringListHashMap2.put(ingredient.getGoodsName()+ingredient.getGoodsCode()+ingredient.getSupper(),ingredients);
+            }else{
+                List<SyCostAllocationIngredient> ingredients=new ArrayList<>();
+                ingredients.add(ingredient);
+                stringListHashMap2.put(ingredient.getGoodsName()+ingredient.getGoodsCode()+ingredient.getSupper(),ingredients);
+            }
+        }
+        for (List<SyCostAllocationIngredient> syCostAllocationIngredients : stringListHashMap.values()){
+            if (syCostAllocationIngredients.size()>1){
+                for (SyCostAllocationIngredient ingredient : syCostAllocationIngredients){
+                    BigDecimal transferQuantity=stringBigDecimalHashMap.get(ingredient.getGoodsName()+ingredient.getGoodsCode());
+//                    System.out.println("ingredient.getUsageQuantity()\t"+ingredient.getUsageQuantity()+"\ttransferQuantity\t"+transferQuantity);
+                    if (ingredient.getUsageQuantity().equals(transferQuantity)){
+                        ingredient.setIngredientsTransferQuantity(ingredient.getUsageQuantity().subtract(transferQuantity));
+                    }
+                }
+            }
+        }
+        for (List<SyCostAllocationIngredient> syCostAllocationIngredients : stringListHashMap2.values()){
+            SyCostAllocationIngredient allocationIngredient1=new SyCostAllocationIngredient();
+            if (syCostAllocationIngredients.size()>1){
+                int num=0;
+                for (SyCostAllocationIngredient ingredient : syCostAllocationIngredients){
+                   if (num==0){
+                       allocationIngredient1=ingredient;
+                   }else{
+                       //转入数量
+                       allocationIngredient1.setIngredientsTransferQuantity(allocationIngredient1.getIngredientsTransferQuantity().add(ingredient.getIngredientsTransferQuantity()));
+                       //转入成本
+                       System.out.println("allocationIngredient1.getTransferCost()\t"+allocationIngredient1.getTransferCost()+"\tingredient.getTransferCost()\t"+ingredient.getTransferCost());
+                       allocationIngredient1.setTransferCost(allocationIngredient1.getTransferCost().add(ingredient.getTransferCost()));
+                       //使用数量
+//                       allocationIngredient1.setUsageQuantity(allocationIngredient1.getUsageQuantity().add(ingredient.getUsageQuantity()));
+                       //购入数量
+                       System.out.println("allocationIngredient1.getPurchaseQuantity()\t"+allocationIngredient1.getPurchaseQuantity()+"\tingredient.getPurchaseQuantity()\t"+ingredient.getPurchaseQuantity());
+                       BigDecimal PurchaseQuantity=(allocationIngredient1.getPurchaseQuantity().add(ingredient.getPurchaseQuantity()));
+                       allocationIngredient1.setPurchaseQuantity(PurchaseQuantity);
+                       //余下数量
+                       BigDecimal ingredientsRemainingQuantity=allocationIngredient1.getPurchaseQuantity().subtract(ingredient.getUsageQuantity());
+                       if (ingredientsRemainingQuantity.doubleValue()>BigDecimal.ZERO.doubleValue()){
+                           allocationIngredient1.setIngredientsRemainingQuantity(ingredientsRemainingQuantity);
+                       }else{
+                           allocationIngredient1.setIngredientsRemainingQuantity(BigDecimal.ZERO);
+                       }
+//                       allocationIngredient1.setIngredientsRemainingQuantity(allocationIngredient1.getPurchaseQuantity().subtract(ingredient.getUsageQuantity()));
+                       //转入数量
+                       BigDecimal ingredientsTransferQuantity=allocationIngredient1.getUsageQuantity().subtract(allocationIngredient1.getPurchaseQuantity());
+                       if (ingredientsTransferQuantity.doubleValue()>BigDecimal.ZERO.doubleValue()){
+                           allocationIngredient1.setIngredientsTransferQuantity(ingredientsTransferQuantity);
+                       }else{
+                           allocationIngredient1.setIngredientsTransferQuantity(BigDecimal.ZERO);
+                       }
+//                       allocationIngredient1.setIngredientsTransferQuantity(allocationIngredient1.getUsageQuantity().subtract(allocationIngredient1.getPurchaseQuantity()));
+                       //损耗
+                       allocationIngredient1.setLoss((allocationIngredient1.getPurchaseQuantity().subtract(allocationIngredient1.getUsageQuantity())).divide(allocationIngredient1.getPurchaseQuantity(),4));
+                       //人民币金额
+                       allocationIngredient1.setRmbAmount(allocationIngredient1.getRmbAmount().add(ingredient.getRmbAmount()));
+                       //美元金额
+                       allocationIngredient1.setUsdAmount(allocationIngredient1.getUsdAmount().add(ingredient.getUsdAmount()));
+                       //不含税金额
+                       allocationIngredient1.setPriceExcludingtax(allocationIngredient1.getPriceExcludingtax().add(ingredient.getPriceExcludingtax()));
+                       //用量
+                   }
+                   num++;
+                }
+            }else{
+                allocationIngredient1=syCostAllocationIngredients.get(0);
+            }
+            ingredients4.add(allocationIngredient1);
+        }
+        list4=ingredients4;
+
+        List<SyRemaining> remaininglists  = syCostAllocationIngredientMapper.queryRemainingByIngredient(plannum);
+        Map<String,List<SyRemaining>> remainingMaps=new HashMap<>();
+        for (SyRemaining syRemaining : remaininglists){
+            if (remainingMaps.containsKey(syRemaining.getGoodsName())){
+                List<SyRemaining> remaininglist=remainingMaps.get(syRemaining.getGoodsName());
+                remaininglist.add(syRemaining);
+//                remainingMaps.put(syRemaining.getGoodsName(),remaininglist);
+            }else{
+                List<SyRemaining> remaininglist=new ArrayList<>();
+                remaininglist.add(syRemaining);
+                remainingMaps.put(syRemaining.getGoodsName(),remaininglist);
+            }
+        }
 
         for (int i=0;i<list4.size();i++) {
             SyCostAllocationIngredient Ingredient = list4.get(i);
@@ -448,8 +561,9 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
             //若剩余数量不为0则给转入数据对象赋值
             if(Ingredient.getIngredientsRemainingQuantity()!=null){
                 if(Ingredient.getIngredientsRemainingQuantity().compareTo(BigDecimal.ZERO)>0){
-                    List<SyRemaining> remaininglist  = syCostAllocationIngredientMapper.queryRemainingByIngredient(plannum,Ingredient.getGoodsName());
-                    Ingredient.setSyRemaining(remaininglist);
+//                    List<SyRemaining> remaininglist  = syCostAllocationIngredientMapper.queryRemainingByIngredient(plannum,Ingredient.getGoodsName());
+//                    Ingredient.setSyRemaining(remaininglist);
+                    Ingredient.setSyRemaining(remainingMaps.get(Ingredient.getGoodsName()));
                 }
             }
 
@@ -469,20 +583,23 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
                     syCostAllocation.setExcipiencostIncludestax(BigDecimal.ZERO);
                     syCostAllocation.setExcipiencostIncludestaxUsd(BigDecimal.ZERO);
                 }
+                //人民币金额 RmbAmount+ 辅料含税成本 ExcipiencostIncludestax
+                System.out.println("RmbAmount\t"+Ingredient.getRmbAmount()+"ExcipiencostIncludestax\t"+syCostAllocation.getExcipiencostIncludestax());
+                System.out.println("UsdAmount\t"+Ingredient.getUsdAmount()+"ExcipiencostIncludestaxUsd\t"+syCostAllocation.getExcipiencostIncludestaxUsd());
                 syCostAllocation.setExcipiencostIncludestax(Ingredient.getRmbAmount().add(syCostAllocation.getExcipiencostIncludestax()));
                 syCostAllocation.setExcipiencostIncludestaxUsd(Ingredient.getUsdAmount().add(syCostAllocation.getExcipiencostIncludestaxUsd()));
 
             }
             //辅料不含税成本 美元和人民币
-//            if(Ingredient.getPriceExcludingtax()!=null){
-//                if(syCostAllocation.getExcipiencostNotincludestax()==null){
-//                    syCostAllocation.setExcipiencostNotincludestax(BigDecimal.ZERO);
-//                    syCostAllocation.setExcipiencostNotincludestaxUsd(BigDecimal.ZERO);
-//                }
-//                syCostAllocation.setExcipiencostNotincludestax(Ingredient.getPriceExcludingtax().add(syCostAllocation.getExcipiencostNotincludestax()));
-//                syCostAllocation.setExcipiencostNotincludestaxUsd(syCostAllocation.getExcipiencostNotincludestax().divide(syCostAllocation.getExchangeRate(),2,BigDecimal.ROUND_HALF_UP));
-//
-//            }
+            if(Ingredient.getPriceExcludingtax()!=null){
+                if(syCostAllocation.getExcipiencostNotincludestax()==null){
+                    syCostAllocation.setExcipiencostNotincludestax(BigDecimal.ZERO);
+                    syCostAllocation.setExcipiencostNotincludestaxUsd(BigDecimal.ZERO);
+                }
+                syCostAllocation.setExcipiencostNotincludestax(Ingredient.getPriceExcludingtax().add(syCostAllocation.getExcipiencostNotincludestax()));
+                syCostAllocation.setExcipiencostNotincludestaxUsd(syCostAllocation.getExcipiencostNotincludestax().divide(syCostAllocation.getExchangeRate(),2,BigDecimal.ROUND_HALF_UP));
+
+            }
         }
         //辅料不含税成本 美元和人民币
             //   syCostAllocation.setExcipiencostNotincludestax(syCostAllocation.getExcipiencostIncludestax().divide(new BigDecimal(1.13),2,BigDecimal.ROUND_HALF_UP));
@@ -618,7 +735,7 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
         syCostAllocation.setPlanNum(plannum);
         if (syCostAllocation.getShortvalue()!=null&&syCostAllocation.getShortvalue().intValue()>0){
             BigDecimal shortvalue=(syCostAllocation.getSalesrrdersOriginaltotal().subtract(syCostAllocation.getUsdTotalexportprice())).multiply(syCostAllocation.getExchangeRate());
-            System.out.println("shortvalue\t"+shortvalue);
+//            System.out.println("shortvalue\t"+shortvalue);
             syCostAllocation.setShortvalue(shortvalue);
         }
         return syCostAllocation;

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

@@ -278,12 +278,15 @@ 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.setIsReference(0);
+                    entit.setContainerNumber(li.getContainerNumber());
+                    if (entity.getIsReference()<2){
+                        entit.setIsReference(0);
+                    }
                     syPreAssembledPackingListService.updateById(entit);
-                }
+//                }
 
             }
             //新增

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

@@ -998,7 +998,7 @@ public class SyShippingDetailsController extends JeecgController<SyShippingDetai
 					  String key = generateKey(li);
 					  if (seenData.contains(key)) {
 						  result.setSuccess(false);
-						  result.setMessage("第" + count + "条里面有重复数据,无法提交");
+						  result.setMessage("有重复数据,无法提交");
 						  return result;
 					  }
 					  seenData.add(key);

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

@@ -85,7 +85,8 @@ a.end_customer) as endCustomer,
     b.order_remarks as orderRemarks,b.price_remarks as priceRemarks,b.order_change_description as orderChangeDescription,b.pre_completion_date as preCompletionDate,
     b.sales_type_text as salesTypeText,b.customer_name as customerName,b.exchange_rate as exchangeRate,a.whole_order_total as wholeOrderTotal,
     b.declaration_elements as declarationElements,b.number_of_sets as numberOfSets,a.chinese_name as chineseName,b.account as account,b.supplier as supplier,
-    b.garment_factory as garmentFactory,b.elements_id as elementsId,GROUP_CONCAT(DISTINCT b.coding_rules) as codingRules,b.colour as colour,b.group_id as groupId,
+    b.garment_factory as garmentFactory,b.elements_id as elementsId,GROUP_CONCAT(DISTINCT IF(b.coding_rules='' OR b.coding_rules IS NULL,'默认配码规格', b.coding_rules))
+    as codingRules,b.colour as colour,b.group_id as groupId,
     FROM_UNIXTIME(left(b.d_arrive_date,10),'%Y-%m-%d') as arrivalDate
      from sy_shipping_details a
 left join sy_shipping_details_item b

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

@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableField;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import javafx.beans.binding.ObjectExpression;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;

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

@@ -150,7 +150,7 @@ d.terms_of_deliveryvalue as termsOfDeliveryvalue
             group by c.group_id) t group by t.styleNumber,t.smailPo,t.unitPrice order by t.supplier,t.salesman,t.styleNumber,t.smailPo,t.unitPrice
         </if>
         <if test='type == "面辅料"'>
-            SELECT GROUP_CONCAT(a.id) as id, a.sy_shipping_order_item_id as syShippingOrderItemId, a.english_name as
+            SELECT GROUP_CONCAT(a.id) as id,GROUP_CONCAT(a.id) as id2, a.sy_shipping_order_item_id as syShippingOrderItemId, a.english_name as
             englishName, a.style_number as styleNumber, a.smail_po as smailPo,a.create_by as createBy,
             sum(a.number) as number,a.supplier,
             case when a.ready_fabric != '成衣' then sum(a.box_number) else a.box_number end as boxNumber,a.pk_org as pkOrg,

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

@@ -1591,8 +1591,9 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
                         for (SizeTable sizeTable: list.getSizeTables()){
                             strs=strs+sizeTable.getSize()+",";
                         }
-                        String[] args2=("B号码,ITEMCODE,LABEL,启始箱号,结束箱号,颜色(中英文),"+strs+
-                                "件数/每箱,PCS/PACK,PACKS/CTN,PACK QTY,箱数,总件数,长,宽,高,总体积,外箱净重,总净重,外箱毛重,总毛重").split(",");
+                        String[] args2=("B号码,ITEMCODE,LABEL,启始箱号CARTON FROM,结束箱号CARTON END,颜色COLOUR,"+strs+
+                                "件数/每箱 PCS/CTN,PCS/PACK,PACKS/CTN,PACK QTY,箱数CARTONS,总件数 PCS,长L(CM),宽W(CM)," +
+                                "高H(CM),总体积 Total CBM,外箱净重N.W/CTN,总净重 TTL N.W,外箱毛重G.W/CTN,总毛重 TTL G.W").split(",");
                         num2++;
                         //PCS/PACK	PACKS/CTN	PACK QTY
                         //件数/包	包数/箱	包数

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

@@ -354,6 +354,11 @@ public class SyPreAssembledPackingListItem implements Serializable {
 			boxNumber=new BigDecimal(Double.parseDouble(endCaseNumber)-Double.parseDouble(startingBoxNumber)+1);//箱数
 			netWeight=new BigDecimal(parsms[11]);
 			grossWeight=new BigDecimal(parsms[12]);
+
+			if (netWeight.doubleValue()>=grossWeight.doubleValue()){
+				throw new Exception("第"+error.get("num")+"页数据有问题,净重不能大于等于毛重");
+			}
+
 			outerBoxLength=new BigDecimal(parsms[13]);
 			outerBoxWidth=new BigDecimal(parsms[14]);
 			outerBoxHeight=new BigDecimal(parsms[15]);
@@ -421,9 +426,12 @@ public class SyPreAssembledPackingListItem implements Serializable {
 			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));
-		}catch (Exception e){
+		}catch (JeecgBootException e){
 			e.printStackTrace();
 			throw new JeecgBootException("第"+error.get("num")+"页数据有问题,需要调整");
+		}catch (Exception e){
+			e.printStackTrace();
+			throw new JeecgBootException("第"+error.get("num")+"页数据有问题,净重不能大于等于毛重");
 		}
 	}
 

+ 9 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/controller/SyPackingListFabricController.java

@@ -111,10 +111,14 @@ public class SyPackingListFabricController implements Job {
 			queryWrapper.like("a.document_No",syPackingListFabric.getDocumentNo().trim());//单据号
 		}
 		if(oConvertUtils.isNotEmpty(syPackingListFabric.getPushState())){//推送状态
-			queryWrapper.like("a.push_State",syPackingListFabric.getPushState().trim());//推送状态
+			String[] pushState=syPackingListFabric.getPushState().trim().split(",");
+			queryWrapper.in("a.push_State",pushState);//推送状态
 		}
 		if(oConvertUtils.isNotEmpty(syPackingListFabric.getExportInvoiceNo())){
-			queryWrapper.like("a.export_Invoice_No",syPackingListFabric.getExportInvoiceNo().trim());//外销发票号
+			queryWrapper.nested(i->i.like("a.export_Invoice_No",syPackingListFabric.getExportInvoiceNo().trim())
+					.or().like("a.shipping_Order_Number",syPackingListFabric.getExportInvoiceNo().trim())) ;//推送中
+//			queryWrapper.like("a.export_Invoice_No",syPackingListFabric.getExportInvoiceNo().trim());//外销发票号
+//			queryWrapper.like("a.shipping_Order_Number",syPackingListFabric.getExportInvoiceNo().trim());//托书号
 		}
 		if(oConvertUtils.isNotEmpty(syPackingListFabric.getStatus())){
 			queryWrapper.like("a.status",syPackingListFabric.getStatus().trim());//外销发票号
@@ -1035,7 +1039,8 @@ public class SyPackingListFabricController implements Job {
 					 queryWrapper.like("a.order_number",syPackingListFabric.getOrderNumber().trim());//订单号
 				 }
 				 if(oConvertUtils.isNotEmpty(syPackingListFabric.getPushState())){//推送状态
-					 queryWrapper.like("a.push_State",syPackingListFabric.getPushState().trim());//推送状态
+					 String[] pushState=syPackingListFabric.getPushState().trim().split(",");
+					 queryWrapper.in("a.push_State",pushState);//推送状态
 				 }
 				 if(oConvertUtils.isNotEmpty(syPackingListFabric.getContainerNumber())){
 					 queryWrapper.like("a.container_Number",syPackingListFabric.getContainerNumber().trim());//集装箱号
@@ -1274,7 +1279,7 @@ public class SyPackingListFabricController implements Job {
 				 .like("recording_Error","超时").or().eq("recording_Error","null")
 				 .or().eq("recording_Error","nullnull")
 				 .or().like("recording_Error","For input string:")
-				 .or().eq("recording_Error","nullnullnull").or().like("recording_Error","未能捕获到的错误"))) ;//推送中
+				 .or().eq("recording_Error","nullnullnull").or().like("recording_Error","未能捕获到的错误").or().like("recording_Error","重复"))) ;//推送中
 		 //queryWrapper.or();
 		 //queryWrapper.like();//超时
 	 	 List<SyPackingListFabric> syPackingListFabrics=syPackingListFabricService.list(queryWrapper);//修改调整

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

@@ -956,8 +956,9 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 					item.setSyOrderDataItemId(syShippingDetailsItem.getSyOrderDataItemId());//销售订单主表id
 					item.setSyOrderDataId(syShippingDetailsItem.getSyOrderDataId());//销售订单子表id
 					item.setGroupId(oConvertUtils.getId());
-					SyOrderDataItem dataItem=syOrderDataItemMapper.selectById(syShippingDetailsItem.getSyOrderDataItemId());
-					item.setMasterMetering(dataItem.getMasterMetering());//计量单位
+//					SyOrderDataItem dataItem=syOrderDataItemMapper.selectById(syShippingDetailsItem.getSyOrderDataItemId());
+//					item.setMasterMetering(dataItem.getMasterMetering());//计量单位
+					item.setMasterMetering(getMasterMetering(syShippingDetailsItem.getSyOrderDataItemId()));//计量单位
 					//item.setMasterMetering(getMasterMetering(item.getSyOrderDataItemId()));
 					item.setPurOrSubOrder(syShippingDetailsItem.getPurOrSubOrder());//委外采购订单
 					item.setManualYarnUnitPrice(syShippingDetailsItem.getManualYarnUnitPrice());//手册纱单价
@@ -1203,6 +1204,8 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 		JSONArray mapList6=new JSONArray();
 		JSONArray mapList7=new JSONArray();//印厂给染厂做的出库
 
+		String orderNumber=main.getShippingOrderNumber().substring(0,main.getShippingOrderNumber().indexOf("-"));
+
 		JSONArray mapLists=new JSONArray();
 		//账套号
 		String pushsno001=org.jeecg.modules.system.util.oConvertUtils.addOne(redisUtil.get("pushsno001").toString());
@@ -1230,7 +1233,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 			String createDate=main.getTheFinalShippingDate().substring(0,10);//转化日期类型
 			JSONObject map=new JSONObject();//采购(委外)入库单
 			//map.put("CVOUCHCODE", org.jeecg.modules.system.util.oConvertUtils.addOne(purchaseWarehousingMapper.getMaxCode("cCode","RdRecord01","dnmaketime")));//获取单据号
-			map.put("CVOUCHCODE",pushsno001);//获取单据号
+			map.put("CVOUCHCODE",pushsno001.replaceAll("DZ",orderNumber));//获取单据号
 			//map.put("CVOUCHCODE", main.getId());//获取单据号
 			map.put("DDATE", date2);//日期(格式2015-01-01)
 			map.put("CMAKER",createBy);//制单人
@@ -1241,7 +1244,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 
 			JSONObject map5=new JSONObject();//采购发票
 			//map5.put("CVOUCHCODE",org.jeecg.modules.system.util.oConvertUtils.addOne(purchaseWarehousingMapper.getMaxCode("cpbvcode ","PurBillVouch","cmaketime")));//发票号
-			map5.put("CVOUCHCODE",pushsno002);//发票号
+			map5.put("CVOUCHCODE",pushsno002.replaceAll("DZ",orderNumber));//发票号
 			map5.put("DDATE",date2);//发票日期(格式2015-01-01)
 			map5.put("CTYPE","专用");//发票类型(01:专用 02:普票)
 			map5.put("CMAKER",createBy);//制单人
@@ -1251,7 +1254,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 
 			JSONObject map3=new JSONObject();//销售发货单
 			//map3.put("CVOUCHCODE",org.jeecg.modules.system.util.oConvertUtils.addOne(purchaseWarehousingMapper.getMaxCode("cDLCode","DispatchList","dcreatesystime")));//发货单号
-			map3.put("CVOUCHCODE",pushsno003);//发货单号
+			map3.put("CVOUCHCODE",pushsno003.replaceAll("DZ",orderNumber));//发货单号
 			map3.put("DDATE",date2);//发货日期(yyyy-MM-dd)
 			map3.put("BRETURNFLAG","0");//退货标识(1:退货,0:发货)
 			map3.put("CMAKER",createBy);//制单人名称
@@ -1260,7 +1263,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 
 			JSONObject map4=new JSONObject();//销售出库单
 			//map4.put("CVOUCHCODE",org.jeecg.modules.system.util.oConvertUtils.addOne(purchaseWarehousingMapper.getMaxCode("ccode","rdrecord32","dnmaketime")));//单据号
-			map4.put("CVOUCHCODE",pushsno004);//单据号
+			map4.put("CVOUCHCODE",pushsno004.replaceAll("DZ",orderNumber));//单据号
 			map4.put("DDATE",date2);//订单日期(格式2015-01-01)
 			map4.put("CHANDLER",createBy);//审核人
 			map4.put("CRDCODE","26");//出库类别
@@ -1270,7 +1273,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 
 			JSONObject map6=new JSONObject();//销售发票
 			//map6.put("CVOUCHCODE",org.jeecg.modules.system.util.oConvertUtils.addOne(purchaseWarehousingMapper.getMaxCode("cSBVCode","SaleBillVouch where cvouchtype=27","cSBVCode")));//发票号
-			map6.put("CVOUCHCODE",pushsno005);//发票号
+			map6.put("CVOUCHCODE",pushsno005.replaceAll("DZ",orderNumber));//发票号
 			map6.put("DDATE",date2);//发票日期(yyyy-MM-dd)
 			map6.put("CTYPE","普通");//发票类型(普通,专用)
 			map6.put("CMAKER",createBy);//制单人名称
@@ -1280,7 +1283,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 
 			JSONObject map2=new JSONObject();//材料出库单
 			//map2.put("CVOUCHCODE",org.jeecg.modules.system.util.oConvertUtils.addOne(purchaseWarehousingMapper.getMaxCode("cCode","rdrecord11","dnmaketime")));//单号
-			map2.put("CVOUCHCODE",pushsno006);//单号
+			map2.put("CVOUCHCODE",pushsno006.replaceAll("DZ",orderNumber));//单号
 			map2.put("DDATE",date2);//日期(格式2015-01-01)
 			//map2.put("CHANDLER",createBy);//审核人
 			map2.put("CGLTYPE","委外订单");//出库类别
@@ -1290,7 +1293,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 
 			JSONObject map7=new JSONObject();//采购(委外)入库单
 			//map7.put("CVOUCHCODE", org.jeecg.modules.system.util.oConvertUtils.addOne(org.jeecg.modules.system.util.oConvertUtils.addOne(purchaseWarehousingMapper.getMaxCode("cCode","RdRecord01","dnmaketime"))));//获取单据号
-			map7.put("CVOUCHCODE",pushsno007 );//获取单据号
+			map7.put("CVOUCHCODE",pushsno007.replaceAll("DZ",orderNumber) );//获取单据号
 			map7.put("DDATE",date2);//日期(格式2015-01-01)
 			map7.put("CMAKER",createBy);//制单人
 			map7.put("cVouchType",1);//传1
@@ -2344,7 +2347,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 							"b.AutoID as u8id ,\n" +
 							"b.id as u8pid,\n" +
 							"b.id as syPackingListFabricId,\n" +
-							"left(b.csocode,ISNULL(NULLIF(CHARINDEX('-',b.csocode)-1,-1),len(b.csocode))) as planLotNumber,\n" +
+							"left(b.iordercode,ISNULL(NULLIF(CHARINDEX('-',b.iordercode)-1,-1),len(b.iordercode))) as planLotNumber,\n" +
 							"b.csocode as orderNumber,\n" +
 							"b.cBatch as dyelotNumber ,"+
 							account + " as account,\n" +
@@ -2645,11 +2648,14 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 			List<Map<String,Object>> invoices=getInvoices(customers.get(customer));
 			JSONObject  jsonObject1=new JSONObject();
 
+
+			String orderNumber=listFabrics.get(0).getShippingOrderNumber().substring(0,syPackingListFabric.getShippingOrderNumber().indexOf("-"));
 			Map<String,Object> order=syPackingListTailoringMapper.getSoMainCode(syPackingListFabric.getRdrecord32Code());//随便哪一个做主表信息
 			code=org.jeecg.modules.system.util.oConvertUtils.addOne(code);
+			code=orderNumber+code.substring(code.indexOf("0"));
 			redisUtil.set("pushsno005", code);//采购委外入库单
 			codeMaps.put(code,listFabricMaps.get(customer));
-			jsonObject1.put("CVOUCHCODE",code);//发票号
+			jsonObject1.put("CVOUCHCODE",code.replaceAll("DZ",orderNumber));//发票号
 			jsonObject1.put("CMAKER","进出口平台管理员");//制单人
 			jsonObject1.put("CVERIFIER","进出口平台管理员");//审核人
 			jsonObject1.put("CACCID","103");//账套号

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

@@ -144,7 +144,8 @@ public class SyPackingListTailoringController implements Job {
 			queryWrapper.like("a.item_number",syPackingListTailoringVo.getItemNumber().trim());//款号
 		}
 		if(oConvertUtils.isNotEmpty(syPackingListTailoringVo.getPushState())){//推送状态
-			queryWrapper.like("a.push_State",syPackingListTailoringVo.getPushState().trim());//推送状态
+			String[] pushState=syPackingListTailoringVo.getPushState().trim().split(",");
+			queryWrapper.in("a.push_State",pushState);//推送状态
 		}
 		if(oConvertUtils.isNotEmpty(syPackingListTailoringVo.getDistributionPoint())){
 			queryWrapper.like("b.distribution_point",syPackingListTailoringVo.getDistributionPoint().trim());//分销点
@@ -597,7 +598,8 @@ public class SyPackingListTailoringController implements Job {
 				 queryWrapper.like("b.garment_Factory",syPackingListTailoringVo.getGarmentFactory().trim());//查询成衣工厂
 			 }
 			 if(oConvertUtils.isNotEmpty(syPackingListTailoringVo.getPushState())){//推送状态
-				 queryWrapper.like("a.push_State",syPackingListTailoringVo.getPushState().trim());//推送状态
+				 String[] pushState=syPackingListTailoringVo.getPushState().trim().split(",");
+				 queryWrapper.in("a.push_State",pushState);//推送状态
 			 }
 			 //款号	分销点	小po	预托书号
 			 if(oConvertUtils.isNotEmpty(syPackingListTailoringVo.getItemNumber())){
@@ -805,7 +807,8 @@ public class SyPackingListTailoringController implements Job {
 			 queryWrapper.like("b.garment_Factory",syPackingListTailoringVo.getGarmentFactory().trim());//查询成衣工厂
 		 }
 		 if(oConvertUtils.isNotEmpty(syPackingListTailoringVo.getPushState())){//推送状态
-			 queryWrapper.like("a.push_State",syPackingListTailoringVo.getPushState().trim());//推送状态
+			 String[] pushState=syPackingListTailoringVo.getPushState().trim().split(",");
+			 queryWrapper.in("a.push_State",pushState);//推送状态
 		 }
 		 //款号	分销点	小po	预托书号
 		 if(oConvertUtils.isNotEmpty(syPackingListTailoringVo.getItemNumber())){
@@ -1376,7 +1379,7 @@ public class SyPackingListTailoringController implements Job {
 				 .like("recording_Error","超时").or().eq("recording_Error","null")
 				 .or().eq("recording_Error","nullnull")
 				 .or().like("recording_Error","For input string:")
-				 .or().eq("recording_Error","nullnullnull").or().like("recording_Error","未能捕获到的错误"))) ;//推送中
+				 .or().eq("recording_Error","nullnullnull").or().like("recording_Error","未能捕获到的错误").or().like("recording_Error","重复"))) ;//推送中
 		/*queryWrapper.eq("push_State","3");//推送中
 		 queryWrapper.or();
 		 queryWrapper.like("recording_Error","超时");//超时*/

+ 1 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/entity/PushJob.java

@@ -107,6 +107,7 @@ public class PushJob implements Job {
         return codeMaps;//账套号-序号-生成的单号
     }
 
+
 //    public static void main(String[] args) throws IOException {
 //        try {
 //            String code="dz000001";

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

@@ -80,7 +80,7 @@ public interface SyPackingListTailoringMapper extends BaseMapper<SyPackingListTa
     public String getUnit(String cinvCode);
 
     //获取目标行号   参数当前数据库,目标数据库,销售订单号,目标账套号,行号
-    public String getIvouchrowno(@Param("params1") String params1,@Param("params2") String params2,@Param("params3") String params3
+    public Map<String,Object>  getIvouchrowno(@Param("params1") String params1,@Param("params2") String params2,@Param("params3") String params3
             ,@Param("params4") String params4,@Param("params5") String params5);
 
     //获取目标行号   参数当前数据库,目标数据库,销售订单号,目标账套号,行号

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

@@ -301,8 +301,8 @@
         WHERE a.ompo_Id_Item!=b.ompo_Id_Item
     </select>
 
-    <select id="getIvouchrowno"   resultType="java.lang.String">
-        SELECT popos.iorderdid FROM
+    <select id="getIvouchrowno"   resultType="java.util.HashMap">
+        SELECT popos.iorderdid iorderdid,popos.ivouchrowno ivouchrowno FROM
         so_sodetails soso
         LEFT JOIN UFDATA_103_2021.dbo.HY_DZ_K7_SYNERGISMLOGDID hy
         ON voucherno = soso.cSOCode

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

@@ -1143,13 +1143,16 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 				}
 			}
 
+
+			String orderNumber=main.getShippingOrderNumber().substring(0,main.getShippingOrderNumber().indexOf("-"));
+
 			Map<String,String> mapSort=new HashMap<>();
 			String createBy="进出口平台管理员";
 			//String createDate=main.getCreateTime().toString();
 			String createDate=main.getTheFinalShippingDate().substring(0,10);//转化日期类型
 			String date2 = main.getTheFinalShippingDate().substring(0,10);//装柜日期
 			JSONObject map=new JSONObject();//采购(委外)入库单
-			map.put("CVOUCHCODE", pushsno001);//获取单据号
+			map.put("CVOUCHCODE", pushsno001.replaceAll("DZ",orderNumber));//获取单据号
 			//map.put("CVOUCHCODE", main.getId());//获取单据号
 			map.put("DDATE",date2);//日期(格式2015-01-01)
 			//map.put("CMEMO",main.getMemo());//备注
@@ -1158,7 +1161,7 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 			map.put("cVouchType",1);//传1
 
 			JSONObject map3=new JSONObject();//销售发货单
-			map3.put("CVOUCHCODE",pushsno003);//发货单号
+			map3.put("CVOUCHCODE",pushsno003.replaceAll("DZ",orderNumber));//发货单号
 			map3.put("DDATE",date2);//发货日期(yyyy-MM-dd)
 			map3.put("BRETURNFLAG","0");//退货标识(1:退货,0:发货)
 			map3.put("CMAKER",createBy);//制单人名称
@@ -1166,7 +1169,7 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 			//map3.put("CMEMO",main.getMemo());//备注
 
 			JSONObject map4=new JSONObject();//销售出库单
-			map4.put("CVOUCHCODE",pushsno004);//单据号
+			map4.put("CVOUCHCODE",pushsno004.replaceAll("DZ",orderNumber));//单据号
 			map4.put("DDATE",date2);//订单日期(格式2015-01-01)
 			map4.put("CHANDLER",createBy);//审核人
 			map4.put("CRDCODE","26");//出库类别
@@ -1174,7 +1177,7 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 			//map4.put("CMEMO",main.getMemo());//备注
 
 			JSONObject map5=new JSONObject();//采购发票
-			map5.put("CVOUCHCODE",pushsno002);//发票号
+			map5.put("CVOUCHCODE",pushsno002.replaceAll("DZ",orderNumber));//发票号
 			map5.put("DDATE",date2);//发票日期(格式2015-01-01)
 			map5.put("CTYPE","专用");//发票类型(01:专用 02:普票)
 			map5.put("CMAKER",createBy);//制单人
@@ -1183,7 +1186,7 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 
 
 			JSONObject map6=new JSONObject();//销售发票
-			map6.put("CVOUCHCODE",pushsno005);//发票号
+			map6.put("CVOUCHCODE",pushsno005.replaceAll("DZ",orderNumber));//发票号
 			map6.put("DDATE",date2);//发票日期(yyyy-MM-dd)
 			map6.put("CTYPE","普通");//发票类型(普通,专用)
 			map6.put("CMAKER",createBy);//制单人名称
@@ -1315,8 +1318,9 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 						orderDataItem=syPackingListTailoringMapper.getOmOrPoItem2("PO_PoDetails", "ID='"+item.getOmpoIdItem()+"'","ID");
 					}else{
 						if(orderData!=null&&orderData.containsKey("id")){
+							Map<String,String> maps=(Map<String,String>)mapt.get("itemSort");
 							orderDataItem=syPackingListTailoringMapper.getOmOrPoItem2("PO_PoDetails", "poid='"+orderData.get("id")+"' and iorderdid ='"+
-							((Map<String,String>)mapt.get("itemSort")).get(item.getId())+"'","ID");//根据行号获取信息
+  							maps.get(item.getId())+"' and ivouchrowno='"+maps.get(item.getId()+"2")+"'","ID");//根据行号获取信息 ivouchrowno
 						}
 					}
 					if(orderDataItem!=null){
@@ -1490,10 +1494,11 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 					//String params1="UFDATA_103_2021";//当前数据库
 					String params3= (String) map.get("cOrderCode");//销售订单号
 					String params5=mapSort.get(item.getId());//当前数据库行号
-					String ivouchrowno =syPackingListTailoringMapper.getIvouchrowno(params1,params2,params3,params4,params5);
+					Map<String,Object> ivouchrownos =syPackingListTailoringMapper.getIvouchrowno(params1,params2,params3,params4,params5);
 					//orderIrowno.setIrowno(ivouchrowno);//获取行号
-					System.out.println("销售订单子表的行号\t"+ivouchrowno);
-					mapSort.put(item.getId(),ivouchrowno);
+					System.out.println("销售订单子表的行号\t"+ivouchrownos);
+					mapSort.put(item.getId(),ivouchrownos.get("iorderdid").toString());
+					mapSort.put(item.getId()+"2",ivouchrownos.get("ivouchrowno").toString());
 				}
 
 				//测试新区域
@@ -2008,7 +2013,8 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 
 	@DS("multi-three")
 	public String getIvouchrowno(String params1, String params2, String params3, String params4, String params5) {
-		return syPackingListTailoringMapper.getIvouchrowno(params1,params2,params3,params4,params5);
+//		return syPackingListTailoringMapper.getIvouchrowno(params1,params2,params3,params4,params5);
+		return "";
 	}
 
 	/**
@@ -2026,6 +2032,7 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 			return "无可推送数据!";
 		}
 		String account=maps.get("account").toString();
+
 		//Map<String,List<String>> customers=getSuppliers(codes,listTailorings);//key:供应商编码,value:出库单id
 		Map<String,List<String>> customers=getSuppliers(listTailorings);//key:供应商编码,value:出库单单据号
 		System.out.println(account+"采购customers\t"+customers);
@@ -2059,6 +2066,7 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 			}
 			System.out.println("orderData\t"+orderData);
 
+			String orderNumber=listTailorings.get(0).getShippingOrderNumber().substring(0,syPackingListTailoring.getShippingOrderNumber().indexOf("-"));
 			//List<SyPackingListFabricItem> listFabricItems=syPackingListFabric.getSyPackingListFabricItem();//需要进行分组
 			List<SyPackingListTailoringItem> listTailoringItems=listTailoringItemMaps.get(customer);
 			//System.out.println("codes.size\t"+codes.size());
@@ -2066,6 +2074,7 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 			List<Map<String,Object>> invoices=getInvoices1(customers.get(customer));
 			JSONObject  jsonObject1=new JSONObject();
 			code=org.jeecg.modules.system.util.oConvertUtils.addOne(code);
+			code=orderNumber+code.substring(code.indexOf("0"));
 			redisUtil.set("pushsno002", code);//采购委外发票单
 			codeMaps.put(code,listTailoringMaps.get(customer));
 //			String istc=syPackingListTailoring.getIsTc();
@@ -2260,6 +2269,8 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 			//jsonObject1.put("CMEMO",syPackingListTailoring.getMemo());//备注
 
 			code=org.jeecg.modules.system.util.oConvertUtils.addOne(code);
+			String orderNumber=listTailorings.get(0).getShippingOrderNumber().substring(0,syPackingListTailoring.getShippingOrderNumber().indexOf("-"));
+			code=orderNumber+code.substring(code.indexOf("0"));
 			redisUtil.set("pushsno005", code);//采购委外入库单
 			codeMaps.put(code,listTailoringMaps.get(customer));
 			jsonObject1.put("CVOUCHCODE",code);//发票号