From 77f5af7a1cd1a57804a6391f5e2c73e8ae10a531 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期一, 03 三月 2025 23:32:37 +0800
Subject: [PATCH] 1、优化出片队列,避免930lisec出片玻璃顺序倒叙情况下,出片玻璃尺寸较大一车只能存放小于一对的数量造成玻璃顺序错乱问题
---
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java | 71 ++++++++++++++++++++++++++++-------
1 files changed, 57 insertions(+), 14 deletions(-)
diff --git a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java
index 5099eb5..7aa6875 100644
--- a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java
+++ b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java
@@ -28,6 +28,7 @@
import freemarker.template.Version;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -59,6 +60,12 @@
@Resource
RedisUtil redisUtil;
+
+ @Value("${mes.glassGap}")
+ private Integer glassGap;
+
+ @Value("${mes.carWidth}")
+ private Integer carWidth;
private static final int ID_RATIO = 10;
@@ -328,20 +335,45 @@
.queryOutGlassList(request.getFlowCardId(), request.getCell());
int isPairCount = glassInfo.getTotalLayer() * request.getTotalPairQuantity();
List<HollowGlassQueueInfo> hollowQueues = new ArrayList<>();
- loop:
- for (HollowBigStorageCageDetails queue : hollowBigStorageCageDetailsList) {
- HollowGlassQueueInfo queueInfo = new HollowGlassQueueInfo();
- BeanUtils.copyProperties(queue, queueInfo);
- queueInfo.setRelationId(info.getId());
- queueInfo.setState(Const.TEMPERING_NEW);
- queueInfo.setCell(request.getCell());
- queueInfo.setCreateTime(new Date());
- queueInfo.setUpdateTime(new Date());
- hollowQueues.add(queueInfo);
- if (queue.getIsPair() == 1) {
- isPairCount -= 1;
- if (isPairCount == 0) {
- break loop;
+
+ if (930 == request.getCell()) {
+ Map<Integer, List<HollowBigStorageCageDetails>> listMap = hollowBigStorageCageDetailsList.stream()
+ .collect(Collectors.groupingBy(HollowBigStorageCageDetails::getHollowSequence));
+ for (Map.Entry<Integer, List<HollowBigStorageCageDetails>> entry : listMap.entrySet()) {
+ //鍒涘缓闃熷垪鎺ユ敹涓嶆弧瓒虫垚瀵规儏鍐典笅锛氫竴瀵圭幓鐠冨垎鍑犳涓婅溅鐨勬搴忛棶棰�
+ List<HollowGlassQueueInfo> tempList = new ArrayList<>();
+ //鍏堝皢鐜荤拑鎸夌収姝e父椤哄簭鎺掑垪锛岃绠椾竴杞︽渶澶氭斁鍑犲潡锛岀畻濂藉潡鏁颁箣鍚庡皢涓�杞︾殑鐜荤拑鎸夌収鍊掑簭瀛樺偍
+ List<HollowBigStorageCageDetails> reverse = CollectionUtil.reverse(entry.getValue());
+ int remainWidth = carWidth;
+ for (HollowBigStorageCageDetails item : reverse) {
+ remainWidth = remainWidth - (int) Math.max(item.getWidth(), item.getHeight());
+ if (remainWidth < 0) {
+ tempList = CollectionUtil.reverse(tempList);
+ remainWidth = carWidth - (int) Math.max(item.getWidth(), item.getHeight());
+ }
+ HollowGlassQueueInfo queueInfo = HollowBDetailToQueue(item, info.getId(), request.getCell());
+ tempList.add(queueInfo);
+ remainWidth = remainWidth - glassGap;
+ }
+ hollowQueues.addAll(tempList);
+ HollowBigStorageCageDetails cageDetails = entry.getValue().get(0);
+ if (cageDetails.getIsPair() == 1) {
+ isPairCount = isPairCount - cageDetails.getTotalLayer();
+ if (isPairCount == 0) {
+ break;
+ }
+ }
+ }
+ } else {
+ loop:
+ for (HollowBigStorageCageDetails item : hollowBigStorageCageDetailsList) {
+ HollowGlassQueueInfo queueInfo = HollowBDetailToQueue(item, info.getId(), request.getCell());
+ hollowQueues.add(queueInfo);
+ if (item.getIsPair() == 1) {
+ isPairCount = isPairCount - 1;
+ if (isPairCount == 0) {
+ break loop;
+ }
}
}
}
@@ -355,5 +387,16 @@
}
return info;
}
+
+ private HollowGlassQueueInfo HollowBDetailToQueue(HollowBigStorageCageDetails details, Long taskId, int targetCell) {
+ HollowGlassQueueInfo queueInfo = new HollowGlassQueueInfo();
+ BeanUtils.copyProperties(details, queueInfo);
+ queueInfo.setRelationId(taskId);
+ queueInfo.setState(Const.TEMPERING_NEW);
+ queueInfo.setCell(targetCell);
+ queueInfo.setCreateTime(new Date());
+ queueInfo.setUpdateTime(new Date());
+ return queueInfo;
+ }
}
--
Gitblit v1.8.0