From 52552445ea0e49bc662d5cdc0d9e33318104c41c Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期一, 09 八月 2021 12:51:01 +0800
Subject: [PATCH] #

---
 src/main/java/zy/cloud/wms/manager/service/impl/WorkServiceImpl.java |   51 +++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 45 insertions(+), 6 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 57cf3e2..290cbac 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.*;
@@ -61,6 +62,8 @@
     private ErpService erpService;
     @Autowired
     private AsrsService asrsService;
+    @Autowired
+    private PakinService pakinService;
 
     @Override
     @Transactional
@@ -97,6 +100,39 @@
             if (mat == null) {
                 throw new CoolException("鐗╂枡鏁版嵁閿欒锛岃鑱旂郴绠$悊鍛�");
             }
+            // 淇濆瓨鍏ュ簱璁板綍
+            Pakin pakin = new Pakin(
+                    "I" + String.valueOf(snowflakeIdWorker.nextId()),    // 浠诲姟鍙穂闈炵┖]
+                    null,    // 宸ヤ綔鐘舵��
+                    null,    // 鎵樼洏鍙�
+                    dto.getCount(),    // 鍏ュ簱鏁伴噺
+                    node.getId(),    // 鍏宠仈璐т綅[闈炵┖]
+                    node.getUuid(),    // 璐т綅[闈炵┖]
+                    mat.getMatnr(),    // 鍟嗗搧缂栫爜[闈炵┖]
+                    null,    // 鍟嗗搧鍚嶇О
+                    null,    // 鍚嶇О
+                    null,    // 灏虹爜
+                    null,    // 鍨嬪彿
+                    null,    // 鎵瑰彿
+                    null,    // 鍗曚綅
+                    null,    // SKC
+                    null,    // 鍗曟嵁绫诲瀷
+                    null,    // 鍗曟嵁缂栧彿
+                    null,    // 瀹㈡埛鍚嶇О
+                    null,    // 鍝侀」鏁�
+                    null,    // 鏁伴噺
+                    null,    // 閲嶉噺
+                    1,    // 鐘舵��
+                    userId,    // 娣诲姞浜哄憳
+                    now,    // 娣诲姞鏃堕棿
+                    userId,    // 淇敼浜哄憳
+                    now,    // 淇敼鏃堕棿
+                    null    // 澶囨敞
+            );
+            VersionUtils.setPakin(pakin, mat);
+            if (!pakinService.insert(pakin)) {
+                throw new CoolException("淇濆瓨鍏ュ簱璁板綍澶辫触");
+            }
             LocDetl locDetl = locDetlService.getLocDetl(node.getId(), dto.getMatnr());
             if (locDetl == null) {
                 // 鏇存柊璐т綅搴撳瓨鏄庣粏
@@ -132,8 +168,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("鍏ュ簱鎴愬姛");
@@ -264,8 +301,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();
     }
@@ -877,8 +915,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