From 613e4e92157dd697629dbad17fd091ae37637bc7 Mon Sep 17 00:00:00 2001
From: guoyujie <guoyujie@ng.com>
Date: 星期一, 17 十一月 2025 08:50:44 +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 |  372 ++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 299 insertions(+), 73 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 942c48b..738d9e2 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,15 +6,20 @@
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.example.erp.common.Constants;
+import com.example.erp.common.Result;
 import com.example.erp.entity.pp.FlowCard;
 import com.example.erp.entity.sd.*;
 import com.example.erp.entity.userInfo.Log;
+import com.example.erp.entity.userInfo.SysError;
 import com.example.erp.exception.ServiceException;
 import com.example.erp.mapper.pp.FlowCardMapper;
 import com.example.erp.mapper.pp.ReportingWorkMapper;
 import com.example.erp.mapper.sd.*;
 import com.example.erp.service.userInfo.LogService;
+import com.example.erp.service.userInfo.SysErrorService;
+import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.time.LocalDate;
@@ -22,6 +27,9 @@
 import java.util.Map;
 
 import com.fasterxml.jackson.core.type.TypeReference;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
+
 import java.io.IOException;
 
 
@@ -49,6 +57,8 @@
     private final OrderDetailMapper orderDetailMapper;
     private final OrderMapper orderMapper;
     private final ReportingWorkMapper reportingWorkMapper;
+    @Autowired
+    SysErrorService sysErrorService;
 
     public FlowCardService(FlowCardMapper flowCardMapper, OrderGlassDetailMapper orderGlassDetailMapper,
                            OrderProcessDetailMapper orderProcessDetailMapper, LogService logService,
@@ -65,6 +75,25 @@
         this.reportingWorkMapper = reportingWorkMapper;
     }
 
+    //灏嗗眰鏁板瓧绗︿覆鐢ㄩ�楀彿闅斿紑
+    public static String splitTechNumbers(String input) {
+        if (input == null || input.isEmpty()) {
+            return "";
+        }
+
+        List<String> result = new ArrayList<>();
+        for (int i = 0; i < input.length(); i++) {
+            // 鐗规畩澶勭悊 "10"
+            if (input.charAt(i) == '1' && i + 1 < input.length() && input.charAt(i + 1) == '0') {
+                result.add("10");
+                i++; // 璺宠繃涓嬩竴涓瓧绗�
+            } else {
+                result.add(String.valueOf(input.charAt(i)));
+            }
+        }
+
+        return String.join(",", result);
+    }
     //娴佺▼鍗$鐞嗘煡璇�
     public Map<String, Object> selectProcessCard(Integer pageNum, Integer pageSize,List<String> selectDate, FlowCard flowCard) {
         Integer offset = (pageNum - 1) * pageSize;
@@ -180,59 +209,76 @@
     }
 
     //淇濆瓨娴佺▼鍗℃暟鎹�
