From 4e3b8155722b66e25df3c6fd42cc586b68dea391 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期五, 06 六月 2025 13:55:39 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java |  256 +++++++++++++++++++++++++++++++++-----------------
 1 files changed, 169 insertions(+), 87 deletions(-)

diff --git a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java
index f412f58..0805962 100644
--- a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java
+++ b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java
@@ -12,6 +12,7 @@
 import com.mes.bigstoragecagetask.entity.BigStorageCageTask;
 import com.mes.bigstoragecagetask.service.BigStorageCageTaskService;
 import com.mes.common.config.Const;
+import com.mes.common.config.ConstSysConfig;
 import com.mes.damage.entity.Damage;
 import com.mes.damage.service.DamageService;
 import com.mes.glassinfo.entity.GlassInfo;
@@ -32,6 +33,7 @@
 import com.mes.hollowqueue.service.HollowGlassQueueInfoService;
 import com.mes.hollowtask.entity.HollowBigStorageCageHistoryTask;
 import com.mes.hollowtask.service.HollowBigStorageCageHistoryTaskService;
+import com.mes.sysconfig.service.SysConfigService;
 import com.mes.temperingglass.entity.TemperingGlassInfo;
 import com.mes.temperingglass.service.TemperingGlassInfoService;
 import com.mes.utils.RedisUtil;
@@ -39,7 +41,6 @@
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
@@ -75,6 +76,8 @@
     private HollowGlassQueueInfoService hollowGlassQueueInfoService;
     @Resource
     private HollowGlassOutRelationInfoService hollowGlassOutRelationInfoService;
+    @Resource
+    private SysConfigService sysConfigService;
 
     private static final String BIG_STORAGE_CAGE_IN_TWO_TASK = "big_storage_cage_in_two_task";
     private static final String BIG_STORAGE_CAGE_OUT_TWO_TASK = "big_storage_cage_out_two_task";
@@ -87,22 +90,22 @@
     @Resource
     private RedisUtil redisUtil;
 
-    @Value("${mes.slotWidth}")
-    private Integer slotWidth;
-
-    @Value("${mes.glassGap}")
-    private Integer glassGap;
-
-    @Value("${mes.carWidth}")
-    private Integer carWidth;
-
-    @Value("${mes.outCarMaxSize}")
-    private Integer outCarMaxSize;
-
-    @Value("${mes.slotMaxHeight}")
-    private Integer slotMaxHeight;
-    @Value("${mes.slotMaxthickness}")
-    private Integer slotMaxthickness;
+//    @Value("${mes.slotWidth}")
+//    private Integer slotWidth;
+//
+//    @Value("${mes.glassGap}")
+//    private Integer glassGap;
+//
+//    @Value("${mes.carWidth}")
+//    private Integer carWidth;
+//
+//    @Value("${mes.outCarMaxSize}")
+//    private Integer outCarMaxSize;
+//
+//    @Value("${mes.slotMaxHeight}")
+//    private Integer slotMaxHeight;
+//    @Value("${mes.slotMaxthickness}")
+//    private Integer slotMaxthickness;
 
     @Scheduled(fixedDelay = 1000)
     public void inBigStorageTask() throws Exception {
@@ -145,7 +148,8 @@
         for (Map.Entry<String, Long> entry : glassCountMap.entrySet()) {
             if (entry.getValue() > 1) {
                 log.info("杩涚墖鐜荤拑{}瀛樺湪鐩稿悓锛岀粨鏉熸湰娆′换鍔�", entry.getKey());
-                //todo:鍚憄lc鍙戦�佹姤璀�
+                //鍚憄lc鍙戦�佹姤璀�:鍚屼竴杞﹁繘鐗囩幓鐠冨瓨鍦ㄧ浉鍚�
+                miloService.writeToOpcWord(generateReadWriteEntity("DLP2A.DLP2A.alarmSignal", 2));
                 return;
             }
         }
@@ -153,16 +157,20 @@
                 .in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL_ZERO));
         if (CollectionUtil.isNotEmpty(detailsList)) {
             log.info("鐞嗙墖绗煎瓨鍦ㄧ浉鍚岀殑杩涚墖鐜荤拑{}锛岀粨鏉熸湰娆′换鍔�", detailsList);
-            //todo:鍚憄lc鍙戦�佹姤璀�
+            //鍚憄lc鍙戦�佹姤璀�:鐞嗙墖绗煎瓨鍦ㄧ浉鍚岀殑杩涚墖鐜荤拑
+            miloService.writeToOpcWord(generateReadWriteEntity("DLP2A.DLP2A.alarmSignal", 4));
             return;
         }
         List<GlassInfo> glassInfoList = glassInfoService.list(new LambdaQueryWrapper<GlassInfo>().in(GlassInfo::getGlassId, glassIdList));
 
         if (glassInfoList.size() != inTaskList.size()) {
             log.info("杩涚墖浠诲姟鏁伴噺{}涓庣幓鐠冩暟閲弡}涓嶅尮閰嶏紝缁撴潫鏈杩涚墖", inTaskList.size(), glassInfoList.size());
-            //todo:鍚憄lc鍙戦�佹姤璀�
+            //鍚憄lc鍙戦�佹姤璀�:杩涚墖浠诲姟鏁伴噺涓庣郴缁熸煡璇㈠埌鐨勭幓鐠冩暟閲忎笉鍖归厤
+            miloService.writeToOpcWord(generateReadWriteEntity("DLP2A.DLP2A.alarmSignal", 8));
             return;
         }
