ERP WIP part of the Detailed API application

Work order creation (create work order)

PROCEDURE new_work_order(p_wip_entity_id NUMBER,

p_organization_id NUMBER,

x_error_status OUT VARCHAR2,

x_error_message OUT VARCHAR2) IS

l_iface_rec wip.wip_job_schedule_interface% ROWTYPE; - job ticket interface table

CURSOR c_wdj IS

SELECT *

FROM cux_wip_discrete_jobs_temp cwdj

WHERE cwdj.wip_entity_id = p_wip_entity_id

AND cwdj.organization_id = p_organization_id;

BEGIN

--

l_iface_rec.last_update_date := SYSDATE;

l_iface_rec.last_updated_by := fnd_global.user_id;

l_iface_rec.creation_date := SYSDATE;

l_iface_rec.created_by := fnd_global.user_id;

--

l_iface_rec.group_id := wip.wip_job_schedule_interface_s.nextval;

/*================================================

WIP_LOAD_TYPE MFG_LOOKUPS

------------ --------------

1 Create Standard Job

2 Create Repetitive Schedule

3 Update Discrete Job

4 Create Non–standard Job

================================================*/

FOR rec_wdj IN c_wdj LOOP

g_status_type := rec_wdj.status_type;

 

    - The non-standard service logic criteria ticket

if rec_wdj.job_type=1 then

l_iface_rec.load_type: = 1; - 1 Standard

else

l_iface_rec.load_type: = 4; - nonstandard

end if;

 

l_iface_rec.allow_explosion := 'Y';

l_iface_rec.process_phase := '2';

l_iface_rec.process_status := '1';

l_iface_rec.status_type := '3' /*rec_wdj.status_type*/

; - has been paid

l_iface_rec.job_name := rec_wdj.job_num;

l_iface_rec.organization_id := rec_wdj.organization_id;

 

l_iface_rec.class_code := rec_wdj.class_code;

l_iface_rec.primary_item_id := rec_wdj.primary_item_id;

l_iface_rec.start_quantity := rec_wdj.plan_quantity;

l_iface_rec.scheduling_method := '1';

l_iface_rec.first_unit_start_date := rec_wdj.scheduled_start_date;

l_iface_rec.first_unit_completion_date := rec_wdj.scheduled_completion_date;

 

l_iface_rec.attribute_category := rec_wdj.temp_attribute_category;

l_iface_rec.attribute1 := rec_wdj.temp_attribute1;

l_iface_rec.attribute2 := rec_wdj.temp_attribute2;

l_iface_rec.attribute3 := rec_wdj.temp_attribute3;

l_iface_rec.attribute4 := rec_wdj.temp_attribute4;

l_iface_rec.attribute5 := rec_wdj.temp_attribute5;

l_iface_rec.attribute6 := rec_wdj.temp_attribute6;

l_iface_rec.attribute7 := rec_wdj.temp_attribute7;

l_iface_rec.attribute8 := rec_wdj.temp_attribute8;

l_iface_rec.attribute9 := rec_wdj.temp_attribute9;

l_iface_rec.attribute10 := rec_wdj.temp_attribute10;

l_iface_rec.attribute11 := rec_wdj.temp_attribute11;

l_iface_rec.attribute12 := rec_wdj.temp_attribute12;

l_iface_rec.attribute13 := rec_wdj.temp_attribute13;

l_iface_rec.attribute14 := rec_wdj.temp_attribute14;

l_iface_rec.attribute15 := rec_wdj.temp_attribute15;

 

l_iface_rec.source_code := 'wip test;

l_iface_rec.source_line_id := rec_wdj.job_id;

 

INSERT INTO wip.wip_job_schedule_interface VALUES l_iface_rec;

END LOOP;

--API

wip_massload_pub.massloadjobs(p_groupid => l_iface_rec.group_id, -- Group ID

p_validationlevel => 2, -- Validation Level

p_commitflag => 0, -- Commit 1 =Yes , 0 ='No'

x_returnstatus => x_error_status,

x_errormsg => x_error_message);

 

