提交
This commit is contained in:
+9
-2
@@ -34,6 +34,8 @@ public final class PalletOperationRequests {
|
||||
@NotEmpty @Size(max = 20) List<@Valid TargetMove> targets,
|
||||
@Size(max = 500) String reason) { }
|
||||
|
||||
public record MeasuredCartonBinding(@NotBlank @Size(max=255) String cartonMark,
|
||||
@NotBlank @Size(max=255) String sourceCartonMark) {}
|
||||
/** source为空时表示退货箱没有来源托盘,现场仅扫描箱唛后绑定目标托盘;actualSource为现场确认的原入仓库存行。 */
|
||||
public record RelabelDisassemble(@NotBlank @Size(max = 128) String idempotencyKey,
|
||||
@NotBlank @Size(max = 64) String relabelNo,
|
||||
@@ -41,10 +43,15 @@ public final class PalletOperationRequests {
|
||||
@Valid PalletExpectation target,
|
||||
@NotEmpty @Size(max = 500) List<@NotBlank @Size(max = 255) String> cartonMarks,
|
||||
@Size(max = 500) String reason,
|
||||
@Valid MoveLine actualSource) {
|
||||
@Valid MoveLine actualSource,
|
||||
@Size(max=500) List<@Valid MeasuredCartonBinding> measuredCartons) {
|
||||
public RelabelDisassemble(String idempotencyKey, String relabelNo, PalletExpectation source,
|
||||
PalletExpectation target, List<String> cartonMarks, String reason, MoveLine actualSource) {
|
||||
this(idempotencyKey, relabelNo, source, target, cartonMarks, reason, actualSource, null);
|
||||
}
|
||||
public RelabelDisassemble(String idempotencyKey, String relabelNo, PalletExpectation source,
|
||||
PalletExpectation target, List<String> cartonMarks, String reason) {
|
||||
this(idempotencyKey, relabelNo, source, target, cartonMarks, reason, null);
|
||||
this(idempotencyKey, relabelNo, source, target, cartonMarks, reason, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+14
-3
@@ -68,6 +68,7 @@ public class PdaPalletOperationService {
|
||||
@Resource private RelabelApplicationMapper relabelApplications;
|
||||
@Resource private RelabelItemMapper relabelItems;
|
||||
@Resource private RelabelPalletMutationService relabelPalletMutations;
|
||||
@Resource private com.baiyue.lastleg.relabel.service.RelabelCartonMeasurementService cartonMeasurements;
|
||||
@Resource private ReturnInventoryCartonMapper returnCartons;
|
||||
@Resource private ReturnInventoryCartonItemMapper returnCartonItems;
|
||||
@Resource private ReturnInventoryBalanceMapper returnBalances;
|
||||
@@ -307,7 +308,7 @@ public class PdaPalletOperationService {
|
||||
Set<String> bound = boundRelabelMarks(application);
|
||||
if (!marks.stream().allMatch(bound::contains)) {
|
||||
if (marks.stream().anyMatch(bound::contains)) throw conflict("本批包含已绑定箱唛,请刷新后重试");
|
||||
recordRelabelBinding(identity, new RelabelMutation(application, byPosition, Map.of()), retained);
|
||||
recordRelabelBinding(identity, new RelabelMutation(application, byPosition, Map.of(), request.measuredCartons()), retained);
|
||||
}
|
||||
var result = new PalletOperationResponses.Operation(IdWorker.getId(), "RELABEL_PALLET_DISASSEMBLE", request.idempotencyKey(),
|
||||
"COMPLETED", false, LocalDateTime.now(), List.of(content(identity.overseasWarehouseId(), source)));
|
||||
@@ -351,7 +352,7 @@ public class PdaPalletOperationService {
|
||||
requireRelabelDestination(identity.overseasWarehouseId(), selected, target);
|
||||
Plan base = plan(identity.overseasWarehouseId(), pallets, moves, Set.of(target.palletId()), false);
|
||||
Plan relabelPlan = new Plan(base.pallets(), base.moves(), base.changes(),
|
||||
new RelabelMutation(application, itemsByPosition, actual == null ? Map.of() : anchors));
|
||||
new RelabelMutation(application, itemsByPosition, actual == null ? Map.of() : anchors, request.measuredCartons()));
|
||||
String reason = "换标拆托" + (request.reason() == null || request.reason().isBlank()
|
||||
? "" : ":" + request.reason().trim());
|
||||
return execute(identity, "RELABEL_PALLET_DISASSEMBLE", request.idempotencyKey(), request,
|
||||
@@ -840,7 +841,12 @@ public class PdaPalletOperationService {
|
||||
record.setFromStatus(task.getStatus()); record.setToStatus(task.getStatus());
|
||||
record.setOperatorKey(identity.operatorKey()); record.setOperatorName(identity.operatorName());
|
||||
record.setCreatedAt(LocalDateTime.now());
|
||||
var measured = cartonMeasurements.prepare(app,
|
||||
mutation.itemsByPosition().values().stream().flatMap(List::stream).toList(),
|
||||
mutation.itemsByPosition().keySet().stream().map(positions::selectById).filter(Objects::nonNull).findFirst().orElseThrow().getPalletId(),
|
||||
targets.values().iterator().next().getPalletId(), targets.values().iterator().next().getPalletNo(), mutation.measuredCartons());
|
||||
record.setDetailJson(write(Map.of("round", Objects.toString(task.getReviewedAt(), "INITIAL"),
|
||||
"measuredCartons", measured,
|
||||
"cartonMarks", mutation.itemsByPosition().values().stream().flatMap(List::stream).map(RelabelItem::getCartonMark).toList(),
|
||||
"targetPallets", targets.values().stream().map(InventoryPosition::getPalletNo).distinct().toList(),
|
||||
"sourcePallets", mutation.itemsByPosition().keySet().stream().map(positions::selectById)
|
||||
@@ -1122,6 +1128,11 @@ public class PdaPalletOperationService {
|
||||
RelabelMutation relabelMutation) { }
|
||||
private record RelabelMutation(RelabelApplication application,
|
||||
Map<Long, List<RelabelItem>> itemsByPosition,
|
||||
Map<Long, InventoryPosition> anchors) { }
|
||||
Map<Long, InventoryPosition> anchors,
|
||||
List<com.baiyue.lastleg.palletops.dto.PalletOperationRequests.MeasuredCartonBinding> measuredCartons) {
|
||||
RelabelMutation(RelabelApplication application, Map<Long,List<RelabelItem>> itemsByPosition, Map<Long,InventoryPosition> anchors) {
|
||||
this(application,itemsByPosition,anchors,null);
|
||||
}
|
||||
}
|
||||
private enum InventoryBucket { AVAILABLE, HOLD }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user