sucheng пре 7 месеци
родитељ
комит
0ed3e4e758
1 измењених фајлова са 66 додато и 66 уклоњено
  1. 66 66
      cx-aps/cx-aps-common/src/main/resources/mybatis/ApsProductionOrderDao.xml

+ 66 - 66
cx-aps/cx-aps-common/src/main/resources/mybatis/ApsProductionOrderDao.xml

@@ -370,10 +370,10 @@
         join aps_process_operation_out_mater apoom on apo.id=apoom.MAINID-- 作业输出物料
         join aps_blank_order abo on apo.BLANKID = abo.id
         join aps_production_order apro on apro.ID = abo.PRODUCTIONORDERID
-        join aps_product_detail apd on apoom.ORDERDETAILID = apd.id -- 订单产品明细
-        left join aps_production_merge_order apmd on apmd.ID = apd.MERGEORDERNUMBER and apmd.DELETED='0'
+        left join aps_product_detail apd on apoom.ORDERDETAILID = apd.id and apo.DELETED='0' -- 订单产品明细
+        left join aps_production_merge_order apmd on apmd.ORDERNO = apd.MERGEORDERNUMBER and apmd.DELETED='0'
         where
-        apope.deleted='0' and apo.DELETED='0' and abo.DELETED='0' and apro.deleted='0'
+        apope.deleted='0' and abo.DELETED='0' and apro.deleted='0'
         and apd.DELETED='0' and apoom.DELETED='0'
         and ifnull(apmd.ORDERTYPE, apro.ORDERTYPE) = '客户订单' -- 订单类型为空默认为客户订单
         and abo.PRODUCTSTATUS in ('30','40','50')
@@ -389,21 +389,21 @@
         from
             aps_process_operation_process_equ apope
                 join aps_process_operation apo on apo.ID = apope.PROCESSID
-                join aps_process_operation_out_mater apoom on apo.id=apoom.MAINID-- 作业输出物料
                 join aps_blank_order abo on apo.BLANKID = abo.id
                 join aps_production_order apro on apro.ID = abo.PRODUCTIONORDERID
-                join aps_product_detail apd on apoom.ORDERDETAILID = apd.id -- 订单产品明细
                 join aps_report_records arr on apope.id=arr.PROCESSEQUID
                 join aps_report_output aro on arr.id=aro.mainid
-                left join aps_production_merge_order apmd on apmd.ID = apd.MERGEORDERNUMBER and apmd.DELETED='0'
+                join aps_process_operation_out_mater apoom on aro.OUTPUTID=apoom.ID-- 作业输出物料
+                left join aps_product_detail apd on apoom.ORDERDETAILID = apd.id and apd.DELETED = '0' -- 订单产品明细
+                left join aps_production_merge_order apmd on apmd.ORDERNO = apd.MERGEORDERNUMBER and apmd.DELETED='0'
         where
             apope.deleted='0' and apo.DELETED='0' and abo.DELETED='0' and apro.deleted='0'
-          and apd.DELETED='0' and arr.deleted='0' and aro.DELETED='0'
+          and arr.deleted='0' and aro.DELETED='0' and apoom.DELETED = '0'
           and ifnull(apmd.ORDERTYPE, apro.ORDERTYPE) = '客户订单' -- 订单类型为空默认为客户订单
           and arr.CHECKSTATUS='已检验'
           and aro.QUALIFIED='是'
           and apoom.PLANPRODROLLNUM>0
-          and YEAR(apope.ACTUALFINISHDATE) = YEAR(CURRENT_DATE)
+          and YEAR(arr.REPORTWORKTIME) = YEAR(CURRENT_DATE)
         GROUP BY apro.TENANTID
     </select>
     <select id="selectNowMonthPlanGetOrderNum" resultType="com.rongwei.bsentity.domain.ApsReportYearAndMonth">
@@ -445,10 +445,10 @@
         join aps_process_operation_out_mater apoom on apo.id=apoom.MAINID-- 作业输出物料
         join aps_blank_order abo on apo.BLANKID = abo.id
         join aps_production_order apro on apro.ID = abo.PRODUCTIONORDERID
