| | |
| | | const items = res.data || []; |
| | | processRouteItemsOptions.value = items; |
| | | |
| | | // 自动添加工序 |
| | | // 自动添加工序,计划数使用基本信息的需求数量 |
| | | const demandQty = formState.value.quantity || 1; |
| | | processRouteItems.value = items.map(item => ({ |
| | | processId: item.processId, |
| | | processName: item.processName, |
| | |
| | | userPower: item.userPower ? item.userPower.split(',') : [], |
| | | planStartTime: "", |
| | | planEndTime: "", |
| | | planNum: 1, |
| | | planNum: demandQty, |
| | | isQuality: item.isQuality || false, |
| | | })); |
| | | }); |
| | |
| | | } |
| | | }, { deep: true }); |
| | | |
| | | // 监听需求数量变化,重新计算物料需求数量 |
| | | // 监听需求数量变化,重新计算物料需求数量和工序计划数 |
| | | watch(() => formState.value.quantity, (newQty) => { |
| | | // 更新物料清单的需求数量 |
| | | if (productStructureRecords.value.length > 0 && newQty) { |
| | | productStructureRecords.value.forEach(item => { |
| | | item.demandedQuantity = (item.unitQuantity || 1) * newQty; |
| | | }); |
| | | } |
| | | // 更新工序的计划数 |
| | | if (processRouteItems.value.length > 0 && newQty) { |
| | | processRouteItems.value.forEach(item => { |
| | | item.planNum = newQty; |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | // 单位产出需要数量变化处理 |