先查詢出實際的完工數量

select sum(mmt.TRANSACTION_QUANTITY)
from apps.mtl_material_transactions mmt
where mmt.ORGANIZATION_ID=***
and mmt.TRANSACTION_SOURCE_ID=wip_entity_id and mmt.TRANSACTION_TYPE_ID in(17,44) --wip裝配件完成及裝配件退回
and mmt.SUBINVENTORY_CODE='***'

同時查看mtl_transaction_accounts 表中的財務資訊是否正確

select *
from apps.mtl_transaction_accounts mta
where mta.TRANSACTION_ID in
(
select mmt.TRANSACTION_ID
from apps.mtl_material_transactions mmt
where mmt.ORGANIZATION_ID=***
and mmt.TRANSACTION_SOURCE_ID=***--作業id
and mmt.TRANSACTION_TYPE_ID in(17,44)
)



最後更新:

update wip_discrete_jobs
set quantity_completed = 實際完成數量
status_type = 4,
date_completed = sysdate
where wip_entity_id = ***

 

arrow
arrow
    全站熱搜

    oracleD2K 發表在 痞客邦 留言(0) 人氣()