From 0b5dc6887e46ac956b5b783c70244d40589fbd25 Mon Sep 17 00:00:00 2001
From: lsh <lsh@163.com>
Date: 星期四, 13 十一月 2025 16:11:21 +0800
Subject: [PATCH] *

---
 src/main/java/com/zy/asrs/controller/LocDetlController.java |  129 +++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 123 insertions(+), 6 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/LocDetlController.java b/src/main/java/com/zy/asrs/controller/LocDetlController.java
index 2f91219..e25eb46 100644
--- a/src/main/java/com/zy/asrs/controller/LocDetlController.java
+++ b/src/main/java/com/zy/asrs/controller/LocDetlController.java
@@ -2,6 +2,7 @@
 
 import com.alibaba.excel.EasyExcel;
 import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
@@ -13,12 +14,20 @@
 import com.core.common.DateUtils;
 import com.core.common.R;
 import com.zy.asrs.entity.LocDetl;
+import com.zy.asrs.entity.ManLocDetl;
 import com.zy.asrs.entity.Mat;
+import com.zy.asrs.entity.param.OrderInspectionRollParam;
+import com.zy.asrs.entity.param.QualityGroupListParam;
+import com.zy.asrs.entity.result.OrderPakoutDetailVo;
 import com.zy.asrs.mapper.LocDetlMapper;
+import com.zy.asrs.service.ApiLogService;
 import com.zy.asrs.service.LocDetlService;
+import com.zy.asrs.service.ManLocDetlService;
 import com.zy.asrs.service.MatService;
+import com.zy.common.utils.HttpHandler;
 import com.zy.common.web.BaseController;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
@@ -31,10 +40,18 @@
 
     @Autowired
     private LocDetlService locDetlService;
+
     @Autowired
     private LocDetlMapper locDetlMapper;
     @Autowired
     private MatService matService;
+    @Autowired
+    private ApiLogService apiLogService;
+
+    @Value("${srXghyMes.qualityFinishedCheckoutUrl}")
+    private String qualityFinishedCheckoutUrl;
+    @Value("${srXghyMes.qualityFinishedCheckout}")
+    private String qualityFinishedCheckout;
 
     @RequestMapping(value = "/locDetl/update")
     public R update1() {
@@ -80,10 +97,36 @@
                 param.remove("modi_time");
             }
         }
-        return R.ok(locDetlService.getStockOut(toPage(curr, limit, param, LocDetl.class)));
+        Page<LocDetl> stockOut = locDetlService.getStockOut(toPage(curr, limit, param, LocDetl.class));
+        if (stockOut.getRecords().size()==0){
+            stockOut = locDetlService.getStockOut(toPage(1, limit, param, LocDetl.class));
+        }
+        return R.ok(stockOut);
     }
 
-    @RequestMapping(value = "/locDetl/list/auth")
+    @RequestMapping(value = "/unqualified/stock/out/list/auth")
+    @ManagerAuth
+    public R stockOutListUnqualified(@RequestParam(defaultValue = "1")Integer curr,
+                          @RequestParam(defaultValue = "10")Integer limit,
+                          @RequestParam Map<String, Object> param){
+        param.put("danger",2);
+        if (!Cools.isEmpty(param.get("modi_time"))){
+            String val = String.valueOf(param.get("modi_time"));
+            if (val.contains(RANGE_TIME_LINK)) {
+                String[] dates = val.split(RANGE_TIME_LINK);
+                param.put("startTime", DateUtils.convert(dates[0]));
+                param.put("endTime", DateUtils.convert(dates[1]));
+                param.remove("modi_time");
+            }
+        }
+        Page<LocDetl> stockOut = locDetlService.getStockOut(toPage(curr, limit, param, LocDetl.class));
+        if (stockOut.getRecords().size()==0){
+            stockOut = locDetlService.getStockOut(toPage(1, limit, param, LocDetl.class));
+        }
+        return R.ok(stockOut);
+    }
+
+    @RequestMapping(value = "/locDetl/list/auth")// /locDetl/list/auth 鎺ュ彛闂
     @ManagerAuth
     public R list(@RequestParam(defaultValue = "1")Integer curr,
                   @RequestParam(defaultValue = "10")Integer limit,
@@ -113,6 +156,7 @@
 //        }
         return R.ok(locDetlService.selectPage(new Page<>(curr, limit), wrapper));
     }
