備貨的數量字段定義及計算 如下:
1)sbiQty 備貨數量
2)sbiOutQty 已出庫數量:已被訂單鎖定且訂單已經出庫的數量
3)sbiNoHoldQty 非鎖定數量:生成了采購申請未下采購訂單的數量+備貨被解鎖出來的數量
select sum(preqty) from purchaserequisition where presellbufferitemid = sbiItemID and prepurchaseorderitemid is null
4)sbiNoorderHoldQty 未有銷售訂單鎖定數量:
在途鎖定和在庫鎖定中沒有同時被銷售訂單鎖定的數量和,另外一種描述是:在途和在庫的鎖定表中僅僅只是備貨本身的鎖定,沒有被訂單鎖住的數量之和
(ISNULL((select sum(phiHoldQty) from ProductHoldInventory where phiSellBufferItemID = sbiItemid and phiSellOrderItemID is null),0)+ISNULL((select sum(phooHoldQty) from ProductHoldOnOrder where phooSellBufferItemID = sbiItemid and phooSellOrderItemID is null),0))
5)sbiOrderHoldQty 已有銷售訂單鎖定數量:
在途鎖定和在庫鎖定中同時被銷售訂單鎖定的數量和
ISNULL((select sum(phiHoldQty) from ProductHoldInventory where phiSellBufferItemID = sbiItemid and phiSellOrderItemID is not null),0) +ISNULL((select sum(phooHoldQty) from ProductHoldOnOrder where phooSellBufferItemID = sbiItemid and phooSellOrderItemID is not null),0))
6)sbiCancelQty 取消數量:
當備貨在狀態維護頁面進行取消時,系統會根據備貨數量-備貨已有訂單鎖定數量-備貨未有訂單鎖定數量-備貨已出庫數量-備貨非鎖定數量,計算出備貨取消鎖定數量,同時標記備貨的狀態為取消狀態
7)sbiOrderQty 已開銷售訂單數量:目前這個字段沒有用過,系統中所有的該字段的值都為0
以上數量字段的綜合計算公式:
sbiOutQty =sbiQty - sbiOrderHoldQty - sbiNoorderHoldQty -sbiNoHoldQty