|  | @@ -156,7 +156,7 @@
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	<select id="queryTransferByIngredient" resultType="org.jeecg.modules.cost.entity.SyTransfer">
 | 
	
		
			
				|  |  |  		select tab1.cInvName as goodsName,tab1.cCode as planCode,tab2.jian-isnull(tab1.purchaseQuantity,0) as number,
 | 
	
		
			
				|  |  | -				tab.cost as unitCost,(purchaseQuantity-tab2.jian)*tab.cost as cost
 | 
	
		
			
				|  |  | +				tab.cost as unitCost,(tab2.jian-isnull(tab1.purchaseQuantity,0))*tab.cost as cost
 | 
	
		
			
				|  |  |  		from
 | 
	
		
			
				|  |  |  		(
 | 
	
		
			
				|  |  |  				select oti.cInvName as goodsName,sum(pb.iCost) as cost
 | 
	
	
		
			
				|  | @@ -227,12 +227,12 @@
 | 
	
		
			
				|  |  |  						or i.cInvCCode = '0399' or i.cInvCCode = '0499')
 | 
	
		
			
				|  |  |  				GROUP BY i.cInvName,rs.cBatch
 | 
	
		
			
				|  |  |  		)tab2 on tab2.cInvName=tab1.cInvName and tab1.cBatch=tab2.cBatch
 | 
	
		
			
				|  |  | -		 where tab1.purchaseQuantity-tab2.jian>0
 | 
	
		
			
				|  |  | +		 where tab1.tab2.jian-isnull(tab1.purchaseQuantity,0)>0
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  		 union all
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  		 select tab1.cInvName as goodsName,tab1.cCode as planCode,tab2.jian-isnull(tab1.purchaseQuantity,0) as number,
 | 
	
		
			
				|  |  | -				tab.cost as unitCost,(purchaseQuantity-tab2.jian)*tab.cost as cost
 | 
	
		
			
				|  |  | +				tab.cost as unitCost,(tab2.jian-isnull(tab1.purchaseQuantity,0))*tab.cost as cost
 | 
	
		
			
				|  |  |  		from
 | 
	
		
			
				|  |  |  		(
 | 
	
		
			
				|  |  |  				select oti.cInvName as goodsName,sum(pb.iCost) as cost
 | 
	
	
		
			
				|  | @@ -285,7 +285,7 @@
 | 
	
		
			
				|  |  |  						or i.cInvCCode = '0399' or i.cInvCCode = '0499')
 | 
	
		
			
				|  |  |  				GROUP BY i.cInvName,rs.cBatch
 | 
	
		
			
				|  |  |  		)tab2 on tab2.cInvName=tab1.cInvName and tab1.cBatch=tab2.cBatch
 | 
	
		
			
				|  |  | -		 where tab1.purchaseQuantity-tab2.jian>0
 | 
	
		
			
				|  |  | +		 where tab1.tab2.jian-isnull(tab1.purchaseQuantity,0)>0
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	<select id="queryRemainingByIngredient" resultType="org.jeecg.modules.cost.entity.SyRemaining">
 |