+
 
     private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){
         for (Map.Entry<String, Object> entry : map.entrySet()){
@@ -145,12 +189,18 @@
 	@RequestMapping(value = "/locDetl/update/auth")
 	@ManagerAuth(memo = "搴撲綅鏄庣粏淇敼")
     public R update(LocDetl locDetl){
-        if (Cools.isEmpty(locDetl) || null==locDetl.getMatnr()){
+        if (Cools.isEmpty(locDetl) || null==locDetl.getBatch()){
             return R.error();
         }
-        locDetl.setModiUser(getUserId());
-        locDetl.setModiTime(new Date());
-        locDetlService.updateById(locDetl);
+        LocDetl locDetl1 = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("loc_no", locDetl.getLocNo()).eq("batch", locDetl.getBatch()));
+        if (Cools.isEmpty(locDetl1) ){
+            return R.error();
+        }
+        locDetl1.setModiUser(getUserId());
+        locDetl1.setModiTime(new Date());
+        locDetl1.setDanger(locDetl.getDanger());
+        locDetlService.update(locDetl1,new EntityWrapper<LocDetl>().eq("loc_no", locDetl.getLocNo()).eq("batch", locDetl.getBatch()));
+//        locDetlService.updateById(locDetl1);
         return R.ok();
     }
 
@@ -267,4 +317,71 @@
         return R.ok(sum);
     }
 
+    @RequestMapping(value = "/actual/shipment/locDetl/report/auth")
+    @ManagerAuth(memo = "鍗峰彿鏄惁鍚堟牸鎵嬪姩鏍¢獙")
+    public R actualShipmentLocDetl(@RequestParam String model) {
+        Long userId = null;
+        try {
+            userId = getUserId();
+            if (Cools.isEmpty(userId)) {
+                return R.error("鐢ㄦ埛寮傚父").add("鐢ㄦ埛寮傚父");
+            }
+        } catch (Exception e){
+            return R.error("鐢ㄦ埛寮傚父").add("鐢ㄦ埛寮傚父");
+        }
+        List<LocDetl> locDetlList = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("model", model));
+        OrderInspectionRollParam orderInspectionRollParam = new OrderInspectionRollParam(model);
+        String response = "";
+        boolean success = false;
+        Map<String, Object> params = JSON.parseObject(JSON.toJSONString(orderInspectionRollParam), Map.class);
+        try {
+            response = new HttpHandler.Builder()
+                    .setUri(qualityFinishedCheckoutUrl)
+                    .setPath(qualityFinishedCheckout)
+                    .setParams(params)
+                    .setUseFormUrlEncoded(true)
+                    .build()
+                    .doPost();
+            JSONObject jsonObject = JSON.parseObject(response);
+            if (jsonObject.getBoolean("state")) {
+                String value = jsonObject.getString("value");
+                if (value.equals("鍚堟牸")){
+                    for (LocDetl locDetl : locDetlList) {
+                        locDetl.setDanger(1);
+                        locDetlService.updateById(locDetl);
+                    }
+                } else if (value.equals("涓嶅悎鏍�")){
+                    for (LocDetl locDetl : locDetlList) {
+                        locDetl.setDanger(2);
+                        locDetlService.updateById(locDetl);
+                    }
+                } else {
+                    for (LocDetl locDetl : locDetlList) {
+                        locDetl.setDanger(0);
+                        locDetlService.updateById(locDetl);
+                    }
+                }
+                success = true;
+            } else {
+                return R.error("鏌ヨ鍗峰彿鏄惁鍚堟牸澶辫触");
+            }
+        } catch (Exception e) {
+            return R.error("鏌ヨ鍗峰彿鏄惁鍚堟牸澶辫触"+e.getMessage());
+        } finally {
+            try {
+                // 淇濆瓨鎺ュ彛鏃ュ織
+                apiLogService.save(
+                        "鏌ヨ鍗峰彿鏄惁鍚堟牸",
+                        qualityFinishedCheckoutUrl+"/"+qualityFinishedCheckout,
+                        null,
+                        "127.0.0.1",
+                        JSON.toJSONString(orderInspectionRollParam),
+                        response,
+                        success
+                );
+            } catch (Exception e) { }
+        }
+        return R.error("涓婃姤澶辫触").add("涓婃姤澶辫触");
+    }
+
 }

--
Gitblit v1.9.1