贴标申请,仓储转运
This commit is contained in:
+24
-2
@@ -880,8 +880,30 @@ public class RelabelApplicationService implements WalletResultHandler {
|
||||
WarehouseTransferOrder transfer = linkedTransfer;
|
||||
if (transfer != null && "WAIT_RELABEL".equals(transfer.getStatus())) {
|
||||
// Item-level relabel destinations apply only to those cartons.
|
||||
// They must never bind the whole transfer, because its remaining
|
||||
// cartons may still require a separate destination selection.
|
||||
// They may bind the whole transfer only when every transfer carton
|
||||
// is included; a partial relabel must leave the remainder unbound.
|
||||
int relabelPackages = relabelItems.stream()
|
||||
.mapToInt(item -> Objects.requireNonNullElse(item.getNotifiedPackageCount(), 0)).sum();
|
||||
Set<String> relabelDestinations = relabelItems.stream()
|
||||
.map(RelabelItem::getDestinationFbaWarehouseCode)
|
||||
.filter(StringUtils::hasText).map(String::trim).collect(Collectors.toSet());
|
||||
// 兼容历史转运单:旧数据只保存 fbaWarehouseCode,没有 destinationType。
|
||||
// 这类单据已经有明确目的仓,应直接进入待排车,不能退回待绑定目的仓。
|
||||
if (!StringUtils.hasText(transfer.getDestinationType())
|
||||
&& StringUtils.hasText(transfer.getFbaWarehouseCode())) {
|
||||
transfer.setDestinationType("FBA");
|
||||
transfer.setDestinationWarehouseCode(transfer.getFbaWarehouseCode().trim());
|
||||
transfer.setDestinationWarehouseName(transfer.getFbaWarehouseCode().trim());
|
||||
}
|
||||
if (!StringUtils.hasText(transfer.getDestinationType())
|
||||
&& relabelPackages >= Objects.requireNonNullElse(transfer.getPackageCount(), 0)
|
||||
&& relabelDestinations.size() == 1) {
|
||||
String destination = relabelDestinations.iterator().next();
|
||||
transfer.setDestinationType("FBA");
|
||||
transfer.setDestinationWarehouseCode(destination);
|
||||
transfer.setDestinationWarehouseName(destination);
|
||||
transfer.setFbaWarehouseCode(destination);
|
||||
}
|
||||
boolean transferHasDestination = "FBA".equals(transfer.getDestinationType())
|
||||
? StringUtils.hasText(transfer.getDestinationWarehouseCode())
|
||||
: "PRIVATE".equals(transfer.getDestinationType())
|
||||
|
||||
+1
-1
@@ -109,7 +109,7 @@ class WarehouseTransferServiceTest {
|
||||
1, 20, null, null, null, null, null, null, null, null));
|
||||
|
||||
assertEquals("RL-20260923-000001", result.records().get(0).relabelNo());
|
||||
assertEquals("COMPLETED", result.records().get(0).relabelStatus());
|
||||
assertEquals("COMPLETED", result.records().get(0).relabelApplicationStatus());
|
||||
assertEquals("READY_FOR_DISPATCH", result.records().get(0).relabelFulfillmentStatus());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user