From 3c87c3ff67c2193ab5bfaa31f0fb1ad5a68cd5af Mon Sep 17 00:00:00 2001
From: guoyuji <guoyujie@ng.com>
Date: 星期五, 15 三月 2024 09:09:10 +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 | 263 ++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 191 insertions(+), 72 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
index 3362936..80b4bb7 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/ProductionScheduling.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/ProductionScheduling.xml
@@ -7,6 +7,8 @@
<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"/>
@@ -40,85 +42,202 @@
</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(ps.scheduling_quantity,0)) as pendingProductionQuantity,
- round(od.width*od.height*(od.quantity-IFNULL(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
+ <!-- 鏌ヨ宸叉帓鐗堟暟鎹�-->
+ <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}
- <if test="processes!=null and processes!=''">
- and ps.processes regexp #{processes}
- </if>
-
+ 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(ps.scheduling_quantity,0)) as pendingProductionQuantity,
- round(od.width*od.height*(od.quantity-IFNULL(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
+ <!-- 鏌ヨ宸叉帓浜х殑鏁版嵁-->
+ <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 scheduling_quantity,
+ 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.order_id regexp #{orderId}
-
- <if test="processes!=null and processes!=''">
- and ps.processes regexp #{processes}
- </if>
-
+ 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(ps.scheduling_quantity,0)) as pendingProductionQuantity,
- round(od.width*od.height*(od.quantity-IFNULL(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 isnull(ps.scheduling_id) and od.create_time between #{selectTime1} and #{selectTime2}
- <if test="orderId!=null and orderId!=''">
- and od.order_id regexp #{orderId}
+ <!-- 鏌ヨ鏈帓浜ф暟鎹�-->
+ <select id="selectNoSchedulingMp">
+ select ogd.order_id,
+ o.customer_name,
+ o.project,
+ ogd.order_number,
+ ogd.technology_number,
+ ogd.child_width,
+ ogd.child_height,
+ od.quantity,
+ round(ogd.child_width * ogd.child_height * od.quantity / 1000000, 2) as area,
+ (od.quantity - IFNULL((ps.schedulingQuantity), 0)) as scheduling_quantity,
+ (od.quantity - IFNULL((ps.schedulingQuantity), 0)) as pendingProductionQuantity,
+ round(ogd.child_width * ogd.child_height * (od.quantity - IFNULL((ps.schedulingQuantity), 0)) / 1000000, 2)
+ as pendingProductionArea,
+ IFNULL(ps.schedulingQuantity, 0) as productionScheduledQuantity,
+ round(ogd.child_width * ogd.child_height * (IFNULL(ps.schedulingQuantity, 0)) / 1000000,
+ 2) as productionScheduledArea,
+ ogd.glass_child,
+ od.shape
+ from sd.order_glass_detail as ogd
- </if>
- group by od.order_id,od.order_number
+ left join sd.order as o on ogd.order_id = o.order_id
+ left join sd.order_detail as od 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
+ (select order_id,order_number,technology_number,SUM(scheduling_quantity) as schedulingQuantity from production_scheduling where processes=#{processes} group by order_id,order_number,technology_number) as ps on ps.order_id = ogd.order_id and ps.order_number = ogd.order_number and ps.technology_number=ogd.technology_number
+
+ where (od.quantity - IFNULL((ps.schedulingQuantity), 0)) > 0
+ and od.create_time between #{selectTime1} and #{selectTime2} and opd.reporting_work_num_count=0
+
+ and position(#{orderId} in ogd.order_id)
+-- and position("鍒囧壊" in ps.processes)
+
+ group by ogd.order_id, ogd.order_number,ogd.technology_number
+ order by ogd.order_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(ps.scheduling_quantity,0)) as pendingProductionQuantity,
- round(od.width*od.height*(od.quantity-IFNULL(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.create_time between #{selectTime1} and #{selectTime2}
+ select ogd.order_id,
+ o.customer_name,
+ o.project,
+ ogd.order_number,
+ ogd.technology_number,
+ ogd.child_width,
+ ogd.child_height,
+ od.quantity,
+ round(ogd.child_width * ogd.child_height * od.quantity / 1000000, 2) as area,
+ (od.quantity - IFNULL((ps.schedulingQuantity), 0)) as scheduling_quantity,
+ (od.quantity - IFNULL((ps.schedulingQuantity), 0)) as pendingProductionQuantity,
+ round(ogd.child_width * ogd.child_height * (od.quantity - IFNULL((ps.schedulingQuantity), 0)) / 1000000, 2)
+ as pendingProductionArea,
+ IFNULL(ps.schedulingQuantity, 0) as productionScheduledQuantity,
+ round(ogd.child_width * ogd.child_height * (IFNULL(ps.schedulingQuantity, 0)) / 1000000,
+ 2) as productionScheduledArea,
+ ogd.glass_child,
+ od.shape
+ from sd.order_glass_detail as ogd
+
+ left join sd.order as o on ogd.order_id = o.order_id
+ left join sd.order_detail as od 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
+ (select order_id,order_number,technology_number,SUM(scheduling_quantity) as schedulingQuantity from production_scheduling where processes=#{processes} group by order_id,order_number,technology_number) as ps on ps.order_id = ogd.order_id and ps.order_number = ogd.order_number and ps.technology_number=ogd.technology_number
+
+ where (od.quantity - IFNULL((ps.schedulingQuantity), 0)) > 0
+ and od.create_time between #{selectTime1} and #{selectTime2} and opd.reporting_work_num_count=0
+
+ and position(#{orderId} in ogd.order_id)
+-- and position("鍒囧壊" in ps.processes)
+
+ group by ogd.order_id, ogd.order_number,ogd.technology_number
+ order by ogd.order_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,
+ technology_number,
+ processes,
+ scheduling_quantity,
+ scheduled_start_time,
+ plan_end_time,
+ notes,
+ create_time)
+ VALUES (#{schedulingId},
+ #{orderId},
+ #{orderNumber},
+ #{technologyNumber},
+ #{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