END;

When the update to an existing ticket load_type 3, the interface writes the fields to be updated to the new value.

For example,  update work order status

 

- Change work order status

PROCEDURE change_work_order_status(p_wip_entity_id NUMBER,

p_organization_id NUMBER,

p_status_type NUMBER,

p_group_id NUMBER := wip.wip_job_schedule_interface_s.nextval,

x_error_status OUT VARCHAR2,

x_error_message OUT VARCHAR2) IS

wip.wip_job_schedule_interface% ROWTYPE l_schedule_iface_rec;  - ticket Interface Task Table

--l_group_id NUMBER;

/*l_returnstatus VARCHAR2(40);

l_errormsg VARCHAR2(2000);*/

l_temp VARCHAR2(3);

BEGIN

BEGIN

SELECT 1

INTO l_temp

FROM wip_discrete_jobs wdj

WHERE wdj.wip_entity_id = p_wip_entity_id

AND wdj.organization_id = p_organization_id

AND wdj.status_type = p_status_type;

x_error_status := 'S';

RETURN;

EXCEPTION

WHEN no_data_found THEN

NULL;

END;

l_schedule_iface_rec.group_id := p_group_id;

--

l_schedule_iface_rec.last_update_date := SYSDATE;

l_schedule_iface_rec.last_updated_by := fnd_global.user_id;

l_schedule_iface_rec.creation_date := SYSDATE;

l_schedule_iface_rec.created_by := fnd_global.user_id;

--

-- l_schedule_iface_rec.group_id := l_group_id;

/*================================================

WIP_LOAD_TYPE MFG_LOOKUPS

------------ --------------

1 Create Standard Job

2 Create Repetitive Schedule

3 Update Discrete Job

4 Create Non–standard Job

================================================*/

l_schedule_iface_rec.load_type := 3; --Update standard or non-standard Discrete Job

 

l_schedule_iface_rec.process_phase := 2; --Validation

 

l_schedule_iface_rec.process_status := 1; --Pending

--

l_schedule_iface_rec.wip_entity_id := p_wip_entity_id;

l_schedule_iface_rec.organization_id := p_organization_id;

 

l_schedule_iface_rec.status_type: = p_status_type;  - target state

 

INSERT INTO wip.wip_job_schedule_interface VALUES l_schedule_iface_rec;

wip_massload_pub.massloadjobs(p_groupid => p_group_id, -- Group ID

p_validationlevel => 2, -- Validation Level

p_commitflag => 0, -- Commit 1 =Yes , 0 ='No'

x_returnstatus => x_error_status,

x_errormsg => x_error_message);

END;

 

 

  • Mobile transaction processing (move transaction)

    After a work order is created, if not to move the transaction, the transaction can not be completed. The number of mobile number needs to be moved in accordance with the number of completion. The completion of the transaction has completed the concept of excess, therefore, mobile transactions have excessive movement.

    A function may need to get the number of mobile

FUNCTION get_available_to_move_qty(p_wip_entity_id IN NUMBER,

p_opr_seq_num IN NUMBER,

p_organization_id IN NUMBER,

p_intraopr_step IN NUMBER)

RETURN NUMBER IS

l_available_to_move_qty NUMBER;

 

CURSOR csr_wip_operations IS

SELECT decode(p_intraopr_step,

1,

wo.quantity_in_queue,

2,

wo.quantity_running,

3,

wo.quantity_waiting_to_move,

4,

wo.quantity_rejected,

5,

wo.quantity_scrapped,

wo.quantity_completed)

FROM wip_operations wo

WHERE wo.wip_entity_id = p_wip_entity_id

AND wo.operation_seq_num = p_opr_seq_num

AND wo.organization_id = p_organization_id

AND wo.repetitive_schedule_id IS NULL;

 

BEGIN

OPEN csr_wip_operations;

FETCH csr_wip_operations

INTO l_available_to_move_qty;

CLOSE csr_wip_operations;

 

RETURN l_available_to_move_qty;

