优化
This commit is contained in:
@@ -70,11 +70,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', actualGrossWeightKg: '12.5', actualVolumeCbm: '0.45', customerRemark: '客户备注', latestInternalNote: '最新内部备注', relation: { role: 'PARENT', rootOrderId: 90001, parentOrderId: null, splitSequence: null, childCount: '2' }, measurement: null, preload: null, loading: null, delivery: null, transport: null }],
|
||||
records: [{ orderId: '90001', tenantId: '208', inboundId: '77', inboundVersion: 3, mainStatus: 'WAIT_MEASURE', locationCodes: 'A0-01, B2-03', actualGrossWeightKg: '12.5', actualVolumeCbm: '0.45', totalPalletCount: '3', totalNetWeightKg: '11.2', chargeableVolumeCbm: '0.5', totalQuantity: '48', skuNos: ['SKU-1', ''], requestedPickupAt: '2026-08-18T09:30:00', 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', actualGrossWeightKg: 12.5, actualVolumeCbm: 0.45, customerRemark: '客户备注', latestInternalNote: '最新内部备注', relation: { role: 'PARENT', rootOrderId: '90001', childCount: 2 } }],
|
||||
records: [{ orderId: '90001', tenantId: '208', inboundId: '77', inboundVersion: 3, locationCodes: 'A0-01, B2-03', actualGrossWeightKg: 12.5, actualVolumeCbm: 0.45, totalPalletCount: 3, totalNetWeightKg: 11.2, chargeableVolumeCbm: 0.5, totalQuantity: 48, skuNos: ['SKU-1'], requestedPickupAt: '2026-08-18T09:30:00', customerRemark: '客户备注', latestInternalNote: '最新内部备注', relation: { role: 'PARENT', rootOrderId: '90001', childCount: 2 } }],
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -89,7 +89,6 @@ export interface UnifiedOrderResource {
|
||||
inboundCode: string | null
|
||||
expectedShipDate: string | null
|
||||
totalPackageCount: number | null
|
||||
recommendedPalletType: string | null
|
||||
locationCodes: string | null
|
||||
actualGrossWeightKg: number | null
|
||||
actualVolumeCbm: number | null
|
||||
@@ -100,14 +99,14 @@ export interface UnifiedOrderResource {
|
||||
transport: UnifiedOrderTransportSummary | null
|
||||
createdAt: string | null
|
||||
updatedAt: string | null
|
||||
/** Optional fields returned by newer first-leg/inbound projections. */
|
||||
expectedArrivalAt?: string | null
|
||||
feeReviewStatus?: string | null
|
||||
expectedArrivalAt: string | null
|
||||
feeReviewStatus: string | null
|
||||
holdCargo?: boolean | null
|
||||
holdReason?: string | null
|
||||
companyName?: string | null
|
||||
businessType?: string | null
|
||||
pickupMethod?: string | null
|
||||
requestedPickupAt: string | null
|
||||
pickupAt?: string | null
|
||||
pickupContactPhone?: string | null
|
||||
pickupAddress?: string | null
|
||||
@@ -116,24 +115,27 @@ export interface UnifiedOrderResource {
|
||||
taxMode?: string | null
|
||||
fullContainer?: boolean | null
|
||||
customsInspection?: boolean | null
|
||||
/** Legacy aliases retained while older order responses are still deployed. */
|
||||
totalPalletCount?: number | null
|
||||
chargeableVolumeCbm?: number | null
|
||||
volumetricWeightKg?: number | null
|
||||
totalNetWeightKg?: number | null
|
||||
totalPalletCount: number | null
|
||||
chargeableVolumeCbm: number | null
|
||||
volumetricWeightKg: number | null
|
||||
totalNetWeightKg: number | null
|
||||
location?: string | null
|
||||
destinationType?: string | null
|
||||
destinationAddress?: string | null
|
||||
destinationPostalCode?: string | null
|
||||
destinationContact?: string | null
|
||||
destinationContactPhone?: string | null
|
||||
measurementCompletedAt?: string | null
|
||||
inboundCompletedAt?: string | null
|
||||
measurementCompletedAt: string | null
|
||||
inboundCompletedAt: string | null
|
||||
associatedFiles?: string[] | null
|
||||
markFiles?: string[] | null
|
||||
pcOrderFiles?: string[] | null
|
||||
expressCompany?: string | null
|
||||
expressTrackingNo?: string | null
|
||||
expressCompany: string | null
|
||||
expressTrackingNo: string | null
|
||||
skuNos: string[] | null
|
||||
totalQuantity: number | null
|
||||
shipmentId: string | null
|
||||
referenceId: string | null
|
||||
remark?: string | null
|
||||
customerRemark?: string | null
|
||||
latestInternalNote?: string | null
|
||||
@@ -339,7 +341,11 @@ function normalizeRow(raw: UnifiedOrderResource): UnifiedOrderResource {
|
||||
actualGrossWeightKg: numberValue(raw.actualGrossWeightKg),
|
||||
actualVolumeCbm: numberValue(raw.actualVolumeCbm),
|
||||
totalPalletCount: nullableInteger(raw.totalPalletCount),
|
||||
recommendedPalletType: raw.recommendedPalletType ?? null,
|
||||
chargeableVolumeCbm: numberValue(raw.chargeableVolumeCbm),
|
||||
volumetricWeightKg: numberValue(raw.volumetricWeightKg),
|
||||
totalNetWeightKg: numberValue(raw.totalNetWeightKg),
|
||||
totalQuantity: nullableInteger(raw.totalQuantity),
|
||||
skuNos: raw.skuNos?.filter((value) => value.trim()) ?? null,
|
||||
locationCodes: raw.locationCodes ?? raw.location ?? null,
|
||||
measurement: raw.measurement ? {
|
||||
...raw.measurement,
|
||||
|
||||
Reference in New Issue
Block a user