-        join aps_product_detail apd on apoom.ORDERDETAILID = apd.id -- 订单产品明细
-        left join aps_production_merge_order apmd on apmd.ID = apd.MERGEORDERNUMBER and apmd.DELETED='0'
+        left join aps_product_detail apd on apoom.ORDERDETAILID = apd.id  and apo.DELETED='0'-- 订单产品明细
+        left join aps_production_merge_order apmd on apmd.ORDERNO = apd.MERGEORDERNUMBER and apmd.DELETED='0'
         where
-        apope.deleted='0' and apo.DELETED='0' and abo.DELETED='0' and apro.deleted='0'
+        apope.deleted='0' and abo.DELETED='0' and apro.deleted='0'
         and apd.DELETED='0' and apoom.DELETED='0'
         and ifnull(apmd.ORDERTYPE, apro.ORDERTYPE) = '客户订单' -- 订单类型为空默认为客户订单
         and abo.PRODUCTSTATUS in ('30','40','50')
@@ -465,22 +465,22 @@
         from
             aps_process_operation_process_equ apope
                 join aps_process_operation apo on apo.ID = apope.PROCESSID
-                join aps_process_operation_out_mater apoom on apo.id=apoom.MAINID-- 作业输出物料
                 join aps_blank_order abo on apo.BLANKID = abo.id
                 join aps_production_order apro on apro.ID = abo.PRODUCTIONORDERID
-                join aps_product_detail apd on apoom.ORDERDETAILID = apd.id -- 订单产品明细
                 join aps_report_records arr on apope.id=arr.PROCESSEQUID
                 join aps_report_output aro on arr.id=aro.mainid
-                left join aps_production_merge_order apmd on apmd.ID = apd.MERGEORDERNUMBER and apmd.DELETED='0'
+                join aps_process_operation_out_mater apoom on aro.OUTPUTID=apoom.ID-- 作业输出物料
+                left join aps_product_detail apd on apoom.ORDERDETAILID = apd.id and apd.DELETED = '0' -- 订单产品明细
+                left join aps_production_merge_order apmd on apmd.ORDERNO = apd.MERGEORDERNUMBER and apmd.DELETED='0'
         where
             apope.deleted='0' and apo.DELETED='0' and abo.DELETED='0' and apro.deleted='0'
-          and apd.DELETED='0' and arr.deleted='0' and aro.DELETED='0'
+          and arr.deleted='0' and aro.DELETED='0' and apoom.DELETED = '0'
           and ifnull(apmd.ORDERTYPE, apro.ORDERTYPE) = '客户订单' -- 订单类型为空默认为客户订单
           and arr.CHECKSTATUS='已检验'
           and aro.QUALIFIED='是'
           and apoom.PLANPRODROLLNUM>0
-          and YEAR(apope.ACTUALFINISHDATE) = YEAR(CURRENT_DATE)
-          and MONTH(apope.ACTUALFINISHDATE) = MONTH(CURRENT_DATE)
+          and YEAR(arr.REPORTWORKTIME) = YEAR(CURRENT_DATE)
+          and MONTH(arr.REPORTWORKTIME) = MONTH(CURRENT_DATE)
         GROUP BY apro.TENANTID
     </select>
     <select id="selectOrderTable" resultType="com.rongwei.bsentity.domain.ApsReportOrderFinishTable">
@@ -496,11 +496,11 @@
         join aps_process_operation_out_mater apoom on apo.id=apoom.MAINID-- 作业输出物料
         join aps_blank_order abo on apo.BLANKID = abo.id
         join aps_production_order apro on apro.ID = abo.PRODUCTIONORDERID
