From 3e42139cd2a5e665faef6c5c11bc7f7ca2bfd30d Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期四, 20 二月 2025 10:02:41 +0800
Subject: [PATCH] 修改流程卡打印编辑查询 并查列不匹配问题

---
 north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java |  174 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 174 insertions(+), 0 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 60c56dc..72ae94d 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
@@ -7,6 +7,7 @@
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.example.erp.common.Constants;
 import com.example.erp.entity.pp.FlowCard;
+import com.example.erp.entity.sd.OrderDetail;
 import com.example.erp.entity.sd.OrderGlassDetail;
 import com.example.erp.entity.sd.OrderProcessDetail;
 import com.example.erp.entity.userInfo.Log;
@@ -475,6 +476,20 @@
         if (!flowCardList.isEmpty()) {
             for (FlowCard flowCard : flowCardList) {
                 flowCardMapper.updateComposing(flowCard.getProcessId());
+            }
+            return true;
+        }
+        else {
+            return false;
+
+        }
+    }
+
+    public Boolean updateProcessCardRack(Map<String, Object> object) {
+        List<FlowCard> flowCardList = JSONArray.parseArray(JSONObject.toJSONString(object.get("composing")), FlowCard.class);
+        if (!flowCardList.isEmpty()) {
+            for (FlowCard flowCard : flowCardList) {
+                flowCardMapper.updateProcessCardRack(flowCard.getProcessId(),flowCard.getTechnologyNumber(),flowCard.getRack());
             }
             return true;
         }
@@ -1029,6 +1044,165 @@
         flowCardMapper.updateProjectProcessPrintCount(projectNo);
         return flowCardMapper.selectProjectProcessPrintCount(projectNo);
     }
