优化
This commit is contained in:
@@ -28,7 +28,7 @@ test('废弃来源包含通用仓位,选择后带出全部库存且不把选
|
||||
function selectionRows(boxes, selectedKeys) {
|
||||
const body = view.match(/function syncDiscardSelection\(\) \{([\s\S]*?)\n\}/)[1].replace('new Map<string, CargoRow>()', 'new Map()')
|
||||
const rows = { value: [] }
|
||||
new Function('discardSelectableBoxes', 'discardSelectedBoxKeys', 'cargoRows', 'createCargoRow', body)({ value: boxes }, { value: selectedKeys }, rows, () => ({}))
|
||||
new Function('discardSourceBoxes', 'discardSelectedBoxKeys', 'cargoRows', 'createCargoRow', body)({ value: boxes }, { value: selectedKeys }, rows, () => ({}))
|
||||
return rows.value
|
||||
}
|
||||
test('部分废弃只提交勾选的箱子,数量由箱子汇总,清空后无明细', () => {
|
||||
@@ -48,3 +48,12 @@ test('混合SKU箱按实物箱只计一次,退货箱仍整箱携带全部SKU',
|
||||
const returnRows = selectionRows([{ key: 'RETURN_CARTON:2', cartonId: '2', source: returned, skus }], ['RETURN_CARTON:2'])
|
||||
assert.deepEqual(returnRows.map(row => row.quantity), [2, 3]); assert.ok(returnRows.every(row => row.returnCartonId === '2' && row.discardCartonIds === undefined))
|
||||
})
|
||||
|
||||
test('通用混箱同仓位保留全部SKU,跨仓位相同SKU保持独立来源', () => {
|
||||
const skus = [{ skuCode: 'A', availablePackages: 1 }, { skuCode: 'B', availablePackages: 1 }]
|
||||
const source = { orderId: null, inventoryPositionId: '42', sourceType: 'INVENTORY', availablePackages: 1, skus }
|
||||
const boxes = [{ key: 'INVENTORY:1', cartonId: '1', source, skus }, { key: 'INVENTORY:2', cartonId: '2', source: { ...source, inventoryPositionId: '43' }, skus: [skus[0]] }]
|
||||
const rows = selectionRows(boxes, ['INVENTORY:1', 'INVENTORY:2'])
|
||||
assert.equal(rows.length, 3)
|
||||
assert.deepEqual(rows.map(row => [row.sourceInventoryPositionId, row.sku, row.quantity, row.discardCartonIds]), [['42', 'A', 1, ['1']], ['42', 'B', 1, ['1']], ['43', 'A', 1, ['2']]])
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user