From c20baabe480137a7dabfbe804a4fb72d95b46724 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期四, 05 十二月 2024 16:36:43 +0800
Subject: [PATCH] 1、修改推送数据格式类型,便于前端展示

---
 hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java |  253 ++++++++++++++++++++++++++++++++++----------------
 1 files changed, 173 insertions(+), 80 deletions(-)

diff --git a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java
index 443b283..fb42c44 100644
--- a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java
+++ b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java
@@ -4,10 +4,11 @@
 import cn.hutool.core.lang.Assert;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.kangaroohy.milo.model.ReadWriteEntity;
 import com.kangaroohy.milo.service.MiloService;
-import com.mes.base.entity.BigStorageCageBaseInfo;
+import com.mes.base.entity.HollowBigStorageCageBaseInfo;
 import com.mes.bigstoragecagetask.entity.BigStorageCageTask;
 import com.mes.bigstoragecagetask.service.BigStorageCageTaskService;
 import com.mes.common.config.Const;
@@ -19,7 +20,10 @@
 import com.mes.hollow.entity.HollowBigStorageCageDetails;
 import com.mes.hollow.entity.HollowGlassOutRelationInfo;
 import com.mes.hollow.entity.HollowGlassRelationInfo;
-import com.mes.hollow.entity.dto.*;
+import com.mes.hollow.entity.dto.BigStorageSequenceDTO;
+import com.mes.hollow.entity.dto.FlowCardVirtualSlotDTO;
+import com.mes.hollow.entity.dto.HollowBigStorageDTO;
+import com.mes.hollow.entity.dto.UpdateHollowBigStorageCageDTO;
 import com.mes.hollow.service.HollowBigStorageCageDetailsService;
 import com.mes.hollow.service.HollowBigStorageCageService;
 import com.mes.hollow.service.HollowGlassOutRelationInfoService;
@@ -71,6 +75,9 @@
     private HollowGlassQueueInfoService hollowGlassQueueInfoService;
     @Resource
     private HollowGlassOutRelationInfoService hollowGlassOutRelationInfoService;
+
+    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";
     @Autowired(required = false)
     MiloService miloService;
     @Resource
@@ -87,14 +94,6 @@
 
     @Value("${mes.outCarMaxSize}")
     private Integer outCarMaxSize;
-
-    @Value("${mes.sequence.order}")
-    private boolean sequenceOrder;
-
-    @Value("${mes.temperingOutTargetPosition}")
-    private Integer temperingOutTargetPosition;
-    @Value("${mes.artificialOutTargetPosition}")
-    private Integer artificialOutTargetPosition;
 
     @Scheduled(fixedDelay = 1000)
     public void inBigStorageTask() throws Exception {
@@ -173,7 +172,7 @@
                     .eq(HollowBigStorageCage::getSlot, bigStorageDTO.getSlot()));
             task.setTargetSlot(bigStorageDTO.getSlot());
             task.setGlassId(info.getGlassId());
-            bigStorageCageTaskService.updateTaskMessage("big_storage_cage_in_two_task", task);
+            bigStorageCageTaskService.updateTaskMessage(BIG_STORAGE_CAGE_IN_TWO_TASK, task);
             //瀛樻斁鍘嗗彶浠诲姟
             HollowBigStorageCageHistoryTask historyTask = new HollowBigStorageCageHistoryTask();
             BeanUtils.copyProperties(task, historyTask);
@@ -227,7 +226,7 @@
             return;
         }
         //鑾峰彇鍑虹墖浠诲姟琛�
