From 831dca6a550341e5b003a05e1a8da7d2ce1dab39 Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期一, 09 六月 2025 15:31:01 +0800
Subject: [PATCH] #
---
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/OutStockServiceImpl.java | 46 ++++++++++++++++++++++++++++++++--------------
1 files changed, 32 insertions(+), 14 deletions(-)
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/OutStockServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/OutStockServiceImpl.java
index dbe8343..a1fb137 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/OutStockServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/OutStockServiceImpl.java
@@ -411,18 +411,14 @@
throw new CoolException("鏈壘鍒板綋鍓嶇瓥鐣�");
}
List<OrderOutItemDto> locItems = null;
- if (WaveRuleType.Efficiency_First.type.equals(waveRule.getType())) {
- locItems = efficiencyFirst(param.getOrderId());
- } else if (WaveRuleType.First_In_First_Out.type.equals(waveRule.getType())) {
-
- }
+ locItems = getOutOrderList(param.getOrderId(), waveRule);
return R.ok(locItems);
}
private List<LocItem> getEfficiencyFirstItemList(AsnOrderItem asnOrderItem){
- QueryWrapper<LocItem> locItemQueryWrapper = new QueryWrapper<>();
- locItemQueryWrapper.eq("matnr_code", asnOrderItem.getMatnrCode());
- locItemQueryWrapper.eq("batch", asnOrderItem.getSplrBatch());
+ LambdaQueryWrapper<LocItem> locItemQueryWrapper = new LambdaQueryWrapper<>();
+ locItemQueryWrapper.eq(LocItem::getMatnrCode, asnOrderItem.getMatnrCode());
+ locItemQueryWrapper.eq(LocItem::getBatch, asnOrderItem.getSplrBatch());
String applySql = String.format(
"EXISTS (SELECT 1 FROM man_loc ml " +
"WHERE ml.use_status = '%s'" +
@@ -432,18 +428,34 @@
);
locItemQueryWrapper.apply(applySql);
List<LocItem> locItems = locItemService.list(locItemQueryWrapper);
- locItems.sort((s1,s2)-> LocUtils.isShallowLoc(s1.getLocCode())?-1:0);
+ locItems.sort(Comparator
+ .comparing((LocItem item) -> !LocUtils.isShallowLoc(item.getLocCode()))
+ );
return locItems;
}
- private List<OrderOutItemDto> efficiencyFirst(Long orderId){
+ private List<LocItem> getFirstInFirstOutItemList(AsnOrderItem asnOrderItem){
+ LambdaQueryWrapper<LocItem> locItemQueryWrapper = new LambdaQueryWrapper<>();
+ locItemQueryWrapper.eq(LocItem::getMatnrCode, asnOrderItem.getMatnrCode());
+ locItemQueryWrapper.eq(LocItem::getBatch, asnOrderItem.getSplrBatch());
+ locItemQueryWrapper.orderByAsc(LocItem::getCreateTime);
+ String applySql = String.format(
+ "EXISTS (SELECT 1 FROM man_loc ml " +
+ "WHERE ml.use_status = '%s'" +
+ "AND ml.id = man_loc_item.loc_id " +
+ ")",
+ LocStsType.LOC_STS_TYPE_F.type
+ );
+ locItemQueryWrapper.apply(applySql);
+ List<LocItem> locItems = locItemService.list(locItemQueryWrapper);
+ return locItems;
+ }
+
+ private List<OrderOutItemDto> getOutOrderList(Long orderId,WaveRule waveRule){
List<AsnOrderItem> asnOrderItems = asnOrderItemService.list(new LambdaQueryWrapper<AsnOrderItem>()
.eq(AsnOrderItem::getAsnId, orderId)
);
-
List<OrderOutItemDto> list = new ArrayList<>();
-
- Set<String> exist = new HashSet<>();
Set<ExistDto> existDtos = new HashSet<>();
for (AsnOrderItem asnOrderItem : asnOrderItems) {
@@ -454,7 +466,13 @@
continue;
}
List<LocItem> locItems = null;
- locItems = getEfficiencyFirstItemList(asnOrderItem);
+ if (WaveRuleType.Efficiency_First.type.equals(waveRule.getType())) {
+ locItems = getEfficiencyFirstItemList(asnOrderItem);
+ } else if (WaveRuleType.First_In_First_Out.type.equals(waveRule.getType())) {
+ locItems = getFirstInFirstOutItemList(asnOrderItem);
+ }else {
+ locItems = getFirstInFirstOutItemList(asnOrderItem);
+ }
for (LocItem locItem : locItems) {
Loc loc = locService.getById(locItem.getLocId());
List<LocItem> itemList = locItemService.list(new LambdaQueryWrapper<LocItem>().eq(LocItem::getLocCode, locItem.getLocCode()));
--
Gitblit v1.9.1