From 15f335a0553bbc56c23a1eea9548e53b8fdbcb87 Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期一, 11 三月 2024 11:29:04 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override

---
 north-glass-erp/src/main/resources/mapper/pp/ProductionScheduling.xml |  226 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 226 insertions(+), 0 deletions(-)

diff --git a/north-glass-erp/src/main/resources/mapper/pp/ProductionScheduling.xml b/north-glass-erp/src/main/resources/mapper/pp/ProductionScheduling.xml
new file mode 100644
index 0000000..e099760
--- /dev/null
+++ b/north-glass-erp/src/main/resources/mapper/pp/ProductionScheduling.xml
@@ -0,0 +1,226 @@
+<?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.ProductionSchedulingMapper">
+    <resultMap id="ProductionSchedulingMap" type="com.example.erp.entity.pp.ProductionScheduling">
+        <result column="processes" property="processes"/>
+        <result column="scheduling_quantity" property="schedulingQuantity"/>
+        <result column="order_number" property="orderNumber"/>
+        <result column="scheduling_id" property="schedulingId"/>
+        <result column="order_id" property="orderId"/>
+        <!--鎺ユ敹鍏朵粬澶栭敭瀹炰綋绫绘暟鎹�-->
+        <association property="order" javaType="com.example.erp.entity.sd.Order">
+            <result column="project" property="project"/>
+            <result column="order_id" property="orderId"/>
+            <result column="customer_name" property="customerName"/>
+            <result column="batch" property="batch"/>
+            <result column="other_remarks" property="otherRemarks"/>
+            <result column="icon" property="icon"/>
+            <result column="order_type" property="orderType"/>
+            <result column="salesman" property="salesman"/>
+            <result column="processing_note" property="processingNote"/>
+            <result column="delivery_address" property="deliveryAddress"/>
+        </association>
+        <association property="orderDetail" javaType="com.example.erp.entity.sd.OrderDetail">
+            <result column="order_id" property="orderId"/>
+            <result column="product_id" property="productId"/>
+            <result column="product_name" property="productName"/>
+            <result column="compute_gross_area" property="computeGrossArea"/>
+            <result column="processing_note" property="processingNote"/>
+            <result column="quantity" property="quantity"/>
+            <result column="compute_gross_area" property="computeGrossArea"/>
+            <result column="perimeter" property="perimeter"/>
+            <result column="order_number" property="orderNumber"/>
+            <result column="width" property="width"/>
+            <result column="height" property="height"/>
+            <result column="shape" property="shape"/>
+            <result column="weight" property="weight"/>
+        </association>
+
+
+    </resultMap>
+
+
+    <!--    鏌ヨ宸叉帓鐗堟暟鎹�-->
+    <select id="selectOkSchedulingMp">
+        select date(ps.scheduled_start_time)                          as scheduled_start_time,
+               date(ps.plan_end_time)                                 as plan_end_time,
+               od.order_id,
+               o.customer_name,
+               o.project,
+               od.order_number,
+               od.width,
+               od.height,
+               od.quantity,
+               round(od.width * od.height * od.quantity / 1000000, 2) as area,
+               ps.scheduling_quantity,
+               (od.quantity - IFNULL(sum(ps.scheduling_quantity), 0)) as pendingProductionQuantity,
+               round(od.width * od.height * (od.quantity - IFNULL(sum(ps.scheduling_quantity), 0)) / 1000000,
+                     2)                                               as pendingProductionArea,
+               IFNULL(ps.scheduling_quantity, 0)                      as productionScheduledQuantity,
+               round(od.width * od.height * (IFNULL(ps.scheduling_quantity, 0)) / 1000000,
+                     2)                                               as productionScheduledArea,
+               IF(ps.review_status = 0, "鏈鏍�", "宸插鏍�")           as review_status,
+               ps.reviewer,
+               od.product_name,
+               od.shape,
+               ps.scheduling_id
+        from sd.order_detail as od
+                 left join sd.order as o on od.order_id = o.order_id
+                 left join production_scheduling as ps
+                           on ps.order_id = od.order_id and ps.order_number = od.order_number
+        where ps.scheduling_id IS NOT NULL
+          and od.create_time between #{selectTime1} and #{selectTime2}
+          and position(#{processes} in ps.processes)
+          and position(#{orderId} in ps.order_id)
+        group by od.order_id, od.order_number
+        order by ps.id desc
+    </select>
+
+    <!--    鏌ヨ宸叉帓浜х殑鏁版嵁-->
+    <select id="selectSchedulingNotMp">
+        select date(ps.scheduled_start_time)                          as scheduled_start_time,
+               date(ps.plan_end_time)                                 as plan_end_time,
+               od.order_id,
+               o.customer_name,
+               o.project,
+               od.order_number,
+               od.width,
+               od.height,
+               od.quantity,
+               round(od.width * od.height * od.quantity / 1000000, 2) as area,
+               ps.scheduling_quantity,
+               (od.quantity - IFNULL(sum(ps.scheduling_quantity), 0)) as pendingProductionQuantity,
+               round(od.width * od.height * (od.quantity - IFNULL(sum(ps.scheduling_quantity), 0)) / 1000000, 2)
+                                                                      as pendingProductionArea,
+               IFNULL(ps.scheduling_quantity, 0)                      as productionScheduledQuantity,
+               round(od.width * od.height * (IFNULL(ps.scheduling_quantity, 0)) / 1000000, 2)
+                                                                      as productionScheduledArea,
+               IF(ps.review_status = 0, "鏈鏍�", "宸插鏍�")
+                                                                      as review_status,
+               ps.reviewer,
+               od.product_name,
+               od.shape,
+               ps.scheduling_id
+        from sd.order_detail as od
+                 left join sd.order as o on od.order_id = o.order_id
+                 left join production_scheduling as ps
+                           on ps.order_id = od.order_id and ps.order_number = od.order_number
+        where (ps.scheduling_id IS NOT NULL)
+          and position(#{processes} in ps.processes)
+          and position(#{orderId} in ps.order_id)
+        group by od.order_id, od.order_number
+        order by ps.id desc
+    </select>
+    <!--    鏌ヨ鏈帓浜ф暟鎹�-->
+    <select id="selectNoSchedulingMp">
+        select od.order_id,
+               o.customer_name,
+               o.project,
+               od.order_number,
+               od.width,
+               od.height,
+               od.quantity,
+               round(od.width * od.height * od.quantity / 1000000, 2) as area,
+               (od.quantity - IFNULL(sum(ps.scheduling_quantity), 0)) as pendingProductionQuantity,
+               round(od.width * od.height * (od.quantity - IFNULL(sum(ps.scheduling_quantity), 0)) / 1000000, 2)
+                                                                      as pendingProductionArea,
+               IFNULL(ps.scheduling_quantity, 0)                      as productionScheduledQuantity,
+               round(od.width * od.height * (IFNULL(ps.scheduling_quantity, 0)) / 1000000,
+                     2)                                               as productionScheduledArea,
+               od.product_name,
+               od.shape
+        from sd.order_detail as od
+                 left join sd.order as o on od.order_id = o.order_id
+                 left join production_scheduling as ps
+                           on ps.order_id = od.order_id and ps.order_number = od.order_number
+        where (od.quantity - IFNULL((ps.scheduling_quantity), 0)) > 0
+          and od.create_time between #{selectTime1} and #{selectTime2}
+
+          and position(#{orderId} in ps.order_id)
+          and position(#{processes} in ps.processes)
+
+        group by od.order_id, od.order_number
+        order by ps.id desc
+    </select>
+    <!--    棣栨鏌ヨ鎺掍骇鏁版嵁-->
+    <select id="selectLastSchedulingMp">
+        select od.order_id,
+               o.customer_name,
+               o.project,
+               od.order_number,
+               od.width,
+               od.height,
+               od.quantity,
+               round(od.width * od.height * od.quantity / 1000000, 2) as area,
+               (od.quantity - IFNULL(sum(ps.scheduling_quantity), 0)) as pendingProductionQuantity,
+               round(od.width * od.height * (od.quantity - IFNULL(sum(ps.scheduling_quantity), 0)) / 1000000,
+                     2)                                               as pendingProductionArea,
+               IFNULL(sum(ps.scheduling_quantity), 0)                 as productionScheduledQuantity,
+               round(od.width * od.height * (IFNULL(sum(ps.scheduling_quantity), 0)) / 1000000,
+                     2)                                               as productionScheduledArea,
+               od.product_name,
+               od.shape
+        from sd.order_detail as od
+                 left join sd.order as o on od.order_id = o.order_id
+                 left join production_scheduling as ps
+                           on ps.order_id = od.order_id and ps.order_number = od.order_number
+        where od.create_time between #{selectTime1} and #{selectTime2}
+          and (od.quantity - IFNULL((ps.scheduling_quantity), 0)) > 0
+
+        group by od.order_id, od.order_number
+        order by ps.id desc
+    </select>
+
+    <select id="selectMaxId">
+        select COUNT(ps.scheduling_id)
+        from `production_scheduling` as ps
+        where date(ps.create_time) = curdate()
+    </select>
+
+    <insert id="insertSelective">
+        insert into production_scheduling(scheduling_id,
+                                          order_id,
+                                          order_number,
+                                          processes,
+                                          scheduling_quantity,
+                                          scheduled_start_time,
+                                          plan_end_time,
+                                          notes,
+                                          create_time)
+        VALUES (#{schedulingId},
+                #{orderId},
+                #{orderNumber},
+                #{processes},
+                #{schedulingQuantity},
+                #{scheduledStartTime},
+                #{planEndTime},
+                #{notes},
+                now())
+    </insert>
+
+    <update id="examineSchedulingMp">
+        update production_scheduling
+        set review_status=1,
+            reviewer=#{userName}
+        where scheduling_id = #{schedulingId}
+    </update>
+
+    <delete id="deleteSchedulingMp">
+        delete
+        from production_scheduling
+        where scheduling_id = #{schedulingId}
+    </delete>
+
+    <select id="selectProcess">
+        SELECT *
+        FROM sd.basic_data as bd
+        where bd.basic_category = 'process'
+          and bd.basic_type = 'product'
+    </select>
+
+    <select id="selectNumberMp">
+
+    </select>
+</mapper>
\ No newline at end of file

--
Gitblit v1.8.0