| | |
| | | <!-- 发货弹框 --> |
| | | <el-dialog v-model="deliveryFormVisible" |
| | | title="发货信息" |
| | | width="40%" |
| | | width="70%" |
| | | @close="closeDeliveryDia"> |
| | | <el-form :model="deliveryForm" |
| | | label-width="120px" |
| | |
| | | const batchNoList = await getDeliveryBatchNoList( |
| | | row.productModelId || row.modelId |
| | | ); |
| | | |
| | | // 自动分配发货数量:按照待发货数量,从上到下依次分配 |
| | | const noQuantity = Number(row?.noQuantity || 0); |
| | | let remainingQuantity = noQuantity; |
| | | batchNoList.forEach(item => { |
| | | if (remainingQuantity <= 0) { |
| | | item.deliveryQuantity = 0; |
| | | return; |
| | | } |
| | | const batchStockQuantity = getDeliveryBatchQuantity(item); |
| | | // 当前批次可分配的数量:取剩余待发货数量和库存数量的较小值 |
| | | const assignQuantity = Math.min(remainingQuantity, batchStockQuantity); |
| | | item.deliveryQuantity = assignQuantity; |
| | | remainingQuantity -= assignQuantity; |
| | | }); |
| | | |
| | | deliveryForm.value = { |
| | | shippingCarNumber: "", |
| | | expressCompany: "", |