This commit is contained in:
2026-09-09 15:14:15 +08:00
parent 90a2eda86a
commit 1ee32b7a6f
9 changed files with 30 additions and 9 deletions
@@ -37,7 +37,7 @@ public class DeliveryTransferController {
@PreAuthorize("hasAuthority('" + OverseasPermissions.OUTBOUND_CREATE + "')") @PreAuthorize("hasAuthority('" + OverseasPermissions.OUTBOUND_CREATE + "')")
@Operation(summary = "Create one-click dropship outbound and push a PDA picking task") @Operation(summary = "Create one-click dropship outbound and push a PDA picking task")
public ApiResponse<DeliveryResponses.PdaTask> createOneClick( public ApiResponse<DeliveryResponses.PdaTask> createOneClick(
@AuthenticationPrincipal AuthenticatedUser user, @RequestParam String customerId, @AuthenticationPrincipal AuthenticatedUser user, @RequestParam(required = false) String customerId,
@Valid @RequestBody DeliveryRequests.OneClickOutbound request) { @Valid @RequestBody DeliveryRequests.OneClickOutbound request) {
return ApiResponse.success(service.createOneClick(requiredCustomer(user, customerId), operator(user), request)); return ApiResponse.success(service.createOneClick(requiredCustomer(user, customerId), operator(user), request));
} }
@@ -48,7 +48,8 @@ public class DeliveryTransferController {
public ApiResponse<java.util.List<DeliveryResponses.OneClickCandidate>> oneClickCandidates( public ApiResponse<java.util.List<DeliveryResponses.OneClickCandidate>> oneClickCandidates(
@AuthenticationPrincipal AuthenticatedUser user, @RequestParam String customerId, @AuthenticationPrincipal AuthenticatedUser user, @RequestParam String customerId,
@RequestParam(required = false) String warehouseId) { @RequestParam(required = false) String warehouseId) {
return ApiResponse.success(service.oneClickCandidates(requiredCustomer(user, customerId), warehouseId)); requirePlatform(user);
return ApiResponse.success(service.oneClickCandidates(customerId, warehouseId));
} }
@GetMapping("/outbound-orders/return/candidates") @GetMapping("/outbound-orders/return/candidates")
@@ -53,7 +53,7 @@ public final class DeliveryRequests {
String documentNo, String lxCode, String warehouseId, String status, String documentNo, String lxCode, String warehouseId, String status,
String dispatchNo, String waybillNo, String vehiclePlate, String dispatchNo, String waybillNo, String vehiclePlate,
String driverName, String deliveryMethod, String driverName, String deliveryMethod,
LocalDateTime plannedFrom, LocalDateTime plannedTo) { LocalDateTime plannedFrom, LocalDateTime plannedTo, String outboundType) {
public Query { if (page == 0) page = 1; if (size == 0) size = 20; } public Query { if (page == 0) page = 1; if (size == 0) size = 20; }
} }
@@ -46,7 +46,7 @@ public final class DeliveryResponses {
String destinationWarehouseCode, String destinationWarehouseName, String destinationWarehouseCode, String destinationWarehouseName,
String skuCode, int packageCount, int pickedPackageCount, String status) {} String skuCode, int packageCount, int pickedPackageCount, String status) {}
public record OutboundDetail(OutboundRow outbound, DeliveryRow delivery, List<OutboundPalletRow> pallets) {} public record OutboundDetail(OutboundRow outbound, DeliveryRow delivery, List<OutboundPalletRow> pallets) {}
public record OneClickCandidate(Long inventoryPositionId, String overseasWarehouseId, public record OneClickCandidate(Long inventoryPositionId, String orderNo, String customerId, String customerName, String overseasWarehouseId,
String overseasWarehouseName, String palletNo, String inboundCode, String overseasWarehouseName, String palletNo, String inboundCode,
String skuCode, String productName, long availablePackages) {} String skuCode, String productName, long availablePackages) {}
public record ReturnOutboundCandidate(String returnNo, String overseasWarehouseId, public record ReturnOutboundCandidate(String returnNo, String overseasWarehouseId,
@@ -257,7 +257,7 @@ public class DeliveryTransferService {
} }
public List<DeliveryResponses.OneClickCandidate> oneClickCandidates(String customerId, String warehouseId) { public List<DeliveryResponses.OneClickCandidate> oneClickCandidates(String customerId, String warehouseId) {
return dropshipProfiles.listOutboundCandidates(required(customerId, "Customer is required"), return dropshipProfiles.listOutboundCandidates(customerId,
StringUtils.hasText(warehouseId) ? warehouseId.trim() : null).stream() StringUtils.hasText(warehouseId) ? warehouseId.trim() : null).stream()
.map(this::oneClickCandidate).toList(); .map(this::oneClickCandidate).toList();
} }
@@ -604,6 +604,7 @@ public class DeliveryTransferService {
.like(StringUtils.hasText(query.lxCode()), OutboundOrder::getLxCodes, query.lxCode()) .like(StringUtils.hasText(query.lxCode()), OutboundOrder::getLxCodes, query.lxCode())
.eq(StringUtils.hasText(query.warehouseId()), OutboundOrder::getOverseasWarehouseId, query.warehouseId()) .eq(StringUtils.hasText(query.warehouseId()), OutboundOrder::getOverseasWarehouseId, query.warehouseId())
.eq(StringUtils.hasText(query.status()), OutboundOrder::getStatus, query.status()) .eq(StringUtils.hasText(query.status()), OutboundOrder::getStatus, query.status())
.eq(StringUtils.hasText(query.outboundType()), OutboundOrder::getOutboundType, query.outboundType())
.orderByDesc(OutboundOrder::getCreatedAt)); .orderByDesc(OutboundOrder::getCreatedAt));
return page(page, page.getRecords().stream().map(this::outboundRow).toList()); return page(page, page.getRecords().stream().map(this::outboundRow).toList());
} }
@@ -696,7 +697,7 @@ public class DeliveryTransferService {
item.getSkuCode(), value(item.getPackageCount()), value(item.getPickedPackageCount()), item.getStatus()); item.getSkuCode(), value(item.getPackageCount()), value(item.getPickedPackageCount()), item.getStatus());
} }
private DeliveryResponses.OneClickCandidate oneClickCandidate(DropshipOutboundCandidate candidate) { private DeliveryResponses.OneClickCandidate oneClickCandidate(DropshipOutboundCandidate candidate) {
return new DeliveryResponses.OneClickCandidate(candidate.getInventoryPositionId(), return new DeliveryResponses.OneClickCandidate(candidate.getInventoryPositionId(), candidate.getOrderNo(), candidate.getCustomerId(), candidate.getCustomerName(),
candidate.getOverseasWarehouseId(), candidate.getOverseasWarehouseName(), candidate.getPalletNo(), candidate.getOverseasWarehouseId(), candidate.getOverseasWarehouseName(), candidate.getPalletNo(),
candidate.getInboundCode(), candidate.getSkuCode(), candidate.getProductName(), candidate.getInboundCode(), candidate.getSkuCode(), candidate.getProductName(),
value(candidate.getAvailablePackages())); value(candidate.getAvailablePackages()));
@@ -10,7 +10,7 @@ import java.util.List;
public interface DropshipOrderProfileMapper extends BaseMapper<DropshipOrderProfile> { public interface DropshipOrderProfileMapper extends BaseMapper<DropshipOrderProfile> {
String OUTBOUND_CANDIDATE_SELECT = "SELECT pos.id inventory_position_id,p.id profile_id," + String OUTBOUND_CANDIDATE_SELECT = "SELECT pos.id inventory_position_id,p.id profile_id," +
"p.warehouse_pallet_id,pos.overseas_warehouse_id,b.overseas_warehouse_name," + "p.warehouse_pallet_id,pos.overseas_warehouse_id,b.overseas_warehouse_name," +
"p.pallet_no,b.inbound_code,s.sku_code,s.product_name," + "p.pallet_no,b.inbound_code,o.order_no,o.customer_id,o.customer_name,s.sku_code,s.product_name," +
"LEAST(pos.available_packages,s.package_count,(SELECT COUNT(*) FROM ll_dropship_carton c " + "LEAST(pos.available_packages,s.package_count,(SELECT COUNT(*) FROM ll_dropship_carton c " +
"WHERE c.customer_id=p.customer_id AND c.profile_id=p.id AND c.sku_code=s.sku_code " + "WHERE c.customer_id=p.customer_id AND c.profile_id=p.id AND c.sku_code=s.sku_code " +
"AND c.status='AVAILABLE')) available_packages FROM ll_dropship_order_profile p " + "AND c.status='AVAILABLE')) available_packages FROM ll_dropship_order_profile p " +
@@ -21,7 +21,7 @@ public interface DropshipOrderProfileMapper extends BaseMapper<DropshipOrderProf
"JOIN ll_inventory_balance b ON b.id=pos.balance_id AND b.customer_id=pos.customer_id " + "JOIN ll_inventory_balance b ON b.id=pos.balance_id AND b.customer_id=pos.customer_id " +
"JOIN ll_dropship_sku_inventory s ON s.customer_id=p.customer_id AND s.order_id=p.order_id " + "JOIN ll_dropship_sku_inventory s ON s.customer_id=p.customer_id AND s.order_id=p.order_id " +
"AND s.profile_id=p.id "; "AND s.profile_id=p.id ";
String OUTBOUND_CANDIDATE_WHERE = "WHERE p.customer_id=#{customerId} AND p.status='ACTIVE' " + String OUTBOUND_CANDIDATE_WHERE = "WHERE (#{customerId} IS NULL OR #{customerId}='' OR p.customer_id=#{customerId}) AND p.status='ACTIVE' " +
"AND pos.status='OCCUPIED' AND pos.available_packages>0 AND s.package_count>0 " + "AND pos.status='OCCUPIED' AND pos.available_packages>0 AND s.package_count>0 " +
"AND EXISTS (SELECT 1 FROM ll_dropship_carton c WHERE c.customer_id=p.customer_id " + "AND EXISTS (SELECT 1 FROM ll_dropship_carton c WHERE c.customer_id=p.customer_id " +
"AND c.profile_id=p.id AND c.sku_code=s.sku_code AND c.status='AVAILABLE') " + "AND c.profile_id=p.id AND c.sku_code=s.sku_code AND c.status='AVAILABLE') " +
@@ -12,6 +12,9 @@ public class DropshipOutboundCandidate {
private String overseasWarehouseName; private String overseasWarehouseName;
private String palletNo; private String palletNo;
private String inboundCode; private String inboundCode;
private String orderNo;
private String customerId;
private String customerName;
private String skuCode; private String skuCode;
private String productName; private String productName;
private Long availablePackages; private Long availablePackages;
@@ -34,7 +34,7 @@ class MerchantDeliveryControllerTest {
private final DeliveryTransferService service = mock(DeliveryTransferService.class); private final DeliveryTransferService service = mock(DeliveryTransferService.class);
private final MerchantDeliveryController controller = controller(); private final MerchantDeliveryController controller = controller();
private final DeliveryRequests.Query query = new DeliveryRequests.Query( private final DeliveryRequests.Query query = new DeliveryRequests.Query(
1, 20, null, null, null, null, null, null, null, null, null, null, null); 1, 20, null, null, null, null, null, null, null, null, null, null, null, null);
@Test @Test
void fixedRoutesUseIndependentListAndCreatePermissionsWithoutCustomerParameter() throws Exception { void fixedRoutesUseIndependentListAndCreatePermissionsWithoutCustomerParameter() throws Exception {
@@ -0,0 +1,8 @@
-- 入仓计划与实收的一件代发来源托盘快照字段(目标库:baiyue_lastleg)
USE baiyue_lastleg;
SET @ddl = (SELECT IF(EXISTS (SELECT 1 FROM information_schema.columns WHERE table_schema=DATABASE() AND table_name='ll_inbound_plan_pallet' AND column_name='source_pallet_no'), 'SELECT 1', 'ALTER TABLE ll_inbound_plan_pallet ADD COLUMN source_pallet_no VARCHAR(128) NULL COMMENT ''一件代发不可变来源托盘号快照'' AFTER pallet_no'));
PREPARE s FROM @ddl; EXECUTE s; DEALLOCATE PREPARE s;
SET @ddl = (SELECT IF(EXISTS (SELECT 1 FROM information_schema.columns WHERE table_schema=DATABASE() AND table_name='ll_inbound_stock_receipt' AND column_name='source_pallet_no'), 'SELECT 1', 'ALTER TABLE ll_inbound_stock_receipt ADD COLUMN source_pallet_no VARCHAR(128) NULL COMMENT ''一件代发不可变来源托盘号快照'' AFTER pallet_no'));
PREPARE s FROM @ddl; EXECUTE s; DEALLOCATE PREPARE s;
+8
View File
@@ -0,0 +1,8 @@
$ErrorActionPreference = 'Stop'
. (Join-Path $PSScriptRoot 'local-env.ps1')
$env:LASTLEG_SECURITY_SERVICE_URL = 'http://127.0.0.1:9303'
$maven = 'D:\apache-maven-3.8.8\bin\mvn.cmd'
$module = Join-Path (Split-Path $PSScriptRoot -Parent) 'gateway-overseas'
& $maven -o spring-boot:run -DskipTests