END get_available_to_move_qty;

This method is called to a mobile transaction.

PROCEDURE process_move_transaction(p_wip_entity_id IN NUMBER,

p_organization_id IN NUMBER,

p_move_qty IN NUMBER,

p_uom IN VARCHAR2,

p_job_id IN NUMBER,

x_error_status OUT VARCHAR2,

x_error_message OUT VARCHAR2,

x_over_qty OUT NUMBER) IS

l_rec_move_txn wip_move_txn_interface%ROWTYPE;

l_group_id NUMBER;

l_txn_id NUMBER;

l_available NUMBER;

 

BEGIN

SELECT wip_transactions_s.nextval INTO l_group_id FROM dual;

--return;

 

- Use processing API one by one

l_txn_id := NULL;

l_rec_move_txn := NULL;

 

SELECT wip_transactions_s.nextval INTO l_txn_id FROM dual;

 

l_rec_move_txn.transaction_id := l_txn_id;

l_rec_move_txn.group_id := l_group_id;

 

l_rec_move_txn.process_phase := 1;

l_rec_move_txn.process_status := 2; --runing

 

l_rec_move_txn.created_by := fnd_global.user_id;

l_rec_move_txn.creation_date := SYSDATE;

l_rec_move_txn.last_updated_by := fnd_global.user_id;

l_rec_move_txn.last_update_date := SYSDATE;

l_rec_move_txn.last_update_login := fnd_global.login_id;

 

l_rec_move_txn.wip_entity_id := p_wip_entity_id;

--l_rec_move_txn.wip_entity_name := rec_grp.wo_no;

l_rec_move_txn.organization_id := p_organization_id;

l_rec_move_txn.transaction_date := SYSDATE;

 

l_rec_move_txn.transaction_quantity: = ABS (p_move_qty); - anyway, the number of processing transactions always take positive values

l_rec_move_txn.transaction_uom := p_uom;

P_move_qty the IF> 0 THEN  - a number of mobile greater than zero, moving forward, go to the mobile station by the queued serial number from the smallest maximum

l_rec_move_txn.transaction_type := 1; --1.normal move;2.combination move or completion/return transaction

SELECT MIN(wo.operation_seq_num), MAX(wo.operation_seq_num)

INTO l_rec_move_txn.fm_operation_seq_num,

l_rec_move_txn.to_operation_seq_num

FROM wip_operations wo

WHERE wo.wip_entity_id = p_wip_entity_id

AND wo.organization_id = p_organization_id;

l_rec_move_txn.fm_intraoperation_step_type := 1; --排队

l_rec_move_txn.to_intraoperation_step_type := 3; --移动

 

l_available := get_available_to_move_qty(p_wip_entity_id => p_wip_entity_id,

p_opr_seq_num => l_rec_move_txn.fm_operation_seq_num;

p_organization_id => p_organization_id,

p_intraopr_step => 1);

L_available the IF <p_move_qty THEN  - if the movement is less than the number of available number of the mobile, the mobile is enabled excess

l_rec_move_txn.overcompletion_transaction_qty := p_move_qty -

l_available;

l_rec_move_txn.overcompletion_primary_qty := p_move_qty -

l_available;

x_over_qty := p_move_qty -

l_available;

 

 

END IF;

 

The ELSE - number of mobile less than 0 , the reverse movement, from the mobile station to queue the maximum number of minimum went

l_rec_move_txn.transaction_type := 1; --1.normal move;2.combination move or completion/return transaction

SELECT MAX(wo.operation_seq_num), MIN(wo.operation_seq_num)

INTO l_rec_move_txn.fm_operation_seq_num,

l_rec_move_txn.to_operation_seq_num

FROM wip_operations wo

WHERE wo.wip_entity_id = p_wip_entity_id

AND wo.organization_id = p_organization_id;

l_rec_move_txn.fm_intraoperation_step_type := 3; --移动

l_rec_move_txn.to_intraoperation_step_type := 1; --排队

END IF;

 

