浏览代码

大屏接口调整

huxy 2 年之前
父节点
当前提交
885c086ee8

+ 56 - 26
jeecg-boot-module-system/src/main/java/org/jeecg/modules/scas/mapper/xml/SupplierCapacityMapper.xml

@@ -269,6 +269,23 @@
         AND dArriveMonth <= DATEPART(mm,GETDATE())))
         GROUP BY darrivedate) p
         order by p.yearMonth
+
+
+         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">
@@ -328,6 +345,22 @@
         ORDER BY cdepcode
 
 
+        select
+        Supplier_Capacity_Test.cdepcode venname,
+        ideporder,
+        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
+        left join  Department
+        on Supplier_Capacity_Test.cDepCode=Department.cdepname
+        where (dArriveYear > #{minYear} OR (dArriveYear = #{minYear} AND dArriveMonth >= #{minMonth} ))
+        AND (dArriveYear &lt; #{maxYear} OR (dArriveYear = #{maxYear} AND dArriveMonth  &lt;=#{maxMonth} ))
+        and
+        GROUP BY Supplier_Capacity_Test.cdepcode,ideporder
+        ORDER BY ideporder
+
     </select>-->
 
     <select id="statement1" resultType="org.jeecg.modules.scas.entity.vo.SupplierCapacity5" parameterType="java.lang.String">
@@ -349,23 +382,17 @@
         (select supplier venName,capacity_quota quotaCapacity from sy_capacity_control
         where state!=-1  ) b
         on a.cvencode=b.venName
-        ORDER BY yearMonth
+        ORDER BY cvencode
     </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
+        p.quotaCapacity,
+        p.productionCapacity,
+        (p.quotaCapacity-p.productionCapacity) spareCapacity
+        from ( select (select sum(capacity_quota) from sy_capacity_control where state!=-1) quotaCapacity,
+        ISNULL((select cast(sum(coefficient  *iquantity)/60 as decimal(20,2)) from Supplier_Capacity_Test
+        where dArriveYear= #{year} and dArriveMonth=  #{month}),0) productionCapacity)p
     </select>
 
     <select id="statement3" resultType="org.jeecg.modules.scas.entity.vo.SupplierCapacity5" parameterType="java.lang.String">
@@ -387,24 +414,27 @@
         (select supplier venName,capacity_quota quotaCapacity from sy_capacity_control
         where state!=-1  ) b
         on a.cvencode=b.venName
-        ORDER BY yearMonth
+        ORDER BY cvencode
     </select>
 
     <select id="statement4" resultType="org.jeecg.modules.scas.entity.vo.SupplierCapacity5" parameterType="java.lang.String">
-
         select
-        Supplier_Capacity_Test.cdepcode venname,
+        cdepname venname,
         ideporder,
-        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
-        left join  Department
-        on Supplier_Capacity_Test.cDepCode=Department.cdepname
-        where (dArriveYear > #{minYear} OR (dArriveYear = #{minYear} AND dArriveMonth >= #{minMonth} ))
-        AND (dArriveYear &lt; #{maxYear} OR (dArriveYear = #{maxYear} AND dArriveMonth  &lt;=#{maxMonth} ))
-        GROUP BY Supplier_Capacity_Test.cdepcode,ideporder
+        ISNULL(coefficient2, 0) productionCapacity,
+        (select sum(capacity_quota) from sy_capacity_control where state!=-1) quotaCapacity
+        from Department
+        left join
+        (select cdepcode,cast(sum(coefficient  *iquantity)/60 as decimal(20,2)) coefficient2
+        from 	Supplier_Capacity_Test
+        where   cDepCode like '业务_部'
+        and cdepcode not  like '业务七%'
+        and (dArriveYear > #{minYear} OR (dArriveYear = #{minYear} AND dArriveMonth >= #{maxMonth} ))
+        AND (dArriveYear &lt; #{minYear} OR (dArriveYear = #{minYear} AND dArriveMonth &lt;= #{maxMonth} ))
+        GROUP BY  cDepCode) p
+        on cdepname=p.cdepcode
+        where   cdepname like '业务_部'
+        and cdepname not  like '业务七%'
         ORDER BY ideporder
 
     </select>