From b8982b86a15d186c4cf6144fface700d9769fa95 Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期五, 21 三月 2025 09:13:13 +0800
Subject: [PATCH] Merge branch 'master' of http://bore.pub:10439/r/ERP_override
---
north-glass-erp/src/main/java/com/example/erp/service/pp/ProductionSchedulingService.java | 137 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 137 insertions(+), 0 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
new file mode 100644
index 0000000..94449b7
--- /dev/null
+++ b/north-glass-erp/src/main/java/com/example/erp/service/pp/ProductionSchedulingService.java
@@ -0,0 +1,137 @@
+
+package com.example.erp.service.pp;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.example.erp.entity.pp.ProductionScheduling;
+import com.example.erp.mapper.pp.ProductionSchedulingMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+@DS("pp")
+public class ProductionSchedulingService {
+ @Autowired
+ ProductionSchedulingMapper productionSchedulingMapper;
+
+ //鏈帓浜ф煡璇�
+ public Map<String, Object> selectSchedulingSv(Integer pageNum, Integer pageSize, String selectTime1, String selectTime2, String orderIds, String processes, Integer state, ProductionScheduling productionScheduling ) {
+
+ Integer offset = (pageNum - 1) * pageSize;
+ Map<String, Object> map = new HashMap<>();
+ if("null".equals(orderIds)){
+ orderIds="";
+ }
+ if ("null".equals(processes)){
+
+ processes="";
+ }
+
+ if (state==2){//宸叉帓浜�
+ map.put("data", productionSchedulingMapper.selectOkSchedulingMp(offset, pageSize,selectTime1, selectTime2,orderIds,processes, productionScheduling));
+ map.put("total", productionSchedulingMapper.getOkPageTotal(offset, pageSize,selectTime1, selectTime2,orderIds,processes, productionScheduling));
+
+ }else if (state==1){//鏈帓浜�
+ map.put("data", productionSchedulingMapper.selectNoSchedulingMp(offset, pageSize,selectTime1, selectTime2,orderIds,processes, productionScheduling));
+ map.put("total", productionSchedulingMapper.getPageTotal(offset, pageSize,selectTime1, selectTime2,orderIds,processes, productionScheduling));
+
+ }
+ return map;
+ }
+
+
+ //棣栨鏌ヨ鎺掍骇鏁版嵁
+ public Map<String, Object> selectLastScheduling(String selectTime1, String selectTime2,String processes,String orderId,ProductionScheduling productionScheduling ) {
+ Map<String, Object> map = new HashMap<>();
+ map.put("process", productionSchedulingMapper.selectProcess());
+ 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.getOrderGlassDetail().getOrderId(),productionScheduling.getOrderNumber(),productionScheduling.getTechnologyNumber(),processes,productionScheduling.getSchedulingQuantity(),productionScheduling.getScheduledStartTime(),productionScheduling.getPlanEndTime(),productionScheduling.getNotes());
+ }
+ 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());
+ }
+ 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,productionScheduling.getSchedulingQuantity(),productionScheduling.getNotes());
+ }
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ public boolean cancelReviewSchedulingSv(Map<String, Object> object) {
+ List<ProductionScheduling> schedulinglist = JSONArray.parseArray(JSONObject.toJSONString(object.get("scheduling")), ProductionScheduling.class);
+
+ if (!schedulinglist.isEmpty()) {
+ for (ProductionScheduling productionScheduling : schedulinglist) {
+ productionSchedulingMapper.cancelReviewSchedulingMp(productionScheduling.getSchedulingId());
+ }
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+}
--
Gitblit v1.8.0