fix(lastleg): preserve return relabel delivery metadata and measurements
This commit is contained in:
+9
-2
@@ -1478,10 +1478,17 @@ public class DeliveryTransferService {
|
||||
&& !Objects.equals(delivery.getDestinationWarehouseCode(), item.getDestinationWarehouseCode())) continue;
|
||||
ReturnInventoryCarton carton = returnCartons.findCustomerMark(customerId, item.getCartonMarks());
|
||||
if (carton == null) throw conflict("退货派送单来源箱记录缺失");
|
||||
for (var line : returnCartonItems.listCarton(carton.getId()))
|
||||
boolean relabelCarton = "RELABEL_OUTBOUND".equals(sourceOutbound.getOutboundType());
|
||||
boolean firstSku = true;
|
||||
// Match receipt cargo semantics: stable first SKU carries the physical box once, never per piece.
|
||||
for (var line : returnCartonItems.listCarton(carton.getId())) {
|
||||
cargo.add(new DeliveryResponses.DeliverySku(item.getInboundCode(), delivery.getCustomerName(),
|
||||
carton.getDestinationWarehouseCode(), delivery.getDeliveryAddress(), null, null,
|
||||
line.getSkuCode(), line.getProductNameZh(), 1, null, null, line.getQuantity()));
|
||||
line.getSkuCode(), line.getProductNameZh(), !relabelCarton || firstSku ? 1 : 0,
|
||||
relabelCarton && firstSku ? item.getGrossWeightKg() : null,
|
||||
relabelCarton && firstSku ? item.getVolumeCbm() : null, line.getQuantity()));
|
||||
firstSku = false;
|
||||
}
|
||||
}
|
||||
return new DeliveryResponses.DeliveryDetail(deliveryRow(delivery), cargo,
|
||||
feeSources.listForBusiness(customerId, "DELIVERY_ORDER", delivery.getId()).stream().map(this::feeRow).toList(),
|
||||
|
||||
Reference in New Issue
Block a user