EBS ORACLE工单齐套率的计算程序
PROCEDURE Get_wip_accept_item_date(p_use_id in number,
p_org_id IN NUMBER,
p_start_date IN DATE,
p_end_date IN DATE)
is
cursor accept_cursor(p_org number, p_inventory_item_id number) is
select wro.required_quantity,
wro.quantity_issued,
wro.quantity_per_assembly,
wro.wip_entity_id,
wro.organization_id,
wro.inventory_item_id,
wro.required_quantity - NVL(wro.quantity_issued, 0) quantity,
wdj.description
-- wro.mps_required_quantity quantity --净需求
from wip_discrete_jobs wdj, wip_requirement_operations wro
where wdj.wip_entity_id = wro.wip_entity_id
and wdj.organization_id = wro.organization_id
and wro.inventory_item_id = p_inventory_item_id
and wro.organization_id = nvl(p_org, wro.organization_id)
and wdj.status_type in (1, 3) --已发放,未发放
and wdj.class_code not in ('BLA2', 'BLP2')
and wro.wip_supply_type!=6
and wro.required_quantity > NVL(wro.quantity_issued, 0)
-- and wro.date_required between p_start_date and p_end_date
and wdj.scheduled_start_date between p_start_date and p_end_date --modify by lmh0525
-- and wdj.wip_entity_id=169287
--and wro.inventory_item_id =20360
order by wdj.scheduled_start_date
;
--进检
cursor jinjian_cursor(p_org number,
p_inventory_item_id number,
p_tran_id number) is
SELECT RT.TRANSACTION_DATE,
rt.quantity -
nvl(CUX_INV_ARRIVE_ITEM_DATE_new.get_deliver_qty(rt.transaction_id),0) -
nvl(CUX_INV_ARRIVE_ITEM_DATE_new.get_reject_qty(rt.transaction_id),0) -
nvl(tt.qty,0) quantity,
rt.quantity fyquantity,
nvl(CUX_INV_ARRIVE_ITEM_DATE_new.get_reject_qty(rt.transaction_id),0) reject_qty,
rt.transaction_id
FROM RCV_TRANSACTIONS RT,
po_lines_all pll,
(select object_id, sum(quantity) qty
from WIP.CUX_QUANTITY_STATUS
where request_id = p_tran_id
and status='T6'
and Create_By =p_use_id
group by object_id) tt
WHERE RT.TRANSACTION_TYPE = 'RECEIVE'
and rt.po_line_id = pll.po_line_id
and pll.item_id = p_inventory_item_id
and rt.organization_id = p_org
and rt.transaction_id = tt.object_id(+)
and rt.quantity -
nvl(CUX_INV_ARRIVE_ITEM_DATE_new.get_deliver_qty(rt.transaction_id),0) -
nvl(CUX_INV_ARRIVE_ITEM_DATE_new.get_reject_qty(rt.transaction_id),0) -
nvl(tt.qty, 0) > 0
order by RT.TRANSACTION_DATE;
---在途 ship
cursor shipment_cursor(p_org_id number,
p_item_id number,
p_tran_id number) is
SELECT a.Shipment_Line_Id,
a.EXPECTED_RECEIPT_DATE, --预计到货时间*/
a.QUANTITY_SHIPPED - a.QUANTITY_RECEIVED - nvl(tt.qty,0) quantity
FROM MEG_CUX_PO_SHIPMENT_V a,
(select object_id, sum(quantity) qty
from WIP.CUX_QUANTITY_STATUS
where request_id = p_tran_id
and status='SHIP'
and Create_By =p_use_id
group by object_id) tt
WHERE RECEVIED_FLAG = '1'
and SHIP_TO_ORGANIZATION_ID = p_org_id
and ITEM_ID = p_item_id
and a.STAGE <> 'INTERFACE'
and a.Shipment_Line_Id = tt.object_id(+)
and a.QUANTITY_SHIPPED - a.QUANTITY_RECEIVED - nvl(tt.qty,0) > 0;
--采购
cursor po_cursor(p_org_id number, p_item_id number, p_tran_id number) is
SELECT pll.line_location_id,
pll.need_by_date, --需求日期
pll.promised_date, --承诺日期
pll.creation_date, --下单日期
(case when pll.promised_date is null then 'N'
ELSE 'Y' end ) Trflase,--是否更新承诺日期
decode(pll.closed_code,
'CLOSED FOR RECEIVING',
decode(sign(PLL.QUANTITY - PLL.QUANTITY_CANCELLED -
pll.quantity_received),
1,
pll.quantity_received,
PLL.QUANTITY - PLL.QUANTITY_CANCELLED),
PLL.QUANTITY - PLL.QUANTITY_CANCELLED) -
nvl(rsp.QUANTITY_SHIPPED, 0) - nvl(pll.quantity_received, 0) -
nvl(t3.qty, 0) quantity,
decode(nvl(pll.po_release_id, 0),
0,
pha.segment1,
pha.segment1 || '-' || pra.release_num) PO_NO,
PLA.LINE_NUM,PLL.SHIPMENT_NUM,
pv.VENDOR_NAME,nvl(pv.VENDOR_NAME_ALT, pv.VENDOR_NAME) VENDOR_NAME_ALT
FROM po_line_locations_all PLL,
PO_LINES_ALL PLA,
(SELECT a.PO_LINE_LOCATION_ID,
sum(nvl(QUANTITY_SHIPPED, 0) -
nvl(QUANTITY_RECEIVED, 0)) QUANTITY_SHIPPED
FROM MEG_CUX_PO_SHIPMENT_V a
WHERE a.RECEVIED_FLAG = '1'
group by a.PO_LINE_LOCATION_ID) rsp,
(select object_id, sum(quantity) qty
from WIP.CUX_QUANTITY_STATUS cqs
where cqs.status='PO'
AND request_id = p_tran_id
and Create_By =p_use_id
group by object_id) t3,
po_headers_all pha,
po_releases_all pra,
po_vendors pv
WHERE 1 = 1
AND PLL.PO_HEADER_ID = PLA.PO_HEADER_ID
AND PLL.PO_LINE_ID = PLA.PO_LINE_ID
AND pll.line_location_id = rsp.PO_LINE_LOCATION_ID(+)
and pll.shipment_type <> 'PRICE BREAK'
and nvl(pll.closed_code, 'OPEN') not in
('CLOSED', 'FINALLY CLOSED')
AND pla.item_id = p_item_id
and decode(pll.closed_code,
'CLOSED FOR RECEIVING',
decode(sign(PLL.QUANTITY - PLL.QUANTITY_CANCELLED -
pll.quantity_received),
1,
pll.quantity_received,
PLL.QUANTITY - PLL.QUANTITY_CANCELLED),
PLL.QUANTITY - PLL.QUANTITY_CANCELLED) -
nvl(rsp.QUANTITY_SHIPPED, 0) - nvl(pll.quantity_received, 0) -
nvl(t3.qty,0) > 0
and pll.ship_to_organization_id = p_org_id
and pll.line_location_id = t3.object_id(+)
and pha.po_header_id = pll.po_header_id
and pha.org_id = pll.org_id
and pll.po_release_id = pra.po_release_id(+)
and pll.org_id = pra.org_id(+)
and pha.vendor_id = pv.VENDOR_ID
order by pll.promised_date;
--PR数量
cursor pr_cursor(p_org_id number, p_item_id number, p_tran_id number) is
select prh.requisition_header_id,
prl.quantity - nvl(prl.quantity_cancelled, 0) quantity,
prh.creation_date creation_date,
prh.description --
from po_requisition_headers_all prh,
po_requisition_lines_all prl,
mtl_system_items_b msi,
(select object_id, sum(quantity) qty
from WIP.CUX_QUANTITY_STATUS
where request_id = p_tran_id
AND status='PR'
and Create_By =p_use_id
group by object_id) tt
where prl.item_id = msi.inventory_item_id
and prh.requisition_header_id = prl.requisition_header_id
and prl.destination_organization_id = msi.organization_id
and prl.destination_organization_id=p_org_id
and prl.item_id =p_item_id
and prh.requisition_header_id = tt.object_id(+)
and prl.reqs_in_pool_flag ='Y'
and nvl(prl.cancel_flag, 'N')= 'N'
order by prh.creation_date ;
--获取料号
cursor org_item is
select wro.organization_id, wro.inventory_item_id
from wip_discrete_jobs wdj, wip_requirement_operations wro
where wdj.wip_entity_id = wro.wip_entity_id
and wdj.organization_id = wro.organization_id
and wro.organization_id = nvl(p_org_id, wro.organization_id)
and wdj.status_type in (1, 3)
and wdj.class_code not in ('BLA2', 'BLP2')
and wro.required_quantity > NVL(wro.quantity_issued, 0)
--and wro.date_required between p_start_date and p_end_date
and wdj.scheduled_start_date between p_start_date and p_end_date
and wro.wip_supply_type!=6
-- and wdj.wip_entity_id =172093
--and wro.inventory_item_id =20360
--and wro.inventory_item_id = 16750--直接测试某个料号 1213
--and wdj.wip_entity_id in (158327,168572,168577)
--and wro.inventory_item_id = 77234--直接测试某个料号 1213
group by wro.organization_id,
wro.inventory_item_id
;
--dbms_output.put_line('开始'||to_date(p_start_date,'YYYY-MM-DD'));
x_quantity_recv number; -- 合计进检
--x_quantity_stock number; -- 合计库存
x_quantity_ship number; --合计发运
x_quantity_on_order number; -- 合计在途
x_req_qty number;
-- x_quantity_issued number;
x_req_date date;
x_status varchar2(20);
x_subinventory_code varchar2(10);
stock_qty number := 0;
x_L21_ORGQTY number := 0;
p_tran_id number;
x_quantity number := 0; --不同状态对应的数量
x_sum_lack_quantity number := 0;
p_require_id number := 0;
x_inv_quantity number := 0;--需求数量
-- x_required_quantity number := 0;
x_po_no varchar2(50);
x_LINE_NUM number := 0; --行号
x_SHIPMENT_NUM number := 0; --发运号
x_p_vendor varchar2(50);--供应商
l_po_sumqty number := 0;--po总数量
x_sum_inv_check_qty number := 0;
x_pr_qty number := 0;
l_pr_sumqty number := 0;--PR总数量
x_tflase varchar2(20);
x_ship_qty number := 0;
--x_Shipment_Line_Id number := 0;--发运id
l_ent_pending number := 0;
l_nocheck_pending number := 0;
l_reject_qty number := 0;
l_line_location_id number := 0;
l_other_inv_qty number := 0;
x_other_wip_qty number := 0;
l_min_qty number :=0;
begin
delete from WIP.CUX_WIP_ACCEPT_ITEM_DATE where create_by =p_use_id;
delete from WIP.CUX_QUANTITY_STATUS where create_by =p_use_id ;
commit;
SELECT for_CUX_WIP_ACCEPT_ITEM_SEQ.NEXTVAL into p_require_id from dual; --作为请求的id
for l_c in org_item loop
begin
select SUBSTR(MOV.ORGANIZATION_CODE, 2, 2) ||
DECODE(mc.description,
'原材料',
'01',
'半成品/组件',
'02',
'成品',
'03',
'01')
into x_subinventory_code
from mtl_item_categories mic,
meg_cux_org_v mov,
mtl_categories_b mc
where mic.organization_id = mov.ORGANIZATION_ID
and mic.inventory_item_id = l_c.inventory_item_id
and mic.category_set_id = 1100000041
and mic.category_id = mc.category_id
and mc.structure_id = 50355
and mic.organization_id = l_c.organization_id;
-- dbms_output.put_line('组织:'||l_c.organization_id);
-- dbms_output.put_line('料号:'||l_c.inventory_item_id);
exception
when others then
null;
end;
--库存
/* x_quantity_stock := mg_comm_pub.get_inv_qty(l_c.inventory_item_id,
l_c.organization_id, --只考虑力慧组织
0);
*/
--可用库存
stock_qty := Cux_Inv_Arrive_Item_Date_New.get_inv_prdt1_qty(l_c.organization_id,
l_c.inventory_item_id);
x_inv_quantity :=stock_qty;
/* dbms_output.put_line('料号:'||l_c.inventory_item_id);
dbms_output.put_line('库存:'||stock_qty); */
x_L21_ORGQTY := cux_inv_arrive_item_date_NEW.get_inv_l21_prdt1_qty(l_c.inventory_item_id);
--stock_qty := x_quantity_stock;
--进检
x_quantity_recv := mg_comm_pub.get_po_on_order_inv(p_item_id => l_c.inventory_item_id,
p_org_id => l_c.organization_id,
p_subinventory_code => x_subinventory_code,
p_flag => 2);
-- dbms_output.put_line('进检:'||x_quantity_recv);
-- 发运
--x_sum_inv_check_qty :=stock_qty +x_quantity_recv; --库存+进检
x_quantity_ship := wwinv_pub_pkg.get_po_shipQty(p_item_id => l_c.inventory_item_id,
p_org_id => l_c.organization_id);
x_ship_qty :=x_quantity_ship;
--PO数量
x_quantity_on_order := mg_comm_pub.get_po_on_order_inv(p_item_id => l_c.inventory_item_id,
p_org_id => l_c.organization_id,
p_subinventory_code => x_subinventory_code,
p_flag => 0);
l_po_sumqty :=x_quantity_on_order;
--PR数量
x_pr_qty := cux_inv_arrive_item_date_new.get_pr_qty_by_item(l_c.organization_id,
l_c.inventory_item_id);
l_pr_sumqty :=x_pr_qty;
--进检待入库
l_ent_pending:=cux_inv_arrive_item_date_new.get_t6_noinv_by_item(l_c.organization_id,
l_c.inventory_item_id);
--待检数量
l_nocheck_pending:=cux_inv_arrive_item_date_new.get_re_nocheck_by_item(l_c.organization_id,
l_c.inventory_item_id);
l_reject_qty :=cux_inv_arrive_item_date_new.get_reject_qty_by_item(l_c.organization_id,
l_c.inventory_item_id);
l_other_inv_qty:=cux_inv_arrive_item_date_new.get_inv_other_prdt1_qty(l_c.organization_id,
l_c.inventory_item_id);
x_other_wip_qty:=cux_inv_arrive_item_date_new.get_wip_need_qty(l_c.organization_id,
l_c.inventory_item_id,
p_start_date,
p_end_date) ;
--最小订货量
l_min_qty:=cux_inv_arrive_item_date_new.get_min_order_qty(l_c.organization_id,
l_c.inventory_item_id);
-- end loop;
--x_quantity_stock 库存
for l_b in accept_cursor(l_c.organization_id, l_c.inventory_item_id) loop
-- x_req_qty : =l_b.quantity;
--库存 INV
x_req_qty := l_b.quantity;
if nvl(x_req_qty, 0) > 0 then
if stock_qty > 0 then
x_status := 'INV';
x_req_date := sysdate;
--x_inv_quantity :=stock_qty;
if nvl(x_req_qty, 0) <= stock_qty then
--库存满足需求数量
x_sum_lack_quantity :=stock_qty +x_quantity_recv-x_req_qty;--欠料情况
x_quantity := x_req_qty;
stock_qty := stock_qty - x_req_qty;
x_req_qty := 0;
else
x_sum_lack_quantity :=x_quantity_recv;--欠料情况
x_quantity := stock_qty;
x_req_qty := nvl(x_req_qty, 0) - nvl(stock_qty, 0);
stock_qty := 0;
end if;
CUX_INV_ARRIVE_ITEM_DATE_NEW.insert_ARRIVE_ITEM_DATE_COMMIT(l_c.inventory_item_id,
l_c.organization_id,
l_b.wip_entity_id,
p_require_id,
SYSDATE,
x_inv_quantity,
x_L21_ORGQTY,
l_b.required_quantity,
l_b.quantity_issued,
l_b.quantity,
-- x_req_qty,
x_sum_lack_quantity,
x_req_date,
x_status,
x_quantity,
p_use_id,
NULL,
null,
null,
null,
l_b.description,
l_other_inv_qty ,
x_other_wip_qty,
null,
l_min_qty);
CUX_INV_ARRIVE_ITEM_DATE_NEW.insert_report_status_commit(l_c.inventory_item_id,
l_c.organization_id,
l_b.wip_entity_id,
p_require_id,
x_status,
x_quantity,
x_req_date,
p_require_id,
p_use_id );
end if;
end if;
--进检 T6
if nvl(x_req_qty, 0) > 0 then
-- dbms_output.put_line('需求数量:'||x_req_qty);
if x_quantity_recv > 0 then
for l_jinjian in jinjian_cursor(l_c.organization_id,
l_c.inventory_item_id,
p_require_id) loop
--if x_req_qty < x_quantity_recv then
x_status := 'T6';
x_req_date := l_jinjian.transaction_date +
CUX_INV_ARRIVE_ITEM_DATE_NEW.get_preprocessing_leadtime(l_c.organization_id,
l_c.inventory_item_id,
3);
-- x_inv_quantity :=stock_qty;
-- l_reject_qty :=l_jinjian.reject_qty;
if x_req_qty < l_jinjian.quantity then
x_sum_lack_quantity :=x_sum_lack_quantity-x_req_qty;
-- x_quantity_recv := l_jinjian.quantity - x_req_qty;
x_quantity_recv := x_quantity_recv - x_quantity;
x_quantity := x_req_qty;
x_req_qty := 0; --进检满足需求
else
x_sum_lack_quantity :=x_sum_lack_quantity-l_jinjian.quantity;
x_quantity := l_jinjian.quantity;
-- x_quantity_recv := x_quantity_recv - x_quantity;
x_req_qty := x_req_qty - x_quantity;
x_quantity_recv := 0;
end if;
CUX_INV_ARRIVE_ITEM_DATE_NEW.insert_ARRIVE_ITEM_DATE_COMMIT(l_c.inventory_item_id,
l_c.organization_id,
l_b.wip_entity_id,
p_require_id,
SYSDATE,
x_inv_quantity,
x_L21_ORGQTY,
l_b.required_quantity,
l_b.quantity_issued,
l_b.quantity,
x_sum_lack_quantity,
x_req_date,
x_status,
x_quantity,
p_use_id,
NULL,
l_ent_pending,
l_nocheck_pending,
l_reject_qty,
l_b.description,
l_other_inv_qty,
x_other_wip_qty,
null,
l_min_qty);
--插入记录表
CUX_INV_ARRIVE_ITEM_DATE_NEW.insert_report_status_commit(l_c.inventory_item_id,
l_c.organization_id,
l_b.wip_entity_id,
l_jinjian.transaction_id,
x_status,
x_quantity,
x_req_date,
p_require_id,
p_use_id );
end loop;
end if;
end if;
--发运 SHIP
if nvl(x_req_qty, 0) > 0 then
if x_quantity_ship > 0 then
for l_shipment in shipment_cursor(l_c.organization_id,
l_c.inventory_item_id,
p_require_id) loop
x_status := 'SHIP';
x_req_date := l_shipment.EXPECTED_RECEIPT_DATE +
CUX_INV_ARRIVE_ITEM_DATE_NEW.get_preprocessing_leadtime(l_c.organization_id,
l_c.inventory_item_id,
3);
x_sum_lack_quantity:= x_sum_lack_quantity-x_req_qty;
--x_Shipment_Line_Id :=l_shipment.Shipment_Line_Id;
if nvl(x_req_qty, 0) > 0 then
if x_req_qty < l_shipment.quantity then
x_quantity := x_req_qty;
x_quantity_ship := x_quantity_ship - x_req_qty;
x_req_qty := 0;
else
x_quantity := l_shipment.quantity;
x_req_qty := x_req_qty - x_quantity_ship;
x_quantity_ship := 0;
end if;
CUX_INV_ARRIVE_ITEM_DATE_NEW.insert_ARRIVE_ITEM_DATE_COMMIT(l_c.inventory_item_id,
l_c.organization_id,
l_b.wip_entity_id,
p_require_id,
SYSDATE,
x_inv_quantity,
x_L21_ORGQTY,
l_b.required_quantity,
l_b.quantity_issued,
l_b.quantity,
x_sum_lack_quantity,
x_req_date,
x_status,
x_quantity,
p_use_id,
null,
null,
null,
null,
l_b.description,
l_other_inv_qty,
x_other_wip_qty,
x_ship_qty,
l_min_qty);
CUX_INV_ARRIVE_ITEM_DATE_NEW.insert_report_status_commit(l_c.inventory_item_id,
l_c.organization_id,
l_b.wip_entity_id,
l_shipment.Shipment_Line_Id, --事物的id
x_status,
x_quantity,
x_req_date,
p_require_id,
p_use_id );
end if;
end loop;
end if;
end if;
--在途 PO
if nvl(x_req_qty, 0) > 0 then
if x_quantity_on_order > 0 then
for l_po_qty in po_cursor(l_c.organization_id,
l_c.inventory_item_id,
p_require_id) loop
x_status := 'PO';
--判断采购日期
-- x_sum_lack_quantity :=x_sum_inv_check_qty- nvl(x_req_qty, 0);
x_po_no :=l_po_qty.po_no;
x_LINE_NUM:=l_po_qty.LINE_NUM;
x_SHIPMENT_NUM:=l_po_qty.SHIPMENT_NUM;
x_p_vendor :=l_po_qty.VENDOR_NAME_ALT;
l_line_location_id :=l_po_qty.line_location_id;
if nvl(x_req_qty, 0) > 0 then
if l_po_qty.promised_date is not null then
--承诺日期不为空
x_req_date := l_po_qty.promised_date +
CUX_INV_ARRIVE_ITEM_DATE_NEW.get_preprocessing_leadtime(l_c.organization_id,
l_c.inventory_item_id,
3);
elsif (l_po_qty.promised_date is null and
l_po_qty.need_by_date >=
l_po_qty.creation_date +
CUX_INV_ARRIVE_ITEM_DATE_NEW.get_preprocessing_leadtime(l_c.organization_id,
l_c.inventory_item_id,
4)) then
--承诺日期为空,且PO需求日期>=(PO下单日期+预加工+加工中+后加工)
x_req_date := l_po_qty.need_by_date;
else
x_req_date := l_po_qty.creation_date +
CUX_INV_ARRIVE_ITEM_DATE_NEW.get_preprocessing_leadtime(l_c.organization_id,
l_c.inventory_item_id,
4);
end if;
-- x_sum_lack_quantity:= x_sum_lack_quantity-x_req_qty;
if x_req_qty < l_po_qty.quantity then
x_sum_lack_quantity :=x_sum_lack_quantity- nvl(x_req_qty, 0);
x_quantity := x_req_qty;
x_quantity_on_order := l_po_qty.quantity - x_req_qty;
x_req_qty :=0;
-- x_tflase :=l_po_qty.Trflase;
else
x_sum_lack_quantity :=x_sum_lack_quantity-l_po_qty.quantity;
x_quantity := l_po_qty.quantity;
x_req_qty := x_req_qty - l_po_qty.quantity;
x_quantity_on_order := 0;
-- x_tflase :=l_po_qty.Trflase;
-- x_po_qty_now :=-1;
end if;
CUX_INV_ARRIVE_ITEM_DATE_NEW.insert_po_pr_qty_commit(l_c.inventory_item_id,
l_c.organization_id,
l_b.wip_entity_id,
p_require_id,
SYSDATE,
x_inv_quantity,
x_L21_ORGQTY,
l_b.required_quantity,
l_b.quantity_issued,
l_b.quantity,
x_sum_lack_quantity,
x_req_date,
x_status,
x_quantity,
x_po_no,
x_LINE_NUM ,
x_SHIPMENT_NUM ,
x_p_vendor,
l_po_sumqty ,
p_use_id ,
l_po_qty.Trflase,
l_b.description,
l_line_location_id,
l_other_inv_qty,
x_other_wip_qty ,
l_min_qty );
CUX_INV_ARRIVE_ITEM_DATE_NEW.insert_report_status_commit(l_c.inventory_item_id,
l_c.organization_id,
l_b.wip_entity_id,
l_po_qty.line_location_id, --事物的id
x_status,
x_quantity,
x_req_date,
p_require_id,
p_use_id );
end if;
end loop;
end if;
end if;
--请购 PR
if nvl(x_req_qty, 0) > 0 then
if x_pr_qty > 0 then
x_status := 'PR';
--l_pr_sumqty :=x_pr_qty;
for l_pr_qty in pr_cursor (l_c.organization_id,
l_c.inventory_item_id,
p_require_id) loop
x_req_date:= l_pr_qty.creation_date+CUX_INV_ARRIVE_ITEM_DATE_NEW.get_preprocessing_leadtime(l_c.organization_id,
l_c.inventory_item_id,
4);
if nvl(x_req_qty, 0) > 0 then
if x_req_qty < nvl(l_pr_qty.quantity,0) then
x_sum_lack_quantity:= x_sum_lack_quantity-x_req_qty;
x_quantity := x_req_qty;
x_pr_qty := x_pr_qty - x_req_qty;
x_req_qty :=0;
else
x_sum_lack_quantity:= x_sum_lack_quantity-l_pr_qty.quantity;
x_quantity := l_pr_qty.quantity;
x_quantity_recv := l_pr_qty.quantity - x_req_qty;
x_req_qty :=x_req_qty -l_pr_qty.quantity ;
--x_req_qty := x_req_qty - x_quantity_recv;
x_pr_qty := 0;
end if;
CUX_INV_ARRIVE_ITEM_DATE_NEW.insert_pr_qty_commit(l_c.inventory_item_id,
l_c.organization_id,
l_b.wip_entity_id,
p_require_id,
SYSDATE,
x_inv_quantity,
x_L21_ORGQTY,
l_b.required_quantity,
l_b.quantity_issued,
l_b.quantity,
x_sum_lack_quantity,
x_req_date,
x_status,
x_quantity,
l_pr_sumqty,
p_use_id ,
l_b.description,
l_pr_qty.description ,
l_min_qty );
CUX_INV_ARRIVE_ITEM_DATE_NEW.insert_report_status_commit(l_c.inventory_item_id,
l_c.organization_id,
l_b.wip_entity_id,
l_pr_qty.requisition_header_id, --事物的id
x_status,
x_quantity,
x_req_date,
p_require_id,
p_use_id );
end if;
end loop ;
end if;
end if;
--L/T
if nvl(x_req_qty, 0) > 0 then
x_status := 'L/T';
x_req_date := sysdate +CUX_INV_ARRIVE_ITEM_DATE_NEW.get_preprocessing_leadtime(l_c.organization_id,
l_c.inventory_item_id,
4);
if x_sum_lack_quantity<0 then
x_sum_lack_quantity :=x_sum_lack_quantity-x_req_qty;
else x_sum_lack_quantity :=-x_req_qty;
end if ;
CUX_INV_ARRIVE_ITEM_DATE_NEW.insert_ARRIVE_ITEM_DATE_COMMIT(l_c.inventory_item_id,
l_c.organization_id,
l_b.wip_entity_id,
p_require_id,
SYSDATE,
x_inv_quantity,
x_L21_ORGQTY,
l_b.required_quantity,
l_b.quantity_issued,
l_b.quantity,
x_sum_lack_quantity,
x_req_date,
x_status,
x_req_qty,
p_use_id,
NULL,
null,
null,
null,
l_b.description,
l_other_inv_qty,
x_other_wip_qty,
null,
l_min_qty
);
cux_inv_arrive_item_date_NEW.insert_report_status_commit(l_c.inventory_item_id,
l_c.organization_id,
l_b.wip_entity_id,
p_require_id, --事物的id
x_status,
x_quantity,
x_req_date,
p_require_id,
p_use_id );
end if;
end loop;
end loop;
commit;
end;
--
EBS ORACLE工单齐套率的计算程序的更多相关文章
- Oracle EBS - 工单状态
Job status update 1. Job的几种状态 unreleased --未核发 released--已核发 complete --完成 complete no charges--完成不计 ...
- 齐博x1工单碎片模板制作教程
可以把工单插入到任何频道的内容里边,如下图所示 碎片模板制作标准如下 <form action="{:urls('order/add')}" class="wn_f ...
- PP篇7 生产替代料齐套后处理
扫描可关注本人技术分享公众号,与您一起学习新知! 对于计划订单和生产订单, 当存在替代料的时候,完成齐套性检查后,按照可齐套量进行拆单,并删除不能齐套的替代料(有个删除规则).不能齐套就按照优先级最高 ...
- (OSP)外包工单关工单失败
会计同事反映,在关几个外包(OSP)工单时,系统报错.错误讯息如下.检查错误讯息,发现Number of jobs failed in Delivered Quantity : 2.检查工单数据,均无 ...
- failed jobs because of past close date,关工单报错
今天会计反映关不了工单.我们公司关工单的程序是自己开发的,可以整批关.报如下错误.我试着用Standad程序关,可以.看来应该是我们开发的程序有问题.后来发现,是抛到WIP_DJ_CLOSE_TEMP ...
- Linux下使用Docker部署nacos-server(单机模式),丧心病狂的我在半夜给UCloud提交了一份工单
1. 拉取nacos-server镜像 进入 Docker Hub 查看nacos-server最新版本为 nacos-server:1.4.0 配置阿里云镜像加速 sudo mkdir -p /et ...
- abp加DDD开发:低耦合、可复用、可扩展的【工单】业务模块-简介和集成
前言 很多场景[单体+模块化]比微服务更合适,开发难度低.代码可复用性强.可扩展性强.模块化开发有些难点,模块启动与卸载.模块之间的依赖和通讯.asp.net core abp为我们提供了模块化开发能 ...
- Linux平台oracle 11g单实例 + ASM存储 安装部署 快速参考
操作环境:Citrix虚拟化环境中申请一个Linux6.4主机(模板)目标:创建单机11g + ASM存储 数据库 1. 主机准备 2. 创建ORACLE 用户和组成员 3. 创建以下目录并赋予对应权 ...
- oracle查询单表占用空间的大小
oracle查询单表占用空间的大小 SELECT segment_name AS TABLENAME, BYTES B, BYTES KB, BYTES MB FROM user_segments w ...
随机推荐
- 3.1-3.5 分布式部署hadoop2.x的准备和配置
一.环境 192.168.1.130 master 192.168.1.131 slave1 192.168.1.132 slave2 所有主机: 1.关闭防火墙.selinu ...
- MySQL命令行参数
一,mysql命令行参数 Usage: mysql [OPTIONS] [database] //命令方式 -?, --help //显示帮助信息并退出 -I, --help ...
- 【WIP】客户端JavaScript Web Object
创建: 2017/10/11 更新: 2017/10/14 标题加上[WIP],增加[TODO] 更新: 2018/01/22 更改标题 [客户端JavaScript Web Object, UR ...
- E20180425-hm
zoom n. 变焦; 嗡嗡声; 隆隆声; (车辆等) 疾驰的声音; deprecate vt. 不赞成,不推荐, 反对;
- P5154 数列游戏(区间dp)
传送门 果然和dp有关的东西我绝对做不出来啊-- 设\(dp[i][j]\)表示消完区间\([i,j]\)中的数之后能得到的最大分数,如果消不完则为\(-inf\),否则枚举断点.顺便如果\(a[i] ...
- [热拔插] 轻量级Winform插件式框架
写在前面的话 对于大神,Winform这种“古董玩具”,实在没太多“技术性”可言了,然而『好用才是王道』,本文不以技术为卖点,纯属经验之谈,欢迎交流拍砖 朴素版UI 开发初衷 由于本人所在公司不定时需 ...
- P1211 街道赛跑
又是一下午的杠题,累啊~~~ 这道题第一问很简单,只需去掉一个点,判断能不能到达终点就行了: 第二问其实仔细想想也不难,就是判断去掉一个点后是否形成两个图:首先要知道是建立在第一问的基础上的:在加边的 ...
- spring @InitBinder
/** * 将字符串日期转化为Date类型 * @param binder */ @InitBinder protected void initBinder(WebDataBinder binder) ...
- Markdown 简单使用教程
标题: # 一级标题 ## 二级标题 增加星号,字号相应变小,共有6级 列表: - 无序列表 编号. 有序列表 插入链接: [显示文本](链接地址) 插入图片: ![](图片地址) 引用: > ...
- 129 Sum Root to Leaf Numbers 求根叶数字总和
给定一个只包含 0-9 数字的二叉树,每个根到叶的路径可以代表一个数字.例如,从根到叶路径 1->2->3则代表数字 123.查找所有根到叶数字的总和.例如, 1 / \ 2 ...