+    @Transactional(rollbackFor = Exception.class)
     public Boolean addFlowCardSv(String orderId, Map<String, Object> object) {
-        String userName = "";
-        if (object.get("userName") != null) {
-            userName = object.get("userName").toString();
-        }
-        String productionId = "";
-        if (object.get("productionId") != null) {
-            productionId = object.get("productionId").toString();
-        }
-
-        List<FlowCard> FlowCardList = JSONArray.parseArray(JSONObject.toJSONString(object.get("flowCard")), FlowCard.class);
-        if (!FlowCardList.isEmpty()) {
-            for (FlowCard flowCard : FlowCardList) {
-                //鏌ヨ姣忎釜搴忓彿鐨勫眰鏁�
-                Integer layer = flowCardMapper.selectLayer(productionId, flowCard.getOrderNumber());
-                //娣诲姞娴佺▼鍗℃暟鎹�
-                flowCardMapper.addFlowCardMp(flowCard.getProcessId(), flowCard.getOrderNumber(), flowCard.getLandingSequence(), flowCard.getQuantity(), productionId, userName, layer);
-                //淇敼鍒嗘灦鐘舵�侊紝灏嗙姸鎬佹敼涓�1
-                flowCardMapper.updateFlowState(productionId, flowCard.getOrderNumber());
-                //鏌ヨ璇ヨ鍗曟湭鍒嗘灦鏁伴噺
-                Integer FlowCount = flowCardMapper.selectFlowCount(orderId);
-                if (FlowCount == 0) {
-                    //淇敼璁㈠崟琛ㄥ垎鏋剁姸鎬佷负2
-                    flowCardMapper.updateProcessingCard(orderId, 2);
-                } else {
-                    //淇敼璁㈠崟琛ㄥ垎鏋剁姸鎬佷负1,鏈叏閮ㄥ垎鏋跺畬鎴�
-                    flowCardMapper.updateProcessingCard(orderId, 1);
-                }
-                //鏌ヨ璁㈠崟灏忕墖琛ㄨ幏鍙栧伐鑹轰紶鍏ュ皬鐗囧伐鑹鸿〃
-                List<OrderGlassDetail> orderGlassDetailList =
-                        orderGlassDetailMapper.selectList(
-                                new QueryWrapper<OrderGlassDetail>()
-                                        .eq("order_id", orderId)
-                                        .eq("order_number", flowCard.getOrderNumber())
-                        );
-                List<OrderProcessDetail> orderProcessDetailList = getOrderProcessDetails(orderGlassDetailList);
-                orderProcessDetailList.forEach(
-                        orderGlassDetail -> orderGlassDetail.setProcessId(flowCard.getProcessId()));
-
-                //璧嬪�艰鍗曞伐鑹鸿〃
-                orderProcessDetailMapper.insertOrderProcessDetail(orderProcessDetailList);
+        boolean saveState = true;
+        //璁剧疆鍥炴粴鐐�
+        Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint();
+        try {
+            String userName = "";
+            if (object.get("userName") != null) {
+                userName = object.get("userName").toString();
             }
-            //淇濆瓨鏃ュ織
-            Log log = new Log();
-            log.setContent(object.toString());
-            log.setFunction("addFlowCardSv娴佺▼鍗℃柊澧�");
-            log.setOperatorId((String) object.get("userId"));
-            log.setOperator((String) object.get("userName"));
-            logService.saveLog(log);
-            return true;
-        } else {
-            return false;
+            String productionId = "";
+            if (object.get("productionId") != null) {
+                productionId = object.get("productionId").toString();
+            }
+
+            List<FlowCard> FlowCardList = JSONArray.parseArray(JSONObject.toJSONString(object.get("flowCard")), FlowCard.class);
+            if (!FlowCardList.isEmpty()) {
+                for (FlowCard flowCard : FlowCardList) {
+                    //鏌ヨ姣忎釜搴忓彿鐨勫眰鏁�
+                    Integer layer = flowCardMapper.selectLayer(productionId, flowCard.getOrderNumber());
+                    //娣诲姞娴佺▼鍗℃暟鎹�
+                    flowCardMapper.addFlowCardMp(flowCard.getProcessId(), flowCard.getOrderNumber(), flowCard.getLandingSequence(), flowCard.getQuantity(), productionId, userName, layer);
+                    //淇敼鍒嗘灦鐘舵�侊紝灏嗙姸鎬佹敼涓�1
+                    flowCardMapper.updateFlowState(productionId, flowCard.getOrderNumber());
+                    //鏌ヨ璇ヨ鍗曟湭鍒嗘灦鏁伴噺
+                    Integer FlowCount = flowCardMapper.selectFlowCount(orderId);
+                    if (FlowCount == 0) {
+                        //淇敼璁㈠崟琛ㄥ垎鏋剁姸鎬佷负2
+                        flowCardMapper.updateProcessingCard(orderId, 2);
+                    } else {
+                        //淇敼璁㈠崟琛ㄥ垎鏋剁姸鎬佷负1,鏈叏閮ㄥ垎鏋跺畬鎴�
+                        flowCardMapper.updateProcessingCard(orderId, 1);
+                    }
+                    //鏌ヨ璁㈠崟灏忕墖琛ㄨ幏鍙栧伐鑹轰紶鍏ュ皬鐗囧伐鑹鸿〃
+                    List<OrderGlassDetail> orderGlassDetailList =
+                            orderGlassDetailMapper.selectList(
+                                    new QueryWrapper<OrderGlassDetail>()
+                                            .eq("order_id", orderId)
+                                            .eq("order_number", flowCard.getOrderNumber())
+                            );
+                    List<OrderProcessDetail> orderProcessDetailList = getOrderProcessDetails(orderGlassDetailList);
+                    orderProcessDetailList.forEach(
+                            orderGlassDetail -> orderGlassDetail.setProcessId(flowCard.getProcessId()));
+
+                    //璧嬪�艰鍗曞伐鑹鸿〃
+                    orderProcessDetailMapper.insertOrderProcessDetail(orderProcessDetailList);
+                }
+                //淇濆瓨鏃ュ織
+                Log log = new Log();
+                log.setContent(object.toString());
+                log.setFunction("addFlowCardSv娴佺▼鍗℃柊澧�");
+                log.setOperatorId((String) object.get("userId"));
+                log.setOperator((String) object.get("userName"));
+                logService.saveLog(log);
+            } else {
+                saveState = false;
+            }
+
+        } catch (Exception e) {
+            TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint);
+            //灏嗗紓甯镐紶鍏ユ暟鎹簱
+            SysError sysError = new SysError();
+            sysError.setError(e+Arrays.toString(e.getStackTrace()));
+            sysError.setFunc("updateFinishedGoodsInventoryAllocate");
+            sysErrorService.insert(sysError);
+            saveState = false;
+
         }
+        return saveState;
+
     }
 
     public Map<String, Object> selectSchedulingSv(String selectTime1, String selectTime2, String orderId, String processes, Integer state, FlowCard flowCard) {
@@ -373,7 +419,7 @@
                     //鑾峰彇宸ュ簭瀵瑰簲鐨勫埆绉�
                     String processName = flowCardMapper.getProcessName(processSub);
                     //processName.equals("stepC") || processName.equals("stepD")
-                    if (processName.equals("stepC") || processName.equals("stepD")) {//宸ヨ壓鏄惁鍖呭惈澶硅兌涓┖
+                    if (processName.equals("stepC") || processName.equals("stepD")) {//宸ヨ壓鏄惁鍖呭惈澶硅兌涓┖锛屾祦绋嬪崱鏌ヨ鍚堝苟
                         itemmap.put("detail", flowCardMapper.getPrimaryListLimt(flowCard.getProcessId(),
                                 String.valueOf("null".equals(compound)
                                         ? flowCard.getTechnologyNumber()//姝e父灞�
@@ -383,14 +429,14 @@
                         if (compound == null
                                 || "null".equals(compound)
                                 || compound.trim().isEmpty()){
-                            List<Map<String, Object>> detailList = flowCardMapper.getDetailList(flowCard.getProcessId(), flowCard.getTechnologyNumber(), flowCard.getProcess(),flashback,landingSequence);
+                            List<Map<String, Object>> detailList = flowCardMapper.getDetailList(flowCard.getProcessId(), splitTechNumbers(flowCard.getTechnologyNumber()), flowCard.getProcess(),flashback,landingSequence);
                             itemmap.put("detailList", detailList);
                         }else {//鏈夐渶瑕佸悓鏋剁殑灞�
-                            List<Map<String, Object>> detailList = flowCardMapper.getDetailCompoundList(flowCard.getProcessId(), flowCard.getTechnologyNumber(), flowCard.getProcess(),flashback,compound,landingSequence);
+                            List<Map<String, Object>> detailList = flowCardMapper.getDetailCompoundList(flowCard.getProcessId(), splitTechNumbers(flowCard.getTechnologyNumber()), flowCard.getProcess(),flashback,splitTechNumbers(compound),landingSequence);
                             itemmap.put("detailList", detailList);
                         }
                     } else {
-                        if (merge.equals("1") && flowCard.getMerge().equals(1)) {//鍚�
+                        if (merge.equals("1") && flowCard.getMerge().equals(1)) {//鏈惎鐢�,閰嶇疆鏂囦欢flowCardMerge鍊间负1
                             // 妫�鏌ユ槸鍚﹀凡缁忓鐞嗚繃璇� processId锛屽鏋滃鐞嗚繃鍒欒烦杩�
                             if (processedKeys.contains(uniqueKey)) {
                                 continue;
@@ -409,29 +455,17 @@
                             if (compound == null
                                     || "null".equals(compound)
                                     || compound.trim().isEmpty()){
-                                List<Map<String, Object>> detailList = flowCardMapper.getDetailListLike(flowCard.getProcessId(), String.valueOf(flowCard.getTechnologyNumber()), flowCard.getProcess(),flashback,landingSequence);
+
+                                List<Map<String, Object>> detailList = flowCardMapper.getDetailListLike(flowCard.getProcessId(), splitTechNumbers(flowCard.getTechnologyNumber()), flowCard.getProcess(),flashback,landingSequence);
                                 itemmap.put("detailList", detailList);
                             }else {//鏈夐渶瑕佸悓鏋剁殑灞�
-                                List<Map<String, Object>> detailList = flowCardMapper.getDetailListLikeCompound(flowCard.getProcessId(), String.valueOf(flowCard.getTechnologyNumber()), flowCard.getProcess(),flashback,compound,landingSequence);
+                                List<Map<String, Object>> detailList = flowCardMapper.getDetailListLikeCompound(flowCard.getProcessId(), splitTechNumbers(flowCard.getTechnologyNumber()), flowCard.getProcess(),flashback,splitTechNumbers(compound),landingSequence);
                                 itemmap.put("detailList", detailList);
                             }
                         }
 
                     }
 
-                } else {//鍚�
-                    //娴佺▼鍗℃槑缁嗘暟鎹�
-                    if (printLike.equals("") || printLike.equals("null")) {
-                        itemmap.put("detail", flowCardMapper.getPrimaryListMerge(flowCard.getProcessId(), printMerge, flowCard.getOrderId()));
-
-                        List<Map<String, Object>> detailList = flowCardMapper.getDetailList(flowCard.getProcessId(), flowCard.getTechnologyNumber(), flowCard.getProcess(), flashback, landingSequence);
-                        itemmap.put("detailList", detailList);
-                    } else {
-                        itemmap.put("detail", flowCardMapper.getPrimaryList(flowCard.getProcessId(), String.valueOf(flowCard.getTechnologyNumber()), flowCard.getGlassChild(), flowCard.getProcess(), flowCard.getOrderId()));
-
-                        List<Map<String, Object>> detailList = flowCardMapper.getDetailListLike(flowCard.getProcessId(), printMerge, flowCard.getProcess(), flashback, landingSequence);
-                        itemmap.put("detailList", detailList);
-                    }
                 }
 
                 //宸ヨ壓娴佺▼
@@ -728,12 +762,19 @@
                     // 鍒ゆ柇鏄惁涓洪潪绌哄瓧绗︿覆
                     if (orderNumber != null && !orderNumber.trim().isEmpty()) {
 
-                        itemmap.put("data", flowCardMapper.getPrintCustomDataSemi(
+                        List<Map<String, Object>> customDataSemi =flowCardMapper.getPrintCustomDataSemi(
                                 flowCard.getProcessId(),
                                 flowCard.getTechnologyNumber(),
                                 flowCard.getProcess(),
-                                flowCard.getOrderNumber(), flowCard.getPrintQuantity()
-                        ));
+                                flowCard.getOrderNumber(), flowCard.getPrintQuantity());
+                        for (Map<String, Object> dataMap : customDataSemi) {
+                            dataMap.put("newList", flowCardMapper.getgetPrintCustomDataSemiSp(
+                                    flowCard.getProcessId(),
+                                    dataMap.get("technologyNumber").toString(),
+                                    flowCard.getOrderNumber()
+                            ));
+                        }
+                        itemmap.put("data", customDataSemi);
                     } else {
                             //鐢ㄤ簬澶╂触鐜板満娴佺▼鍗℃墦鍗扮晫闈㈢殑灏忕墖鏍囩鎵撳嵃
                         itemmap.put("data", flowCardMapper.getPrintCustomDataSemiTj(
@@ -1227,6 +1268,19 @@
         return map;
     }
 
+    public Map<String, Object> selectPrintProjectDetailSmallPiece(Map<String, Object> object) throws JsonProcessingException {
+        Map<String, Object> map = new HashMap<>();
+        String projectNo=object.get("projectNo").toString();
+        String stockIdsStr=object.get("stockId").toString();
+        ObjectMapper objectMapper = new ObjectMapper();
+        if (stockIdsStr != null && !stockIdsStr.isEmpty()) {
+            List<Integer> list = objectMapper.readValue(stockIdsStr, new TypeReference<List<Integer>>() {});
+            map.put("data", flowCardMapper.getPrintProjectDetailsMpSp(projectNo,list));
+        }
+
+        return map;
+    }
+
     public Map<String, Object> getPrintCustomDataProjectNoDetailSv(String type, Integer detailType, Map<String, Object> object) {
         Map<String, Object> map = new HashMap<>();
         List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();//鏈�缁堢粨鏋�
@@ -1236,7 +1290,8 @@
                 Map<String, Object> itemmap = new HashMap<>();
                 //鏄惁鏄伐绋嬫槑缁嗘墦鍗�
                 if (detailType == 0) {//宸ョ▼鎵撳嵃鏄庣粏
-                    itemmap.put("data", flowCardMapper.getPrintCustomDataProjectDetail(flowCard.getProjectNo(), flowCard.getStockId()));
+                        itemmap.put("data", flowCardMapper.getPrintCustomDataProjectDetail(flowCard.getProjectNo(), flowCard.getStockId(),flowCard.getPolysId()));
+
 
                 }
                 //闈炲伐绋嬫墦鍗�
@@ -1440,6 +1495,9 @@
 
                 if (orderDetail.getQuantity() > shelfQuantity) {
                     newOrderDetail.setProcessId(processId);
+                    newOrderDetail.setLongSide(orderDetail.getLongSide());
+                    newOrderDetail.setShortSide(orderDetail.getShortSide());
+                    newOrderDetail.setBuildingNumber(orderDetail.getBuildingNumber());
                     newOrderDetail.setQuantity(Long.valueOf(shelfQuantity));
                     newOrderDetail.setHeight(orderDetail.getHeight());
                     newOrderDetail.setWidth(orderDetail.getWidth());
@@ -1453,6 +1511,10 @@
                     shelfQuantity = shelfQuantity - shelfQuantity;
                 } else {
                     newOrderDetail.setProcessId(processId);
+                    newOrderDetail.setLongSide(orderDetail.getLongSide());
+                    newOrderDetail.setShortSide(orderDetail.getShortSide());
+                    newOrderDetail.setBuildingNumber(orderDetail.getBuildingNumber());
+
                     newOrderDetail.setQuantity(orderDetail.getQuantity());
                     newOrderDetail.setHeight(orderDetail.getHeight());
                     newOrderDetail.setWidth(orderDetail.getWidth());
@@ -1515,12 +1577,30 @@
 
     public Boolean updateTerminationSv(String processId, Integer orderNumber, Integer value) {
         if (processId!=""){
+
             flowCardMapper.updateTerminationMp(processId,orderNumber,value);
+            //鑾峰彇缁堟鏁伴噺涓庢祦绋嬪崱鏁伴噺姣旇緝
+            Map<String, Object> data = flowCardMapper.getTerminationQuantity(processId,orderNumber);
+            Integer terminationNum = (Integer) data.get("termination_quantity");
+            Integer totalNum = (Integer) data.get("quantity");
+            if (terminationNum==totalNum){
+                flowCardMapper.updateTerminationStatus(processId,orderNumber);
+            }
             return true;
         }else {
             return false;
         }
 
+    }
+
+    public Boolean updateTerminationNoSv(String processId, Integer orderNumber) {
+        if (processId!=""){
+            flowCardMapper.updateTerminationNoMp(processId,orderNumber);
+
+            return true;
+        }else {
+            return false;
+        }
     }
 
     public Map<String, Object> selectCompletedSv(String processId, Integer orderNumber, String process) {
@@ -1532,6 +1612,152 @@
 
         return map;
     }
+
+//    public Map<String, Object> getSelectPrintingConsolidatedSv(Map<String, Object> object, String printMerge, String printLike, String mergeTechnologyNumber) {
+//        if (printMerge == null) {
+//            printMerge = "";
+//        }
+//        if (printLike == null) {
+//            printLike = "";
+//        }
+//        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()) {
+//            Set<String> processedKeys = new HashSet<>();
+//            for (FlowCard flowCard : flowCardList) {
+//                String batch = flowCard.getOrder().getBatch();
+//                String glassChild = flowCard.getGlassChild();
+//                Map<String, Object> itemmap = new HashMap<>();
+//                //娴佺▼鍗¤〃澶磋〃灏炬暟鎹�
+//                itemmap.put("detail", flowCardMapper.getPrimaryListRefund(flowCard.getProcessId(), String.valueOf(flowCard.getTechnologyNumber()), flowCard.getOrderNumber(), flowCard.getReportingWorkId(), mergeTechnologyNumber, flowCard.getPatchReason(), flowCard.getOrderId()));
+//
+//                List<Map<String, Object>> detailList = flowCardMapper.getDetailListRefund(flowCard.getProcessId(), flowCard.getTechnologyNumber(), flowCard.getOrderNumber(), flowCard.getReportingWorkId(), flowCard.getPatchReason());
+//                itemmap.put("detailList", detailList);
+//                //宸ヨ壓娴佺▼
+//                List<Map<String, Object>> processList = flowCardMapper.getProcessList(flowCard.getProcessId(), flowCard.getTechnologyNumber());
+//                //宸ュ簭鍒楄〃
+//                List<Map<String, Object>> processNameList = flowCardMapper.getProcessNameList();
+//                itemmap.put("processList", processList);
+//                itemmap.put("processNameList", processNameList);
+//                //  itemmap.put("numberList", numberList);
+//                list.add(itemmap);
+//
+//            }
+//        }
+//        map.put("data", list);
+//        //鍒濆鍖栧��
+//        printLike = null;
+//        return map;
+//    }
+
+    public Map<String, Object> getSelectPrintingConsolidatedSv(Map<String, Object> object,
+                                                               String printMerge,
+                                                               String printLike,
+                                                               String mergeTechnologyNumber) {
+        if (printMerge == null) printMerge = "";
+        if (printLike == null) printLike = "";
+
+        Map<String, Object> map = new HashMap<>();
+        List<Map<String, Object>> list = new ArrayList<>();
+
+        List<FlowCard> flowCardList = JSONArray.parseArray(
+                JSONObject.toJSONString(object.get("printList")), FlowCard.class);
+
+        if (!flowCardList.isEmpty()) {
+            // 鐢� Map 淇濆瓨姣忎釜 key 瀵瑰簲鐨勫悎骞� detailList
+            Map<String, List<Map<String, Object>>> keyToDetails = new LinkedHashMap<>();
+
+            // 鐢� Map 淇濆瓨姣忎釜 key 瀵瑰簲鐨勭涓�涓� flowCard锛岀敤浜庣敓鎴� itemmap 琛ㄥご绛変俊鎭�
+            Map<String, FlowCard> keyToFirstFlowCard = new HashMap<>();
+
+            for (FlowCard flowCard : flowCardList) {
+                String batch = flowCard.getBatch();
+                String glassChild = flowCard.getProductName();
+                String key = batch + "_" + glassChild;
+
+                List<Map<String, Object>> currentDetailList = flowCardMapper.getDetailListRefund(
+                        flowCard.getProcessId(),
+                        flowCard.getTechnologyNumber(),
+                        flowCard.getOrderNumber(),
+                        flowCard.getReportingWorkId(),
+                        flowCard.getPatchReason()
+                );
+
+                for (Map<String, Object> detail : currentDetailList) {
+                    detail.put("processId", flowCard.getProcessId());
+                    detail.put("technologyNumber", flowCard.getTechnologyNumber());
+                }
+
+                // 鍚堝苟 detailList 鍒板搴� key
+                keyToDetails.computeIfAbsent(key, k -> new ArrayList<>()).addAll(currentDetailList);
+
+                // 淇濆瓨绗竴娆″嚭鐜扮殑 flowCard锛岀敤浜庣敓鎴� itemmap
+                keyToFirstFlowCard.putIfAbsent(key, flowCard);
+            }
+
+            // 閬嶅巻鍚堝苟鍚庣殑 key锛岀敓鎴� itemmap
+            for (Map.Entry<String, List<Map<String, Object>>> entry : keyToDetails.entrySet()) {
+                String key = entry.getKey();
+                List<Map<String, Object>> mergedDetailList = entry.getValue();
+
+                FlowCard firstFlowCard = keyToFirstFlowCard.get(key);
+
+                Map<String, Object> itemmap = new HashMap<>();
+                itemmap.put("detailList", mergedDetailList);
+
+                // 琛ㄥご琛ㄥ熬
+                itemmap.put("detail", flowCardMapper.getPrimaryListRefundHB(
+                        firstFlowCard.getProcessId(),
+                        String.valueOf(firstFlowCard.getTechnologyNumber()),
+                        firstFlowCard.getOrderNumber(),
+                        firstFlowCard.getReportingWorkId(),
+                        mergeTechnologyNumber,
+                        firstFlowCard.getPatchReason(),
+                        firstFlowCard.getOrderId()
+                ));
+
+                // 宸ヨ壓娴佺▼
+                List<Map<String, Object>> processList = flowCardMapper.getProcessList(
+                        firstFlowCard.getProcessId(),
+                        firstFlowCard.getTechnologyNumber()
+                );
+
+                // 宸ュ簭鍒楄〃
+                List<Map<String, Object>> processNameList = flowCardMapper.getProcessNameList();
+
+                itemmap.put("processList", processList);
+                itemmap.put("processNameList", processNameList);
+
+                list.add(itemmap);
+            }
+        }
+
+        map.put("data", list);
+        return map;
+    }
+
+
+    public Result selectProcessCardProgressSv(Map<String, String> object) {
+        String orderId = object.get("orderId");
+        String processId = object.get("processId");
+        String orderNumber = object.get("orderNumber");
+        String technologyNumber = object.get("technologyNumber");
+        String process = object.get("process");
+        Result result = new Result();
+        //褰撴祦绋嬪崱鍜岃鍗曞彿閮戒负绌烘椂锛岃繑鍥炴彁绀轰俊鎭�
+        if (orderId == null &&processId == null){
+            result.setCode(Constants.Code_600);
+            result.setMsg("Please enter at least one parameter for the order number and the process card.");
+            return result;
+        }
+        return result.success(
+                orderProcessDetailMapper
+                        .selectProcessCardProgressSv( orderId, processId, orderNumber, technologyNumber, process)
+        );
+
+    }
+
 }
 
 

--
Gitblit v1.8.0