From b13c552870d145f287dfd93a502e91cf9efc8ec3 Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期三, 13 三月 2024 10:05:37 +0800
Subject: [PATCH] 修改界面中英文

---
 north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml |  256 ++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 214 insertions(+), 42 deletions(-)

diff --git a/north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml b/north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml
index c97049a..333af58 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml
@@ -9,6 +9,8 @@
         <result property="previousProcess" column="previous_process"/>
         <result property="nextProcess" column="next_process"/>
         <result property="thisProcess" column="this_process"/>
+        <result property="reviewedState" column="reviewed_state"/>
+        <result property="previousProcessQuantity" column="previous_process_quantity"/>
         <association property="order" javaType="com.example.erp.entity.sd.Order">
             <result property="customerId" column="customer_id"/>
             <result property="customerName" column="customer_name"/>
@@ -17,7 +19,6 @@
         <association property="flowCard" javaType="com.example.erp.entity.pp.FlowCard">
             <result property="orderId" column="order_id"/>
             <result property="productionId" column="production_id"/>
-            <result property="quantity" column="quantity"/>
         </association>
         <association property="reportingWorkDetail" javaType="com.example.erp.entity.pp.ReportingWorkDetail">
             <result property="completedQuantity" column="completed_quantity"/>
@@ -31,14 +32,20 @@
                o.customer_id,
                o.customer_name,
                o.project,
-               SUM(fc.quantity)   as quantity,
+               SUM(fc.quantity)   as previous_process_quantity,
                #{previousProcess} as previous_process,
                #{nextProcess}     as next_process,
-               #{process} as  this_process
+               #{process} as  this_process,
+               ifnull((rw.reviewed_state),1) as reviewed_state  -- 涓嬪伐搴忓鏍哥姸鎬�
         from sd.order as o
