| 
					
				 | 
			
			
				@@ -234,4 +234,73 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	and (oti.cInvCcode like '03%' or oti.cInvCcode like '04%') and oti.cInvCCode != '0399' and oti.cInvCCode != '0499' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	GROUP BY oti.cInvName,ot.cFree1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	</select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	<select id="querypilosityFewer" parameterType="java.lang.String" resultType="org.jeecg.modules.cost.entity.SyCostAllocationFabric"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+select 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		tab.planQuantity as planQuantity,tab.color, tab.goodsName,isnull(tab1.purchaseQuantity,0) as purchaseQuantity,(isnull(tab1.purchaseQuantity,0) - tab.planQuantity) as pilosityFewer 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		from 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		select ot.cFree1 as color,max(oti.cInvName) as goodsName,sum(ot.iQuantity) as planQuantity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		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.cInvName = #{goodName} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		and (oti.cInvCcode like '03%' or oti.cInvCcode like '04%') and oti.cInvCCode != '0399' and oti.cInvCCode != '0499' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		GROUP BY ot.cFree1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		) tab 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		left join 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	 ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		select rs.cFree1 as color,max(i.cInvName) as cInvName,sum(rs.iQuantity) as purchaseQuantity,max(rs.cBatch) as cBatch from UFDATA_101_2021.dbo.rdrecords01 rs 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		join UFDATA_101_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		where iordercode in ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		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%') and i.cInvCCode != '0399' and i.cInvCCode != '0499' and i.cInvCCode != '0299' and i.cInvName = #{goodName} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 and rs.cBatch like CONCAT(#{code},'%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		GROUP BY rs.cFree1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		)tab1 on tab1.cInvName=tab.goodsName 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		union all 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		select 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		tab.planQuantity as planQuantity,tab.color, tab.goodsName,isnull(tab1.purchaseQuantity,0) as purchaseQuantity,(isnull(tab1.purchaseQuantity,0) - tab.planQuantity) as pilosityFewer 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		from 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		select ot.cFree1 as color,max(oti.cInvName) as goodsName,sum(ot.iQuantity) as planQuantity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		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.cInvName = #{goodName} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		and (oti.cInvCcode like '03%' or oti.cInvCcode like '04%') and oti.cInvCCode != '0399' and oti.cInvCCode != '0499' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		GROUP BY ot.cFree1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		) tab 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		left join 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	 ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		select rs.cFree1 as color,max(i.cInvName) as cInvName,sum(rs.iQuantity) as purchaseQuantity,max(rs.cBatch) as cBatch from UFDATA_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%') and i.cInvCCode != '0399' and i.cInvCCode != '0499' and i.cInvCCode != '0299' and i.cInvName = #{goodName} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		 and rs.cBatch like CONCAT(#{code},'%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		GROUP BY rs.cFree1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		)tab1 on tab1.cInvName=tab.goodsName 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	</select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 </mapper> 
			 |