+
+        Integer slotWidth = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_WIDTH);
         //鎸夌収鐜荤拑鍘氬害鍒嗙粍锛屽垽鏂墿浣欐牸瀛愭槸鍚﹀彲浠ュ瓨鏀�
         Map<Double, Long> thickCountMap = glassInfoList.stream().collect(Collectors.groupingBy(GlassInfo::getThickness, Collectors.counting()));
         for (Map.Entry<Double, Long> entry : thickCountMap.entrySet()) {
@@ -172,18 +180,22 @@
                     .ge(HollowBigStorageCage::getMaxThickness, entry.getKey()));
             if (count < entry.getValue()) {
                 log.info("绗煎唴鏍煎瓙鍓╀綑鏁伴噺涓嶈冻锛岀粨鏉熸湰娆¤繘鐗�");
-                //todo:鍚憄lc鍙戦�佹姤璀�
+                //鍚憄lc鍙戦�佹姤璀�:绗煎唴鏍煎瓙鍓╀綑鏁伴噺涓嶈冻
+                miloService.writeToOpcWord(generateReadWriteEntity("DLP2A.DLP2A.alarmSignal", 16));
                 return;
             }
         }
-        //todo:瓒呭ぇ灏哄
-        if (slotMaxHeight < Math.min(glassInfoList.get(0).getWidth(), glassInfoList.get(0).getHeight()) || glassInfoList.get(0).getThickness() > slotMaxthickness) {
+        //瓒呭ぇ灏哄
+        Integer slotMaxHeight = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_MAX_HEIGHT);
+        Integer slotMaxthickness = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_MAX_THICKNESS);
+        if (slotMaxHeight < Math.min(glassInfoList.get(0).getWidth(), glassInfoList.get(0).getHeight()) || glassInfoList.get(0).getThickness() >= slotMaxthickness) {
             int count = hollowBigStorageCageDetailsService.count(new LambdaQueryWrapper<HollowBigStorageCageDetails>()
                     .eq(HollowBigStorageCageDetails::getSlot, THROUGH_SLOT)
                     .in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL));
             if (count > 0) {
                 log.info("鐩撮�氱墖鍙板瓨鍦ㄧ幓鐠冿紝缁撴潫鏈杩涚墖");
-                //todo:鍚憄lc鍙戦�佹姤璀�
+                //鍚憄lc鍙戦�佹姤璀�:鐩撮�氱墖鍙板瓨鍦ㄧ幓鐠冿紝鏃犳硶缁х画鐩撮��
+                miloService.writeToOpcWord(generateReadWriteEntity("DLP2A.DLP2A.alarmSignal", 64));
                 return;
             }
         }
@@ -201,18 +213,54 @@
 
         //璁$畻鐩爣鏍煎瓙
         List<HollowBigStorageCageHistoryTask> historyTasks = new ArrayList<>();
