From 8fbb7182a426eac7e8112e60548b07d051b91a51 Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期日, 21 十二月 2025 10:58:41 +0800
Subject: [PATCH] #库存预留
---
src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java | 39 +++++++++++++++++++++++++++++++++------
src/main/java/com/zy/asrs/controller/OutController.java | 15 ++++++---------
src/main/webapp/views/orderPakout/order.html | 2 +-
3 files changed, 40 insertions(+), 16 deletions(-)
diff --git a/src/main/java/com/zy/asrs/controller/OutController.java b/src/main/java/com/zy/asrs/controller/OutController.java
index f729b42..463ac10 100644
--- a/src/main/java/com/zy/asrs/controller/OutController.java
+++ b/src/main/java/com/zy/asrs/controller/OutController.java
@@ -141,20 +141,17 @@
.eq(!Cools.isEmpty(orderDetl.getBoxType3()), "box_type3", orderDetl.getBoxType3())
);
- // 濡傛灉搴撳瓨棰勭暀璁板綍涓嶄负绌猴紝浣跨敤steam灏嗗簱瀛橀鐣欒褰曚腑鐨勫簱瀛樻暟閲忓叏閮ㄥ姞璧锋潵,瀛楁涓簈uantity锛岀被鍨嬩负BigDecimal
- BigDecimal inventoryReserveQuantity = inventoryReserves.stream().map(InventoryReserve::getQuantity).reduce(BigDecimal.ZERO, BigDecimal::add);
- //鑾峰彇搴撳瓨涓殑搴撳瓨鏁伴噺
List<LocDetl> locDetls = locDetlService.queryStockAll(null, exist, orderDetl.getMatnr(), orderDetl.getBatch(),
orderDetl.getBrand(), orderDetl.getStandby1(), orderDetl.getStandby2(), orderDetl.getStandby3(), orderDetl.getBoxType1(), orderDetl.getBoxType2(), orderDetl.getBoxType3());
- // 浣跨敤steam灏唋ocDetls涓殑搴撳瓨鏁伴噺鍏ㄩ儴鍔犺捣鏉�,瀛楁涓簈uantity锛孌ouble绫诲瀷
- BigDecimal locDetlQuantity = locDetls.stream().map(LocDetl::getAnfme).map(BigDecimal::valueOf).reduce(BigDecimal.ZERO, BigDecimal::add);
+ if (!Cools.isEmpty(inventoryReserves)) {
+ BigDecimal inventoryReserveQuantity = inventoryReserves.stream().map(InventoryReserve::getQuantity).reduce(BigDecimal.ZERO, BigDecimal::add);
+ BigDecimal locDetlQuantity = locDetls.stream().map(LocDetl::getAnfme).map(BigDecimal::valueOf).reduce(BigDecimal.ZERO, BigDecimal::add);
- if (locDetlQuantity.subtract(new BigDecimal(orderDetl.getAnfme())).compareTo(inventoryReserveQuantity) < 0) {
- return R.parse("搴撳瓨棰勭暀鏁伴噺澶т簬搴撳瓨鏁伴噺");
+ if (locDetlQuantity.subtract(new BigDecimal(orderDetl.getAnfme())).compareTo(inventoryReserveQuantity) < 0) {
+ return R.parse("搴撳瓨棰勭暀鏁伴噺澶т簬搴撳瓨鏁伴噺");
+ }
}
-
-
double issued = Optional.of(orderDetl.getAnfme() - orderDetl.getWorkQty()).orElse(0.0D);
diff --git a/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
index 56f8945..b3f4da6 100644
--- a/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
@@ -2,10 +2,7 @@
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
-import com.core.common.BaseRes;
-import com.core.common.Cools;
-import com.core.common.DateUtils;
-import com.core.common.SnowflakeIdWorker;
+import com.core.common.*;
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
import com.zy.asrs.entity.param.EmptyPlateOutParam;
@@ -29,6 +26,7 @@
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
+import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@@ -98,6 +96,9 @@
@Autowired
private OrderDetlPakoutService orderDetlPakoutService;
+
+ @Autowired
+ private InventoryReserveService inventoryReserveService;
@Override
@Transactional
@@ -189,6 +190,32 @@
List<LocDetlDto> locDetlDtos = new ArrayList<>();
for (StockOutParam.LocDetl paramLocDetl : param.getLocDetls()) {
if (!Cools.isEmpty(paramLocDetl.getLocNo(), paramLocDetl.getMatnr(), paramLocDetl.getCount())) {
+
+ List<InventoryReserve> inventoryReserves = inventoryReserveService.selectList(new EntityWrapper<InventoryReserve>()
+ .eq("matnr", paramLocDetl.getMatnr())
+ .eq("batch", paramLocDetl.getBatch())
+ .eq(!Cools.isEmpty(paramLocDetl.getBrand()), "brand", paramLocDetl.getBrand())
+ .eq(!Cools.isEmpty(paramLocDetl.getStandby1()), "standby1", paramLocDetl.getStandby1())
+ .eq(!Cools.isEmpty(paramLocDetl.getStandby2()), "standby2", paramLocDetl.getStandby2())
+ .eq(!Cools.isEmpty(paramLocDetl.getStandby3()), "standby3", paramLocDetl.getStandby3())
+ .eq(!Cools.isEmpty(paramLocDetl.getBoxType1()), "box_type1", paramLocDetl.getBoxType1())
+ .eq(!Cools.isEmpty(paramLocDetl.getBoxType2()), "box_type2", paramLocDetl.getBoxType2())
+ .eq(!Cools.isEmpty(paramLocDetl.getBoxType3()), "box_type3", paramLocDetl.getBoxType3())
+
+ );
+
+ List<LocDetl> locDetls = locDetlService.queryStockAll(null, null, paramLocDetl.getMatnr(), paramLocDetl.getBatch(),
+ paramLocDetl.getBrand(), paramLocDetl.getStandby1(), paramLocDetl.getStandby2(), paramLocDetl.getStandby3(), paramLocDetl.getBoxType1(), paramLocDetl.getBoxType2(), paramLocDetl.getBoxType3());
+
+ if (!Cools.isEmpty(inventoryReserves)) {
+ BigDecimal inventoryReserveQuantity = inventoryReserves.stream().map(InventoryReserve::getQuantity).reduce(BigDecimal.ZERO, BigDecimal::add);
+ BigDecimal locDetlQuantity = locDetls.stream().map(LocDetl::getAnfme).map(BigDecimal::valueOf).reduce(BigDecimal.ZERO, BigDecimal::add);
+
+ if (locDetlQuantity.subtract(new BigDecimal(paramLocDetl.getCount().toString())).compareTo(inventoryReserveQuantity) < 0) {
+ throw new CoolException("搴撳瓨棰勭暀鏁伴噺澶т簬搴撳瓨鏁伴噺");
+ }
+ }
+
LocDetl one = locDetlService.selectItem(paramLocDetl.getLocNo(), paramLocDetl.getMatnr(), paramLocDetl.getBatch(), paramLocDetl.getBrand()
, paramLocDetl.getStandby1(), paramLocDetl.getStandby2(), paramLocDetl.getStandby3(), paramLocDetl.getBoxType1(), paramLocDetl.getBoxType2(), paramLocDetl.getBoxType3());
if (null != one) locDetlDtos.add(new LocDetlDto(one, paramLocDetl.getCount()));
@@ -1067,7 +1094,7 @@
@Transactional
public void cancelWrkMast(String workNo, Long userId) {
Date now = new Date();
- WrkMast wrkMast = wrkMastService.selectById(workNo);
+ WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", workNo));
if (Cools.isEmpty(wrkMast)) {
throw new CoolException(workNo + "宸ヤ綔妗d笉瀛樺湪");
}
@@ -1218,7 +1245,7 @@
@Override
@Transactional
public void pickWrkMast(String workNo, Long userId) {
- WrkMast wrkMast = wrkMastService.selectById(workNo);
+ WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", workNo));
if (Cools.isEmpty(wrkMast)) {
throw new CoolException(workNo + "宸ヤ綔妗d笉瀛樺湪");
}
diff --git a/src/main/webapp/views/orderPakout/order.html b/src/main/webapp/views/orderPakout/order.html
index e212ed2..99ab6b4 100644
--- a/src/main/webapp/views/orderPakout/order.html
+++ b/src/main/webapp/views/orderPakout/order.html
@@ -111,7 +111,7 @@
{{# if (d.settle == 2) { }}
<a class="layui-btn layui-btn-primary layui-border-blue layui-btn-xs btn-complete" lay-event="complete">瀹岀粨</a>
{{# } }}
- {{# if (d.settle == 1 || d.settle == 2) { }}
+ {{# if (d.settle == 1) { }}
<a class="layui-btn layui-btn-warm layui-btn-xs btn-edit" lay-event="reserve">棰勭暀</a>
{{# } }}
</script>
--
Gitblit v1.9.1