|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622 。
您需要 登录 才可以下载或查看,没有帐号?注册
x
select mtl.segment1 item_num, --物料编码
mtl.description item_name, --物料名称
to_char(mmt.transaction_date,'YYYY-MM-DD') transaction_date,
decode(mmt.owning_tp_type,1,'寄销','普通') cashYN, ---判断是否是供应商资产
decode(mmt.owning_tp_type,1,pov.SEGMENT1,'83') vendor_num, ---供应商编号
decode(mmt.owning_tp_type,1,pov.VENDOR_NAME,'某茶应商') vendor_name, --供应商名称
mmt.transaction_uom, ---单位
mmt.transaction_source_id,
mmt.TRANSACTION_SOURCE_NAME,
mty.transaction_type_name, ---事务处理类型
mty.description, ---事务处理类型说明
mfl.MEANING,
mmt.subinventory_code SUB_NUM_FM, ---来源子库
msub.description SUB_NUM_FM, ---来源子库名称
msub.attribute2 sub_admin, ---库管员
mmt.transfer_subinventory SUB_NUM_TO, ---目标子库存
msub2.description SUB_NAME_TO, --目标子库存名称
case when mmt.transaction_quantity>0 then '入库' else '出库' end mtl_type, ---事务处理进出类型
mmt.transaction_quantity qty ----数量
from Mtl_System_Items_b mtl,
MTL_TRANSACTION_TYPES mty,
mtl_material_transactions mmt,
AP_SUPPLIER_SITES_ALL PVS,
PO_VENDORS pov,
MTL_SECONDARY_INVENTORIES MSUB,
MTL_SECONDARY_INVENTORIES MSUB2,
MFG_LOOKUPS mfl
where mtl.inventory_item_id = mmt.inventory_item_id
and mtl.organization_id = msub.organization_id
and mmt.TRANSACTION_ACTION_ID NOT IN (24, 30)
and mmt.transaction_type_id = mty.transaction_type_id
and pov.VENDOR_ID = pvs.VENDOR_ID
and pvs.VENDOR_SITE_ID = decode(mmt.owning_tp_type,2,mmt.owning_organization_id, &P_ORGID)
and mmt.subinventory_code = MSUB.Secondary_Inventory_Name
and mfl.LOOKUP_TYPE = 'MTL_TRANSACTION_ACTION'
and mmt.transaction_action_id=mfl.LOOKUP_CODE
and mmt.transfer_subinventory=msub2.secondary_inventory_name(+)
and mmt.organization_id=msub2.organization_id(+)
--and mmt.owning_tp_type = 1 ---区分寄销跟普通件物料
and mtl.organization_id = nvl(&P_ORGID,mtl.organization_id)
and mtl.segment1 between nvl(&P_item_fm, mtl.segment1) and nvl(&P_item_to, mtl.segment1)
and mmt.subinventory_code between nvl(&P_SUB_FM, mmt.subinventory_code) and nvl(&P_SUB_TO, mmt.subinventory_code)
and to_date(to_char(mmt.TRANSACTION_DATE, 'yyyy-mm-dd'), 'yyyy-mm-dd') between
to_date(nvl(&P_DATE_FM, '2999-12-12'), 'yyyy-mm-dd') and to_date(nvl(&P_DATE_TO, '2999-12-12'), 'yyyy-mm-dd')
该贴已经同步到 dwtxkj的微博 |
|