l_rec_move_txn.last_updated_by_name := fnd_global.user_name;

l_rec_move_txn.created_by_name := fnd_global.user_name;

 

- The following two fields of view of business logic access

l_rec_move_txn.source_code := 'cux_wip_discrete_jobs';

l_rec_move_txn.source_line_id := p_job_id;

 

 

INSERT INTO wip_move_txn_interface VALUES l_rec_move_txn;

--API

wip_movproc_pub.processinterface(p_txn_id => l_txn_id,

p_commit => 'F',

x_returnstatus => x_error_status,

x_errormsg => x_error_message);

 

COMMIT;

--end loop;

END;

 

  • The completion of the transaction (move transaction)

The completion of the transaction to be completed and returned two logics deal with unreasonable

PROCEDURE process_completion_txn(p_completion_txn_id NUMBER,

x_error_status OUT VARCHAR2,

x_error_message OUT VARCHAR2) IS

l_iface_rec inv.mtl_transactions_interface%ROWTYPE;

l_iface_lot_rec inv.mtl_transaction_lots_interface%ROWTYPE;

- This logically different data source access, modify their own.

CURSOR c_completion IS

SELECT *

FROM cux_wip_completion_txn t

WHERE t.completion_txn_id = p_completion_txn_id

and nvl(t.imp_flag, 'N') != 'S';

l_return_status VARCHAR2(40);

l_msg_count NUMBER;

l_msg_data VARCHAR2(2000);

l_trans_count NUMBER;

l_request_id NUMBER;

 

l_moved_qty NUMBER;

l_completion_qty NUMBER;

l_start_qty NUMBER;

x_over_qty NUMBER;

BEGIN

l_iface_rec.last_update_date := SYSDATE;

l_iface_rec.last_updated_by := fnd_global.user_id;

l_iface_rec.creation_date := SYSDATE;

l_iface_rec.created_by := fnd_global.user_id;

l_iface_rec.last_update_login := fnd_global.user_id;

FOR rec_completion IN c_completion LOOP

 

SELECT mtl_material_transactions_s.nextval

INTO l_iface_rec.transaction_interface_id

FROM dual;

l_iface_rec.transaction_header_id := l_iface_rec.transaction_interface_id;

/************transaction_mode*********************

* transaction_mode

* 2 Concurrent, Process transaction interface does not handle,

* Requires Inventory transaction worker program call processing

* 3 Background, the process Process transaction interface

***************************************************/

l_iface_rec.transaction_mode := 3;

/************process_flag*********************

* process_flag

*1 Yes

*2 No

*3 Error

***************************************************/

l_iface_rec.process_flag := 1;

 

IF rec_completion.quantity >= 0 THEN

l_iface_rec.transaction_type_id: = 44 is;  --mtl_transaction_types - Completion the WIP completed transaction

ELSE

l_iface_rec.transaction_type_id: =. 17;  - if the number is negative  17 WIP Completion Return completed transaction return

END IF;

 

l_iface_rec.transaction_source_type_id: =. 5;  - look-up table  mtl_txn_source_types obtain the corresponding values of - Production Management

/*************************************************

Miscellaneous * account alias, alias ID disposition_id i.e.

Miscellaneous * account, with account ID code_combination_id i.e.

* WIP Material Transactions, with the task ID that is wip_entity_id

* SO material transactions with mtl_sales_orders.sales_order_id

* Sub-bank transfer or inter-organizational transfer, is empty

************************************************/

BEGIN

SELECT wdj.wip_entity_id, we.primary_item_id

INTO l_iface_rec.transaction_source_id,

l_iface_rec.inventory_item_id

FROM wip_discrete_jobs wdj, wip_entities we

WHERE (wdj.source_line_id = rec_completion.job_id AND

wdj.source_code = 'wip platform')

AND we.wip_entity_id = wdj.wip_entity_id

AND we.organization_id = wdj.organization_id;

EXCEPTION

WHEN no_data_found THEN

NULL;

END;

 

 

Rec_completion.quantity the IF> 0 THEN  - If the number is greater than zero, the transaction needs to be moved

