From 369d64e49980d910414a7efe486d72dfc230cde4 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期五, 28 五月 2021 11:00:04 +0800
Subject: [PATCH] #
---
src/main/java/zy/cloud/wms/manager/service/impl/WorkServiceImpl.java | 108 +++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 83 insertions(+), 25 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 c7b9c42..905d81b 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
@@ -137,6 +137,62 @@
@Override
@Transactional
+ public R stockPakout(PakoutParam param, Long userId) {
+ Mat mat = matService.selectByMatnr(param.getMatnr());
+ Node node = nodeService.selectByUuid(param.getNodeUuid());
+ LocDetl locDetl = locDetlService.getLocDetl(node.getId(), mat.getMatnr());
+ if (locDetl == null || locDetl.getAnfme() < param.getCount()) {
+ return R.error(mat.getMaktx() + "搴撳瓨涓嶈冻");
+ }
+ Pakout pakout = new Pakout(
+ String.valueOf(snowflakeIdWorker.nextId()), // 浠诲姟鍙穂闈炵┖]
+ 3L, // 宸ヤ綔鐘舵��
+ null, // 鎵樼洏鍙�
+ param.getCount(), // 鍑哄簱鏁伴噺
+ node.getId(), // 鍏宠仈璐т綅[闈炵┖]
+ node.getUuid(), // 璐т綅[闈炵┖]
+ mat.getMatnr(), // 鍟嗗搧缂栫爜[闈炵┖]
+ null, // 鍟嗗搧鍚嶇О
+ null, // 鍚嶇О
+ null, // 灏虹爜
+ null, // 鍨嬪彿
+ null, // 鎵瑰彿
+ null, // 鍗曚綅
+ null, // SKC
+ null, // 鍗曟嵁绫诲瀷
+ null, // 鍗曟嵁缂栧彿
+ null, // 瀹㈡埛鍚嶇О
+ null, // 鍝侀」鏁�
+ null, // 鏁伴噺
+ null, // 閲嶉噺
+ 1, // 鐘舵��
+ userId, // 娣诲姞浜哄憳
+ new Date(), // 娣诲姞鏃堕棿
+ userId, // 淇敼浜哄憳
+ new Date(), // 淇敼鏃堕棿
+ null // 澶囨敞
+ );
+ VersionUtils.setPakout(pakout, mat);
+ // 淇濆瓨鍑哄簱閫氱煡鍗�
+ if (!pakoutService.insert(pakout)) {
+ throw new CoolException("淇濆瓨鍑哄簱閫氱煡鍗曞け璐�");
+ }
+ if (param.getCount()>=locDetl.getAnfme()) {
+ // 鍒犻櫎搴撳瓨鏄庣粏
+ if (!locDetlService.removeStock(node.getId(), mat.getMatnr())) {
+ throw new CoolException("鍒犻櫎搴撳瓨鏄庣粏澶辫触");
+ }
+ } else {
+ // 淇敼搴撳瓨鏄庣粏鏁伴噺
+ if (!locDetlService.reduceStock(node.getId(), mat.getMatnr(), param.getCount())) {
+ throw new CoolException("淇敼搴撳瓨鏄庣粏鏁伴噺澶辫触");
+ }
+ }
+ return R.ok();
+ }
+
+ @Override
+ @Transactional
public R stockIn(StockInParam param, Long userId) {
Node node = nodeService.selectByUuid(param.getNodeId());
if (node == null) {
@@ -560,28 +616,28 @@
}
}
// 鐩存帴澧炲姞搴撳瓨
- LocDetl locDetl = locDetlService.getLocDetl(param.getNode_id(), param.getMatnr());
- if (locDetl == null) {
- // 鏇存柊璐т綅搴撳瓨鏄庣粏
- locDetl = new LocDetl();
- locDetl.setLocNo(node.getName());
- locDetl.setNodeId(node.getId());
- locDetl.setAnfme(anfme);
- VersionUtils.setLocDetl(locDetl, mat);
- locDetl.setStatus(1);
- locDetl.setCreateBy(userId);
- locDetl.setCreateTime(new Date());
- locDetl.setUpdateBy(userId);
- locDetl.setUpdateTime(new Date());
- boolean insert = locDetlService.insert(locDetl);
- if (!insert) {
- throw new CoolException("鏂板搴撳瓨鏄庣粏妗eけ璐�");
- }
- } else {
- if (!locDetlService.incrementStock(node.getId(), param.getMatnr(), anfme)) {
- throw new CoolException("鏂板搴撳瓨鏄庣粏妗eけ璐�");
- }
- }
+// LocDetl locDetl = locDetlService.getLocDetl(param.getNode_id(), param.getMatnr());
+// if (locDetl == null) {
+// // 鏇存柊璐т綅搴撳瓨鏄庣粏
+// locDetl = new LocDetl();
+// locDetl.setLocNo(node.getName());
+// locDetl.setNodeId(node.getId());
+// locDetl.setAnfme(anfme);
+// VersionUtils.setLocDetl(locDetl, mat);
+// locDetl.setStatus(1);
+// locDetl.setCreateBy(userId);
+// locDetl.setCreateTime(new Date());
+// locDetl.setUpdateBy(userId);
+// locDetl.setUpdateTime(new Date());
+// boolean insert = locDetlService.insert(locDetl);
+// if (!insert) {
+// throw new CoolException("鏂板搴撳瓨鏄庣粏妗eけ璐�");
+// }
+// } else {
+// if (!locDetlService.incrementStock(node.getId(), param.getMatnr(), anfme)) {
+// throw new CoolException("鏂板搴撳瓨鏄庣粏妗eけ璐�");
+// }
+// }
return R.ok("琛ヤ粨鎴愬姛锛岀瓑寰呯珛搴撹皟鎷�");
}
@@ -760,9 +816,11 @@
String docNum = null;
Long docId = null;
switch (check.getSettle()) {
- case 1: // 鐩樼泩
- docNum = "CS-" + String.valueOf(snowflakeIdWorker.nextId()).substring(0, 15);
- docId = 14L; // 鎶ユ孩鍗�
+ case 1: // 鐩樼泩 todo 鍓嶆湡鐢ㄩ噰璐崟涓婃姤
+// docNum = "CS-" + String.valueOf(snowflakeIdWorker.nextId()).substring(0, 15);
+// docId = 14L; // 鎶ユ孩鍗�
+ docNum = "PU-" + String.valueOf(snowflakeIdWorker.nextId()).substring(0, 15);
+ docId = 34L; // 閲囪喘鍗�
break;
case 2: // 鐩樹簭
docNum = "CD-" + String.valueOf(snowflakeIdWorker.nextId()).substring(0, 15);
--
Gitblit v1.9.1