fix(lastleg): retain physical carton labels from frozen relabel contributions
This commit is contained in:
+17
-1
@@ -664,7 +664,7 @@ public class DispatchAggregateService implements DispatchExecutionPort,DispatchA
|
||||
var origin=pick.dispatchItemSourceId()==null?null:origins.get(pick.dispatchItemSourceId());
|
||||
var sourceOrigin=origin==null?null:new SourceOrigin(origin.getId(),origin.getRelabelApplicationId(),origin.getRelabelItemId(),origin.getSourceInventoryBalanceId(),origin.getSourceInboundOrderId(),origin.getSourceInboundOrderNo(),origin.getSourceInboundCode(),origin.getProductQuantity()!=null || pick.productQuantity()>0?pick.productQuantity():null);
|
||||
cargo.add(new CargoLine(item.getId(),pick.customerId(),item.getCustomerName(),pick.orderId(),pick.orderNo(),source,item.getSourceStage(),pick.sourceRegion(),pick.sourceInboundId(),pick.inboundCode(),
|
||||
item.getPlanPalletId(),item.getWarehousePalletId(),item.getPalletNo(),pick.pickId(),pick.attributionId(),pick.positionId(),pick.receiptId(),pick.returnReceiptId(),pick.returnCartonId(),pick.cartonMark(),
|
||||
item.getPlanPalletId(),item.getWarehousePalletId(),item.getPalletNo(),pick.pickId(),pick.attributionId(),pick.positionId(),pick.receiptId(),pick.returnReceiptId(),pick.returnCartonId(),origin==null?pick.cartonMark():relabelCartonMarks(origin),
|
||||
"RELABEL_ORDER".equals(item.getSourceBusinessType())?item.getSourceBusinessNo():null,destination(item),pick.packages(),pick.productQuantity(),null,null,allocations,sourceOrigin));
|
||||
}
|
||||
var picked=executionReads.itemPicked(row.getId()).stream().collect(Collectors.toMap(p->p.itemId(),p->p.packages()));
|
||||
@@ -675,6 +675,22 @@ public class DispatchAggregateService implements DispatchExecutionPort,DispatchA
|
||||
read(row.getResourcesJson(),Resources.class),counts(row),reviews(row),complete,List.copyOf(cargo));
|
||||
}
|
||||
|
||||
/** 普通换标出库沿本次冻结贡献的新箱标,不从退货箱表或原箱唛生成快照。 */
|
||||
private String relabelCartonMarks(com.baiyue.lastleg.dispatch.entity.DispatchItemSource origin) {
|
||||
try {
|
||||
var facts=json.readTree(origin.getUnitFactsJson());var marks=new java.util.TreeSet<String>();
|
||||
if(!facts.isArray())throw conflict("换标冻结箱标事实缺失");
|
||||
for(var fact:facts)if("RELABELLED".equals(fact.path("result").asText())) {
|
||||
var mark=fact.path("cartonMark").asText("").trim();
|
||||
if(mark.isEmpty() || !marks.add(mark))throw conflict("换标冻结新箱标缺失或重复");
|
||||
}
|
||||
if(marks.isEmpty())throw conflict("换标冻结新箱标缺失");
|
||||
return String.join(",",marks);
|
||||
} catch(com.fasterxml.jackson.core.JsonProcessingException error) {
|
||||
throw new IllegalStateException("换标冻结箱标事实无法读取",error);
|
||||
}
|
||||
}
|
||||
|
||||
/** 共同根锁顺序固定,当前阶段资格留给原命令恢复之后。 */
|
||||
private DispatchAggregate lockPlatform(Actor actor,String number) { requirePlatform(actor);lockReviewRoot(actor,number);return required(actor,number,true); }
|
||||
/** 运输取货锁原车次,仓库派送锁其整车资源;统一先父后主单。 */
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import java.util.List;
|
||||
/** 换标域向排车提供原始组成事实,不读取排车账本或代替排车锁定库存。 */
|
||||
public interface RelabelDispatchSourcePort {
|
||||
/** 当前作业轮次的逐件成功或异常事实;未知件数保持空值。 */
|
||||
record UnitFact(Long id, String oldLabel, String newLabel, String result, Integer quantity) { }
|
||||
record UnitFact(Long id, String oldLabel, String newLabel, String result, Integer quantity, String cartonMark) { }
|
||||
|
||||
/** 原申请身份、内部作业状态、履约订单及客户确认轮次。 */
|
||||
record Application(Long applicationId, String relabelNo, String customerId,
|
||||
|
||||
+1
-1
@@ -168,7 +168,7 @@ public class RelabelDispatchSourceService implements RelabelDispatchSourcePort {
|
||||
item.getSourceInboundOrderId(), item.getSourceInboundOrderNo(), item.getSourceInboundCode(),
|
||||
notified, bound ? notified : 0, productQuantity(item, itemFacts, histories, round), basis,
|
||||
itemFacts.stream().map(f -> new UnitFact(f.getId(), f.getOldLabel(), f.getNewLabel(),
|
||||
f.getResult(), f.getQuantity())).toList()));
|
||||
f.getResult(), f.getQuantity(), "SKU_LABEL".equals(item.getOperationType()) ? f.getOldLabel() : f.getNewLabel())).toList()));
|
||||
}
|
||||
if (rows.items().isEmpty()) reasons.add(app.getRelabelNo() + ":申请明细为空");
|
||||
if (facts.stream().anyMatch(f -> rows.items().stream().noneMatch(i -> Objects.equals(i.getId(), f.getItemId()))))
|
||||
|
||||
Reference in New Issue
Block a user