-        List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_out_two_task");
+        List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage(BIG_STORAGE_CAGE_OUT_TWO_TASK);
         if (CollectionUtil.isNotEmpty(outTaskList)) {
             log.info("鏈夋鍦ㄦ墽琛岀殑鍑虹墖浠诲姟锛岀粨鏉熸湰娆″嚭鐗囦换鍔�");
             return;
@@ -270,10 +269,12 @@
             List<HollowGlassQueueInfo> unFinishHollowQueueList = hollowGlassQueueInfoService.list(new LambdaQueryWrapper<HollowGlassQueueInfo>()
                     .eq(HollowGlassQueueInfo::getFlowCardId, hollowGlassOutRelationInfo.getFlowCardId())
                     .eq(HollowGlassQueueInfo::getCell, cell)
-                    .eq(HollowGlassQueueInfo::getState, Const.TEMPERING_NEW));
+                    .eq(HollowGlassQueueInfo::getState, Const.TEMPERING_NEW)
+                    .orderByAsc(HollowGlassQueueInfo::getHollowSequence));
             if (CollectionUtil.isNotEmpty(unFinishHollowQueueList)) {
                 log.info("鏈夋鍦ㄥ嚭鐗囩殑涓┖浠诲姟");
-                computeOutGlassInfo(unFinishHollowQueueList, "big_storage_cage_out_two_task", hollowGlassOutRelationInfo.getCell(), Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_AFTER_OUT);
+                Integer isPair = unFinishHollowQueueList.get(0).getIsPair();
+                hollowOutGlassByIsPair(unFinishHollowQueueList, hollowGlassOutRelationInfo.getCell(), isPair, hollowGlassOutRelationInfo.getTotalLayer(),hollowGlassOutRelationInfo.getIsForce());
                 Date endDate = new Date();
                 log.info("澶х悊鐗囩鍑虹墖浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
                 return;
@@ -284,62 +285,65 @@
                         .eq(HollowGlassOutRelationInfo::getCell, hollowGlassOutRelationInfo.getCell())
                         .set(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_SUCCESS));
             }
