ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 查询上下阶bom之SQL

查询上下阶bom之SQL

原创 Linux操作系统 作者:jarli 时间:2019-07-17 16:36:01 0 删除 编辑
此sql对于erp上线初期特别有用,测试bom是否有问题
SELECT MSI.SEGMENT1 ASSEMBLY,
MSI.PRIMARY_UNIT_OF_MEASURE Uom,
MIR.REVISION,
BIC.ITEM_NUM,
BIC.OPERATION_SEQ_NUM,
ITEM.SEGMENT1 ITEM,
ITEM.DESCRIPTION "Item Description",
MIR1.REVISION "Item Revision",
ITEM.PRIMARY_UNIT_OF_MEASURE "Item UOM",
BIC.COMPONENT_QUANTITY,
BIC.EFFECTIVITY_DATE,
BIC.DISABLE_DATE,
BIC.COMPONENT_YIELD_FACTOR,
MCL.MEANING "Type",
ITEM.INVENTORY_ITEM_STATUS_CODE "Status",
ML.MEANING WIP_SUPPLY_TYPE,
BIC.SUPPLY_SUBINVENTORY
FROM BOM_BILL_OF_MATERIALS BOM,
BOM_INVENTORY_COMPONENTS BIC,
MTL_SYSTEM_ITEMS_B MSI,
FND_COMMON_LOOKUPS MCL,
MTL_ITEM_REVISIONS MIR,
MTL_SYSTEM_ITEMS_B ITEM,
MTL_ITEM_REVISIONS MIR1,
MFG_LOOKUPS ML
WHERE BOM.ORGANIZATION_ID=X(代表厂别)
AND BOM.BILL_SEQUENCE_ID=BIC.BILL_SEQUENCE_ID
AND ((TO_CHAR(BIC.EFFECTIVITY_DATE,'yyyy-mm-dd')<=TO_CHAR(SYSDATE,'yyyy-mm-dd')
AND (BIC.DISABLE_DATE IS NULL OR TO_CHAR(BIC.DISABLE_DATE,'yyyy-mm-dd')>=TO_CHAR(SYSDATE,'yyyy-mm-dd'))
)
OR
(TO_CHAR(BIC.EFFECTIVITY_DATE,'yyyy-mm-dd')>=TO_CHAR(SYSDATE,'yyyy-mm-dd') AND BIC.CHANGE_NOTICE IS NOT
NULL )
)
AND TO_CHAR(BIC.IMPLEMENTATION_DATE,'yyyy-mm-dd')<=TO_CHAR(SYSDATE,'yyyy-mm-dd')
AND BOM.ALTERNATE_BOM_DESIGNATOR IS NULL
AND BOM.ORGANIZATION_ID=MSI.ORGANIZATION_ID
AND BOM.ASSEMBLY_ITEM_ID=MSI.INVENTORY_ITEM_ID
AND MSI.INVENTORY_ITEM_ID=MIR.INVENTORY_ITEM_ID
AND MSI.ORGANIZATION_ID=MIR.ORGANIZATION_ID
AND BIC.COMPONENT_ITEM_ID=ITEM.INVENTORY_ITEM_ID
AND MSI.ORGANIZATION_ID=ITEM.ORGANIZATION_ID
AND ITEM.INVENTORY_ITEM_ID=MIR1.INVENTORY_ITEM_ID
AND ITEM.ORGANIZATION_ID=MIR1.ORGANIZATION_ID
AND MCL.LOOKUP_TYPE='ITEM_TYPE'
AND MCL.LOOKUP_CODE=ITEM.ITEM_TYPE
AND ML.LOOKUP_TYPE='WIP_SUPPLY'
AND ML.LOOKUP_CODE=BIC.WIP_SUPPLY_TYPE
ORDER BY MSI.SEGMENT1,BIC.ITEM_NUM,ITEM.SEGMENT1

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

请登录后发表评论 登录
全部评论

注册时间:2003-03-27

  • 博文量
    227
  • 访问量
    161490