備貨的數(shù)量字段定義及計(jì)算 如下:
1)sbiQty 備貨數(shù)量
2)sbiOutQty 已出庫(kù)數(shù)量:已被訂單鎖定且訂單已經(jīng)出庫(kù)的數(shù)量
3)sbiNoHoldQty 非鎖定數(shù)量:生成了采購(gòu)申請(qǐng)未下采購(gòu)訂單的數(shù)量+備貨被解鎖出來(lái)的數(shù)量
select sum(preqty) from purchaserequisition where presellbufferitemid = sbiItemID and prepurchaseorderitemid is null
4)sbiNoorderHoldQty 未有銷售訂單鎖定數(shù)量:
在途鎖定和在庫(kù)鎖定中沒(méi)有同時(shí)被銷售訂單鎖定的數(shù)量和,另外一種描述是:在途和在庫(kù)的鎖定表中僅僅只是備貨本身的鎖定,沒(méi)有被訂單鎖住的數(shù)量之和
(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 已有銷售訂單鎖定數(shù)量:
在途鎖定和在庫(kù)鎖定中同時(shí)被銷售訂單鎖定的數(shù)量和
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 取消數(shù)量:
當(dāng)備貨在狀態(tài)維護(hù)頁(yè)面進(jìn)行取消時(shí),系統(tǒng)會(huì)根據(jù)備貨數(shù)量-備貨已有訂單鎖定數(shù)量-備貨未有訂單鎖定數(shù)量-備貨已出庫(kù)數(shù)量-備貨非鎖定數(shù)量,計(jì)算出備貨取消鎖定數(shù)量,同時(shí)標(biāo)記備貨的狀態(tài)為取消狀態(tài)
7)sbiOrderQty 已開(kāi)銷售訂單數(shù)量:目前這個(gè)字段沒(méi)有用過(guò),系統(tǒng)中所有的該字段的值都為0
以上數(shù)量字段的綜合計(jì)算公式:
sbiOutQty =sbiQty - sbiOrderHoldQty - sbiNoorderHoldQty -sbiNoHoldQty