From 914a092bc4c21d69641f94b68fecf61b25ddaca1 Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期三, 06 九月 2023 13:11:38 +0800
Subject: [PATCH] #拣货单完成、上架规则

---
 src/main/java/com/zy/asrs/controller/LocCheckController.java |   48 ++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 44 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/LocCheckController.java b/src/main/java/com/zy/asrs/controller/LocCheckController.java
index 8549423..ea85ae8 100644
--- a/src/main/java/com/zy/asrs/controller/LocCheckController.java
+++ b/src/main/java/com/zy/asrs/controller/LocCheckController.java
@@ -7,22 +7,29 @@
 import com.baomidou.mybatisplus.plugins.Page;
 import com.core.common.DateUtils;
 import com.zy.asrs.entity.LocCheck;
+import com.zy.asrs.entity.ManLocDetl;
 import com.zy.asrs.service.LocCheckService;
 import com.core.annotations.ManagerAuth;
 import com.core.common.BaseRes;
 import com.core.common.Cools;
 import com.core.common.R;
+import com.zy.asrs.service.ManLocDetlService;
 import com.zy.common.web.BaseController;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.*;
 
+import java.util.*;
+@Slf4j
 @RestController
 public class LocCheckController extends BaseController {
 
     @Autowired
     private LocCheckService locCheckService;
+
+    @Autowired
+    private ManLocDetlService manLocDetlService;
 
     @RequestMapping(value = "/locCheck/{id}/auth")
     @ManagerAuth
@@ -121,9 +128,42 @@
     }
 
     @RequestMapping("/locCheck/create/auth")
-    public R autoCreate(String prec){
-        locCheckService.autoCreatePick(prec);
-        return R.ok("鍒涘缓鎷h揣鍗曟垚鍔�");
+    @ManagerAuth
+    public R autoCreate(@RequestParam(value = "prec") String prec){
+        int precInt = Integer.parseInt(prec);
+        EntityWrapper<ManLocDetl> manLocDetlEntityWrapper = new EntityWrapper<>();
+        int count = manLocDetlService.selectCount(manLocDetlEntityWrapper);
+        List<ManLocDetl> countLocDetl;
+        switch (precInt){
+            case 100:
+                break;
+            case 80:
+                count = (int)(count * 0.8); break;
+            case 60:
+                count = (int)(count * 0.6); break;
+            case 40:
+                count = (int)(count * 0.4); break;
+            case 10:
+                count = (int)(count * 0.1); break;
+            default:
+                return R.ok("鏁伴噺");
+        }
+        countLocDetl = locCheckService.getCountLocDetl(count);
+        locCheckService.deleteAll();
+        for (ManLocDetl manLocDetl :countLocDetl){
+            LocCheck locCheck = new LocCheck();
+            locCheck.setLocNo(manLocDetl.getLocNo());
+            locCheck.setType(1);
+            locCheck.setMatnr(manLocDetl.getMatnr());
+            locCheck.setAnfme(manLocDetl.getAnfme());
+            if (!locCheckService.insert(locCheck)){
+                return R.error("鎻掑叆澶辫触");
+            }
+        }
+
+
+        return R.ok("鎻掑叆鎴愬姛");
+
     }
 
 }

--
Gitblit v1.9.1