ITPub博客

首页 > Linux操作系统 > Linux操作系统 > On hand Quantities&Transaction Qantiites

On hand Quantities&Transaction Qantiites

原创 Linux操作系统 作者:jarli 时间:2019-04-27 11:21:05 0 删除 编辑
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/,如需转载,请注明出处,否则将追究法律责任。

上一篇: User&Responsibility
下一篇: Item
请登录后发表评论 登录
全部评论

注册时间:2003-03-27

  • 博文量
    227
  • 访问量
    162828