process_move_transaction(l_iface_rec.transaction_source_id,

rec_completion.organization_id,

rec_completion.quantity,

rec_completion.uom_code,

rec_completion.job_id,

x_error_status,

x_error_message,

x_over_qty);

 

IF x_error_status != 'S' THEN

UPDATE cux_wip_completion_txn cwct

SET cwct.imp_flag = x_error_status,

cwct.imp_msg = x_error_message,

cwct.last_updated_by = fnd_global.user_id,

cwct.last_update_date = SYSDATE

WHERE cwct.completion_txn_id = p_completion_txn_id;

RETURN;

END IF;

END IF;

 

- Mobile successfully  continued

l_iface_rec.organization_id := rec_completion.organization_id;

l_iface_rec.subinventory_code := rec_completion.secondary_inventory_name;

l_iface_rec.locator_id := rec_completion.inventory_location_id;

l_iface_rec.transaction_quantity := rec_completion.quantity;

l_iface_rec.transaction_uom := rec_completion.uom_code;

l_iface_rec.transaction_date := SYSDATE;

    l_iface_rec.final_completion_flag := 'N';

    - Different numbers take the following three fields, depending on the business logic

l_iface_rec.source_code := 'cux_wip_completion_txn';

l_iface_rec.source_header_id := rec_completion.job_id;

l_iface_rec.source_line_id := rec_completion.completion_txn_id;

 

 

INSERT INTO inv.mtl_transactions_interface VALUES l_iface_rec;

 

l_iface_lot_rec.last_update_date := SYSDATE;

l_iface_lot_rec.last_updated_by := fnd_global.user_id;

l_iface_lot_rec.creation_date := SYSDATE;

l_iface_lot_rec.created_by := fnd_global.user_id;

l_iface_lot_rec.last_update_login := fnd_global.user_id;

 

l_iface_lot_rec.transaction_interface_id := l_iface_rec.transaction_interface_id;

l_iface_lot_rec.lot_number := rec_completion.lot_number;

l_iface_lot_rec.primary_quantity := rec_completion.quantity;

l_iface_lot_rec.transaction_quantity := rec_completion.quantity;

- Different numbers take the following three fields, depending on the business logic

l_iface_lot_rec.source_code := 'cux_wip_completion_txn';

l_iface_lot_rec.source_line_id := rec_completion.completion_txn_id;

 

INSERT INTO inv.mtl_transaction_lots_interface

VALUES l_iface_lot_rec;

 

l_request_id := inv_txn_manager_pub.process_transactions(p_api_version => 1,

p_init_msg_list => fnd_api.g_false,

p_commit => fnd_api.g_true,

p_validation_level => fnd_api.g_valid_level_full,

x_return_status => l_return_status,

x_msg_count => l_msg_count,

x_msg_data => l_msg_data,

x_trans_count => l_trans_count,

p_table => 1,

p_header_id => l_iface_rec.transaction_header_id);

x_error_status := l_return_status;

 

Rec_completion.quantity the IF <= 0 the AND x_error_status = 'S' THEN - if it is completed to return, after the completion of the move, the number of moving back

process_move_transaction(l_iface_rec.transaction_source_id,

rec_completion.organization_id,

rec_completion.quantity,

rec_completion.uom_code,

rec_completion.job_id,

x_error_status,

x_error_message,

x_over_qty);

 

if x_error_status != 'S' then

update cux_wip_completion_txn cwct

set cwct.imp_flag = x_error_status,

cwct.imp_msg = x_error_message,

cwct.last_updated_by = fnd_global.USER_ID,

cwct.last_update_date = sysdate

where cwct.completion_txn_id = p_completion_txn_id;

return;

end if;

END IF;

BEGIN

SELECT mti.error_code || ',' || mti.error_explanation || ',' ||

mli.error_code

INTO x_error_message

FROM mtl_transactions_interface mti,

mtl_transaction_lots_interface mli

WHERE mti.transaction_interface_id =

