From 9ae0e3d68b255dd6df31ea55d9b6eda1a61708dd Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期三, 15 一月 2025 10:13:17 +0800
Subject: [PATCH] 1、测试类报错删除 2、修改opc配置

---
 hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java |   98 +++++++++----------------------------------------
 1 files changed, 18 insertions(+), 80 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 d7e8364..f412f58 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
@@ -195,7 +195,7 @@
         //鎶ュ伐
         log.info("灏嗘帴鏀跺埌鐨勭幓鐠冭繘琛岄挗鍖栬嚜鍔ㄦ姤宸ワ紝鐜荤拑id鏈夛細{}", glassIdList);
         for (String glass : glassIdList) {
-            damageService.autoSubmitReport(glass, inTaskList.get(0).getStartSlot(), "閽㈠寲", "杩涗腑绌虹悊鐗囩");
+            damageService.autoSubmitReport(glass, inTaskList.get(0).getStartSlot(), "閽㈠寲", "杩涗腑绌虹悊鐗囩", 1);
         }
         Map<String, List<GlassInfo>> glassListMap = glassInfoList.stream().collect(Collectors.groupingBy(GlassInfo::getGlassId));
 
@@ -285,12 +285,11 @@
         }
 
         //鑾峰彇绌洪棽涓旈鍙栦换鍔$殑鏁版嵁淇℃伅锛屾病鏈変换鍔$洿鎺ヨ蛋鐜荤拑璋冨害
-        ReadWriteEntity oneEntity = miloService.readFromOpcUa("DLP2B.DLP2B.outOneRequest");
-        ReadWriteEntity twoEntity = miloService.readFromOpcUa("DLP2B.DLP2B.outTwoRequest");
-        ReadWriteEntity threeEntity = miloService.readFromOpcUa("DLP2B.DLP2B.outThreeRequest");
-        int cell = -1;
+        ReadWriteEntity oneEntity = miloService.readFromOpcUa("CMJ1.CMJ1.isFree");
         HollowGlassOutRelationInfo hollowGlassOutRelationInfo = null;
-        if ("1".equals(oneEntity.getValue() + "")) {
+        int cell = -1;
+        //鏉庤禌鍏嬬嚎闇�瑕佽幏鍙栭煩姹焢lc鐨勭嚎璺┖闂茬姸鎬侊細10000000绗�8浣嶄负 1琛ㄧず蹇欑 0琛ㄧず绌洪棽
+        if (null != oneEntity.getValue() && "1".equals(oneEntity.getValue() + "")) {
             cell = 930;
             hollowGlassOutRelationInfo = hollowGlassOutRelationInfoService
                     .getOne(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
@@ -298,7 +297,9 @@
                             .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START)
                     );
         }
-        if (1 == 1 || null == hollowGlassOutRelationInfo && "1".equals(twoEntity.getValue() + "")) {
+
+        ReadWriteEntity twoEntity = miloService.readFromOpcUa("ZKQ2.ZKQ2.isFree");
+        if (null == hollowGlassOutRelationInfo && null != twoEntity.getValue() && Boolean.parseBoolean(twoEntity.getValue() + "")) {
             cell = 931;
             hollowGlassOutRelationInfo = hollowGlassOutRelationInfoService
                     .getOne(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
@@ -306,14 +307,7 @@
                             .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START)
                     );
         }
-        if (null == hollowGlassOutRelationInfo && "1".equals(threeEntity.getValue() + "")) {
-            cell = 932;
-            hollowGlassOutRelationInfo = hollowGlassOutRelationInfoService
-                    .getOne(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
-                            .eq(HollowGlassOutRelationInfo::getCell, cell)
-                            .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START)
-                    );
-        }
+
         if (null != hollowGlassOutRelationInfo) {
             //鏄惁鍏佽涓┖
             //鏄惁鏈夋鍦ㄤ腑绌虹殑鐜荤拑:涓┖灏忕墖琛ㄧ瓫閫夋湭鍑虹鐨勭幓鐠冧俊鎭�
@@ -337,63 +331,6 @@
                         .eq(HollowGlassOutRelationInfo::getCell, hollowGlassOutRelationInfo.getCell())
                         .set(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_SUCCESS));
             }
