仓库管理修改

liweidong
wusiyu 2 days ago
parent 013b7cf096
commit 5afe2b8312
  1. 26
      blade-service/blade-wms/src/main/java/org/springblade/wms/service/impl/StOtherReceiptRecordServiceImpl.java

@ -83,6 +83,30 @@ public class StOtherReceiptRecordServiceImpl extends BaseServiceImpl<StOtherRece
throw new RuntimeException("库存更新失败:商品明细列表不能为空,请选择入库商品");
}
Map<Long, String> slPiMap = new HashMap<>();
for (StStockInoutRecord detail : inoutList) {
Long slId = detail.getSlId();
String piNo = detail.getPiNo();
// 基础字段校验
if (detail.getGoodsId() == null || slId == null || detail.getQuantity() == null || detail.getQuantity() <= 0) {
throw new RuntimeException("库存更新失败:商品ID、库位ID不能为空,入库数量必须大于0");
}
// 该库位已存在待入库批次,判断是否一致
if (slPiMap.containsKey(slId)) {
String existPi = slPiMap.get(slId);
if (!StrUtil.equals(existPi, piNo)) {
throw new ServiceException(
"同一库位不允许录入多个批次!库位已存在批次:" + existPi + ",当前明细批次:" + piNo
);
}
} else {
// 库位首次出现,存入批次号
slPiMap.put(slId, piNo);
}
}
Long sirId = stOtherReceiptRecord.getSirId();
StStockInoutRecord inout = null;
if (sirId != null) {
@ -121,7 +145,7 @@ public class StOtherReceiptRecordServiceImpl extends BaseServiceImpl<StOtherRece
List<String> piNos = stRealtimeStockService.findBySlIdAndGoodsCode(detail.getSlId(), location.getGoodsCode());
String detailPiNo = detail.getPiNo();
if (CollUtil.isNotEmpty(piNos)) {
// 库位已有库存 → 必须和转移单 pino 一致
// 库位已有库存 → 必须和pino 一致
boolean pinoMatch = piNos.stream().anyMatch(p -> p.equals(detailPiNo));
if (!pinoMatch) {
throw new ServiceException("批次号不匹配!当前库位批次:" + piNos + ",其他入库批次:" + detailPiNo);

Loading…
Cancel
Save