fix: expose the selected container schedule for editing

This commit is contained in:
2026-10-03 11:09:52 +08:00
parent ba7dcd39f2
commit 65c12eaf5e
4 changed files with 47 additions and 1 deletions
@@ -1,6 +1,7 @@
package com.baiyue.firstleg.entity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
@@ -75,6 +76,9 @@ public class ContainerBookingEntity {
@TableField(exist = false) private Long planId;
@TableField(exist = false) private String planNo;
@TableField(exist = false) private String planStatus;
/** Identity of the port schedule selected for the current transport read model. */
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
@TableField(exist = false) private Long currentPortScheduleId;
/** Actual completion timestamp projected from the associated loading plan. */
@JsonIgnore @TableField(exist = false) private LocalDateTime completedLoadingAt;
@TableField(exist = false) private Boolean exceptionActive;
@@ -71,9 +71,12 @@ public class ContainerRepository {
}
private void resolveCurrentPortSchedule(ContainerBookingEntity value) {
if (value == null || value.getCustomerId() == null || value.getOceanBookingId() == null) return;
if (value == null) return;
value.setCurrentPortScheduleId(null);
if (value.getCustomerId() == null || value.getOceanBookingId() == null) return;
PortScheduleEntity schedule = schedules.latestForDispatch(value.getCustomerId(), value.getOceanBookingId(), value.getId());
if (schedule == null) return;
value.setCurrentPortScheduleId(schedule.getId());
value.setVesselName(schedule.getVesselName());
value.setVoyageNo(schedule.getVoyageNo());
value.setEstimatedSailingAt(schedule.getEtdAt());
@@ -2260,6 +2260,7 @@ components:
required: [id, bookingNo, cabinetNo, sourceType, recordStatus, warehouseId, warehouseName, channelGroupCode, containerType, capacityCbm, maxWeightKg, planStatus, exceptionActive, destinationClearanceDocumentStatus, customsDeclarationDocumentStatus, deliveryOrderDocumentStatus, version]
properties:
id: {type: string, pattern: '^[1-9][0-9]*$'}
currentPortScheduleId: {type: string, pattern: '^[1-9][0-9]*$', nullable: true, readOnly: true, description: 当前运输读模型由 latestForDispatch 选中的船期记录 ID;无匹配时为空,仅用于定位关联船期,不作为业务编号展示}
planId: {type: string, pattern: '^[1-9][0-9]*$', nullable: true, description: 关联智能装柜计划ID;未创建计划时为空}
planNo: {type: string, nullable: true, pattern: '^LP-[0-9]{6}-[0-9]{4}$', example: LP-260818-0001, description: 预装与确认装柜清单共用的稳定编号;未创建计划时为空}
bookingNo: {type: string, pattern: '^CB-[0-9]{6}-[0-9]{4}$', example: CB-260818-0001, description: 平台内部货柜登记号}