优化
This commit is contained in:
@@ -67,7 +67,10 @@ export async function run(context) {
|
||||
context.createdResources.phase4OverseasWarehouse = { marker: context.marker, customerId: null, warehouseId: null, palletId: null, terminalStatus: null }
|
||||
const tenantsResult = await domesticGet(context, '查询可用客户候选', '/api/platform/v1/iam/tenants?page=1&size=100&status=ACTIVE')
|
||||
assertPage(context, '可用客户候选', tenantsResult)
|
||||
const customer = records(tenantsResult.data).find((item) => longId(item?.id) && item?.status === 'ACTIVE')
|
||||
const fixedCustomer = context.context?.merchantQualificationFixture
|
||||
const customer = context.options?.fixedCustomerId
|
||||
? { id: fixedCustomer?.tenantId, status: fixedCustomer?.tenantId ? 'ACTIVE' : null }
|
||||
: records(tenantsResult.data).find((item) => longId(item?.id) && item?.status === 'ACTIVE')
|
||||
const customerId = id(customer?.id)
|
||||
if (!customerId) {
|
||||
context.assert(MODULE, '海外仓验收必须取得ACTIVE客户', tenantsResult.response, false,
|
||||
@@ -151,6 +154,7 @@ export async function run(context) {
|
||||
let warehouse = await findWarehouse(context, records(tenantsResult.data), customerId)
|
||||
let ownedWarehouse = false
|
||||
if (!warehouse) {
|
||||
if (context.options?.fixedCustomerId) throw new Error('固定资源模式缺少海外仓,禁止自动创建仓库')
|
||||
warehouse = await createWarehouseFixture(context, customerId)
|
||||
ownedWarehouse = Boolean(warehouse)
|
||||
}
|
||||
@@ -185,6 +189,12 @@ export async function run(context) {
|
||||
`listId=${id(pallet.id)}, detailId=${id(detail.data?.id) || 'missing'}; ${trace(detail.response)}`, OPTIONS)
|
||||
}
|
||||
|
||||
if (context.options?.fixedCustomerId) {
|
||||
context.context.phase4OverseasWarehouse = { customerId, warehouseId, palletId: null }
|
||||
context.addCoverageGap(MODULE, 'resource-lifecycle', '复用海外仓资源,仅核验列表和详情',
|
||||
'不创建或修改公共库位及托盘;业务分配由后续实际库存流程决定', 'not-implemented', { blocking: false })
|
||||
return
|
||||
}
|
||||
try {
|
||||
await verifyLocationLifecycle(context, warehouseId)
|
||||
await verifyPalletLifecycle(context, warehouseId)
|
||||
|
||||
Reference in New Issue
Block a user