优化
This commit is contained in:
@@ -85,7 +85,7 @@ export function selectCustomsFlow(createdResources) {
|
||||
return { fixture: null, container: null }
|
||||
}
|
||||
|
||||
async function ensureServiceCenterFlow(context, container) {
|
||||
async function ensureReleasedOceanBooking(context, container) {
|
||||
const containerBookingId = id(container?.containerBookingId)
|
||||
const loadingPlanId = id(container?.loadingPlanId)
|
||||
let ocean = context.createdResources?.oceanBooking
|
||||
@@ -104,22 +104,7 @@ async function ensureServiceCenterFlow(context, container) {
|
||||
return false
|
||||
}
|
||||
|
||||
let truck = context.createdResources?.serviceCenterFlow
|
||||
if (truck?.finalStatus !== 'COMPLETED'
|
||||
|| id(truck?.oceanBookingId) !== id(ocean.id)
|
||||
|| id(truck?.containerBookingId) !== containerBookingId
|
||||
|| id(truck?.loadingPlanId) !== loadingPlanId) {
|
||||
const serviceCenter = await import(new URL('./service-center-flow.mjs', import.meta.url))
|
||||
await serviceCenter.run(context)
|
||||
truck = context.createdResources?.serviceCenterFlow
|
||||
}
|
||||
const ready = truck?.finalStatus === 'COMPLETED'
|
||||
&& id(truck?.oceanBookingId) === id(ocean.id)
|
||||
&& id(truck?.containerBookingId) === containerBookingId
|
||||
&& id(truck?.loadingPlanId) === loadingPlanId
|
||||
context.addStep(MODULE, '报关前拖车已完成并绑定实际装柜柜次', null, ready,
|
||||
`truckStatus=${truck?.finalStatus || 'missing'}, truckContainer=${id(truck?.containerBookingId) || 'missing'}, containerBookingId=${containerBookingId || 'missing'}`, OPTIONS)
|
||||
return ready
|
||||
return true
|
||||
}
|
||||
|
||||
export async function run(context) {
|
||||
@@ -137,7 +122,7 @@ export async function run(context) {
|
||||
`tenantId=${tenantId || 'missing'}, parentOrderId=${parentOrderId || 'missing'}, inboundId=${inboundId || 'missing'}, containerBookingId=${containerBookingId || 'missing'}, loadingPlanId=${loadingPlanId || 'missing'}, containerStatus=${container?.finalStatus || 'missing'}`, OPTIONS)
|
||||
return
|
||||
}
|
||||
if (!await ensureServiceCenterFlow(context, container)) return
|
||||
if (!await ensureReleasedOceanBooking(context, container)) return
|
||||
|
||||
const slicesPath = `/api/platform/v1/orders/container-bookings/${encodeURIComponent(containerBookingId)}/fulfillment-slices?tenantId=${encodeURIComponent(tenantId)}`
|
||||
const slicesResponse = await context.request('GET', slicesPath)
|
||||
|
||||
Reference in New Issue
Block a user