Merge remote-tracking branch 'origin/test' into dev
# Conflicts: # scripts/admin-test-env-modules/inbound-fees-contract.test.mjs
This commit is contained in:
+1
@@ -48,6 +48,7 @@ public record ContainerInboundPlanPreviewResponse(
|
||||
String destinationWarehouseId,
|
||||
String destinationWarehouseCode,
|
||||
String destinationWarehouseName,
|
||||
String fbaWarehouseCode,
|
||||
int packageCount,
|
||||
BigDecimal volumeCbm,
|
||||
Integer suggestedPalletCount,
|
||||
|
||||
+1
-1
@@ -210,7 +210,7 @@ public class ContainerInboundPlanConversionCoordinator {
|
||||
for (int localSequence = 1; localSequence <= order.suggestedPalletCount(); localSequence++) {
|
||||
items.add(new PreparedItem(order.customerId(), Long.parseLong(order.orderId()), planId, planNo,
|
||||
localSequence, ++globalSequence, "CIP:" + generationId + ":" + globalSequence,
|
||||
"FBA".equals(order.destinationType()) ? order.destinationWarehouseCode() : null));
|
||||
trimToNull(order.fbaWarehouseCode())));
|
||||
}
|
||||
}
|
||||
Preparation preparation = new Preparation(warehouseId, List.copyOf(items));
|
||||
|
||||
+12
-5
@@ -224,7 +224,7 @@ public class InboundPlanService {
|
||||
if (warehouseId == null || !Objects.equals(warehouseId, trimToNull(row.overseasWarehouseId()))) {
|
||||
blockers.add("RECEIVING_WAREHOUSE_INCONSISTENT");
|
||||
}
|
||||
boolean fba = "FBA".equals(destinationType(row));
|
||||
boolean fba = isFbaDestination(row);
|
||||
if (fba ? trimToNull(row.fbaWarehouseCode()) == null
|
||||
: row.destinationCount() != 1 || trimToNull(row.destinationWarehouseId()) == null
|
||||
&& trimToNull(row.destinationWarehouseCode()) == null) blockers.add("DESTINATION_NOT_READY");
|
||||
@@ -234,13 +234,14 @@ public class InboundPlanService {
|
||||
Integer suggested = suggestedPalletCount(row, blockers);
|
||||
if (!planned && (suggested == null || suggested <= 0)) blockers.add("PALLET_COUNT_NOT_READY");
|
||||
String destinationType = destinationType(row);
|
||||
String destinationCode = "FBA".equals(destinationType) && trimToNull(row.fbaWarehouseCode()) != null
|
||||
String fbaWarehouseCode = isFbaDestination(row) ? trimToNull(row.fbaWarehouseCode()) : null;
|
||||
String destinationCode = fbaWarehouseCode != null
|
||||
? row.fbaWarehouseCode().trim() : row.destinationWarehouseCode();
|
||||
String readiness = planned ? "PLANNED" : blockers.isEmpty() ? "READY" : "BLOCKED";
|
||||
return new ContainerInboundPlanPreviewResponse.Order(row.customerId(), row.customerName(),
|
||||
String.valueOf(row.orderId()), trimToNull(row.orderNo()) == null ? row.sourceOrderNo() : row.orderNo(),
|
||||
row.inboundCode(), row.orderType(), destinationType, row.destinationWarehouseId(),
|
||||
destinationCode, row.destinationWarehouseName(), row.packageCount(), row.volumeCbm(),
|
||||
destinationCode, row.destinationWarehouseName(), fbaWarehouseCode, row.packageCount(), row.volumeCbm(),
|
||||
suggested, row.plannedPalletCount(), row.planNo(), row.planStatus(), row.version(), readiness,
|
||||
List.copyOf(blockers));
|
||||
}
|
||||
@@ -258,7 +259,7 @@ public class InboundPlanService {
|
||||
|| row.packageCount() > 0 && row.volumeCbm().signum() == 0) return null;
|
||||
try {
|
||||
return PalletAllocator.allocate(List.of(new PalletAllocator.LineInput(row.orderId(),
|
||||
nullSafe(row.destinationWarehouseId()) + "|" + nullSafe("FBA".equals(destinationType(row))
|
||||
nullSafe(row.destinationWarehouseId()) + "|" + nullSafe(isFbaDestination(row)
|
||||
? row.fbaWarehouseCode() : row.destinationWarehouseCode()),
|
||||
row.volumeCbm(), row.packageCount(), row.recommendedPalletCount()))).pallets().size();
|
||||
} catch (IllegalArgumentException exception) {
|
||||
@@ -268,10 +269,16 @@ public class InboundPlanService {
|
||||
|
||||
private static String destinationType(InboundPlanOrderMapper.ContainerPreviewOrderRow row) {
|
||||
if ("ONE_CLICK_DROPSHIP".equals(row.orderType())) return "ONE_CLICK_DROPSHIP";
|
||||
if ("FBA".equals(row.destinationType()) || trimToNull(row.fbaWarehouseCode()) != null) return "FBA";
|
||||
if (isFbaDestination(row)) return "FBA";
|
||||
return "PRIVATE_ADDRESS";
|
||||
}
|
||||
|
||||
private static boolean isFbaDestination(InboundPlanOrderMapper.ContainerPreviewOrderRow row) {
|
||||
String explicit = trimToNull(row.destinationType());
|
||||
if (explicit != null) return "FBA".equalsIgnoreCase(explicit);
|
||||
return trimToNull(row.fbaWarehouseCode()) != null;
|
||||
}
|
||||
|
||||
private static int typeRank(String type) {
|
||||
return switch (type) { case "FBA" -> 0; case "ONE_CLICK_DROPSHIP" -> 1; default -> 2; };
|
||||
}
|
||||
|
||||
+2
-1
@@ -247,7 +247,8 @@ public class LoadingCompletedConsumer {
|
||||
order.setOverseasWarehouseCode(DEFAULT_RECEIVING_WAREHOUSE_CODE);
|
||||
order.setOverseasWarehouseName(DEFAULT_RECEIVING_WAREHOUSE_NAME);
|
||||
order.setReceivingWarehouseVersion(0);
|
||||
order.setFbaWarehouseCode(source.destinationWarehouseCode()); order.setContainerNo(containerNo);
|
||||
order.setFbaWarehouseCode("FBA".equals(destinationType) ? source.destinationWarehouseCode() : null);
|
||||
order.setContainerNo(containerNo);
|
||||
order.setContainerStatus("待转柜"); order.setAbnormal(false); order.setDetained(false);
|
||||
order.setPackageCount(source.packageCount());
|
||||
order.setPalletCount("ONE_CLICK_DROPSHIP".equals(orderType)
|
||||
|
||||
Reference in New Issue
Block a user