|  | @@ -230,6 +230,25 @@
 | 
	
		
			
				|  |  |          where state!=-1) b
 | 
	
		
			
				|  |  |          on a.cvencode=b.venName
 | 
	
		
			
				|  |  |          ORDER BY yearMonth;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        select *,
 | 
	
		
			
				|  |  | +        IIF((quotaCapacity-productionCapacity)<0,0,(quotaCapacity-productionCapacity)) spareCapacity
 | 
	
		
			
				|  |  | +        from
 | 
	
		
			
				|  |  | +        (select
 | 
	
		
			
				|  |  | +        darrivedate yearMonth,
 | 
	
		
			
				|  |  | +        cvencode,
 | 
	
		
			
				|  |  | +        cast(sum(coefficient  *iquantity)/60 as decimal(20,2)) productionCapacity
 | 
	
		
			
				|  |  | +        from Supplier_Capacity_Test
 | 
	
		
			
				|  |  | +        where dArriveYear = #{year}
 | 
	
		
			
				|  |  | +        AND dArriveMonth =  #{month}
 | 
	
		
			
				|  |  | +        GROUP BY darrivedate,cvencode) a
 | 
	
		
			
				|  |  | +        right join
 | 
	
		
			
				|  |  | +        (select supplier venName,capacity_quota quotaCapacity from sy_capacity_control
 | 
	
		
			
				|  |  | +        where state!=-1) b
 | 
	
		
			
				|  |  | +        on a.cvencode=b.venName
 | 
	
		
			
				|  |  | +        ORDER BY yearMonth
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <select id="statement2" resultType="org.jeecg.modules.scas.entity.vo.SupplierCapacity5">
 | 
	
	
		
			
				|  | @@ -312,20 +331,23 @@
 | 
	
		
			
				|  |  |      </select>-->
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <select id="statement1" resultType="org.jeecg.modules.scas.entity.vo.SupplierCapacity5" parameterType="java.lang.String">
 | 
	
		
			
				|  |  | -        select *,
 | 
	
		
			
				|  |  | -        IIF((quotaCapacity-productionCapacity)<0,0,(quotaCapacity-productionCapacity)) spareCapacity
 | 
	
		
			
				|  |  | -        from
 | 
	
		
			
				|  |  | -        (select
 | 
	
		
			
				|  |  | +        select yearMonth,
 | 
	
		
			
				|  |  | +        cvencode,
 | 
	
		
			
				|  |  | +        isnull(coefficient2,0) productionCapacity,
 | 
	
		
			
				|  |  | +        quotaCapacity,
 | 
	
		
			
				|  |  | +        venName,
 | 
	
		
			
				|  |  | +        IIF((quotaCapacity-isnull(coefficient2,0))<0,0,(quotaCapacity-isnull(coefficient2,0))) spareCapacity
 | 
	
		
			
				|  |  | +        from (select
 | 
	
		
			
				|  |  |          darrivedate yearMonth,
 | 
	
		
			
				|  |  |          cvencode,
 | 
	
		
			
				|  |  | -        cast(sum(coefficient  *iquantity)/60 as decimal(20,2)) productionCapacity
 | 
	
		
			
				|  |  | +        cast(sum(coefficient  *iquantity)/60 as decimal(20,2)) coefficient2
 | 
	
		
			
				|  |  |          from Supplier_Capacity_Test
 | 
	
		
			
				|  |  |          where dArriveYear = #{year}
 | 
	
		
			
				|  |  |          AND dArriveMonth =  #{month}
 | 
	
		
			
				|  |  |          GROUP BY darrivedate,cvencode) a
 | 
	
		
			
				|  |  |          right join
 | 
	
		
			
				|  |  |          (select supplier venName,capacity_quota quotaCapacity from sy_capacity_control
 | 
	
		
			
				|  |  | -        where state!=-1) b
 | 
	
		
			
				|  |  | +        where state!=-1  ) b
 | 
	
		
			
				|  |  |          on a.cvencode=b.venName
 | 
	
		
			
				|  |  |          ORDER BY yearMonth
 | 
	
		
			
				|  |  |      </select>
 | 
	
	
		
			
				|  | @@ -347,20 +369,23 @@
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <select id="statement3" resultType="org.jeecg.modules.scas.entity.vo.SupplierCapacity5" parameterType="java.lang.String">
 | 
	
		
			
				|  |  | -       select *,
 | 
	
		
			
				|  |  | -        IIF((quotaCapacity-productionCapacity)<0,0,(quotaCapacity-productionCapacity)) spareCapacity
 | 
	
		
			
				|  |  | -        from
 | 
	
		
			
				|  |  | -        (select
 | 
	
		
			
				|  |  | +       select yearMonth,
 | 
	
		
			
				|  |  | +        cvencode,
 | 
	
		
			
				|  |  | +        isnull(coefficient2,0) productionCapacity,
 | 
	
		
			
				|  |  | +        quotaCapacity,
 | 
	
		
			
				|  |  | +        venName,
 | 
	
		
			
				|  |  | +        IIF((quotaCapacity-isnull(coefficient2,0))<0,0,(quotaCapacity-isnull(coefficient2,0))) spareCapacity
 | 
	
		
			
				|  |  | +        from (select
 | 
	
		
			
				|  |  |          darrivedate yearMonth,
 | 
	
		
			
				|  |  |          cvencode,
 | 
	
		
			
				|  |  | -        cast(sum(coefficient  *iquantity)/60 as decimal(20,2)) productionCapacity
 | 
	
		
			
				|  |  | +        cast(sum(coefficient  *iquantity)/60 as decimal(20,2)) coefficient2
 | 
	
		
			
				|  |  |          from Supplier_Capacity_Test
 | 
	
		
			
				|  |  |          where dArriveYear = #{year}
 | 
	
		
			
				|  |  |          AND dArriveMonth =  #{month}
 | 
	
		
			
				|  |  |          GROUP BY darrivedate,cvencode) a
 | 
	
		
			
				|  |  |          right join
 | 
	
		
			
				|  |  |          (select supplier venName,capacity_quota quotaCapacity from sy_capacity_control
 | 
	
		
			
				|  |  | -        where state!=-1) b
 | 
	
		
			
				|  |  | +        where state!=-1  ) b
 | 
	
		
			
				|  |  |          on a.cvencode=b.venName
 | 
	
		
			
				|  |  |          ORDER BY yearMonth
 | 
	
		
			
				|  |  |      </select>
 |