From 097fe004312a312a9704d841cf7b0d6c11742fee Mon Sep 17 00:00:00 2001
From: TQS <56479841@qq.com>
Date: 星期二, 22 十一月 2022 15:05:06 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/core/model/protocol/SteProtocol.java | 111 +++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 99 insertions(+), 12 deletions(-)
diff --git a/src/main/java/com/zy/core/model/protocol/SteProtocol.java b/src/main/java/com/zy/core/model/protocol/SteProtocol.java
index 1890496..42515cc 100644
--- a/src/main/java/com/zy/core/model/protocol/SteProtocol.java
+++ b/src/main/java/com/zy/core/model/protocol/SteProtocol.java
@@ -1,13 +1,19 @@
package com.zy.core.model.protocol;
+import com.core.common.Cools;
+import com.core.common.SpringUtils;
import com.zy.asrs.entity.BasSte;
+import com.zy.asrs.service.BasSteService;
import com.zy.core.enums.SteHisTaskStatusType;
+import com.zy.core.enums.SteLocaType;
import com.zy.core.enums.SteStatusType;
import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
/**
* Created by vincent on 2020/8/7
*/
+@Slf4j
@Data
public class SteProtocol {
@@ -33,6 +39,11 @@
public SteStatusType statusType;
/**
+ * 浠诲姟鍙�
+ */
+ public Short taskNo = 0;
+
+ /**
* 姝e湪鎵ц浠诲姟
*/
public Boolean execute;
@@ -46,18 +57,18 @@
/**
* 寮傚父鐮�1
*/
- public Integer alarm;
+ public Short alarm;
/**
* 寮傚父鐮�2
*/
- public Integer alarm0;
+ public Short alarm0;
/**
* 鐢垫睜鐢甸噺
*/
- public Short charge;
+ public Float charge = 0.0F;
/**
* 婊$數
@@ -70,15 +81,16 @@
public Boolean lowCharge;
/**
- * 鐢垫睜棣堢數 0锛屾甯革紝1棣堢數
+ * 鐢垫睜棣堢數 0锛屾瑺鐢碉紝1浣庣數 2婊$數
*/
public Short feed;
-
/**
* 褰撳墠浣嶇疆 1锛岃繎鐐癸紝2杩滅偣锛�3A鐐癸紝4B鐐�
*/
public Short loca;
+
+ public SteLocaType locaType;
/**
* 杩戠偣璺濈
@@ -88,7 +100,7 @@
/**
* 褰撳墠閫熷害
*/
- public Double speed;
+ public Double speed = 0.0D;
/**
* 楂樹綆浣� 0锛屼綆浣嶏紝1楂樹綅
@@ -104,11 +116,6 @@
* 鍦ㄨ建閬撲笂 0涓嶅湪锛�1鍦�
*/
public Short track;
-
- /**
- * 浠诲姟鍙�
- */
- public Integer taskNo = 0;
/**
* 浠诲姟绫诲瀷
@@ -178,6 +185,17 @@
*/
public Short crnAllowRun;
+ /**
+ * 鍏呯數鐘舵�� 1锛氬湪鍏呯數锛�0锛氫笉鍦ㄥ厖鐢�
+ */
+ private Short chargeStatus;
+
+ // 鍏ュ簱鍙栫┖
+ private Boolean inEmpty;
+
+ // 鍑哄簱鍙栫┖
+ private Boolean outEmpty;
+
public void setStatus(Short status){
this.status = status;
this.statusType = SteStatusType.get(status);
@@ -186,6 +204,16 @@
public void setStatus(SteStatusType type){
this.statusType = type;
this.status = SteStatusType.get(type).id.shortValue();
+ }
+
+ public void setLoca(Short loca){
+ this.loca = loca;
+ this.locaType = SteLocaType.get(loca);
+ }
+
+ public void setLoca(SteLocaType type){
+ this.locaType = type;
+ this.loca = SteLocaType.get(type).id.shortValue();
}
public void setHisTaskStatus(Short hisTaskStatus){
@@ -205,12 +233,71 @@
*/
private String lastIo = "I";
+ private String pakMk = "-";
public BasSte toSqlModel(BasSte basSte){
if (alarm!=null) {
basSte.setSteErr(alarm.longValue());
}
- basSte.setWrkNo(taskNo);
+ basSte.setWrkNo(taskNo.intValue());
+// if (basSte.getPakMk().equals("N")) {
+// if (!Cools.isEmpty(row)) {
+// basSte.setRow(row.intValue());
+// }
+// if (!Cools.isEmpty(bay)) {
+// basSte.setBay(bay.intValue());
+// }
+// if (!Cools.isEmpty(lev)) {
+// basSte.setLev(lev.intValue());
+// }
+// }
return basSte;
}
+
+ // 鏄惁澶勪簬绌洪棽寰呭懡鐘舵��
+ public Boolean isIdle() {
+ boolean res = this.statusType.equals(SteStatusType.IDLE)
+ && this.pakMk.equals("N")
+ && !isAlarm()
+ && this.chargeStatus == 0
+ && isEnable()
+ ;
+ if (!res) {
+ return res;
+ } else {
+ // 鐢甸噺
+ try {
+ String chargeLine = SpringUtils.getBean(BasSteService.class).selectById(this.steNo).getChargeLine();
+ return charge > Float.parseFloat(chargeLine);
+ } catch (Exception e) {
+ log.error("fail", e);
+ return false;
+ }
+ }
+ }
+
+ // 鏄惁澶勪簬鎶ヨ鐘舵��
+ public Boolean isAlarm() {
+ return this.alarm > 1;
+ }
+
+ public Boolean isEnable() {
+ if (Cools.isEmpty(row)) {
+ if (row == 0) {
+ return false;
+ }
+ }
+ if (Cools.isEmpty(bay)) {
+ if (bay == 0) {
+ return false;
+ }
+ }
+ if (Cools.isEmpty(lev)) {
+ if (lev == 0) {
+ return false;
+ }
+ }
+ return true;
+ }
+
}
--
Gitblit v1.9.1