优化
This commit is contained in:
@@ -32,6 +32,15 @@ async function safeCleanup(context, name, action) {
|
||||
}
|
||||
}
|
||||
|
||||
async function continueLifecycle(context, name, action) {
|
||||
try {
|
||||
await action()
|
||||
} catch (error) {
|
||||
context.assert(MODULE, `${name}生命周期执行`, null, false,
|
||||
error instanceof Error ? error.message : String(error), BLOCKER)
|
||||
}
|
||||
}
|
||||
|
||||
function warehousePayload(marker, edited = false) {
|
||||
const suffix = marker.replace(/[^A-Za-z0-9]/g, '').slice(-20).toUpperCase()
|
||||
return {
|
||||
@@ -350,10 +359,12 @@ export async function run(context) {
|
||||
const resource = { marker: context.marker }
|
||||
context.createdResources.phase4OverseasMasterData = resource
|
||||
try {
|
||||
await createAndVerifyPartnerWarehouse(context, resource)
|
||||
await quoteLifecycle(context, resource)
|
||||
await exchangeLifecycle(context, resource)
|
||||
await vehicleLifecycle(context, resource)
|
||||
await continueLifecycle(context, '海外报价', async () => {
|
||||
await createAndVerifyPartnerWarehouse(context, resource)
|
||||
await quoteLifecycle(context, resource)
|
||||
})
|
||||
await continueLifecycle(context, '月度汇率', () => exchangeLifecycle(context, resource))
|
||||
await continueLifecycle(context, '车辆主数据', () => vehicleLifecycle(context, resource))
|
||||
} finally {
|
||||
await safeCleanup(context, '海外报价', async () => {
|
||||
if (!resource.quote?.id) return
|
||||
|
||||
Reference in New Issue
Block a user