From f50b70fce51257349608837adfdd79e1337858a1 Mon Sep 17 00:00:00 2001
From: guoyuji <guoyujie@ng.com>
Date: 星期三, 19 二月 2025 16:14:50 +0800
Subject: [PATCH] 提交智能优化方法测试版
---
north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java | 140 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 140 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 f24487e..993c45e 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;
@@ -1063,6 +1064,145 @@
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