From f62353986a6afff2e2a5a17cfdec30d04a4e600d Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期六, 07 十二月 2024 16:50:09 +0800
Subject: [PATCH] 1、fixbug:缺片详情临时解决 将所有缺片信息返回 2、新增膜系 状态:避免同一块玻璃占用完相同尺寸关系表 3、中空界面注释开始暂停按钮 4、领取/强制执行任务增加限制,必须在本条线没有任务的情况下可以领取

---
 hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java |  159 +++++++++++++++++++++++++++++++++--------------------
 1 files changed, 99 insertions(+), 60 deletions(-)

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 241f50f..3516652 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
@@ -162,43 +162,56 @@
 
         //璁$畻鐩爣鏍煎瓙
         List<HollowBigStorageCageHistoryTask> historyTasks = new ArrayList<>();
-        for (BigStorageCageTask task : inTaskList) {
-            GlassInfo info = glassListMap.get(task.getGlassId()).get(0);
-            HollowBigStorageDTO bigStorageDTO = hollowGlassRelationInfoService.queryHollowTargetSlot(info.getFlowCardId(),
-                    info.getWidth(), info.getHeight(), info.getTotalLayer(), info.getLayer());
+        try {
+            for (BigStorageCageTask task : inTaskList) {
+                GlassInfo info = glassListMap.get(task.getGlassId()).get(0);
+                HollowBigStorageDTO bigStorageDTO = hollowGlassRelationInfoService.queryHollowTargetSlot(info.getFlowCardId(),
+                        info.getWidth(), info.getHeight(), info.getTotalLayer(), info.getLayer());
 //            涓存椂鏇存柊鏍煎瓙鐨勫墿浣欏昂瀵革細闃叉鐩搁偦鐜荤拑杩涘悓涓�鏍煎瓙閫犳垚鍓╀綑灏哄涓嶈冻锛岀幓鐠冭秺鐣岀殑鎯呭喌锛屼换鍔″畬鎴愬悗鍐嶆鏇存柊澶х悊鐗囩琛ㄥ墿浣欏搴︼紙鎸夌収绗煎唴鐜荤拑鏁伴噺鏇存柊澶х悊鐗囩鍓╀綑灏哄锛�
-            hollowBigStorageCageService.update(new LambdaUpdateWrapper<HollowBigStorageCage>()
-                    .set(HollowBigStorageCage::getRemainWidth, bigStorageDTO.getRemainWidth() - Math.max(info.getWidth(), info.getHeight()) - glassGap)
-                    .eq(HollowBigStorageCage::getSlot, bigStorageDTO.getSlot()));
-            task.setTargetSlot(bigStorageDTO.getSlot());
-            task.setGlassId(info.getGlassId());
-            bigStorageCageTaskService.updateTaskMessage(BIG_STORAGE_CAGE_IN_TWO_TASK, task);
-            //瀛樻斁鍘嗗彶浠诲姟
-            HollowBigStorageCageHistoryTask historyTask = new HollowBigStorageCageHistoryTask();
-            BeanUtils.copyProperties(task, historyTask);
-            historyTask.setTaskType(Const.BIG_STORAGE_AFTER_IN);
-            historyTask.setGlassCount(glassInfoList.size());
-            historyTask.setTaskState(Const.ENGINEERING_NEW);
-            historyTasks.add(historyTask);
-            //瀛樻斁璇︽儏鏁版嵁
-            HollowBigStorageCageDetails cageDetails = new HollowBigStorageCageDetails();
-            BeanUtils.copyProperties(bigStorageDTO, cageDetails);
-            BeanUtils.copyProperties(info, cageDetails);
-            cageDetails.setState(Const.GLASS_STATE_NEW);
-            cageDetails.setSequence(bigStorageDTO.getSlotSequence());
-            cageDetails.setGap(glassGap);
-            cageDetails.setId(null);
-            hollowBigStorageCageDetailsService.save(cageDetails);
+                hollowBigStorageCageService.update(new LambdaUpdateWrapper<HollowBigStorageCage>()
+                        .set(HollowBigStorageCage::getRemainWidth, bigStorageDTO.getRemainWidth() - Math.max(info.getWidth(), info.getHeight()) - glassGap)
+                        .eq(HollowBigStorageCage::getSlot, bigStorageDTO.getSlot()));
+                task.setTargetSlot(bigStorageDTO.getSlot());
+                task.setGlassId(info.getGlassId());
+                bigStorageCageTaskService.updateTaskMessage(BIG_STORAGE_CAGE_IN_TWO_TASK, task);
+                //瀛樻斁鍘嗗彶浠诲姟
+                HollowBigStorageCageHistoryTask historyTask = new HollowBigStorageCageHistoryTask();
+                BeanUtils.copyProperties(task, historyTask);
+                historyTask.setTaskType(Const.BIG_STORAGE_AFTER_IN);
+                historyTask.setGlassCount(glassInfoList.size());
+                historyTask.setTaskState(Const.ENGINEERING_NEW);
+                historyTasks.add(historyTask);
+                //瀛樻斁璇︽儏鏁版嵁
+                HollowBigStorageCageDetails cageDetails = new HollowBigStorageCageDetails();
+                BeanUtils.copyProperties(bigStorageDTO, cageDetails);
+                BeanUtils.copyProperties(info, cageDetails);
+                cageDetails.setState(Const.GLASS_STATE_NEW);
+                cageDetails.setSequence(bigStorageDTO.getSlotSequence());
+                cageDetails.setGap(glassGap);
+                cageDetails.setId(null);
+                hollowBigStorageCageDetailsService.save(cageDetails);
+                hollowGlassRelationInfoService.update(new LambdaUpdateWrapper<HollowGlassRelationInfo>()
+                        .set(HollowGlassRelationInfo::getGlassId, cageDetails.getGlassId())
+                        .set(HollowGlassRelationInfo::getTemperingLayoutId, cageDetails.getTemperingLayoutId())
+                        .set(HollowGlassRelationInfo::getTemperingFeedSequence, cageDetails.getTemperingFeedSequence())
+                        .set(HollowGlassRelationInfo::getEngineerId, cageDetails.getEngineerId())
+                        .set(HollowGlassRelationInfo::getState, Const.HOLLOW_RELATION_OCCUPY)
+                        .eq(HollowGlassRelationInfo::getFlowCardId, bigStorageDTO.getFlowCardId())
+                        .eq(HollowGlassRelationInfo::getLayer, bigStorageDTO.getLayer())
+                        .eq(HollowGlassRelationInfo::getVirtualSlot, bigStorageDTO.getVirtualSlot())
+                        .eq(HollowGlassRelationInfo::getSlotSequence, bigStorageDTO.getSlotSequence())
+                        .eq(HollowGlassRelationInfo::getHollowSequence, bigStorageDTO.getHollowSequence())
+                );
+            }
+        } catch (Exception exception) {
+            log.info("杩涚墖浠诲姟鎵ц涓彂鐢熷紓甯革細{}", exception);
             hollowGlassRelationInfoService.update(new LambdaUpdateWrapper<HollowGlassRelationInfo>()
-                    .set(HollowGlassRelationInfo::getGlassId, cageDetails.getGlassId())
-                    .set(HollowGlassRelationInfo::getTemperingLayoutId, cageDetails.getTemperingLayoutId())
-                    .set(HollowGlassRelationInfo::getTemperingFeedSequence, cageDetails.getTemperingFeedSequence())
-                    .set(HollowGlassRelationInfo::getEngineerId, cageDetails.getEngineerId())
-                    .eq(HollowGlassRelationInfo::getFlowCardId, bigStorageDTO.getFlowCardId())
-                    .eq(HollowGlassRelationInfo::getLayer, bigStorageDTO.getLayer())
-                    .eq(HollowGlassRelationInfo::getVirtualSlot, bigStorageDTO.getVirtualSlot())
-                    .eq(HollowGlassRelationInfo::getSlotSequence, bigStorageDTO.getSlotSequence())
-                    .eq(HollowGlassRelationInfo::getHollowSequence, bigStorageDTO.getHollowSequence())
+                    .set(HollowGlassRelationInfo::getGlassId, null)
+                    .set(HollowGlassRelationInfo::getTemperingLayoutId, null)
+                    .set(HollowGlassRelationInfo::getTemperingFeedSequence, null)
+                    .set(HollowGlassRelationInfo::getEngineerId, null)
+                    .set(HollowGlassRelationInfo::getState, Const.HOLLOW_RELATION_NEW)
+                    .eq(HollowGlassRelationInfo::getState, Const.HOLLOW_RELATION_OCCUPY)
             );
         }
         //鍘嗗彶鏁版嵁鍏ュ簱
@@ -274,7 +287,7 @@
             if (CollectionUtil.isNotEmpty(unFinishHollowQueueList)) {
                 log.info("鏈夋鍦ㄥ嚭鐗囩殑涓┖浠诲姟");
                 Integer isPair = unFinishHollowQueueList.get(0).getIsPair();
-                hollowOutGlassByIsPair(unFinishHollowQueueList, hollowGlassOutRelationInfo.getCell(), isPair, hollowGlassOutRelationInfo.getTotalLayer(),hollowGlassOutRelationInfo.getIsForce());
+                hollowOutGlassByIsPair(unFinishHollowQueueList, hollowGlassOutRelationInfo.getCell(), isPair, hollowGlassOutRelationInfo.getTotalLayer(), hollowGlassOutRelationInfo.getIsForce());
                 Date endDate = new Date();
                 log.info("澶х悊鐗囩鍑虹墖浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
                 return;
@@ -367,7 +380,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,0);
+                        hollowOutGlassByIsPair(list, targetSlot, 0, 0, 0);
                         List<Integer> slotList = new ArrayList<>();
                         slotList.add(targetSlot);
                         updateSlotRemainBySlots(slotList);
@@ -440,12 +453,38 @@
                 hollowBigStorageCageDetailsService.updateBySlot(storageCageDTOList, Const.GLASS_STATE_IN);
                 log.info("4銆佸ぇ鐞嗙墖绗艰繘鐗囩姸鎬佸凡瀹屾垚宸插畬鎴愮殑鐜荤拑淇℃伅id:{}", v);
                 updateSlotRemainBySlots(inSuccessGlassSlot);
+                List<String> glassList = v.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList());
+                hollowGlassRelationInfoService.update(new LambdaUpdateWrapper<HollowGlassRelationInfo>()
+                        .set(HollowGlassRelationInfo::getState, Const.HOLLOW_RELATION_SUCCESS)
+                        .eq(HollowGlassRelationInfo::getState, Const.HOLLOW_RELATION_OCCUPY)
+                        .in(HollowGlassRelationInfo::getGlassId, glassList)
+                );
             } else if (e1 == 3) {
                 //鐮存崯澶勭悊
                 dealDamageInTask(v);
+                List<String> glassList = v.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList());
+                hollowGlassRelationInfoService.update(new LambdaUpdateWrapper<HollowGlassRelationInfo>()
+                        .set(HollowGlassRelationInfo::getGlassId, null)
+                        .set(HollowGlassRelationInfo::getTemperingLayoutId, null)
+                        .set(HollowGlassRelationInfo::getTemperingFeedSequence, null)
+                        .set(HollowGlassRelationInfo::getEngineerId, null)
+                        .set(HollowGlassRelationInfo::getState, Const.HOLLOW_RELATION_NEW)
+                        .eq(HollowGlassRelationInfo::getState, Const.HOLLOW_RELATION_OCCUPY)
+                        .in(HollowGlassRelationInfo::getGlassId, glassList)
+                );
             } else {
                 //娓呯┖鐞嗙墖绗肩┖鏁版嵁
                 noDealInTask(v);
+                List<String> glassList = v.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList());
+                hollowGlassRelationInfoService.update(new LambdaUpdateWrapper<HollowGlassRelationInfo>()
+                        .set(HollowGlassRelationInfo::getGlassId, null)
+                        .set(HollowGlassRelationInfo::getTemperingLayoutId, null)
+                        .set(HollowGlassRelationInfo::getTemperingFeedSequence, null)
+                        .set(HollowGlassRelationInfo::getEngineerId, null)
+                        .set(HollowGlassRelationInfo::getState, Const.HOLLOW_RELATION_NEW)
+                        .eq(HollowGlassRelationInfo::getState, Const.HOLLOW_RELATION_OCCUPY)
+                        .in(HollowGlassRelationInfo::getGlassId, glassList)
+                );
             }
         });
         for (BigStorageCageTask item : inTaskList) {
@@ -560,36 +599,36 @@
         try {
             //鏇存柊鏁伴噺
             //鎸夌収鐜荤拑id鑾峰彇闇�瑕佸嚭鐗囧鍒楄〃涓殑鏁版嵁
-            if(finalTaskType.equals(Const.BIG_STORAGE_AFTER_OUT) ){
+            if (finalTaskType.equals(Const.BIG_STORAGE_AFTER_OUT)) {
                 HollowGlassQueueInfo hollowGlassQueueInfo = hollowGlassQueueInfoService.getOne(new LambdaQueryWrapper<HollowGlassQueueInfo>()
                         .eq(HollowGlassQueueInfo::getGlassId, outTaskList.get(0).getGlassId())
                         .orderByDesc(HollowGlassQueueInfo::getUpdateTime).last("limit 1"));
                 List<HollowGlassQueueInfo> list = hollowGlassQueueInfoService.list(new LambdaQueryWrapper<HollowGlassQueueInfo>()
-                        .eq(HollowGlassQueueInfo::getFlowCardId, hollowGlassQueueInfo.getFlowCardId())
-                        .eq(HollowGlassQueueInfo::getCell, hollowGlassQueueInfo.getCell())
+                                .eq(HollowGlassQueueInfo::getFlowCardId, hollowGlassQueueInfo.getFlowCardId())
+                                .eq(HollowGlassQueueInfo::getCell, hollowGlassQueueInfo.getCell())
 //                        .eq(HollowGlassQueueInfo::getIsPair, 1)
-                        .eq(HollowGlassQueueInfo::getState, Const.TEMPERING_NEW)
+                                .eq(HollowGlassQueueInfo::getState, Const.TEMPERING_NEW)
                 );
-                if (CollectionUtil.isEmpty(list)){
+                if (CollectionUtil.isEmpty(list)) {
 //                浠诲姟鏇存柊涓哄凡瀹屾垚
                     hollowGlassOutRelationInfoService.update(new UpdateWrapper<HollowGlassOutRelationInfo>()
-                            .eq("flow_card_id",hollowGlassQueueInfo.getFlowCardId())
-                            .eq("cell",hollowGlassQueueInfo.getCell())
+                            .eq("flow_card_id", hollowGlassQueueInfo.getFlowCardId())
+                            .eq("cell", hollowGlassQueueInfo.getCell())
                             .setSql("pair_quantity = total_pair_quantity")
-                            .set("state",Const.HOLLOW_FLOW_CARD_SUCCESS)
+                            .set("state", Const.HOLLOW_FLOW_CARD_SUCCESS)
                     );
-                }else{
+                } else {
 //               璁$畻鍓╀綑鐜荤拑瀵规暟锛岀敤浠诲姟鎬婚槦鏁板噺鍓╀綑瀵规暟
                     int remainCount = list.size() / hollowGlassQueueInfo.getTotalLayer();
                     hollowGlassOutRelationInfoService.update(new UpdateWrapper<HollowGlassOutRelationInfo>()
-                            .eq("flow_card_id",hollowGlassQueueInfo.getFlowCardId())
-                            .eq("cell",hollowGlassQueueInfo.getCell())
-                            .setSql("pair_quantity = total_pair_quantity -"+remainCount)
+                            .eq("flow_card_id", hollowGlassQueueInfo.getFlowCardId())
+                            .eq("cell", hollowGlassQueueInfo.getCell())
+                            .setSql("pair_quantity = total_pair_quantity -" + remainCount)
                     );
                 }
             }
-        }catch (Exception e){
-            log.info("璁$畻鐜荤拑鏁伴噺杩囩▼涓嚭鐜伴敊璇紝閿欒淇℃伅{}",e.getMessage());
+        } catch (Exception e) {
+            log.info("璁$畻鐜荤拑鏁伴噺杩囩▼涓嚭鐜伴敊璇紝閿欒淇℃伅{}", e.getMessage());
         }
 
 //        hollowGlassOutRelationInfoService.update
@@ -703,7 +742,7 @@
     }
 
 
-    private <T extends HollowBigStorageCageBaseInfo> Boolean hollowOutGlassByIsPair(List<T> list, int targetSlot, int isPair, int totalLayer,int isForce) {
+    private <T extends HollowBigStorageCageBaseInfo> Boolean hollowOutGlassByIsPair(List<T> list, int targetSlot, int isPair, int totalLayer, int isForce) {
         List<T> resultList = new ArrayList<>();
         List<T> tempList = new ArrayList<>();
         int taskType = Const.BIG_STORAGE_AFTER_OUT;
@@ -711,25 +750,25 @@
         for (T t : list) {
             if (isPair == (t.getIsPair() == null ? 0 : t.getIsPair())) {
                 tempList.add(t);
-            }else{
+            } else {
                 break;
             }
         }
-        if (isPair == 0 && isForce!=1) {
+        if (isPair == 0 && isForce != 1) {
             taskType = Const.BIG_STORAGE_AFTER_DISPATCH;
             taskState = Const.GLASS_STATE_SCHEDULE_ING;
             resultList.add(list.get(0));
             //鐩墠璋冨害浠诲姟totalLayer涓�0  鍑虹墖璋冨害浠诲姟鏈夊眰鍙凤紝鐢ㄤ簬鍖哄垎璋冨害鏂瑰紡
-            if (totalLayer !=0){
+            if (totalLayer != 0) {
                 HollowBigStorageCage storageCage = hollowBigStorageCageService.getOne(new LambdaQueryWrapper<HollowBigStorageCage>()
                         .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON).eq(HollowBigStorageCage::getRemainWidth, slotWidth).last("limit 1"));
                 targetSlot = storageCage.getSlot();
             }
             totalLayer = 0;
-        }else{
+        } else {
             resultList = tempList;
         }
-        return computeOutGlassInfo(resultList, BIG_STORAGE_CAGE_OUT_TWO_TASK, targetSlot, taskState, taskType, totalLayer,isForce);
+        return computeOutGlassInfo(resultList, BIG_STORAGE_CAGE_OUT_TWO_TASK, targetSlot, taskState, taskType, totalLayer, isForce);
     }
 
     /**
@@ -740,7 +779,7 @@
      * @param totalLayer
      * @return
      */
-    private <T extends HollowBigStorageCageBaseInfo> Boolean computeOutGlassInfo(List<T> list, String tableName, int targetSlot, int state, int taskType, int totalLayer,int isForce) {
+    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<>();
@@ -759,13 +798,13 @@
         Assert.isFalse(CollectionUtil.isEmpty(tempList), "鏈幏鍙栧嚭鐗囨暟鎹紝缁撴潫鍑虹墖浠诲姟");
         log.info("鑾峰彇鍑虹墖浠诲姟鏁版嵁{}鏉★紝鎵ц淇濆瓨", tempList.size());
         List<BigStorageCageTask> bigStorageCageTaskList = tempList;
-        if (1!= isForce){
+        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);
+                    bigStorageCageTaskList = tempList.subList(0, tempList.size() - remainCount);
                 }
             }
         }

--
Gitblit v1.8.0