From 35ce7aaef10e30006bcef381d19302c0928c1194 Mon Sep 17 00:00:00 2001
From: 18516761980 <4761516tqsxp>
Date: 星期二, 14 九月 2021 08:24:00 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/controller/MobileController.java |   87 +++++++++++++++++++++++++++++++++++++++----
 1 files changed, 79 insertions(+), 8 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/MobileController.java b/src/main/java/com/zy/asrs/controller/MobileController.java
index 361e6f3..3851b5f 100644
--- a/src/main/java/com/zy/asrs/controller/MobileController.java
+++ b/src/main/java/com/zy/asrs/controller/MobileController.java
@@ -1,30 +1,32 @@
 package com.zy.asrs.controller;
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.baomidou.mybatisplus.mapper.Wrapper;
 import com.core.annotations.ManagerAuth;
 import com.core.common.BaseRes;
 import com.core.common.Cools;
 import com.core.common.R;
-import com.zy.asrs.entity.CombBillQueryVo;
-import com.zy.asrs.entity.LocDetl;
-import com.zy.asrs.entity.LocMast;
-import com.zy.asrs.entity.WrkDetl;
+import com.core.exception.CoolException;
+import com.zy.asrs.entity.*;
 import com.zy.asrs.entity.param.CombParam;
-import com.zy.asrs.service.LocDetlService;
-import com.zy.asrs.service.LocMastService;
-import com.zy.asrs.service.MobileService;
-import com.zy.asrs.service.WrkDetlService;
+import com.zy.asrs.service.*;
 import com.zy.common.model.MobileLocDetlVo;
 import com.zy.common.web.BaseController;
+import com.zy.ints.entity.WaitMatchk;
 import com.zy.ints.entity.WaitMatin;
+import com.zy.ints.service.WaitMatchkService;
 import com.zy.ints.service.WaitMatinService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
 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.ArrayList;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -45,6 +47,10 @@
     private WrkDetlService wrkDetlService;
     @Autowired
     private WaitMatinService waitMatinService;
+    @Autowired
+    private WaitMatchkService waitMatchkService;
+    @Autowired
+    private MatCodeService matCodeService;
 
     /**
      * 缁勬墭
@@ -200,4 +206,69 @@
         return R.ok().add(list);
     }
 
+    /**
+     * 鏍规嵁PDA鐩樼偣鏁伴噺锛屾洿鏂扮洏鐐归�氱煡妗�
+     * @param param
+     * @return
+     */
+    @RequestMapping("/stock/check")
+    @Transactional
+    public R erpStockCheck(@RequestBody String param) {
+        Boolean flag = false;
+        JSONObject jsonObject = JSONObject.parseObject(param);
+        String checkListStr = jsonObject.getString("checkList");
+        List<WaitMatchk> checkList = JSONArray.parseArray(checkListStr, WaitMatchk.class);
+        Long userId = 9527L; //getUserId();//9527L;
+        int seq = 0;
+        Date now = new Date();
+        for (Integer i = 0; i < checkList.size(); i++) {
+            String locNo = checkList.get(i).getLocNo();
+            String matNo = checkList.get(i).getMatNo();
+            Double checkQty = checkList.get(i).getCheckQty();
+
+            Wrapper<WaitMatchk> wrapper = new EntityWrapper<WaitMatchk>().eq("loc_no",locNo).eq("mat_no",matNo);
+            WaitMatchk waitMatchk0 = waitMatchkService.selectOne(wrapper);
+            if(null != waitMatchk0){
+                waitMatchk0.setCheckQty(checkQty);
+                flag = waitMatchkService.update(waitMatchk0,wrapper);
+                if(!flag){
+                    throw new CoolException("鏇存柊鐩樼偣閫氱煡妗eけ璐�");
+                }
+            } else {
+                MatCode matCode = matCodeService.selectOne(new EntityWrapper<MatCode>().eq("mat_no",matNo));
+                WaitMatchk waitMatchk1 = waitMatchkService.selectOne(new EntityWrapper<WaitMatchk>().eq("loc_no",locNo).orderBy("seq_no",false));
+                if(null != matCode) {
+                    WaitMatchk waitMatchk = new WaitMatchk();
+                    waitMatchk.setLocNo(locNo);
+                    waitMatchk.setMatNo(matNo);
+                    if(null != waitMatchk1){
+                        waitMatchk.setBillNo(waitMatchk1.getBillNo());
+                        waitMatchk.setSeqNo(waitMatchk1.getSeqNo()+1);
+                        waitMatchk.setZpallet(waitMatchk1.getZpallet());
+                        waitMatchk.setLinkErp(waitMatchk1.getLinkErp());
+                        waitMatchk.setIoStatus(waitMatchk1.getIoStatus());
+                    } else {
+                        waitMatchk.setBillNo("0");
+                        waitMatchk.setSeqNo(seq++);
+                        waitMatchk.setLinkErp(0);
+                        waitMatchk.setIoStatus(1);
+                    }
+                    waitMatchk.setBillType(1);//鎶界洏
+                    waitMatchk.setMatName(matCode.getMatName());
+                    waitMatchk.setStockQty(0D);
+                    waitMatchk.setCheckQty(checkQty);
+                    waitMatchk.setModiTime(now);
+                    waitMatchk.setModiUser(getUserId());
+                    waitMatchk.setAppeTime(now);
+                    waitMatchk.setAppeUser(getUserId());
+                    flag = waitMatchkService.insert(waitMatchk);
+                    if(!flag){
+                        throw new CoolException("鏂板鐩樼偣閫氱煡妗f暟鎹け璐�");
+                    }
+                }
+
+            }
+        }
+        return R.ok().add(flag);
+    }
 }

--
Gitblit v1.9.1