ソースを参照

选矿空托出入库优化

ChenYang 1 年間 前
コミット
874ad78cdf

+ 9 - 6
warewms-ams/src/main/java/com/ruoyi/ams/xuankuang/service/BeltLineClientService.java

@@ -1,5 +1,6 @@
 package com.ruoyi.ams.xuankuang.service;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.ruoyi.hard.xuankang.BeltLineClient;
 import lombok.extern.slf4j.Slf4j;
@@ -20,9 +21,9 @@ public class BeltLineClientService {
     //进入时抬升输送线
     public boolean openTheConveyorLine() {
         //读输送线机械状态
-        Number station = beltLineClient.readMechanicalState();
-        log.info("BeltLineClientService - openTheConveyorLine station info is :{}", JSONObject.toJSONString(station));
-        if (station.intValue() == 1) {
+        Number mechanicalState = beltLineClient.readMechanicalState();
+        log.info("BeltLineClientService - openTheConveyorLine station info is :{}", mechanicalState);
+        if (mechanicalState.intValue() == 1) {
             return Boolean.TRUE;
         }
         //读模式
@@ -35,9 +36,11 @@ public class BeltLineClientService {
             //写通过方向
             beltLineClient.writeDirection(1);
             //读状态
-            Number number1 = beltLineClient.readState();
-            log.info("BeltLineClientService - openTheConveyorLine number1 info is :{}", JSONObject.toJSONString(number1));
-            return number1.intValue() == 3;
+            Number logicStatus = beltLineClient.readState();
+            mechanicalState = beltLineClient.readMechanicalState();
+
+            log.info("BeltLineClientService - openTheConveyorLine current logicStatus is :{}, mechanicalState is :{}", logicStatus, mechanicalState);
+            return ObjectUtil.equal(mechanicalState, 1) && ObjectUtil.equal(logicStatus, 3);
         }
         return Boolean.FALSE;
     }