-
-            if (redisUtil.getCacheObject("hollowSwitch")) {
-                List<HollowGlassOutRelationInfo> HollowGlassOutRelationInfoList = hollowGlassOutRelationInfoService
-                        .list(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
-                                .eq(HollowGlassOutRelationInfo::getCell, cell)
-                                .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_NEW));
-                for (HollowGlassOutRelationInfo e : HollowGlassOutRelationInfoList) {
-                    //涓┖浼樺厛锛氳幏鍙栫悊鐗囩  鐜荤拑灏忕墖  鐮存崯琛� 鏁伴噺   鍒ゆ柇绗煎唴鐗堝浘鏄惁鍒伴綈
-                    List<FlowCardGlassInfoDTO> flowCardGlassInfoDTO = hollowBigStorageCageDetailsService.hollowIsAll(e.getFlowCardId(), e.getTotalLayer(), Boolean.TRUE);
-                    if (CollectionUtil.isNotEmpty(flowCardGlassInfoDTO)) {
-                        //鐜荤拑鍒伴綈鍖呮嫭宸插嚭鐗囩殑
-                        //鍒伴綈锛屽皢鐜荤拑灏忕墖鏁版嵁瀛樺叆涓┖灏忕墖琛紝閫昏緫鐢熸垚鍑虹墖浠诲姟  缁撴潫
-                        for (FlowCardGlassInfoDTO item : flowCardGlassInfoDTO) {
-                            List<HollowBigStorageCageDetails> hollowBigStorageCageDetailsList = hollowBigStorageCageDetailsService.list(new LambdaQueryWrapper<HollowBigStorageCageDetails>()
-                                    .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN)
-                                    .eq(HollowBigStorageCageDetails::getFlowCardId, item.getFlowCardId())
-                                    .orderByAsc(HollowBigStorageCageDetails::getHollowSequence)
-                                    .orderBy(Boolean.TRUE, cell != 931, HollowBigStorageCageDetails::getLayer)
-                            );
-                            int finalCell = cell;
-                            List<HollowGlassQueueInfo> hollowQueues = hollowBigStorageCageDetailsList.stream().map(queue -> {
-                                HollowGlassQueueInfo queueInfo = new HollowGlassQueueInfo();
-                                BeanUtils.copyProperties(queue, queueInfo);
-                                queueInfo.setState(Const.TEMPERING_NEW);
-                                queueInfo.setCell(finalCell);
-                                return queueInfo;
-                            }).collect(Collectors.toList());
-                            if (CollectionUtil.isNotEmpty(hollowQueues)) {
-                                hollowGlassQueueInfoService.saveBatch(hollowQueues);
-                                computeOutGlassInfo(hollowQueues, "big_storage_cage_out_two_task", cell, Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_AFTER_OUT);
-                                //灏嗕腑绌轰换鍔$姸鎬佹敼涓哄紑濮�
-                                hollowGlassOutRelationInfoService.update(new LambdaUpdateWrapper<HollowGlassOutRelationInfo>()
-                                        .eq(HollowGlassOutRelationInfo::getFlowCardId, e.getFlowCardId())
-                                        .eq(HollowGlassOutRelationInfo::getCell, cell)
-                                        .set(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START));
-                                Date endDate = new Date();
-                                log.info("澶х悊鐗囩鍑虹墖浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
-                                return;
-                            }
-                        }
-                    }
-                }
-            }
-            //鏄惁鏈変汉宸ヤ笅鐗囦换鍔�   鏈夌洿鎺ュ嚭
-            List<HollowBigStorageCageDetails> artificialList = hollowBigStorageCageDetailsService.list(new LambdaQueryWrapper<HollowBigStorageCageDetails>()
-                    .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_ARTIFICIAL)
-                    .orderByAsc(HollowBigStorageCageDetails::getSlot)
-                    .orderByAsc(HollowBigStorageCageDetails::getId).last("limit " + outCarMaxSize));
-            if (CollectionUtil.isNotEmpty(artificialList)) {
-                computeOutGlassInfo(artificialList, "big_storage_cage_out_two_task", artificialOutTargetPosition, Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_AFTER_OUT);
-                Date endDate = new Date();
-                log.info("澶х悊鐗囩鍑虹墖浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
-                return;
-            }
+//            if (redisUtil.getCacheObject("hollowSwitch")) {
+//                List<HollowGlassOutRelationInfo> HollowGlassOutRelationInfoList = hollowGlassOutRelationInfoService
+//                        .list(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
+//                                .eq(HollowGlassOutRelationInfo::getCell, cell)
+//                                .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_NEW));
+//                for (HollowGlassOutRelationInfo e : HollowGlassOutRelationInfoList) {
+//                    //涓┖浼樺厛锛氳幏鍙栫悊鐗囩  鐜荤拑灏忕墖  鐮存崯琛� 鏁伴噺   鍒ゆ柇绗煎唴鐗堝浘鏄惁鍒伴綈
+//                    List<FlowCardGlassInfoDTO> flowCardGlassInfoDTO = hollowBigStorageCageDetailsService.hollowIsAll(e.getFlowCardId(), e.getTotalLayer(), Boolean.TRUE);
+//                    if (CollectionUtil.isNotEmpty(flowCardGlassInfoDTO)) {
+//                        //鐜荤拑鍒伴綈鍖呮嫭宸插嚭鐗囩殑
+//                        //鍒伴綈锛屽皢鐜荤拑灏忕墖鏁版嵁瀛樺叆涓┖灏忕墖琛紝閫昏緫鐢熸垚鍑虹墖浠诲姟  缁撴潫
+//                        for (FlowCardGlassInfoDTO item : flowCardGlassInfoDTO) {
+//                            List<HollowBigStorageCageDetails> hollowBigStorageCageDetailsList = hollowBigStorageCageDetailsService.queryOutGlassList(item.getFlowCardId(), cell);
+//                            int finalCell = cell;
+//                            List<HollowGlassQueueInfo> hollowQueues = hollowBigStorageCageDetailsList.stream().map(queue -> {
+//                                HollowGlassQueueInfo queueInfo = new HollowGlassQueueInfo();
+//                                BeanUtils.copyProperties(queue, queueInfo);
+//                                queueInfo.setState(Const.TEMPERING_NEW);
+//                                queueInfo.setCell(finalCell);
+//                                return queueInfo;
+//                            }).collect(Collectors.toList());
+//
+//                            List<HollowBigStorageCageDetails> hollowBigStorageCageDetailsList = hollowBigStorageCageDetailsService.queryOutGlassList(flowCardId, cell);
+//                            int isPairCount = glassInfo.getTotalLayer() * e.getTotalLayer();
+//                            List<HollowGlassQueueInfo> hollowQueues = new ArrayList<>();
+//                            loop:
+//                            for (HollowBigStorageCageDetails queue : hollowBigStorageCageDetailsList) {
+//                                HollowGlassQueueInfo queueInfo = new HollowGlassQueueInfo();
+//                                BeanUtils.copyProperties(queue, queueInfo);
+//                                queueInfo.setState(Const.TEMPERING_NEW);
+//                                queueInfo.setCell(cell);
+//                                hollowQueues.add(queueInfo);
+//                                if (queue.getIsPair() == 1){
+//                                    isPairCount -=1;
+//                                    if (isPairCount == 0){
+//                                        break loop;
+//                                    }
+//                                }
+//                            }
+//
+//                            if (CollectionUtil.isNotEmpty(hollowQueues)) {
+//                                hollowGlassQueueInfoService.saveBatch(hollowQueues);
+//                                Integer isPair = hollowQueues.get(0).getIsPair();
+//                                hollowOutGlassByIsPair(hollowQueues, cell, isPair, e.getTotalLayer());
+//                                //灏嗕腑绌轰换鍔$姸鎬佹敼涓哄紑濮�
+//                                hollowGlassOutRelationInfoService.update(new LambdaUpdateWrapper<HollowGlassOutRelationInfo>()
+//                                        .eq(HollowGlassOutRelationInfo::getFlowCardId, e.getFlowCardId())
+//                                        .eq(HollowGlassOutRelationInfo::getCell, cell)
+//                                        .set(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START));
+//                                Date endDate = new Date();
+//                                log.info("澶х悊鐗囩鍑虹墖浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
+//                                return;
+//                            }
+//                        }
+//                    }
+//                }
+//            }
         }
