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 | 87 +++++++++++++++++++++++++++++++------------ 1 files changed, 62 insertions(+), 25 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 d9a3147..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,11 +7,11 @@ 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; @@ -21,13 +21,13 @@ */ @Slf4j @Data -public class ShuttleProtocol { +public class ShuttleProtocol implements Cloneable{ //**********************蹇呴』瀛樺湪灞炴��********************** /** * 鍥涘悜绌挎杞﹀彿 */ - private String shuttleNo; + private Integer shuttleNo; /** * 浠诲姟鍙� @@ -60,6 +60,11 @@ private Integer deviceStatus; /** + * 灏忚溅妯″紡锛�0锛氭墜鍔� 1锛氳嚜鍔� + */ + private Integer mode; + + /** * 褰撳墠浜岀淮鐮� * 0涓虹┖ */ @@ -87,6 +92,11 @@ * 鏄惁椤跺崌 */ private Boolean hasLift; + + /** + * 鏄惁鏈夋墭鐩� + */ + private Boolean hasPallet; /** * 琛岄┒鏂瑰悜 @@ -156,9 +166,24 @@ private Long deviceDataLog = System.currentTimeMillis(); /** + * 鎸囦护涓嬪彂鏃堕棿 + */ + private Long sendTime = 0L; + + /** + * 鏈�杩戜竴娆″湪绾挎椂闂� + */ + private Long lastOnlineTime = System.currentTimeMillis(); + + /** * 璁惧淇℃伅 */ private Device device; + + /** + * 鎵╁睍瀛楁 + */ + private Object extend; /** * 璁剧疆灏忚溅鐘舵�� @@ -195,37 +220,38 @@ return ""; } - /** - * 鑾峰彇灏忚溅绌洪棽鐘舵�� - */ - public Boolean getIdle() { - if (this.deviceStatus == null) { - return false; + public String getErrorCode$() { + if (this.errorCode == null) { + return ""; } - - ShuttleDeviceStatusService shuttleDeviceStatusService = SpringUtils.getBean(ShuttleDeviceStatusService.class); - ShuttleDeviceStatus status = shuttleDeviceStatusService.getOne(new LambdaQueryWrapper<ShuttleDeviceStatus>() - .eq(ShuttleDeviceStatus::getHostId, this.device.getHostId()) - .eq(ShuttleDeviceStatus::getDevicePlc, this.device.getDevicePlc()) - .eq(ShuttleDeviceStatus::getStatus, 1) - .eq(ShuttleDeviceStatus::getDeviceStatus, this.deviceStatus)); - if (status != null) { - if (status.getFlag() != null && status.getFlag().equals(String.valueOf(ShuttleDeviceStatusType.IDLE))) { - return true;//绌洪棽涓� - } + 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 false;//榛樿涓嶇┖闂� + return errorCode; } public Integer getTaskNo() { RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class); if (null != redisUtil) { - Object o = redisUtil.get(DeviceRedisConstant.SHUTTLE_FLAG + this.taskNo); + Object o = redisUtil.get(DeviceRedisConstant.SHUTTLE_FLAG + this.shuttleNo); if (!Cools.isEmpty(o)) { this.taskNo = Integer.parseInt(String.valueOf(o)); } } return this.taskNo == null ? 0 : this.taskNo; + } + + public synchronized void setSyncTaskNo(Integer taskNo) { + RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class); + if (null != redisUtil) { + redisUtil.set(DeviceRedisConstant.SHUTTLE_FLAG + this.shuttleNo, taskNo); + this.taskNo = taskNo; + } } //閫氳繃褰撳墠浜岀淮鐮佽幏鍙栧綋鍓嶅簱浣嶅彿 @@ -239,9 +265,10 @@ } //婧愬簱浣�(灏忚溅褰撳墠浣嶇疆) - Loc currentLoc = locService.getOne(new LambdaQueryWrapper<Loc>() + LambdaQueryWrapper<Loc> wrapper = new LambdaQueryWrapper<Loc>() .eq(Loc::getCode, this.currentCode) - .eq(Loc::getHostId, this.device.getHostId())); + .eq(Loc::getHostId, this.device.getHostId()); + Loc currentLoc = locService.getOne(wrapper); if (currentLoc == null) { return null; } @@ -249,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