From f082c354556f7e8d533cf8fefa4fbe671cccc119 Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期二, 03 十二月 2024 11:30:47 +0800
Subject: [PATCH] 1、fixbug:中空进片都重新计算格子 2、新增强制出片功能 3、优化出片调度逻辑

---
 hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollowqueue/service/impl/HollowGlassQueueInfoServiceImpl.java  |   24 +----
 hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/entity/HollowGlassOutRelationInfo.java                  |    6 +
 hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/HollowGlassOutRelationInfoService.java          |    2 
 hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java                           |  126 ++++++++++++++++++------------
 hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java    |    6 
 hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java |   44 ++++++++++
 hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/controller/HollowGlassOutRelationInfoController.java    |    5 +
 hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollowqueue/service/HollowGlassQueueInfoService.java           |    2 
 hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollowqueue/controller/HollowGlassQueueInfoController.java     |    8 --
 9 files changed, 138 insertions(+), 85 deletions(-)

diff --git a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/controller/HollowGlassOutRelationInfoController.java b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/controller/HollowGlassOutRelationInfoController.java
index 12b593a..0dbbff7 100644
--- a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/controller/HollowGlassOutRelationInfoController.java
+++ b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/controller/HollowGlassOutRelationInfoController.java
@@ -29,6 +29,11 @@
     public Result<HollowGlassOutRelationInfo> receiveTask(String flowCardId, int cell, int totalPairQuantity) {
         return Result.success(hollowGlassOutRelationInfoService.receiveTask(flowCardId, cell, totalPairQuantity));
     }
+    @ApiOperation("寮哄埗鍑虹墖")
+    @PostMapping("/forceOutGlass")
+    public Result<HollowGlassOutRelationInfo> forceOutGlass(String flowCardId, int cell, int totalPairQuantity) {
+        return Result.success(hollowGlassOutRelationInfoService.forceOutGlass(flowCardId, cell, totalPairQuantity));
+    }
 
 }
 
diff --git a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/entity/HollowGlassOutRelationInfo.java b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/entity/HollowGlassOutRelationInfo.java
index 4882347..19ad040 100644
--- a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/entity/HollowGlassOutRelationInfo.java
+++ b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/entity/HollowGlassOutRelationInfo.java
@@ -43,6 +43,11 @@
      * 宸插畬鎴愰厤瀵规暟閲�
      */
     private Integer pairQuantity;
+
+    /**
+     * 鏄惁寮哄埗
+     */
+    private Integer isForce;
     /**
      * /*鍒涘缓鏃堕棿
      */
@@ -55,3 +60,4 @@
 
 }
 
+
diff --git a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/HollowGlassOutRelationInfoService.java b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/HollowGlassOutRelationInfoService.java
index 999c34e..5673fb7 100644
--- a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/HollowGlassOutRelationInfoService.java
+++ b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/HollowGlassOutRelationInfoService.java
@@ -12,5 +12,7 @@
 public interface HollowGlassOutRelationInfoService extends IService<HollowGlassOutRelationInfo> {
 
     HollowGlassOutRelationInfo receiveTask(String flowCardId, int cell, int totalPairQuantity);
+
+    HollowGlassOutRelationInfo forceOutGlass(String flowCardId, int cell, int totalPairQuantity);
 }
 
diff --git a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java
index 63438cc..7f54fa2 100644
--- a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java
+++ b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java
@@ -5,13 +5,21 @@
 import com.mes.common.config.Const;
 import com.mes.glassinfo.entity.GlassInfo;
 import com.mes.glassinfo.service.GlassInfoService;
+import com.mes.hollow.entity.HollowBigStorageCageDetails;
 import com.mes.hollow.entity.HollowGlassOutRelationInfo;
 import com.mes.hollow.mapper.HollowGlassOutRelationInfoMapper;
+import com.mes.hollow.service.HollowBigStorageCageDetailsService;
 import com.mes.hollow.service.HollowGlassOutRelationInfoService;
+import com.mes.hollowqueue.entity.HollowGlassQueueInfo;
+import com.mes.hollowqueue.service.HollowGlassQueueInfoService;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * (HollowGlassOutRelationInfo)琛ㄦ湇鍔″疄鐜扮被
@@ -25,9 +33,23 @@
 
     @Resource
     GlassInfoService glassInfoService;
