优化
This commit is contained in:
@@ -97,11 +97,12 @@ async function readInbound(context, fixture) {
|
||||
|
||||
async function createConfirmedContainer(context, source, label) {
|
||||
const value = suffix(context, label)
|
||||
const containerNo = `MAN-${value}`.slice(0, 64)
|
||||
const summary = source.detail.summary
|
||||
const draft = {
|
||||
customerId: source.tenantId, customerName: summary.customerName || 'IT 测试客户',
|
||||
channelCode: summary.channelCode, warehouseId: source.warehouseId,
|
||||
warehouseName: summary.warehouseName, billOfLadingNo: `BL-${value}`.slice(0, 128),
|
||||
billOfLadingNo: `BL-${value}`.slice(0, 128),
|
||||
shippingCompanyId: null, shippingCompanyName: null,
|
||||
bookingAgentId: null, bookingAgentName: null, departurePortCode: 'CNSZX',
|
||||
vesselName: `人工船-${value}`.slice(0, 128), voyageNo: `V-${value}`.slice(0, 64),
|
||||
@@ -112,12 +113,12 @@ async function createConfirmedContainer(context, source, label) {
|
||||
parties: [{ partyType: 'SHIPPER', partyName: `发货方-${value}` },
|
||||
{ partyType: 'CONSIGNEE', partyName: `收货方-${value}` },
|
||||
{ partyType: 'NOTIFY_PARTY', partyName: `通知方-${value}` }],
|
||||
containerRequirements: [{ containerType: '40HQ', containerKind: 'FCL', capacityCbm: 68,
|
||||
maxWeightKg: 28000, quantity: 1 }],
|
||||
containers: [{ containerNo, containerType: '40HC', containerKind: 'FCL', capacityCbm: 76,
|
||||
maxWeightKg: 28000 }],
|
||||
}
|
||||
const simulationResponse = await context.request('POST', CONTAINERS, {
|
||||
channelCode: summary.channelCode, warehouseId: source.warehouseId, containerType: '40HQ',
|
||||
capacityCbm: 68, maxWeightKg: 28000,
|
||||
channelCode: summary.channelCode, warehouseId: source.warehouseId, containerType: '40HC',
|
||||
capacityCbm: 76, maxWeightKg: 28000,
|
||||
})
|
||||
const simulation = context.apiSuccess(MODULE, `${label} 新增内部模拟柜`, simulationResponse, '', OPTIONS)
|
||||
const containerId = id(simulation?.id)
|
||||
@@ -130,10 +131,10 @@ async function createConfirmedContainer(context, source, label) {
|
||||
context.assert(MODULE, `${label} 一次登记直接返回 CONFIRMED`, createdResponse,
|
||||
confirmed?.oceanBooking?.status === 'CONFIRMED',
|
||||
`status=${confirmed?.oceanBooking?.status || 'missing'}`, OPTIONS)
|
||||
const requirement = confirmed?.containerRequirements?.find?.((item) => item.containerType === '40HQ')
|
||||
if (!requirement?.id) throw new Error(`${label} 确认订舱未返回箱型需求`)
|
||||
const requirement = confirmed?.containers?.find?.((item) => item.containerNo === containerNo)
|
||||
if (!requirement?.containerBookingId) throw new Error(`${label} 确认订舱未返回真实柜身份`)
|
||||
const linkedResponse = await context.request('POST', `${CONTAINERS}/${containerId}/ocean-booking-link`, {
|
||||
oceanBookingId: bookingId, requirementId: id(requirement.id), expectedVersion: Number(simulation.version),
|
||||
realContainerBookingId: id(requirement.containerBookingId), expectedVersion: Number(simulation.version),
|
||||
})
|
||||
const linked = context.apiSuccess(MODULE, `${label} 关联模拟柜与真实订舱`, linkedResponse, '', OPTIONS)
|
||||
if (id(linked?.id) !== containerId || linked?.cabinetNo !== simulation.cabinetNo) {
|
||||
|
||||
Reference in New Issue
Block a user