From 5cf0fe34b6ef60407e7e8802d3f756bed9d9b7ac Mon Sep 17 00:00:00 2001
From: yangyang
Date: 星期日, 29 六月 2025 16:23:51 +0800
Subject: [PATCH] 问题修复

---
 zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/LocMapController.java |   57 +++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 41 insertions(+), 16 deletions(-)

diff --git a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/LocMapController.java b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/LocMapController.java
index 7a0bb7d..d1c3c19 100644
--- a/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/LocMapController.java
+++ b/zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/LocMapController.java
@@ -8,6 +8,7 @@
 import com.zy.asrs.framework.common.R;
 import com.zy.asrs.wms.asrs.entity.Loc;
 import com.zy.asrs.wms.asrs.entity.enums.LocStsType;
+import com.zy.asrs.wms.asrs.entity.param.LocMastInitParam;
 import com.zy.asrs.wms.asrs.service.LocService;
 import com.zy.asrs.wms.common.annotation.OperationLog;
 import com.zy.asrs.wms.common.domain.BaseParam;
@@ -153,32 +154,56 @@
     @OperationLog("鍒濆鍖栧簱浣�")
     @PostMapping("/locMap/init")
     @Transactional
-    public R init(@RequestBody LocMap locMap) {
-        Integer mapLev = locMap.getMapLev();
+    public R init(@RequestBody LocMastInitParam param) {
+//        Integer mapLev = locMap.getMapLev();
 
-        locService.remove(new LambdaQueryWrapper<Loc>().eq(Loc::getLev1, mapLev));
+//        locService.remove(new LambdaQueryWrapper<Loc>().eq(Loc::getLev1, mapLev));
 
         //瑙f瀽json鍦板浘鏁版嵁
-        List<ArrayList> arrayLists = JSON.parseArray(locMap.getData(), ArrayList.class);
-        int rowIdx = 0;
-        for (ArrayList row : arrayLists) {
-            int bayIdx = 0;
-            for (Object bay : row) {
-                JSONObject data = JSON.parseObject(JSON.toJSONString(bay));
-                if (data.getInteger("value") == 0) {
+//        List<ArrayList> arrayLists = JSON.parseArray(locMap.getData(), ArrayList.class);
+//        int rowIdx = 0;
+//        for (ArrayList row : arrayLists) {
+//            int bayIdx = 0;
+//            for (Object bay : row) {
+//                JSONObject data = JSON.parseObject(JSON.toJSONString(bay));
+//                if (data.getInteger("value") == 0) {
+//                    Loc loc = new Loc();
+//                    loc.setRow1(rowIdx);
+//                    loc.setBay1(bayIdx);
+//                    loc.setLev1(mapLev);
+//                    loc.setLocStsId(LocStsType.O.val());
+//                    loc.setLocNo(Utils.getPlatLocNo(rowIdx, bayIdx, mapLev));
+//                    locService.save(loc);
+//                }
+//                bayIdx++;
+//            }
+//            rowIdx++;
+//        }
+
+        List<Loc> list = new ArrayList<>();
+        Integer chanl = 0; //榛樿绗竴宸烽亾
+        for (int r = param.getStartRow(); r <= param.getEndRow(); r++) {
+//            if (r % param.getChannel() == 1) {
+//                chanl ++;
+//            }
+            for (int b = param.getStartBay(); b <= param.getEndBay(); b++) {
+                for (int l = param.getStartLev(); l <= param.getEndLev(); l++) {
+                    // 鑾峰彇搴撲綅鍙�
+                    String locNo = Utils.getPlatLocNo(r, b, l);
                     Loc loc = new Loc();
-                    loc.setRow1(rowIdx);
-                    loc.setBay1(bayIdx);
-                    loc.setLev1(mapLev);
+                    loc.setRow1(r);
+                    loc.setBay1(b);
+                    loc.setLev1(l);
                     loc.setLocStsId(LocStsType.O.val());
-                    loc.setLocNo(Utils.getLocNo(rowIdx, bayIdx, mapLev));
+                    loc.setLocNo(locNo);
                     locService.save(loc);
+                    list.add(loc);
                 }
-                bayIdx++;
             }
-            rowIdx++;
         }
 
+
+
         return R.ok("娣诲姞鎴愬姛");
     }
 

--
Gitblit v1.9.1