From e31a077927d47bd05bcfdc3367deafb8c4069c6d Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期四, 26 十二月 2024 23:57:34 +0800
Subject: [PATCH] 1、卧式理片玻璃替换仅替换版图信息 2、指定钢化、指定工程fixbug:膜系字段修改为filmsId 3、移除大理片笼向前端推送钢化历史任务数据 4、中空领取任务界面接口改造:新增开始/暂停/结束任务按钮,流程卡列表、预览任务、删除任务接口 5、领取/强制任务接口改造:新增除膜信息、李赛克文件需要的数据信息

---
 hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java |  132 +++++++++++++++++++++++++++++++++++++-------
 1 files changed, 111 insertions(+), 21 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 e110c40..f9f171e 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
@@ -2,15 +2,19 @@
 
 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.HollowGlassOutRelationTaskDetails;
+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.hollow.service.HollowGlassOutRelationTaskDetailsService;
 import com.mes.hollowqueue.entity.HollowGlassQueueInfo;
 import com.mes.hollowqueue.service.HollowGlassQueueInfoService;
 import com.mes.utils.RedisUtil;
@@ -40,66 +44,152 @@
     HollowBigStorageCageDetailsService hollowBigStorageCageDetailsService;
     @Resource
     HollowGlassQueueInfoService hollowGlassQueueInfoService;
+    @Resource
+    HollowGlassOutRelationTaskDetailsService hollowGlassOutRelationTaskDetailsService;
 
     @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");
+        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;
         }
-        List<HollowGlassOutRelationInfo> outRelationInfos = this.list(new LambdaQueryWrapper<HollowGlassOutRelationInfo>().eq(HollowGlassOutRelationInfo::getCell, cell)
-                .in(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START));
-        if (CollectionUtil.isNotEmpty(outRelationInfos)){
+        List<HollowGlassOutRelationInfo> outRelationInfos = this.list(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
+                .eq(HollowGlassOutRelationInfo::getCell, request.getCell())
+                .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START));
+        if (CollectionUtil.isNotEmpty(outRelationInfos)) {
+            log.info("鏈夋鍦ㄦ墽琛岀殑浠诲姟");
             return null;
         }
-        info.setFlowCardId(flowCardId);
-        info.setCell(cell);
+        //淇濆瓨浠诲姟鍏崇郴涓昏〃
+        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());
+        this.save(info);
+        //淇濆瓨浠诲姟璇︽儏琛�
+        HollowGlassOutRelationTaskDetails taskDetails = new HollowGlassOutRelationTaskDetails();
+        BeanUtils.copyProperties(request, taskDetails);
+        taskDetails.setRelationId(info.getId());
+        hollowGlassOutRelationTaskDetailsService.save(taskDetails);
+        // 鏌ヨ鍑洪渶瑕佸嚭鐜荤拑鐨勯槦鍒�
+        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