优化
This commit is contained in:
@@ -79,13 +79,14 @@ export function truckAppointmentPayload(context, suffix, identity, version = 0,
|
||||
}
|
||||
|
||||
async function activeSupplier(context, category, suffix) {
|
||||
const carrierFilter = category === 'BOOKING' ? '&carrierCode=MATSON' : ''
|
||||
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'
|
||||
&& (category !== 'TRUCKING' || item?.truckingScope === 'DOMESTIC')
|
||||
&& (category !== 'BOOKING' || item?.carrierCodes?.includes?.('MATSON')))
|
||||
if (existing) return { supplierId: id(existing.id), supplierName: existing.name }
|
||||
const created = await request(context, 'POST', '/api/platform/v1/suppliers?tenantId=0', {
|
||||
name: `${category}-验收-${suffix}`, category, carrierCodes: category === 'BOOKING' ? ['MATSON'] : [],
|
||||
name: `${category}-验收-${suffix}`, category, truckingScope: category === 'TRUCKING' ? 'DOMESTIC' : null, carrierCodes: category === 'BOOKING' ? ['MATSON'] : [],
|
||||
region: '深圳', legalRepresentative: '验收法人', contactName: '验收联系人', phone: '13800000000',
|
||||
email: 'truck-acceptance@example.com', address: '深圳市验收地址', businessLicenseNo: `TRUCK-${suffix}`.slice(0, 64),
|
||||
licenseFileId: null, status: 'ACTIVE', settlementPeriod: 'MONTHLY_30', remark: context.marker,
|
||||
|
||||
Reference in New Issue
Block a user