--工艺路线
1 DECLARE 2 -- API input variables 3 l_operation_tbl bom_rtg_pub.operation_tbl_type := bom_rtg_pub.g_miss_operation_tbl; 4 l_rtg_header_rec bom_rtg_pub.rtg_header_rec_type := bom_rtg_pub.g_miss_rtg_header_rec; 5 l_rtg_revision_tbl bom_rtg_pub.rtg_revision_tbl_type := bom_rtg_pub.g_miss_rtg_revision_tbl; 6 l_op_resource_tbl bom_rtg_pub.op_resource_tbl_type := bom_rtg_pub.g_miss_op_resource_tbl; 7 l_sub_resource_tbl bom_rtg_pub.sub_resource_tbl_type := bom_rtg_pub.g_miss_sub_resource_tbl; 8 l_op_network_tbl bom_rtg_pub.op_network_tbl_type := bom_rtg_pub.g_miss_op_network_tbl; 9 10 -- API output variables 11 x_rtg_header_rec bom_rtg_pub.rtg_header_rec_type; -- routing header record 12 x_rtg_revision_tbl bom_rtg_pub.rtg_revision_tbl_type; -- routing revisions 13 x_operation_tbl bom_rtg_pub.operation_tbl_type; -- routing operations 14 x_op_resource_tbl bom_rtg_pub.op_resource_tbl_type; -- oepration resources 15 x_sub_resource_tbl bom_rtg_pub.sub_resource_tbl_type; -- sub operation resources 16 x_op_network_tbl bom_rtg_pub.op_network_tbl_type; -- operation networks 17 x_message_list error_handler.error_tbl_type; 18 19 -- Other API variables 20 l_return_status VARCHAR2(1) := NULL; 21 l_msg_count NUMBER := 0; 22 l_cnt NUMBER := 1; 23 24 -- WHO columns 25 l_user_id NUMBER := -1; 26 l_resp_id NUMBER := -1; 27 l_application_id NUMBER := -1; 28 l_row_cnt NUMBER := 1; 29 l_user_name VARCHAR2(30) := ‘HAND_CW‘; 30 31 BEGIN 32 33 FOR c IN (SELECT t.* 34 FROM cux.cux_update_routing_temp t 35 WHERE 1 = 1 36 AND t.p_session_id = ‘2016091901‘) 37 LOOP 38 39 /*-- Get the user_id 40 SELECT user_id 41 INTO l_user_id 42 FROM fnd_user 43 WHERE user_name = l_user_name; 44 45 -- Get the application_id and responsibility_id 46 l_application_id := 702; 47 l_resp_id := 50723;*/ 48 49 -- Initialize applications information 50 fnd_global.apps_initialize(1510, 51 50761, 52 401); 53 -- dbms_output.put_line(‘Initialized applications context: ‘ || l_user_id || ‘ ‘ || l_resp_id || ‘ ‘ || l_application_id); 54 55 -- Create the routing header 56 l_rtg_header_rec.assembly_item_name := ‘102021101011000007‘; 57 l_rtg_header_rec.organization_code := ‘A01‘; 58 l_rtg_header_rec.alternate_routing_code := NULL; 59 l_rtg_header_rec.transaction_type := ‘UPDATE‘; 60 61 62 63 l_operation_tbl(l_cnt).assembly_item_name := ‘102021101011000007‘; 64 l_operation_tbl(l_cnt).organization_code := ‘A01‘; 65 l_operation_tbl(l_cnt).alternate_routing_code := NULL; 66 --l_operation_tbl(l_cnt).department_code := ‘AR‘; 67 l_operation_tbl(l_cnt).operation_sequence_number := ‘20‘; 68 l_operation_tbl(l_cnt).operation_type := 1; 69 l_operation_tbl(l_cnt).start_effective_date := SYSDATE; 70 l_operation_tbl(l_cnt).standard_operation_code := c.p_operation_code; 71 l_operation_tbl(l_cnt).transaction_type := ‘UPDATE‘; 72 73 --l_operation_tbl(l_cnt).option_dependent_flag := c.p_option_dependent_flag; 74 l_operation_tbl(l_cnt).count_point_type := c.p_count_point_flag; 75 -- l_operation_tbl(l_cnt).count_point_type := c.p_autocharge_flag; 76 l_operation_tbl(l_cnt).backflush_flag := c.p_backflush_flag; 77 l_operation_tbl(l_cnt).attribute1 := c.p_attribute1; 78 l_operation_tbl(l_cnt).attribute2 := c.p_attribute2; 79 l_operation_tbl(l_cnt).attribute3 := c.p_attribute3; 80 l_operation_tbl(l_cnt).attribute4 := c.p_attribute4; 81 l_operation_tbl(l_cnt).attribute5 := c.p_attribute5; 82 l_operation_tbl(l_cnt).attribute6 := c.p_attribute6; 83 l_operation_tbl(l_cnt).attribute7 := c.p_attribute7; 84 l_operation_tbl(l_cnt).attribute8 := c.p_attribute8; 85 l_operation_tbl(l_cnt).attribute9 := c.p_attribute9; 86 l_operation_tbl(l_cnt).attribute10 := c.p_attribute10; 87 l_operation_tbl(l_cnt).attribute11 := c.p_attribute11; 88 l_operation_tbl(l_cnt).attribute12 := c.p_attribute12; 89 l_operation_tbl(l_cnt).attribute13 := c.p_attribute13; 90 l_operation_tbl(l_cnt).attribute14 := c.p_attribute14; 91 l_operation_tbl(l_cnt).attribute15 := c.p_attribute15; 92 93 /* 94 l_op_resource_tbl(l_cnt).assembly_item_name := ‘102021101011000007‘; 95 l_op_resource_tbl(l_cnt).organization_code := ‘A01‘; 96 l_op_resource_tbl(l_cnt).alternate_routing_code := NULL; 97 l_op_resource_tbl(l_cnt).operation_sequence_number := ‘20‘; 98 l_op_resource_tbl(l_cnt).usage_rate_or_amount := 3; 99 l_op_resource_tbl(l_cnt).transaction_type := ‘UPDATE‘; 100 l_op_resource_tbl(l_cnt).resource_sequence_number := ‘10‘; 101 l_op_resource_tbl(l_cnt).op_start_effective_date := to_date( ‘2014/5/29 18:58:26‘, 102 ‘YYYY-MM-DD hh24:mi:ss‘ );*/ 103 104 dbms_output.put_line(‘=======================================================‘); 105 dbms_output.put_line(‘Calling Bom_Rtg_Pub.Process_Rtg API‘); 106 107 bom_rtg_pub.process_rtg(p_bo_identifier => ‘RTG‘, 108 p_api_version_number => ‘1.0‘, 109 p_init_msg_list => TRUE, 110 p_rtg_header_rec => l_rtg_header_rec, 111 p_rtg_revision_tbl => l_rtg_revision_tbl, 112 p_operation_tbl => l_operation_tbl, 113 p_op_resource_tbl => l_op_resource_tbl, 114 p_sub_resource_tbl => l_sub_resource_tbl, 115 p_op_network_tbl => l_op_network_tbl, 116 x_rtg_header_rec => x_rtg_header_rec, 117 x_rtg_revision_tbl => x_rtg_revision_tbl, 118 x_operation_tbl => x_operation_tbl, 119 x_op_resource_tbl => x_op_resource_tbl, 120 x_sub_resource_tbl => x_sub_resource_tbl, 121 x_op_network_tbl => x_op_network_tbl, 122 x_return_status => l_return_status, 123 x_msg_count => l_msg_count, 124 p_debug => ‘N‘, 125 p_output_dir => ‘/usr/tmp/‘, 126 p_debug_filename => ‘rtg_bo_debug.log‘); 127 128 dbms_output.put_line(‘=======================================================‘); 129 dbms_output.put_line(‘Return Status: ‘ || l_return_status); 130 131 IF (l_return_status <> fnd_api.g_ret_sts_success) THEN 132 dbms_output.put_line(‘x_msg_count:‘ || l_msg_count); 133 134 error_handler.get_message_list(x_message_list => x_message_list); 135 dbms_output.put_line(‘Error Message Count :‘ || x_message_list.count); 136 FOR i IN 1 .. x_message_list.count 137 LOOP 138 dbms_output.put_line(to_char(i) || ‘:‘ || x_message_list(i).entity_index || ‘:‘ || x_message_list(i).table_name); 139 dbms_output.put_line(to_char(i) || ‘:‘ || x_message_list(i).message_text); 140 END LOOP; 141 END IF; 142 dbms_output.put_line(‘=======================================================‘); 143 144 l_cnt := l_cnt + 1; 145 END LOOP; 146 147 EXCEPTION 148 WHEN OTHERS THEN 149 dbms_output.put_line(‘Exception Occured :‘); 150 dbms_output.put_line(SQLCODE || ‘:‘ || SQLERRM); 151 dbms_output.put_line(‘=======================================================‘); 152 RAISE; 153 END;
创建工艺路线
--标准工序
没有相关标准api
时间: 2024-11-07 20:32:28