From 4530cb8f0e65de9079e64409f92741c03232c38c Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期一, 25 四月 2022 14:05:23 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/controller/MobileController.java |  140 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 138 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/MobileController.java b/src/main/java/com/zy/asrs/controller/MobileController.java
index 0af752a..ba76d5c 100644
--- a/src/main/java/com/zy/asrs/controller/MobileController.java
+++ b/src/main/java/com/zy/asrs/controller/MobileController.java
@@ -1,11 +1,22 @@
 package com.zy.asrs.controller;
 
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.core.annotations.ManagerAuth;
+import com.core.common.Cools;
 import com.core.common.R;
+import com.zy.asrs.entity.*;
 import com.zy.asrs.entity.param.CombParam;
+import com.zy.asrs.entity.param.MobileAdjustParam;
+import com.zy.asrs.entity.result.MobileAdjustResult;
+import com.zy.asrs.service.*;
+import com.zy.common.web.BaseController;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
 
 /**
  * 绉诲姩绔帴鍙f帶鍒跺櫒
@@ -13,16 +24,141 @@
  */
 @RestController
 @RequestMapping("mobile")
-public class MobileController {
+public class MobileController extends BaseController  {
+
+    @Autowired
+    private MobileService mobileService;
+    @Autowired
+    private LocMastService locMastService;
+    @Autowired
+    private LocDetlService locDetlService;
+    @Autowired
+    private OrderService orderService;
+    @Autowired
+    private DocTypeService docTypeService;
+    @Autowired
+    private WrkMastService wrkMastService;
+    @Autowired
+    private WrkDetlService wrkDetlService;
+    @Autowired
+    private BasDevpService basDevpService;
+    @Autowired
+    private PackService packService;
+
+    // 缁勬墭 ----------------------------------------------------------------------------------------------------
 
     /**
-     * 缁勬墭
+     * 鏍规嵁鍗曞彿妫�绱㈠崟鎹暟鎹�
+     * http://localhost:8081/jkwms/mobile/order/serach/orderNo/auth?orderNo=123123
      */
+    @RequestMapping("/order/search/orderNo/auth")
+    @ManagerAuth
+    public R orderSearchByBarcode(@RequestParam String orderNo){
+        Order order = orderService.selectByNo(orderNo);
+        if (order == null) {
+            return R.ok();
+        }
+        DocType docType = docTypeService.selectById(order.getDocType());
+        if (docType.getPakin() == null || docType.getPakin() != 1) {
+            return R.ok();
+        }
+        if (order.getSettle() > 2) {
+            return R.ok();
+        }
+        List<OrderDetl> orderDetls = orderService.selectWorkingDetls(order.getId());
+        if (Cools.isEmpty(orderDetls)) {
+            return R.ok();
+        }
+        return R.ok().add(orderDetls);
+    }
+
     @RequestMapping("/comb/auth")
     @ManagerAuth(memo = "缁勬墭")
     public R comb(@RequestBody CombParam combParam){
+        mobileService.comb(combParam, getUserId());
+        return R.ok("缁勬墭鎴愬姛");
+    }
 
+    @RequestMapping("/pack/get/auth")
+    @ManagerAuth
+    public R packGet(@RequestParam String barcode){
+        Pack pack = packService.selectByBarcode(barcode);
+        if (pack == null) {
+            return R.ok();
+        }
+        if (pack.getSettle() == 1L) {
+            return R.ok().add(pack);
+        }
+        return R.ok("缁勬墭鎴愬姛");
+    }
+
+    @RequestMapping("/pack/comb/auth")
+    @ManagerAuth(memo = "涓嬬嚎缁勬墭")
+    public R packComb(@RequestBody CombParam combParam){
+        mobileService.packComb(combParam, getUserId());
+        return R.ok("缁勬墭鎴愬姛");
+    }
+
+
+    // 鍑哄簱 ---------------------------------------------------------------------------------------------------
+
+    @RequestMapping("/pakout/query/auth")
+    @ManagerAuth
+    public R pakoutQuery(@RequestParam(required = false) String barcode,
+                         @RequestParam(required = false) Integer staNo,
+                         @RequestParam(required = false) String matnr){
+        if (Cools.isEmpty(barcode) && Cools.isEmpty(matnr)) {
+            return R.ok();
+        }
+        if (!Cools.isEmpty(barcode)) {
+            List<WrkDetl> wrkDetls = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("zpallet", barcode));
+            return R.ok().add(wrkDetls);
+        }
+        if (!Cools.isEmpty(matnr)) {
+            if (!Cools.isEmpty(staNo)) {
+                List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("sta_no", staNo).eq("wrk_sts", 14L));
+                if (!Cools.isEmpty(wrkMasts)) {
+                    WrkMast wrkMast = wrkMasts.get(0);
+                    List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo());
+                    return R.ok().add(wrkDetls);
+                }
+            }
+        }
         return R.ok();
     }
 
+
+    // 鐩樼偣 ----------------------------------------------------------------------------------------------------
+
+    @RequestMapping("/checkDetl/auth")
+    @ManagerAuth
+    public R getCheckDetl(@RequestParam(required = false) Integer staNo) {
+        if (null == staNo || staNo == 0) {
+            return R.ok();
+        }
+        BasDevp basDevp = basDevpService.selectById(staNo);
+        if (null != basDevp && basDevp.getWrkNo() != null) {
+            WrkMast wrkMast = wrkMastService.selectById(basDevp.getWrkNo());
+            if (wrkMast != null && wrkMast.getIoType() == 107) {
+                List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo());
+                if (!Cools.isEmpty(wrkDetls)) {
+                    MobileAdjustResult result = new MobileAdjustResult();
+                    result.setStaNo(staNo);
+                    result.setWrkNo(wrkMast.getWrkNo());
+                    result.setWrkDetls(wrkDetls);
+                    return R.ok().add(result);
+                }
+            }
+        }
+        return R.ok();
+    }
+
+    @RequestMapping("/adjust/auth")
+    @ManagerAuth(memo = "鐩樼偣")
+    public R adjust(@RequestBody MobileAdjustParam combParam){
+        mobileService.adjust(combParam, getUserId());
+        return R.ok("鐩樼偣鎴愬姛");
+    }
+
+
 }

--
Gitblit v1.9.1