From b9b44b51b201e2f5a9a1f3665c7fb76b5690f9af Mon Sep 17 00:00:00 2001
From: wu <731351411@qq.com>
Date: 星期一, 23 十二月 2024 16:13:08 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java | 66 +++++++++++++++++++++++++++++++-
1 files changed, 63 insertions(+), 3 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 76e0636..e110c40 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
@@ -1,17 +1,28 @@
package com.mes.hollow.service.impl;
+import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.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 com.mes.utils.RedisUtil;
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.Date;
+import java.util.List;
+import java.util.stream.Collectors;
/**
* (HollowGlassOutRelationInfo)琛ㄦ湇鍔″疄鐜扮被
@@ -25,20 +36,69 @@
@Resource
GlassInfoService glassInfoService;
+ @Resource
+ HollowBigStorageCageDetailsService hollowBigStorageCageDetailsService;
+ @Resource
+ HollowGlassQueueInfoService hollowGlassQueueInfoService;
+
+ @Resource
+ RedisUtil redisUtil;
@Override
- public HollowGlassOutRelationInfo receiveTask(String flowCardId, int cell) {
+ 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);
+ }
+
+ @Override
+ public Boolean dispatchHollowSwitch(Boolean flag) {
+ redisUtil.setCacheObject("dispatchHollowSwitch", flag);
+ return redisUtil.getCacheObject("dispatchHollowSwitch");
+ }
+
+
+ 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) {
log.info("璇ユ祦绋嬪崱淇℃伅绯荤粺鏈壘鍒�");
return info;
}
+ List<HollowGlassOutRelationInfo> outRelationInfos = this.list(new LambdaQueryWrapper<HollowGlassOutRelationInfo>().eq(HollowGlassOutRelationInfo::getCell, cell)
+ .in(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START));
+ if (CollectionUtil.isNotEmpty(outRelationInfos)){
+ return null;
+ }
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);
+ 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);
+ queueInfo.setCreateTime(new Date());
+ queueInfo.setUpdateTime(new Date());
+ hollowQueues.add(queueInfo);
+ if (queue.getIsPair() == 1){
+ isPairCount -=1;
+ if (isPairCount == 0){
+ break loop;
+ }
+ }
+ }
+ hollowGlassQueueInfoService.saveBatch(hollowQueues);
this.save(info);
return info;
}
--
Gitblit v1.8.0