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/java/com/example/erp/service/pp/ProductionSchedulingService.java |   38 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 37 insertions(+), 1 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..0476821 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
@@ -5,11 +5,13 @@
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.dynamic.datasource.annotation.DS;
 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;
@@ -49,4 +51,38 @@
         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) {
+               productionSchedulingMapper.insertSelective(schedulingId,productionScheduling.getOrderId(),productionScheduling.getOrderNumber(),processes,productionScheduling.getSchedulingQuantity(),productionScheduling.getScheduledStartTime(),productionScheduling.getPlanEndTime(),productionScheduling.getNotes());
+               // System.out.println(productionScheduling.getOrderNumber()+"***"+productionScheduling.getOrderId());
+            }
+            return true;
+        }
+        else {
+            return false;
+
+        }
+
+    }
 }

--
Gitblit v1.8.0