From 49379100e381557f383f601616b2f6835295786d Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期三, 20 九月 2023 13:39:44 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/common/utils/NyLiftUtils.java | 62 ++++++++++++++++++++++++++++++
1 files changed, 61 insertions(+), 1 deletions(-)
diff --git a/src/main/java/com/zy/common/utils/NyLiftUtils.java b/src/main/java/com/zy/common/utils/NyLiftUtils.java
index 1794678..6909cd2 100644
--- a/src/main/java/com/zy/common/utils/NyLiftUtils.java
+++ b/src/main/java/com/zy/common/utils/NyLiftUtils.java
@@ -1,6 +1,15 @@
package com.zy.common.utils;
+import com.core.common.SpringUtils;
+import com.zy.core.cache.SlaveConnection;
+import com.zy.core.enums.SlaveType;
+import com.zy.core.model.LiftSlave;
import com.zy.core.model.command.NyLiftCommand;
+import com.zy.core.model.protocol.LiftStaProtocol;
+import com.zy.core.properties.SlaveProperties;
+import com.zy.core.thread.LiftThread;
+
+import javax.swing.*;
/**
* 鐗涚溂鎻愬崌鏈哄伐鍏风被
@@ -10,7 +19,7 @@
/**
* 鑾峰彇鎻愬崌鏈哄懡浠�
*/
- public NyLiftCommand getLiftCommand(Integer liftNo, Integer taskModel, Integer sourceSta, Integer targetSta, Integer taskNo) {
+ public static NyLiftCommand getLiftCommand(Integer liftNo, Integer taskModel, Integer sourceSta, Integer targetSta, Integer taskNo) {
NyLiftCommand command = new NyLiftCommand();
command.setLiftNo(liftNo.shortValue());
command.setTaskNo(taskNo.shortValue());
@@ -20,4 +29,55 @@
return command;
}
+ //鑾峰彇鎻愬崌鏈虹珯鐐�
+ public static LiftStaProtocol getLiftStaByStaNo(Integer staNo) {
+ SlaveProperties slaveProperties = SpringUtils.getBean(SlaveProperties.class);
+ for (LiftSlave liftSlave : slaveProperties.getLift()) {
+ LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, liftSlave.getId());
+ if (liftThread == null) {
+ return null;
+ }
+
+ for (LiftStaProtocol liftStaProtocol : liftThread.getLiftStaProtocols()) {
+ if (liftStaProtocol.getStaNo().equals(staNo)) {
+ return liftStaProtocol;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ //鑾峰彇鎻愬崌鏈虹珯鐐�
+ public static LiftStaProtocol getLiftStaByStaNo(Integer liftNo, Integer staNo) {
+ LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, liftNo);
+ if (liftThread == null) {
+ return null;
+ }
+
+ for (LiftStaProtocol liftStaProtocol : liftThread.getLiftStaProtocols()) {
+ if (liftStaProtocol.getStaNo().equals(staNo)) {
+ return liftStaProtocol;
+ }
+ }
+
+ return null;
+ }
+
+ //鑾峰彇鎻愬崌鏈虹珯鐐�
+ public static LiftStaProtocol getLiftStaByLev(Integer liftNo, Integer lev) {
+ LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, liftNo);
+ if (liftThread == null) {
+ return null;
+ }
+
+ for (LiftStaProtocol liftStaProtocol : liftThread.getLiftStaProtocols()) {
+ if (liftStaProtocol.getLev().equals(lev)) {
+ return liftStaProtocol;
+ }
+ }
+
+ return null;
+ }
+
}
--
Gitblit v1.9.1