From 2f640b1038fa331954f78ed1f4317212cf5bb34d Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期五, 07 六月 2024 16:56:06 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override

---
 north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java |  136 +++++++++++++++++++++++++++++++++++++--------
 1 files changed, 111 insertions(+), 25 deletions(-)

diff --git a/north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java b/north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java
index 4329b82..c1b7ba5 100644
--- a/north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java
+++ b/north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java
@@ -6,17 +6,16 @@
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.example.erp.entity.pp.FlowCard;
-import com.example.erp.entity.sd.Order;
-import com.example.erp.entity.sd.OrderDetail;
+import com.example.erp.entity.pp.ProductionScheduling;
 import com.example.erp.entity.sd.OrderGlassDetail;
 import com.example.erp.entity.sd.OrderProcessDetail;
 import com.example.erp.mapper.pp.FlowCardMapper;
 import com.example.erp.mapper.sd.OrderGlassDetailMapper;
 import com.example.erp.mapper.sd.OrderProcessDetailMapper;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.sql.Date;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -40,11 +39,11 @@
     }
 
     //娴佺▼鍗$鐞嗘煡璇�
-    public Map<String, Object> selectProcessCard(Integer pageNum, Integer pageSize,Date selectTime1, Date selectTime2, FlowCard flowCard) {
-        Integer offset = (pageNum-1)*pageSize;
+    public Map<String, Object> selectProcessCard(Integer pageNum, Integer pageSize, Date selectTime1, Date selectTime2, FlowCard flowCard) {
+        Integer offset = (pageNum - 1) * pageSize;
         Map<String, Object> map = new HashMap<>();
-        map.put("data", flowCardMapper.selectFlowCard(offset, pageSize,selectTime1, selectTime2, flowCard));
-        map.put("total",flowCardMapper.getPageTotal(offset, pageSize, selectTime1, selectTime2, flowCard));
+        map.put("data", flowCardMapper.selectFlowCard(offset, pageSize, selectTime1, selectTime2, flowCard));
+        map.put("total", flowCardMapper.getPageTotal(offset, pageSize, selectTime1, selectTime2, flowCard));
         return map;
     }
 
@@ -65,14 +64,25 @@
     //鍒犻櫎娴佺▼鍗�
     public Boolean deleteFlowCardSv(String orderId, String processId) {
         if (!orderId.isEmpty() && !processId.isEmpty()) {
+            //鍒ゆ柇璇ユ祦绋嬪崱鏄惁鎶ュ伐
             Integer count = flowCardMapper.reportingWorkCount(processId);
             if (count == 0) {
-                //淇敼璁㈠崟琛ㄥ垎鏋剁姸鎬佷负1,鏈叏閮ㄥ垎鏋跺畬鎴�
-                flowCardMapper.updateProcessingCard(orderId, 1);
+
                 //淇敼鍒嗘灦鐘舵��
                 flowCardMapper.updateDeleteState(orderId, processId);
+                //鍒犻櫎鎶ュ伐娴佺▼鏄庣粏琛ㄦ暟鎹�
+                flowCardMapper.deleteReportingWork(processId);
                 //鍒犻櫎鍒嗘灦鏄庣粏
                 flowCardMapper.deleteFlowCardMp(orderId, processId);
+                //鍒ゆ柇璇ヨ鍗曟祦绋嬪崱鏄惁鍏ㄩ儴鍒犻櫎
+                Integer flowNumber = flowCardMapper.selectFlowCardCount(orderId);
+                if (flowNumber == 0) {
+                    //淇敼璁㈠崟琛ㄥ垎鏋剁姸鎬佷负0,鍏ㄩ儴鍒犻櫎
+                    flowCardMapper.updateProcessingCard(orderId, 0);
+                } else {
+                    //淇敼璁㈠崟琛ㄥ垎鏋剁姸鎬佷负1,鍒犻櫎閮ㄥ垎
+                    flowCardMapper.updateProcessingCard(orderId, 1);
+                }
                 return true;
             } else {
                 return false;
@@ -92,15 +102,13 @@
 
 
     //淇敼鎺掔増鐘舵��
-    public Boolean updateLayoutStatusSv(String processId) {
+    public Boolean updateLayoutStatusSv(String processId, Integer state) {
 
         if (!processId.isEmpty()) {
-            Integer Status = flowCardMapper.selectLayoutStatus(processId);
-            if (Status == 1) {
-                flowCardMapper.updateLayoutStatusMp(processId);
-            } else {
-                return false;
-            }
+//            Integer Status = flowCardMapper.selectLayoutStatus(processId);
+
+            flowCardMapper.updateLayoutStatusMp(processId, state);
+
 
             return true;
         } else {
@@ -126,7 +134,7 @@
                 //鏌ヨ姣忎釜搴忓彿鐨勫眰鏁�
                 Integer layer = flowCardMapper.selectLayer(productionId, flowCard.getOrderNumber());
                 //娣诲姞娴佺▼鍗℃暟鎹�
-                flowCardMapper.addFlowCardMp(flowCard.getProcessId(), flowCard.getOrderNumber(), flowCard.getLandingSequence(), flowCard.getQuantity(), productionId, userName,layer);
+                flowCardMapper.addFlowCardMp(flowCard.getProcessId(), flowCard.getOrderNumber(), flowCard.getLandingSequence(), flowCard.getQuantity(), productionId, userName, layer);
                 //淇敼鍒嗘灦鐘舵�侊紝灏嗙姸鎬佹敼涓�1
                 flowCardMapper.updateFlowState(productionId, flowCard.getOrderNumber());
                 //鏌ヨ璇ヨ鍗曟湭鍒嗘灦鏁伴噺
@@ -142,12 +150,12 @@
                 List<OrderGlassDetail> orderGlassDetailList =
                         orderGlassDetailMapper.selectList(
                                 new QueryWrapper<OrderGlassDetail>()
-                                .eq("order_id", flowCard.getProcessId().substring(0,10))
-                                .eq("order_number", flowCard.getOrderNumber())
+                                        .eq("order_id", flowCard.getProcessId().substring(0, 10))
+                                        .eq("order_number", flowCard.getOrderNumber())
                         );
                 List<OrderProcessDetail> orderProcessDetailList = getOrderProcessDetails(orderGlassDetailList);
                 orderProcessDetailList.forEach(
-                        orderGlassDetail ->orderGlassDetail.setProcessId(flowCard.getProcessId()));
+                        orderGlassDetail -> orderGlassDetail.setProcessId(flowCard.getProcessId()));
 
 
                 //璧嬪�艰鍗曞伐鑹鸿〃
@@ -160,13 +168,13 @@
         }
     }
 
-    public Map<String, Object> selectSchedulingSv(String selectTime1, String selectTime2, String orderId,String processes, Integer state, FlowCard flowCard) {
+    public Map<String, Object> selectSchedulingSv(String selectTime1, String selectTime2, String orderId, String processes, Integer state, FlowCard flowCard) {
         Map<String, Object> map = new HashMap<>();
-        if (state==2){//宸叉帓浜�
-            map.put("data", flowCardMapper.selectOkSchedulingMp(selectTime1, selectTime2,orderId,processes, flowCard));
+        if (state == 2) {//宸叉帓浜�
+            map.put("data", flowCardMapper.selectOkSchedulingMp(selectTime1, selectTime2, orderId, processes, flowCard));
 
-        }else if (state==1){//鏈帓浜�
-            map.put("data", flowCardMapper.selectNoSchedulingMp(selectTime1, selectTime2,orderId,processes, flowCard));
+        } else if (state == 1) {//鏈帓浜�
+            map.put("data", flowCardMapper.selectNoSchedulingMp(selectTime1, selectTime2, orderId, processes, flowCard));
 
         }
 
@@ -180,4 +188,82 @@
         map.put("data", flowCardMapper.selectLastSchedulingMp(selectTime1, selectTime2, flowCard));
         return map;
     }
+
+    public Object flowCardDetailSv(String processId, FlowCard flowCard) {
+        Map<String, Object> map = new HashMap<>();
+        map.put("data", flowCardMapper.flowCardDetailMp(processId, flowCard));
+        return map;
+    }
+
+    public Object selectPrintFlowCardSv(Date selectTime1, Date selectTime2, String orderId, String project, FlowCard flowCard) {
+        if ("null".equals(orderId)) {
+            orderId = "";
+        }
+        if ("null".equals(project)) {
+            project = "";
+        }
+        Map<String, Object> map = new HashMap<>();
+        map.put("data", flowCardMapper.selectPrintFlowCardMp(selectTime1, selectTime2, orderId, project, flowCard));
+        return map;
+    }
+
+    public Object selectPrintSv(String orderId, FlowCard flowCard) {
+        Map<String, Object> map = new HashMap<>();
+        map.put("data", flowCardMapper.selectPrintMp(orderId, flowCard));
+        return map;
+    }
+
+    public Map<String, Object> getSelectPrintingSv(Map<String, Object> object) {
+        Map<String, Object> map = new HashMap<>();
+        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();//鏈�缁堢粨鏋�
+        List<FlowCard> flowCardList = JSONArray.parseArray(JSONObject.toJSONString(object.get("printList")), FlowCard.class);
+        if (!flowCardList.isEmpty()) {
+            for (FlowCard flowCard : flowCardList) {
+                Map<String, Object> itemmap = new HashMap<>();
+                //娴佺▼鍗¤〃澶磋〃灏炬暟鎹�
+                itemmap.put("detail", flowCardMapper.getPrimaryList(flowCard.getProcessId(), flowCard.getTechnologyNumber()));
+                //娴佺▼鍗℃槑缁嗘暟鎹�
+                List<Map<String, Object>> detailList = flowCardMapper.getDetailList(flowCard.getProcessId(), flowCard.getTechnologyNumber());
+                //宸ヨ壓娴佺▼
+                List<Map<String, Object>> processList = flowCardMapper.getProcessList(flowCard.getProcessId(), flowCard.getTechnologyNumber());
+                itemmap.put("detailList", detailList);
+                itemmap.put("processList", processList);
+                list.add(itemmap);
+
+
+            }
+        }
+        map.put("data", list);
+        return map;
+    }
+
+    public Boolean updateComposingSv(Map<String, Object> object) {
+        List<FlowCard> flowCardList = JSONArray.parseArray(JSONObject.toJSONString(object.get("composing")), FlowCard.class);
+        if (!flowCardList.isEmpty()) {
+            for (FlowCard flowCard : flowCardList) {
+                flowCardMapper.updateComposing(flowCard.getProcessId());
+            }
+            return true;
+        }
+        else {
+            return false;
+
+        }
+    }
+
+    public Map<String, Object> getSelectPrintLabelSv(Map<String, Object> object) {
+        Map<String, Object> map = new HashMap<>();
+        List<FlowCard> flowCardList = JSONArray.parseArray(JSONObject.toJSONString(object.get("printList")), FlowCard.class);
+        if (!flowCardList.isEmpty()) {
+            for (FlowCard flowCard : flowCardList) {
+                Integer count=flowCard.getQuantity();
+                for (int i = 0; i < count; i++) {
+                    map.put("data", flowCardMapper.getPrintLabel(flowCard.getProcessId(), flowCard.getTechnologyNumber()));
+                    //System.out.println(flowCardMapper.getPrintLabel(flowCard.getProcessId(), flowCard.getTechnologyNumber()));
+                }
+            }
+        }
+
+        return map;
+    }
 }

--
Gitblit v1.8.0