| 
					
				 | 
			
			
				@@ -48,8 +48,8 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		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 om.cCode like CONCAT(#{code},'%') 	and omi.cInvCcode like '19%' and om.iVerifyStateNew = 2 and (om.cCloser is null or om.cCloser='asuser') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		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.cInvCode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		) vim on vim.cInvCode = vif.cInvCode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		where trim(vif.cCode) like CONCAT(#{code},'%') 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -65,7 +65,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		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') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		WHERE om.cVerifier is not null and (om.cCloser is null or om.cCloser!='asuser') and omi.cInvCcode like '19%' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		and om.cPOID like CONCAT(#{code},'%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		GROUP BY i.cInvCode 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -77,7 +77,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		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.cCloser is null or om.cCloser='asuser') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		WHERE om.cVerifier is not null and (om.cCloser is null or om.cCloser!='asuser') and omi.cInvCcode like '19%' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		and om.cCode like CONCAT(#{code},'%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		GROUP BY i.cInvCode 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -91,7 +91,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		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') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		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.cInvCode 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -125,8 +125,8 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		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 om.cCode like CONCAT(#{code},'%') and om.iVerifyStateNew = 2 and (om.cCloser is null or om.cCloser='asuser') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		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.cInvCode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		) vim on vim.cInvCode = vif.cInvCode 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -143,7 +143,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		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') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		WHERE om.cVerifier is not null and (om.cCloser is null or om.cCloser!='asuser') and omi.cInvCcode like '19%' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		and om.cPOID like CONCAT(#{code},'%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		GROUP BY i.cInvCode 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -155,7 +155,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		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.cCloser is null or om.cCloser='asuser') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		WHERE om.cVerifier is not null and (om.cCloser is null or om.cCloser!='asuser') and omi.cInvCcode like '19%' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		and om.cCode like CONCAT(#{code},'%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		GROUP BY i.cInvCode 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -169,7 +169,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		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') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		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.cInvCode 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -182,6 +182,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 <!--	面料转入数量链接方法--> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	<select id="queryTransferByFabric" resultType="org.jeecg.modules.cost.entity.SyTransfer"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		select 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		tab2.cinvName as goodsName,tab2.cFree1 as color,tab2.cBatch as planCode, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		case when tab2.jian-isnull(tab1.purchaseQuantity,0) <![CDATA[<=]]> 0 then 0 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -190,30 +191,40 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		select i.cInvName,sum(rs.iQuantity) as purchaseQuantity,rs.cBatch,rs.cFree1 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 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		where cPOID in ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		select distinct 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 omi.cInvCcode like '19%' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		and om.cPOID like CONCAT(#{code},'%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		GROUP BY i.cInvName,rs.cBatch,rs.cFree1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		union all 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		select i.cInvName,sum(rs.iQuantity) as purchaseQuantity,rs.cBatch,rs.cFree1 from UFDATA_101_2021.dbo.rdrecords01 rs 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		join UFDATA_101_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		where cPOID 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 '03%' or i.cInvCcode like '04%' or i.cInvCcode like '02%') and (i.cInvCCode != '0399' or i.cInvName like '%带%') and (i.cInvCCode != '0499' or i.cInvName like '%带%') and (i.cInvCCode != '0299' or i.cInvName like '%带%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		WHERE om.cVerifier is not null and (om.cCloser is null or om.cCloser!='asuser') and omi.cInvCcode like '19%' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		and om.cCode like CONCAT(#{code},'%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		GROUP BY i.cInvName,rs.cBatch,rs.cFree1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		)tab1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		right join 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		select i.cInvName,sum(rs.iQuantity) as jian,rs.cBatch,rs.cFree1 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 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		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') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		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' or i.cInvName like '%带%') and (i.cInvCCode != '0499' or i.cInvName like '%带%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		and (i.cInvCCode != '0299' or i.cInvName like '%带%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		GROUP BY i.cInvName,rs.cBatch,rs.cFree1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		)tab2 on tab2.cInvName=tab1.cInvName and tab2.cBatch=tab1.cBatch and tab1.cfree1=tab2.cfree1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		where tab2.jian-isnull(tab1.purchaseQuantity,0) > 0 and tab2.cinvName = #{goodName} 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -226,35 +237,47 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		else tab2.jian-isnull(tab1.purchaseQuantity,0) end as number 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		from 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		select i.cInvName,sum(rs.iQuantity) as purchaseQuantity,rs.cBatch,rs.cFree1 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 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		where cPOID in ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		select distinct 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 omi.cInvCcode like '19%' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		and om.cPOID like CONCAT(#{code},'%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		GROUP BY i.cInvName,rs.cBatch,rs.cFree1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		union all 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		select i.cInvName,sum(rs.iQuantity) as purchaseQuantity,rs.cBatch,rs.cFree1 from UFDATA_103_2021.dbo.rdrecords01 rs 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		join UFDATA_103_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		where cPOID 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 '03%' or i.cInvCcode like '04%' or i.cInvCcode like '02%') and (i.cInvCCode != '0399' or i.cInvName like '%带%') and (i.cInvCCode != '0499' or i.cInvName like '%带%') and (i.cInvCCode != '0299' or i.cInvName like '%带%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		WHERE om.cVerifier is not null and (om.cCloser is null or om.cCloser!='asuser') and omi.cInvCcode like '19%' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		and om.cCode like CONCAT(#{code},'%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		GROUP BY i.cInvName,rs.cBatch,rs.cFree1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		)tab1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		right join 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		select i.cInvName,sum(rs.iQuantity) as jian,rs.cBatch,rs.cFree1 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 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		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') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		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' or i.cInvName like '%带%') and (i.cInvCCode != '0499' or i.cInvName like '%带%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		and (i.cInvCCode != '0299' or i.cInvName like '%带%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		GROUP BY i.cInvName,rs.cBatch,rs.cFree1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		)tab2 on tab2.cInvName=tab1.cInvName and tab2.cBatch=tab1.cBatch and tab1.cfree1=tab2.cfree1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		where tab2.jian-isnull(tab1.purchaseQuantity,0) > 0 and tab2.cinvName = #{goodName} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -266,7 +289,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	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} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	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 oti.cInvName,ot.cFree1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -278,7 +301,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	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} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	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 oti.cInvName,ot.cFree1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	</select> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -297,7 +320,7 @@ select 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		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} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		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} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		GROUP BY ot.cFree1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		) tab 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		left join 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -309,7 +332,7 @@ select 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			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') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		WHERE om.cVerifier is not null and (om.cCloser is null or om.cCloser!='asuser') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 and om.cPOID like CONCAT(#{code},'%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		)  and i.cInvName = #{goodName} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 and rs.cBatch like CONCAT(#{code},'%') 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -331,7 +354,7 @@ select 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		join UFDATA_103_2021.dbo.OM_MOMaterials ot on ot.MoDetailsID=od.MODetailsID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		join UFDATA_103_2021.dbo.Inventory oti on oti.cInvCode=ot.cInvCode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		join UFDATA_103_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		WHERE om.iVerifyStateNew = 2 and (om.cCloser is null or om.cCloser='asuser') and omi.cInvCcode like '19%' and om.cCode like CONCAT(#{code},'%') and oti.cInvName = #{goodName} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		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} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		GROUP BY ot.cFree1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		) tab 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		left join 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -343,7 +366,7 @@ select 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			from UFDATA_101_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') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		WHERE om.cVerifier is not null and (om.cCloser is null or om.cCloser!='asuser') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 and om.cPOID like CONCAT(#{code},'%') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		)  and i.cInvName = #{goodName} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		 and rs.cBatch like CONCAT(#{code},'%') 
			 |