优化
This commit is contained in:
@@ -41,6 +41,7 @@ function validDraft() {
|
||||
customerRemark: '',
|
||||
tradeTerm: 'FOB',
|
||||
destinationCountryCode: 'US',
|
||||
destinationWarehouseId: 'WH-FBA-ONT8',
|
||||
destinationWarehouseName: 'ONT8',
|
||||
pickupMethod: 'SELF_EXPRESS',
|
||||
channelCode: 'SEA-US-FBA',
|
||||
@@ -113,6 +114,20 @@ test('requires FBA reference, warehouse, shipment, SKU and UPC fields', () => {
|
||||
assert.ok(errors.includes('第 1 条货物缺少 UPC'))
|
||||
})
|
||||
|
||||
test('requires public destination ids while keeping private addresses detached from public warehouses', () => {
|
||||
const publicDraft = validDraft()
|
||||
publicDraft.destinationWarehouseId = ''
|
||||
assert.ok(validateFirstLegOrderDraft(publicDraft).includes('请选择平台维护的目的仓'))
|
||||
|
||||
const privateDraft = validDraft()
|
||||
privateDraft.destinationType = 'PRIVATE'
|
||||
privateDraft.destinationWarehouseId = 'WH-FBA-ONT8'
|
||||
privateDraft.amazonWarehouseCode = ''
|
||||
privateDraft.shipmentId = ''
|
||||
privateDraft.referenceNo = ''
|
||||
assert.ok(validateFirstLegOrderDraft(privateDraft).includes('私人地址不能引用平台公共仓库'))
|
||||
})
|
||||
|
||||
test('does not require container details for non-FCL cargo', () => {
|
||||
const draft = validDraft()
|
||||
draft.transportMode = 'AIR'
|
||||
|
||||
@@ -66,6 +66,8 @@ export function validateFirstLegOrderDraft(draft: FirstLegOrderDraft) {
|
||||
if (!draft.destination.trim()) errors.push('请填写目的地')
|
||||
if (!/^[A-Za-z]{2}$/.test(draft.destinationCountryCode.trim())) errors.push('请输入两位英文字母的目的国代码')
|
||||
if (!draft.destinationWarehouseName.trim()) errors.push('请填写目的仓名称')
|
||||
if (draft.destinationType !== 'PRIVATE' && !draft.destinationWarehouseId) errors.push('请选择平台维护的目的仓')
|
||||
if (draft.destinationType === 'PRIVATE' && draft.destinationWarehouseId) errors.push('私人地址不能引用平台公共仓库')
|
||||
if (!draft.channelCode.trim() || !draft.channelName.trim()) errors.push('请填写渠道编码和渠道名称')
|
||||
if (!draft.receivingWarehouseId) errors.push('请选择平台收货仓')
|
||||
if (!draft.shipperPartyId || !draft.shipperPartySnapshot || !draft.shipper.trim()) errors.push('请选择发货单位')
|
||||
|
||||
Reference in New Issue
Block a user