-        join aps_product_detail apd on apoom.ORDERDETAILID = apd.id -- 订单产品明细
-        left join aps_production_merge_order apmd on apmd.ID = apd.MERGEORDERNUMBER and apmd.DELETED='0'
+        join aps_product_detail apd on apoom.ORDERDETAILID = apd.id and apd.DELETED='0' -- 订单产品明细
+        left join aps_production_merge_order apmd on apmd.ORDERNO = apd.MERGEORDERNUMBER and apmd.DELETED='0'
         where
         apope.deleted='0' and apo.DELETED='0' and abo.DELETED='0' and apro.deleted='0'
-        and apd.DELETED='0' and apoom.DELETED='0'
+        and apoom.DELETED='0'
         and ifnull(apmd.ORDERTYPE, apro.ORDERTYPE) = '客户订单' -- 订单类型为空默认为客户订单
         and abo.PRODUCTSTATUS in ('30','40','50')
         and (apope.PLANPROCESSRALL-apope.CANCELROLL)>0
@@ -522,17 +522,17 @@
         aro.WEIGHT,null)) YACTUALPRODUCEVOLUME -- 昨日实际完成订单量
         from
         aps_process_operation_process_equ apope
-        join aps_process_operation apo on apo.ID = apope.PROCESSID
-        join aps_process_operation_out_mater apoom on apo.id=apoom.MAINID-- 作业输出物料
-        join aps_blank_order abo on apo.BLANKID = abo.id
-        join aps_production_order apro on apro.ID = abo.PRODUCTIONORDERID
-        join aps_product_detail apd on apoom.ORDERDETAILID = apd.id -- 订单产品明细
-        join aps_report_records arr on apope.id=arr.PROCESSEQUID
-        join aps_report_output aro on arr.id=aro.mainid
-        left join aps_production_merge_order apmd on apmd.ID = apd.MERGEORDERNUMBER and apmd.DELETED='0'
+            join aps_process_operation apo on apo.ID = apope.PROCESSID
+            join aps_blank_order abo on apo.BLANKID = abo.id
+            join aps_production_order apro on apro.ID = abo.PRODUCTIONORDERID
+            join aps_report_records arr on apope.id=arr.PROCESSEQUID
+            join aps_report_output aro on arr.id=aro.mainid
+            join aps_process_operation_out_mater apoom on aro.OUTPUTID=apoom.ID-- 作业输出物料
+            left join aps_product_detail apd on apoom.ORDERDETAILID = apd.id and apd.DELETED = '0' -- 订单产品明细
+            left join aps_production_merge_order apmd on apmd.ORDERNO = apd.MERGEORDERNUMBER and apmd.DELETED='0'
         where
-        apope.deleted='0' and apo.DELETED='0' and abo.DELETED='0' and apro.deleted='0'
-        and apd.DELETED='0' and arr.deleted='0' and aro.DELETED='0'
+            apope.deleted='0' and apo.DELETED='0' and abo.DELETED='0' and apro.deleted='0'
+          and arr.deleted='0' and aro.DELETED='0' and apoom.DELETED = '0'
         and ifnull(apmd.ORDERTYPE, apro.ORDERTYPE) = '客户订单' -- 订单类型为空默认为客户订单
         and arr.CHECKSTATUS='已检验'
         and aro.QUALIFIED='是'
@@ -577,15 +577,15 @@
         sum((apope.PLANPROCESSRALL-apope.CANCELROLL)*apoom.PLANPRODROLLNUM/apo.PLANPROCESSRALL*apoom.SINGLEROLLWEIGHT) PLANPRODUCEVOLUME -- 当月计划完成订单量
         from
         aps_process_operation_process_equ apope
