From cb921a68fe5f01012125fb522086acea2aa255ba Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期五, 27 十二月 2024 14:43:40 +0800
Subject: [PATCH] 1、中空理片笼新增配方相关功能,用于用户自定义保存中空线相关参数,避免重复输入相同的参数 2、领取任务/强制出片改造:在流程卡、路线、数量基础上新增配方id,用于关联本地流程卡的中空的参数配方 3、增加限制:同一条线路的同个流程卡仅能存在一个未完成的任务 4、卧式理片笼新增日期格式
---
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java | 136 +++++++++++++++++++++++++++++++++++++++-----
1 files changed, 119 insertions(+), 17 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 9b7ffb7..17e9a24 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,23 +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.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.entity.request.HollowTaskRequest;
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;
@@ -38,49 +43,146 @@
@Resource
HollowGlassQueueInfoService hollowGlassQueueInfoService;
+ @Resource
+ RedisUtil redisUtil;
+
@Override
- public HollowGlassOutRelationInfo receiveTask(String flowCardId, int cell, int totalPairQuantity) {
- return childrenTask(flowCardId,cell,totalPairQuantity,0);
+ public HollowGlassOutRelationInfo receiveTask(HollowTaskRequest request) {
+ return childrenTask(request, 0);
}
@Override
- public HollowGlassOutRelationInfo forceOutGlass(String flowCardId, int cell, int totalPairQuantity) {
- return childrenTask(flowCardId,cell,totalPairQuantity,1);
+ public HollowGlassOutRelationInfo forceOutGlass(HollowTaskRequest request) {
+ return childrenTask(request, 1);
+ }
+
+ @Override
+ public Boolean dispatchHollowSwitch(Boolean flag) {
+ redisUtil.setCacheObject("dispatchHollowSwitch", flag);
+ return redisUtil.getCacheObject("dispatchHollowSwitch");
+ }
+
+ @Override
+ public List<String> hollowTaskList(int cell) {
+ //鏌ヨ浠诲姟琛ㄤ腑鏈潯绾挎墍鏈夋湭瀹屾垚鐨勪换鍔′俊鎭�
+ List<HollowGlassOutRelationInfo> list = this.list(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
+ .in(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_NEW, Const.HOLLOW_FLOW_CARD_START, Const.HOLLOW_FLOW_CARD_PAUSE)
+ .eq(HollowGlassOutRelationInfo::getCell, cell));
+ if (CollectionUtil.isNotEmpty(list)) {
+ return list.stream().map(HollowGlassOutRelationInfo::getFlowCardId).collect(Collectors.toList());
+ }
+ return new ArrayList<String>();
+ }
+
+ @Override
+ public List<HollowGlassQueueInfo> appointHollowTaskDetails(String flowCardId, int cell) {
+ //鎸夌収娴佺▼鍗″強璺嚎锛屾煡鎵惧搴旂殑浠诲姟淇℃伅
+ HollowGlassOutRelationInfo hollowGlassOutRelationInfo = this.getOne(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
+ .in(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_NEW, Const.HOLLOW_FLOW_CARD_START, Const.HOLLOW_FLOW_CARD_PAUSE)
+ .eq(HollowGlassOutRelationInfo::getFlowCardId, flowCardId)
+ .eq(HollowGlassOutRelationInfo::getCell, cell).last("limit 1"));
+ if (null == hollowGlassOutRelationInfo) {
+ return new ArrayList<HollowGlassQueueInfo>();
+ }
+ //鎸夌収浠诲姟id鏌ヨ瀵瑰垪琛ㄤ腑鐨勯槦鍒椾俊鎭�
+ return hollowGlassQueueInfoService.list(new LambdaQueryWrapper<HollowGlassQueueInfo>()
+ .eq(HollowGlassQueueInfo::getRelationId, hollowGlassOutRelationInfo.getId()));
+ }
+
+ @Override
+ public Boolean startTask(String flowCardId, int cell) {
+ //鏇存柊浠诲姟鐘舵�佷负寮�濮�
+ return this.update(new LambdaUpdateWrapper<HollowGlassOutRelationInfo>()
+ .set(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START)
+ .eq(HollowGlassOutRelationInfo::getFlowCardId, flowCardId)
+ .eq(HollowGlassOutRelationInfo::getCell, cell));
+ }
+
+ @Override
+ public Boolean pauseTask(String flowCardId, int cell) {
+// 鏇存柊浠诲姟鐘舵�佷负鏆傚仠
+ return this.update(new LambdaUpdateWrapper<HollowGlassOutRelationInfo>()
+ .set(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_PAUSE)
+ .eq(HollowGlassOutRelationInfo::getFlowCardId, flowCardId)
+ .eq(HollowGlassOutRelationInfo::getCell, cell));
+ }
+
+ @Override
+ public Boolean finishTask(String flowCardId, int cell) {
+ //娓呯┖闃熷垪琛ㄤ腑鏈畬鎴愮殑鐜荤拑淇℃伅
+ hollowGlassQueueInfoService.remove(new LambdaQueryWrapper<HollowGlassQueueInfo>()
+ .in(HollowGlassQueueInfo::getState, Const.TEMPERING_NEW)
+ .eq(HollowGlassQueueInfo::getFlowCardId, flowCardId)
+ .eq(HollowGlassQueueInfo::getCell, cell));
+ //鏇存柊浠诲姟鐘舵�佹湭宸插畬鎴�
+ return this.update(new LambdaUpdateWrapper<HollowGlassOutRelationInfo>()
+ .set(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_SUCCESS)
+ .eq(HollowGlassOutRelationInfo::getFlowCardId, flowCardId)
+ .eq(HollowGlassOutRelationInfo::getCell, cell));
+ }
+
+ @Override
+ public Boolean deleteHollowTaskDetails(String flowCardId, int cell) {
+ //鎸夌収娴佺▼鍗″強璺嚎锛屾煡鎵惧搴旂殑浠诲姟淇℃伅
+ this.remove(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
+ .in(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_NEW, Const.HOLLOW_FLOW_CARD_START, Const.HOLLOW_FLOW_CARD_PAUSE)
+ .eq(HollowGlassOutRelationInfo::getFlowCardId, flowCardId)
+ .eq(HollowGlassOutRelationInfo::getCell, cell));
+ hollowGlassQueueInfoService.remove(new LambdaQueryWrapper<HollowGlassQueueInfo>()
+ .in(HollowGlassQueueInfo::getState, Const.TEMPERING_NEW)
+ .eq(HollowGlassQueueInfo::getFlowCardId, flowCardId)
+ .eq(HollowGlassQueueInfo::getCell, cell));
+ return Boolean.TRUE;
}
- 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"));
+ private HollowGlassOutRelationInfo childrenTask(HollowTaskRequest request, int isForce) {
+ GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getFlowCardId, request.getFlowCardId()).last("limit 1"));
HollowGlassOutRelationInfo info = new HollowGlassOutRelationInfo();
if (null == glassInfo) {
log.info("璇ユ祦绋嬪崱淇℃伅绯荤粺鏈壘鍒�");
return info;
}
- info.setFlowCardId(flowCardId);
- info.setCell(cell);
+ List<HollowGlassOutRelationInfo> outRelationInfos = this.list(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
+ .eq(HollowGlassOutRelationInfo::getCell, request.getCell())
+ .eq(HollowGlassOutRelationInfo::getFlowCardId, request.getFlowCardId())
+ .in(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_NEW, Const.HOLLOW_FLOW_CARD_START, Const.HOLLOW_FLOW_CARD_PAUSE));
+ if (CollectionUtil.isNotEmpty(outRelationInfos)) {
+ log.info("褰撳墠娴佺▼鍗″湪鏈潯绾挎湁鏈畬鎴愮殑浠诲姟");
+ return null;
+ }
+ //淇濆瓨浠诲姟鍏崇郴涓昏〃
+ info.setFlowCardId(request.getFlowCardId());
+ info.setCell(request.getCell());
info.setIsForce(isForce);
info.setTotalLayer(glassInfo.getTotalLayer());
- info.setState(Const.HOLLOW_FLOW_CARD_START);
- info.setTotalPairQuantity(totalPairQuantity);
- List<HollowBigStorageCageDetails> hollowBigStorageCageDetailsList = hollowBigStorageCageDetailsService.queryOutGlassList(flowCardId, cell);
- int isPairCount = glassInfo.getTotalLayer() * totalPairQuantity;
+ info.setState(Const.HOLLOW_FLOW_CARD_NEW);
+ info.setTotalPairQuantity(request.getTotalPairQuantity());
+ info.setFormulaId(request.getFormulaId());
+ this.save(info);
+ // 鏌ヨ鍑洪渶瑕佸嚭鐜荤拑鐨勯槦鍒�
+ List<HollowBigStorageCageDetails> hollowBigStorageCageDetailsList = hollowBigStorageCageDetailsService
+ .queryOutGlassList(request.getFlowCardId(), request.getCell());
+ int isPairCount = glassInfo.getTotalLayer() * request.getTotalPairQuantity();
List<HollowGlassQueueInfo> hollowQueues = new ArrayList<>();
loop:
for (HollowBigStorageCageDetails queue : hollowBigStorageCageDetailsList) {
HollowGlassQueueInfo queueInfo = new HollowGlassQueueInfo();
BeanUtils.copyProperties(queue, queueInfo);
+ queueInfo.setRelationId(info.getId());
queueInfo.setState(Const.TEMPERING_NEW);
- queueInfo.setCell(cell);
+ queueInfo.setCell(request.getCell());
+ queueInfo.setCreateTime(new Date());
+ queueInfo.setUpdateTime(new Date());
hollowQueues.add(queueInfo);
- if (queue.getIsPair() == 1){
- isPairCount -=1;
- if (isPairCount == 0){
+ if (queue.getIsPair() == 1) {
+ isPairCount -= 1;
+ if (isPairCount == 0) {
break loop;
}
}
}
hollowGlassQueueInfoService.saveBatch(hollowQueues);
- this.save(info);
return info;
}
}
--
Gitblit v1.8.0