From 664df6de041aeab4341f739372f64ac9e428aad2 Mon Sep 17 00:00:00 2001
From: 1 <1@123>
Date: 星期二, 13 一月 2026 13:57:45 +0800
Subject: [PATCH] lsh#

---
 rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java |   96 +++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 74 insertions(+), 22 deletions(-)

diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
index 01697b5..45f807b 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
@@ -207,7 +207,6 @@
         return R.ok("浠诲姟鐢熸垚瀹屾瘯锛�");
     }
 
-
     @Override
     @Transactional(rollbackFor = Exception.class)
     public synchronized R generateFlatWarehouseTasks(WaitPakin pakins, String locCode, Long loginUserId) {
@@ -334,13 +333,16 @@
             throw new CoolException("璇锋鏌ョ粍鎷栫姸鎬佹槸鍚﹀畬鎴愶紒锛�");
         }
         waitPakins.forEach(pakin -> {
-            BasContainer container = basContainerService.getOne(new LambdaUpdateWrapper<BasContainer>()
-                    .eq(BasContainer::getCode, pakin.getBarcode()));
-            if (Objects.isNull(container)) {
-                throw new CoolException("瀹瑰櫒鏈淮鎶ゅ叆搴擄紝璇风淮鎶ゅ悗鍐嶆搷浣滐紒锛�");
-            }
+//            BasContainer container = basContainerService.getOne(new LambdaUpdateWrapper<BasContainer>()
+//                    .eq(BasContainer::getCode, pakin.getBarcode()));
+//            if (Objects.isNull(container)) {
+//                throw new CoolException("瀹瑰櫒鏈淮鎶ゅ叆搴擄紝璇风淮鎶ゅ悗鍐嶆搷浣滐紒锛�");
+//            }
+
+            //楠岃瘉鍩虹淇℃伅
+            BasStation basStation = checkStaStatus(pakin.getBarcode(), deviceSite.getSite());
             /**鑾峰彇搴撲綅*/
-            String targetLoc = LocManageUtil.getTargetLoc(warehouseArea.getId(), container.getContainerType());
+            String targetLoc = LocManageUtil.getTargetLoc(warehouseArea.getId(), null);
             if (Cools.isEmpty(targetLoc)) {
                 throw new CoolException("璇ョ珯鐐瑰搴斿簱鍖烘湭鎵惧埌搴撲綅");
             }
@@ -447,26 +449,71 @@
     }
 
 
+    private BasStation checkStaStatus(String barcode, String sta) {
+        if (Cools.isEmpty(barcode)) {
+            throw new CoolException("瀹瑰櫒鐮佷笉鑳戒负绌�");
+        }
+        if (Cools.isEmpty(sta)) {
+            throw new CoolException("鎺ラ┏浣嶄笉鑳戒负绌�");
+        }
+        BasStation isBarcodeSta = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
+                        .eq(BasStation::getBarcode, barcode)
+                , false
+        );
+        if (!Cools.isEmpty(isBarcodeSta)) {
+            throw new CoolException("璇ユ潯鐮佸凡琚�" + isBarcodeSta.getStationName() + "绔欑粦瀹�");
+        }
+        BasStation basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
+                .eq(BasStation::getStationName, sta)
+        );
+        if (Cools.isEmpty(basStation)) {
+            throw new CoolException("鏈壘鍒扮珯鐐逛俊鎭�");
+        }
+        if (!basStation.getUseStatus().equals("O")) {
+            throw new CoolException("绔欑偣鐘舵�佷笉涓虹┖闂�");
+        }
+        if (!Cools.isEmpty(basStation.getContainerType())) {
+            List<Long> longs1 = JSONObject.parseArray(basStation.getContainerType(), Long.class);
+            List<BasContainer> containers = basContainerService.list(
+                    new LambdaQueryWrapper<BasContainer>()
+                            .in(BasContainer::getContainerType, longs1)
+            );
+            boolean matches = false;
+            for (BasContainer container : containers) {
+                String codeType = container.getCodeType();  // 鑾峰彇姝e垯琛ㄨ揪寮�
+                if (barcode.matches(codeType)) {  // 鍒ゆ柇鏉$爜鏄惁绗﹀悎杩欎釜姝e垯
+                    matches = true;
+                    break;  // 鎵惧埌鍖归厤鐨勫氨閫�鍑哄惊鐜�
+                }
+            }
+//            boolean matches = containers.stream()
+//                    .map(BasContainer::getCodeType)
+//                    .anyMatch(codeType -> barcode.matches(codeType));
+            if (!matches) {
+                throw new CoolException("鏉$爜涓庣珯鐐逛笉鍖归厤");
+            }
+        }
+
+        return basStation;
+    }
     /**
-     * @param
      * @param loginUserId
-     * @return
      * @author Munch D. Luffy
      * @date 2026/01/10
      * @description: WCS鍏ュ簱浠诲姟鐢宠
      */
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public synchronized R generateTasksWcs(GenerateTaskParams waitPakin, Long loginUserId) {
+    public synchronized R generateTasksWcs(GenerateTaskParams waitPakin, Long loginUserId,List<Integer> rowList) {
         if (Objects.isNull(waitPakin) || waitPakin.getWaitPakins().isEmpty()) {
             throw new CoolException("鍙傛暟涓嶈兘涓虹┖锛侊紒");
         }
 
-        DeviceSite deviceSite = deviceSiteService.getById(waitPakin.getSiteId());
-        if (Objects.isNull(deviceSite)) {
+        BasStation basStation = basStationService.getById(waitPakin.getSiteId());
+        if (Objects.isNull(basStation)) {
             throw new CoolException("绔欑偣涓嶅瓨鍦紒锛�");
         }
-        DeviceBind deviceBind = deviceBindService.getById(LocUtils.getAreaType(deviceSite.getSite()));
+        DeviceBind deviceBind = deviceBindService.getById(LocUtils.getAreaType(basStation.getStationName()));
         if (Cools.isEmpty(deviceBind)) {
             throw new CoolException("搴撲綅瑙勫垯鏈煡");
         }
@@ -484,13 +531,18 @@
             throw new CoolException("璇锋鏌ョ粍鎷栫姸鎬佹槸鍚﹀畬鎴愶紒锛�");
         }
         waitPakins.forEach(pakin -> {
-            BasContainer container = basContainerService.getOne(new LambdaUpdateWrapper<BasContainer>()
-                    .eq(BasContainer::getCode, pakin.getBarcode()));
-            if (Objects.isNull(container)) {
-                throw new CoolException("瀹瑰櫒鏈淮鎶ゅ叆搴擄紝璇风淮鎶ゅ悗鍐嶆搷浣滐紒锛�");
-            }
+
+
+            //楠岃瘉鍩虹淇℃伅
+
+            BasStation basStation1 = checkStaStatus(pakin.getBarcode(),basStation.getStationName());
+//            BasContainer container = basContainerService.getOne(new LambdaUpdateWrapper<BasContainer>()
+//                    .eq(BasContainer::getCode, pakin.getBarcode()));
+//            if (Objects.isNull(container)) {
+//                throw new CoolException("瀹瑰櫒鏈淮鎶ゅ叆搴擄紝璇风淮鎶ゅ悗鍐嶆搷浣滐紒锛�");
+//            }
             /**鑾峰彇搴撲綅*/
-            String targetLoc = LocManageUtil.getTargetLoc(warehouseArea.getId(), container.getContainerType());
+            String targetLoc = LocManageUtil.getTargetLoc(warehouseArea.getId(),null,rowList);
             if (Cools.isEmpty(targetLoc)) {
                 throw new CoolException("璇ョ珯鐐瑰搴斿簱鍖烘湭鎵惧埌搴撲綅");
             }
@@ -507,8 +559,8 @@
                     .setResource(TaskResouceType.TASK_RESOUCE_PAKIN_TYPE.val)
                     .setTargLoc(targetLoc)
                     .setBarcode(pakin.getBarcode())
-                    .setOrgSite(deviceSite.getSite())
-                    .setTargSite(deviceSite.getDeviceSite())
+                    .setOrgSite(basStation.getStationName())
+                    .setTargSite(basStation.getStationName())
                     .setCreateBy(loginUserId)
                     .setUpdateBy(loginUserId);
 
@@ -659,7 +711,7 @@
      */
     private Task modiftyTaskSort(Task task, Long loginUserId) {
         String curLoc;
-        if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type)) {
+        if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type) || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_IN.type)) {
             curLoc = task.getTargLoc();
         } else {
             curLoc = task.getOrgLoc();

--
Gitblit v1.9.1