zengtx vor 1 Jahr
Ursprung
Commit
8c24088fee

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

@@ -91,6 +91,9 @@ public class SyCostAllocation implements Serializable {
     /**人民币费用支出*/
     @ApiModelProperty(value = "人民币费用支出")
     private java.math.BigDecimal rmbExpense;
+    /**人民币费用支出*/
+    @ApiModelProperty(value = "人民币费用支出不含税")
+    private java.math.BigDecimal rmbNorTaxExpense;
     /**税率*/
     @ApiModelProperty(value = "税率")
     private java.math.BigDecimal taxrate;

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

@@ -24,7 +24,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
 	</select>
 	<!--	通过视图查询-->
 	<select id="queryByCostFabric1" parameterType="java.lang.String" resultType="org.jeecg.modules.cost.entity.SyCostAllocationFabric">
-select
+		select
 		tab.*,isnull(tab3.purchaseQuantity,0) as purchaseQuantity,
 		case when tab3.jian-isnull(tab3.purchaseQuantity,0) <![CDATA[<=]]> 0 then 0
 		else tab3.jian-isnull(tab3.purchaseQuantity,0) end as fabrictransferQuantity,
@@ -38,10 +38,10 @@ select
 		)/tab3.purchaseQuantity,0) as loss
 		from
 		(
-		select vim.goodsName as goodsName,sum(vim.unitConsumption) as unitConsumption,sum(vim.planQuantity) as planQuantity,
-		sum(vim.usageQuantity) as usageQuantity from UFDATA_103_2021.dbo.VIEW_FabricLoss_Cost_Cloth vif
+		select vim.cInvCode, max(vim.goodsName) as goodsName,sum(vim.unitConsumption) as unitConsumption,sum(vim.planQuantity) as planQuantity,
+		sum(vim.usageQuantity) as usageQuantity from UFDATA_103_2021.dbo.cost_allocation_fabric_view vif
 		join(
-		select oti.cInvName as goodsName,sum(ot.iQuantity)/sum(od.iQuantity) as unitConsumption,sum(ot.iQuantity) as planQuantity,case when oti.cInvName like '%圆带%' and max(om.cCode) like '%SYM764%' then replace(oti.cInvName,' ','') +' ' + isnull(ot.cFree1,'') else oti.cInvName +' ' + isnull(ot.cFree1,'') end as cInvName,
+		select oti.cInvCode,max(oti.cInvName) as goodsName,sum(ot.iQuantity)/sum(od.iQuantity) as unitConsumption,sum(ot.iQuantity) as planQuantity,
 		sum(ot.iSendQTY) as usageQuantity
 		from UFDATA_101_2021.dbo.om_momain om
 		join UFDATA_101_2021.dbo.OM_MODetails od on om.moid=od.moid
@@ -50,15 +50,15 @@ select
 		join UFDATA_101_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
 		WHERE om.iVerifyStateNew = 2 and (om.cCloser is null or om.cCloser='asuser')
 		and om.cCode like CONCAT(#{code},'%') 	and omi.cInvCcode like '19%' and om.iVerifyStateNew = 2 and (om.cCloser is null or om.cCloser='asuser')
-		GROUP BY oti.cInvName,ot.cFree1
-		) vim on vim.cInvName = vif.cInvName
-		where trim(vif.cSOCode) like CONCAT(#{code},'%') and vif.cSOCode not like '%样%'
-		GROUP BY vim.goodsName
+		GROUP BY oti.cInvCode
+		) vim on vim.cInvCode = vif.cInvCode
+		where trim(vif.cCode) like CONCAT(#{code},'%')
+		GROUP BY vim.cInvCode
 		) tab
 		left join
-		( select tab2.cinvName,sum(tab1.purchaseQuantity) as purchaseQuantity,sum(tab2.jian) as jian from
+		( select tab2.cinvCode,max(tab2.cinvName) as cinvName,sum(tab1.purchaseQuantity) as purchaseQuantity,sum(tab2.jian) as jian from
 		(
-		select i.cInvName,sum(rs.iQuantity) as purchaseQuantity,max(rs.cBatch) as cBatch from UFDATA_101_2021.dbo.rdrecords01 rs
+		select i.cInvCode,max(i.cInvName) as cInvName,sum(rs.iQuantity) as purchaseQuantity,max(rs.cBatch) as cBatch from UFDATA_101_2021.dbo.rdrecords01 rs
 		join UFDATA_101_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
 		where iordercode in (
 		select distinct od.csocode
@@ -68,11 +68,11 @@ select
 		WHERE om.cVerifier is not null and (om.cCloser is null or om.cCloser='asuser')
 		and om.cPOID like CONCAT(#{code},'%')
 		) and rs.cBatch like CONCAT(#{code},'%')
-		GROUP BY i.cInvName
+		GROUP BY i.cInvCode
 		)tab1
 		right join
 		(
-		select i.cInvName,sum(rs.iQuantity) as jian,max(rs.cBatch) as cBatch from UFDATA_101_2021.dbo.rdrecords11 rs
+		select i.cInvCode,max(i.cInvName) as cInvName,sum(rs.iQuantity) as jian,max(rs.cBatch) as cBatch from UFDATA_101_2021.dbo.rdrecords11 rs
 		join UFDATA_101_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
 		where iordercode in (
 		select distinct od.csocode
@@ -82,10 +82,10 @@ select
 		WHERE om.iVerifyStateNew = 2 and (om.cCloser is null or om.cCloser='asuser')
 		and omi.cInvCcode like '19%' and om.cCode like CONCAT(#{code},'%')
 		)
-		GROUP BY i.cInvName
-		)tab2 on tab2.cInvName=tab1.cInvName and tab2.cBatch=tab1.cBatch
-		GROUP BY tab2.cInvName
-		) tab3 on tab3.cInvName=tab.goodsName
+		GROUP BY i.cInvCode
+		)tab2 on tab2.cInvCode=tab1.cInvCode and tab2.cBatch=tab1.cBatch
+		GROUP BY tab2.cInvCode
+		) tab3 on tab3.cInvCode=tab.cInvCode
 
 		union all
 
@@ -103,10 +103,10 @@ select
 		)/tab3.purchaseQuantity,0) as loss
 		from
 		(
-		select vim.goodsName as goodsName,sum(vim.unitConsumption) as unitConsumption,sum(vim.planQuantity) as planQuantity,
-		sum(vim.usageQuantity) as usageQuantity from UFDATA_103_2021.dbo.VIEW_FabricLoss_Cost_Cloth vif
+		select vim.cInvCode, max(vim.goodsName) as goodsName,sum(vim.unitConsumption) as unitConsumption,sum(vim.planQuantity) as planQuantity,
+		sum(vim.usageQuantity) as usageQuantity from UFDATA_103_2021.dbo.cost_allocation_fabric_view vif
 		join(
-		select oti.cInvName as goodsName,sum(ot.iQuantity)/sum(od.iQuantity) as unitConsumption,sum(ot.iQuantity) as planQuantity,case when oti.cInvName like '%圆带%' then replace(oti.cInvName,' ','') +' ' + isnull(ot.cFree1,'') else oti.cInvName +' ' + isnull(ot.cFree1,'') end as cInvName,
+		select oti.cInvCode as cInvCode,max(oti.cInvName) as goodsName,sum(ot.iQuantity)/sum(od.iQuantity) as unitConsumption,sum(ot.iQuantity) as planQuantity,
 		sum(ot.iSendQTY) as usageQuantity
 		from UFDATA_103_2021.dbo.om_momain om
 		join UFDATA_103_2021.dbo.OM_MODetails od on om.moid=od.moid
@@ -116,15 +116,15 @@ select
 		WHERE om.iVerifyStateNew = 2 and (om.cCloser is null or om.cCloser='asuser')
 		and om.cCode like CONCAT(#{code},'%') and om.iVerifyStateNew = 2 and (om.cCloser is null or om.cCloser='asuser')
 		and omi.cInvCcode like '19%'
-		GROUP BY oti.cInvName,ot.cFree1
-		) vim on vim.cInvName = vif.cInvName
-		where trim(vif.cSOCode) like CONCAT(#{code},'%') and vif.cSOCode not like '%样%'
-		GROUP BY vim.goodsName
+		GROUP BY oti.cInvCode
+		) vim on vim.cInvCode = vif.cInvCode
+		where trim(vif.cCode) like CONCAT(#{code},'%')
+		GROUP BY vim.cInvCode
 		) tab
 		left join
-		( select tab2.cinvName,sum(tab1.purchaseQuantity) as purchaseQuantity,sum(tab2.jian) as jian from
+		( select tab2.cInvCode,max(tab2.cinvName) as cinvName,sum(tab1.purchaseQuantity) as purchaseQuantity,sum(tab2.jian) as jian from
 		(
-		select i.cInvName,sum(rs.iQuantity) as purchaseQuantity,max(rs.cBatch) as cBatch from UFDATA_103_2021.dbo.rdrecords01 rs
+		select i.cInvCode as cInvCode,max(i.cInvName) as cInvName,sum(rs.iQuantity) as purchaseQuantity,max(rs.cBatch) as cBatch from UFDATA_103_2021.dbo.rdrecords01 rs
 		join UFDATA_103_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
 		where iordercode in (
 		select distinct od.csocode
@@ -134,11 +134,11 @@ select
 		WHERE om.cVerifier is not null and (om.cCloser is null or om.cCloser='asuser')
 		and om.cPOID like CONCAT(#{code},'%')
 		) and rs.cBatch like CONCAT(#{code},'%')
-		GROUP BY i.cInvName
+		GROUP BY i.cInvCode
 		)tab1
 		right join
 		(
-		select i.cInvName,sum(rs.iQuantity) as jian,max(rs.cBatch) as cBatch from UFDATA_103_2021.dbo.rdrecords11 rs
+		select  i.cInvCode as cInvCode,max(i.cInvName) as cInvName,sum(rs.iQuantity) as jian,max(rs.cBatch) as cBatch from UFDATA_103_2021.dbo.rdrecords11 rs
 		join UFDATA_103_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
 		where iordercode in (
 		select distinct od.csocode
@@ -148,133 +148,11 @@ select
 		WHERE om.iVerifyStateNew = 2 and (om.cCloser is null or om.cCloser='asuser')
 		and omi.cInvCcode like '19%' and om.cCode like CONCAT(#{code},'%')
 		)
-		and rs.cBatch = #{code}
-		GROUP BY i.cInvName
-		)tab2 on tab2.cInvName=tab1.cInvName and tab2.cBatch=tab1.cBatch
-		GROUP BY tab2.cInvName
-		) tab3 on tab3.cInvName=tab.goodsName
-	</select>
-
-	<select id="queryByCostFabric" parameterType="java.lang.String" resultType="org.jeecg.modules.cost.entity.SyCostAllocationFabric">
-		select
-		tab.*,isnull(tab3.purchaseQuantity,0) as purchaseQuantity,
-		case when tab3.jian-isnull(tab3.purchaseQuantity,0) <![CDATA[<=]]> 0 then 0
-		else tab3.jian-isnull(tab3.purchaseQuantity,0) end as fabrictransferQuantity,
-		case when tab3.jian-isnull(tab3.purchaseQuantity,0) <![CDATA[<=]]> 0 then isnull(tab3.purchaseQuantity,0)-tab.usageQuantity
-		else (tab3.jian-isnull(tab3.purchaseQuantity,0))+isnull(tab3.purchaseQuantity,0)-tab.usageQuantity end
-		as 	fabricremainingQuantity,
-		isnull((
-		case when tab3.jian-isnull(tab3.purchaseQuantity,0) <![CDATA[<=]]> 0
-		then isnull(tab3.purchaseQuantity,0)-tab.usageQuantity
-		else (tab3.jian-isnull(tab3.purchaseQuantity,0))+isnull(tab3.purchaseQuantity,0)-tab.usageQuantity end
-		)/tab3.purchaseQuantity,0) as loss
-		from
-		(
-		select oti.cInvName as goodsName,sum(ot.iQuantity)/sum(od.iQuantity) as unitConsumption,sum(ot.iQuantity) as planQuantity,
-		sum(ot.iSendQTY) as usageQuantity
-		from UFDATA_101_2021.dbo.om_momain om
-		join UFDATA_101_2021.dbo.OM_MODetails od on om.moid=od.moid
-		join UFDATA_101_2021.dbo.OM_MOMaterials ot on ot.MoDetailsID=od.MODetailsID
-		join UFDATA_101_2021.dbo.Inventory oti on oti.cInvCode=ot.cInvCode
-		join UFDATA_101_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
-		WHERE om.iVerifyStateNew = 2 and (om.cCloser is null or om.cCloser='asuser') and omi.cInvCcode like '19%' and om.cCode LIKE CONCAT(#{code},'%')
-		and (oti.cInvCcode like '03%' or oti.cInvCcode like '04%' or oti.cInvCcode like '02%') and (oti.cInvCCode != '0399' and oti.cInvCCode != '0499'  and oti.cInvCCode != '0299')
-		GROUP BY oti.cInvName
-		) tab
-		left join
-		( select tab2.cinvName,sum(tab1.purchaseQuantity) as purchaseQuantity,sum(tab2.jian) as jian from
-		(
-		select i.cInvName,sum(rs.iQuantity) as purchaseQuantity,max(rs.cBatch) as cBatch from UFDATA_101_2021.dbo.rdrecords01 rs
-		join UFDATA_101_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
-		where iordercode in (
-		select distinct od.csocode
-			from UFDATA_101_2021.dbo.PO_POmain om
-		join UFDATA_101_2021.dbo.PO_PODetails od on om.poid=od.poid
-		join UFDATA_101_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
-		WHERE om.cVerifier is not null and (om.cCloser is null or om.cCloser='asuser')
-		 and om.cPOID like CONCAT(#{code},'%')
-		) and (i.cInvCcode like '03%' or i.cInvCcode like '04%' or i.cInvCcode like '02%') and (i.cInvCCode != '0399'  and i.cInvCCode != '0499' and i.cInvCCode != '0299' )
-		 and rs.cBatch like CONCAT(#{code},'%')
-		GROUP BY i.cInvName
-		)tab1
-		right join
-		(
-		select i.cInvName,sum(rs.iQuantity) as jian,max(rs.cBatch) as cBatch from UFDATA_101_2021.dbo.rdrecords11 rs
-		join UFDATA_101_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
-		where iordercode in (
-		select distinct od.csocode
-		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 (om.cCloser is null or om.cCloser='asuser')
-		and omi.cInvCcode like '19%' and om.cCode like CONCAT(#{code},'%')
-		) and (i.cInvCcode like '03%' or i.cInvCcode like '04%' or i.cInvCcode like '02%') and (i.cInvCCode != '0399'  and i.cInvCCode != '0499'  and i.cInvCCode != '0299')
-
-		GROUP BY i.cInvName
-		)tab2 on tab2.cInvName=tab1.cInvName and tab2.cBatch=tab1.cBatch
-		GROUP BY tab2.cInvName
-		) tab3 on tab3.cInvName=tab.goodsName
-
-		union all
-
-		select
-		tab.*,isnull(tab3.purchaseQuantity,0) as purchaseQuantity,
-		case when tab3.jian-isnull(tab3.purchaseQuantity,0) <![CDATA[<=]]> 0 then 0
-		else tab3.jian-isnull(tab3.purchaseQuantity,0) end as fabrictransferQuantity,
-		case when tab3.jian-isnull(tab3.purchaseQuantity,0) <![CDATA[<=]]> 0 then isnull(tab3.purchaseQuantity,0)-tab.usageQuantity
-		else (tab3.jian-isnull(tab3.purchaseQuantity,0))+isnull(tab3.purchaseQuantity,0)-tab.usageQuantity end
-		as 	fabricremainingQuantity,
-		isnull((
-		case when tab3.jian-isnull(tab3.purchaseQuantity,0) <![CDATA[<=]]> 0
-		then isnull(tab3.purchaseQuantity,0)-tab.usageQuantity
-		else (tab3.jian-isnull(tab3.purchaseQuantity,0))+isnull(tab3.purchaseQuantity,0)-tab.usageQuantity end
-		)/tab3.purchaseQuantity,0) as loss
-		from
-		(
-		select oti.cInvName as goodsName,sum(ot.iQuantity)/sum(od.iQuantity) as unitConsumption,sum(ot.iQuantity) as planQuantity,
-		sum(ot.iSendQTY) as usageQuantity
-		from UFDATA_103_2021.dbo.om_momain om
-		join UFDATA_103_2021.dbo.OM_MODetails od on om.moid=od.moid
-		join UFDATA_103_2021.dbo.OM_MOMaterials ot on ot.MoDetailsID=od.MODetailsID
-		join UFDATA_103_2021.dbo.Inventory oti on oti.cInvCode=ot.cInvCode
-		join UFDATA_103_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
-		WHERE om.iVerifyStateNew = 2 and (om.cCloser is null or om.cCloser='asuser') and omi.cInvCcode like '19%' and om.cCode LIKE CONCAT(#{code},'%')
-		and (oti.cInvCcode like '03%' or oti.cInvCcode like '04%' or oti.cInvCcode like '02%') and (oti.cInvCCode != '0399' and oti.cInvCCode != '0499'  and oti.cInvCCode != '0299' )
-		GROUP BY oti.cInvName
-		) tab
-		left join
-		( select tab2.cinvName,sum(tab1.purchaseQuantity) as purchaseQuantity,sum(tab2.jian) as jian from
-		(
-		select i.cInvName,sum(rs.iQuantity) as purchaseQuantity,max(rs.cBatch) as cBatch from UFDATA_103_2021.dbo.rdrecords01 rs
-		join UFDATA_103_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
-		where iordercode in (
-		select distinct od.csocode
-		from UFDATA_103_2021.dbo.PO_POmain om
-		join UFDATA_103_2021.dbo.PO_PODetails od on om.poid=od.poid
-		join UFDATA_103_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
-		WHERE om.cVerifier is not null and (om.cCloser is null or om.cCloser='asuser')
-		 and om.cPOID like CONCAT(#{code},'%')
-		) and (i.cInvCcode like '03%' or i.cInvCcode like '04%' or i.cInvCcode like '02%') and (i.cInvCCode != '0399' and i.cInvCCode != '0499'  and i.cInvCCode != '0299')
-		 and rs.cBatch like CONCAT(#{code},'%')
-		GROUP BY i.cInvName
-		)tab1
-		right join
-		(
-		select i.cInvName,sum(rs.iQuantity) as jian,max(rs.cBatch) as cBatch from UFDATA_103_2021.dbo.rdrecords11 rs
-		join UFDATA_103_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
-		where iordercode in (
-		select distinct od.csocode
-		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 (om.cCloser is null or om.cCloser='asuser')
-		and omi.cInvCcode like '19%' and om.cCode like CONCAT(#{code},'%')
-		) and (i.cInvCcode like '03%' or i.cInvCcode like '04%' or i.cInvCcode like '02%') and (i.cInvCCode != '0399'  and i.cInvCCode != '0499' and i.cInvCCode != '0299' )
-		and rs.cBatch like CONCAT(#{code},'%')
-		GROUP BY i.cInvName
-		)tab2 on tab2.cInvName=tab1.cInvName and tab2.cBatch=tab1.cBatch
-		GROUP BY tab2.cInvName
-		) tab3 on tab3.cInvName=tab.goodsName
+		and rs.cBatch = 'SYY140'
+		GROUP BY i.cInvCode
+		)tab2 on tab2.cInvCode=tab1.cInvCode and tab2.cBatch=tab1.cBatch
+		GROUP BY tab2.cInvCode
+		) tab3 on tab3.cInvCode=tab.cInvCode
 	</select>
 
 

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

@@ -29,8 +29,7 @@
 		else (isnull(tab2.jian,0)-isnull(tab1.purchaseQuantity,0))*tab.cost end as transferCost
 		from
 		(
-		select vim.cInvCode,vim.goodsName,sum(vim.dosage) as dosage,sum(vim.usageQuantity) as usageQuantity,max(vim.supper) as supper,sum(vim.rmbAmount) as rmbAmount,sum(vim.usdAmount) as usdAmount,sum(vim.priceExcludingtax) as priceExcludingtax,sum(vim.cost) as cost from UFDATA_103_2021.dbo.VIEW_FabricLoss_Cost_Assist vif
-		join (
+
 		select t4.cInvCode,t4.goodsName,max(t4.dosage) as dosage,max(t4.usageQuantity) as usageQuantity,max(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.cInvCode,t3.goodsName,t3.cVenAbbName AS supper,max( t3.dosage ) AS dosage,SUM ( t3.usageQuantity ) AS usageQuantity,
 
@@ -118,11 +117,13 @@
 		) t3
 		GROUP BY
 		t3.cInvCode,t3.goodsName,t3.cVenAbbName
-		) t4 GROUP BY t4.cInvCode,t4.goodsName
-		) vim on vim.goodsName = vif.cInvName
-		where trim(vif.cPoid) like CONCAT(#{code},'%') and vif.cPoid not like '%样%'
-		and vif.cVenAbbName not in ('宁波森语','马菲羊','森语集团') and vif.iquantityinvoice>0
-		GROUP BY vim.cInvCode,vim.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
 		(
@@ -168,9 +169,8 @@
 		else (isnull(tab2.jian,0)-isnull(tab1.purchaseQuantity,0))*tab.cost end as transferCost
 		from
 		(
-		select vim.cInvCode,vim.goodsName,sum(vim.dosage) as dosage,sum(vim.usageQuantity) as usageQuantity,max(vim.supper) as supper,sum(vim.rmbAmount) as rmbAmount,sum(vim.usdAmount) as usdAmount,sum(vim.priceExcludingtax) as priceExcludingtax,sum(vim.cost) as cost from UFDATA_103_2021.dbo.VIEW_FabricLoss_Cost_Assist vif
-		join (
-		select t4.cInvCode,t4.goodsName,max(t4.dosage) as dosage,max(t4.usageQuantity) as usageQuantity,max(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 t4.cInvCode,max(t4.goodsName) as goodsName,max(t4.dosage) as dosage,max(t4.usageQuantity) as usageQuantity,max(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.cInvCode,t3.goodsName,max(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.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
@@ -268,11 +268,13 @@
 		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.cInvCode,t3.goodsName
-		) t4 GROUP BY t4.cInvCode,t4.goodsName
-		) vim on vim.goodsName = vif.cInvName
-		where trim(vif.cPoid) like CONCAT(#{code},'%') and vif.cPoid not like '%样%'
-		and vif.cVenAbbName not in ('宁波森语','马菲羊','森语集团') and vif.iquantityinvoice>0
-		GROUP BY vim.cInvCode,vim.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
 		(
@@ -304,290 +306,6 @@
 		)tab2 on tab2.cInvName=tab.goodsName and tab1.cInvCode=tab.cInvCode
 	</select>
 
-	<select id="queryByCostIngredient" 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,max(t4.usageQuantity) as usageQuantity,max(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.cInvCode as cInvCode,t3.goodsName,t3.cVenAbbName AS supper,max( 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.cInvCode as 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.om_momain om
-		JOIN UFDATA_103_2021.dbo.OM_MODetails od ON om.moid= od.moid
-		JOIN UFDATA_103_2021.dbo.OM_MOMaterials ot ON ot.MoDetailsID= od.MODetailsID
-		JOIN UFDATA_103_2021.dbo.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 ( om.cCloser IS NULL OR om.cCloser= 'asuser' )
-		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 = '0299' OR oti.cInvCCode = '0499' )
-		GROUP BY ot.cInvCode,od.isosid,om.ccode,oti.cInvName ) AS t1
-
-		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
-		) AS t2
-		on
-		t1.cInvCode= t2.cInvCode
-		AND t2.isosid= t1.isosid
-		) t3
-		GROUP BY
-		t3.cInvCode,t3.goodsName,t3.cVenAbbName
-
-		union all
-
-
-		SELECT t3.cInvCode,t3.goodsName,max(t3.cVenAbbName) AS supper,max( 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.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,max (ot.iUnitQuantity) AS dosage,SUM (ot.iSendQTY) AS usageQuantity
-		FROM
-		UFDATA_103_2021.dbo.om_momain om
-		JOIN UFDATA_103_2021.dbo.OM_MODetails od ON om.moid= od.moid
-		JOIN UFDATA_103_2021.dbo.OM_MOMaterials ot ON ot.MoDetailsID= od.MODetailsID
-		JOIN UFDATA_103_2021.dbo.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 ( om.cCloser IS NULL OR om.cCloser= 'asuser' )
-		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 = '0299' OR oti.cInvCCode = '0499'  )
-		GROUP BY 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,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
-		GROUP BY bi.cInvCode,pod.iorderdid
-		) AS t2
-		on
-		t1.cInvCode= t2.cInvCode
-		AND t2.iorderdid= t1.isosid
-		) t3
-		GROUP BY
-		t3.cInvCode,t3.goodsName
-		) t4 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
-		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.cCloser is null or om.cCloser='asuser')
-		and om.cPOID LIKE CONCAT(#{code},'%')
-		) and (i.cInvCcode like '05%' or i.cInvCcode like '06%' or i.cInvCcode like '07%'
-		or i.cInvCCode = '0399' or i.cInvCCode = '0499'  or i.cInvCCode = '0299')
-		GROUP BY i.cInvCode,i.cInvName
-		)tab1 on tab1.cInvName=tab.goodsName and tab.cInvCode = tab1.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 (om.cCloser is null or om.cCloser='asuser')
-		and omi.cInvCcode like '19%' and om.cCode LIKE CONCAT(#{code},'%')
-		) and (i.cInvCcode like '05%' or i.cInvCcode like '06%' or i.cInvCcode like '07%'
-		or i.cInvCCode = '0399' or i.cInvCCode = '0499'  or i.cInvCCode = '0299')
-		GROUP BY i.cInvCode,i.cInvName--,rs.cBatch
-		)tab2 on tab2.cInvName=tab.goodsName and tab.cInvCode = tab2.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,t4.goodsName,max(t4.dosage) as dosage,max(t4.usageQuantity) as usageQuantity,max(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.cInvCode,t3.goodsName,max(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.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_101_2021.dbo.om_momain om
-		join UFDATA_101_2021.dbo.OM_MODetails od on om.moid=od.moid
-		join UFDATA_101_2021.dbo.OM_MOMaterials ot on ot.MoDetailsID=od.MODetailsID
-		JOIN UFDATA_101_2021.dbo.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 (om.cCloser is null or om.cCloser='asuser') 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 = '0299' or oti.cInvCCode = '0499' )
-		group by 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 t2.iorderdid=t1.isosid
-		) t3  GROUP BY t3.cInvCode,t3.goodsName
-
-		union all
-
-		select t3.cInvCode,t3.goodsName,max(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.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_101_2021.dbo.om_momain om
-		join UFDATA_101_2021.dbo.OM_MODetails od on om.moid=od.moid
-		join UFDATA_101_2021.dbo.OM_MOMaterials ot on ot.MoDetailsID=od.MODetailsID
-		JOIN UFDATA_101_2021.dbo.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 (om.cCloser is null or om.cCloser='asuser') 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 = '0299' or oti.cInvCCode = '0499' )
-		group by 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.cInvCode,t3.goodsName
-
-		union all
-		select t3.cInvCode,t3.goodsName,max(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.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_101_2021.dbo.om_momain om
-		join UFDATA_101_2021.dbo.OM_MODetails od on om.moid=od.moid
-		join UFDATA_101_2021.dbo.OM_MOMaterials ot on ot.MoDetailsID=od.MODetailsID
-		JOIN UFDATA_101_2021.dbo.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 (om.cCloser is null or om.cCloser='asuser') 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 = '0299' or oti.cInvCCode = '0499' )
-		group by 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.cInvCode,t3.goodsName
-		) t4 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
-		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.cCloser is null or om.cCloser='asuser')
-		and om.cPOID LIKE CONCAT(#{code},'%')
-		) and (i.cInvCcode like '05%' or i.cInvCcode like '06%' or i.cInvCcode like '07%'
-		or i.cInvCCode = '0399' or i.cInvCCode = '0499' or i.cInvCCode = '0299')
-		GROUP BY i.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 (om.cCloser is null or om.cCloser='asuser')
-		and omi.cInvCcode like '19%' and om.cCode LIKE CONCAT(#{code},'%')
-		) and (i.cInvCcode like '05%' or i.cInvCcode like '06%' or i.cInvCcode like '07%'
-		or i.cInvCCode = '0399' or i.cInvCCode = '0499'  or i.cInvCCode = '0299')
-		GROUP BY i.cInvCode,i.cInvName
-		)tab2 on tab2.cInvName=tab.goodsName and tab2.cInvCode = tab.cInvCode
-
-
-
-	</select>
 
 	<select id="queryTransferByIngredient" resultType="org.jeecg.modules.cost.entity.SyTransfer">
 		select tab1.cInvName as goodsName,tab1.cCode as planCode,isnull(tab2.jian,0)-isnull(tab1.purchaseQuantity,0) as number,

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

@@ -234,17 +234,7 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
         }
 
         /*查询U8数据 面料*/
-        List<SyCostAllocationFabric> list3 = null;
-        List<SyCostAllocationIngredient> list4 = null;
-
-        List<FabricOMOrder> fabricOMOrderListAll = fabricLossMapper.getOmOrderListAll(plannum);
-        if(fabricOMOrderListAll.size()==0){
-            list3 = syCostAllocationFabricMapper.queryByCostFabric(plannum);
-            list4 = syCostAllocationIngredientMapper.queryByCostIngredient(plannum);
-        }else{
-            list3 = syCostAllocationFabricMapper.queryByCostFabric1(plannum);
-            list4 = syCostAllocationIngredientMapper.queryByCostIngredient1(plannum);
-        }
+        List<SyCostAllocationFabric> list3 = syCostAllocationFabricMapper.queryByCostFabric1(plannum);
 
         for (int i=0;i<list3.size();i++) {
 
@@ -381,7 +371,7 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
 
 
         //查询U8数据 辅料
-
+        List<SyCostAllocationIngredient> list4 = syCostAllocationIngredientMapper.queryByCostIngredient1(plannum);
         for (int i=0;i<list4.size();i++) {
             SyCostAllocationIngredient Ingredient = list4.get(i);
             //若转入数量不为0则给转入数据对象赋值