|
@@ -208,4 +208,168 @@
|
|
|
${ew.customSqlSegment}
|
|
|
</select>
|
|
|
|
|
|
+<!-- <select id="statement1" resultType="org.jeecg.modules.scas.entity.vo.SupplierCapacity5">
|
|
|
+ select *,
|
|
|
+ (quotaCapacity-coefficient) spareCapacity,
|
|
|
+ IIF((quotaCapacity-coefficient)<0,0,(quotaCapacity-coefficient)) productionCapacity
|
|
|
+ from
|
|
|
+ (select
|
|
|
+ darrivedate yearMonth,
|
|
|
+ cvencode,
|
|
|
+ cast(sum(coefficient *iquantity)/60 as decimal(20,2)) coefficient
|
|
|
+ from Supplier_Capacity_Test
|
|
|
+ where (dArriveYear > DATEPART(yyyy,GETDATE())
|
|
|
+ OR (dArriveYear = DATEPART(yyyy,GETDATE())
|
|
|
+ AND dArriveMonth >= DATEPART(mm,GETDATE())))
|
|
|
+ AND (dArriveYear < DATEPART(yyyy,GETDATE())+1
|
|
|
+ OR (dArriveYear = DATEPART(yyyy,GETDATE())+1
|
|
|
+ AND dArriveMonth <= DATEPART(mm,GETDATE())-1))
|
|
|
+ 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">
|
|
|
+ select p.*,
|
|
|
+ (p.quotaCapacity-p.productionCapacity) spareCapacity from (
|
|
|
+ select
|
|
|
+ darrivedate yearMonth,
|
|
|
+ cast(sum(coefficient *iquantity)/60 as decimal(20,2)) productionCapacity,
|
|
|
+ (select sum(capacity_quota) from sy_capacity_control where state!=-1) quotaCapacity
|
|
|
+ from Supplier_Capacity_Test
|
|
|
+ right join sy_capacity_control
|
|
|
+ on supplier=cvencode and state!=-1
|
|
|
+ where (dArriveYear > DATEPART(yyyy,GETDATE())-1
|
|
|
+ OR (dArriveYear = DATEPART(yyyy,GETDATE())-1
|
|
|
+ AND dArriveMonth >= DATEPART(mm,GETDATE())+1))
|
|
|
+ AND (dArriveYear < DATEPART(yyyy,GETDATE())
|
|
|
+ OR (dArriveYear = DATEPART(yyyy,GETDATE())
|
|
|
+ AND dArriveMonth <= DATEPART(mm,GETDATE())))
|
|
|
+ GROUP BY darrivedate) p
|
|
|
+ order by p.yearMonth
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="statement3" resultType="org.jeecg.modules.scas.entity.vo.SupplierCapacity5">
|
|
|
+ select *,
|
|
|
+ (quotaCapacity-coefficient) spareCapacity,
|
|
|
+ IIF((quotaCapacity-coefficient)<0,0,(quotaCapacity-coefficient)) productionCapacity
|
|
|
+ from
|
|
|
+ (select
|
|
|
+ darrivedate yearMonth,
|
|
|
+ cvencode,
|
|
|
+ cast(sum(coefficient *iquantity)/60 as decimal(20,2)) coefficient
|
|
|
+ from Supplier_Capacity_Test
|
|
|
+ where (dArriveYear > DATEPART(yyyy,GETDATE())
|
|
|
+ OR (dArriveYear = DATEPART(yyyy,GETDATE())
|
|
|
+ AND dArriveMonth >= DATEPART(mm,GETDATE())))
|
|
|
+ AND (dArriveYear < DATEPART(yyyy,GETDATE())+1
|
|
|
+ OR (dArriveYear = DATEPART(yyyy,GETDATE())+1
|
|
|
+ AND dArriveMonth <= DATEPART(mm,GETDATE())-1))
|
|
|
+ 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="statement4" resultType="org.jeecg.modules.scas.entity.vo.SupplierCapacity5">
|
|
|
+ select
|
|
|
+ darrivedate yearMonth,
|
|
|
+ darrivemonth,
|
|
|
+ cdepcode,
|
|
|
+ cast(sum(coefficient *iquantity)/60 as decimal(20,2)) productionCapacity,
|
|
|
+ (select sum(capacity_quota) from sy_capacity_control where state!=-1) quotaCapacity
|
|
|
+ from Supplier_Capacity_Test
|
|
|
+ right join sy_capacity_control
|
|
|
+ on supplier=cvencode and state!=-1
|
|
|
+ where (dArriveYear > DATEPART(yyyy,GETDATE())-1
|
|
|
+ OR (dArriveYear = DATEPART(yyyy,GETDATE())-1
|
|
|
+ AND dArriveMonth >= ${min}))
|
|
|
+ AND (dArriveYear < DATEPART(yyyy,GETDATE())+1
|
|
|
+ OR (dArriveYear = DATEPART(yyyy,GETDATE())+1
|
|
|
+ AND dArriveMonth <= ${max}))
|
|
|
+ GROUP BY darrivedate,darrivemonth,cdepcode
|
|
|
+ ORDER BY darrivedate
|
|
|
+ </select>-->
|
|
|
+
|
|
|
+ <select id="statement1" resultType="org.jeecg.modules.scas.entity.vo.SupplierCapacity5" parameterType="java.lang.String">
|
|
|
+ select *,
|
|
|
+ (quotaCapacity-coefficient) spareCapacity,
|
|
|
+ IIF((quotaCapacity-coefficient)<0,0,(quotaCapacity-coefficient)) productionCapacity
|
|
|
+ from
|
|
|
+ (select
|
|
|
+ darrivedate yearMonth,
|
|
|
+ cvencode,
|
|
|
+ cast(sum(coefficient *iquantity)/60 as decimal(20,2)) coefficient
|
|
|
+ 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" parameterType="java.lang.String">
|
|
|
+ select p.*,
|
|
|
+ (p.quotaCapacity-p.productionCapacity) spareCapacity from (
|
|
|
+ select
|
|
|
+ darrivedate yearMonth,
|
|
|
+ cast(sum(coefficient *iquantity)/60 as decimal(20,2)) productionCapacity,
|
|
|
+ (select sum(capacity_quota) from sy_capacity_control where state!=-1) quotaCapacity
|
|
|
+ from Supplier_Capacity_Test
|
|
|
+ right join sy_capacity_control
|
|
|
+ on supplier=cvencode and state!=-1
|
|
|
+ where dArriveYear= #{year}
|
|
|
+ and dArriveMonth= #{month}
|
|
|
+ GROUP BY darrivedate) p
|
|
|
+ order by p.yearMonth
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="statement3" resultType="org.jeecg.modules.scas.entity.vo.SupplierCapacity5" parameterType="java.lang.String">
|
|
|
+ select *,
|
|
|
+ (quotaCapacity-coefficient) spareCapacity,
|
|
|
+ IIF((quotaCapacity-coefficient)<0,0,(quotaCapacity-coefficient)) productionCapacity
|
|
|
+ from
|
|
|
+ (select
|
|
|
+ darrivedate yearMonth,
|
|
|
+ cvencode,
|
|
|
+ cast(sum(coefficient *iquantity)/60 as decimal(20,2)) coefficient
|
|
|
+ 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="statement4" resultType="org.jeecg.modules.scas.entity.vo.SupplierCapacity5" parameterType="java.lang.String">
|
|
|
+ select
|
|
|
+ darrivedate yearMonth,
|
|
|
+ darrivemonth,
|
|
|
+ cdepcode,
|
|
|
+ cast(sum(coefficient *iquantity)/60 as decimal(20,2)) productionCapacity,
|
|
|
+ (select sum(capacity_quota) from sy_capacity_control where state!=-1) quotaCapacity
|
|
|
+ from Supplier_Capacity_Test
|
|
|
+ right join sy_capacity_control
|
|
|
+ on supplier=cvencode and state!=-1
|
|
|
+ where (dArriveYear > DATEPART(yyyy,GETDATE())-1
|
|
|
+ OR (dArriveYear = DATEPART(yyyy,GETDATE())-1
|
|
|
+ AND dArriveMonth >= ${min}))
|
|
|
+ AND (dArriveYear < DATEPART(yyyy,GETDATE())+1
|
|
|
+ OR (dArriveYear = DATEPART(yyyy,GETDATE())+1
|
|
|
+ AND dArriveMonth <= ${max}))
|
|
|
+ GROUP BY darrivedate,darrivemonth,cdepcode
|
|
|
+ ORDER BY darrivedate
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|