-//            if (redisUtil.getCacheObject("hollowSwitch")) {
-//                List<HollowGlassOutRelationInfo> HollowGlassOutRelationInfoList = hollowGlassOutRelationInfoService
-//                        .list(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
-//                                .eq(HollowGlassOutRelationInfo::getCell, cell)
-//                                .eq(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_NEW));
-//                for (HollowGlassOutRelationInfo e : HollowGlassOutRelationInfoList) {
-//                    //涓┖浼樺厛锛氳幏鍙栫悊鐗囩  鐜荤拑灏忕墖  鐮存崯琛� 鏁伴噺   鍒ゆ柇绗煎唴鐗堝浘鏄惁鍒伴綈
-//                    List<FlowCardGlassInfoDTO> flowCardGlassInfoDTO = hollowBigStorageCageDetailsService.hollowIsAll(e.getFlowCardId(), e.getTotalLayer(), Boolean.TRUE);
-//                    if (CollectionUtil.isNotEmpty(flowCardGlassInfoDTO)) {
-//                        //鐜荤拑鍒伴綈鍖呮嫭宸插嚭鐗囩殑
-//                        //鍒伴綈锛屽皢鐜荤拑灏忕墖鏁版嵁瀛樺叆涓┖灏忕墖琛紝閫昏緫鐢熸垚鍑虹墖浠诲姟  缁撴潫
-//                        for (FlowCardGlassInfoDTO item : flowCardGlassInfoDTO) {
-//                            List<HollowBigStorageCageDetails> hollowBigStorageCageDetailsList = hollowBigStorageCageDetailsService.queryOutGlassList(item.getFlowCardId(), cell);
-//                            int finalCell = cell;
-//                            List<HollowGlassQueueInfo> hollowQueues = hollowBigStorageCageDetailsList.stream().map(queue -> {
-//                                HollowGlassQueueInfo queueInfo = new HollowGlassQueueInfo();
-//                                BeanUtils.copyProperties(queue, queueInfo);
-//                                queueInfo.setState(Const.TEMPERING_NEW);
-//                                queueInfo.setCell(finalCell);
-//                                return queueInfo;
-//                            }).collect(Collectors.toList());
-//
-//                            List<HollowBigStorageCageDetails> hollowBigStorageCageDetailsList = hollowBigStorageCageDetailsService.queryOutGlassList(flowCardId, cell);
-//                            int isPairCount = glassInfo.getTotalLayer() * e.getTotalLayer();
-//                            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;
-//                                    }
-//                                }
-//                            }
-//
-//                            if (CollectionUtil.isNotEmpty(hollowQueues)) {
-//                                hollowGlassQueueInfoService.saveBatch(hollowQueues);
-//                                Integer isPair = hollowQueues.get(0).getIsPair();
-//                                hollowOutGlassByIsPair(hollowQueues, cell, isPair, e.getTotalLayer());
-//                                //灏嗕腑绌轰换鍔$姸鎬佹敼涓哄紑濮�
-//                                hollowGlassOutRelationInfoService.update(new LambdaUpdateWrapper<HollowGlassOutRelationInfo>()
-//                                        .eq(HollowGlassOutRelationInfo::getFlowCardId, e.getFlowCardId())
-//                                        .eq(HollowGlassOutRelationInfo::getCell, cell)
-//                                        .set(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START));
-//                                Date endDate = new Date();
-//                                log.info("澶х悊鐗囩鍑虹墖浠诲姟缁撴潫鏃堕棿锛歿}锛屽叡鑰楁椂锛歿}ms,缁撴潫鎵爜浠诲姟", endDate, endDate.getTime() - startDate.getTime());
-//                                return;
-//                            }
-//                        }
-//                    }
-//                }
-//            }
         }
 //        redisUtil.setCacheObject("dispatchHollowSwitch",true);
         //鏄惁瀛樺湪闇�瑕佸唴閮ㄨ皟搴︾殑鏍煎瓙:鎵ц鍐呴儴璋冨害浠诲姟
@@ -603,6 +540,9 @@
                     hollowBigStorageCageDetailsService.updateBySlot(storageCageDTOList, Const.GLASS_STATE_OUT);
                 } else {
                     hollowBigStorageCageDetailsService.updateBySlot(storageCageDTOList, Const.GLASS_STATE_IN);
+                    //鎸夌収鏍煎瓙淇℃伅鏇存柊瀵瑰簲鐨勮澶噄d
+                    List<Integer> slotList = storageCageDTOList.stream().map(UpdateHollowBigStorageCageDTO::getTargetSlot).distinct().collect(Collectors.toList());
+                    hollowBigStorageCageDetailsService.updateDeviceIdBySlot(slotList);
                 }
                 log.info("4銆佸ぇ鐞嗙墖绗艰繘鐗囩姸鎬佸凡瀹屾垚宸插畬鎴愮殑鐜荤拑淇℃伅id:{}", v);
                 updateSlotRemainBySlots(outSuccessGlassSlot);
@@ -801,7 +741,11 @@
             if (totalLayer != 0) {
                 resultList.add(list.get(0));
                 HollowBigStorageCage storageCage = hollowBigStorageCageService.getOne(new LambdaQueryWrapper<HollowBigStorageCage>()
-                        .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON).eq(HollowBigStorageCage::getRemainWidth, slotWidth).last("limit 1"));
+                        .eq(HollowBigStorageCage::getEnableState, Const.SLOT_ON)
+                        .le(HollowBigStorageCage::getMinThickness, list.get(0).getThickness())
+                        .ge(HollowBigStorageCage::getMaxThickness, list.get(0).getThickness())
+                        .eq(HollowBigStorageCage::getRemainWidth, slotWidth)
+                        .orderByAsc(HollowBigStorageCage::getMaxThickness).last("limit 1"));
                 targetSlot = storageCage.getSlot();
                 hollowBigStorageCageService.update(new LambdaUpdateWrapper<HollowBigStorageCage>()
                         .set(HollowBigStorageCage::getRemainWidth, 0).eq(HollowBigStorageCage::getSlot, targetSlot));
@@ -913,17 +857,11 @@
         }
     }
 
-    private ReadWriteEntity generateReadWriteEntity(String identifier, Object value) {
+    public ReadWriteEntity generateReadWriteEntity(String identifier, Object value) {
         return ReadWriteEntity.builder()
                 .identifier(identifier)
                 //Kep涓槸Long绫诲瀷锛屽嵆锛欼nt32锛孞ava涓殑int绫诲瀷
                 .value(value)
                 .build();
     }
-//
-//    private List<BigStorageCageTask> computeOutTaskList(List<BigStorageCageTask> taskList, int totalLayer, int target) {
-////        if (target == 931){}
-//        if (taskList.get(0).get)
-//            return null;
-//    }
 }
\ No newline at end of file

--
Gitblit v1.8.0