Add editable cutting rules
This commit is contained in:
@@ -70,6 +70,38 @@ test('buildCutPlan subtracts open production quantity from suggested cut need',
|
||||
assert.equal(row.suggestedCutQuantity, 20);
|
||||
});
|
||||
|
||||
test('buildCutPlan estimates rolls when a family yield is configured', () => {
|
||||
const plan = buildCutPlan([product({})], range, 14, {}, { familyYields: { BLCS: 50 } });
|
||||
const [row] = plan.needRows;
|
||||
|
||||
assert.equal(row.suggestedCutQuantity, 120);
|
||||
assert.equal(row.estimatedRolls, 3);
|
||||
assert.deepEqual(row.issues, []);
|
||||
assert.equal(plan.summary.estimatedRolls, 3);
|
||||
});
|
||||
|
||||
test('buildCutPlan applies per-product planning overrides', () => {
|
||||
const plan = buildCutPlan([
|
||||
product({
|
||||
id: 'SKU-2',
|
||||
name: 'BONÉ PRETO',
|
||||
quantitySold: 70,
|
||||
stock: 0
|
||||
})
|
||||
], range, 7, {}, {
|
||||
familyYields: { BLCS: 35 },
|
||||
productOverrides: {
|
||||
'SKU-2': { familyKey: 'BLCS', color: 'Preto', size: 'M' }
|
||||
}
|
||||
});
|
||||
|
||||
assert.equal(plan.needRows[0].family.key, 'BLCS');
|
||||
assert.equal(plan.needRows[0].color, 'Preto');
|
||||
assert.equal(plan.needRows[0].size, 'M');
|
||||
assert.equal(plan.needRows[0].estimatedRolls, 2);
|
||||
assert.deepEqual(plan.needRows[0].issues, []);
|
||||
});
|
||||
|
||||
test('buildOpenProductionByProductId matches open OPs by SKU and normalized product variant', () => {
|
||||
const products = [
|
||||
product({ id: 'SKU-1' }),
|
||||
|
||||
Reference in New Issue
Block a user