This commit is contained in:
2026-08-17 15:41:42 +08:00
parent 4abcb2b80f
commit 5f79616623
60 changed files with 1457 additions and 270 deletions
@@ -54,7 +54,7 @@ export async function run(context) {
Boolean(customerId) && Boolean(customerName),
`customerId=${customerId || 'missing'}, customerName=${customerName || 'missing'}`, OPTIONS)
if (!customerId || !customerName) return
const linkContainer = (containerFlow?.finalStatus === 'COMPLETED' || containerFlow?.finalStatus === 'LOADED')
const linkContainer = ['AWAITING_REVIEW', 'LOADED'].includes(containerFlow?.finalStatus)
&& id(containerFlow?.tenantId) === customerId
&& Boolean(containerFlow?.containerBookingId)
&& Boolean(containerFlow?.loadingPlanId)
@@ -104,12 +104,6 @@ export async function run(context) {
&& Boolean(appointment?.createdAt || appointment?.createdBy || appointment?.operatorName),
`appointmentId=${appointmentId || 'missing'}, oceanBookingId=${appointment?.oceanBookingId || 'missing'}, containerBookingId=${appointment?.containerBookingId || 'n/a'}, loadingPlanId=${appointment?.loadingPlanId || 'n/a'}, version=${appointment?.version ?? 'missing'}`, OPTIONS)
if (!appointmentId) return
context.createdResources.serviceCenterFlow = {
appointmentId, oceanBookingId: ocean.id,
containerBookingId: linkContainer ? id(containerFlow.containerBookingId) : null,
loadingPlanId: linkContainer ? id(containerFlow.loadingPlanId) : null,
marker: context.marker, finalStatus: 'COMPLETED',
}
const path = `${TRUCK}/${appointmentId}`
let version = Number(appointment.version)
for (const [name, endpoint, status] of [
@@ -146,4 +140,12 @@ export async function run(context) {
&& Boolean(item.operatorName) && Boolean(item.createdAt) && item.reason === context.marker)),
`history=${history?.length ?? 'n/a'}, actions=${actions.map((item) => item.action).join(',')}`,
OPTIONS)
if (final?.status === 'COMPLETED') {
context.createdResources.serviceCenterFlow = {
appointmentId, oceanBookingId: ocean.id,
containerBookingId: linkContainer ? id(containerFlow.containerBookingId) : null,
loadingPlanId: linkContainer ? id(containerFlow.loadingPlanId) : null,
marker: context.marker, finalStatus: 'COMPLETED',
}
}
}