+
+        Integer glassGap = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_GLASS_GAP);
         try {
-            for (BigStorageCageTask task : inTaskList) {
-                GlassInfo info = glassListMap.get(task.getGlassId()).get(0);
-                HollowBigStorageDTO bigStorageDTO = hollowGlassRelationInfoService.queryHollowTargetSlot(info.getFlowCardId(),
-                        info.getWidth(), info.getHeight(), info.getTotalLayer(), info.getLayer());
+            if (slotMaxHeight > Math.min(glassInfoList.get(0).getWidth(), glassInfoList.get(0).getHeight()) && glassInfoList.get(0).getThickness() < slotMaxthickness) {
+                for (BigStorageCageTask task : inTaskList) {
+                    GlassInfo info = glassListMap.get(task.getGlassId()).get(0);
+                    HollowBigStorageDTO bigStorageDTO = hollowGlassRelationInfoService.queryHollowTargetSlot(info.getFlowCardId(),
+                            info.getWidth(), info.getHeight(), info.getTotalLayer(), info.getLayer());
 //            涓存椂鏇存柊鏍煎瓙鐨勫墿浣欏昂瀵革細闃叉鐩搁偦鐜荤拑杩涘悓涓�鏍煎瓙閫犳垚鍓╀綑灏哄涓嶈冻锛岀幓鐠冭秺鐣岀殑鎯呭喌锛屼换鍔″畬鎴愬悗鍐嶆鏇存柊澶х悊鐗囩琛ㄥ墿浣欏搴︼紙鎸夌収绗煎唴鐜荤拑鏁伴噺鏇存柊澶х悊鐗囩鍓╀綑灏哄锛�
-                hollowBigStorageCageService.update(new LambdaUpdateWrapper<HollowBigStorageCage>()
-                        .set(HollowBigStorageCage::getRemainWidth, bigStorageDTO.getRemainWidth() - Math.max(info.getWidth(), info.getHeight()) - glassGap)
-                        .eq(HollowBigStorageCage::getSlot, bigStorageDTO.getSlot()));
-                task.setTargetSlot(bigStorageDTO.getSlot());
-                task.setGlassId(info.getGlassId());
-                bigStorageCageTaskService.updateTaskMessage(BIG_STORAGE_CAGE_IN_TWO_TASK, task);
+                    hollowBigStorageCageService.update(new LambdaUpdateWrapper<HollowBigStorageCage>()
+                            .set(HollowBigStorageCage::getRemainWidth, bigStorageDTO.getRemainWidth() - Math.max(info.getWidth(), info.getHeight()) - glassGap)
+                            .eq(HollowBigStorageCage::getSlot, bigStorageDTO.getSlot()));
+                    task.setTargetSlot(bigStorageDTO.getSlot());
+                    task.setGlassId(info.getGlassId());
+                    bigStorageCageTaskService.updateTaskMessage(BIG_STORAGE_CAGE_IN_TWO_TASK, task);
+                    //瀛樻斁鍘嗗彶浠诲姟
+                    HollowBigStorageCageHistoryTask historyTask = new HollowBigStorageCageHistoryTask();
+                    BeanUtils.copyProperties(task, historyTask);
+                    historyTask.setTaskType(Const.BIG_STORAGE_AFTER_IN);
+                    historyTask.setGlassCount(glassInfoList.size());
+                    historyTask.setTaskState(Const.ENGINEERING_NEW);
+                    historyTasks.add(historyTask);
+                    //瀛樻斁璇︽儏鏁版嵁
+                    HollowBigStorageCageDetails cageDetails = new HollowBigStorageCageDetails();
+                    BeanUtils.copyProperties(bigStorageDTO, cageDetails);
+                    BeanUtils.copyProperties(info, cageDetails);
+                    cageDetails.setState(Const.GLASS_STATE_NEW);
+                    cageDetails.setSequence(bigStorageDTO.getSlotSequence());
+                    cageDetails.setGap(glassGap);
+                    cageDetails.setId(null);
+                    hollowBigStorageCageDetailsService.save(cageDetails);
+                    hollowGlassRelationInfoService.update(new LambdaUpdateWrapper<HollowGlassRelationInfo>()
+                            .set(HollowGlassRelationInfo::getGlassId, cageDetails.getGlassId())
+                            .set(HollowGlassRelationInfo::getTemperingLayoutId, cageDetails.getTemperingLayoutId())
+                            .set(HollowGlassRelationInfo::getTemperingFeedSequence, cageDetails.getTemperingFeedSequence())
+                            .set(HollowGlassRelationInfo::getEngineerId, cageDetails.getEngineerId())
+                            .set(HollowGlassRelationInfo::getState, Const.HOLLOW_RELATION_OCCUPY)
+                            .eq(HollowGlassRelationInfo::getFlowCardId, bigStorageDTO.getFlowCardId())
+                            .eq(HollowGlassRelationInfo::getLayer, bigStorageDTO.getLayer())
+                            .eq(HollowGlassRelationInfo::getVirtualSlot, bigStorageDTO.getVirtualSlot())
+                            .eq(HollowGlassRelationInfo::getSlotSequence, bigStorageDTO.getSlotSequence())
+                            .eq(HollowGlassRelationInfo::getHollowSequence, bigStorageDTO.getHollowSequence())
+                    );
+                }
+            } else {
+                BigStorageCageTask task = inTaskList.get(0);
+                task.setTargetSlot(THROUGH_SLOT);
+                bigStorageCageTaskService.updateTaskMessage("big_storage_cage_in_two_task", task);
                 //瀛樻斁鍘嗗彶浠诲姟
                 HollowBigStorageCageHistoryTask historyTask = new HollowBigStorageCageHistoryTask();
                 BeanUtils.copyProperties(task, historyTask);
@@ -220,27 +268,18 @@
                 historyTask.setGlassCount(glassInfoList.size());
                 historyTask.setTaskState(Const.ENGINEERING_NEW);
                 historyTasks.add(historyTask);
-                //瀛樻斁璇︽儏鏁版嵁
+                GlassInfo info = glassInfoList.get(0);
                 HollowBigStorageCageDetails cageDetails = new HollowBigStorageCageDetails();
-                BeanUtils.copyProperties(bigStorageDTO, cageDetails);
                 BeanUtils.copyProperties(info, cageDetails);
+                cageDetails.setSlot(THROUGH_SLOT);
                 cageDetails.setState(Const.GLASS_STATE_NEW);
-                cageDetails.setSequence(bigStorageDTO.getSlotSequence());
+                cageDetails.setDeviceId(0);
+                cageDetails.setSequence(0);
+                cageDetails.setHollowSequence(0);
                 cageDetails.setGap(glassGap);
+                cageDetails.setFilmsId(info.getFilmsid());
                 cageDetails.setId(null);
                 hollowBigStorageCageDetailsService.save(cageDetails);
-                hollowGlassRelationInfoService.update(new LambdaUpdateWrapper<HollowGlassRelationInfo>()
-                        .set(HollowGlassRelationInfo::getGlassId, cageDetails.getGlassId())
-                        .set(HollowGlassRelationInfo::getTemperingLayoutId, cageDetails.getTemperingLayoutId())
-                        .set(HollowGlassRelationInfo::getTemperingFeedSequence, cageDetails.getTemperingFeedSequence())
-                        .set(HollowGlassRelationInfo::getEngineerId, cageDetails.getEngineerId())
-                        .set(HollowGlassRelationInfo::getState, Const.HOLLOW_RELATION_OCCUPY)
-                        .eq(HollowGlassRelationInfo::getFlowCardId, bigStorageDTO.getFlowCardId())
-                        .eq(HollowGlassRelationInfo::getLayer, bigStorageDTO.getLayer())
-                        .eq(HollowGlassRelationInfo::getVirtualSlot, bigStorageDTO.getVirtualSlot())
-                        .eq(HollowGlassRelationInfo::getSlotSequence, bigStorageDTO.getSlotSequence())
-                        .eq(HollowGlassRelationInfo::getHollowSequence, bigStorageDTO.getHollowSequence())
-                );
             }
         } catch (Exception exception) {
             log.info("杩涚墖浠诲姟鎵ц涓彂鐢熷紓甯革細{}", exception);
@@ -285,27 +324,41 @@
         }
 
         //鑾峰彇绌洪棽涓旈鍙栦换鍔$殑鏁版嵁淇℃伅锛屾病鏈変换鍔$洿鎺ヨ蛋鐜荤拑璋冨害
+        HashMap<Integer, ReadWriteEntity> map = new HashMap<>();
         ReadWriteEntity oneEntity = miloService.readFromOpcUa("CMJ1.CMJ1.isFree");
+        ReadWriteEntity twoEntity = miloService.readFromOpcUa("ZKQ2.ZKQ2.isFree");
+        ReadWriteEntity threeEntity = miloService.readFromOpcUa("ZKQ2.ZKQ2.isFree03");
+        map.put(930, oneEntity);
+        map.put(931, twoEntity);
+        map.put(932, threeEntity);
         HollowGlassOutRelationInfo hollowGlassOutRelationInfo = null;
         int cell = -1;
-        //鏉庤禌鍏嬬嚎闇�瑕佽幏鍙栭煩姹焢lc鐨勭嚎璺┖闂茬姸鎬侊細10000000绗�8浣嶄负 1琛ㄧず蹇欑 0琛ㄧず绌洪棽
-        if (null != oneEntity.getValue() && "1".equals(oneEntity.getValue() + "")) {
-            cell = 930;
-            hollowGlassOutRelationInfo = hollowGlassOutRelationInfoService
-                    .getOne(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
-                            .eq(HollowGlassOutRelationInfo::getCell, cell)
-                            .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START)
-                    );
+        for (int i = 930; i <= 932; i++) {
+            if (null == hollowGlassOutRelationInfo) {
+                ReadWriteEntity entity = map.get(i);
+                cell = i;
+                if (null != entity.getValue() && ("1".equals(entity.getValue() + "") || Boolean.parseBoolean(entity.getValue() + ""))) {
+                    hollowGlassOutRelationInfo = hollowGlassOutRelationInfoService
+                            .getOne(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
+                                    .eq(HollowGlassOutRelationInfo::getCell, cell)
+                                    .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START)
+                            );
+                }
+            } else {
+                break;
+            }
         }