+    @Resource
+    HollowBigStorageCageDetailsService hollowBigStorageCageDetailsService;
+    @Resource
+    HollowGlassQueueInfoService hollowGlassQueueInfoService;
 
     @Override
     public HollowGlassOutRelationInfo receiveTask(String flowCardId, int cell, int totalPairQuantity) {
+        return childrenTask(flowCardId,cell,totalPairQuantity,0);
+    }
+
+    @Override
+    public HollowGlassOutRelationInfo forceOutGlass(String flowCardId, int cell, int totalPairQuantity) {
+        return childrenTask(flowCardId,cell,totalPairQuantity,1);
+    }
+
+
+    private HollowGlassOutRelationInfo childrenTask(String flowCardId, int cell, int totalPairQuantity,int isForce) {
         GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getFlowCardId, flowCardId).last("limit 1"));
         HollowGlassOutRelationInfo info = new HollowGlassOutRelationInfo();
         if (null == glassInfo) {
@@ -36,11 +58,29 @@
         }
         info.setFlowCardId(flowCardId);
         info.setCell(cell);
+        info.setIsForce(isForce);
         info.setTotalLayer(glassInfo.getTotalLayer());
-        info.setTotalLayer(glassInfo.getTotalLayer());
-        info.setState(Const.HOLLOW_FLOW_CARD_NEW);
+        info.setState(Const.HOLLOW_FLOW_CARD_START);
         info.setTotalPairQuantity(totalPairQuantity);
         this.save(info);
+        List<HollowBigStorageCageDetails> hollowBigStorageCageDetailsList = hollowBigStorageCageDetailsService.queryOutGlassList(flowCardId, cell);
+        int isPairCount = glassInfo.getTotalLayer() * totalPairQuantity;
+        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;
+                }
+            }
+        }
+        hollowGlassQueueInfoService.saveBatch(hollowQueues);
         return info;
     }
 }
