优化
This commit is contained in:
@@ -79,6 +79,13 @@ export function truckAppointmentPayload(context, suffix, identity, version = 0,
|
||||
}
|
||||
|
||||
async function activeSupplier(context, category, suffix) {
|
||||
if (context.options?.fixedCustomerId) {
|
||||
const { loadSupplier } = await import('./finance-full-fixtures.mjs')
|
||||
const supplier = await loadSupplier(context, category, category === 'BOOKING'
|
||||
? { carrierCode: 'MATSON' } : { truckingScope: 'DOMESTIC' })
|
||||
if (!supplier) throw new Error(`缺少现有 ${category} 供应商,禁止自动创建`)
|
||||
return { supplierId: id(supplier.id), supplierName: supplier.name }
|
||||
}
|
||||
const carrierFilter = category === 'BOOKING' ? '&carrierCode=MATSON' : category === 'TRUCKING' ? '&truckingScope=DOMESTIC' : ''
|
||||
const list = await request(context, 'GET', `/api/platform/v1/suppliers?tenantId=0&category=${category}&status=ACTIVE${carrierFilter}&page=1&size=100`)
|
||||
const existing = records(data(list)).find((item) => item?.category === category && item?.status === 'ACTIVE'
|
||||
|
||||
Reference in New Issue
Block a user