From 664d9030efca22edd8e43b4db4b2c0700fff44af Mon Sep 17 00:00:00 2001
From: Junjie <DELL@qq.com>
Date: 星期三, 14 一月 2026 09:18:33 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/core/utils/WmsOperateUtils.java |   51 ++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 40 insertions(+), 11 deletions(-)

diff --git a/src/main/java/com/zy/core/utils/WmsOperateUtils.java b/src/main/java/com/zy/core/utils/WmsOperateUtils.java
index 5cd16b3..423b10d 100644
--- a/src/main/java/com/zy/core/utils/WmsOperateUtils.java
+++ b/src/main/java/com/zy/core/utils/WmsOperateUtils.java
@@ -7,17 +7,21 @@
 import com.core.exception.CoolException;
 import com.zy.asrs.entity.BasCrnp;
 import com.zy.asrs.entity.BasDualCrnp;
+import com.zy.asrs.entity.BasStation;
 import com.zy.asrs.entity.HttpRequestLog;
 import com.zy.asrs.entity.WrkMast;
 import com.zy.asrs.service.BasCrnpService;
 import com.zy.asrs.service.BasDualCrnpService;
+import com.zy.asrs.service.BasStationService;
 import com.zy.asrs.service.HttpRequestLogService;
 import com.zy.asrs.service.WrkMastService;
 import com.zy.asrs.utils.Utils;
 import com.zy.common.entity.FindCrnNoResult;
 import com.zy.common.service.CommonService;
 import com.zy.common.utils.HttpHandler;
+import com.zy.common.utils.RedisUtil;
 import com.zy.core.News;
+import com.zy.core.enums.RedisKeyType;
 import com.zy.core.enums.SlaveType;
 import com.zy.system.entity.Config;
 import com.zy.system.service.ConfigService;
@@ -45,28 +49,42 @@
     private BasCrnpService basCrnpService;
     @Autowired
     private BasDualCrnpService basDualCrnpService;
+    @Autowired
+    private BasStationService basStationService;
+    @Autowired
+    private StationOperateProcessUtils stationOperateProcessUtils;
+    @Autowired
+    private RedisUtil redisUtil;
 
     //鐢宠鍏ュ簱浠诲姟
     public synchronized String applyInTask(String barcode, Integer sourceStaNo, Integer locType1) {
-        String wmsUrl = null;
-        Config wmsSystemUriConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "wmsSystemUri"));
-        if (wmsSystemUriConfig != null) {
-            wmsUrl = wmsSystemUriConfig.getValue();
+        Object systemConfigMapObj = redisUtil.get(RedisKeyType.SYSTEM_CONFIG_MAP.key);
+        if (systemConfigMapObj == null) {
+            News.error("绯荤粺Config缂撳瓨澶辨晥");
+            return null;
         }
+        HashMap<String, String> systemConfigMap = (HashMap<String, String>) systemConfigMapObj;
 
+        String wmsUrl = systemConfigMap.get("wmsSystemUri");
         if (wmsUrl == null) {
             News.error("鏈厤缃甒MS绯荤粺URI锛岄厤缃枃浠禖ode缂栫爜锛歸msSystemUri");
             return null;
         }
 
-        String wmsSystemInUrl = null;
-        Config wmsSystemInUrlConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "wmsSystemInUrl"));
-        if (wmsSystemInUrlConfig != null) {
-            wmsSystemInUrl = wmsSystemInUrlConfig.getValue();
+        String wmsSystemInUrl = systemConfigMap.get("wmsSystemInUrl");
+        if(wmsSystemInUrl == null){
+            News.error("鏈厤缃甒MS鍏ュ簱鎺ュ彛鍦板潃锛岄厤缃枃浠禖ode缂栫爜锛歸msSystemInUrl");
+            return null;
         }
 
-        if(wmsSystemInUrlConfig == null){
-            News.error("鏈厤缃甒MS鍏ュ簱鎺ュ彛鍦板潃锛岄厤缃枃浠禖ode缂栫爜锛歸msSystemInUrl");
+        int conveyorStationTaskLimit = 30;
+        String conveyorStationTaskLimitStr = systemConfigMap.get("conveyorStationTaskLimit");
+        if(conveyorStationTaskLimitStr != null){
+            conveyorStationTaskLimit = Integer.parseInt(conveyorStationTaskLimitStr);
+        }
+        int currentStationTaskCount = stationOperateProcessUtils.getCurrentStationTaskCount();
+        if (currentStationTaskCount > conveyorStationTaskLimit) {
+            News.error("杈撻�佺珯鐐逛换鍔″凡杈惧埌涓婇檺锛屼笂闄愬�硷細{}锛岀珯鐐逛换鍔℃暟锛歿}", conveyorStationTaskLimit, currentStationTaskCount);
             return null;
         }
 
@@ -74,8 +92,19 @@
         String response = null;
         int result = 0;
         try {
+            BasStation basStation = basStationService.selectOne(new EntityWrapper<BasStation>().eq("station_id", sourceStaNo));
+            if(basStation == null){
+                News.error("绔欑偣{}涓嶅瓨鍦�", sourceStaNo);
+                return null;
+            }
+
+            String stationNo = String.valueOf(sourceStaNo);
+            if(!Cools.isEmpty(basStation.getStationAlias())){
+                stationNo = basStation.getStationAlias();
+            }
+
             requestParam.put("barcode", barcode);
-            requestParam.put("sourceStaNo", String.valueOf(sourceStaNo));
+            requestParam.put("sourceStaNo", stationNo);
             requestParam.put("locType1", locType1);
             requestParam.put("row", Utils.getInTaskEnableRow(sourceStaNo));
 

--
Gitblit v1.9.1