added deployment folder with latest code
This commit is contained in:
@@ -0,0 +1,226 @@
|
||||
drop function if exists mmt_staging2.fn_PTO_PNA_ODS;
|
||||
CREATE OR REPLACE FUNCTION mmt_staging2.fn_PTO_PNA_ODS(p_file_syspk int)
|
||||
RETURNS text AS $$
|
||||
declare __test_instance_id int;
|
||||
declare __file_syspk int;
|
||||
declare __make text;
|
||||
declare __model text;
|
||||
declare v_state text;
|
||||
declare v_msg text;
|
||||
declare v_detail text;
|
||||
declare v_hint text;
|
||||
declare v_context text;
|
||||
declare _error int;
|
||||
begin
|
||||
__file_syspk := p_file_syspk;
|
||||
/*************************************************************
|
||||
Function Name:fn_PTO_PNA_ODS
|
||||
Function Desc: This function populates data into ODS blocks
|
||||
File Format: PTOBST
|
||||
Sheet Format: PTOBST_PNA
|
||||
Creation Date: March 21 2021
|
||||
Updation Date:
|
||||
Author: compegence team
|
||||
Function Call: select mmt_staging2.fn_PTO_PNA_ODS(880)
|
||||
***************************************************************/
|
||||
|
||||
|
||||
SET search_path TO mmt_staging2;
|
||||
select tractor_model into __model from mmt_ods.test_instance_tractor_info where test_file_ref_no =__file_syspk;
|
||||
select tractor_make into __make from mmt_ods.test_instance_tractor_info where test_file_ref_no =__file_syspk;
|
||||
insert into mmt_ods.PTO_Key_Perf_Parameters
|
||||
(client_id,function_id,test_condtion,test_file_ref_no,
|
||||
tractor_model,tractor_make,pto_gear_ratio,specific_gravity_of_fuel,dyno_constant,pto_power_hp,
|
||||
pto_sfc_gm_per_hp_hr,backup_torque_pct,engine_oil_temp_c,coolant_temp_c,rated_engine_speed_rpm,
|
||||
engine_high_idle_speed_rpm,engine_low_idle_speed_rpm,maximum_equi_crankshaft_torque_nm,
|
||||
equi_crankshaft_torque_at_max_Power_Nm,ambient_presure_mm_of_hg,related_humidity_pct,
|
||||
exhaust_temperature_c,back_pressure_mm_of_hg,engine_oil_pressure_bar,test_engineer,test_bed,
|
||||
location_name,total_run_hrs,test_date,test_file_format,test_file_sheet_format
|
||||
)
|
||||
select
|
||||
client_id,function_id,test_condition,file_syspk,
|
||||
model,make,pto_gear_ratio::numeric,specific_gravity_of_fuel::numeric,dyno_constant::numeric,pto_power_hp::numeric,
|
||||
pto_sfc_gm_hp::numeric,backup_torque::numeric,engine_oil_temp::numeric,coolant_temp::numeric,
|
||||
rated_engine_speed::numeric,engine_high_idle_speed::numeric,engine_low_idle_speed::numeric,
|
||||
maximum_equ_crankshaft::numeric,equ_crankshaft_torque_at_maximum_power::numeric,
|
||||
ambient_pressure_mm_of_hg::numeric,relative_humidity::numeric,
|
||||
exhaust_temperature::numeric,back_pressure::numeric,engine_oil_pressure_bar::numeric,test_engineer,test_bed,
|
||||
place,total_run_hrs::int, to_Date(test_Date, 'DD-MM-YYYY'),file_format,sheet_mnemonic
|
||||
from mmt_staging2.PTOBST_PNA_key_perfomrance_parameters_block
|
||||
where ods_record=1;
|
||||
|
||||
/* block */
|
||||
insert into mmt_ods.PTO_Perf_Results
|
||||
(
|
||||
client_id,function_id,test_file_ref_no,test_file_format,test_file_sheet_format,
|
||||
tractor_make,
|
||||
tractor_model,
|
||||
pto_test_type,serial_number,speed_engine_rpm,
|
||||
speed_pto_rpm,torque_n_m,torque_kg_m,power_kw,
|
||||
power_hp,eq_crank_torque_nm,fuel_consumption_g_per_min,fuel_consumption_kg_per_hr,
|
||||
fuel_consumption_ltr_per_hr,fuel_consumption_sfc_kg_per_kwh,fuel_consumption_sfc_g_per_hph,
|
||||
sp_energy_kwh_per_ltr,temperatures_fuel_c,temperatures_ambient_c,temperatures_air_in_c,
|
||||
temperatures_water_outlet_c,temperatures_exh_c,engine_oil_c,pressure_ambient_mm_of_hg,pressure_exh_mm_of_hg,
|
||||
pressure_lub_oil_bar,rh_pct
|
||||
)
|
||||
|
||||
select client_id,function_id,file_syspk,file_format,sheet_mnemonic,make,model,
|
||||
test_condition,c2,c3::int,c4::numeric,c5::numeric,c6::numeric,c7::numeric,c8::numeric,c9::numeric,c10::numeric,
|
||||
c11::numeric,
|
||||
c12::numeric,c13::numeric,c14::numeric,c15::numeric,c16::numeric,c17::numeric,c18::numeric,
|
||||
c19::numeric,c20::numeric,c21::numeric,c22::numeric,c23::numeric,c24::numeric,c25::numeric
|
||||
from mmt_staging2.PTOBST_PNA_boostmode_maxpower_test_block
|
||||
where ods_record=1;
|
||||
|
||||
/* block */
|
||||
insert into mmt_ods.PTO_Perf_Results
|
||||
(
|
||||
client_id,function_id,test_file_ref_no,test_file_format,test_file_sheet_format,
|
||||
tractor_make,
|
||||
tractor_model,
|
||||
pto_test_type,serial_number,speed_engine_rpm,
|
||||
speed_pto_rpm,torque_n_m,torque_kg_m,power_kw,
|
||||
power_hp,eq_crank_torque_nm,fuel_consumption_g_per_min,fuel_consumption_kg_per_hr,
|
||||
fuel_consumption_ltr_per_hr,fuel_consumption_sfc_kg_per_kwh,fuel_consumption_sfc_g_per_hph,
|
||||
sp_energy_kwh_per_ltr,temperatures_fuel_c,temperatures_ambient_c,temperatures_air_in_c,
|
||||
temperatures_water_outlet_c,temperatures_exh_c,engine_oil_c,pressure_ambient_mm_of_hg,pressure_exh_mm_of_hg,
|
||||
pressure_lub_oil_bar,rh_pct
|
||||
)
|
||||
|
||||
select client_id,function_id,file_syspk,file_format,sheet_mnemonic,make,model,
|
||||
test_condition,c2,c3::numeric,c4::numeric,c5::numeric,c6::numeric,c7::numeric,c8::numeric,c9::numeric,c10::numeric,
|
||||
c11::numeric,
|
||||
c12::numeric,c13::numeric,c14::numeric,c15::numeric,c16::numeric,c17::numeric,c18::numeric,
|
||||
c19::numeric,c20::numeric,c21::numeric,c22::numeric,c23::numeric,c24::numeric,c25::numeric
|
||||
from mmt_staging2.PTOBST_PNA_2Hrs_max_power_test_block
|
||||
where ods_record=1 ;
|
||||
/*and c2<>'Avg' */
|
||||
|
||||
/* block */
|
||||
insert into mmt_ods.PTO_Perf_Results
|
||||
(
|
||||
client_id,function_id,test_file_ref_no,test_file_format,test_file_sheet_format,
|
||||
tractor_make,
|
||||
tractor_model,
|
||||
pto_test_type,serial_number,speed_engine_rpm,
|
||||
speed_pto_rpm,torque_n_m,torque_kg_m,power_kw,
|
||||
power_hp,eq_crank_torque_nm,fuel_consumption_g_per_min,fuel_consumption_kg_per_hr,
|
||||
fuel_consumption_ltr_per_hr,fuel_consumption_sfc_kg_per_kwh,fuel_consumption_sfc_g_per_hph,
|
||||
sp_energy_kwh_per_ltr,temperatures_fuel_c,temperatures_ambient_c,temperatures_air_in_c,
|
||||
temperatures_water_outlet_c,temperatures_exh_c,engine_oil_c,pressure_ambient_mm_of_hg,pressure_exh_mm_of_hg,
|
||||
pressure_lub_oil_bar,rh_pct
|
||||
)
|
||||
|
||||
select client_id,function_id,file_syspk,file_format,sheet_mnemonic,make,model,
|
||||
test_condition,c2,c3::int,c4::numeric,c5::numeric,c6::numeric,c7::numeric,c8::numeric,c9::numeric,c10::numeric,
|
||||
c11::numeric,
|
||||
c12::numeric,c13::numeric,c14::numeric,c15::numeric,c16::numeric,c17::numeric,c18::numeric,
|
||||
c19::numeric,c20::numeric,c21::numeric,c22::numeric,c23::numeric,c24::numeric,c25::numeric
|
||||
from mmt_staging2.PTOBST_PNA_varying_speed_test_block
|
||||
where ods_record=1 ;
|
||||
|
||||
/* block */
|
||||
insert into mmt_ods.PTO_Perf_Results
|
||||
(
|
||||
client_id,function_id,test_file_ref_no,test_file_format,test_file_sheet_format,
|
||||
tractor_make,
|
||||
tractor_model,
|
||||
pto_test_type,pto_test_sub_type,serial_number,speed_engine_rpm,
|
||||
speed_pto_rpm,torque_n_m,torque_kg_m,power_kw,
|
||||
power_hp,eq_crank_torque_nm,fuel_consumption_g_per_min,fuel_consumption_kg_per_hr,
|
||||
fuel_consumption_ltr_per_hr,fuel_consumption_sfc_kg_per_kwh,fuel_consumption_sfc_g_per_hph,
|
||||
sp_energy_kwh_per_ltr,temperatures_fuel_c,temperatures_ambient_c,temperatures_air_in_c,
|
||||
temperatures_water_outlet_c,temperatures_exh_c,engine_oil_c,pressure_ambient_mm_of_hg,pressure_exh_mm_of_hg,
|
||||
pressure_lub_oil_bar,rh_pct
|
||||
)
|
||||
|
||||
select client_id,function_id,file_syspk,file_format,sheet_mnemonic,make,model,
|
||||
test_condition,c1,c2,c3::numeric,c4::numeric,c5::numeric,c6::numeric,c7::numeric,c8::numeric,c9::numeric,c10::numeric,
|
||||
c11::numeric,
|
||||
c12::numeric,c13::numeric,c14::numeric,c15::numeric,c16::numeric,c17::numeric,c18::numeric,
|
||||
c19::numeric,c20::numeric,c21::numeric,c22::numeric,c23::numeric,c24::numeric,c25::numeric
|
||||
from mmt_staging2.PTOBST_PNA_part_load_rated_rpm_block
|
||||
where ods_record=1 ;
|
||||
|
||||
/* block */
|
||||
insert into mmt_ods.PTO_Perf_Results
|
||||
(
|
||||
client_id,function_id,test_file_ref_no,test_file_format,test_file_sheet_format,
|
||||
tractor_make,
|
||||
tractor_model,
|
||||
pto_test_type,pto_test_sub_type,serial_number,speed_engine_rpm,
|
||||
speed_pto_rpm,torque_n_m,torque_kg_m,power_kw,
|
||||
power_hp,eq_crank_torque_nm,fuel_consumption_g_per_min,fuel_consumption_kg_per_hr,
|
||||
fuel_consumption_ltr_per_hr,fuel_consumption_sfc_kg_per_kwh,fuel_consumption_sfc_g_per_hph,
|
||||
sp_energy_kwh_per_ltr,temperatures_fuel_c,temperatures_ambient_c,temperatures_air_in_c,
|
||||
temperatures_water_outlet_c,temperatures_exh_c,engine_oil_c,pressure_ambient_mm_of_hg,pressure_exh_mm_of_hg,
|
||||
pressure_lub_oil_bar,rh_pct
|
||||
)
|
||||
|
||||
select client_id,function_id,file_syspk,file_format,sheet_mnemonic,make,model,
|
||||
test_condition,c1,c2,c3::numeric,c4::numeric,c5::numeric,c6::numeric,c7::numeric,c8::numeric,c9::numeric,c10::numeric,
|
||||
c11::numeric,
|
||||
c12::numeric,c13::numeric,c14::numeric,c15::numeric,c16::numeric,c17::numeric,c18::numeric,
|
||||
c19::numeric,c20::numeric,c21::numeric,c22::numeric,c23::numeric,c24::numeric,c25::numeric
|
||||
from mmt_staging2.PTOBST_PNA_varying_load_block
|
||||
where ods_record=1 ;
|
||||
|
||||
/* block */
|
||||
insert into mmt_ods.pto_smoke_test
|
||||
(
|
||||
client_id,function_id,test_file_ref_no,test_file_format,test_file_sheet_format,
|
||||
tractor_make,
|
||||
tractor_model,
|
||||
engine_speed_rpm,
|
||||
pto_speed_rpm ,
|
||||
torque_100_pct ,
|
||||
torque_80_pct ,
|
||||
smoke_fsn_100_pct ,
|
||||
smoke_fsn_80_pct
|
||||
)
|
||||
|
||||
select client_id,function_id,file_syspk,file_format,sheet_mnemonic,make,model,
|
||||
c2::numeric,c3::numeric,c4::numeric,c5::numeric,c6::numeric,c7::numeric
|
||||
from mmt_staging2.PTOBST_PNA_smoke_test_block
|
||||
where ods_record=1 ;
|
||||
|
||||
|
||||
select file_syspk into __file_syspk from mmt_staging2.PTOBST_RPT_tractor_specs_block;
|
||||
select syspk into __test_instance_id from mmt_ods.test_instance where test_file_ref_no =__file_syspk;
|
||||
|
||||
|
||||
update mmt_ods.PTO_Key_Perf_Parameters
|
||||
set test_instance_id=__test_instance_id,
|
||||
tractor_model =__model,
|
||||
tractor_make=__make
|
||||
where test_file_ref_no=__file_syspk;
|
||||
|
||||
update mmt_ods.PTO_Perf_Results
|
||||
set test_instance_id=__test_instance_id,
|
||||
tractor_model =__model,
|
||||
tractor_make=__make
|
||||
where test_file_ref_no=__file_syspk;
|
||||
|
||||
update mmt_ods.pto_smoke_test
|
||||
set test_instance_id=__test_instance_id,
|
||||
tractor_model =__model,
|
||||
tractor_make=__make
|
||||
where test_file_ref_no=__file_syspk;
|
||||
v_context := '';
|
||||
perform mmt_staging2.mmt_insert_db_error ( null, null, 1001, 'Compegence', __file_syspk ,'PTO','PTO_PNA' ,null,'ods', 'fn_PTO_PNA_ODS', v_state, v_msg, v_detail, v_hint, v_context,'success');
|
||||
return v_context;
|
||||
|
||||
EXCEPTION when OTHERS then
|
||||
|
||||
GET STACKED DIAGNOSTICS
|
||||
v_state = returned_sqlstate,
|
||||
v_msg = message_text,
|
||||
v_detail = pg_exception_detail,
|
||||
v_hint = pg_exception_hint,
|
||||
v_context = pg_exception_context;
|
||||
|
||||
perform mmt_staging2.mmt_insert_db_error ( null, null, 1001, 'Compegence', __file_syspk ,'PTO','PTO_PNA' ,null,'ods', 'fn_PTO_PNA_ODS', v_state, v_msg, v_detail, v_hint, v_context,'error');
|
||||
return v_context;
|
||||
end
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
Reference in New Issue
Block a user