From ede4e6aef5421f3a28fb4bc083ee60025b1b5f03 Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期五, 01 三月 2024 08:56:39 +0800
Subject: [PATCH] 报工新增界面部分代码

---
 north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml |  140 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 140 insertions(+), 0 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
new file mode 100644
index 0000000..0df04e9
--- /dev/null
+++ b/north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.example.erp.mapper.pp.ReportingWorkMapper">
+    <resultMap id="reportingWorkMap" type="com.example.erp.entity.pp.ReportingWork">
+        <result property="orderId" column="order_id"/>
+        <result property="productionId" column="production_id"/>
+        <result property="previousProcess" column="previous_process"/>
+        <result property="nextProcess" column="next_process"/>
+        <result property="thisProcess" column="this_process"/>
+        <association property="order" javaType="com.example.erp.entity.sd.Order">
+            <result property="customerId" column="customer_id"/>
+            <result property="customerName" column="customer_name"/>
+            <result property="project" column="project"/>
+        </association>
+        <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"/>
+        </association>
+
+    </resultMap>
+
+    <select id="AddSelectLastWorkMp" resultMap="reportingWorkMap">
+        select o.order_id,
+               fc.production_id,
+               o.customer_id,
+               o.customer_name,
+               o.project,
+               SUM(fc.quantity)   as quantity,
+               #{previousProcess} as previous_process,
+               #{nextProcess}     as next_process,
+               #{process} as  this_process
+        from sd.order as o
+                 left join flow_card as fc on fc.order_id = o.order_id
+        where fc.process_id = #{processIdStr}
+          and position(fc.technology_number in #{technologyStr})
+        GROUP BY fc.process_id
+    </select>
+
+    <select id="SelectWorkBasicDeviceMp">
+        select *
+        from basic_data_produce as a
+        where a.basic_category = #{process}
+          and a.basic_type = '璁惧'
+    </select>
+
+    <select id="SelectWorkBasicTeamsMp">
+        select *
+        from basic_data_produce as a
+        where a.basic_category = #{process}
+          and a.basic_type = '鐝粍'
+    </select>
+
+    <!--    鏌ヨ娴佺▼鍗″伐鑹烘祦绋�-->
+    <select id="SelectTechnologicalProcess">
+        select ogd.process
+        from sd.order_glass_detail as ogd
+        where ogd.production_id = LEFT(#{processIdStr}, 11)
+        limit 1
+
+    </select>
+
+    <select id="SelectWorkTechnologyMp">
+        select GROUP_CONCAT(distinct fc.technology_number)
+        from flow_card as fc
+        where fc.process_id = #{processIdStr}
+    </select>
+
+<!--    绗竴閬撳伐搴忔姤宸ユ槑缁嗘煡璇�-->
+    <select id="SelectTechnologicalNumMp">
+        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,
+            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
+        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
+        WHERE
+            fc.process_id = #{processIdStr}
+          AND position(
+                fc.technology_number IN #{technologyStr})
+
+        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
+
+                 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})
+
+        order by fc.order_number
+    </select>
+
+    <select id="SelectProcessMp">
+        select * from sd.basic_data where basic_type="product" and basic_category="process"
+
+    </select>
+
+</mapper>
\ No newline at end of file

--
Gitblit v1.8.0