From a68bf17ab81df98882e19b79628e6876bb260468 Mon Sep 17 00:00:00 2001
From: zc <zc@123>
Date: 星期三, 18 六月 2025 10:04:26 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/fyxc_shuttle_wcs' into fyxc_shuttle_wcs

---
 src/main/java/com/zy/common/utils/ForkLiftUtils.java |  129 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 128 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/zy/common/utils/ForkLiftUtils.java b/src/main/java/com/zy/common/utils/ForkLiftUtils.java
index 044d9e1..045054a 100644
--- a/src/main/java/com/zy/common/utils/ForkLiftUtils.java
+++ b/src/main/java/com/zy/common/utils/ForkLiftUtils.java
@@ -1,5 +1,8 @@
 package com.zy.common.utils;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.core.common.SpringUtils;
 import com.zy.asrs.utils.Utils;
 import com.zy.common.model.NavigateNode;
@@ -9,8 +12,11 @@
 import com.zy.core.model.protocol.ForkLiftStaProtocol;
 import com.zy.core.properties.SlaveProperties;
 import com.zy.core.thread.ForkLiftThread;
+import com.zy.system.entity.Config;
+import com.zy.system.service.ConfigService;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 
 /**
@@ -36,7 +42,6 @@
 
         return null;
     }
-
 
     //鑾峰彇鎻愬崌鏈虹珯鐐�
     public static ForkLiftStaProtocol getLiftStaByLev(Integer liftNo, Integer lev) {
@@ -71,4 +76,126 @@
         return targetNodes;
     }
 
+    //閫氳繃杈撻�佺嚎绔欏彿鑾峰彇瀵瑰簲鎻愬崌鏈哄彿
+    public static Integer getConveyorBindLiftNo(Integer staNo) {
+        ConfigService configService = SpringUtils.getBean(ConfigService.class);
+        if (configService == null) {
+            return null;
+        }
+
+        Config conveyorLiftBindConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "conveyorLiftBind"));
+        if(conveyorLiftBindConfig == null) {
+            return null;
+        }
+
+        List<JSONObject> list = JSON.parseArray(conveyorLiftBindConfig.getValue(), JSONObject.class);
+        if (list.isEmpty()) {
+            return null;
+        }
+
+        for (JSONObject data : list) {
+            if(data.getInteger("staNo").equals(staNo)) {
+                return data.getInteger("liftNo");
+            }
+        }
+
+        return null;
+    }
+
+    //璇锋眰涓婄骇绯荤粺锛屾槸鍚﹀厑璁稿嚭搴�
+    //鏌ヨ鏄惁鏈夊嚭搴撴潈闄�
+    public static boolean queryOutMission(Integer staNo) {
+        ConfigService configService = SpringUtils.getBean(ConfigService.class);
+        if (configService == null) {
+            return false;
+        }
+
+        Config queryOutMissionPathEnableConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "queryOutMissionPathEnable"));
+        if (queryOutMissionPathEnableConfig != null) {
+            String queryOutMissionPathEnable = queryOutMissionPathEnableConfig.getValue();
+            if (!queryOutMissionPathEnable.equals("Y")) {
+                return true;//鍏抽棴鏌ヨ鍑哄簱鏉冮檺鍔熻兘
+            }
+        }
+
+        Config superSystemUriConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "superSystemUri"));
+        if (superSystemUriConfig == null) {
+            return false;
+        }
+        String superSystemUri = superSystemUriConfig.getValue();
+
+        Config queryOutMissionPathConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "queryOutMissionPath"));
+        if (queryOutMissionPathConfig == null) {
+            return false;
+        }
+        String missionPath = queryOutMissionPathConfig.getValue();
+
+        try {
+            HashMap<String, Object> data = new HashMap<>();
+            data.put("staNo", staNo);
+
+            String response = new HttpHandler.Builder()
+                    .setUri(superSystemUri)
+                    .setPath(missionPath)
+                    .setJson(JSON.toJSONString(data))
+                    .build()
+                    .doPost();
+            if (response.equals("ok")) {
+                return true;//鏈夊嚭搴撴潈闄�
+            }
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+        return false;
+    }
+
+    //璇锋眰涓婄骇绯荤粺锛屾槸鍚﹀厑璁稿叆搴�
+    //鏌ヨ鏄惁鏈夊叆搴撴潈闄�
+    public static boolean queryInMission(Integer sourceStaNo, Integer liftNo, String superTaskNo) {
+        ConfigService configService = SpringUtils.getBean(ConfigService.class);
+        if (configService == null) {
+            return false;
+        }
+
+        Config queryInMissionPathEnableConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "queryInMissionPathEnable"));
+        if (queryInMissionPathEnableConfig != null) {
+            String queryInMissionPathEnable = queryInMissionPathEnableConfig.getValue();
+            if (!queryInMissionPathEnable.equals("Y")) {
+                return true;//鍏抽棴鏌ヨ鍏ュ簱鏉冮檺鍔熻兘
+            }
+        }
+
+        Config superSystemUriConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "superSystemUri"));
+        if (superSystemUriConfig == null) {
+            return false;
+        }
+        String superSystemUri = superSystemUriConfig.getValue();
+
+        Config queryInMissionPathConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "queryInMissionPath"));
+        if (queryInMissionPathConfig == null) {
+            return false;
+        }
+        String missionPath = queryInMissionPathConfig.getValue();
+
+        try {
+            HashMap<String, Object> data = new HashMap<>();
+            data.put("staNo", sourceStaNo);
+            data.put("liftNo", liftNo);
+            data.put("superTaskNo", superTaskNo);
+
+            String response = new HttpHandler.Builder()
+                    .setUri(superSystemUri)
+                    .setPath(missionPath)
+                    .setJson(JSON.toJSONString(data))
+                    .build()
+                    .doPost();
+            if (response.equals("ok")) {
+                return true;//鏈夊叆搴撴潈闄�
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return false;
+    }
+
 }

--
Gitblit v1.9.1