From b3c0f1778b109fd82e0368961a9a431041710c63 Mon Sep 17 00:00:00 2001 From: guoyuji <guoyujie@ng.com> Date: 星期二, 04 三月 2025 11:03:21 +0800 Subject: [PATCH] 提交智能分架功能 --- north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java | 66 +++++++++++++++++++++------------ 1 files changed, 42 insertions(+), 24 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 6d86d1f..b7ae99f 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 @@ -1052,20 +1052,27 @@ } public Object processCardAutoRack(Map<String, Object> object) { - String orderId = "NG25000004"; - String productionId = "NG25000004B"; - /*String orderId = object.get("orderId").toString(); + 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 shelfThickness = Float.parseFloat(object.get("shelfThickness").toString()); Float spacerThickness = Float.parseFloat(object.get("spacerThickness").toString()); - */ - //Integer inMaxQuantity = 1; - Float inWeight = 100.0f; + Float inLenMax = Float.parseFloat(object.get("inLenMax").toString()); + Float inLenMin = Float.parseFloat(object.get("inLenMin").toString()); + Float inShortMax = Float.parseFloat(object.get("inShortMax").toString()); + Float inShortMin = Float.parseFloat(object.get("inShortMin").toString()); + + /*String orderId = "NG25000004"; + String productionId = "NG25000004A"; + Integer inMaxQuantity = 1; + Float inWeight = 4000.0f; Float shelfThickness = 2000.0f; - /*鍨墖鍘氬害*/ - Float spacerThickness = 0.0f; + Float maxHeight = 1520.0f; + Float maxWid = 400.0f; + Float spacerThickness = 0.0f;//鍨墖鍘氬害*/ + + Map<String, Object> thickness = flowCardMapper.getGlassThicknessByProdutionId(orderId, productionId); //鎴愬搧鐜荤拑鎬诲帤搴� @@ -1074,7 +1081,8 @@ Float glassThickness = Float.parseFloat(thickness.get("thickness").toString()); //鑾峰彇姝ゅ伐绋嬪彿璁㈠崟鏄庣粏淇℃伅 - List<OrderDetail> orderDetails = flowCardMapper.getOrderDetailByProductionId(orderId, productionId); + List<OrderDetail> orderDetails = flowCardMapper.getOrderDetailByProductionId(orderId, productionId,"scope",inLenMax,inLenMin,inShortMax,inShortMin); + List<OrderDetail> orderDetailsNotScope = flowCardMapper.getOrderDetailByProductionId(orderId, productionId,"notScope",inLenMax,inLenMin,inShortMax,inShortMin); //鏍规嵁鐜荤拑鍘氬害鍜屽灚鐗囧帤搴﹀綋鍓嶆灦瀛愭渶澶у彲鏀炬暟閲� Integer shelfMaxQuantityByThickness = (int) (shelfThickness / (glassTotalThickness + spacerThickness)); @@ -1096,12 +1104,12 @@ ); //褰撳墠璁㈠崟鏄庣粏鍓╀綑鏁伴噺 if (shelfQuantity == 0) { - shelfQuantity = shelfQuantityByWeight; + shelfQuantity =Math.min( Math.min(shelfMaxQuantityByThickness,inMaxQuantity),shelfQuantityByWeight); }else if(shelfQuantity>0){//鏋跺瓙鍓╀綑鏁伴噺澶т簬0鏃讹紝鍒ゆ柇褰撳墠鏋跺瓙鍓╀綑閲嶉噺锛屾槸鍚︽敮鎸佹渶鏂板簭鍙风殑鐨勬垚鍝侀噸閲� - String FlowCardId = orderDetailList.get(orderDetailList.size() - 1).getFlowCardId(); + String FlowCardId = orderDetailList.get(orderDetailList.size() - 1).getProcessId(); double flowCardWeight = 0.0; for (OrderDetail orderDetail1 : orderDetailList) { - if (orderDetail1.getFlowCardId().equals(FlowCardId)) { + if (orderDetail1.getProcessId().equals(FlowCardId)) { flowCardWeight += orderDetail1.getHeight()*orderDetail1.getQuantity()* orderDetail1.getWidth()* glassThickness* 2.5 / 1000000; } } @@ -1113,7 +1121,7 @@ * glassThickness * 2.5 / 1000000)); if (shelfQuantity == 0) { - shelfQuantity = shelfQuantityByWeight; + shelfQuantity = Math.min(shelfQuantityByWeight, Math.min(inMaxQuantity, shelfMaxQuantityByThickness)); flowCardNo += 1; } } @@ -1125,30 +1133,38 @@ OrderDetail newOrderDetail = new OrderDetail(); //褰撴寰幆涓紝褰撳墠鏋跺瓙鍓╀綑鏁伴噺涓�0鏃讹紝閲嶆柊璁$畻鏋跺瓙鍓╀綑鏁伴噺 if (shelfQuantity == 0) { - shelfQuantity = shelfQuantityByWeight; + shelfQuantity = Math.min(Math.min(shelfMaxQuantityByThickness,inMaxQuantity),shelfQuantityByWeight); } - String processId = productionId + String.format("%05d", flowCardNo); + String processId = productionId + String.format("%03d", flowCardNo); //鍙栨渶灏忓�� - // maxQuantity = Math.min(shelfQuantity, Math.min(inMaxQuantity, shelfMaxQuantityByThickness)); - maxQuantity = Math.min(shelfQuantity, shelfMaxQuantityByThickness); + maxQuantity = Math.min(shelfQuantity, Math.min(inMaxQuantity, shelfMaxQuantityByThickness)); + //maxQuantity = Math.min(shelfQuantity, shelfMaxQuantityByThickness); - /*System.out.println(shelfQuantity + "," + inMaxQuantity + "," + shelfMaxQuantityByThickness); + /*System.out.println("璁㈠崟搴忓彿锛�"+orderDetail.getOrderNumber()); + System.out.println(shelfQuantity + "," + "," + shelfMaxQuantityByThickness); System.out.println(flowCardNo + "," + maxQuantity); System.out.println("------");*/ if (orderDetail.getQuantity() > maxQuantity) { - newOrderDetail.setFlowCardId(processId); + newOrderDetail.setProcessId(processId); newOrderDetail.setQuantity(Long.valueOf(maxQuantity)); newOrderDetail.setHeight(orderDetail.getHeight()); newOrderDetail.setWidth(orderDetail.getWidth()); + newOrderDetail.setOrderNumber(orderDetail.getOrderNumber()); + newOrderDetail.setShape(orderDetail.getShape()); + newOrderDetail.setLandingSequence(flowCardNo); orderDetailList.add(newOrderDetail); orderDetail.setQuantity(orderDetail.getQuantity() - maxQuantity); flowCardNo += 1; + shelfQuantity = shelfQuantity - maxQuantity; } else { - newOrderDetail.setFlowCardId(processId); + newOrderDetail.setProcessId(processId); newOrderDetail.setQuantity(orderDetail.getQuantity()); newOrderDetail.setHeight(orderDetail.getHeight()); newOrderDetail.setWidth(orderDetail.getWidth()); + newOrderDetail.setOrderNumber(orderDetail.getOrderNumber()); + newOrderDetail.setShape(orderDetail.getShape()); + newOrderDetail.setLandingSequence(flowCardNo); orderDetailList.add(newOrderDetail); //褰撳墠鏋跺瓙鍓╀綑鏁伴噺 shelfQuantity = shelfQuantity - Math.toIntExact(orderDetail.getQuantity()); @@ -1160,9 +1176,11 @@ } } - - - return orderDetailList; + Map<String, Object> map = new HashMap<>(); + Collections.reverse(orderDetailList); + map.put("orderDetailList", orderDetailList); + map.put("orderDetailsNotScope", orderDetailsNotScope); + return map; } -- Gitblit v1.8.0