From fddf567bffc2907c8f19586c6b6823cff4278d9d Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 28 三月 2024 08:54:01 +0800
Subject: [PATCH] #
---
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/model/protocol/ShuttleProtocol.java | 48 +++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 47 insertions(+), 1 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 b0ff291..ad5496b 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
@@ -3,15 +3,20 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zy.asrs.framework.common.Cools;
import com.zy.asrs.framework.common.SpringUtils;
+import com.zy.asrs.wcs.core.entity.Loc;
+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.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.ShuttleDeviceStatusService;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
+
+import java.util.HashMap;
/**
* 鍥涘悜绌挎杞�
@@ -217,7 +222,7 @@
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));
}
@@ -225,4 +230,45 @@
return this.taskNo == null ? 0 : this.taskNo;
}
+ //閫氳繃褰撳墠浜岀淮鐮佽幏鍙栧綋鍓嶅簱浣嶅彿
+ public String getCurrentLocNo() {
+ LocService locService = SpringUtils.getBean(LocService.class);
+ if (locService == null) {
+ return null;
+ }
+ if (this.currentCode == null) {
+ return null;
+ }
+
+ //婧愬簱浣�(灏忚溅褰撳墠浣嶇疆)
+ LambdaQueryWrapper<Loc> wrapper = new LambdaQueryWrapper<Loc>()
+ .eq(Loc::getCode, this.currentCode)
+ .eq(Loc::getHostId, this.device.getHostId());
+ Loc currentLoc = locService.getOne(wrapper);
+ if (currentLoc == null) {
+ return null;
+ }
+
+ return currentLoc.getLocNo();
+ }
+
+ // 鏄惁澶勪簬绌洪棽寰呭懡鐘舵��
+ public Boolean isIdle() {
+ if (this.deviceStatus == null
+ || this.pakMk == null
+ || this.errorCode == null
+ || this.protocolStatus == null
+ ) {
+ return false;
+ }
+
+ boolean res = this.deviceStatus.equals(ShuttleDeviceStatusType.IDLE)
+ && this.pakMk
+ && !this.errorCode.equals("0")
+ && this.getTaskNo() == 0
+ && this.protocolStatus.intValue() == ShuttleProtocolStatusType.IDLE.id
+ ;
+ return res;
+ }
+
}
--
Gitblit v1.9.1