This commit is contained in:
2026-08-17 14:46:44 +08:00
parent b914bb7532
commit a34b5d5ba0
38 changed files with 249 additions and 115 deletions
@@ -14,8 +14,7 @@ public interface WarehouseSupplierClient {
ApiResponse<Snapshot> get(@RequestHeader("X-Internal-Service-Token") String token,
@PathVariable long supplierId,
@RequestParam(defaultValue = "true") boolean requireActive,
@RequestParam(required = false) String category,
@RequestParam(required = false) String scope);
@RequestParam(required = false) String category);
record Snapshot(long supplierId, String name, String category, String scope, String status) {}
record Snapshot(long supplierId, String name, String category, String status) {}
}
@@ -127,7 +127,8 @@ public final class LoadingPickDtos {
public record Task(Long id, Long loadingPlanId, Long containerBookingId, Long inboundId,
Integer inboundVersion, Integer loadingVersion, String cabinetNo,
String currentContainerNo, String taskStatus,
String currentContainerNo, String sourceType, String recordStatus,
Long mergedIntoContainerBookingId, String taskStatus,
String workflowStatus, Integer version, Assignment assignment,
Review review, List<PickItem> items) {
}
@@ -135,6 +136,7 @@ public final class LoadingPickDtos {
/** PDA 工作台只展示当前作业员可领取或已领取的进行中任务。 */
public record PendingTask(Long taskId, Long loadingPlanId, Long containerBookingId,
String cabinetNo, String currentContainerNo,
String sourceType, String recordStatus, Long mergedIntoContainerBookingId,
Long warehouseId, String warehouseName, String taskStatus,
String workflowStatus, Integer version, Integer assignmentVersion,
Integer itemCount, Integer pendingItemCount) {
@@ -49,6 +49,8 @@ public interface LoadingPickTaskMapper extends BaseMapper<LoadingPickTaskEntity>
SELECT task.id AS taskId, task.loading_plan_id AS loadingPlanId,
task.container_booking_id AS containerBookingId, task.cabinet_no AS cabinetNo,
booking.container_no AS containerNo, booking.warehouse_id AS warehouseId,
booking.source_type AS sourceType, booking.record_status AS recordStatus,
booking.merged_into_container_booking_id AS mergedIntoContainerBookingId,
booking.warehouse_name AS warehouseName, task.task_status AS taskStatus,
CASE WHEN assignment.pick_task_id IS NULL THEN 'UNASSIGNED' ELSE 'IN_PROGRESS' END AS workflowStatus,
task.version AS version, COALESCE(assignment.version, 0) AS assignmentVersion,
@@ -67,6 +69,7 @@ public interface LoadingPickTaskMapper extends BaseMapper<LoadingPickTaskEntity>
</if>
GROUP BY task.id, task.loading_plan_id, task.container_booking_id, task.cabinet_no,
booking.container_no, booking.warehouse_id,
booking.source_type, booking.record_status, booking.merged_into_container_booking_id,
booking.warehouse_name, task.task_status, task.version,
assignment.pick_task_id, assignment.version
ORDER BY task.id DESC
@@ -82,6 +85,9 @@ public interface LoadingPickTaskMapper extends BaseMapper<LoadingPickTaskEntity>
private String containerNo;
private Long containerBookingId;
private String cabinetNo;
private String sourceType;
private String recordStatus;
private Long mergedIntoContainerBookingId;
private Long warehouseId;
private String warehouseName;
private String taskStatus;
@@ -101,6 +107,12 @@ public interface LoadingPickTaskMapper extends BaseMapper<LoadingPickTaskEntity>
public void setContainerBookingId(Long value) { this.containerBookingId = value; }
public String getCabinetNo() { return cabinetNo; }
public void setCabinetNo(String value) { this.cabinetNo = value; }
public String getSourceType() { return sourceType; }
public void setSourceType(String sourceType) { this.sourceType = sourceType; }
public String getRecordStatus() { return recordStatus; }
public void setRecordStatus(String recordStatus) { this.recordStatus = recordStatus; }
public Long getMergedIntoContainerBookingId() { return mergedIntoContainerBookingId; }
public void setMergedIntoContainerBookingId(Long value) { this.mergedIntoContainerBookingId = value; }
public Long getWarehouseId() { return warehouseId; }
public void setWarehouseId(Long warehouseId) { this.warehouseId = warehouseId; }
public String getWarehouseName() { return warehouseName; }
@@ -185,6 +185,7 @@ public class LoadingPickService {
return repository.pendingTasks(operatorId, normalizedKeyword).stream()
.map(row -> new PendingTask(row.getTaskId(), row.getLoadingPlanId(), row.getContainerBookingId(),
row.getCabinetNo(), row.getContainerNo(),
row.getSourceType(), row.getRecordStatus(), row.getMergedIntoContainerBookingId(),
row.getWarehouseId(), row.getWarehouseName(), row.getTaskStatus(), row.getWorkflowStatus(),
row.getVersion(), row.getAssignmentVersion(), row.getItemCount(), row.getPendingItemCount()))
.toList();
@@ -607,6 +608,9 @@ public class LoadingPickService {
: assigned == null ? "UNASSIGNED"
: repository.allTaskItemsResolved(task.getId()) ? "AWAITING_REVIEW" : "IN_PROGRESS";
var booking = smartLoadingRepository.booking(task.getContainerBookingId());
if (booking == null || !"ACTIVE".equals(booking.getRecordStatus())) {
throw new BizException(ResultCode.NOT_FOUND, "PDA拣货任务不存在或柜次已非有效存续记录");
}
var owners = repository.inboundOwners(task.getId());
Long detailInboundId = source.isEmpty() ? null : source.get(0).getInboundId();
var owner = detailInboundId == null ? null : owners.stream()
@@ -616,7 +620,8 @@ public class LoadingPickService {
return new Task(task.getId(), task.getLoadingPlanId(), task.getContainerBookingId(),
owner == null ? null : owner.inboundId(), inbound == null ? null : inbound.version(),
inbound == null ? null : inbound.version(), task.getCabinetNo(),
booking == null ? null : booking.getContainerNo(), task.getTaskStatus(),
booking.getContainerNo(), booking.getSourceType(), booking.getRecordStatus(),
booking.getMergedIntoContainerBookingId(), task.getTaskStatus(),
workflowStatus, task.getVersion(), assignment, review, items);
}
@@ -15,29 +15,32 @@ public class WarehouseSupplierSnapshotService {
@Value("${baiyue.security.internal-service-token}") private String internalToken;
public WarehouseSupplierClient.Snapshot booking(Long supplierId, String suppliedName) {
return resolve(supplierId, suppliedName, "BOOKING", "INTERNATIONAL");
return resolve(supplierId, suppliedName, "BOOKING");
}
public WarehouseSupplierClient.Snapshot trucking(Long supplierId, String suppliedName) {
return resolve(supplierId, suppliedName, "TRUCKING", null);
return resolve(supplierId, suppliedName, "TRUCKING");
}
public WarehouseSupplierClient.Snapshot customs(Long supplierId, String suppliedName) {
return resolve(supplierId, suppliedName, "CUSTOMS", null);
return resolve(supplierId, suppliedName, "CUSTOMS");
}
private WarehouseSupplierClient.Snapshot resolve(Long supplierId, String suppliedName,
String category, String scope) {
String category) {
if (supplierId == null || supplierId <= 0) {
if (StringUtils.hasText(suppliedName)) throw new BizException(ResultCode.BAD_REQUEST,
"供应商名称必须来自有效的供应商ID,禁止自由文本");
return null;
}
try {
var response = client.get(internalToken, supplierId, true, category, scope);
var response = client.get(internalToken, supplierId, true, category);
if (response == null || !response.successful() || response.data() == null
|| response.data().supplierId() != supplierId
|| !"ACTIVE".equals(response.data().status())
|| !category.equals(response.data().category())
|| !StringUtils.hasText(response.data().name())) {
throw new BizException(ResultCode.CONFLICT, "所选供应商不存在、未启用或类别/范围不匹配");
throw new BizException(ResultCode.CONFLICT, "所选供应商不存在、未启用或类别不匹配");
}
if (StringUtils.hasText(suppliedName)
&& !suppliedName.trim().equals(response.data().name())) {