l_iface_rec.transaction_interface_id

AND mli.transaction_interface_id(+) =

mti.transaction_interface_id;

EXCEPTION

WHEN no_data_found THEN

NULL;

END;

    

    - depending on the different service logic corresponding rehabilitation treatment

IF x_error_status != 'S' THEN

DELETE mtl_transaction_lots_interface t

WHERE t.source_code = 'cux_wip_completion_txn'

AND t.source_line_id = rec_completion.completion_txn_id;

 

DELETE mtl_transactions_interface t

WHERE t.source_code = 'cux_wip_completion_txn'

AND t.source_line_id = rec_completion.completion_txn_id

AND t.source_header_id = rec_completion.job_id;

 

END IF;

UPDATE cux_wip_completion_txn cwct

SET cwct.imp_flag = x_error_status,

cwct.imp_msg = x_error_message,

cwct.last_updated_by = fnd_global.user_id,

cwct.last_update_date = SYSDATE

WHERE cwct.completion_txn_id = p_completion_txn_id;

 

END LOOP;

 

END;

 

  • Feeding transaction processing (issue transaction)

Feeding same call mmt transaction processing interface table with mobile transaction processing similar

 

PROCEDURE process_issue_txn(p_issue_txn_id NUMBER,

x_error_status OUT VARCHAR2,

x_error_message OUT VARCHAR2) IS

l_iface_rec inv.mtl_transactions_interface%ROWTYPE;

l_iface_lot_rec inv.mtl_transaction_lots_interface%ROWTYPE;

CURSOR c_issue IS

SELECT *

FROM cux_wip_issue_txn t

WHERE t.wip_issue_txn_id = p_issue_txn_id

and nvl(t.imp_flag, 'N') != 'S';

l_return_status VARCHAR2(40);

l_msg_count NUMBER;

l_msg_data VARCHAR2(2000);

l_trans_count NUMBER;

l_request_id NUMBER;

 

BEGIN

l_iface_rec.last_update_date := SYSDATE;

l_iface_rec.last_updated_by := fnd_global.user_id;

l_iface_rec.creation_date := SYSDATE;

l_iface_rec.created_by := fnd_global.user_id;

l_iface_rec.last_update_login := fnd_global.user_id;

FOR rec_issue IN c_issue LOOP

SELECT mtl_material_transactions_s.nextval

INTO l_iface_rec.transaction_interface_id

FROM dual;

l_iface_rec.transaction_header_id := l_iface_rec.transaction_interface_id;

/************transaction_mode*********************

* transaction_mode

* 2 Concurrent, Process transaction interface does not handle,

* Requires Inventory transaction worker program call processing

* 3 Background, the process Process transaction interface

***************************************************/

l_iface_rec.transaction_mode := 3;

/************process_flag*********************

* process_flag

*1 Yes

*2 No

*3 Error

***************************************************/

l_iface_rec.process_flag := 1;

IF rec_issue.transaction_quantity >= 0 THEN

l_iface_rec.transaction_type_id := 35; --mtl_transaction_types--WIP Issue

ELSE

l_iface_rec.transaction_type_id := 43; --wip return

END IF;

 

l_iface_rec.transaction_source_type_id: =. 5;  --mtl_txn_source_types-- production management

/*************************************************

Miscellaneous * account alias, alias ID disposition_id i.e.

Miscellaneous * account, with account ID code_combination_id i.e.

* WIP Material Transactions, with the task ID that is wip_entity_id

* SO material transactions with mtl_sales_orders.sales_order_id

* Sub-bank transfer or inter-organizational transfer, is empty

************************************************/

 

SELECT wdj.wip_entity_id

INTO l_iface_rec.transaction_source_id

FROM wip_discrete_jobs wdj, wip_entities we

WHERE (wdj.source_line_id = rec_issue.job_id OR

(wdj.wip_entity_id, wdj.organization_id) IN

(SELECT cwdj.wip_entity_id, cwdj.organization_id

FROM cux_wip_discrete_jobs_v cwdj

WHERE cwdj.job_id = rec_issue.job_id

AND cwdj.order_wip_entity_id IS NULL))

