From ad7b64d59cfdcd95c5da328d0e0b349df401eaf4 Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期四, 18 四月 2024 09:53:46 +0800
Subject: [PATCH] 提交拉取

---
 north-glass-erp/src/main/java/com/example/erp/service/pp/ProductionSchedulingService.java |  107 +++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 98 insertions(+), 9 deletions(-)

diff --git a/north-glass-erp/src/main/java/com/example/erp/service/pp/ProductionSchedulingService.java b/north-glass-erp/src/main/java/com/example/erp/service/pp/ProductionSchedulingService.java
index 4b71fc6..75c9eb4 100644
--- a/north-glass-erp/src/main/java/com/example/erp/service/pp/ProductionSchedulingService.java
+++ b/north-glass-erp/src/main/java/com/example/erp/service/pp/ProductionSchedulingService.java
@@ -4,12 +4,15 @@
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.example.erp.entity.pp.ProductionScheduling;
+import com.example.erp.entity.sd.OrderDetail;
 import com.example.erp.mapper.pp.ProductionSchedulingMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.sql.Date;
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -20,15 +23,22 @@
     @Autowired
     ProductionSchedulingMapper productionSchedulingMapper;
 
-    //甯︽椂闂存煡璇�
-    public Map<String, Object> SelectSchedulingSv(String selectTime1, String selectTime2, String orderId,String processes, Integer state, ProductionScheduling productionScheduling ) {
+    //鏈帓浜ф煡璇�
+    public Map<String, Object> selectSchedulingSv(String selectTime1, String selectTime2, String orderId,String processes, Integer state, ProductionScheduling productionScheduling ) {
         Map<String, Object> map = new HashMap<>();
+        if("null".equals(orderId)){
+            orderId="";
+        }
+        if ("null".equals(processes)){
+
+            processes="";
+        }
 
         if (state==2){//宸叉帓浜�
-            map.put("data", productionSchedulingMapper.SelectOkSchedulingMp(selectTime1, selectTime2,orderId,processes, productionScheduling));
+            map.put("data", productionSchedulingMapper.selectOkSchedulingMp(selectTime1, selectTime2,orderId,processes, productionScheduling));
 
         }else if (state==1){//鏈帓浜�
-            map.put("data", productionSchedulingMapper.SelectNoSchedulingMp(selectTime1, selectTime2,orderId,processes, productionScheduling));
+            map.put("data", productionSchedulingMapper.selectNoSchedulingMp(selectTime1, selectTime2,orderId,processes, productionScheduling));
 
         }
 
@@ -37,16 +47,95 @@
 
 
     //棣栨鏌ヨ鎺掍骇鏁版嵁
-    public Map<String, Object> selectLastScheduling(String selectTime1, String selectTime2,ProductionScheduling productionScheduling ) {
+    public Map<String, Object> selectLastScheduling(String selectTime1, String selectTime2,String processes,String orderId,ProductionScheduling productionScheduling ) {
         Map<String, Object> map = new HashMap<>();
-        map.put("data", productionSchedulingMapper.selectLastSchedulingMp(selectTime1, selectTime2, productionScheduling));
+        if("null".equals(orderId)){
+            orderId="";
+        }
+        if ("null".equals(processes)){
+
+            processes="";
+        }
+        map.put("data", productionSchedulingMapper.selectLastSchedulingMp(selectTime1, selectTime2,processes,orderId, productionScheduling));
+        map.put("process", productionSchedulingMapper.selectProcess());
         return map;
     }
 
     //甯﹁鍗曞彿鏌ヨ
-    public Map<String, Object> SelectSchedulingNotSv(String selectTime1, String selectTime2, String orderId, String processes, Integer state, ProductionScheduling productionScheduling) {
+    public Map<String, Object> selectSchedulingNotSv(String selectTime1, String selectTime2, String orderId, String processes, Integer state, ProductionScheduling productionScheduling) {
         Map<String, Object> map = new HashMap<>();
-        map.put("data", productionSchedulingMapper.SelectSchedulingNotMp(selectTime1, selectTime2,orderId,processes, productionScheduling));
+        map.put("data", productionSchedulingMapper.selectSchedulingNotMp(selectTime1, selectTime2,orderId,processes, productionScheduling));
         return map;
     }
+
+    public Boolean addSchedulingSv(Map<String, Object> object) {
+        String userName = "";
+        if (object.get("userName") != null) {
+            userName = object.get("userName").toString();
+        }
+        String processes = "";
+        if (object.get("processes") != null) {
+            processes = object.get("processes").toString();
+        }
+
+        Integer maxId = productionSchedulingMapper.selectMaxId();
+        //鏌ヨ璁㈠崟id锛屽苟涓旇嚜澧�
+        String formattedNumber = String.format("%02d", maxId+1);
+        //鏍煎紡鍖栧綋鍓嶆棩鏈�
+        java.util.Date currentDate = new Date();
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyMMdd");
+        String formattedDate = dateFormat.format(currentDate);
+        String schedulingId =  "PC"+formattedDate+formattedNumber;
+
+        List<ProductionScheduling> schedulinglist = JSONArray.parseArray(JSONObject.toJSONString(object.get("scheduling")), ProductionScheduling.class);
+        if (!schedulinglist.isEmpty()) {
+            for (ProductionScheduling productionScheduling : schedulinglist) {
+                //鏌ヨ宸叉帓浜у伐搴忔暟閲�
+             // Integer num =  productionSchedulingMapper.selectNumberMp(productionScheduling.getOrderId(),productionScheduling.getOrderNumber(),processes);
+
+             productionSchedulingMapper.insertSelective(schedulingId,productionScheduling.getOrderId(),productionScheduling.getOrderNumber(),productionScheduling.getTechnologyNumber(),processes,productionScheduling.getSchedulingQuantity(),productionScheduling.getScheduledStartTime(),productionScheduling.getPlanEndTime(),productionScheduling.getNotes());
+                //System.out.println(productionScheduling.getOrderNumber()+"***"+productionScheduling.getTechnologyNumber());
+            }
+            return true;
+        }
+        else {
+            return false;
+
+        }
+
+    }
+
+    public boolean deleteSchedulingSv(Map<String, Object> object) throws Exception {
+        JSONObject objJson = new JSONObject(object);
+        List<ProductionScheduling> Scheduling = JSONArray.parseArray(JSONObject.toJSONString(objJson.get("scheduling")), ProductionScheduling.class);
+        if (!Scheduling.isEmpty()) {
+            for (ProductionScheduling productionScheduling : Scheduling) {
+                productionSchedulingMapper.deleteSchedulingMp(productionScheduling.getSchedulingId());
+                // System.out.println(productionScheduling.getOrderNumber()+"***"+productionScheduling.getOrderId());
+            }
+            return true;
+        }
+        else {
+            return false;
+        }
+    }
+
+    public boolean examineSchedulingSv(Map<String, Object> object) {
+        String userName = "";
+        if (object.get("userName") != null) {
+            userName = object.get("userName").toString();
+        }
+        List<ProductionScheduling> schedulinglist = JSONArray.parseArray(JSONObject.toJSONString(object.get("scheduling")), ProductionScheduling.class);
+
+        if (!schedulinglist.isEmpty()) {
+            for (ProductionScheduling productionScheduling : schedulinglist) {
+                productionSchedulingMapper.examineSchedulingMp(productionScheduling.getSchedulingId(),userName);
+                // System.out.println(productionScheduling.getOrderNumber()+"***"+productionScheduling.getOrderId());
+            }
+            return true;
+        }
+        else {
+            return false;
+        }
+    }
 }

--
Gitblit v1.8.0