-
-        ReadWriteEntity twoEntity = miloService.readFromOpcUa("ZKQ2.ZKQ2.isFree");
-        if (null == hollowGlassOutRelationInfo && null != twoEntity.getValue() && Boolean.parseBoolean(twoEntity.getValue() + "")) {
-            cell = 931;
-            hollowGlassOutRelationInfo = hollowGlassOutRelationInfoService
-                    .getOne(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
-                            .eq(HollowGlassOutRelationInfo::getCell, cell)
-                            .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START)
-                    );
+        for (int i = 930; i <= 932; i++) {
+            if (null == hollowGlassOutRelationInfo) {
+                cell = i;
+                hollowGlassOutRelationInfo = hollowGlassOutRelationInfoService
+                        .getOne(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
+                                .eq(HollowGlassOutRelationInfo::getCell, cell)
+                                .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START)
+                        );
+            } else {
+                break;
+            }
         }
 
         if (null != hollowGlassOutRelationInfo) {
@@ -610,7 +663,6 @@
             log.info("璁$畻鐜荤拑鏁伴噺杩囩▼涓嚭鐜伴敊璇紝閿欒淇℃伅{}", e.getMessage());
         }
 
-//        hollowGlassOutRelationInfoService.update
 //       閲嶇疆浠诲姟琛ㄦ暟鎹�
         bigStorageCageTaskService.updateOutTaskMessage(BIG_STORAGE_CAGE_OUT_TWO_TASK);
 
