From cc2b7c021293f25748711617ef182b2d15192dbd Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期二, 29 六月 2021 14:47:40 +0800
Subject: [PATCH] #

---
 src/main/java/zy/cloud/wms/manager/service/impl/WorkServiceImpl.java |   51 ++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 44 insertions(+), 7 deletions(-)

diff --git a/src/main/java/zy/cloud/wms/manager/service/impl/WorkServiceImpl.java b/src/main/java/zy/cloud/wms/manager/service/impl/WorkServiceImpl.java
index 905d81b..ee3054b 100644
--- a/src/main/java/zy/cloud/wms/manager/service/impl/WorkServiceImpl.java
+++ b/src/main/java/zy/cloud/wms/manager/service/impl/WorkServiceImpl.java
@@ -17,6 +17,7 @@
 import zy.cloud.wms.common.service.MainService;
 import zy.cloud.wms.common.service.asrs.AsrsService;
 import zy.cloud.wms.common.service.asrs.entity.Result1;
+import zy.cloud.wms.common.service.erp.ErpR;
 import zy.cloud.wms.common.service.erp.ErpService;
 import zy.cloud.wms.common.utils.VersionUtils;
 import zy.cloud.wms.manager.entity.*;
@@ -67,7 +68,11 @@
     public R stockPakin(PakinParam param, Long userId) {
         Node node = nodeService.selectByUuid(param.getNodeId());
         if (node == null) {
-            node = nodeService.selectById(param.getNodeId());
+            try {
+                node = nodeService.selectById(param.getNodeId());
+            } catch (Exception e) {
+                return R.error("璐т綅涓嶅瓨鍦�");
+            }
         }
         if (node == null) {
             return R.error("璐т綅涓嶅瓨鍦�");
@@ -128,8 +133,9 @@
             billDto.setQty(dto.getCount());
             dtos.add(billDto);
         }
-        if (!erpService.uploadBill(dtos, docId, docNum)) {
-            throw new CoolException("鏃犳硶涓婃姤鑷砮rp");
+        ErpR erpR = erpService.uploadBill(dtos, docId, docNum);
+        if (!erpR.getSuccess()) {
+            throw new CoolException("鏃犳硶涓婃姤鑷砮rp锛�"+erpR.getMsg());
         }
 
         return R.ok("鍏ュ簱鎴愬姛");
@@ -260,8 +266,9 @@
             billDto.setQty(comb.getAnfme());
             dtos.add(billDto);
         }
-        if (!erpService.uploadBill(dtos, param.getDocType(), docNum)) {
-            throw new CoolException("鏃犳硶涓婃姤鑷砮rp");
+        ErpR erpR = erpService.uploadBill(dtos, param.getDocType(), docNum);
+        if (!erpR.getSuccess()) {
+            throw new CoolException("鏃犳硶涓婃姤鑷砮rp锛�"+erpR.getMsg());
         }
         return R.ok();
     }
@@ -642,6 +649,35 @@
         return R.ok("琛ヤ粨鎴愬姛锛岀瓑寰呯珛搴撹皟鎷�");
     }
 
+    @Override
+    public R asrsStockTransferLocMode(AsrsTransferParam param, Long userId) {
+        if (Cools.isEmpty(param.getNode_id(), param.getMatnr(), param.getSafe_qua(), param.getAmount())) {
+            return R.error("鏁伴噺閿欒");
+        }
+        Node node = nodeService.selectById(param.getNode_id());
+        Mat mat = matService.selectByMatnr(param.getMatnr());
+        if (node == null || mat == null) {
+            return R.error();
+        }
+        double anfme = Arith.subtract(2, param.getSafe_qua(), param.getAmount());
+        List<StockTransferParam> params = new ArrayList<>();
+        StockTransferParam transferParam = new StockTransferParam();
+        transferParam.setMatnr(param.getMatnr());
+        transferParam.setAnfme(anfme);
+        transferParam.setAllotNo(param.getNode_id()+ "_" +param.getMatnr());
+        transferParam.setLocNo(param.getLocNo());
+        params.add(transferParam);
+        Result1 result = asrsService.stockTransferLocMode(params);
+        if (result.getCode() == 500) {
+            if (Cools.isEmpty(result.getData())) {
+                throw new CoolException(result.getMsg());
+            } else {
+                throw new CodeCoolException("20001-" + result.getData());
+            }
+        }
+
+        return R.ok("琛ヤ粨鎴愬姛锛岀瓑寰呯珛搴撹皟鎷�");
+    }
 
     @Override
     public R stockCheck(StoCheckParam param, Long userId) {
@@ -844,8 +880,9 @@
         billDto.setMatnr(check.getMatnr());
         billDto.setQty(Math.abs(check.getDiffQty()));
         dtos.add(billDto);
-        if (!erpService.uploadBill(dtos, docId.intValue(), docNum)) {
-            throw new CoolException("鏃犳硶涓婃姤鑷砮rp");
+        ErpR erpR = erpService.uploadBill(dtos, docId.intValue(), docNum);
+        if (!erpR.getSuccess()) {
+            throw new CoolException("鏃犳硶涓婃姤鑷砮rp锛�"+erpR.getMsg());
         }
         return R.ok();
     }

--
Gitblit v1.9.1