-
+//        redisUtil.setCacheObject("dispatchHollowSwitch",true);
         //鏄惁瀛樺湪闇�瑕佸唴閮ㄨ皟搴︾殑鏍煎瓙:鎵ц鍐呴儴璋冨害浠诲姟
         if (redisUtil.getCacheObject("dispatchHollowSwitch")) {
             //todo:鑾峰彇绗煎唴鍗曟牸宸茬粡鍒伴綈鐨勭幓鐠冩牸瀛愪俊鎭�
@@ -363,7 +367,7 @@
                         int targetSlot = item.getSlot();
                         list = hollowBigStorageCageDetailsService.list(new LambdaQueryWrapper<HollowBigStorageCageDetails>()
                                 .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN).eq(HollowBigStorageCageDetails::getSlot, startSlot));
-                        computeOutGlassInfo(list, "big_storage_cage_out_two_task", targetSlot, Const.GLASS_STATE_SCHEDULE_ING, Const.BIG_STORAGE_AFTER_DISPATCH);
+                        hollowOutGlassByIsPair(list, targetSlot, 0, 0,0);
                         List<Integer> slotList = new ArrayList<>();
                         slotList.add(targetSlot);
                         updateSlotRemainBySlots(slotList);
@@ -474,7 +478,7 @@
             return;
         }
         //鑾峰彇杩涚墖浠诲姟琛�
-        List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_out_one_task");
+        List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage(BIG_STORAGE_CAGE_OUT_TWO_TASK);
         if (CollectionUtil.isEmpty(outTaskList)) {
             log.info("褰撳墠澶ц溅鏃犺繘鐗囩幓鐠冿紝缁撴潫瀹屾垚杩涚墖浠诲姟");
             return;
@@ -532,6 +536,7 @@
                 noDealOutTask(v);
             }
         });
+
         for (BigStorageCageTask item : outTaskList) {
             //鏇存柊鍘嗗彶浠诲姟琛ㄤ腑鐨勪换鍔$姸鎬�
             hollowBigStorageCageHistoryTaskService.update(new LambdaUpdateWrapper<HollowBigStorageCageHistoryTask>()
@@ -552,8 +557,45 @@
 //                绌烘墽琛�
             }
         }
