From 706eabba4750cf92282378ae5d2414f497a4578c Mon Sep 17 00:00:00 2001
From: Junjie <DELL@qq.com>
Date: 星期四, 08 一月 2026 12:51:23 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/utils/Utils.java | 546 ++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 504 insertions(+), 42 deletions(-)
diff --git a/src/main/java/com/zy/asrs/utils/Utils.java b/src/main/java/com/zy/asrs/utils/Utils.java
index b474b9e..f2c7d43 100644
--- a/src/main/java/com/zy/asrs/utils/Utils.java
+++ b/src/main/java/com/zy/asrs/utils/Utils.java
@@ -1,37 +1,44 @@
package com.zy.asrs.utils;
import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.core.common.Arith;
import com.core.common.Cools;
import com.core.common.SpringUtils;
+import com.core.exception.CoolException;
import com.zy.asrs.entity.BasCrnp;
+import com.zy.asrs.entity.BasDualCrnp;
+import com.zy.asrs.entity.BasStationDevice;
import com.zy.asrs.entity.WrkMast;
import com.zy.asrs.service.BasCrnpService;
+import com.zy.asrs.service.BasDualCrnpService;
+import com.zy.asrs.service.BasStationDeviceService;
import com.zy.asrs.service.WrkMastService;
+import com.zy.common.model.NavigateNode;
+import com.zy.common.utils.NavigateUtils;
import com.zy.common.utils.RedisUtil;
+import com.zy.core.News;
import com.zy.core.cache.SlaveConnection;
-import com.zy.core.enums.CrnModeType;
-import com.zy.core.enums.RedisKeyType;
-import com.zy.core.enums.SlaveType;
+import com.zy.core.enums.*;
+import com.zy.core.model.StationObjModel;
import com.zy.core.model.protocol.CrnProtocol;
+import com.zy.core.model.protocol.DualCrnProtocol;
import com.zy.core.thread.CrnThread;
+import com.zy.core.thread.DualCrnThread;
+import java.lang.reflect.Field;
import java.text.DecimalFormat;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.Set;
+import java.util.*;
public class Utils {
private static final String LOC_NO_FLAG = "-";
private static final DecimalFormat fmt = new DecimalFormat("##0.00");
+ private static Integer defaultDeviceLogCollectTime = 200;
+ private static Long lastUpdateDeviceLogCollectTime = -1L;
public static float scale(Float f){
if (f == null || f == 0f || Float.isNaN(f)) {
@@ -105,38 +112,76 @@
//鑾峰彇璁惧鏃ュ織閲囬泦鏃堕棿
public static int getDeviceLogCollectTime() {
- int defaultTime = 200;
- try {
- RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class);
- if (redisUtil == null) {
- return defaultTime;
- }
+ if (defaultDeviceLogCollectTime == null || System.currentTimeMillis() - lastUpdateDeviceLogCollectTime > 60 * 1000) {
+ int defaultTime = 200;
+ lastUpdateDeviceLogCollectTime = System.currentTimeMillis();
+ try {
+ RedisUtil redisUtil = null;
+ try {
+ redisUtil = SpringUtils.getBean(RedisUtil.class);
+ } catch (CoolException coolException) {
- Object object = redisUtil.get(RedisKeyType.SYSTEM_CONFIG_MAP.key);
- if (object == null) {
- return defaultTime;
- }
+ }
+ if (redisUtil == null) {
+ return defaultTime;
+ }
- HashMap<String, String> systemConfigMap = (HashMap<String, String>) object;
- String deviceLogCollectTime = systemConfigMap.get("deviceLogCollectTime");
- if(deviceLogCollectTime == null){
- return defaultTime;
- }
+ Object object = redisUtil.get(RedisKeyType.SYSTEM_CONFIG_MAP.key);
+ if (object == null) {
+ return defaultTime;
+ }
- return Integer.parseInt(deviceLogCollectTime);
- }catch (Exception e){
- e.printStackTrace();
+ HashMap<String, String> systemConfigMap = (HashMap<String, String>) object;
+ String deviceLogCollectTime = systemConfigMap.get("deviceLogCollectTime");
+ if(deviceLogCollectTime == null){
+ return defaultTime;
+ }
+
+ return Integer.parseInt(deviceLogCollectTime);
+ }catch (Exception e){
+ e.printStackTrace();
+ }
}
- return defaultTime;
+ return defaultDeviceLogCollectTime;
}
//鑾峰彇鍏ュ簱浠诲姟鍙敤鎺�
- public static List<Integer> getInTaskEnableRow() {
+ public static List<Integer> getInTaskEnableRow(Integer stationId) {
+ return getInTaskEnableRow(stationId, new ArrayList<>(), new ArrayList<>(), true);
+ }
+
+ //鑾峰彇鍏ュ簱浠诲姟鍙敤鎺�
+ public static List<Integer> getInTaskEnableRow(Integer stationId, List<Integer> excludeCrnList, List<Integer> excludeDualCrnList, boolean maxInTaskControl) {
+ //鑾峰彇鍫嗗灈鏈哄叆搴撲换鍔″彲鐢ㄦ帓
+ List<Integer> rowList = getCrnInTaskEnableRow(stationId, excludeCrnList, maxInTaskControl);
+ //鑾峰彇鍙屽伐浣嶅爢鍨涙満鍏ュ簱浠诲姟鍙敤鎺�
+ List<Integer> dualRowList = getDualCrnInTaskEnableRow(stationId, excludeDualCrnList, maxInTaskControl);
+ if (!dualRowList.isEmpty()) {
+ rowList.addAll(dualRowList);
+ }
+ return rowList;
+ }
+
+ //鑾峰彇鍫嗗灈鏈哄叆搴撲换鍔″彲鐢ㄦ帓
+ public static List<Integer> getCrnInTaskEnableRow(Integer stationId, List<Integer> excludeCrnList, boolean maxInTaskControl) {
List<Integer> list = new ArrayList<>();
try {
RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class);
+ NavigateUtils navigateUtils = SpringUtils.getBean(NavigateUtils.class);
WrkMastService wrkMastService = SpringUtils.getBean(WrkMastService.class);
BasCrnpService basCrnpService = SpringUtils.getBean(BasCrnpService.class);
+ BasStationDeviceService basStationDeviceService = SpringUtils.getBean(BasStationDeviceService.class);
+
+ List<BasStationDevice> stationDevices = basStationDeviceService.selectList(new EntityWrapper<BasStationDevice>().eq("station_id", stationId));
+ boolean hasConfig = !stationDevices.isEmpty();
+ List<Integer> allowedCrnNos = new ArrayList<>();
+ if (hasConfig) {
+ for (BasStationDevice sd : stationDevices) {
+ if (SlaveType.Crn.toString().equals(sd.getDeviceType())) {
+ allowedCrnNos.add(sd.getDeviceNo());
+ }
+ }
+ }
Integer currentCircleTaskCrnNo = null;
Object object = redisUtil.get(RedisKeyType.CURRENT_CIRCLE_TASK_CRN_NO.key);
@@ -154,12 +199,11 @@
List<WrkMast> currentCrnTask = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("crn_no", currentCircleTaskCrnNo));
if (currentCrnTask.size() <= 1) {
if (basCrnp != null) {
- String controlRowsStr = basCrnp.getControlRows();
- if(!Cools.isEmpty(controlRowsStr)){
- List<Integer> rows = JSON.parseArray(controlRowsStr, Integer.class);
+ List<List<Integer>> rowList = basCrnp.getControlRows$();
+ for (List<Integer> rows : rowList) {
list.addAll(rows);
- wrapper.ne("crn_no", currentCircleTaskCrnNo);
}
+ wrapper.ne("crn_no", currentCircleTaskCrnNo);
}
}
}
@@ -168,13 +212,27 @@
List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<>());
List<BasCrnp> basCrnps = basCrnpService.selectList(wrapper);
+ List<BasCrnp> baseList = new ArrayList<>();
+ List<BasCrnp> extraList = new ArrayList<>();
+ for (BasCrnp basCrnp : basCrnps) {
+ if (excludeCrnList.contains(basCrnp.getCrnNo())) {
+ extraList.add(basCrnp);
+ }else {
+ baseList.add(basCrnp);
+ }
+ }
+ baseList.addAll(extraList);
+
for (WrkMast wrkMast : wrkMasts) {
Integer crnNo = wrkMast.getCrnNo();
map.put(crnNo, map.getOrDefault(crnNo, 0) + 1);
}
List<BasCrnp> enabledCrnps = new ArrayList<>();
- for (BasCrnp basCrnp : basCrnps) {
+ for (BasCrnp basCrnp : baseList) {
+ if (hasConfig && !allowedCrnNos.contains(basCrnp.getCrnNo())) {
+ continue;
+ }
CrnThread crnThread = (CrnThread) SlaveConnection.get(SlaveType.Crn, basCrnp.getCrnNo());
if (crnThread == null) {
continue;
@@ -183,22 +241,426 @@
if (crnProtocol.getMode() != CrnModeType.AUTO.id) {
continue;
}
- enabledCrnps.add(basCrnp);
+
+ List<WrkMast> inWrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>()
+ .eq("crn_no", basCrnp.getCrnNo())
+ .eq("io_type", WrkIoType.IN.id)
+ );
+ // 妫�鏌ユ槸鍚﹁秴杩囨渶澶у叆搴撲换鍔℃暟
+ if (maxInTaskControl && inWrkMasts.size() >= basCrnp.getMaxInTask()) {
+ News.info("鍫嗗灈鏈�:{} 宸茶揪鏈�澶у叆搴撲换鍔℃暟锛屽綋鍓嶄换鍔℃暟:{}", basCrnp.getCrnNo(), inWrkMasts.size());
+ continue;
+ }
+
+ //璁$畻绔欑偣鏄惁鍙揪璇ュ爢鍨涙満
+ List<StationObjModel> inStationList = basCrnp.getInStationList$();
+ boolean enableGo = false;
+ for (StationObjModel stationObjModel : inStationList) {
+ try {
+ List<NavigateNode> navigateNodes = navigateUtils.calcByStationId(stationId, stationObjModel.getStationId());
+ if(navigateNodes != null && !navigateNodes.isEmpty()) {
+ enableGo = true;
+ break;
+ }
+ } catch (Exception e) {
+
+ }
+ }
+
+ if (enableGo) {
+ enabledCrnps.add(basCrnp);
+ }
}
enabledCrnps.sort(Comparator.comparingInt(o -> map.getOrDefault(o.getCrnNo(), 0)));
for (BasCrnp basCrnp : enabledCrnps) {
- String controlRowsStr = basCrnp.getControlRows();
- if (Cools.isEmpty(controlRowsStr)) {
- continue;
+ List<List<Integer>> rowList = basCrnp.getControlRows$();
+ for (List<Integer> rows : rowList) {
+ list.addAll(rows);
}
- List<Integer> rows = JSON.parseArray(controlRowsStr, Integer.class);
- list.addAll(rows);
}
- }catch (Exception e){
+ } catch (Exception e) {
e.printStackTrace();
}
return list;
}
+
+ //鑾峰彇鍙屽伐浣嶅爢鍨涙満鍏ュ簱浠诲姟鍙敤鎺�
+ public static List<Integer> getDualCrnInTaskEnableRow(Integer stationId, List<Integer> excludeCrnList, boolean maxInTaskControl) {
+ List<Integer> list = new ArrayList<>();
+ try {
+ RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class);
+ NavigateUtils navigateUtils = SpringUtils.getBean(NavigateUtils.class);
+ WrkMastService wrkMastService = SpringUtils.getBean(WrkMastService.class);
+ BasDualCrnpService basDualCrnpService = SpringUtils.getBean(BasDualCrnpService.class);
+ BasStationDeviceService basStationDeviceService = SpringUtils.getBean(BasStationDeviceService.class);
+
+ List<BasStationDevice> stationDevices = basStationDeviceService.selectList(new EntityWrapper<BasStationDevice>().eq("station_id", stationId));
+ boolean hasConfig = !stationDevices.isEmpty();
+ List<Integer> allowedCrnNos = new ArrayList<>();
+ if (hasConfig) {
+ for (BasStationDevice sd : stationDevices) {
+ if (SlaveType.Crn.toString().equals(sd.getDeviceType())) {
+ allowedCrnNos.add(sd.getDeviceNo());
+ }
+ }
+ }
+
+ Wrapper<BasDualCrnp> wrapper = new EntityWrapper<BasDualCrnp>()
+ .eq("in_enable", "Y")
+ .eq("status", 1);
+
+ HashMap<Integer, Integer> map = new HashMap<>();
+ List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<>());
+ List<BasDualCrnp> basDualCrnps = basDualCrnpService.selectList(wrapper);
+
+ List<BasDualCrnp> baseList = new ArrayList<>();
+ List<BasDualCrnp> extraList = new ArrayList<>();
+ for (BasDualCrnp basDualCrnp : basDualCrnps) {
+ if (excludeCrnList.contains(basDualCrnp.getCrnNo())) {
+ extraList.add(basDualCrnp);
+ }else {
+ baseList.add(basDualCrnp);
+ }
+ }
+ baseList.addAll(extraList);
+
+ for (WrkMast wrkMast : wrkMasts) {
+ Integer dualCrnNo = wrkMast.getDualCrnNo();
+ map.put(dualCrnNo, map.getOrDefault(dualCrnNo, 0) + 1);
+ }
+
+ List<BasDualCrnp> enabledCrnps = new ArrayList<>();
+ for (BasDualCrnp basDualCrnp : baseList) {
+ if (hasConfig && !allowedCrnNos.contains(basDualCrnp.getCrnNo())) {
+ continue;
+ }
+
+ DualCrnThread dualCrnThread = (DualCrnThread) SlaveConnection.get(SlaveType.DualCrn, basDualCrnp.getCrnNo());
+ if (dualCrnThread == null) {
+ continue;
+ }
+ DualCrnProtocol dualCrnProtocol = dualCrnThread.getStatus();
+ if (dualCrnProtocol.getMode() != DualCrnModeType.AUTO.id) {
+ continue;
+ }
+
+ List<WrkMast> inWrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>()
+ .eq("dual_crn_no", basDualCrnp.getCrnNo())
+ .eq("io_type", WrkIoType.IN.id)
+ );
+ // 妫�鏌ユ槸鍚﹁秴杩囨渶澶у叆搴撲换鍔℃暟
+ if (maxInTaskControl && inWrkMasts.size() >= basDualCrnp.getMaxInTask()) {
+ News.info("鍙屽伐浣嶅爢鍨涙満:{} 宸茶揪鏈�澶у叆搴撲换鍔℃暟锛屽綋鍓嶄换鍔℃暟:{}", basDualCrnp.getCrnNo(), inWrkMasts.size());
+ continue;
+ }
+
+ //璁$畻绔欑偣鏄惁鍙揪璇ュ爢鍨涙満
+ List<StationObjModel> inStationList = basDualCrnp.getInStationList$();
+ boolean enableGo = false;
+ for (StationObjModel stationObjModel : inStationList) {
+ try {
+ List<NavigateNode> navigateNodes = navigateUtils.calcByStationId(stationId, stationObjModel.getStationId());
+ if(navigateNodes != null && !navigateNodes.isEmpty()) {
+ enableGo = true;
+ break;
+ }
+ } catch (Exception e) {
+
+ }
+ }
+
+ if (enableGo) {
+ enabledCrnps.add(basDualCrnp);
+ }
+ }
+
+ enabledCrnps.sort(Comparator.comparingInt(o -> map.getOrDefault(o.getCrnNo(), 0)));
+
+ for (BasDualCrnp basDualCrnp : enabledCrnps) {
+ List<List<Integer>> rowList = basDualCrnp.getControlRows$();
+ for (List<Integer> rows : rowList) {
+ list.addAll(rows);
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return list;
+ }
+
+ public static Map<String, Object> convertObjectToMap(Object obj) {
+ Map<String, Object> map = new HashMap<>();
+ Class<?> clazz = obj.getClass();
+ Field[] fields = clazz.getDeclaredFields();
+ for (Field field : fields) {
+ field.setAccessible(true);
+ try {
+ map.put(field.getName(), field.get(obj));
+ }catch (Exception e){
+ e.printStackTrace();
+ }
+ }
+ return map;
+ }
+
+ //鑾峰彇娣卞簱浣嶆帓鍙�
+ public static List<Integer> getDeepRowList() {
+ List<Integer> rowList = new ArrayList<>();
+ BasCrnpService basCrnpService = SpringUtils.getBean(BasCrnpService.class);
+ if (basCrnpService == null) {
+ return rowList;
+ }
+
+ BasDualCrnpService basDualCrnpService = SpringUtils.getBean(BasDualCrnpService.class);
+ if (basDualCrnpService == null) {
+ return rowList;
+ }
+
+ List<BasCrnp> basCrnps = basCrnpService.selectList(new EntityWrapper<BasCrnp>());
+ for (BasCrnp basCrnp : basCrnps) {
+ String deepRowsStr = basCrnp.getDeepRows();
+ if(!Cools.isEmpty(deepRowsStr)){
+ List<Integer> rows = JSON.parseArray(deepRowsStr, Integer.class);
+ rowList.addAll(rows);
+ }
+ }
+
+ List<BasDualCrnp> basDualCrnps = basDualCrnpService.selectList(new EntityWrapper<BasDualCrnp>());
+ for (BasDualCrnp basDualCrnp : basDualCrnps) {
+ String deepRowsStr = basDualCrnp.getDeepRows();
+ if(!Cools.isEmpty(deepRowsStr)){
+ List<Integer> rows = JSON.parseArray(deepRowsStr, Integer.class);
+ rowList.addAll(rows);
+ }
+ }
+ return rowList;
+ }
+
+ //鑾峰彇娴呭簱浣嶆帓鍙�
+ public static Integer getShallowRowByDeepRow(Integer deepRow) {
+ SlaveType slaveType = checkRowDeviceType(deepRow);
+ if (slaveType == null) {
+ return null;
+ }
+
+ if (slaveType.equals(SlaveType.Crn)) {
+ return getShallowRowByCrnDeepRow(deepRow);
+ } else if (slaveType.equals(SlaveType.DualCrn)) {
+ return getShallowRowByDualCrnDeepRow(deepRow);
+ }
+
+ return null;
+ }
+
+ //鑾峰彇鍫嗗灈鏈烘祬搴撲綅鎺掑彿
+ public static Integer getShallowRowByCrnDeepRow(Integer deepRow) {
+ BasCrnpService basCrnpService = SpringUtils.getBean(BasCrnpService.class);
+ if (basCrnpService == null) {
+ return null;
+ }
+
+ List<Integer> deepRowList = getDeepRowList();
+ if (!deepRowList.contains(deepRow)) {
+ return null;
+ }
+
+ List<Integer> controlRowList = null;
+ List<BasCrnp> basCrnps = basCrnpService.selectList(new EntityWrapper<>());
+ for (BasCrnp basCrnp : basCrnps) {
+ List<List<Integer>> rowList = basCrnp.getControlRows$();
+ for (List<Integer> rows : rowList) {
+ if (rows.contains(deepRow)) {
+ controlRowList = rows;
+ break;
+ }
+ }
+
+ if (controlRowList != null) {
+ break;
+ }
+ }
+
+ if (controlRowList == null) {
+ return null;
+ }
+
+ for (Integer row : controlRowList) {
+ if (deepRow.equals(row)) {
+ continue;
+ }
+
+ return row;
+ }
+ return null;
+ }
+
+ //鑾峰彇鍙屽伐浣嶅爢鍨涙満娴呭簱浣嶆帓鍙�
+ public static Integer getShallowRowByDualCrnDeepRow(Integer deepRow) {
+ BasDualCrnpService basDualCrnpService = SpringUtils.getBean(BasDualCrnpService.class);
+ if (basDualCrnpService == null) {
+ return null;
+ }
+
+ List<Integer> deepRowList = getDeepRowList();
+ if (!deepRowList.contains(deepRow)) {
+ return null;
+ }
+
+ List<Integer> controlRowList = null;
+ List<BasDualCrnp> basDualCrnps = basDualCrnpService.selectList(new EntityWrapper<>());
+ for (BasDualCrnp basDualCrnp : basDualCrnps) {
+ List<List<Integer>> rowList = basDualCrnp.getControlRows$();
+ for (List<Integer> rows : rowList) {
+ if (rows.contains(deepRow)) {
+ controlRowList = rows;
+ break;
+ }
+ }
+
+ if (controlRowList != null) {
+ break;
+ }
+ }
+
+ if (controlRowList == null) {
+ return null;
+ }
+
+ for (Integer row : controlRowList) {
+ if (deepRow.equals(row)) {
+ continue;
+ }
+
+ return row;
+ }
+ return null;
+ }
+
+ //鑾峰彇娣卞簱浣嶆帓鍙�
+ public static Integer getDeepRowByShallowRow(Integer shallowRow) {
+ SlaveType slaveType = checkRowDeviceType(shallowRow);
+
+ if (slaveType.equals(SlaveType.Crn)) {
+ return getDeepRowByCrnShallowRow(shallowRow);
+ } else if (slaveType.equals(SlaveType.DualCrn)) {
+ return getDeepRowByDualCrnShallowRow(shallowRow);
+ }
+
+ return null;
+ }
+
+ //鑾峰彇鍫嗗灈鏈烘繁搴撲綅鎺掑彿
+ public static Integer getDeepRowByCrnShallowRow(Integer shallowRow) {
+ BasCrnpService basCrnpService = SpringUtils.getBean(BasCrnpService.class);
+ if (basCrnpService == null) {
+ return null;
+ }
+
+ List<Integer> controlRowList = null;
+ List<Integer> deepRowList = null;
+ List<BasCrnp> basCrnps = basCrnpService.selectList(new EntityWrapper<>());
+ for (BasCrnp basCrnp : basCrnps) {
+ List<List<Integer>> rowList = basCrnp.getControlRows$();
+ for (List<Integer> rows : rowList) {
+ if (rows.contains(shallowRow)) {
+ controlRowList = rows;
+ deepRowList = JSON.parseArray(basCrnp.getDeepRows(), Integer.class);
+ break;
+ }
+ }
+
+ if (controlRowList != null) {
+ break;
+ }
+ }
+
+ if (deepRowList == null) {
+ return null;
+ }
+
+ for (Integer row : controlRowList) {
+ if (!deepRowList.contains(row)) {
+ continue;
+ }
+
+ return row;
+ }
+ return null;
+ }
+
+ //鑾峰彇鍙屽伐浣嶅爢鍨涙満娣卞簱浣嶆帓鍙�
+ public static Integer getDeepRowByDualCrnShallowRow(Integer shallowRow) {
+ BasDualCrnpService basDualCrnpService = SpringUtils.getBean(BasDualCrnpService.class);
+ if (basDualCrnpService == null) {
+ return null;
+ }
+
+ List<Integer> controlRowList = null;
+ List<Integer> deepRowList = null;
+ List<BasDualCrnp> basDualCrnps = basDualCrnpService.selectList(new EntityWrapper<>());
+ for (BasDualCrnp basDualCrnp : basDualCrnps) {
+ List<List<Integer>> rowList = basDualCrnp.getControlRows$();
+ for (List<Integer> rows : rowList) {
+ if (rows.contains(shallowRow)) {
+ controlRowList = rows;
+ deepRowList = JSON.parseArray(basDualCrnp.getDeepRows(), Integer.class);
+ break;
+ }
+ }
+
+ if (controlRowList != null) {
+ break;
+ }
+ }
+
+ if (deepRowList == null) {
+ return null;
+ }
+
+ for (Integer row : controlRowList) {
+ if (!deepRowList.contains(row)) {
+ continue;
+ }
+
+ return row;
+ }
+ return null;
+ }
+
+ //妫�娴嬫帓鍙疯澶囩被鍨�
+ public static SlaveType checkRowDeviceType(Integer row) {
+ BasCrnpService basCrnpService = SpringUtils.getBean(BasCrnpService.class);
+ if (basCrnpService == null) {
+ return null;
+ }
+
+ BasDualCrnpService basDualCrnpService = SpringUtils.getBean(BasDualCrnpService.class);
+ if (basDualCrnpService == null) {
+ return null;
+ }
+
+ List<BasCrnp> basCrnps = basCrnpService.selectList(new EntityWrapper<>());
+ for (BasCrnp basCrnp : basCrnps) {
+ List<List<Integer>> controlRows = basCrnp.getControlRows$();
+ for (List<Integer> list : controlRows) {
+ if (list.contains(row)) {
+ return SlaveType.Crn;
+ }
+ }
+ }
+
+ List<BasDualCrnp> basDualCrnps = basDualCrnpService.selectList(new EntityWrapper<>());
+ for (BasDualCrnp basDualCrnp : basDualCrnps) {
+ List<List<Integer>> controlRows = basDualCrnp.getControlRows$();
+ for (List<Integer> list : controlRows) {
+ if (list.contains(row)) {
+ return SlaveType.DualCrn;
+ }
+ }
+ }
+
+ return null;
+ }
}
--
Gitblit v1.9.1