| 
					
				 | 
			
			
				@@ -45,21 +45,22 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		left join 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		( select tab2.cinvName,sum(tab1.purchaseQuantity) as purchaseQuantity,sum(tab2.jian) as jian from 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		select i.cInvName,sum(rs.iQuantity) as purchaseQuantity,rs.cBatch from UFDATA_101_2021.dbo.rdrecords01 rs 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		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.om_momain om 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		join UFDATA_101_2021.dbo.OM_MODetails od on om.moid=od.moid 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			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.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%') and i.cInvCCode != '0399' and i.cInvCCode != '0499' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		GROUP BY i.cInvName,rs.cBatch 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		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 rs.cBatch like CONCAT(#{code},'%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		GROUP BY i.cInvName 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		)tab1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		right join 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		select i.cInvName,sum(rs.iQuantity) as jian,rs.cBatch from UFDATA_101_2021.dbo.rdrecords11 rs 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		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 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -68,8 +69,9 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		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%') and i.cInvCCode != '0399' and i.cInvCCode != '0499' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		GROUP BY i.cInvName,rs.cBatch 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		) and (i.cInvCcode like '03%' or i.cInvCcode like '04%') 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 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -104,21 +106,21 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		left join 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		( select tab2.cinvName,sum(tab1.purchaseQuantity) as purchaseQuantity,sum(tab2.jian) as jian from 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		select i.cInvName,sum(rs.iQuantity) as purchaseQuantity,rs.cBatch from UFDATA_103_2021.dbo.rdrecords01 rs 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		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.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%') and i.cInvCCode != '0399' and i.cInvCCode != '0499' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		GROUP BY i.cInvName,rs.cBatch 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		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 rs.cBatch like CONCAT(#{code},'%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		GROUP BY i.cInvName 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		)tab1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		right join 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		select i.cInvName,sum(rs.iQuantity) as jian,rs.cBatch from UFDATA_103_2021.dbo.rdrecords11 rs 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		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 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -127,13 +129,16 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		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%') and i.cInvCCode != '0399' and i.cInvCCode != '0499' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		GROUP BY i.cInvName,rs.cBatch 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		) and (i.cInvCcode like '03%' or i.cInvCcode like '04%') 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 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	</select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+<!--	面料转入数量链接方法--> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	<select id="queryTransferByFabric" resultType="org.jeecg.modules.cost.entity.SyTransfer"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		select 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		tab2.cinvName as goodsName,tab2.cFree1 as color,tab2.cBatch as planCode, 
			 |