优化
This commit is contained in:
@@ -69,11 +69,11 @@ describe('unified orders API contract', () => {
|
||||
|
||||
it('normalizes C02 row IDs and keeps inboundId for measurement routing', async () => {
|
||||
vi.mocked(http.get).mockResolvedValue({ data: {
|
||||
records: [{ orderId: '90001', tenantId: '208', inboundId: '77', inboundVersion: 3, mainStatus: 'WAIT_MEASURE', recommendedPalletType: 'STANDARD', locationCodes: 'A0-01, B2-03', customerRemark: '客户备注', latestInternalNote: '最新内部备注', measurement: null, preload: null, loading: null, delivery: null, transport: null }],
|
||||
records: [{ orderId: '90001', tenantId: '208', inboundId: '77', inboundVersion: 3, mainStatus: 'WAIT_MEASURE', recommendedPalletType: 'STANDARD', locationCodes: 'A0-01, B2-03', customerRemark: '客户备注', latestInternalNote: '最新内部备注', relation: { role: 'PARENT', rootOrderId: 90001, parentOrderId: null, splitSequence: null, childCount: '2' }, measurement: null, preload: null, loading: null, delivery: null, transport: null }],
|
||||
page: 1, size: 20, total: 1, pages: 1,
|
||||
} })
|
||||
await expect(listPlatformUnifiedOrders({ page: 1, size: 20 })).resolves.toMatchObject({
|
||||
records: [{ orderId: '90001', tenantId: '208', inboundId: '77', inboundVersion: 3, recommendedPalletType: 'STANDARD', locationCodes: 'A0-01, B2-03', customerRemark: '客户备注', latestInternalNote: '最新内部备注' }],
|
||||
records: [{ orderId: '90001', tenantId: '208', inboundId: '77', inboundVersion: 3, recommendedPalletType: 'STANDARD', locationCodes: 'A0-01, B2-03', customerRemark: '客户备注', latestInternalNote: '最新内部备注', relation: { role: 'PARENT', rootOrderId: '90001', childCount: 2 } }],
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -63,12 +63,21 @@ export interface UnifiedOrderTransportSummary {
|
||||
portArrivalAt: string | null
|
||||
}
|
||||
|
||||
export interface UnifiedOrderRelationSummary {
|
||||
role: 'PARENT' | 'CHILD'
|
||||
rootOrderId: number | string | null
|
||||
parentOrderId: number | string | null
|
||||
splitSequence: number | null
|
||||
childCount: number
|
||||
}
|
||||
|
||||
export interface UnifiedOrderResource {
|
||||
orderId: number | string
|
||||
tenantId: number | string
|
||||
orderNo: string | null
|
||||
mainStatus: UnifiedOrderMainStatus
|
||||
nextAction: string | null
|
||||
relation: UnifiedOrderRelationSummary | null
|
||||
internalOrderStatus: string | null
|
||||
customerId: number | string | null
|
||||
customerName: string | null
|
||||
@@ -319,6 +328,13 @@ function normalizeRow(raw: UnifiedOrderResource): UnifiedOrderResource {
|
||||
destinationWarehouseId: id(raw.destinationWarehouseId),
|
||||
inboundId: id(raw.inboundId),
|
||||
inboundVersion: nullableInteger(raw.inboundVersion),
|
||||
relation: raw.relation ? {
|
||||
...raw.relation,
|
||||
rootOrderId: id(raw.relation.rootOrderId),
|
||||
parentOrderId: id(raw.relation.parentOrderId),
|
||||
splitSequence: nullableInteger(raw.relation.splitSequence),
|
||||
childCount: integer(raw.relation.childCount, 0),
|
||||
} : null,
|
||||
totalPackageCount: nullableInteger(raw.totalPackageCount),
|
||||
totalPalletCount: nullableInteger(raw.totalPalletCount),
|
||||
recommendedPalletType: raw.recommendedPalletType ?? null,
|
||||
|
||||
Reference in New Issue
Block a user