-        join aps_process_operation apo on apo.ID = apope.PROCESSID
-        join aps_process_operation_out_mater apoom on apo.id=apoom.MAINID-- 作业输出物料
-        join aps_blank_order abo on apo.BLANKID = abo.id
-        join aps_production_order apro on apro.ID = abo.PRODUCTIONORDERID
-        join aps_product_detail apd on apoom.ORDERDETAILID = apd.id -- 订单产品明细
-        left join aps_production_merge_order apmd on apmd.ID = apd.MERGEORDERNUMBER and apmd.DELETED='0'
+            join aps_process_operation apo on apo.ID = apope.PROCESSID
+            join aps_process_operation_out_mater apoom on apo.id=apoom.MAINID-- 作业输出物料
+            join aps_blank_order abo on apo.BLANKID = abo.id
+            join aps_production_order apro on apro.ID = abo.PRODUCTIONORDERID
+            join aps_product_detail apd on apoom.ORDERDETAILID = apd.id and apd.DELETED='0' -- 订单产品明细
+            left join aps_production_merge_order apmd on apmd.ORDERNO = apd.MERGEORDERNUMBER and apmd.DELETED='0'
         where
-        apope.deleted='0' and apo.DELETED='0' and abo.DELETED='0' and apro.deleted='0'
-        and apd.DELETED='0' and apoom.DELETED='0'
+            apope.deleted='0' and apo.DELETED='0' and abo.DELETED='0' and apro.deleted='0'
+          and apoom.DELETED='0'
         and ifnull(apmd.ORDERTYPE, apro.ORDERTYPE) = '客户订单' -- 订单类型为空默认为客户订单
         and abo.PRODUCTSTATUS in ('30','40','50')
         and (apope.PLANPROCESSRALL-apope.CANCELROLL)>0
@@ -602,17 +602,17 @@
         sum(aro.WEIGHT) ACTUALPRODUCEVOLUME -- 当月实际完成订单量
         from
         aps_process_operation_process_equ apope
-        join aps_process_operation apo on apo.ID = apope.PROCESSID
-        join aps_process_operation_out_mater apoom on apo.id=apoom.MAINID-- 作业输出物料
-        join aps_blank_order abo on apo.BLANKID = abo.id
-        join aps_production_order apro on apro.ID = abo.PRODUCTIONORDERID
-        join aps_product_detail apd on apoom.ORDERDETAILID = apd.id -- 订单产品明细
-        join aps_report_records arr on apope.id=arr.PROCESSEQUID
-        join aps_report_output aro on arr.id=aro.mainid
-        left join aps_production_merge_order apmd on apmd.ID = apd.MERGEORDERNUMBER and apmd.DELETED='0'
+            join aps_process_operation apo on apo.ID = apope.PROCESSID
+            join aps_blank_order abo on apo.BLANKID = abo.id
+            join aps_production_order apro on apro.ID = abo.PRODUCTIONORDERID
+            join aps_report_records arr on apope.id=arr.PROCESSEQUID
+            join aps_report_output aro on arr.id=aro.mainid
+            join aps_process_operation_out_mater apoom on aro.OUTPUTID=apoom.ID-- 作业输出物料
+            left join aps_product_detail apd on apoom.ORDERDETAILID = apd.id and apd.DELETED = '0' -- 订单产品明细
+            left join aps_production_merge_order apmd on apmd.ORDERNO = apd.MERGEORDERNUMBER and apmd.DELETED='0'
         where
-        apope.deleted='0' and apo.DELETED='0' and abo.DELETED='0' and apro.deleted='0'
-        and apd.DELETED='0' and arr.deleted='0' and aro.DELETED='0'
+            apope.deleted='0' and apo.DELETED='0' and abo.DELETED='0' and apro.deleted='0'
+          and arr.deleted='0' and aro.DELETED='0' and apoom.DELETED = '0'
         and ifnull(apmd.ORDERTYPE, apro.ORDERTYPE) = '客户订单' -- 订单类型为空默认为客户订单
         and arr.CHECKSTATUS='已检验'
         and aro.QUALIFIED='是'
@@ -644,15 +644,15 @@
         sum((apope.PLANPROCESSRALL-apope.CANCELROLL)*apoom.PLANPRODROLLNUM/apo.PLANPROCESSRALL*apoom.SINGLEROLLWEIGHT) PLANPRODUCEVOLUME -- 当月计划完成订单量
         from
         aps_process_operation_process_equ apope