@@ -721,7 +773,8 @@
     }
 
 
-    private <T extends HollowBigStorageCageBaseInfo> Boolean hollowOutGlassByIsPair(List<T> list, int targetSlot, int isPair, int totalLayer, int isForce) {
+    private <T extends HollowBigStorageCageBaseInfo> Boolean hollowOutGlassByIsPair(List<T> list,
+                                                                                    int targetSlot, int isPair, int totalLayer, int isForce) throws Exception {
         List<T> resultList = new ArrayList<>();
         List<T> tempList = new ArrayList<>();
         int taskType = Const.BIG_STORAGE_AFTER_OUT;
@@ -733,6 +786,8 @@
                 break;
             }
         }
+
+        Integer slotWidth = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_WIDTH);
         if (isPair == 0 && isForce != 1) {
             taskType = Const.BIG_STORAGE_AFTER_DISPATCH;
             taskState = Const.GLASS_STATE_SCHEDULE_ING;
@@ -746,6 +801,13 @@
                         .ge(HollowBigStorageCage::getMaxThickness, list.get(0).getThickness())
                         .eq(HollowBigStorageCage::getRemainWidth, slotWidth)
                         .orderByAsc(HollowBigStorageCage::getMaxThickness).last("limit 1"));
+
+                if (null == storageCage) {
+                    //鍚憄lc鍙戦�佹姤璀�:鐩撮�氱墖鍙板瓨鍦ㄧ幓鐠冿紝鏃犳硶缁х画鐩撮��
+                    miloService.writeToOpcWord(generateReadWriteEntity("DLP1A.DLP1A.alarmSignal", 16));
+                    Assert.isFalse(storageCage == null, "浠诲姟璋冨害娌℃湁澶氫綑鏍煎瓙锛岀粨鏉熻皟搴︿换鍔�");
+                }
+
                 targetSlot = storageCage.getSlot();
                 hollowBigStorageCageService.update(new LambdaUpdateWrapper<HollowBigStorageCage>()
                         .set(HollowBigStorageCage::getRemainWidth, 0).eq(HollowBigStorageCage::getSlot, targetSlot));