+
+
+    public Map<String, Object> flowCardDetail(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.getFlowCardDetail(flowCard.getProcessId()));
+                list.add(itemmap);
+
+            }
+        }
+
+        map.put("data", list);
+        return map;
+    }
+
+    public Object processCardAutoRack(Map<String, Object> object) {
+        String orderId = "NG25000004";
+        String productionId = "NG25000004B";
+        /*String orderId = object.get("orderId").toString();
+        String productionId = object.get("productionId").toString();
+        Integer inMaxQuantity = Integer.parseInt(object.get("inMaxQuantity").toString());
+        Float inWeight =  Float.parseFloat(object.get("inWeight").toString());
+        Float shelfThickness =  Float.parseFloat(object.get("shelfThickness").toString())*1000;
+        Float spacerThickness =  Float.parseFloat(object.get("spacerThickness").toString());
+        */
+        Integer inMaxQuantity = 30;
+        Float inWeight =  100.0f;
+        Float shelfThickness =  2000.0f;
+        /*鍨墖鍘氬害*/
+        Float spacerThickness =  0.0f;
+        Map<String,Object> thickness = flowCardMapper.getGlassThicknessByProdutionId(orderId,productionId);
+
+        Float glassTotalThickness = Float.parseFloat(thickness.get("totalThickness").toString()) ;
+        Float glassThickness = Float.parseFloat(thickness.get("thickness").toString());
+
+        //鑾峰彇姝ゅ伐绋嬪彿璁㈠崟鏄庣粏淇℃伅
+        List<OrderDetail> orderDetails = flowCardMapper.getOrderDetailByProductionId(orderId,productionId);
+
+        //鏍规嵁鐜荤拑鍘氬害鍜屽灚鐗囧帤搴﹀綋鍓嶆灦瀛愭渶澶у彲鏀炬暟閲�
+        Integer shelfMaxQuantityByThickness = (int) (shelfThickness / (glassTotalThickness+spacerThickness));
+
+        //鐢ㄤ簬鎺ユ敹鏈�缁堢敓鎴愮殑娴佺▼鍗�
+        List<FlowCard> flowCardList = new ArrayList<>();
+
+        //娴佺▼鍗¤嚜澧炵鍙�
+        int flowCardNo = 1;
+        // 褰撳墠鏋跺瓙鍓╀綑鍙斁鏁伴噺
+        Integer shelfQuantity = 0;
+        for(OrderDetail orderDetail : orderDetails){
+            //鏋跺瓙鏍规嵁灏哄閲嶉噺鏈�澶ц兘鏀惧灏�
+            int shelfQuantityByWeight = (int) (inWeight/
+                    (orderDetail.getHeight()
+                            *orderDetail.getWidth()
+                            *glassThickness
+                            *2.5/1000000)
+            );
+            System.out.println(shelfQuantityByWeight);
+            //褰撳墠璁㈠崟鏄庣粏鍓╀綑鏁伴噺
+            if(shelfQuantity==0){
+                shelfQuantity = shelfQuantityByWeight;
+            }
+            //鍙栨渶灏忓��
+            Integer maxQuantity = 0;
+            while (orderDetail.getQuantity() > 0 ) {
+                FlowCard flowCard = new FlowCard();
+                //褰撴寰幆涓紝褰撳墠鏋跺瓙鍓╀綑鏁伴噺涓�0鏃讹紝閲嶆柊璁$畻鏋跺瓙鍓╀綑鏁伴噺
+                if(shelfQuantity==0){
+                    shelfQuantity = shelfQuantityByWeight;
+                    System.out.println("flowCardNo锛�"+flowCardNo);
+                }
+                String processId = productionId+String.format("%05d",flowCardNo);
+                //鍙栨渶灏忓��
+                 maxQuantity = Math.min(shelfQuantity, Math.min(inMaxQuantity, shelfMaxQuantityByThickness));
+                System.out.println(shelfQuantity+","+inMaxQuantity+","+shelfMaxQuantityByThickness);
+                System.out.println(flowCardNo+","+maxQuantity);
+                System.out.println("------");
+
+                if (orderDetail.getQuantity() > maxQuantity){
+                    flowCard.setProcessId(processId);
+                    flowCard.setQuantity(maxQuantity);
+                    flowCardList.add(flowCard);
+                    orderDetail.setQuantity(orderDetail.getQuantity()-maxQuantity);
+                    flowCardNo+=1;
+                }else{
+                    flowCard.setProcessId(processId);
+                    flowCard.setQuantity(Math.toIntExact(orderDetail.getQuantity()));
+                    flowCardList.add(flowCard);
+                    //褰撳墠鏋跺瓙鍓╀綑鏁伴噺
+                    shelfQuantity= shelfQuantity-Math.toIntExact(orderDetail.getQuantity());
+                    if(shelfQuantity==0){
+                        flowCardNo+=1;
+                    }
+                    orderDetail.setQuantity(0L);
+                }
+            }
+
+        }
+
+
+
+        return  flowCardList;
+    }
+
+
+
+    public Object processCardAutoRack1(Map<String, Object> object) {
+        String orderId = "NG25000004";
+        String productionId = "NG25000004B";
+        /*String orderId = object.get("orderId").toString();
+        String productionId = object.get("productionId").toString();
+        Integer inMaxQuantity = Integer.parseInt(object.get("inMaxQuantity").toString());
+        Float inWeight =  Float.parseFloat(object.get("inWeight").toString());
+        Float shelfThickness =  Float.parseFloat(object.get("shelfThickness").toString())*1000;
+        Float spacerThickness =  Float.parseFloat(object.get("spacerThickness").toString());
+        */
+        Integer inMaxQuantity = 30;
+        Float inWeight =  100.0f;
+        Float shelfThickness =  2000.0f;
+        /*鍨墖鍘氬害*/
+        Float spacerThickness =  0.0f;
+        Map<String,Object> thickness = flowCardMapper.getGlassThicknessByProdutionId(orderId,productionId);
+
+        Float glassTotalThickness = Float.parseFloat(thickness.get("totalThickness").toString()) ;
+        Float glassThickness = Float.parseFloat(thickness.get("thickness").toString());
+
+        //鑾峰彇姝ゅ伐绋嬪彿璁㈠崟鏄庣粏淇℃伅
+        List<OrderDetail> orderDetails = flowCardMapper.getOrderDetailByProductionId(orderId,productionId);
+        Integer flowCardQuantity = 0;
+        for(OrderDetail orderDetail:orderDetails){
+            flowCardQuantity+=Math.toIntExact(orderDetail.getQuantity());
+        }
+
+
+        //鏍规嵁鐜荤拑鍘氬害鍜屽灚鐗囧帤搴﹀綋鍓嶆灦瀛愭渶澶у彲鏀炬暟閲�
+        Integer shelfMaxQuantityByThickness = (int) (shelfThickness / (glassTotalThickness+spacerThickness));
+
+        //鐢ㄤ簬鎺ユ敹鏈�缁堢敓鎴愮殑娴佺▼鍗�
+        List<FlowCard> flowCardList = new ArrayList<>();
+
+        //娴佺▼鍗¤嚜澧炵鍙�
+        int flowCardNo = 1;
+        // 褰撳墠鏋跺瓙鍓╀綑鍙斁鏁伴噺
+        Integer shelfQuantity = 0;
+
+        while(flowCardQuantity>0){
+
+        }
+
+
+
+
+        return  flowCardList;
+    }
 }
 
 

--
Gitblit v1.8.0