On hand Quantities&Transaction Qantiites

On hand Quantities&Transaction Qantiites

1.當前的庫存量

select MOH.ORGANIZATION_ID,
MOH.SUBINVENTORY_CODE,
MOH.INVENTORY_ITEM_ID,
SUM(MOH.PRIMARY_TRANSACTION_QUANTITY) ONHAND_QTY,
(SELECT SUM(MMT.TRANSACTION_QUANTITY)
FROM MTL_MATERIAL_TRANSACTIONS MMT
WHERE MMT.INVENTORY_ITEM_ID=MOH.INVENTORY_ITEM_ID
AND MMT.SUBINVENTORY_CODE=MOH.SUBINVENTORY_CODE
AND MMT.ORGANIZATION_ID=MOH.ORGANIZATION_ID
) A
from MTL_ONHAND_QUANTITIES_DETAIL moh
WHERE MOH.ORGANIZATION_ID=X
GROUP BY MOH.ORGANIZATION_ID, MOH.SUBINVENTORY_CODE,
MOH.INVENTORY_ITEM_ID

2.庫存異動數量

SELECT MMT.ORGANIZATION_ID,
MMT.INVENTORY_ITEM_ID,
MMT.SUBINVENTORY_CODE,
ITEMB.SEGMENT1 AS "item",
SUM(MMT.TRANSACTION_QUANTITY) TRANS_QTY
FROM MTL_MATERIAL_TRANSACTIONS MMT,
MTL_SYSTEM_ITEMS_B ITEMB
WHERE 1=1
AND MMT.ORGANIZATION_ID=ITEMB.ORGANIZATION_ID
AND MMT.INVENTORY_ITEM_ID=ITEMB.INVENTORY_ITEM_ID
AND MMT.ORGANIZATION_ID=X
GROUP BY MMT.ORGANIZATION_ID,
MMT.INVENTORY_ITEM_ID,
MMT.SUBINVENTORY_CODE,
ITEMB.SEGMENT1

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/41594/viewspace-50523/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/41594/viewspace-50523/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值