+        try {
+            //鏇存柊鏁伴噺
+            //鎸夌収鐜荤拑id鑾峰彇闇�瑕佸嚭鐗囧鍒楄〃涓殑鏁版嵁
+            if(finalTaskType.equals(Const.BIG_STORAGE_AFTER_OUT) ){
+                HollowGlassQueueInfo hollowGlassQueueInfo = hollowGlassQueueInfoService.getOne(new LambdaQueryWrapper<HollowGlassQueueInfo>()
+                        .eq(HollowGlassQueueInfo::getGlassId, outTaskList.get(0).getGlassId())
+                        .orderByDesc(HollowGlassQueueInfo::getUpdateTime).last("limit 1"));
+                List<HollowGlassQueueInfo> list = hollowGlassQueueInfoService.list(new LambdaQueryWrapper<HollowGlassQueueInfo>()
+                        .eq(HollowGlassQueueInfo::getFlowCardId, hollowGlassQueueInfo.getFlowCardId())
+                        .eq(HollowGlassQueueInfo::getCell, hollowGlassQueueInfo.getCell())
+                        .eq(HollowGlassQueueInfo::getIsPair, 1)
+                        .eq(HollowGlassQueueInfo::getState, Const.TEMPERING_NEW)
+                );
+                if (CollectionUtil.isEmpty(list)){
+//                浠诲姟鏇存柊涓哄凡瀹屾垚
+                    hollowGlassOutRelationInfoService.update(new UpdateWrapper<HollowGlassOutRelationInfo>()
+                            .eq("flow_card_id",hollowGlassQueueInfo.getFlowCardId())
+                            .eq("cell",hollowGlassQueueInfo.getCell())
+                            .setSql("pair_quantity = total_pair_quantity")
+                            .set("state",Const.HOLLOW_FLOW_CARD_SUCCESS)
+                    );
+                }else{
+//               璁$畻鍓╀綑鐜荤拑瀵规暟锛岀敤浠诲姟鎬婚槦鏁板噺鍓╀綑瀵规暟
+                    int remainCount = list.size() / hollowGlassQueueInfo.getTotalLayer();
+                    hollowGlassOutRelationInfoService.update(new UpdateWrapper<HollowGlassOutRelationInfo>()
+                            .eq("flow_card_id",hollowGlassQueueInfo.getFlowCardId())
+                            .eq("cell",hollowGlassQueueInfo.getCell())
+                            .setSql("pair_quantity = total_pair_quantity -"+remainCount)
+                    );
+                }
+            }
+        }catch (Exception e){
+            log.info("璁$畻鐜荤拑鏁伴噺杩囩▼涓嚭鐜伴敊璇紝閿欒淇℃伅{}",e.getMessage());
+        }
+
+//        hollowGlassOutRelationInfoService.update
 //       閲嶇疆浠诲姟琛ㄦ暟鎹�
-        bigStorageCageTaskService.updateOutTaskMessage("big_storage_cage_out_one_task");
+        bigStorageCageTaskService.updateOutTaskMessage(BIG_STORAGE_CAGE_OUT_TWO_TASK);
+
         //娓呯┖鍚姩鐘舵��
         //鍚憃pc鍙戦�佸惎鍔ㄤ俊鍙�
         miloService.writeToOpcWord(generateReadWriteEntity("DLP2B.DLP2B.MesReply", 0));
@@ -660,29 +702,74 @@
         log.info("鍑虹墖浠诲姟-鏃犲姩浣滄墽琛屽畬鎴�");
     }
 
+
+    private <T extends HollowBigStorageCageBaseInfo> Boolean hollowOutGlassByIsPair(List<T> list, int targetSlot, int isPair, int totalLayer,int isForce) {
+        List<T> resultList = new ArrayList<>();
+        List<T> tempList = new ArrayList<>();
+        int taskType = Const.BIG_STORAGE_AFTER_OUT;
+        int taskState = Const.GLASS_STATE_OUT_ING;
+        for (T t : list) {
+            if (isPair == (t.getIsPair() == null ? 0 : t.getIsPair())) {
+                tempList.add(t);
+            }else{
+                break;
+            }
+        }
+        if (isPair == 0 && isForce!=1) {
+            taskType = Const.BIG_STORAGE_AFTER_DISPATCH;
+            taskState = Const.GLASS_STATE_SCHEDULE_ING;
+            resultList.add(list.get(0));
+            //鐩墠璋冨害浠诲姟totalLayer涓�0  鍑虹墖璋冨害浠诲姟鏈夊眰鍙凤紝鐢ㄤ簬鍖哄垎璋冨害鏂瑰紡
+            if (totalLayer !=0){
+                HollowBigStorageCage storageCage = hollowBigStorageCageService.getOne(new LambdaQueryWrapper<HollowBigStorageCage>()
+                        .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON).eq(HollowBigStorageCage::getRemainWidth, slotWidth).last("limit 1"));
+                targetSlot = storageCage.getSlot();
+            }
+            totalLayer = 0;
+        }else{
+            resultList = tempList;
+        }
+        return computeOutGlassInfo(resultList, BIG_STORAGE_CAGE_OUT_TWO_TASK, targetSlot, taskState, taskType, totalLayer,isForce);
+    }
+
     /**
      * 鍑虹墖涓�娆′粎鐢熸垚涓�杞︾幓鐠�
      *
-     * @param list
      * @param <T>
+     * @param list
+     * @param totalLayer
      * @return
      */
