From 8a4d482469e2078cce3cf227c11be862e94b860d Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期五, 12 四月 2024 20:25:24 +0800
Subject: [PATCH] Merge branch 'Four-Way-Rack' of http://47.97.1.152:5880/r/zy-asrs-master into Four-Way-Rack

---
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java |   34 ++++++++++++++++++++++++----------
 1 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java
index f3e2a32..44aad5b 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/ShuttleAction.java
@@ -1,10 +1,9 @@
 package com.zy.asrs.wcs.core.action;
 
 import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.zy.asrs.wcs.common.ExecuteSupport;
-import com.zy.asrs.wcs.core.entity.BasShuttle;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import com.zy.asrs.wcs.core.entity.Loc;
 import com.zy.asrs.wcs.core.entity.Task;
 import com.zy.asrs.wcs.core.model.NavigateNode;
@@ -27,6 +26,7 @@
 import com.zy.asrs.wcs.rcs.model.enums.SlaveType;
 import com.zy.asrs.wcs.rcs.model.protocol.ShuttleProtocol;
 import com.zy.asrs.wcs.rcs.thread.ShuttleThread;
+import org.aspectj.apache.bcel.generic.RET;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -46,6 +46,8 @@
     private LocService locService;
     @Autowired
     private ShuttleDispatcher shuttleDispatcher;
+    @Autowired
+    private ObjectMapper objectMapper;
 
     public synchronized boolean assignWork(Device device, ShuttleAssignCommand assignCommand) {
         ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getId().intValue());
@@ -87,7 +89,14 @@
         if (obj == null) {
             return false;
         }
-        ShuttleRedisCommand redisCommand = JSON.parseObject(obj.toString(), ShuttleRedisCommand.class);
+
+        ShuttleRedisCommand redisCommand = null;
+        try {
+            redisCommand = objectMapper.readValue(String.valueOf(obj), ShuttleRedisCommand.class);
+        } catch (JsonProcessingException e) {
+            throw new RuntimeException(e);
+        }
+
         if (redisCommand == null) {
             return false;
         }
@@ -177,12 +186,12 @@
 
                 // 绯荤粺浠诲姟
                 if (assignCommand.getAuto()) {
-                    if (!assignCommand.getCharge()) {
-                        //瀵逛富绾跨▼鎶涘嚭绛夊緟纭鐘舵�亀aiting
-                        shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.WAITING);
-                    }else {
-                        shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.CHARGING_WAITING);
-                    }
+//                    if (!assignCommand.getCharge()) {
+//                        //瀵逛富绾跨▼鎶涘嚭绛夊緟纭鐘舵�亀aiting
+//                        shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.WAITING);
+//                    }else {
+//                        shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.CHARGING_WAITING);
+//                    }
                     News.info("鍥涘悜绌挎杞︿换鍔℃墽琛屼笅鍙戝畬鎴愮瓑寰呮墽琛岀粨鏉燂紝绌挎杞﹀彿={}锛屼换鍔℃暟鎹�={}", shuttleProtocol.getShuttleNo(), JSON.toJSON(command));
 
                     // 鎵嬪姩浠诲姟
@@ -211,6 +220,11 @@
             return false;
         }
 
+        commandStep++;
+        //鏇存柊redis鏁版嵁
+        redisCommand.setCommandStep(commandStep);
+        //浠诲姟鏁版嵁淇濆瓨鍒皉edis
+        redisUtil.set(DeviceRedisConstant.SHUTTLE_WORK_FLAG + redisCommand.getWrkNo(), JSON.toJSONString(redisCommand));
         return true;
     }
 

--
Gitblit v1.9.1