From f43b508dda7334487a1640b0bbd908d7b3aa3cb6 Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期二, 15 十月 2024 13:14:28 +0800
Subject: [PATCH] #

---
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyShuttleThread.java |   32 +++++++++++++++++++++++++-------
 1 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyShuttleThread.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyShuttleThread.java
index 56f00c1..705c89c 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyShuttleThread.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/NyShuttleThread.java
@@ -173,6 +173,7 @@
         BasShuttle basShuttle = shuttleService.getOne(new LambdaQueryWrapper<BasShuttle>()
                 .eq(BasShuttle::getShuttleNo, device.getDeviceNo())
                 .eq(BasShuttle::getHostId, device.getHostId()));
+
         if (basShuttle == null) {
             basShuttle = new BasShuttle();
             //鍥涘悜绌挎杞﹀彿
@@ -182,6 +183,10 @@
             basShuttle.setHostId(device.getHostId());
             basShuttle.setDeviceId(device.getId().intValue());
             shuttleService.save(basShuttle);
+        }else {
+            Integer shuttleId = basShuttle.getId();
+            basShuttle = new BasShuttle();
+            basShuttle.setId(shuttleId);
         }
         //浠诲姟鍙�
         basShuttle.setTaskNo(shuttleProtocol.getTaskNo().intValue());
@@ -473,13 +478,14 @@
 
             for (NyShuttleHttpCommand requestCommand : commandList) {
                 JSONObject result = requestCommand(requestCommand);
-//                if (result == null) {
-//                    return false;//璇锋眰澶辫触
-//                }
+                if (result == null) {
+                    return false;//璇锋眰澶辫触
+                }
                 this.shuttleProtocol.setSendTime(System.currentTimeMillis());//鎸囦护涓嬪彂鏃堕棿
             }
             return true;
-        } catch (IOException e) {
+        } catch (Exception e) {
+            e.printStackTrace();
             return false;
         }
     }
@@ -495,7 +501,8 @@
             }
             this.shuttleProtocol.setSendTime(System.currentTimeMillis());//鎸囦护涓嬪彂鏃堕棿
             return true;
-        } catch (IOException e) {
+        } catch (Exception e) {
+            e.printStackTrace();
             return false;
         }
     }
@@ -511,7 +518,8 @@
             }
             this.shuttleProtocol.setSendTime(System.currentTimeMillis());//鎸囦护涓嬪彂鏃堕棿
             return true;
-        } catch (IOException e) {
+        } catch (Exception e) {
+            e.printStackTrace();
             return false;
         }
     }
@@ -535,7 +543,8 @@
             }
             this.shuttleProtocol.setSendTime(System.currentTimeMillis());//鎸囦护涓嬪彂鏃堕棿
             return true;
-        } catch (IOException e) {
+        } catch (Exception e) {
+            e.printStackTrace();
             return false;
         }
     }
@@ -787,6 +796,15 @@
     }
 
     @Override
+    public boolean requestWaiting() {
+        if (this.shuttleProtocol.getProtocolStatusType().equals(ShuttleProtocolStatusType.IDLE)) {
+            this.shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.WAITING);
+            return true;
+        }
+        return false;
+    }
+
+    @Override
     public ShuttleCommand getMoveCommand(Integer taskNo, String startCodeNum, String distCodeNum, Integer allDistance, Integer runDirection, Integer runSpeed, List<NavigateNode> nodes) {
         NavigateMapData navigateMapData = SpringUtils.getBean(NavigateMapData.class);
         NyShuttleHttpCommand httpStandard = getHttpStandard(Integer.parseInt(device.getDeviceNo()), taskNo);

--
Gitblit v1.9.1