From 1bd1061c60c286e3b2216a67090c4976c9c7b35f Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期六, 18 四月 2026 17:50:29 +0800
Subject: [PATCH] 出入库扫码

---
 src/pages/inventoryManagement/scanOut/scanOut.logic.ts |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/src/pages/inventoryManagement/scanOut/scanOut.logic.ts b/src/pages/inventoryManagement/scanOut/scanOut.logic.ts
index 05213fa..bd30c63 100644
--- a/src/pages/inventoryManagement/scanOut/scanOut.logic.ts
+++ b/src/pages/inventoryManagement/scanOut/scanOut.logic.ts
@@ -13,16 +13,23 @@
 }
 
 export function parseRemainingQuantity(row: AnyRow): number | null {
-  const remRaw =
-    row?.remainingQuantity ??
-    row?.remaining_quantity ??
-    row?.remainQuantity ??
-    row?.remain_quantity;
+  const remRaw = row?.remainingQuantity;
   return parseOptionalNumber(remRaw);
 }
 
-export function defaultStockedQuantityFromRow(row: AnyRow): string {
-  const rem = parseRemainingQuantity(row);
+export function parseRemainingShippedQuantity(row: AnyRow): number | null {
+  const remRaw = row?.remainingShippedQuantity;
+  return parseOptionalNumber(remRaw);
+}
+
+export function defaultStockedQuantityFromRow(
+  row: AnyRow,
+  scene: "inbound" | "outbound" = "inbound"
+): string {
+  const rem =
+    scene === "outbound"
+      ? parseRemainingShippedQuantity(row) ?? parseRemainingQuantity(row)
+      : parseRemainingQuantity(row) ?? parseRemainingShippedQuantity(row);
   if (rem !== null) return String(Math.max(0, rem));
 
   const avail = parseOptionalNumber(row?.availableQuality ?? row?.availableQuantity);
@@ -65,9 +72,9 @@
 
 export function buildSalesLedgerProductList(recordList: AnyRow[]): AnyRow[] {
   return recordList.map((item: AnyRow) => {
-    const n = parseOptionalNumber(item.stockedQuantity);
+    const n = parseOptionalNumber(item.operateQuantity);
     const qty = n !== null && !Number.isNaN(n) ? Math.max(0, n) : 0;
-    const { stockedQuantity: _sq, ...rest } = item;
+    const { operateQuantity: _oq, ...rest } = item;
     return { ...rest, stockedQuantity: qty };
   });
 }

--
Gitblit v1.9.3