@@ -767,39 +829,58 @@
      * @param totalLayer
      * @return
      */
-    private <T extends HollowBigStorageCageBaseInfo> Boolean computeOutGlassInfo(List<T> list, String tableName, int targetSlot, int state, int taskType, int totalLayer, int isForce) {
+    private <T extends HollowBigStorageCageBaseInfo> Boolean computeOutGlassInfo(List<T> list, String tableName,
+                                                                                 int targetSlot, int state, int taskType, int totalLayer, int isForce) {
         //浠诲姟鏁版嵁:鑾峰彇杞﹀瓙瀛樻斁鐜荤拑鏈�澶ф暟閲�,鐜荤拑闂撮殧
-        List<BigStorageCageTask> tempList = new ArrayList<>();
-        List<T> tempTList = new ArrayList<>();
+        List<T> templist = new ArrayList<>();
         //鎵撹溅鍓╀綑灏哄
-        Integer remainWidth = carWidth;
+        Integer remainWidth = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_WIDTH);
+        Integer outCarMaxSize = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_OUT_CAR_SIZE);
+//        Integer glassGap = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_GLASS_GAP);
+        Integer glassGap = hollowGlassRelationInfoService.getGlassGapByThickness(list.get(0).getThickness());
         for (T e : list) {
-            if (tempList.size() >= outCarMaxSize || Math.max((int) e.getWidth(), (int) e.getHeight()) > remainWidth) {
+            if (templist.size() >= outCarMaxSize || Math.max((int) e.getWidth(), (int) e.getHeight()) > remainWidth) {
                 break;
             }
             //璁$畻褰撳墠鍑虹墖杞﹀墿灏哄
             remainWidth = remainWidth - Math.max((int) e.getWidth(), (int) e.getHeight()) - glassGap;
-            tempTList.add(e);
-            tempList.add(new BigStorageCageTask(e.getGlassId(), e.getSlot(), targetSlot,
-                    0));
+            templist.add(e);
         }
-        Assert.isFalse(CollectionUtil.isEmpty(tempList), "鏈幏鍙栧嚭鐗囨暟鎹紝缁撴潫鍑虹墖浠诲姟");
-        log.info("鑾峰彇鍑虹墖浠诲姟鏁版嵁{}鏉★紝鎵ц淇濆瓨", tempList.size());
-        List<BigStorageCageTask> bigStorageCageTaskList = tempList;
+        Assert.isFalse(CollectionUtil.isEmpty(templist), "鏈幏鍙栧嚭鐗囨暟鎹紝缁撴潫鍑虹墖浠诲姟");
+        log.info("鑾峰彇鍑虹墖浠诲姟鏁版嵁{}鏉★紝鎵ц淇濆瓨", templist.size());
+        List<T> baseInfoList = templist;
         if (1 != isForce) {
             if (taskType == Const.BIG_STORAGE_AFTER_OUT) {
-                if (tempList.size() <= totalLayer) {
-                    bigStorageCageTaskList = tempList;
+                //鏍¢獙闃叉灏忎簬绛変簬鎬诲眰鏁扮幓鐠冪墖搴忎笉鍖归厤鐨勯棶棰橈紝璇ラ棶棰樺鍑虹幇鍦ㄥぇ鐗囩幓鐠冿紝3灞�
+                if (templist.size() <= totalLayer) {
+                    int tempSequence = templist.get(0).getHollowSequence();
+                    List<T> resultList = new ArrayList<>();
+                    for (int i = 0; i < templist.size(); i++) {
+                        if (tempSequence == list.get(i).getHollowSequence()) {
+                            resultList.add(templist.get(i));
+                        } else {
+                            break;
+                        }
+                    }
+                    baseInfoList = resultList;
                 } else {
-                    int remainCount = tempList.size() % totalLayer;
-                    bigStorageCageTaskList = tempList.subList(0, tempList.size() - remainCount);
+                    //澶т簬鎬诲眰鏁板厛鍙杢otalLyaer鍊嶆暟鏁伴噺鐨勭幓鐠冿紝淇濊瘉澶ц溅涓婄殑鐜荤拑鎴愬浼�
+                    int remainCount = templist.size() % totalLayer;
+                    if (targetSlot == 930) {
+                        baseInfoList = templist.subList(0, totalLayer);
+                    } else {
+                        baseInfoList = templist.subList(0, templist.size() - remainCount);
+                    }
                 }
             }
         }
-
-        List<String> glassIds = bigStorageCageTaskList.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList());
-        int glassCount = bigStorageCageTaskList.size();
+        List<String> glassIds = baseInfoList.stream().map(T::getGlassId).collect(Collectors.toList());
+        int glassCount = baseInfoList.size();
+        List<BigStorageCageTask> bigStorageCageTaskList = new ArrayList<>();
         //鐢熸垚鍑虹墖浠诲姟鏉℃暟涓嶈冻6琛ュ叏
+        for (T t : baseInfoList) {
+            bigStorageCageTaskList.add(new BigStorageCageTask(t.getGlassId(), t.getSlot(), targetSlot, 0));
+        }
         while (bigStorageCageTaskList.size() < 6) {
             bigStorageCageTaskList.add(new BigStorageCageTask("", 0, 0, 0));
         }
@@ -814,7 +895,6 @@
             return history;
         }).collect(Collectors.toList());
         hollowBigStorageCageHistoryTaskService.saveBatch(historyList);
-
         log.info("灏嗗嚭鐗囩幓鐠儃}鐜荤拑鐘舵�佹敼涓哄嚭鐗囦腑", glassIds);
         hollowBigStorageCageDetailsService.update(new LambdaUpdateWrapper<HollowBigStorageCageDetails>()
                 .set(HollowBigStorageCageDetails::getState, state)
@@ -835,6 +915,8 @@
                 .in(HollowBigStorageCageDetails::getSlot, slotList).in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL));
         Map<Integer, Double> slotRemainMap = new HashMap<>();
         //鏄惁瀛樺湪鏈夋牸瀛愰潪绌虹殑鐜荤拑
+        Integer glassGap = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_GLASS_GAP);
+        Integer slotWidth = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_WIDTH);
         if (CollectionUtils.isNotEmpty(inSlotGlassList)) {
             //瀛樺湪  灏嗘牸瀛愬唴鐨勭幓鐠冨垎鍒繘琛屾洿鏂�
 //            List<HollowBigStorageCage> hollowBigStorageCageList = hollowBigStorageCageService.list(new LambdaQueryWrapper<HollowBigStorageCage>()

--
Gitblit v1.8.0