diff --git a/inventory-backend/app/api/v1/transactions.py b/inventory-backend/app/api/v1/transactions.py index 44c795c..15735e8 100644 --- a/inventory-backend/app/api/v1/transactions.py +++ b/inventory-backend/app/api/v1/transactions.py @@ -281,7 +281,14 @@ def dispatch_borrow(): 执行借库扣减 请求体: { approval_id: int, // 关联的审批单ID - items: [...], // 扫码选中的库存物品(含 id, source_table, out_quantity) + items: [ // 扫码选中的库存物品 + { + id: int, // 库存主键(按 source_table 路由到 StockBuy/StockSemi/StockProduct) + source_table: str, // 'stock_buy' | 'stock_semi' | 'stock_product' + sku: str, // 用于按 (source_table, sku) 与审批单做超额交叉校验 + out_quantity: float + } + ], borrower_name: str, signature_path: str, remark: str, diff --git a/inventory-web/src/views/transaction/borrow.vue b/inventory-web/src/views/transaction/borrow.vue index 857850c..7e8ee1e 100644 --- a/inventory-web/src/views/transaction/borrow.vue +++ b/inventory-web/src/views/transaction/borrow.vue @@ -556,7 +556,7 @@ const submitForm = async () => { if (isNaN(safeQty) || safeQty <= 0) safeQty = 1 return { - stock_id: item.id || 0, + id: item.id || 0, source_table: item.source_table || '', sku: item.sku ? String(item.sku) : (item.barcode ? String(item.barcode) : 'NO_SKU'), barcode: item.barcode ? String(item.barcode) : '',