From 7a5dbd93b904d47e0237cbd36594cbe1792f8aeb Mon Sep 17 00:00:00 2001
From: zhoushihao <zsh19950802@163.com>
Date: 星期一, 08 七月 2024 14:48:33 +0800
Subject: [PATCH] 大理片笼:进片任务联调 bug修复 下片:任务联调 bug修复

---
 hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java |   33 ++++++++++++++-------------------
 1 files changed, 14 insertions(+), 19 deletions(-)

diff --git a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java
index b888fc8..f3f04f3 100644
--- a/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java
+++ b/hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/PlcStorageCageTask.java
@@ -78,8 +78,8 @@
     @Value("${mes.outCarMaxSize}")
     private Integer outCarMaxSize;
 
-    @Value("${mes.galssGap}")
-    private Integer galssGap;
+    @Value("${mes.glassGap}")
+    private Integer glassGap;
 
     @Scheduled(fixedDelay = 300)
     public void plcToHomeEdgScan() {
@@ -93,13 +93,10 @@
         String mesD01Address = plcParameterObject.getPlcParameter("MESToD01").getAddress();
         String mesD04Address = plcParameterObject.getPlcParameter("MESToD04").getAddress();
         String d01ToMES = plcParameterObject.getPlcParameter("D01ToMES").getValue();
-        if (!REQUEST_WORD.equals(d01ToMES)) {
-            log.info("璇锋眰瀛椾负{}锛岀粨鏉熸湰娆℃壂鎻忚繘鍗ц浆绔嬩换鍔�", d01ToMES);
-            return;
-        }
+        String d04ToMES = plcParameterObject.getPlcParameter("D04ToMES").getValue();
 
-        log.info("1銆佽幏鍙杁01Id鎵弿ID涓猴細{};鑾峰彇d04Id鎵弿ID涓猴細{};", d01Id, d04Id);
-        if (StringUtils.isBlank(d01Id) && StringUtils.isBlank(d04Id)) {
+        log.info("1銆佽幏鍙杁01Id鎵弿ID涓猴細{}锛岃姹傚瓧涓簕};鑾峰彇d04Id鎵弿ID涓猴細{}锛岃姹傚瓧涓簕};", d01Id, d01ToMES, d04Id, d04ToMES);
+        if (StringUtils.isBlank(d01ToMES) && StringUtils.isBlank(d04ToMES)) {
             log.info("涓ゆ潯绾挎湭鏀跺埌杩涚墖浠诲姟锛岀粨鏉熸湰娆℃壂鎻忚繘鍗ц浆绔嬩换鍔�");
             return;
         }
@@ -107,13 +104,11 @@
             log.info("涓ゆ潯绾垮崸杞珛鍧囧湪鎵ц浠诲姟锛岀粨鏉熸湰娆℃壂鎻忚繘鍗ц浆绔嬩换鍔�");
             return;
         }
-//        Boolean flag01 = Boolean.FALSE;
-//        Boolean flag04 = Boolean.FALSE;
         //鎸夌収绾胯矾鍙婄幓鐠僫d鑾峰彇鐩搁偦涓ゅ潡鐜荤拑 鍗ц浆绔嬩笂鐨勭幓鐠�
-        if (StringUtils.isNotBlank(d01Id) && (StringUtils.isBlank(d02State) || !REQUEST_WORD.equals(d03State))) {
+        if (REQUEST_WORD.equals(d01ToMES) && (StringUtils.isBlank(d02State) || !REQUEST_WORD.equals(d03State))) {
             judgeGlassTypeStatus(d01Id, Const.A09_OUT_TARGET_POSITION, mesD01Address);
         }
-        if (StringUtils.isNotBlank(d04Id) && !REQUEST_WORD.equals(d05State)) {
+        if (REQUEST_WORD.equals(d04ToMES) && !REQUEST_WORD.equals(d05State)) {
             judgeGlassTypeStatus(d04Id, Const.A10_OUT_TARGET_POSITION, mesD04Address);
         }
         log.info("缁撴潫鎵爜浠诲姟");
@@ -235,7 +230,7 @@
         List<BigStorageCageDetails> artificialList = bigStorageCageDetailsService.list(new LambdaQueryWrapper<BigStorageCageDetails>()
                 .eq(BigStorageCageDetails::getState, Const.GLASS_STATE_ARTIFICIAL).orderByDesc(BigStorageCageDetails::getWidth));
         if (CollectionUtils.isNotEmpty(artificialList)) {
-            computeOutGlassInfo(temperingGlassInfoList, Boolean.FALSE, mesToPLCAddress);
+            computeOutGlassInfo(artificialList, Boolean.FALSE, mesToPLCAddress);
             return;
         }
         //閽㈠寲浼樺厛锛氳幏鍙栫悊鐗囩  鐜荤拑灏忕墖  鐮存崯琛� 鏁伴噺   鍒ゆ柇绗煎唴鐗堝浘鏄惁鍒伴綈
@@ -262,7 +257,7 @@
             for (int i = 0; i < slotSequenceList.size() - 1; i++) {
                 SlotSequenceDTO first = slotSequenceList.get(i);
                 SlotSequenceDTO second = slotSequenceList.get(i + 1);
-                int slotWidth = carWidth - first.getRemainWidth() - galssGap;
+                int slotWidth = carWidth - first.getRemainWidth() - glassGap;
                 if (first.getMinSequence() == second.getMaxSequence() + 1
                         && second.getRemainWidth() > slotWidth) {
                     List<BigStorageCageDetails> list = bigStorageCageDetailsService.list(new LambdaQueryWrapper<BigStorageCageDetails>()
@@ -303,7 +298,7 @@
 
         Boolean flag = Boolean.TRUE;
         //2銆佽幏鍙栧崸杞珛
-        Integer widthFirst = edgGlassTaskInfoList.get(0).getWidth();
+        Integer widthFirst = Math.max(edgGlassTaskInfoList.get(0).getWidth() / 10, edgGlassTaskInfoList.get(0).getHeight() / 10);
         if (edgGlassTaskInfoList.size() == 1) {
             if (remainWidth >= widthFirst) {
                 if (glassCount < inCarMaxSize) {
@@ -315,9 +310,9 @@
                 flag = Boolean.FALSE;
             }
         } else {
-            Integer widthSecond = edgGlassTaskInfoList.get(1).getWidth();
+            Integer widthSecond = Math.max(edgGlassTaskInfoList.get(1).getWidth() / 10, edgGlassTaskInfoList.get(1).getHeight() / 10);
             if (remainWidth >= widthFirst) {
-                if (remainWidth - widthFirst - galssGap >= widthSecond) {
+                if (remainWidth - widthFirst - glassGap >= widthSecond) {
                     if (glassCount < inCarMaxSize) {
                         addFeedTask(glassId, line, Const.BIG_STORAGE_IN_WAIT, widthFirst);
                     } else {
@@ -446,7 +441,7 @@
             if (bigStorageCageOutTaskList.size() > outCarMaxSize || e.getWidth() > remainWidth) {
                 break;
             }
-            remainWidth = remainWidth - (int) e.getWidth() - galssGap;
+            remainWidth = remainWidth - (int) e.getWidth() - glassGap;
             if (isTempering) {
                 bigStorageCageOutTaskList.add(new BigStorageCageOutTask(e.getGlassId(), e.getSlot(), Const.TEMPERING_OUT_TARGET_POSITION,
                         (int) e.getWidth() * 10, 0, 0, 1));
@@ -483,7 +478,7 @@
         List<Integer> slotList = list.stream().map(T::getSlot).distinct().collect(Collectors.toList());
         //鑾峰彇寰呭嚭鍘荤殑鐜荤拑淇℃伅锛堢瓑涓嬭溅鍑哄幓鐨勭幓鐠冿級
         Map<Integer, Double> slotRemainMap = list.stream().filter(e -> !taskGlassIds.contains(e.getGlassId()))
-                .collect(Collectors.groupingBy(T::getSlot, Collectors.summingDouble(item -> item.getWidth() + galssGap)));
+                .collect(Collectors.groupingBy(T::getSlot, Collectors.summingDouble(item -> item.getWidth() + glassGap)));
         if (CollectionUtils.isNotEmpty(slotRemainMap)) {
             //鎸夌収鏍煎瓙鍙锋洿鏂板墿浣欏昂瀵�
             slotRemainMap.forEach((e, v) -> {

--
Gitblit v1.8.0