From ee6e7a5260183a0ac977d6ff21fe3de6f70d3bdd Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期二, 18 六月 2024 16:56:40 +0800
Subject: [PATCH] #

---
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/model/protocol/ShuttleProtocol.java |   50 ++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 44 insertions(+), 6 deletions(-)

diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/model/protocol/ShuttleProtocol.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/model/protocol/ShuttleProtocol.java
index c3d506c..388135e 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/model/protocol/ShuttleProtocol.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/model/protocol/ShuttleProtocol.java
@@ -7,23 +7,21 @@
 import com.zy.asrs.wcs.core.service.LocService;
 import com.zy.asrs.wcs.core.utils.RedisUtil;
 import com.zy.asrs.wcs.rcs.constant.DeviceRedisConstant;
-import com.zy.asrs.wcs.rcs.model.enums.ShuttleDeviceStatusType;
+import com.zy.asrs.wcs.rcs.entity.BasShuttleErr;
 import com.zy.asrs.wcs.rcs.model.enums.ShuttleProtocolStatusType;
 import com.zy.asrs.wcs.rcs.entity.Device;
 import com.zy.asrs.wcs.rcs.entity.ShuttleDeviceStatus;
-import com.zy.asrs.wcs.rcs.model.enums.SlaveType;
+import com.zy.asrs.wcs.rcs.service.BasShuttleErrService;
 import com.zy.asrs.wcs.rcs.service.ShuttleDeviceStatusService;
 import lombok.Data;
 import lombok.extern.slf4j.Slf4j;
-
-import java.util.HashMap;
 
 /**
  * 鍥涘悜绌挎杞�
  */
 @Slf4j
 @Data
-public class ShuttleProtocol {
+public class ShuttleProtocol implements Cloneable{
 
     //**********************蹇呴』瀛樺湪灞炴��**********************
     /**
@@ -60,6 +58,11 @@
      * 灏忚溅璁惧鐘舵��
      */
     private Integer deviceStatus;
+
+    /**
+     * 灏忚溅妯″紡锛�0锛氭墜鍔� 1锛氳嚜鍔�
+     */
+    private Integer mode;
 
     /**
      * 褰撳墠浜岀淮鐮�
@@ -163,6 +166,16 @@
     private Long deviceDataLog = System.currentTimeMillis();
 
     /**
+     * 鎸囦护涓嬪彂鏃堕棿
+     */
+    private Long sendTime = 0L;
+
+    /**
+     * 鏈�杩戜竴娆″湪绾挎椂闂�
+     */
+    private Long lastOnlineTime = System.currentTimeMillis();
+
+    /**
      * 璁惧淇℃伅
      */
     private Device device;
@@ -207,6 +220,21 @@
         return "";
     }
 
+    public String getErrorCode$() {
+        if (this.errorCode == null) {
+            return "";
+        }
+        BasShuttleErrService basShuttleErrService = SpringUtils.getBean(BasShuttleErrService.class);
+        BasShuttleErr shuttleErr = basShuttleErrService.getOne(new LambdaQueryWrapper<BasShuttleErr>()
+                .eq(BasShuttleErr::getErrorCode, this.errorCode)
+                .eq(BasShuttleErr::getHostId, this.device.getHostId())
+                .eq(BasShuttleErr::getDevicePlc, this.device.getDevicePlc()));
+        if (shuttleErr != null) {
+            return this.errorCode + "-" + shuttleErr.getErrName();
+        }
+        return errorCode;
+    }
+
     public Integer getTaskNo() {
         RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class);
         if (null != redisUtil) {
@@ -218,7 +246,7 @@
         return this.taskNo == null ? 0 : this.taskNo;
     }
 
-    public void setTaskNo(Integer taskNo) {
+    public synchronized void setSyncTaskNo(Integer taskNo) {
         RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class);
         if (null != redisUtil) {
             redisUtil.set(DeviceRedisConstant.SHUTTLE_FLAG + this.shuttleNo, taskNo);
@@ -248,4 +276,14 @@
         return currentLoc.getLocNo();
     }
 
+    @Override
+    public ShuttleProtocol clone() {
+        try {
+            return (ShuttleProtocol) super.clone();
+        } catch (CloneNotSupportedException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
 }

--
Gitblit v1.9.1