| | |
| | | details = await getProductReceiptDetailListByLineId(line.id!); |
| | | detailMap[line.id!] = details; |
| | | } |
| | | // 勾选入库的行必须已有上架明细,且明细数量之和等于行收货数量 |
| | | if (!details.length) { |
| | | message.error(`物料「${line.itemName}」已勾选入库,请先添加上架明细`); |
| | | return; |
| | | } |
| | | const lineQty = Number(line.quantity ?? 0); |
| | | const sumQty = details.reduce( |
| | | (acc, detail) => acc + Number(detail.quantity ?? 0), |
| | | 0, |
| | | ); |
| | | if (lineQty !== sumQty) { |
| | | message.error( |
| | | `物料「${line.itemName}」上架明细数量之和(${sumQty})与收货数量(${lineQty})不一致`, |
| | | ); |
| | | return; |
| | | } |
| | | row.details = details.map((detail) => ({ |
| | | warehouseId: detail.warehouseId!, |
| | | locationId: detail.locationId!, |