AND we.wip_entity_id = wdj.wip_entity_id

AND we.organization_id = wdj.organization_id;

 

l_iface_rec.inventory_item_id := rec_issue.inventory_item_id;

l_iface_rec.organization_id := rec_issue.organization_id;

l_iface_rec.subinventory_code := rec_issue.secondary_inventory_name;

l_iface_rec.locator_id := rec_issue.inventory_location_id;

l_iface_rec.transaction_quantity := -rec_issue.transaction_quantity;

l_iface_rec.transaction_uom := rec_issue.primary_uom_code;

l_iface_rec.reason_id := rec_issue.reason_id;

 

l_iface_rec.transaction_date := SYSDATE;

l_iface_rec.source_code := 'cux_wip_issue_txn';

l_iface_rec.source_header_id := rec_issue.job_id;

l_iface_rec.source_line_id := rec_issue.wip_issue_txn_id;

l_iface_rec.final_completion_flag := 'N';

 

INSERT INTO inv.mtl_transactions_interface VALUES l_iface_rec;

IF rec_issue.lot_number IS NOT NULL THEN

l_iface_lot_rec.last_update_date := SYSDATE;

l_iface_lot_rec.last_updated_by := fnd_global.user_id;

l_iface_lot_rec.creation_date := SYSDATE;

l_iface_lot_rec.created_by := fnd_global.user_id;

l_iface_lot_rec.last_update_login := fnd_global.user_id;

 

l_iface_lot_rec.transaction_interface_id := l_iface_rec.transaction_interface_id;

l_iface_lot_rec.lot_number := rec_issue.lot_number;

l_iface_lot_rec.primary_quantity := -rec_issue.transaction_quantity;

l_iface_lot_rec.transaction_quantity := -rec_issue.transaction_quantity;

 

l_iface_lot_rec.source_code := 'cux_wip_issue_txn';

l_iface_lot_rec.source_line_id := rec_issue.wip_issue_txn_id;

 

INSERT INTO inv.mtl_transaction_lots_interface

VALUES l_iface_lot_rec;

END IF;

l_request_id := inv_txn_manager_pub.process_transactions(p_api_version => 1,

p_init_msg_list => fnd_api.g_false,

p_commit => fnd_api.g_true,

p_validation_level => fnd_api.g_valid_level_full,

x_return_status => l_return_status,

x_msg_count => l_msg_count,

x_msg_data => l_msg_data,

x_trans_count => l_trans_count,

p_table => 1,

p_header_id => l_iface_rec.transaction_header_id);

x_error_status := l_return_status;

BEGIN

SELECT mti.error_code || ',' || mti.error_explanation || ',' ||

mli.error_code

INTO x_error_message

FROM mtl_transactions_interface mti,

mtl_transaction_lots_interface mli

WHERE mti.transaction_interface_id =

l_iface_rec.transaction_interface_id

AND mli.transaction_interface_id(+) =

mti.transaction_interface_id;

EXCEPTION

WHEN no_data_found THEN

NULL;

END;

 

IF x_error_status != 'S' THEN

DELETE mtl_transaction_lots_interface t

WHERE t.source_code = 'cux_wip_issue_txn'

AND t.source_line_id = rec_issue.wip_issue_txn_id;

 

DELETE mtl_transactions_interface t

WHERE t.source_code = 'cux_wip_issue_txn'

AND t.source_line_id = rec_issue.wip_issue_txn_id

AND t.source_header_id = rec_issue.job_id;

 

END IF;

 

UPDATE cux_wip_issue_txn cwit

SET cwit.imp_flag = x_error_status,

cwit.imp_msg = x_error_message,

cwit.last_updated_by = fnd_global.user_id,

cwit.last_update_date = SYSDATE

WHERE cwit.wip_issue_txn_id = p_issue_txn_id;

END LOOP;

END;

Guess you like

Origin www.cnblogs.com/shuihaya/p/11927374.html