From be032257d1562085b507496140dd3551570962e0 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期二, 23 七月 2024 20:31:15 +0800
Subject: [PATCH] 0723联调解决bug

---
 hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java
index 22b7ce4..1254d27 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java
@@ -85,6 +85,10 @@
     @Value("${mes.glassGap}")
     private Integer glassGap;
 
+    @Value("${mes.xMaxSize}")
+    private Integer xMaxSize;
+
+
     private String d01GlassId = "";
     private String d04GlassId = "";
 
@@ -313,7 +317,7 @@
                     List<BigStorageCageDetails> list = bigStorageCageDetailsService.list(new LambdaQueryWrapper<BigStorageCageDetails>()
                             .eq(BigStorageCageDetails::getSlot, first.getSlot()).eq(BigStorageCageDetails::getState, Const.GLASS_STATE_IN));
                     List<BigStorageCageOutTask> outTasks = list.stream().map(e -> new BigStorageCageOutTask(e.getGlassId(), first.getSlot(), second.getSlot(),
-                            slotWidth, 0, 0, 1)).collect(Collectors.toList());
+                            e.getWidth() * 10, e.getHeight() * 10, 0, 0, 1)).collect(Collectors.toList());
                     bigStorageCageOutTaskService.saveBatch(outTasks);
 
                     //鍚憄lc鍐欏叆纭瀛�
@@ -601,17 +605,25 @@
         List<BigStorageCageOutTask> bigStorageCageOutTaskList = new ArrayList<>();
         //鎵撹溅鍓╀綑灏哄
         Integer remainWidth = carWidth;
+        int maxX = 0;
         for (T e : list) {
             if (bigStorageCageOutTaskList.size() >= outCarMaxSize || e.getWidth() > remainWidth) {
                 break;
             }
             remainWidth = remainWidth - (int) e.getWidth() - glassGap;
             if (isTempering) {
-                bigStorageCageOutTaskList.add(new BigStorageCageOutTask(e.getGlassId(), e.getSlot(), Const.TEMPERING_OUT_TARGET_POSITION,
-                        (int) e.getWidth() * 10, 0, 0, 1));
+                int minLength = Math.min((int) e.getWidth(), (int) e.getHeight());
+                if (maxX + minLength <= xMaxSize) {
+                    bigStorageCageOutTaskList.add(new BigStorageCageOutTask(e.getGlassId(), e.getSlot(), Const.TEMPERING_OUT_TARGET_POSITION,
+                            e.getWidth() * 10, e.getHeight() * 10, 0, 0, 1));
+                    maxX = Math.max(maxX, e.getXCoordinate());
+                } else {
+                    break;
+                }
+
             } else {
                 bigStorageCageOutTaskList.add(new BigStorageCageOutTask(e.getGlassId(), e.getSlot(), Const.ARTIFICIAL_OUT_TARGET_POSITION,
-                        (int) e.getWidth() * 10, 0, 0, 1));
+                        e.getWidth() * 10, e.getHeight(), 0, 0, 1));
             }
 
         }

--
Gitblit v1.8.0