feat: finalize dropship pallet print documents

This commit is contained in:
2026-09-14 17:52:01 +08:00
parent b3d74c5441
commit 3910b8fcce
15 changed files with 34 additions and 50 deletions
@@ -55,7 +55,6 @@ public interface PrintPdfClient {
String downloadFileName, List<DropshipPalletDocument> documents) {}
record DropshipPalletDocument(String palletNo, String destinationWarehouse,
int palletSequence, int totalPallets,
String barcodeContent,
List<DropshipPalletInboundRow> inboundRows,
List<DropshipPalletSkuRow> skuRows) {}
@@ -150,6 +150,17 @@ public class PlatformDropshipPalletizationController {
return ApiResponse.success(service.inboundPallets(accountId, inboundId));
}
@GetMapping("/inbound-orders/{inboundId}/pallets/print")
@PreAuthorize("hasAuthority('platform:firstleg:inbound:list')")
public ResponseEntity<byte[]> printInboundPallets(@AuthenticationPrincipal AuthenticatedUser user,
@PathVariable @Positive long inboundId,
@RequestParam @Positive long accountId,
@RequestHeader(value = "X-Request-Id", required = false) String requestId) {
FirstlegScopeGuard.platform(user, accountId);
return printService.generateDropshipPallets(
service.inboundPallets(accountId, inboundId), service.inboundCode(accountId, inboundId), requestId);
}
@GetMapping("/inbound-orders/{inboundId}/pallets/{palletId}/print")
@PreAuthorize("hasAuthority('platform:firstleg:inbound:list')")
public ResponseEntity<byte[]> printPallet(@AuthenticationPrincipal AuthenticatedUser user,
@@ -254,15 +254,6 @@ public interface DropshipPalletizationMapper {
""")
List<PrintSkuRow> printSkuRows(@Param("palletId") long palletId);
@Select("""
SELECT (SELECT COUNT(*) FROM fl_dropship_pallet listed
WHERE listed.task_id=target.task_id AND listed.id<=target.id) sequence_no,
(SELECT COUNT(*) FROM fl_dropship_pallet listed
WHERE listed.task_id=target.task_id) total
FROM fl_dropship_pallet target
WHERE target.id=#{palletId}
""")
PalletPosition palletPosition(@Param("palletId") long palletId);
@Select("""
SELECT p.id pallet_id,p.pallet_no,'SEALED_PALLET' unit_type,TRUE indivisible,COUNT(DISTINCT c.id) carton_count,
(SELECT COUNT(DISTINCT sku.sku_code) FROM fl_dropship_pallet_carton pc
@@ -306,6 +297,5 @@ public interface DropshipPalletizationMapper {
record PalletMetrics(BigDecimal weightKg,BigDecimal volumeCbm) {}
@Getter @Setter class PrintInboundRow { private Long tenantId,inboundId; private String inboundCode,destinationWarehouse; private Integer cartonCount,itemQuantity; }
@Getter @Setter class PrintSkuRow { private String skuCode; private Integer cartonCount,itemQuantity,minUnitsPerCarton,maxUnitsPerCarton; }
record PalletPosition(int sequenceNo,int total) {}
@Getter @Setter class PalletLine { private Long palletId,tenantId,accountId,inboundId,orderId,warehouseId,destinationWarehouseId,inboundDetailId; private String palletNo,palletStatus,orderNo,inboundCode,channelCode,channelName,destinationWarehouseCode,destinationWarehouseName,customerName,skuCode,cargoName; private Integer cartonCount,actualSkuQuantity; private BigDecimal unitGrossWeightKg,unitNetWeightKg,unitVolumeCbm; }
}
@@ -172,12 +172,8 @@ public class InboundCartonLabelPrintService {
.stream().map(row -> new PrintPdfClient.DropshipPalletSkuRow(
row.getSkuCode(), number(row.getCartonCount()), number(row.getItemQuantity()),
unitsPerCarton(row))).toList();
DropshipPalletizationMapper.PalletPosition position =
palletizationMapper.palletPosition(pallet.palletId());
return new PrintPdfClient.DropshipPalletDocument(
pallet.palletNo(), destinationWarehouse,
position == null ? 1 : position.sequenceNo(), position == null ? 1 : position.total(),
pallet.palletNo(), inboundRows, skuRows);
pallet.palletNo(), destinationWarehouse, pallet.palletNo(), inboundRows, skuRows);
}
private String unitsPerCarton(DropshipPalletizationMapper.PrintSkuRow row) {