-        join aps_process_operation apo on apo.ID = apope.PROCESSID
-        join aps_process_operation_out_mater apoom on apo.id=apoom.MAINID-- 作业输出物料
-        join aps_blank_order abo on apo.BLANKID = abo.id
-        join aps_production_order apro on apro.ID = abo.PRODUCTIONORDERID
-        join aps_product_detail apd on apoom.ORDERDETAILID = apd.id -- 订单产品明细
-        left join aps_production_merge_order apmd on apmd.ID = apd.MERGEORDERNUMBER and apmd.DELETED='0'
+            join aps_process_operation apo on apo.ID = apope.PROCESSID
+            join aps_process_operation_out_mater apoom on apo.id=apoom.MAINID-- 作业输出物料
+            join aps_blank_order abo on apo.BLANKID = abo.id
+            join aps_production_order apro on apro.ID = abo.PRODUCTIONORDERID
+            join aps_product_detail apd on apoom.ORDERDETAILID = apd.id and apd.DELETED='0' -- 订单产品明细
+            left join aps_production_merge_order apmd on apmd.ORDERNO = apd.MERGEORDERNUMBER and apmd.DELETED='0'
         where
-        apope.deleted='0' and apo.DELETED='0' and abo.DELETED='0' and apro.deleted='0'
-        and apd.DELETED='0' and apoom.DELETED='0'
+            apope.deleted='0' and apo.DELETED='0' and abo.DELETED='0' and apro.deleted='0'
+          and apoom.DELETED='0'
         and ifnull(apmd.ORDERTYPE, apro.ORDERTYPE) = '客户订单' -- 订单类型为空默认为客户订单
         and abo.PRODUCTSTATUS in ('30','40','50')
         and (apope.PLANPROCESSRALL-apope.CANCELROLL)>0
@@ -669,17 +669,17 @@
         sum(aro.WEIGHT) ACTUALPRODUCEVOLUME -- 当月实际完成订单量
         from
         aps_process_operation_process_equ apope
-        join aps_process_operation apo on apo.ID = apope.PROCESSID
-        join aps_process_operation_out_mater apoom on apo.id=apoom.MAINID-- 作业输出物料
-        join aps_blank_order abo on apo.BLANKID = abo.id
-        join aps_production_order apro on apro.ID = abo.PRODUCTIONORDERID
-        join aps_product_detail apd on apoom.ORDERDETAILID = apd.id -- 订单产品明细
-        join aps_report_records arr on apope.id=arr.PROCESSEQUID
-        join aps_report_output aro on arr.id=aro.mainid
-        left join aps_production_merge_order apmd on apmd.ID = apd.MERGEORDERNUMBER and apmd.DELETED='0'
+            join aps_process_operation apo on apo.ID = apope.PROCESSID
+            join aps_blank_order abo on apo.BLANKID = abo.id
+            join aps_production_order apro on apro.ID = abo.PRODUCTIONORDERID
+            join aps_report_records arr on apope.id=arr.PROCESSEQUID
+            join aps_report_output aro on arr.id=aro.mainid
+            join aps_process_operation_out_mater apoom on aro.OUTPUTID=apoom.ID-- 作业输出物料
+            left join aps_product_detail apd on apoom.ORDERDETAILID = apd.id and apd.DELETED = '0' -- 订单产品明细
+            left join aps_production_merge_order apmd on apmd.ORDERNO = apd.MERGEORDERNUMBER and apmd.DELETED='0'
         where
-        apope.deleted='0' and apo.DELETED='0' and abo.DELETED='0' and apro.deleted='0'
-        and apd.DELETED='0' and arr.deleted='0' and aro.DELETED='0'
+            apope.deleted='0' and apo.DELETED='0' and abo.DELETED='0' and apro.deleted='0'
+          and arr.deleted='0' and aro.DELETED='0' and apoom.DELETED = '0'
         and ifnull(apmd.ORDERTYPE, apro.ORDERTYPE) = '客户订单' -- 订单类型为空默认为客户订单
         and arr.CHECKSTATUS='已检验'
         and aro.QUALIFIED='是'