diff --git a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java
index d699497..b44f147 100644
--- a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java
+++ b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java
@@ -85,7 +85,7 @@
             );
         }
         HollowBigStorageCageDetails hollowDetails = hollowBigStorageCageDetailsService.getOne(new LambdaQueryWrapper<HollowBigStorageCageDetails>()
-                .eq(HollowBigStorageCageDetails::getSlot, relationInfoOne.getVirtualSlot()).in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL_ZERO)
+                .eq(HollowBigStorageCageDetails::getVirtualSlot, relationInfoOne.getVirtualSlot()).in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL_ZERO)
                 .orderByDesc(HollowBigStorageCageDetails::getSequence).last("limit 1"));
         HollowBigStorageCage storageCage = null;
         if (null == hollowDetails) {
@@ -97,8 +97,8 @@
             return storageDTO;
         }
         HollowGlassRelationInfo relationInfoBefore = hollowGlassRelationInfoService.getOne(new LambdaQueryWrapper<HollowGlassRelationInfo>()
-                .eq(HollowGlassRelationInfo::getEngineerId, relationInfoOne.getEngineerId())
-                .eq(HollowGlassRelationInfo::getTemperingLayoutId, relationInfoOne.getTemperingLayoutId())
+                .eq(HollowGlassRelationInfo::getFlowCardId, relationInfoOne.getFlowCardId())
+                .eq(HollowGlassRelationInfo::getLayer, relationInfoOne.getLayer())
                 .eq(HollowGlassRelationInfo::getVirtualSlot, relationInfoOne.getVirtualSlot())
                 .eq(HollowGlassRelationInfo::getSlotSequence, relationInfoOne.getSlotSequence() - 1));
         if (null == relationInfoBefore) {
diff --git a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollowqueue/controller/HollowGlassQueueInfoController.java b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollowqueue/controller/HollowGlassQueueInfoController.java
index 34c1fe9..f28fd93 100644
--- a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollowqueue/controller/HollowGlassQueueInfoController.java
+++ b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollowqueue/controller/HollowGlassQueueInfoController.java
@@ -23,14 +23,6 @@
 
     @Resource
     HollowGlassQueueInfoService hollowGlassQueueInfoService;
-
-    @ApiOperation("寮哄埗鍑虹墖")
-    @PostMapping("/forceOutGlass")
-    public Result<String> forceOutGlass(String flowCardId, int cell, int totalPairQuantity) {
-        hollowGlassQueueInfoService.forceOutGlass(flowCardId, cell, totalPairQuantity);
-        return Result.success("success");
-    }
-
     @ApiOperation("鎸夌収绾胯矾鏌ヨ姝e湪鍑虹墖鐨勭幓鐠冮槦鍒�")
     @PostMapping("/queryHollowGlassQueueInfo")
     public Result<List<HollowGlassQueueInfo>> queryHollowGlassQueueInfo(int cell) {
diff --git a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollowqueue/service/HollowGlassQueueInfoService.java b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollowqueue/service/HollowGlassQueueInfoService.java
index a394fa8..9c60789 100644
--- a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollowqueue/service/HollowGlassQueueInfoService.java
+++ b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollowqueue/service/HollowGlassQueueInfoService.java
@@ -13,8 +13,6 @@
  */
 public interface HollowGlassQueueInfoService extends IService<HollowGlassQueueInfo> {
 
-    void forceOutGlass(String flowCardId, int cell, int totalPairQuantity);
-
     List<HollowGlassQueueInfo> queryHollowGlassQueueInfo(int cell);
 }
 
diff --git a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollowqueue/service/impl/HollowGlassQueueInfoServiceImpl.java b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollowqueue/service/impl/HollowGlassQueueInfoServiceImpl.java
index 0c41e55..654ea16 100644
--- a/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollowqueue/service/impl/HollowGlassQueueInfoServiceImpl.java
+++ b/hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollowqueue/service/impl/HollowGlassQueueInfoServiceImpl.java
@@ -4,6 +4,8 @@
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.mes.common.config.Const;
+import com.mes.glassinfo.entity.GlassInfo;
+import com.mes.glassinfo.service.GlassInfoService;
 import com.mes.hollow.entity.HollowBigStorageCageDetails;
 import com.mes.hollow.entity.HollowGlassOutRelationInfo;
 import com.mes.hollow.service.HollowBigStorageCageDetailsService;
@@ -11,10 +13,12 @@
 import com.mes.hollowqueue.entity.HollowGlassQueueInfo;
 import com.mes.hollowqueue.mapper.HollowGlassQueueInfoMapper;
 import com.mes.hollowqueue.service.HollowGlassQueueInfoService;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -25,32 +29,14 @@
  * @since 2024-11-30 10:19:56
  */
 @Service
+@Slf4j
 public class HollowGlassQueueInfoServiceImpl extends ServiceImpl<HollowGlassQueueInfoMapper, HollowGlassQueueInfo> implements HollowGlassQueueInfoService {
 
-    @Resource
-    HollowBigStorageCageDetailsService hollowBigStorageCageDetailsService;
 
     @Resource
     HollowGlassOutRelationInfoService hollowGlassOutRelationInfoService;
 
-    @Override
-    public void forceOutGlass(String flowCardId, int cell, int totalPairQuantity) {
-        hollowGlassOutRelationInfoService.receiveTask(flowCardId, cell, totalPairQuantity);
-        hollowGlassOutRelationInfoService.update(new LambdaUpdateWrapper<HollowGlassOutRelationInfo>()
-                .eq(HollowGlassOutRelationInfo::getFlowCardId, flowCardId)
-                .set(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START)
-        );
-        List<HollowBigStorageCageDetails> hollowBigStorageCageDetailsList = hollowBigStorageCageDetailsService.queryOutGlassList(flowCardId, cell);
 
-        List<HollowGlassQueueInfo> hollowQueues = hollowBigStorageCageDetailsList.stream().map(queue -> {
-            HollowGlassQueueInfo queueInfo = new HollowGlassQueueInfo();
-            BeanUtils.copyProperties(queue, queueInfo);
-            queueInfo.setState(Const.TEMPERING_NEW);
-            queueInfo.setCell(cell);
-            return queueInfo;
-        }).collect(Collectors.toList());
-        this.saveBatch(hollowQueues);
-    }
     @Override
     public List<HollowGlassQueueInfo> queryHollowGlassQueueInfo(int cell) {
         HollowGlassOutRelationInfo one = hollowGlassOutRelationInfoService.getOne(new LambdaUpdateWrapper<HollowGlassOutRelationInfo>()
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 bbfea54..0c00efd 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
@@ -270,7 +270,7 @@
             if (CollectionUtil.isNotEmpty(unFinishHollowQueueList)) {
                 log.info("鏈夋鍦ㄥ嚭鐗囩殑涓┖浠诲姟");
                 Integer isPair = unFinishHollowQueueList.get(0).getIsPair();
-                hollowOutGlassByIsPair(unFinishHollowQueueList, hollowGlassOutRelationInfo.getCell(), isPair, hollowGlassOutRelationInfo.getTotalLayer());
+                hollowOutGlassByIsPair(unFinishHollowQueueList, hollowGlassOutRelationInfo.getCell(), isPair, hollowGlassOutRelationInfo.getTotalLayer(),hollowGlassOutRelationInfo.getIsForce());
                 Date endDate = new Date();
                 log.info("澶х悊鐗囩鍑虹墖浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
                 return;
@@ -281,45 +281,63 @@
                         .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.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());
-                            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;
-                            }
-                        }
-                    }
-                }
-            }
+//            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);
         //鏄惁瀛樺湪闇�瑕佸唴閮ㄨ皟搴︾殑鏍煎瓙:鎵ц鍐呴儴璋冨害浠诲姟
@@ -345,7 +363,7 @@
                         int targetSlot = item.getSlot();
                         list = hollowBigStorageCageDetailsService.list(new LambdaQueryWrapper<HollowBigStorageCageDetails>()
                                 .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN).eq(HollowBigStorageCageDetails::getSlot, startSlot));
