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/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java |   44 ++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 42 insertions(+), 2 deletions(-)

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;
     }
 }

--
Gitblit v1.8.0