From 99543f7e820927a8826a7308461a8ab94c361859 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期四, 04 七月 2024 14:28:17 +0800
Subject: [PATCH] #平库库位whs_type==1
---
zy-asrs-common/src/main/java/com/zy/asrs/common/wms/service/impl/MobileServiceImpl.java | 86 ++++++++++++++++++++++++++++++++++++++----
1 files changed, 77 insertions(+), 9 deletions(-)
diff --git a/zy-asrs-common/src/main/java/com/zy/asrs/common/wms/service/impl/MobileServiceImpl.java b/zy-asrs-common/src/main/java/com/zy/asrs/common/wms/service/impl/MobileServiceImpl.java
index 2b2fef2..484fc04 100644
--- a/zy-asrs-common/src/main/java/com/zy/asrs/common/wms/service/impl/MobileServiceImpl.java
+++ b/zy-asrs-common/src/main/java/com/zy/asrs/common/wms/service/impl/MobileServiceImpl.java
@@ -19,6 +19,7 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
@@ -113,7 +114,7 @@
param.getCombMats().forEach(elem -> {
// 璁㈠崟鏄庣粏鏁伴噺鏍¢獙
- OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), elem.getMatnr(), elem.getBatch());
+ OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), elem.getMatnr(), elem.getBatch(),hostId);
if (elem.getAnfme() > orderDetl.getEnableQty()) {
throw new CoolException(orderDetl.getMatnr() + "鍏ュ簱鏁伴噺涓嶅悎娉�");
}
@@ -123,6 +124,9 @@
}
DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getAnfme());
+ detlDto.setWarehouse(orderDetl.getThreeCode());//鏉ユ簮浠撳簱
+ detlDto.setOrigin(orderDetl.getSupp());//鏉ユ簮鍗曞彿
+ detlDto.setOriginNo(orderDetl.getSuppCode());//鏉ユ簮搴忓彿
if (DetlDto.has(detlDtos, detlDto)) {
DetlDto one = DetlDto.find(detlDtos, detlDto.getMatnr(), detlDto.getBatch());
assert one != null;
@@ -143,6 +147,9 @@
waitPakin.setZpallet(param.getBarcode()); // 鎵樼洏鐮�
waitPakin.setIoStatus("N"); // 鍏ュ嚭鐘舵��
waitPakin.setAnfme(detlDto.getAnfme()); // 鏁伴噺
+ waitPakin.setThreeCode(detlDto.getWarehouse()); // 浠撳簱
+ waitPakin.setSupp(detlDto.getOrigin()); // 鏉ユ簮鍗曞彿
+ waitPakin.setSuppCode(detlDto.getOriginNo()); // 鏉ユ簮搴忓彿
waitPakin.setStatus("Y"); // 鐘舵��
waitPakin.setAppeUser(userId);
waitPakin.setAppeTime(now);
@@ -238,7 +245,7 @@
@Transactional
public R WarehouseIn(String locNo, String barcode,Long hostId) {
//鍒ゆ柇搴撲綅鐘舵��
- LocMast locMast = locMastService.getOne(new LambdaQueryWrapper<LocMast>().eq(LocMast::getLocNo, locNo).eq(LocMast::getHostId,hostId));
+ LocMast locMast = locMastService.getOne(new LambdaQueryWrapper<LocMast>().eq(LocMast::getLocNo, locNo).eq(LocMast::getHostId,hostId).eq(LocMast::getWhsType,1L));
if (Cools.isEmpty(locMast)){
return R.error("璇ュ簱浣嶄笉瀛樺湪");
}
@@ -272,7 +279,7 @@
if (Cools.isEmpty(order)){
continue;
}
- OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), waitPakin.getMatnr(), waitPakin.getBatch());
+ OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), waitPakin.getMatnr(), waitPakin.getBatch(),hostId);
if (Cools.isEmpty(orderDetl)){
continue;
}
@@ -280,6 +287,9 @@
if (!orderDetlService.increase(order.getId(), hostId, waitPakin.getMatnr(), waitPakin.getBatch(), waitPakin.getAnfme())) {
throw new CoolException("淇敼鍗曟嵁鏄庣粏鏁伴噺澶辫触");
}
+ // 淇敼璁㈠崟鐘舵�� 浣滀笟涓� ===>> 宸插畬鎴�
+ orderService.checkComplete(waitPakin.getOrderNo(), hostId);
+
}
}
//淇敼搴撲綅鐘舵��
@@ -301,9 +311,10 @@
}
@Override
+ @Transactional
public R WarehouseOut(CombParam combParam, Long hostId) {
//鍒ゆ柇搴撲綅鐘舵��
- LocMast locMast = locMastService.getOne(new LambdaQueryWrapper<LocMast>().eq(LocMast::getLocNo, combParam.getLocno()).eq(LocMast::getHostId,hostId));
+ LocMast locMast = locMastService.getOne(new LambdaQueryWrapper<LocMast>().eq(LocMast::getLocNo, combParam.getLocno()).eq(LocMast::getHostId,hostId).eq(LocMast::getWhsType,1L));
if (Cools.isEmpty(locMast)){
return R.error("璇ュ簱浣嶄笉瀛樺湪");
}
@@ -311,13 +322,70 @@
return R.error("璇ュ簱浣嶇姸鎬佷负锛�"+locMast.getLocSts()+",绂佹鍑哄簱");
}
//鏌ヨ搴撳瓨鏁版嵁
- List<LocDetl> locDetls = locDetlService.list(new LambdaQueryWrapper<LocDetl>().eq(LocDetl::getZpallet, combParam.getBarcode()).eq(LocDetl::getLocNo, combParam.getLocno()).eq(LocDetl::getHostId, hostId));
- if (Cools.isEmpty(locDetls)){
- return R.error("鏈煡璇㈠埌搴撳瓨鏁版嵁");
+ for (CombParam.CombMat combMat :combParam.getCombMats()){
+ LocDetl locDetl = locDetlService.getOne(new LambdaQueryWrapper<LocDetl>()
+ .eq(LocDetl::getLocNo, combParam.getLocno())
+ .eq(LocDetl::getHostId, hostId)
+ .eq(LocDetl::getZpallet, combMat.getZpallet())
+ .eq(LocDetl::getMatnr, combMat.getMatnr())
+ .eq(LocDetl::getBatch, combMat.getBatch())
+ );
+ if (Cools.isEmpty(locDetl)){
+ return R.error("鏈煡璇㈠埌搴撳瓨鏁版嵁");
+ }
+ if (combMat.getAnfme() > locDetl.getAnfme()){
+ return R.error("涓嬫灦鏁伴噺閿欒锛岃秴鍑哄簱瀛樻暟閲�");
+ }
+ if (!Cools.isEmpty(combParam.getOrderNo())){
+ Order order = orderService.selectByNo(combParam.getOrderNo(), hostId);
+ if (Cools.isEmpty(order)){
+ continue;
+ }
+ if (order.getSettle() == 1){
+ orderService.updateSettle(order.getId(), 2L, 9527L, hostId);
+ }
+ OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), combMat.getMatnr(), combMat.getBatch(),hostId);
+ if (Cools.isEmpty(orderDetl)){
+ continue;
+ }
+ if (orderDetl.getAnfme() < orderDetl.getWorkQty()+combMat.getAnfme()){
+ throw new CoolException("涓嬫灦鏁伴噺鍑洪敊");
+ }
+ // 淇敼璁㈠崟鏄庣粏浣滀笟鏁伴噺
+ if (!orderDetlService.increaseWorkQtyByOrderNo(combParam.getOrderNo(), combMat.getMatnr(), combMat.getBatch(), combMat.getAnfme(), hostId)) {
+ throw new CoolException("淇敼鍗曟嵁鏄庣粏宸ヤ綔鏁伴噺澶辫触");
+ }
+ // 淇敼璁㈠崟鏄庣粏瀹屾垚鏁伴噺
+ if (!orderDetlService.increase(order.getId(), hostId, combMat.getMatnr(), combMat.getBatch(), combMat.getAnfme())) {
+ throw new CoolException("淇敼鍗曟嵁鏄庣粏瀹屾垚鏁伴噺澶辫触");
+ }
+ // 淇敼璁㈠崟鐘舵�� 浣滀笟涓� ===>> 宸插畬鎴�
+ orderService.checkComplete(combParam.getOrderNo(), hostId);
+ }
+ try {
+ //澶勭悊搴撳瓨淇℃伅
+ if (combMat.getAnfme().equals(locDetl.getAnfme())){
+ //搴撳瓨鐩哥瓑鍒犻櫎鏁版嵁
+ locDetlService.removeById(locDetl);
+ int count = locDetlService.count(new LambdaQueryWrapper<LocDetl>().eq(LocDetl::getLocNo,combParam.getLocno()).eq(LocDetl::getHostId, hostId));
+ if (count == 0){
+ LocMast locMast1 = locMastService.getOne(new LambdaQueryWrapper<LocMast>().eq(LocMast::getLocNo, combParam.getLocno()).eq(LocMast::getHostId, hostId));
+ locMast1.setLocSts("O");
+ locMastService.updateById(locMast1);
+ }
+ }else {
+ BigDecimal subtract = BigDecimal.valueOf(locDetl.getAnfme()).subtract(BigDecimal.valueOf(combMat.getAnfme()));
+ locDetl.setAnfme(subtract.doubleValue());
+ locDetlService.updateById(locDetl);
+ }
+ }catch (Exception e){
+ throw new CoolException("鏇存柊搴撳瓨鏁版嵁鍑洪敊"+e.getMessage());
+ }
}
- for (LocDetl locDetl: locDetls){
- }
+
+
+
return R.ok();
}
--
Gitblit v1.9.1