-                        hollowOutGlassByIsPair(list, targetSlot, 0, 0);
+                        hollowOutGlassByIsPair(list, targetSlot, 0, 0,1);
                         List<Integer> slotList = new ArrayList<>();
                         slotList.add(targetSlot);
                         updateSlotRemainBySlots(slotList);
@@ -534,8 +552,11 @@
 //                绌烘墽琛�
             }
         }
+        //鏇存柊鏁伴噺
+//        hollowGlassOutRelationInfoService.update
 //       閲嶇疆浠诲姟琛ㄦ暟鎹�
         bigStorageCageTaskService.updateOutTaskMessage(BIG_STORAGE_CAGE_OUT_TWO_TASK);
+
         //娓呯┖鍚姩鐘舵��
         //鍚憃pc鍙戦�佸惎鍔ㄤ俊鍙�
         miloService.writeToOpcWord(generateReadWriteEntity("DLP2B.DLP2B.MesReply", 0));
@@ -643,7 +664,7 @@
     }
 
 
-    private <T extends HollowBigStorageCageBaseInfo> Boolean hollowOutGlassByIsPair(List<T> list, int targetSlot, int isPair, int totalLayer) {
+    private <T extends HollowBigStorageCageBaseInfo> Boolean hollowOutGlassByIsPair(List<T> list, int targetSlot, int isPair, int totalLayer,int isForce) {
         List<T> resultList = new ArrayList<>();
         int taskType = Const.BIG_STORAGE_AFTER_OUT;
         int taskState = Const.GLASS_STATE_OUT_ING;
@@ -652,12 +673,12 @@
                 resultList.add(t);
             }
         }
-        if (isPair == 0) {
+        if (isPair == 0 && isForce!=1) {
             taskType = Const.BIG_STORAGE_AFTER_DISPATCH;
             taskState = Const.GLASS_STATE_SCHEDULE_ING;
             totalLayer = 0;
         }
-        return computeOutGlassInfo(resultList, BIG_STORAGE_CAGE_OUT_TWO_TASK, targetSlot, taskState, taskType, totalLayer);
+        return computeOutGlassInfo(resultList, BIG_STORAGE_CAGE_OUT_TWO_TASK, targetSlot, taskState, taskType, totalLayer,isForce);
     }
 
     /**
@@ -668,7 +689,7 @@
      * @param totalLayer
      * @return
      */
-    private <T extends HollowBigStorageCageBaseInfo> Boolean computeOutGlassInfo(List<T> list, String tableName, int targetSlot, int state, int taskType, int totalLayer) {
+    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<>();
@@ -687,14 +708,17 @@
         Assert.isFalse(CollectionUtil.isEmpty(tempList), "鏈幏鍙栧嚭鐗囨暟鎹紝缁撴潫鍑虹墖浠诲姟");
         log.info("鑾峰彇鍑虹墖浠诲姟鏁版嵁{}鏉★紝鎵ц淇濆瓨", tempList.size());
         List<BigStorageCageTask> bigStorageCageTaskList = tempList;
-        if (taskType == Const.BIG_STORAGE_AFTER_OUT) {
-            if (tempList.size() <= totalLayer) {
-                bigStorageCageTaskList = tempList;
-            } else {
-                int remainCount = tempList.size() % totalLayer;
-//                tempList.subList(0,)
+        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琛ュ叏

--
Gitblit v1.8.0