From 3ab330b8aefb3cd781c9b8730b4ab7ac65e7e9d7 Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期五, 07 三月 2025 09:14:08 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10105/r/ERP_override
---
north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java | 128 ++++++++++++++++++++++++++++--------------
1 files changed, 84 insertions(+), 44 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 9c64754..f7aa975 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
@@ -29,6 +29,7 @@
import java.sql.Date;
import java.util.*;
import java.util.stream.Collectors;
+import java.util.stream.IntStream;
import static com.example.erp.service.sd.OrderService.getOrderProcessDetails;
@@ -219,7 +220,7 @@
return map;
}
- public Object selectPrintFlowCardSv(Date selectTime1, Date selectTime2, String orderId, String project, String userId, FlowCard flowCard) {
+ public Object selectPrintFlowCardSv(Date selectTime1, Date selectTime2, String orderId, String project, String userId, Integer state, FlowCard flowCard) {
if ("null".equals(orderId)) {
orderId = "";
}
@@ -227,7 +228,7 @@
project = "";
}
Map<String, Object> map = new HashMap<>();
- map.put("data", flowCardMapper.selectPrintFlowCardMp(selectTime1, selectTime2, orderId, project, flowCard));
+ map.put("data", flowCardMapper.selectPrintFlowCardMp(selectTime1, selectTime2, orderId, project,state, flowCard));
String roleId = flowCardMapper.selectUserMp(userId);
map.put("user", roleId);
return map;
@@ -776,10 +777,12 @@
if (!flowCardList.isEmpty()) {
for (FlowCard flowCard : flowCardList) {
Map<String, Object> itemmap = new HashMap<>();
- if (type == 1) {
+ if (type == 1) {//鏄庣粏鎵撳嵃
itemmap.put("detail", flowCardMapper.selectPrintDetailsMp(flowCard.getOrderId()));
- } else if (type == 2) {
+ } else if (type == 2) {//鏄庣粏鍒嗘灦鎵撳嵃
itemmap.put("detail", flowCardMapper.selectPrintDetailsMp1(flowCard.getOrderId()));
+ }else if (type == 3) {//璁㈠崟鎵撳嵃
+ itemmap.put("detail", flowCardMapper.selectPrintDetailsMp2(flowCard.getOrderId()));
}
list.add(itemmap);
@@ -799,20 +802,28 @@
if (lableType != 2) {//鎴愬搧鏍囩
for (FlowCard flowCard : flowCardList) {
+ String orderId = flowCard.getOrderId();
String processId = flowCard.getProcessId();
String orderNumber = flowCard.getOrderNumber().toString();
+ if (processId!=null){
+ // 妫�鏌ユ槸鍚﹀凡缁忓鐞嗚繃璇� processId锛屽鏋滃鐞嗚繃鍒欒烦杩�
+ if (processedProcessIds.contains(processId) && processedProcessIds.contains(orderNumber)) {
+ continue;
+ }
+ Map<String, Object> itemmap = new HashMap<>();
+ itemmap.put("data", flowCardMapper.getPrintCustomDataDetails(flowCard.getProcessId(), flowCard.getOrderNumber(), flowCard.getPrintQuantity()));
+ list.add(itemmap);
- // 妫�鏌ユ槸鍚﹀凡缁忓鐞嗚繃璇� processId锛屽鏋滃鐞嗚繃鍒欒烦杩�
- if (processedProcessIds.contains(processId) && processedProcessIds.contains(orderNumber)) {
- continue;
- }
- Map<String, Object> itemmap = new HashMap<>();
- itemmap.put("data", flowCardMapper.getPrintCustomDataDetails(flowCard.getProcessId(), flowCard.getOrderNumber(), flowCard.getPrintQuantity()));
- list.add(itemmap);
+ // 灏嗚 processId 鍔犲叆宸插鐞嗛泦鍚�
+ processedProcessIds.add(processId);
+ processedProcessIds.add(orderNumber);
+ } else{
- // 灏嗚 processId 鍔犲叆宸插鐞嗛泦鍚�
- processedProcessIds.add(processId);
- processedProcessIds.add(orderNumber);
+ Map<String, Object> itemmap = new HashMap<>();
+ itemmap.put("data", flowCardMapper.getPrintOrderDataDetails(flowCard.getOrderId(), flowCard.getOrderNumber(), flowCard.getPrintQuantity()));
+ list.add(itemmap);
+ }
+
}
} else {//灏忕墖鏍囩
for (FlowCard flowCard : flowCardList) {
@@ -885,11 +896,14 @@
}
String[] processCardList = processCard.split("/");
+ List<String> result = IntStream.range(0, processCardList[1].length())
+ .mapToObj(i -> String.valueOf(processCardList[1].charAt(i)))
+ .collect(Collectors.toList());
List<FlowCard> flowCardList = flowCardMapper.selectList(
new QueryWrapper<FlowCard>()
.eq("process_id", processCardList[0])
- .eq("technology_number", processCardList[1])
+ .in("technology_number", result)
);
for (FlowCard flowCard : flowCardList) {
flowCard.setOrderGlassDetail(
@@ -1052,27 +1066,37 @@
}
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());
- */
+ 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 = 100.0f;
+ 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);
+ //鎴愬搧鐜荤拑鎬诲帤搴�
Float glassTotalThickness = Float.parseFloat(thickness.get("totalThickness").toString());
+ //鎴愬搧鐜荤拑鍘氬害
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,glassThickness);
+ List<OrderDetail> orderDetailsNotScope = flowCardMapper.getOrderDetailByProductionId(orderId, productionId,"notScope",inLenMax,inLenMin,inShortMax,inShortMin,glassThickness);
//鏍规嵁鐜荤拑鍘氬害鍜屽灚鐗囧帤搴﹀綋鍓嶆灦瀛愭渶澶у彲鏀炬暟閲�
Integer shelfMaxQuantityByThickness = (int) (shelfThickness / (glassTotalThickness + spacerThickness));
@@ -1094,58 +1118,72 @@
);
//褰撳墠璁㈠崟鏄庣粏鍓╀綑鏁伴噺
if (shelfQuantity == 0) {
- shelfQuantity = shelfQuantityByWeight;
- }else if(shelfQuantity>0){
- String FlowCardId = orderDetailList.get(orderDetailList.size() - 1).getFlowCardId();
+ shelfQuantity =Math.min( Math.min(shelfMaxQuantityByThickness,inMaxQuantity),shelfQuantityByWeight);
+ }else if(shelfQuantity>0){//鏋跺瓙鍓╀綑鏁伴噺澶т簬0鏃讹紝鍒ゆ柇褰撳墠鏋跺瓙鍓╀綑閲嶉噺锛屾槸鍚︽敮鎸佹渶鏂板簭鍙风殑鐨勬垚鍝侀噸閲�
+ 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;
}
}
if(flowCardWeight>0){
- //System.out.println(inWeight+","+flowCardWeight);
flowCardWeight = inWeight - flowCardWeight;
- shelfQuantity = (int) (flowCardWeight /
+ //鎸夌収褰撳墠娴佺▼鍗″墿浣欓噸閲忥紝璁$畻褰撳墠娴佺▼鍗″墿浣欐暟閲�
+ int remainingQuantity = (int) (flowCardWeight /
(orderDetail.getHeight()
* orderDetail.getWidth()
* glassThickness
* 2.5 / 1000000));
+ shelfQuantity =Math.min(Math.min(Math.min(shelfQuantityByWeight, Math.min(inMaxQuantity, shelfMaxQuantityByThickness)),shelfQuantity),remainingQuantity);
if (shelfQuantity == 0) {
- shelfQuantity = shelfQuantityByWeight;
+ shelfQuantity = Math.min(shelfQuantityByWeight, Math.min(inMaxQuantity, shelfMaxQuantityByThickness));
flowCardNo += 1;
}
}
}
//鍙栨渶灏忓��
- Integer maxQuantity = 0;
+ //Integer maxQuantity = 0;
while (orderDetail.getQuantity() > 0) {
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));
- /*System.out.println(shelfQuantity + "," + inMaxQuantity + "," + shelfMaxQuantityByThickness);
+ //maxQuantity = Math.min(shelfQuantity, Math.min(inMaxQuantity, shelfMaxQuantityByThickness));
+ //maxQuantity = Math.min(shelfQuantity, shelfMaxQuantityByThickness);
+
+ /*System.out.println("璁㈠崟搴忓彿锛�"+orderDetail.getOrderNumber());
+ System.out.println(shelfQuantity + "," + "," + shelfMaxQuantityByThickness);
System.out.println(flowCardNo + "," + maxQuantity);
System.out.println("------");*/
+ if(shelfQuantity<=0){
+ return false;
+ }
- if (orderDetail.getQuantity() > maxQuantity) {
- newOrderDetail.setFlowCardId(processId);
- newOrderDetail.setQuantity(Long.valueOf(maxQuantity));
+ if (orderDetail.getQuantity() > shelfQuantity) {
+ newOrderDetail.setProcessId(processId);
+ newOrderDetail.setQuantity(Long.valueOf(shelfQuantity));
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);
+ orderDetail.setQuantity(orderDetail.getQuantity() - shelfQuantity);
flowCardNo += 1;
+ shelfQuantity = shelfQuantity - shelfQuantity;
} 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());
@@ -1157,9 +1195,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