-                 left join flow_card as fc on fc.order_id = o.order_id
+        left join flow_card as fc on fc.order_id = o.order_id
+        left join (select if(count(reviewed_state)>0 and process_id=null,1,0) as reviewed_state ,
+                          process_id
+                   from reporting_work
+                   where this_process=#{previousProcess} and reviewed_state=0 and process_id=#{processIdStr}) as rw
+        on rw.process_id = fc.process_id
         where fc.process_id = #{processIdStr}
-          and position(fc.technology_number in #{technologyStr})
+          and fc.technology_number = #{technologyStr}
         GROUP BY fc.process_id
     </select>
 
@@ -80,59 +87,224 @@
             ogd.child_width,
             ogd.child_height,
             od.shape,
-            fc.quantity - IFNULL(fc.number_patches,0)-IFNULL(rwd.completed_quantity,0)-IFNULL(rwd.breakage_quantity,0)-IFNULL((rwd.breakage_quantity-rwd.rework_quantity),0)
-                        as quantity
+            fc.quantity -odpd.reporting_work_num -odpd.broken_num + ifnull(c.patchNumSum,0) as quantity,
+            odpd.reporting_work_num_count as completed,
+            odpd.broken_num as onceBroken
         FROM
             sd.order_detail AS od
-                LEFT JOIN sd.order_glass_detail AS ogd ON od.order_id = ogd.order_id
-                AND od.order_number = ogd.order_number
-                LEFT JOIN flow_card AS fc ON fc.order_id = ogd.order_id and fc.production_id=ogd.production_id
-                AND fc.order_number = ogd.order_number
-                AND fc.technology_number = ogd.technology_number
-                left join reporting_work as rw on rw.order_id=fc.order_id and rw.production_id=fc.production_id and rw.process_id=fc.process_id
-                left join reporting_work_detail as rwd on rwd.reporting_work_id=rw.reporting_work_id and rwd.order_number=fc.order_number and rwd.technology_number=fc.technology_number
+        LEFT JOIN sd.order_glass_detail AS ogd
+            ON od.order_id = ogd.order_id
+            AND od.order_number = ogd.order_number
+        LEFT JOIN flow_card AS fc
+            ON fc.order_id = ogd.order_id
+            and fc.production_id=ogd.production_id
+            AND fc.order_number = ogd.order_number
+            AND fc.technology_number = ogd.technology_number
+        left join sd.order_process_detail as odpd
+            ON  odpd.order_id = fc.order_id
+            AND odpd.order_number = fc.order_number
+            AND odpd.technology_number = fc.technology_number
+            and  odpd.process_id = fc.process_id
+        left join
+                (select sum(patch_num) as patchNumSum,order_sort,technology_number,process_id
+                   from patch_log
+                   group by reporting_work_id,order_sort,technology_number) as c
+            on c.process_id = fc.process_id
+            and c.order_sort = fc.order_number
+            and c.technology_number = fc.technology_number
         WHERE
             fc.process_id = #{processIdStr}
-          AND position(
-                fc.technology_number IN #{technologyStr})
-
+          AND fc.technology_number = #{technologyStr}
+          AND odpd.process = #{process}
         order by fc.order_number
     </select>
 
 <!--    闈炵涓�閬撳伐搴忔姤宸ユ槑缁嗘煡璇�-->
     <select id="SelectReworlDetailMp">
-        SELECT fc.order_number,
-               ogd.glass_child,
-               ogd.technology_number,
-               ogd.glass_address,
-               fc.quantity as quantity_card,
-               ogd.child_width,
-               ogd.child_height,
-               od.shape,
-               reportingwork_num -IFNULL(rwd.completed_quantity,0)-IFNULL(rwd.breakage_quantity,0)-IFNULL((rwd.breakage_quantity-rwd.rework_quantity),0) as quantity
-        FROM sd.order_detail as od
-                 left join sd.order_glass_detail as ogd
-                           on od.order_id = ogd.order_id and od.order_number = ogd.order_number
-                 left join sd.order_process_detail as opd
-                           on opd.order_id = ogd.order_id and opd.order_number = ogd.order_number and
-                              opd.technology_number = ogd.technology_number
+        SELECT
+            fc.order_number,
+            ogd.glass_child,
+            ogd.technology_number,
+            ogd.glass_address,
+            fc.quantity AS quantity_card,
+            ogd.child_width,
+            ogd.child_height,
+            od.shape,
+            odpds.reporting_work_num -odpd.reporting_work_num -odpd.broken_num + ifnull(c.patchNumSum,0) as quantity,
+            odpd.reporting_work_num_count as completed,
+            odpd.broken_num as onceBroken,
+            ogd.`group`
 
-                 left join flow_card as fc on opd.order_id = fc.order_id and opd.order_number = fc.order_number and
-                                              opd.technology_number = fc.technology_number
-                 left join reporting_work as rw on rw.order_id=fc.order_id and
-                                                   rw.production_id=fc.production_id and rw.process_id=fc.process_id and rw.this_process = #{previousProcess}
-                 left join reporting_work_detail as rwd on rwd.reporting_work_id=rw.reporting_work_id and
-                                                           rwd.order_number=fc.order_number and rwd.technology_number=fc.technology_number
-        where fc.process_id = #{processIdStr}
-          and opd.process = #{previousProcess}
-          and position(ogd.technology_number in #{technologyStr})
 
+        FROM
+            sd.order_detail AS od
+        LEFT JOIN sd.order_glass_detail AS ogd
+                ON od.order_id = ogd.order_id
+                AND od.order_number = ogd.order_number
+        <if test="process == '澶硅兌'">
+            AND ogd.`group` = (select `group`
+                               from sd.order_glass_detail
+                               where order_id = ogd.order_id
+                               and order_number = ogd.order_number
+                               and technology_number =#{technologyStr}
+                               limit 1)
+        </if>
+
+        LEFT JOIN flow_card AS fc
+                ON fc.order_id = ogd.order_id
+                and fc.production_id=ogd.production_id
+                AND fc.order_number = ogd.order_number
+                AND fc.technology_number = ogd.technology_number
+        left join sd.order_process_detail as odpd
+                ON  odpd.order_id = fc.order_id
+                AND odpd.order_number = fc.order_number
+                AND odpd.technology_number = fc.technology_number
+                and odpd.process_id = fc.process_id
+        left join sd.order_process_detail as odpds
+                ON  odpds.id = odpd.id-1
+        left join
+            (select sum(patch_num) as patchNumSum,order_sort,technology_number,process_id
+             from patch_log
+             group by reporting_work_id,order_sort,technology_number) as c
+            on c.process_id = fc.process_id
+            and c.order_sort = fc.order_number
+            and c.technology_number = fc.technology_number
+        WHERE
+            fc.process_id = #{processIdStr}
+        <if test="process != '涓┖' and process != '澶硅兌' and process != '鍖呰'">
+           AND fc.technology_number = #{technologyStr}
+        </if>
+        AND odpd.process = #{process}
         order by fc.order_number
     </select>
 
     <select id="SelectProcessMp">
-        select * from sd.basic_data where basic_type="product" and basic_category="process"
+        select * from sd.basic_data where basic_type='product' and basic_category='process'
 
     </select>
 
+    <select id="historyProcessMp">
+        select ifnull(GROUP_CONCAT(distinct rw.this_process),'') from reporting_work as rw where rw.process_id=#{processIdStr}
+    </select>
+
+    <select id="historyDeviceMp">
+        SELECT
+            bdp.id,
+            bdp.basic_type,
+            bdp.basic_name,
+            bd.basic_name AS basic_category
+        FROM
+            sd.basic_data AS bd
+                LEFT JOIN `basic_data_produce` AS bdp ON bd.id = bdp.basic_category
+        WHERE
+            bd.basic_category = 'process'
+          AND bdp.basic_type = 'device'
+          AND POSITION(bd.basic_name in CONCAT(#{historyProcess},#{process}))
+    </select>
+
+    <select id="historyTeamsMp">
+        SELECT
+            bdp.id,
+            bdp.basic_type,
+            bdp.basic_name,
+            bd.basic_name,bd.id AS basic_category,
+            rw.process
+        FROM
+            sd.basic_data AS bd
+        LEFT JOIN `basic_data_produce` AS bdp
+            ON bd.id = bdp.basic_category
+        right join (
+                    select distinct process from
+                        (   select distinct rw.this_process as  process
+                            from reporting_work as rw where rw.process_id=#{processIdStr}
+                            UNION
+                            select #{process}
+                        ) as t
+                    ) as  rw
+        on rw.process=bd.basic_name
+        WHERE
+           bdp.basic_type = 'teamsgroups'
+    </select>
+
+    <select id="SelectHistoryProcessMp">
+        SELECT
+            distinct
+            bd.basic_name AS basic_category
+        FROM
+            sd.basic_data AS bd
+                LEFT JOIN `basic_data_produce` AS bdp ON bd.id = bdp.basic_category
+        WHERE
+            bd.basic_category = 'process'
+          AND bdp.basic_type = 'teamsgroups'
+          AND POSITION(bd.basic_name in CONCAT(#{historyProcess},#{process}))
+    </select>
+
+    <select id="selectBasicNameByType">
+        select * from `basic_data_produce` as a where a.basic_type  = #{type}
+    </select>
+
+    <select id="selectMaxReportingWorkId">
+        select
+            ifnull(SUBSTR(max(reporting_work_id) from 9),0)
+        from
+            reporting_work as a
+        where
+            date(a.create_time) = curdate()
+        order by id desc,reporting_work_id	desc limit  1
+    </select>
+
+    <!--    鏌ヨ娴佺▼鍗″伐搴忔姤宸ュ彲鎶ユ暟閲�-->
+    <select id="selectReportingWorkNum">
+
+    </select>
+    <select id="selectGlassProcessNum" resultType="java.lang.Integer">
+        select
+              d.reporting_work_num-b.reporting_work_num-b.broken_num+ifnull(c.patchNumSum,0)
+        from flow_card as a
+        left join sd.order_process_detail as b
+        on
+            b.order_number = a.order_number
+            and b.technology_number = a.technology_number
+            and b.order_id = SUBSTR(#{processId} from 1 for 10)
+            and b.process = #{thisProcess}
+            and b.process_id = a.process_id
+        left join sd.order_process_detail as d
+            on d.id=b.id-1
+        left join (select sum(patch_num) as patchNumSum,order_sort,technology_number,process_id
+                   from patch_log
+                   group by reporting_work_id,order_sort,technology_number) as c
+        on
+            c.process_id = a.process_id
+            and c.order_sort = a.order_number
+            and c.technology_number = a.technology_number
+
+        where
+            a.process_id=SUBSTR(#{processId} from 1 for 13)
+            and a.order_number = #{orderNumber}
+            and a.technology_number = #{technologyNumber}
+    </select>
+    <select id="selectFlowCardNum" resultType="java.lang.Integer">
+        select
+                    a.quantity-b.reporting_work_num-b.broken_num+ifnull(c.patchNumSum,0)
+        from flow_card as a
+                 left join sd.order_process_detail as b
+                           on
+                                       b.order_number = a.order_number
+                                   and b.technology_number = a.technology_number
+                                   and b.order_id = SUBSTR(#{processId} from 1 for 10)
+                                   and b.process = #{thisProcess}
+                                   and b.process_id = a.process_id
+                 left join (select sum(patch_num) as patchNumSum,order_sort,technology_number,process_id
+                            from patch_log
+                            group by reporting_work_id,order_sort,technology_number) as c
+                           on
+                                       c.process_id = a.process_id
+                                   and c.order_sort = a.order_number
+                                   and c.technology_number = a.technology_number
+
+        where
+            a.process_id=SUBSTR(#{processId} from 1 for 13)
+          and a.order_number = #{orderNumber}
+          and a.technology_number = #{technologyNumber}
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0