From 0dfdc8148cc266fd3e877183c5b162fb986d5c65 Mon Sep 17 00:00:00 2001
From: huang <1532065656@qq.com>
Date: 星期五, 12 十二月 2025 15:38:56 +0800
Subject: [PATCH] 修改导入工程json格式

---
 mes-processes/mes-plcSend/src/main/java/com/mes/interaction/workstation/scanner/handler/HorizontalScannerLogicHandler.java |   51 ++++++++++++++++++++++++++-------------------------
 1 files changed, 26 insertions(+), 25 deletions(-)

diff --git a/mes-processes/mes-plcSend/src/main/java/com/mes/interaction/workstation/scanner/handler/HorizontalScannerLogicHandler.java b/mes-processes/mes-plcSend/src/main/java/com/mes/interaction/workstation/scanner/handler/HorizontalScannerLogicHandler.java
index 7e25e57..f676a3d 100644
--- a/mes-processes/mes-plcSend/src/main/java/com/mes/interaction/workstation/scanner/handler/HorizontalScannerLogicHandler.java
+++ b/mes-processes/mes-plcSend/src/main/java/com/mes/interaction/workstation/scanner/handler/HorizontalScannerLogicHandler.java
@@ -125,7 +125,7 @@
             clearPlcRequestFields(deviceConfig, serializer);
             return buildResult(deviceConfig, "scanOnce", false, "MES鍐欏尯鏈彁渚涚幓鐠僆D", null);
         }
-        // 璇诲彇MES灏哄鏁版嵁锛歮esWidth=琛ㄥ锛宮esHeight=闀�
+        // 璇诲彇MES灏哄鏁版嵁锛歮esWidth=瀹斤紝mesHeight=闀�
         Integer rawWidth = parseInteger(mesData.get("mesWidth"));
         Integer rawHeight = parseInteger(mesData.get("mesHeight"));
         Integer workLine = parseInteger(mesData.get("workLine"));
@@ -133,28 +133,29 @@
         // 4. 娓呯┖plcRequest鍜宲lcGlassId锛堝彧娓呴櫎PLC瀛楁锛�
         clearPlcRequestFields(deviceConfig, serializer);
 
+        // 5. 鏇存柊鐜荤拑淇℃伅鐘舵�侊細灏唖tate浠�0鏀逛负1锛堝凡鎵爜浜や簰锛�
+        boolean updated = glassInfoService.updateGlassStateAfterScan(glassId, rawWidth, rawHeight, workLine);
+        if (!updated) {
+            log.warn("鏇存柊鐜荤拑淇℃伅鐘舵�佸け璐ワ紝鐜荤拑鍙兘涓嶅瓨鍦�: glassId={}", glassId);
+            // 涓嶈繑鍥為敊璇紝缁х画鎵ц锛屽洜涓哄彲鑳芥槸鏂扮幓鐠冭繕鏈鍏�
+        }
+        
+        // 6. 灏嗘壂鎻忓埌鐨勭幓鐠僆D淇濆瓨鍒板叡浜暟鎹腑锛堜緵澶ц溅璁惧瀹氭椂鍣ㄨ鍙栵級
+        saveScannedGlassId(params, glassId);
 
-            // 5. 淇濆瓨鐜荤拑淇℃伅鍒版暟鎹簱
-            GlassInfo glassInfo = buildGlassInfo(glassId, rawWidth, rawHeight, workLine);
-            boolean saved = glassInfoService.saveOrUpdateGlassInfo(glassInfo);
-            if (!saved) {
-                return buildResult(deviceConfig, "scanOnce", false, "淇濆瓨鐜荤拑淇℃伅澶辫触: " + glassId, null);
-            }
-            
-            // 6. 灏嗘壂鎻忓埌鐨勭幓鐠僆D淇濆瓨鍒板叡浜暟鎹腑锛堜緵澶ц溅璁惧瀹氭椂鍣ㄨ鍙栵級
-            saveScannedGlassId(params, glassId);
-
-            String msg = String.format("鐜荤拑[%s] 灏哄[琛ㄥ:%s x 闀�:%s] 宸叉帴鏀跺苟鍏ュ簱锛寃orkLine=%s",
-                    glassId,
-                    rawWidth != null ? rawWidth + "mm" : "-",
-                    rawHeight != null ? rawHeight + "mm" : "-",
-                    workLine != null ? workLine : "-");
-            Map<String, Object> resultData = new HashMap<>();
-            resultData.put("glassIds", Collections.singletonList(glassId));
-            if (workLine != null) {
-                resultData.put("workLine", workLine);
-            }
-            return buildResult(deviceConfig, "scanOnce", true, msg, resultData);
+        Integer intervalMs = config != null ? config.getScanIntervalMs() : null;
+        String msg = String.format("鐜荤拑[%s] 灏哄[瀹�:%s x 闀�:%s] 宸叉帴鏀讹紝workLine=%s锛屾壂鎻忛棿闅�=%s",
+                glassId,
+                rawWidth != null ? rawWidth + "mm" : "-",
+                rawHeight != null ? rawHeight + "mm" : "-",
+                workLine != null ? workLine : "-",
+                intervalMs != null ? intervalMs + "ms" : "-");
+        Map<String, Object> resultData = new HashMap<>();
+        resultData.put("glassIds", Collections.singletonList(glassId));
+        if (workLine != null) {
+            resultData.put("workLine", workLine);
+        }
+        return buildResult(deviceConfig, "scanOnce", true, msg, resultData);
     }
     
     /**
@@ -271,12 +272,12 @@
     private GlassInfo buildGlassInfo(String glassId, Integer width, Integer height, Integer workLine) {
         GlassInfo glassInfo = new GlassInfo();
         glassInfo.setGlassId(glassId.trim());
-        // mesWidth=琛ㄥ -> glassWidth, mesHeight=闀� -> glassLength
+        // mesWidth=瀹� -> glassWidth, mesHeight=闀� -> glassLength
         if (width != null) {
-            glassInfo.setGlassWidth(width);  // 琛ㄥ
+            glassInfo.setGlassWidth(width);
         }
         if (height != null) {
-            glassInfo.setGlassLength(height); // 闀�
+            glassInfo.setGlassLength(height);
         }
         glassInfo.setStatus(GlassInfo.Status.PENDING);
         if (workLine != null) {

--
Gitblit v1.8.0