From 8b5b1811556bf9a9c95574276b2a93cb5099cec4 Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期日, 07 四月 2024 08:36:00 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/Four-Way-Rack' into Four-Way-Rack
---
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java | 68 +++++++++++++++++++++++++++++++++-
1 files changed, 66 insertions(+), 2 deletions(-)
diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java
index 5fb8600..852ca7c 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java
@@ -7,11 +7,13 @@
import com.zy.asrs.framework.common.DateUtils;
import com.zy.asrs.framework.common.SpringUtils;
import com.zy.asrs.framework.exception.CoolException;
+import com.zy.asrs.wcs.core.entity.BasShuttle;
import com.zy.asrs.wcs.core.entity.Loc;
import com.zy.asrs.wcs.core.model.NavigateNode;
import com.zy.asrs.wcs.core.model.command.ShuttleCommand;
import com.zy.asrs.wcs.core.model.enums.ShuttleCommandModeType;
import com.zy.asrs.wcs.core.model.enums.ShuttleRunDirection;
+import com.zy.asrs.wcs.core.service.BasShuttleService;
import com.zy.asrs.wcs.core.service.LocService;
import com.zy.asrs.wcs.core.utils.NavigateUtils;
import com.zy.asrs.wcs.rcs.News;
@@ -99,6 +101,10 @@
//----------璇诲彇鍥涘悜绌挎杞︾姸鎬�-----------
//灏忚溅璁惧鐘舵��
Integer deviceStatus = data.getInteger("deviceStatus");
+ if (deviceStatus == 255) {
+ //绂荤嚎
+ shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.OFFLINE);
+ }
shuttleProtocol.setDeviceStatus(deviceStatus);
//褰撳墠浜岀淮鐮�
shuttleProtocol.setCurrentCode(data.getString("groundCode") == null ? "0" : data.getString("groundCode"));
@@ -109,14 +115,14 @@
//鏄惁椤跺崌
shuttleProtocol.setHasLift(data.getInteger("palletStatus") == 1 ? true : false);
//鏄惁鏈夋墭鐩�
- shuttleProtocol.setHasPallet(data.getInteger("hasPallet") != 2 ? true : false);
+ shuttleProtocol.setHasPallet(data.getInteger("hasPallet") == null ? true : data.getInteger("hasPallet") != 2 ? true : false);
//琛岄┒鏂瑰悜
shuttleProtocol.setRunDirection(data.getString("direction") == null ? "none" : data.getString("direction"));
//鏄惁涓哄厖鐢电姸鎬�
shuttleProtocol.setHasCharge((deviceStatus == 5 || deviceStatus == 13) ? true : false);
//*********璇诲彇鎵╁睍瀛楁**********
- InnerSuhttleExtend extend = JSON.parseObject(JSON.toJSONString(shuttleProtocol.getExtend()), InnerSuhttleExtend.class);
+ InnerSuhttleExtend extend = (InnerSuhttleExtend) shuttleProtocol.getExtend();
extend.setMapVersion(data.getString("version"));//鍦板浘鐗堟湰
extend.setStatusDescription(data.getString("statusDescription"));//鐘舵�佹弿杩�
shuttleProtocol.setExtend(extend);//鎵╁睍瀛楁
@@ -357,6 +363,64 @@
}
@Override
+ public boolean isRequireCharge() {
+ if (this.shuttleProtocol.getIdle() == null
+ || this.shuttleProtocol.getPakMk() == null
+ || this.shuttleProtocol.getErrorCode() == null
+ || this.shuttleProtocol.getProtocolStatus() == null
+ ) {
+ return false;
+ }
+
+ boolean res = this.shuttleProtocol.getIdle()
+ && this.shuttleProtocol.getPakMk()
+ && this.shuttleProtocol.getErrorCode().equals("0")
+ && this.shuttleProtocol.getProtocolStatus() == ShuttleProtocolStatusType.IDLE.id
+ ;
+ if (!res) {
+ return res;
+ } else {
+ // 鐢甸噺灏忎簬闃堝�奸渶瑕佽繘琛屽厖鐢�
+ try {
+ BasShuttleService shuttleService = SpringUtils.getBean(BasShuttleService.class);
+ if (shuttleService == null) {
+ return false;
+ }
+ BasShuttle basShuttle = shuttleService.getById(this.device.getDeviceNo());
+ if (basShuttle == null) {
+ return false;
+ }
+ Integer chargeLine = basShuttle.getChargeLine();
+ if (chargeLine == null) {
+ return false;
+ }
+ return Integer.valueOf(this.shuttleProtocol.getBatteryPower()) < chargeLine;
+ } catch (Exception e) {
+ News.error("fail", e);
+ return false;
+ }
+ }
+ }
+
+ @Override
+ public boolean isCharging() {
+ if (this.shuttleProtocol.getDeviceStatus() == null) {
+ return false;
+ }
+
+ if (this.shuttleProtocol.getDeviceStatus() == 5 || this.shuttleProtocol.getDeviceStatus() == 13) {
+ //鍏呯數涓拰鐢垫睜鍧囪 =銆� 鍏呯數
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean isChargingCompleted() {
+ return false;
+ }
+
+ @Override
public ShuttleCommand getMoveCommand(Integer taskNo, String startCodeNum, String distCodeNum, Integer allDistance, Integer runDirection, Integer runSpeed) {
HashMap<String, Object> body = new HashMap<>();
body.put("messageName", "runOrder");
--
Gitblit v1.9.1