-    private <T extends BigStorageCageBaseInfo> Boolean computeOutGlassInfo(List<T> list, String tableName, int targetSlot, int state, int taskType) {
+    private <T extends HollowBigStorageCageBaseInfo> Boolean computeOutGlassInfo(List<T> list, String tableName, int targetSlot, int state, int taskType, int totalLayer,int isForce) {
         //浠诲姟鏁版嵁:鑾峰彇杞﹀瓙瀛樻斁鐜荤拑鏈�澶ф暟閲�,鐜荤拑闂撮殧
-        List<BigStorageCageTask> bigStorageCageTaskList = new ArrayList<>();
+        List<BigStorageCageTask> tempList = new ArrayList<>();
+        List<T> tempTList = new ArrayList<>();
         //鎵撹溅鍓╀綑灏哄
         Integer remainWidth = carWidth;
         for (T e : list) {
-            if (bigStorageCageTaskList.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;
-            bigStorageCageTaskList.add(new BigStorageCageTask(e.getGlassId(), e.getSlot(), targetSlot,
+            tempTList.add(e);
+            tempList.add(new BigStorageCageTask(e.getGlassId(), e.getSlot(), targetSlot,
                     0));
         }
-        Assert.isFalse(CollectionUtil.isEmpty(bigStorageCageTaskList), "鏈幏鍙栧嚭鐗囨暟鎹紝缁撴潫鍑虹墖浠诲姟");
-        log.info("鑾峰彇鍑虹墖浠诲姟鏁版嵁{}鏉★紝鎵ц淇濆瓨", bigStorageCageTaskList.size());
+        Assert.isFalse(CollectionUtil.isEmpty(tempList), "鏈幏鍙栧嚭鐗囨暟鎹紝缁撴潫鍑虹墖浠诲姟");
+        log.info("鑾峰彇鍑虹墖浠诲姟鏁版嵁{}鏉★紝鎵ц淇濆瓨", tempList.size());
+        List<BigStorageCageTask> bigStorageCageTaskList = tempList;
+        if (1!= isForce){
+            if (taskType == Const.BIG_STORAGE_AFTER_OUT) {
+                if (tempList.size() <= totalLayer) {
+                    bigStorageCageTaskList = tempList;
+                } else {
+                    int remainCount = tempList.size() % totalLayer;
+                    bigStorageCageTaskList = tempList.subList(0,tempList.size() - remainCount);
+                }
+            }
+        }
+
         List<String> glassIds = bigStorageCageTaskList.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList());
         int glassCount = bigStorageCageTaskList.size();
         //鐢熸垚鍑虹墖浠诲姟鏉℃暟涓嶈冻6琛ュ叏
@@ -704,7 +791,7 @@
         log.info("灏嗗嚭鐗囩幓鐠儃}鐜荤拑鐘舵�佹敼涓哄嚭鐗囦腑", glassIds);
         hollowBigStorageCageDetailsService.update(new LambdaUpdateWrapper<HollowBigStorageCageDetails>()
                 .set(HollowBigStorageCageDetails::getState, state)
-                .set(Const.RAW_GLASS_TASK_TYPE_DISPATCH.equals(taskType), BigStorageCageBaseInfo::getSlot, targetSlot)
+                .set(Const.BIG_STORAGE_AFTER_DISPATCH.equals(taskType), HollowBigStorageCageDetails::getSlot, targetSlot)
                 .ne(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_OUT)
                 .in(HollowBigStorageCageDetails::getGlassId, glassIds));
         try {
@@ -747,4 +834,10 @@
                 .value(value)
                 .build();
     }
+//
+//    private List<BigStorageCageTask> computeOutTaskList(List<BigStorageCageTask> taskList, int totalLayer, int target) {
+////        if (target == 931){}
+//        if (taskList.get(0).get)
+//            return null;
+//    }
 }
\ No newline at end of file

--
Gitblit v1.8.0