fix(firstleg): sequence child inbound codes
This commit is contained in:
@@ -165,16 +165,18 @@ public class PdaPickSettlementService {
|
||||
long remainderChildId = childPackageCount > 0 ? IdWorker.getId() : 0L;
|
||||
long batchId = IdWorker.getId();
|
||||
String idempotencyKey = "pda-task-" + taskId;
|
||||
String childCode = childInboundCode(parent.inboundCode(), remainderChildId == 0 ? loadedChildId : remainderChildId);
|
||||
int parentVersion = root.version() == null ? 0 : root.version();
|
||||
int sequence = splits.nextSplitSequence(parent.tenantId(), rootInboundId);
|
||||
String loadedChildCode = childInboundCode(root.inboundCode(), sequence);
|
||||
String remainderChildCode = childPackageCount > 0
|
||||
? childInboundCode(root.inboundCode(), sequence + 1) : null;
|
||||
requireAffected(splits.cloneChildWithPurpose(parent.tenantId(), rootInboundId, rootInboundId, loadedChildId,
|
||||
orderSplit.loadedChild().orderId(), orderSplit.loadedChild().orderNo(),
|
||||
childInboundCode(parent.inboundCode(), loadedChildId), pickedPackageCount, sequence, "LOADED", operatorId, operatorName), "实装子入库单");
|
||||
loadedChildCode, pickedPackageCount, sequence, "LOADED", operatorId, operatorName), "实装子入库单");
|
||||
if (remainderChildId != 0L) {
|
||||
requireAffected(splits.cloneChildWithPurpose(parent.tenantId(), rootInboundId, rootInboundId, remainderChildId,
|
||||
orderSplit.remainderChild().orderId(), orderSplit.remainderChild().orderNo(),
|
||||
childCode, childPackageCount, sequence + 1, "REMAINDER", operatorId, operatorName), "余量子入库单");
|
||||
remainderChildCode, childPackageCount, sequence + 1, "REMAINDER", operatorId, operatorName), "余量子入库单");
|
||||
}
|
||||
requireAffected(splits.insertBatchWithChildren(batchId, parent.tenantId(), rootInboundId, operationId, parentInboundId,
|
||||
idempotencyKey, parentVersion, parentAvailable, loadedChildId, remainderChildId == 0L ? null : remainderChildId,
|
||||
@@ -242,7 +244,9 @@ public class PdaPickSettlementService {
|
||||
allocations.markTransferred(parent.tenantId(), parentInboundId, confirmedAllocations,
|
||||
releasedReservationIds);
|
||||
allocations.markReleased(parent.tenantId(), parentInboundId, releasedReservationIds);
|
||||
settleWarehouseResources(parentInboundId, remainderChildId, childCode, taskId, operatorId, operatorName,
|
||||
settleWarehouseResources(parentInboundId, remainderChildId,
|
||||
remainderChildCode == null ? loadedChildCode : remainderChildCode,
|
||||
taskId, operatorId, operatorName,
|
||||
warehouseId, parentAvailable, childPackageCount, releasedReservationIds, transferItems);
|
||||
return true;
|
||||
}
|
||||
@@ -442,12 +446,15 @@ public class PdaPickSettlementService {
|
||||
return expectedByLocation.equals(actualByLocation);
|
||||
}
|
||||
|
||||
private static String childInboundCode(String parentCode, long childId) {
|
||||
String prefix = parentCode == null ? "INBOUND" : parentCode.trim();
|
||||
static String childInboundCode(String rootInboundCode, int splitSequence) {
|
||||
if (splitSequence <= 0) {
|
||||
throw conflict("子入库单拆分序号不合法");
|
||||
}
|
||||
String prefix = rootInboundCode == null ? "INBOUND" : rootInboundCode.trim();
|
||||
if (prefix.isEmpty()) {
|
||||
prefix = "INBOUND";
|
||||
}
|
||||
String suffix = "-S" + Long.toUnsignedString(childId).substring(0, 6);
|
||||
String suffix = "-" + splitSequence;
|
||||
return prefix.substring(0, Math.min(prefix.length(), 40 - suffix.length())) + suffix;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user