优化
This commit is contained in:
@@ -57,7 +57,7 @@ test('unchanged source renders real grouped box specs and totals without zero pa
|
||||
assert.match(html, /60 × 50 × 50 cm · 2.5 kg\/箱 · 2 箱/)
|
||||
assert.match(html, /50 × 40 × 40 cm · 3.6 kg\/箱 · 2 箱/)
|
||||
assert.match(html, /来源汇总:0.31 m³ · 9.7 kg/)
|
||||
assert.match(html, /未测整托长宽高/)
|
||||
assert.doesNotMatch(html, /未测整托长宽高/)
|
||||
assert.equal((html.match(/class="measurement-inputs"/g) || []).length, 0)
|
||||
assert.doesNotMatch(html, /确认本托实测/)
|
||||
})
|
||||
@@ -72,37 +72,54 @@ test('changed pallets and explicit packaging changes still render final pallet m
|
||||
test('box aggregated pallets render current totals and no manual pallet measurement even after moving', async () => {
|
||||
const html = await renderMeasurements([{ palletCode: 'NEW', packages: 1, inherited: true, cartonAggregated: true,
|
||||
grossWeightKg: 3.6, volumeCbm: 0.08, sourceCartonSpecs: [{lengthCm:50,widthCm:40,heightCm:40,grossWeightKg:3.6,cartons:1}] }])
|
||||
assert.match(html, /移出扣减、移入增加/)
|
||||
assert.doesNotMatch(html, /移出扣减、移入增加/)
|
||||
assert.match(html, /0.08 m³ · 3.6 kg/)
|
||||
assert.doesNotMatch(html, /确认本托实测|重新测量|measurement-inputs/)
|
||||
})
|
||||
test('mixed box selection is required and submits exact measured source box with binding', async () => {
|
||||
const mixedBoxes = [
|
||||
{ cartonMark: 'OTHER', lengthCm: 60, widthCm: 50, heightCm: 50, grossWeightKg: 2.5 },
|
||||
{ cartonMark: 'SMALL1', customerCartonMark: 'CUSTOMER', lengthCm: 50, widthCm: 40, heightCm: 40, grossWeightKg: 3.6 }
|
||||
]
|
||||
|
||||
test('mixed specs automatically bind the submitted carton without another picker', async () => {
|
||||
const { value, calls } = setup()
|
||||
Object.assign(value, { readyToBind:true, requiresMeasuredBoxChoice:true, marks:['CUSTOMER'],
|
||||
source:{palletCode:'OLD',palletVersion:1}, target:{palletCode:'NEW',palletVersion:1},
|
||||
selectedSource:{positionId:'1',positionVersion:1},quantity:'1', loadSources:async()=>{}, showBindingMessage(){} })
|
||||
Object.assign(value, { readyToBind: true, requiresMeasuredBoxMapping: true, marks: ['CUSTOMER'], measuredBoxChoices: mixedBoxes,
|
||||
source: { palletCode: 'OLD', palletVersion: 1 }, target: { palletCode: 'NEW', palletVersion: 1 },
|
||||
selectedSource: { positionId: '1', positionVersion: 1 }, quantity: '1', loadSources: async () => {}, showBindingMessage() {} })
|
||||
await value.bind()
|
||||
assert.equal(calls.length,0)
|
||||
assert.match(value.error,/请选择/)
|
||||
value.measuredSelections={CUSTOMER:'SMALL1'}
|
||||
await value.bind()
|
||||
assert.deepEqual(calls[0].measuredCartons,[{cartonMark:'CUSTOMER',sourceCartonMark:'SMALL1'}])
|
||||
assert.deepEqual(calls[0].cartonMarks, ['CUSTOMER'])
|
||||
assert.deepEqual(calls[0].measuredCartons, [{ cartonMark: 'CUSTOMER', sourceCartonMark: 'SMALL1' }])
|
||||
assert.doesNotMatch(source, /<picker|chooseMeasuredBox|点击选择实测箱/)
|
||||
})
|
||||
test('measured box picker excludes a box selected for another item', () => {
|
||||
|
||||
test('warehouse carton marks also match automatically and follow the current batch', () => {
|
||||
const { value } = setup()
|
||||
Object.assign(value,{marks:['X','Y'],measuredSelections:{X:'A'},measuredBoxChoices:[
|
||||
{cartonMark:'A',lengthCm:60,widthCm:50,heightCm:50,grossWeightKg:2.5},
|
||||
{cartonMark:'B',lengthCm:50,widthCm:40,heightCm:40,grossWeightKg:3.6}]})
|
||||
assert.deepEqual(value.measuredBoxOptions('Y').map(box=>box.cartonMark),['B'])
|
||||
assert.equal(value.measuredBoxOptions('X').length,2)
|
||||
Object.assign(value, { requiresMeasuredBoxMapping: true, measuredBoxChoices: mixedBoxes, marks: ['SMALL1'] })
|
||||
assert.deepEqual(value.measuredCartonBindings(), [{ cartonMark: 'SMALL1', sourceCartonMark: 'SMALL1' }])
|
||||
value.marks = ['OTHER']
|
||||
assert.deepEqual(value.measuredCartonBindings(), [{ cartonMark: 'OTHER', sourceCartonMark: 'OTHER' }])
|
||||
})
|
||||
test('entering split quantity prepares measured box choices before target binding', () => {
|
||||
|
||||
test('unmatched, ambiguous or duplicate physical boxes cannot bind another carton', async () => {
|
||||
for (const [marks, boxes] of [
|
||||
[['MISSING'], mixedBoxes],
|
||||
[['CUSTOMER'], [...mixedBoxes, { ...mixedBoxes[0], customerCartonMark: 'CUSTOMER' }]],
|
||||
[['CUSTOMER', 'SMALL1'], mixedBoxes]
|
||||
]) {
|
||||
const { value, calls } = setup()
|
||||
Object.assign(value, { readyToBind: true, requiresMeasuredBoxMapping: true, measuredBoxChoices: boxes, marks })
|
||||
await value.bind()
|
||||
assert.equal(calls.length, 0)
|
||||
assert.match(value.error, /不匹配/)
|
||||
}
|
||||
})
|
||||
|
||||
test('entering split quantity prepares the batch and clears invalid quantities', () => {
|
||||
const { value } = setup()
|
||||
Object.assign(value,{measuredBoxChoices:[{cartonMark:'A'}],eligibleItems:[{cartonMark:'X'}],
|
||||
selectedSource:{movablePackages:1},measuredSelections:{OLD:'A'},fillBatch(){this.marks=['X']}})
|
||||
value.prepareMeasuredBatch({detail:{value:'1'}})
|
||||
assert.deepEqual(value.marks,['X'])
|
||||
assert.deepEqual(value.measuredSelections,{})
|
||||
value.prepareMeasuredBatch({detail:{value:'0'}})
|
||||
assert.deepEqual(value.marks,[])
|
||||
Object.assign(value, { measuredBoxChoices: [{ cartonMark: 'A' }], eligibleItems: [{ cartonMark: 'X' }],
|
||||
selectedSource: { movablePackages: 1 }, fillBatch() { this.marks = ['X'] } })
|
||||
value.prepareMeasuredBatch({ detail: { value: '1' } })
|
||||
assert.deepEqual(value.marks, ['X'])
|
||||
value.prepareMeasuredBatch({ detail: { value: '0' } })
|
||||
assert.deepEqual(value.marks, [])
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user