From f3cf5e1d2d6c62a910567091002ee504a0dc00cd Mon Sep 17 00:00:00 2001 From: dheepa Date: Mon, 9 Aug 2021 11:14:23 +0000 Subject: [PATCH] sql --- onetime/archive/create/archive_create.sql | 4 +- onetime/archive/function/fn_archive.sql | 19 +- onetime/commonfunctions/fn_check_count.sql | 6 +- .../fn_fw_ods_misnomer_load.sql | 75 ++ .../fn_fw_ods_tractor_info_load.sql | 208 +++++ .../fn_run_post_generic_validation.sql | 63 +- .../fn_run_post_trx_validation.sql | 11 +- .../commonfunctions/fn_run_trx_rollback.sql | 10 +- onetime/commonfunctions/fn_run_updates.sql | 44 + onetime/commonfunctions/fn_update_generic.sql | 33 +- onetime/configentries/BUDNI_config.sql | 12 +- onetime/configentries/IHT_config.sql | 8 +- onetime/configentries/control-master.sql | 9 +- onetime/configentries/test_lab_data.sql | 2 +- onetime/createtables/common/extension.sql | 5 +- .../createtables/control/control_tables.sql | 3 + onetime/createtables/ods/.sql | 2 +- .../createtables/ods/create_table_fw_ods.sql | 168 +++- onetime/createtables/ods/ods_tables.sql | 15 +- .../staging/create_tables_BUDNI_PTO.sql | 8 +- .../staging/create_tables_PTO.sql | 18 + .../staging/create_tables_iht_cgm.sql | 4 + .../staging/create_tables_iht_emt.sql | 4 + .../staging/create_tables_iht_ham.sql | 4 + .../staging/create_tables_iht_hls.sql | 4 + .../staging/create_tables_iht_nst.sql | 4 + .../staging/create_tables_iht_sll.sql | 5 + .../staging/create_tables_ihtbt30_bt30.sql | 5 +- .../staging/create_tables_ihtbt50_bt50.sql | 5 +- .../staging/create_tables_ihtbtd_btd.sql | 5 +- .../Drawbar/DBOECD_TEST_ods.sql | 10 + .../Drawbar/DBSTD_TEST_ods.sql | 10 + .../IHT/.IHTBT50_BT50_ODS.sql.swp | Bin 0 -> 24576 bytes .../IHT/IHTBT30_BT30_ODS.sql | 36 +- .../IHT/IHTBT30_BT30_STG2.sql | 117 ++- .../IHT/IHTBT50_BT50_ODS.sql | 35 +- .../IHT/IHTBT50_BT50_STG2.sql | 100 +-- .../dataloadfunctions/IHT/IHTBTD_BTD_ODS.sql | 39 +- .../dataloadfunctions/IHT/IHTBTD_BTD_STG2.sql | 26 +- onetime/dataloadfunctions/IHT/IHT_CGM_ODS.sql | 48 +- .../dataloadfunctions/IHT/IHT_CGM_STG2.sql | 14 +- onetime/dataloadfunctions/IHT/IHT_EMT_ODS.sql | 35 +- .../dataloadfunctions/IHT/IHT_EMT_STD_ODS.sql | 11 + .../IHT/IHT_EMT_STD_STG2.sql | 4 +- .../dataloadfunctions/IHT/IHT_EMT_STG2.sql | 13 +- onetime/dataloadfunctions/IHT/IHT_HAM_ODS.sql | 11 + .../dataloadfunctions/IHT/IHT_HAM_STG2.sql | 30 +- onetime/dataloadfunctions/IHT/IHT_HLS_ODS.sql | 31 +- .../dataloadfunctions/IHT/IHT_HLS_STG2.sql | 10 +- onetime/dataloadfunctions/IHT/IHT_NST_ODS.sql | 335 +++---- .../dataloadfunctions/IHT/IHT_NST_STG2.sql | 88 +- onetime/dataloadfunctions/IHT/IHT_SLL_ODS.sql | 36 +- .../dataloadfunctions/IHT/IHT_SLL_STG2.sql | 43 +- .../ODS_Load/fn_fw_ods_budni_load.sql | 253 ++++++ .../ODS_Load/fn_fw_ods_comments_load.sql | 217 +++++ .../ODS_Load/fn_fw_ods_detailed_load.sql | 149 ++++ .../ODS_Load/fn_fw_ods_drawbar_load.sql | 175 ++++ .../fn_fw_ods_drawbar_performance_load.sql | 190 ++++ .../ODS_Load/fn_fw_ods_field_load.sql | 483 ++++++++++ ...fw_ods_load.sql => fn_fw_ods_iht_load.sql} | 695 ++++----------- .../fn_fw_ods_implement_details_update.sql | 185 ++++ .../fn_fw_ods_observation_ftdry_load.sql | 214 +++++ .../ODS_Load/fn_fw_ods_pto_load.sql | 364 ++++++++ onetime/dataloadfunctions/PTO/PTO_GVG_ods.sql | 77 +- .../dataloadfunctions/PTO/PTO_GVG_stg2.sql | 841 ++++++++++-------- onetime/dataloadfunctions/PTO/PTO_MPM_ods.sql | 16 +- onetime/dataloadfunctions/PTO/PTO_PRF_ods.sql | 26 +- .../dataloadfunctions/budni/BUDNI_ARC_ODS.sql | 22 +- .../dataloadfunctions/budni/BUDNI_BRK_ODS.sql | 23 +- .../dataloadfunctions/budni/BUDNI_DBP_ODS.sql | 24 +- .../dataloadfunctions/budni/BUDNI_FLD_ODS.sql | 24 +- .../dataloadfunctions/budni/BUDNI_HDL_ODS.sql | 25 +- .../dataloadfunctions/budni/BUDNI_HLG_ODS.sql | 24 +- .../dataloadfunctions/budni/BUDNI_LCG_ODS.sql | 25 +- .../dataloadfunctions/budni/BUDNI_NMT_ODS.sql | 24 +- .../budni/BUDNI_NMT_STG2.sql | 4 +- .../dataloadfunctions/budni/BUDNI_PTO_ODS.sql | 21 +- .../budni/BUDNI_PTO_STG2.sql | 46 +- .../dataloadfunctions/budni/BUDNI_VMT_ODS.sql | 14 + .../dataloadfunctions/field/FTDRY_SUM_ODS.sql | 2 +- .../dataloadfunctions/field/FTDRY_TRS_ODS.sql | 23 +- .../dataloadfunctions/field/FTHLG_TRS_ods.sql | 10 + .../dataloadfunctions/field/FTWET_SUM_ods.sql | 41 +- .../dataloadfunctions/field/FTWET_TRS_ods.sql | 11 + onetime/wrappers/master_wrapper.sql | 11 +- onetime/wrappers/wrapper.sql | 163 ++++ scripts/check_duplicate_file.sh | 4 +- ..._onetime_compile.sh => onetime_compile.sh} | 0 scripts/run_schedule.sh | 6 +- 89 files changed, 4769 insertions(+), 1508 deletions(-) mode change 100644 => 100755 onetime/commonfunctions/fn_check_count.sql create mode 100644 onetime/commonfunctions/fn_fw_ods_misnomer_load.sql create mode 100644 onetime/commonfunctions/fn_fw_ods_tractor_info_load.sql mode change 100644 => 100755 onetime/commonfunctions/fn_run_post_trx_validation.sql create mode 100644 onetime/commonfunctions/fn_run_updates.sql create mode 100644 onetime/dataloadfunctions/IHT/.IHTBT50_BT50_ODS.sql.swp create mode 100755 onetime/dataloadfunctions/ODS_Load/fn_fw_ods_budni_load.sql create mode 100755 onetime/dataloadfunctions/ODS_Load/fn_fw_ods_comments_load.sql create mode 100755 onetime/dataloadfunctions/ODS_Load/fn_fw_ods_detailed_load.sql create mode 100755 onetime/dataloadfunctions/ODS_Load/fn_fw_ods_drawbar_load.sql create mode 100755 onetime/dataloadfunctions/ODS_Load/fn_fw_ods_drawbar_performance_load.sql create mode 100755 onetime/dataloadfunctions/ODS_Load/fn_fw_ods_field_load.sql rename onetime/dataloadfunctions/ODS_Load/{fn_fw_ods_load.sql => fn_fw_ods_iht_load.sql} (54%) create mode 100644 onetime/dataloadfunctions/ODS_Load/fn_fw_ods_implement_details_update.sql create mode 100755 onetime/dataloadfunctions/ODS_Load/fn_fw_ods_observation_ftdry_load.sql create mode 100644 onetime/dataloadfunctions/ODS_Load/fn_fw_ods_pto_load.sql mode change 100755 => 100644 onetime/dataloadfunctions/PTO/PTO_GVG_ods.sql mode change 100755 => 100644 onetime/dataloadfunctions/PTO/PTO_GVG_stg2.sql create mode 100755 onetime/wrappers/wrapper.sql rename scripts/{run_onetime_compile.sh => onetime_compile.sh} (100%) diff --git a/onetime/archive/create/archive_create.sql b/onetime/archive/create/archive_create.sql index 2e73a2d..d39775a 100755 --- a/onetime/archive/create/archive_create.sql +++ b/onetime/archive/create/archive_create.sql @@ -38,8 +38,8 @@ create table archive.budni_nmt_noise_at_bystander_position_block_archive( like s create table archive.budni_nmt_noise_at_operator_ear_level_block_archive( like staging2.budni_nmt_noise_at_operator_ear_level_block including all, insert_time timestamp default current_timestamp); create table archive.budni_nmt_spec_h1_block_archive( like staging2.budni_nmt_spec_h1_block including all, insert_time timestamp default current_timestamp); create table archive.budni_nmt_test_obs_summary_block_archive( like staging2.budni_nmt_test_obs_summary_block including all, insert_time timestamp default current_timestamp); -create table archive.budni_pto_mmtkeyword1_block_archive( like staging2.budni_pto_mmtkeyword1_block including all, insert_time timestamp default current_timestamp); -create table archive.budni_pto_mmtkeyword2_block_archive( like staging2.budni_pto_mmtkeyword2_block including all, insert_time timestamp default current_timestamp); +create table archive.budni_pto_Parameter1_block_archive( like staging2.budni_pto_Parameter1_block including all, insert_time timestamp default current_timestamp); +create table archive.budni_pto_Parameter2_block_archive( like staging2.budni_pto_Parameter2_block including all, insert_time timestamp default current_timestamp); create table archive.budni_pto_perf_report_block_archive( like staging2.budni_pto_perf_report_block including all, insert_time timestamp default current_timestamp); create table archive.budni_pto_spec_h1_block_archive( like staging2.budni_pto_spec_h1_block including all, insert_time timestamp default current_timestamp); create table archive.budni_pto_summary_block_archive( like staging2.budni_pto_summary_block including all, insert_time timestamp default current_timestamp); diff --git a/onetime/archive/function/fn_archive.sql b/onetime/archive/function/fn_archive.sql index c8a6a65..0df1c58 100755 --- a/onetime/archive/function/fn_archive.sql +++ b/onetime/archive/function/fn_archive.sql @@ -1,12 +1,10 @@ ---drop function if exists fw_core.fn_run_block_archive; +--drop function if exists archive.fn_run_block_archive; -CREATE OR REPLACE FUNCTION fw_core.fn_run_block_archive(p_client_id int,p_function_id int,p_job_id int,p_step_id int) +CREATE OR REPLACE FUNCTION archive.fn_run_block_archive(p_client_id int ,p_function_id int) RETURNS void AS $$ declare __client_id int :=p_client_id; declare __function_id int :=p_function_id; - declare __jobid int := p_job_id; - declare __stepid int := p_step_id; declare __file_mnemonic text :='ARCHIVE'; declare __file_sheet_mnemonic text :='ARCHIVE_SHEET'; declare __file_syspk int := null; @@ -55,8 +53,8 @@ insert into archive.budni_nmt_noise_at_bystander_position_block_archive select * insert into archive.budni_nmt_noise_at_operator_ear_level_block_archive select * from staging2.budni_nmt_noise_at_operator_ear_level_block; insert into archive.budni_nmt_spec_h1_block_archive select * from staging2.budni_nmt_spec_h1_block; insert into archive.budni_nmt_test_obs_summary_block_archive select * from staging2.budni_nmt_test_obs_summary_block; -insert into archive.budni_pto_mmtkeyword1_block_archive select * from staging2.budni_pto_mmtkeyword1_block; -insert into archive.budni_pto_mmtkeyword2_block_archive select * from staging2.budni_pto_mmtkeyword2_block; +insert into archive.budni_pto_Parameter1_block_archive select * from staging2.budni_pto_Parameter1_block; +insert into archive.budni_pto_Parameter2_block_archive select * from staging2.budni_pto_Parameter2_block; insert into archive.budni_pto_perf_report_block_archive select * from staging2.budni_pto_perf_report_block; insert into archive.budni_pto_spec_h1_block_archive select * from staging2.budni_pto_spec_h1_block; insert into archive.budni_pto_summary_block_archive select * from staging2.budni_pto_summary_block; @@ -229,12 +227,6 @@ insert into archive.ptoben_prf_varying_speed_test_high_ambient_block_archive sel - - - update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'archive_function_completed', end_status='success',end_time= now() where job_id=__jobid and step_id=__stepid and latest_runschedule_flag='1'; - -perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'Archive', 'fn_block_archive', err_state, err_msg, err_detail, err_hint, err_context,'success'); - EXCEPTION when OTHERS then GET STACKED DIAGNOSTICS err_state = returned_sqlstate, /* P0002 */ @@ -243,9 +235,6 @@ GET STACKED DIAGNOSTICS err_hint = pg_exception_hint, /* No data error capture */ err_context = pg_exception_context; /* PL/pgSQL function staging2.fn_ftdry_trs_block(integer,integer,text,text,integer) line 69 at RAISE*/ - update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'archive function failed', end_status='error' ,end_time= now() where job_id=6 and step_id=1 and latest_runschedule_flag='1'; - perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'archive', 'fn_block_archive', err_state, err_msg, err_detail, err_hint, err_context,'error'); - end $$ LANGUAGE plpgsql; diff --git a/onetime/commonfunctions/fn_check_count.sql b/onetime/commonfunctions/fn_check_count.sql old mode 100644 new mode 100755 index 7e86c3f..f7ea6b4 --- a/onetime/commonfunctions/fn_check_count.sql +++ b/onetime/commonfunctions/fn_check_count.sql @@ -130,8 +130,8 @@ group by table_name, syspks, file_mnemonic, file_sheet_mnemonic; insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_nmt_noise_at_operator_ear_level_block',count(*) from staging2.budni_nmt_noise_at_operator_ear_level_block where create_time::timestamp >= p_date; insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_nmt_spec_h1_block',count(*) from staging2.budni_nmt_spec_h1_block where create_time::timestamp >= p_date; insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_nmt_test_obs_summary_block',count(*) from staging2.budni_nmt_test_obs_summary_block where create_time::timestamp >= p_date; - insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_pto_mmtkeyword1_block',count(*) from staging2.budni_pto_mmtkeyword1_block where create_time::timestamp >= p_date; - insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_pto_mmtkeyword2_block',count(*) from staging2.budni_pto_mmtkeyword2_block where create_time::timestamp >= p_date; + insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_pto_Parameter1_block',count(*) from staging2.budni_pto_Parameter1_block where create_time::timestamp >= p_date; + insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_pto_Parameter2_block',count(*) from staging2.budni_pto_Parameter2_block where create_time::timestamp >= p_date; insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_pto_perf_report_block',count(*) from staging2.budni_pto_perf_report_block where create_time::timestamp >= p_date; insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_pto_spec_h1_block',count(*) from staging2.budni_pto_spec_h1_block where create_time::timestamp >= p_date; insert into fw_core.check_table_stg_trx_count(schema_name,table_name,row_count) select 'staging2','budni_pto_summary_block',count(*) from staging2.budni_pto_summary_block where create_time::timestamp >= p_date; @@ -322,7 +322,7 @@ EXCEPTION when OTHERS then err_hint = pg_exception_hint, /* No data error capture */ err_context = pg_exception_context; /* PL/pgSQL function staging2.fn_ftdry_trs_block(integer,integer,text,text,integer) line 69 at RAISE*/ - update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'check count failed', end_status='error' ,end_time= now() where job_id=__jobid and step_id=__stepid and latest_runschedule_flag='1'; + update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'check count failed', end_status='success' ,end_time= now() where job_id=__jobid and step_id=__stepid and latest_runschedule_flag='1'; perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'Check_Count', 'fn_check_count', err_state, err_msg, err_detail, err_hint, err_context,'error'); diff --git a/onetime/commonfunctions/fn_fw_ods_misnomer_load.sql b/onetime/commonfunctions/fn_fw_ods_misnomer_load.sql new file mode 100644 index 0000000..358ddc9 --- /dev/null +++ b/onetime/commonfunctions/fn_fw_ods_misnomer_load.sql @@ -0,0 +1,75 @@ +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(1, 20, 1, 'wheel_drive_type', '2', '2WD', 'postgres', '2021-05-26 20:52:59.171', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(2, 20, 1, 'wheel_drive_type', '2 WD', '2WD', 'postgres', '2021-05-26 20:53:06.400', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(3, 20, 1, 'wheel_drive_type', '4 WD', '4WD', 'postgres', '2021-05-26 20:53:16.856', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(4, 20, 1, 'wheel_drive_type', '4', '4WD', 'postgres', '2021-05-26 20:53:20.535', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(5, 20, 1, 'tractor_make', 'Johndeer', 'John Deere', 'postgres', '2021-05-26 21:00:10.211', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(6, 20, 1, 'tractor_make', 'MAHINDRA', 'Mahindra', 'postgres', '2021-05-26 21:00:10.211', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(7, 20, 1, 'tractor_make', 'Japan', 'MAM', 'postgres', '2021-05-26 21:00:10.211', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(8, 20, 1, 'tractor_make', 'Kubota ', 'Kubota', 'postgres', '2021-05-26 21:00:10.211', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(9, 20, 1, 'tractor_make', 'KUBOTA', 'Kubota', 'postgres', '2021-05-26 21:00:10.211', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(10, 20, 1, 'tractor_make', 'Mahindra & Mahindra', 'Mahindra', 'postgres', '2021-05-26 21:00:10.211', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(11, 20, 1, 'tractor_make', 'Mahindra', 'Mahindra', 'postgres', '2021-05-26 21:00:10.211', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(12, 20, 1, 'tractor_make', 'Jhon Deere', 'John Deere', 'postgres', '2021-05-26 21:00:10.211', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(13, 20, 1, 'tractor_make', 'NEW HOLLAND', 'New Holland', 'postgres', '2021-05-26 21:00:10.211', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(14, 20, 1, 'tractor_make', 'JD', 'John Deere', 'postgres', '2021-05-26 21:00:10.211', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(19, 20, 1, 'tractor_model', 'Arjun Trem 4', 'Arjun-Trem-IV', 'postgres', '2021-05-26 21:06:36.956', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(20, 20, 1, 'tractor_model', 'Arjun 605 BS3A', 'Arjun 605 BS 3A', 'postgres', '2021-05-26 21:07:10.903', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(21, 20, 1, 'tractor_model', 'B2741', 'B 2741', 'postgres', '2021-05-26 21:07:54.373', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(22, 20, 1, 'tractor_model', 'JD 5050D V7', 'JD 5050D V7', 'postgres', '2021-05-26 21:08:37.886', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(23, 20, 1, 'tractor_model', 'JOHN DHERE', 'John Deere', 'postgres', '2021-05-26 21:09:18.788', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(24, 20, 1, 'tractor_model', 'KUBOTA L3408', 'Kubota L3408', 'postgres', '2021-05-26 21:09:57.830', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(25, 20, 1, 'tractor_model', 'B2741', 'Kubota B2741', 'postgres', '2021-05-26 21:10:24.457', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(26, 20, 1, 'tractor_model', 'B 2741', 'Kubota B2741', 'postgres', '2021-05-26 21:10:29.379', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(27, 20, 1, 'tractor_model', 'M-Star 60HP 4WD (Boost ) REV 8', 'M-Star 60HP 4WD (Boost ) REV 8', 'postgres', '2021-05-26 21:11:42.910', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(28, 20, 1, 'tractor_model', 'M-Star 60HP 4WD (Boost) +REV 17B', 'M-Star 60HP 4WD (Boost) REV 17B', 'postgres', '2021-05-26 21:12:38.027', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(29, 20, 1, 'tractor_model', 'Mstar 60Hp Trem IV (Normal Mode) +Rev 8', 'Mstar 60Hp Trem IV (Normal Mode) Rev 8', 'postgres', '2021-05-26 21:13:39.510', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(30, 20, 1, 'tractor_model', 'Dhruv CRDI 45 HP +', 'Dhruv CRDI 45 HP', 'postgres', '2021-05-26 21:14:13.126', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(31, 20, 1, 'tractor_model', 'MAM license +(Paddy variant)', 'MAM license(Paddy variant)', 'postgres', '2021-05-26 21:15:15.275', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(32, 20, 1, 'tractor_model', 'M-Star 60HP 4WD (Normal) +REV 17B', 'M-Star 60HP 4WD (Normal) REV 17B', 'postgres', '2021-05-26 21:16:11.990', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(33, 20, 1, 'tractor_model', 'Mstar-Trem-IV (Rev 9) + ( Boost Mode)', 'Mstar-Trem-IV (Rev 9) (Boost Mode)', 'postgres', '2021-05-26 21:17:14.790', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(34, 20, 1, 'tractor_model', 'Trem 4_MSTAR 55HP 2WD +(Engine Dataset Rev. 7) Normal Mode', 'Trem 4_MSTAR 55HP 2WD(Engine Dataset Rev. 7) Normal Mode', 'postgres', '2021-05-26 21:18:27.965', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(35, 20, 1, 'tractor_model', 'Trem 4_MSTAR 55HP 2WD +(Engine Dataset Rev. 7)Boost Mode', 'Trem 4_MSTAR 55HP 2WD(Engine Dataset Rev. 7)Boost Mode', 'postgres', '2021-05-26 21:19:16.384', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(36, 20, 1, 'tractor_model', 'Trem 4_MSTAR 55HP 4WD +(Engine Dataset Rev. 7) Normal Mode', 'Trem 4_MSTAR 55HP 4WD(Engine Dataset Rev. 7) Normal Mode', 'postgres', '2021-05-26 21:19:48.994', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(37, 20, 1, 'tractor_model', 'Trem 4_MSTAR 55HP 4WD +(Engine Dataset Rev. 7)Boost Mode', 'Trem 4_MSTAR 55HP 4WD(Engine Dataset Rev. 7)Boost Mode', 'postgres', '2021-05-26 21:20:49.833', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(38, 20, 1, 'wheel_drive_type', '2wd', '2WD', 'postgres', '2021-05-26 21:23:48.034', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(39, 20, 1, 'wheel_drive_type', '2 wd', '2WD', 'postgres', '2021-05-26 21:23:51.754', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(40, 20, 1, 'wheel_drive_type', '4 wd', '4WD', 'postgres', '2021-05-26 21:23:57.559', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(41, 20, 1, 'wheel_drive_type', '4wd', '4WD', 'postgres', '2021-05-26 21:24:00.469', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(42, 20, 1, 'name_of_implement', 'ROTAVATOR', 'Rotavator', 'postgres', '2021-05-27 21:17:59.157', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(43, 20, 1, 'name_of_implement', 'Disc harrow', 'Disc Harrow', 'postgres', '2021-05-27 21:18:16.312', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(44, 20, 1, 'type_of_implement', '400 Lit capacity', '400 Lit Capacity', 'postgres', '2021-05-27 21:34:26.397', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(45, 20, 1, 'type_of_implement', '600 Lit capacity', '600 Lit Capacity', 'postgres', '2021-05-27 21:34:29.273', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(46, 20, 1, 'type_of_implement', 'Duck foot cultivator', 'Duck Foot Cultivator', 'postgres', '2021-05-27 21:34:33.972', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(47, 20, 1, 'type_of_implement', 'Duck foot Cultivator.', 'Duck Foot Cultivator', 'postgres', '2021-05-27 21:34:36.393', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(48, 20, 1, 'type_of_implement', 'L Blade Rotovator', 'L Blade Rotavator', 'postgres', '2021-05-27 21:34:38.262', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(49, 20, 1, 'type_of_implement', 'L Blades Types', 'L Type Blades', 'postgres', '2021-05-27 21:34:41.003', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(50, 20, 1, 'type_of_implement', 'L Type Blade', 'L Type Blades', 'postgres', '2021-05-27 21:34:45.868', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(51, 20, 1, 'type_of_implement', 'L Blades', 'L Type Blades', 'postgres', '2021-05-27 21:34:47.747', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(52, 20, 1, 'type_of_implement', 'L type Blades', 'L Type Blades', 'postgres', '2021-05-27 21:34:49.567', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(53, 20, 1, 'type_of_implement', 'L type', 'L Type Blades', 'postgres', '2021-05-27 21:34:51.267', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(54, 20, 1, 'type_of_implement', 'L type blade', 'L Type Blades', 'postgres', '2021-05-27 21:34:53.917', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(54, 20, 1, 'type_of_implement', 'L types blade', 'L Type Blades', 'postgres', '2021-05-27 21:34:53.917', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(55, 20, 1, 'type_of_implement', 'L type blade', 'L Type Blades', 'postgres', '2021-05-27 21:34:55.667', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(56, 20, 1, 'type_of_implement', 'L- Blade Rotavator', 'L Type Blade Rotavator', 'postgres', '2021-05-27 21:34:57.447', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(57, 20, 1, 'type_of_implement', 'L- Type blade rotavator', 'L Type Blade Rotavator', 'postgres', '2021-05-27 21:34:59.142', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(58, 20, 1, 'type_of_implement', 'REVERSIBLE', 'Reversible', 'postgres', '2021-05-27 21:35:00.842', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(59, 20, 1, 'type_of_implement', 'Rigid Type', 'Rigid Tyne', 'postgres', '2021-05-27 21:35:03.113', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(60, 20, 1, 'type_of_implement', 'Rigid type', 'Rigid Tyne', 'postgres', '2021-05-27 21:35:05.227', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(61, 20, 1, 'type_of_implement', 'Rigid tupe cultivator', 'Rigid Tyne Cultivator', 'postgres', '2021-05-27 21:35:06.922', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(62, 20, 1, 'type_of_implement', 'Rigid tyne', 'Rigid Tyne', 'postgres', '2021-05-27 21:35:08.447', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(63, 20, 1, 'type_of_implement', 'Rigid type cultivator', 'Rigid Tyne Cultivator', 'postgres', '2021-05-27 21:35:10.552', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(64, 20, 1, 'type_of_implement', 'Rigid tyne cultivator', 'Rigid Tyne Cultivator', 'postgres', '2021-05-27 21:35:12.368', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(65, 20, 1, 'type_of_implement', 'Semi Champion L-Blade', 'Semi Champion L Blade', 'postgres', '2021-05-27 21:35:13.922', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(66, 20, 1, 'type_of_implement', 'Trail Type', 'Trailed Type', 'postgres', '2021-05-27 21:35:15.967', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(67, 20, 1, 'type_of_implement', 'Trailed', 'Trailed Type', 'postgres', '2021-05-27 21:35:17.458', NULL, NULL, 'fw_ods.fw_ods'); +INSERT INTO fw_ods.fw_ods_misnomer (syspk, client_id, function_id, column_name, source_value, target_value, created_by, create_timestamp, updated_by, update_timestamp, table_name) VALUES(68, 20, 1, 'type_of_implement', 'Trailed type Disc Harrow', 'Trailed Type Disc Harrow', 'postgres', '2021-05-27 21:35:19.298', NULL, NULL, 'fw_ods.fw_ods'); diff --git a/onetime/commonfunctions/fn_fw_ods_tractor_info_load.sql b/onetime/commonfunctions/fn_fw_ods_tractor_info_load.sql new file mode 100644 index 0000000..dd584c2 --- /dev/null +++ b/onetime/commonfunctions/fn_fw_ods_tractor_info_load.sql @@ -0,0 +1,208 @@ +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(1, 'FTDRY', 'Mahindra', 'Mstar-Trem-IV (Rev 8)- Boost mode', 'M_Star', 60, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(2, 'FTWET', 'Mahindra', 'BSIII A_MSTAR 57HP 4WD', 'M_Star', 57, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(3, 'FTHLG', 'Mahindra', 'MAM-Liecense', 'Small Tractors', 36, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(4, 'FTDRY', 'Mahindra', 'Mstar-Trem-IV (Rev- A10)', 'M_Star', 55, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(5, 'DBSTD', 'Mahindra', 'Dhruv 575 4WD', 'Dhruv', 45, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(6, 'FTDRY', 'Mahindra', 'Mstar-Trem-IV (Rev 8)- Normal mode', 'M_Star', 57, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(7, 'BUDNI', 'John Deere', '3028EN', 'NA', 28, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(8, 'FTDRY', 'Mahindra', 'Yuvo Star 47 HP', 'Dhruv', 47, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(9, 'FTDRY', 'Mahindra', 'M-Star 65HP-2WD TremIV (Normal) +Rev-9', 'M_Star', 68, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(10, 'FTWET', 'Mahindra', 'Trem 4_MSTAR 55HP 2WD(Engine Dataset Rev. 7)Boost Mode', 'M_Star', 57, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(11, 'BUDNI', 'Mahindra', '605 DI i', 'PVE', 57, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(12, 'FTHLG', 'Mahindra', 'NST REFRESH 45 HP/2WD/', 'H1', 45, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(13, 'FTDRY', 'Mahindra', 'Dhruv CRDI 45 HP', 'Dhruv', 45, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(14, 'FTHLG', 'Mahindra', 'Mstar 57 hp BSIII A', 'M_Star', 57, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(15, 'FTDRY', 'Mahindra', '265 XP Plus', 'H1', 33, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(16, 'FTDRY', 'Mahindra', 'NST Refresh 44HP 2WD', 'H1', 44, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(17, 'BUDNI', 'Mahindra', 'YUVO 415 DI', 'Dhruv', 39, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(18, 'DBSTD', 'Mahindra', '6075 4WD', 'M_Star', 73, '4WD', 'Cabin'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(19, 'FTDRY', 'Mahindra', 'M-Star 75HP-2WD (Boost) Rev 8', 'M_Star', 75, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(20, 'FTDRY', 'Mahindra', 'Dhruv 39hp Regular', 'Dhruv', 39, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(21, 'FTDRY', 'Mahindra', 'Mstar-BS-IIIA', 'M_Star', 65, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(22, 'FTHLG', 'Mahindra', 'Arjun 60HP-2WD TremIV (Boost) +Rev 8', 'H2', 60, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(23, 'BUDNI', 'John Deere', '5050 D V7', 'NA', 50, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(24, 'FTHLG', 'MAM', 'MAM CBU', 'Small Tractors', 36, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(25, 'DBSTD', 'Mahindra', 'Arjun 555 DI HBT', 'H2', 49, NULL, 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(26, 'DBSTD', 'Mahindra', 'Mstar Trem 4 68 HP-4WD Normal mode', 'M_Star', 68, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(27, 'FTHLG', 'Mahindra', 'Yuvo 575', 'Dhruv', 45, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(28, 'FTDRY', 'Mahindra', 'M-Star 75HP-4WD TremIV Rev 8 (Normal)', 'M_Star', 75, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(29, 'FTDRY', 'Mahindra', 'Mstar-Trem-IV (Rev 9) (Normal Mode)', 'M_Star', 65, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(30, 'FTDRY', 'Mahindra', '475DI NST-Refresh', 'H1', 44, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(31, 'FTWET', 'Mahindra', 'Trem 4_MSTAR 55HP 2WD(Engine Dataset Rev. 7) Normal Mode', 'M_Star', 55, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(32, 'FTDRY', 'Mahindra', '475DI NST', 'M_Star', 42, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(33, 'FTDRY', 'Mahindra', 'Arjun-BS-IIIA', 'H2', 57, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(34, 'FTDRY', 'Mahindra', 'Arjun 55HP-2WD TremIV (Normal) +Rev 7', 'H2', 55, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(35, 'DBSTD', 'Mahindra', 'H1 575DI XP Plus', 'H1', 47, NULL, 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(36, 'FTDRY', 'Mahindra', 'M-Star 55HP-2WD (Normal) Rev 7', 'M_Star', 55, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(37, 'FTDRY', 'Mahindra', '33 HP NSTR', 'H1', 33, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(38, 'DBSTD', 'Mahindra', 'Mstar 655 DI', 'M_Star', 65, NULL, 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(39, 'BUDNI', 'Mahindra', 'YUVO 475 DI', 'Dhruv', 42, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(40, 'FTDRY', 'Mahindra', 'B275 DI TU RCRPTO', 'H1', 39, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(41, 'FTWET', 'Mahindra', 'Trem 4_MSTAR 55HP 4WD(Engine Dataset Rev. 7) Normal Mode', 'M_Star', 55, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(42, 'FTDRY', 'Mahindra', 'Dhruv 42hp Regular', 'Dhruv', 42, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(43, 'BUDNI', 'John Deere', '5105 V2', 'NA', 40, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(44, 'DBSTD', 'Mahindra', 'Dhruv 585 DI 4WD', 'Dhruv', 50, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(45, 'FTDRY', 'Mahindra', 'M-Star 60HP 4WD (Normal) REV 17B', 'M_Star', 60, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(46, 'FTDRY', 'Mahindra', 'Arjun 60HP-2WD TremIV (Normal) +Rev 8', 'H2', 60, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(47, 'FTHLG', 'Mahindra', 'Yuvo Star', 'Dhruv', 47, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(48, 'FTDRY', 'Mahindra', 'Mstar-BS-IIIA', 'M_Star', 65, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(49, 'FTDRY', 'Mahindra', 'Yuvo 585', 'Dhruv', 50, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(50, 'FTDRY', 'Mahindra', 'Arjun-Trem-IV (Rev- A10)', 'H2', 55, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(51, 'FTDRY', 'Mahindra', 'M-Star 55HP-4WD Inline', 'M_Star', 55, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(52, 'FTDRY', 'Mahindra', 'M-Star 75HP-4WD TremIV Rev 8 (Boost)', 'M_Star', 75, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(53, 'DBSTD', 'Mahindra', 'Arjun Trem 4 55 HP-2WD Boost', 'H2', 55, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(54, 'FTDRY', 'Mahindra', 'Dhruv 49.96HP P2', 'Dhruv', 50, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(55, 'FTDRY', 'Mahindra', 'Mstar Alternate Approach', 'M_Star', 57, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(56, 'FTDRY', 'Mahindra', 'NOVO Add on Cabin', 'M_Star', 57, '2WD', 'Cabin'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(57, 'FTDRY', 'Mahindra', 'Arjun 60HP-2WD TremIV (Boost) +Rev 8', 'H2', 60, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(58, 'FTHLG', 'Mahindra', 'Arjun 555 DI 49.9 HP HBTU Non CRPTO', 'H2', 50, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(59, 'FTDRY', 'Mahindra', 'Arjun-Trem-IV (Rev- 7)', 'H2', 55, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(60, 'FTDRY', 'Mahindra', 'Arjun 57HP-2WD Inline', 'H2', 57, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(61, 'FTWET', 'Mahindra', 'Yuvo STAR 42HP HCE', 'Dhruv', 42, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(62, 'FTDRY', 'MAM', 'MAM-CBU', 'Small Tractors', 36, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(63, 'FTDRY', 'Mahindra', 'Mstar-Trem-IV (Rev-D15T)', 'M_Star', 75, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(64, 'BUDNI', 'Mahindra', 'JIVO 365 DI P', 'Small Tractors', 36, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(65, 'FTWET', 'Mahindra', 'DHRUV 42HP', 'Dhruv', 42, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(66, 'FTDRY', 'Mahindra', 'Dhruv 39hp HCE', 'Dhruv', 39, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(67, 'DBSTD', 'Mahindra', 'Mstar Trem 4 68 HP-4WD Boost mode', 'M_Star', 68, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(68, 'FTDRY', 'Mahindra', 'Yuvraj NXT 28 HP', 'Small Tractors', 28, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(69, 'IHTNST', 'Mahindra', '265 DI SP Plus(NST-33hp)', 'H1', 33, NULL, 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(70, 'FTHLG', 'Mahindra', 'Arjun 605 DI 57 HP', 'H2', 57, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(71, 'PTOSTD', 'Mahindra', 'Dhruv 31 hp', 'Dhruv', 31, NULL, 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(72, 'FTDRY', 'Mahindra', 'M-Star 60HP 4WD (Boost) REV 17B', 'M_Star', 60, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(73, 'BUDNI', 'New Holland', '5500 TS 12+3 UG', 'NA', 55, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(74, 'DBSTD', 'Mahindra', 'Arjun Trem 4 55 HP-2WD Normal mode', 'H2', 55, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(75, 'IHTSLL', 'Mahindra', 'K2- 4WD HST ', 'K2', 26, NULL, 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(76, 'FTDRY', 'Mahindra', 'NST Refresh 42HP 2WD', 'H1', 42, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(77, 'DBSTD', 'Mahindra', 'Mstar Trem 4 55 HP-2WD', 'M_Star', 55, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(78, 'FTDRY', 'John Deere', 'JD 5050D V7', 'NA', 50, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(79, 'FTDRY', 'Mahindra', 'Mstar 57 hp BSIII A', 'M_Star', 57, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(80, 'DBSTD', 'Mahindra', 'Mstar Trem 4 68 HP-4WD Eco mode', 'M_Star', 68, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(81, 'FTDRY', 'John Deere', 'John Deere 3036EN', 'NA', 36, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(82, 'FTDRY', 'Mahindra', 'Arjun-Trem-IV (Rev-B17)', 'H2', 60, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(83, 'FTHLG', 'Mahindra', 'Arjun 55HP-2WD TremIV (Boost) +Rev 7', 'H2', 55, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(84, 'FTDRY', 'Mahindra', 'Yuvo star 44HP/2WD', 'Dhruv', 44, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(85, 'FTDRY', 'Mahindra', 'M-Star 75HP-4WD Inline', 'M_Star', 75, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(86, 'FTHLG', 'Mahindra', 'Arjun 55HP-2WD TremIV (Normal) +Rev 7', 'H2', 55, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(87, 'FTDRY', 'Mahindra', 'Mstar-BS-IIIA', 'M_Star', 55, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(88, 'FTDRY', 'Mahindra', 'Arjun-Trem-IV (Rev-8)', 'H2', 60, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(89, 'FTDRY', 'Mahindra', 'Mstar-Trem-IV (Rev 9) (Boost Mode)', 'M_Star', 65, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(90, 'FTWET', 'Mahindra', 'DHRUV P2', 'Dhruv', 50, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(91, 'FTDRY', 'Mahindra', 'Y NXT 28 HP', 'Small Tractors', 28, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(92, 'IHTHAM', 'Mahindra', 'Mstar P2 75HP 4WD', 'M_Star', 75, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(93, 'FTDRY', 'Mahindra', 'Arjun 555 HBTU', 'H2', 50, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(94, 'BUDNI', 'John Deere', '5310 V5', 'NA', 55, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(95, 'FTDRY', 'Mahindra', 'NST Refresh 47HP 2WD', 'H1', 47, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(96, 'IHTHLS', 'Mahindra', 'Dhruv export 55hp', 'Dhruv', 55, NULL, 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(97, 'FTDRY', 'Mahindra', 'Mstar-BS-IIIA', 'M_Star', 57, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(98, 'DBSTD', 'Mahindra', 'H1 275DI XP PLUS', 'H1', 44, NULL, 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(99, 'FTHLG', 'Mahindra', 'Yuvo 585', 'Dhruv', 50, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(100, 'FTDRY', 'Mahindra', 'Mstar-Trem-IV (Rev 8)- Boost mode', 'M_Star', 60, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(101, 'FTDRY', 'Mahindra', 'M Star Trem IV 65 HP 4 WD ( Normal) Rev C12', 'M_Star', 68, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(102, 'FTDRY', 'Mahindra', 'Arjun 605 Trem 4 Alternate Approach', 'H2', 57, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(103, 'FTDRY', 'Mahindra', 'Yuvo Star 49.3 HP', 'Dhruv', 49, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(104, 'FTDRY', 'Mahindra', 'M-Star 55HP-2WD', 'M_Star', 52, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(105, 'BUDNI', 'Mahindra', 'ARJUN 605 DI V2', 'M_Star', 56, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(106, 'FTWET', 'Mahindra', 'DHRUV P2 49.96HP', 'Dhruv', 50, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(107, 'FTDRY', 'Mahindra', 'Arjun 555 HBTU + RCRPTO', 'H2', 50, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(108, 'FTDRY', 'Mahindra', 'M-Star 60HP 4WD (Boost ) REV 8', 'M_Star', 60, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(109, 'FTHLG', 'John Deere', '5050 D V7', 'NA', 50, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(110, 'IHTBT50', 'Mahindra', 'Mstar 8100 CAB', 'M_Star', 95, NULL, 'Cabin'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(111, 'FTDRY', 'Mahindra', 'Mstar-Trem-IV (Rev 8)- Normal mode', 'M_Star', 57, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(112, 'FTDRY', 'Mahindra', 'M-Star 65HP-2WD Inline', 'M_Star', 65, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(113, 'DBSTD', 'Mahindra', 'Yuvo 585 DI 2WD SLIPTO', 'Dhruv', 50, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(114, 'FTDRY', 'Mahindra', 'Mstar-Trem-IV (Rev 9) (Boost Mode)', 'M_Star', 65, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(115, 'FTHLG', 'Mahindra', 'Arjun Alternate Approach', 'H2', 57, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(116, 'IHTEMT', 'Mahindra', 'JIVO LOW PROFILE', 'Small Tractors', 24, NULL, 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(117, 'BUDNI', 'Mahindra', '605 DI PS', 'PVE', 52, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(118, 'FTHLG', 'Kubota', 'Kubota L3408', 'NA', 34, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(119, 'FTDRY', 'Mahindra', 'Y-NXT E-Governing OFF', 'Small Tractors', 24, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(120, 'FTDRY', 'Mahindra', '415 DI RCRPTO', 'H1', 39, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(121, 'FTDRY', 'Mahindra', 'Dhruv 42hp HCE', 'Dhruv', 42, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(122, 'FTHLG', 'Mahindra', 'Mstar 60Hp Trem IV +(Boost mode) +Rev 8', 'M_Star', 60, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(123, 'DBSTD', 'Mahindra', 'ARJUN 555 DI', 'H2', 50, NULL, 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(124, 'BUDNI', 'TAFE', 'MF 241 DI Planetary Plus V1', 'NA', 42, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(125, 'FTDRY', 'Kubota', 'Kubota L-3408', 'NA', 34, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(126, 'FTDRY', 'Mahindra', 'M Star 65HP 4WD Inline', 'M_Star', 65, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(127, 'FTDRY', 'Mahindra', '265 DI MKM', 'H1', 30, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(128, 'DBSTD', 'Mahindra', 'Arjun Trem 4 55 HP-2WD Eco mode', 'H2', 55, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(129, 'FTDRY', 'Mahindra', 'M-Star 55HP-4WD TremIV Rev 7 Data (Boost)', 'M_Star', 55, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(130, 'BUDNI', 'Mahindra', 'JIVO 245 DI', 'Small Tractors', 24, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(131, 'FTDRY', 'Mahindra', 'NOVO Non AC Add on Cabin', 'M_Star', 57, '2WD', 'Cabin'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(132, 'BUDNI', 'Mahindra', 'YUVO 575 DI', 'Dhruv', 45, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(133, 'PTOSTD', 'Mahindra', 'Dhruv 31 hp', 'Dhruv', 31, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(134, 'FTDRY', 'Mahindra', 'Mstar-Trem-IV (Rev 7)', 'M_Star', 55, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(135, 'FTDRY', 'Mahindra', 'Arjun 55HP-2WD TremIV (Boost) +Rev 7', 'H2', 55, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(136, 'FTDRY', 'Mahindra', 'Mstar-BS-IIIA', 'M_Star', 57, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(137, 'FTDRY', 'Kubota', 'Kubota B2741', 'NA', 27, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(138, 'FTHLG', 'Mahindra', 'Mstar 57Hp BSIII A', 'M_Star', 57, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(139, 'FTDRY', 'Mahindra', 'Arjun 605 DI 57 HP', 'H2', 57, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(140, 'FTDRY', 'Mahindra', 'Y-NXT E-Governing ON', 'Small Tractors', 24, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(141, 'DBSTD', 'Mahindra', 'YUVO 575 DI SLIPTO 2WD', 'Dhruv', 45, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(142, 'BUDNI', 'John Deere', '5039C PC V3', 'NA', 39, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(143, 'FTDRY', 'Mahindra', 'M-Star 75HP-2WD', 'M_Star', 75, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(144, 'FTHLG', 'MAM', 'MAM license(Paddy variant)', 'Small Tractors', 36, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(145, 'FTHLG', 'Mahindra', 'NST REFRESH 47 HP/2WD/', 'H1', 47, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(146, 'FTDRY', 'Mahindra', 'M-Star 75HP-2WD (Normal) Rev 8', 'M_Star', 75, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(147, 'FTWET', 'Mahindra', 'Trem 4_MSTAR 55HP 4WD(Engine Dataset Rev. 7)Boost Mode', 'M_Star', 57, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(148, 'FTHLG', 'Mahindra', 'Mstar Alternate Approach', 'M_Star', 57, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(149, 'FTDRY', 'John Deere', 'John Deere 3028', 'NA', 28, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(150, 'BUDNI', 'Kubota', 'Kubota B2741', 'NA', 27, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(151, 'FTDRY', 'Mahindra', 'M-Star 55HP-2WD (Boost) Rev A10', 'M_Star', 55, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(152, 'FTHLG', 'Mahindra', 'Arjun 555 DI 49.9 HP HBTU + RCRPTO', 'H2', 50, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(153, 'FTDRY', 'Mahindra', 'M-Star 60HP 4WD (Normal ) REV 8', 'M_Star', 60, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(154, 'FTDRY', 'Mahindra', 'M-Star 75HP-2WD (Boost) Rev D15T', 'M_Star', 75, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(155, 'IHTBT30', 'Mahindra', 'K2 26 HP 4WD ', 'K2', 26, NULL, 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(156, 'FTWET', 'John Deere', 'John Deere', 'NA', 50, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(157, 'FTDRY', 'Mahindra', 'Yuvo 575 Regular - 45HP', 'Dhruv', 45, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(158, 'FTDRY', 'Mahindra', 'Yuvo 575 45 HP', 'Dhruv', 45, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(159, 'FTDRY', 'Mahindra', 'M Star 60HP Inline', 'M_Star', 57, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(160, 'FTWET', 'Mahindra', 'Yuvo STAR 49.96HP', 'Dhruv', 50, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(161, 'FTDRY', 'Mahindra', 'Mstar-Trem-IV (Rev 9) (Normal Mode)', 'M_Star', 65, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(162, 'FTDRY', 'Mahindra', 'Dhruv INLINE 45HP', 'Dhruv', 45, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(163, 'FTDRY', 'Mahindra', 'Yuvraj NXT regular', 'Small Tractors', 24, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(164, 'FTDRY', 'Mahindra', 'NST Refresh 45HP 2WD', 'H1', 45, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(165, 'FTDRY', 'Mahindra', 'Dhruv 585 Engine on Arjun 555 tractor 49.9 hp + NCRPTO', 'Dhruv', 50, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(166, 'FTDRY', 'Mahindra', 'M-Star 55HP-2WD (Normal) Rev A10', 'M_Star', 55, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(167, 'FTWET', 'Mahindra', 'BSIII A_MSTAR 57HP 2WD', 'M_Star', 57, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(168, 'FTDRY', 'Mahindra', 'MAM-Liecense', 'Small Tractors', 36, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(169, 'FTDRY', 'Mahindra', 'Dhruv 49.96hp', 'Dhruv', 50, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(170, 'FTDRY', 'Mahindra', 'M-Star 75HP-2WD (Normal) Rev D15T', 'M_Star', 75, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(171, 'FTDRY', 'Mahindra', 'M Star Trem IV 65 HP 4 WD ( Boost ) Rev C12', 'M_Star', 68, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(172, 'FTDRY', 'Mahindra', 'Mstar-Trem-IV (Rev-8)', 'M_Star', 60, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(173, 'FTDRY', 'Mahindra', 'M Star Trem IV 65 HP 4 WD ( Normal) Rev 9', 'M_Star', 68, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(174, 'FTDRY', 'Mahindra', 'Mstar-Trem-IV(Rev-17B)', 'M_Star', 60, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(175, 'FTDRY', 'Mahindra', 'Mstar-BS-IIIA', 'M_Star', 75, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(176, 'IHTBTD', 'Mahindra', 'Dhruv 575 DI MAT 45hp', 'Dhruv', 45, NULL, 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(177, 'FTWET', 'Mahindra', 'Yuvo STAR 42HP HCE PS', 'Dhruv', 42, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(178, 'FTDRY', 'Mahindra', 'Arjun 555 49.96 HP + NCRPTO', 'H2', 50, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(179, 'FTHLG', 'Mahindra', 'Dhruv 585 Engine on Arjun 555 tractor 49.9 hp + NCRPTO', 'Dhruv', 50, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(180, 'FTDRY', 'Mahindra', 'M-Star 55HP-4WD TremIV Rev 7 Data (Normal)', 'M_Star', 55, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(181, 'FTDRY', 'Mahindra', 'Arjun 605 BS 3A', 'H2', 57, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(182, 'FTHLG', 'Mahindra', 'Arjun 555 49.96 HP + NCRPTO', 'H2', 50, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(183, 'FTHLG', 'MAM', 'MAM-CBU', 'Small Tractors', 36, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(184, 'FTHLG', 'Mahindra', 'Arjun 60HP-2WD TremIV (Normal) +Rev 8', 'H2', 60, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(185, 'PTOBEN', 'Mahindra', 'M-Star 55 Hp', 'M_Star', 55, NULL, 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(186, 'FTDRY', 'Mahindra', 'M-Star 65HP-2WD TremIV (Boost) +Rev-9', 'M_Star', 68, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(187, 'FTDRY', 'John Deere', '5050 D V7', 'NA', 50, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(188, 'FTWET', 'John Deere', 'JD5050D', 'NA', 50, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(189, 'FTHLG', 'Mahindra', 'Mstar 60Hp Trem IV (Normal Mode) Rev 8', 'M_Star', 60, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(190, 'BUDNI', 'John Deere', '5042 D V3', 'NA', 44, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(191, 'FTHLG', 'Mahindra', 'Arjun 57HP-2WD Inline', 'H2', 57, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(192, 'FTDRY', 'Mahindra', 'M Star Trem IV 65 HP 4 WD ( Boost ) Rev 9', 'M_Star', 68, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(193, 'FTDRY', 'Mahindra', 'YuvoStar 33Hp', 'Dhruv', 33, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(194, 'FTDRY', 'Mahindra', 'M-Star 55HP-2WD (Boost) Rev 7', 'M_Star', 55, '2WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(195, 'FTDRY', 'Mahindra', 'Mstar-Trem-IV (Rev-8)', 'M_Star', 75, '4WD', 'Open station'); +INSERT INTO fw_ods.tractor_info ("#", test_file_mnemonic, tractor_make, tractor_model, platform, tractor_engine_hp, wheel_drive_type, "configuration") VALUES(196, 'FTDRY', 'Mahindra', 'Yuvo star 44HP', 'Dhruv', 44, '2WD', 'Open station'); diff --git a/onetime/commonfunctions/fn_run_post_generic_validation.sql b/onetime/commonfunctions/fn_run_post_generic_validation.sql index a042154..7f7c629 100755 --- a/onetime/commonfunctions/fn_run_post_generic_validation.sql +++ b/onetime/commonfunctions/fn_run_post_generic_validation.sql @@ -1,3 +1,6 @@ + + + drop function if exists fw_core.fn_run_post_generic_validation; CREATE OR REPLACE FUNCTION fw_core.fn_run_post_generic_validation(p_client_id int,p_function_id int,p_job_id int,p_step_id int) RETURNS void AS $$ @@ -32,36 +35,47 @@ SELECT SUM (case WHEN end_status = 'success' THEN 1 if (success_sum >0 or success_sum is null) then update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'generic_validation_completed', end_status='success' , end_time= now() where job_id = w_job_id and step_id = w_step_id and latest_runschedule_flag = '1'; else - update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'generic_validation_failed', end_status='error', end_time= now() where job_id = w_job_id and step_id = w_step_id and latest_runschedule_flag = '1'; + update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'generic_validation_failed', end_status='success', end_time= now() where job_id = w_job_id and step_id = w_step_id and latest_runschedule_flag = '1'; return ; end if; ---insert into fw_core.track_jobstep select *,'file_syspk' from fw_core.fw_jobctl_runschedule_jobstep; ---insert into fw_core.track_file select *,'file_syspk' from fw_core.fw_jobctl_file_runschedule; ---insert into fw_core.track_file_sheet select * ,'file_syspk' from fw_core.fw_jobctl_file_sheet_runschedule; + + + + -- validate sheet names for a given file: - for f in select distinct file_syspk,file_mnemonic,file_sheet_mnemonic from fw_core.fw_jobctl_file_sheet_runschedule + for f in select distinct file_syspk,file_mnemonic from fw_core.fw_jobctl_file_sheet_runschedule where file_sheet_mnemonic is not null - and end_status != 'error' and end_status_note = 'generic_validation_completed' and latest_runschedule_flag = '1' + and end_status != 'error' and end_status_note = 'generic_validation_completed' and latest_runschedule_flag = '1' loop + + +if f.file_mnemonic = 'BUDNI' +then + update fw_core.fw_jobctl_file_sheet_runschedule set end_status_note = 'generic_validation_completed', end_status='success', staging_type = 'stg1',end_time = now() where + file_syspk = f.file_syspk; + update fw_core.fw_jobctl_file_runschedule set end_status_note ='generic_validation_completed', end_status='success', staging_type = 'stg1',end_time = now() where file_syspk = f.file_syspk; + +else + select count(distinct sheet_name) from fw_core.test_file_sheet_format_master where sheet_name not in - (select distinct sheet_name from fw_core.fw_jobctl_file_sheet_runschedule where file_mnemonic in (f.file_mnemonic) and file_sheet_mnemonic is not null and file_syspk=f.file_syspk) + (select distinct sheet_name from fw_core.fw_jobctl_file_sheet_runschedule where file_sheet_mnemonic is not null and file_syspk=f.file_syspk) and file_mnemonic in (f.file_mnemonic) into missing_sheet_count; - if missing_sheet_count = 0 then - + if (missing_sheet_count = 0 ) then update fw_core.fw_jobctl_file_sheet_runschedule set end_status_note = 'generic_validation_completed', end_status='success', staging_type = 'stg1',end_time = now() where - file_syspk = f.file_syspk and file_sheet_mnemonic=f.file_sheet_mnemonic; + file_syspk = f.file_syspk; update fw_core.fw_jobctl_file_runschedule set end_status_note ='generic_validation_completed', end_status='success', staging_type = 'stg1',end_time = now() where file_syspk = f.file_syspk; else update fw_core.fw_jobctl_file_sheet_runschedule set end_status_note = 'stg1_sheet_missing', end_status='error', staging_type = 'stg1',end_time = now() where - file_syspk = f.file_syspk and file_sheet_mnemonic=f.file_sheet_mnemonic; + file_syspk = f.file_syspk; update fw_core.fw_jobctl_file_runschedule set end_status_note ='generic_validation_failed', end_status='error', staging_type = 'stg1',end_time = now() where file_syspk = f.file_syspk; + end if; end if; end loop; @@ -70,17 +84,12 @@ end if; if ((success_sum > 0) or (success_sum is null)) then update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'generic_validation_completed', end_status='success', end_time=now() where job_id = w_job_id and step_id = w_step_id and latest_runschedule_flag = '1'; else - update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'generic_validation_failed', end_status='error', end_time=now() where job_id = w_job_id and step_id = w_step_id and latest_runschedule_flag = '1'; + update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'generic_validation_failed', end_status='success', end_time=now() where job_id = w_job_id and step_id = w_step_id and latest_runschedule_flag = '1'; return ; end if; - -insert into fw_core.track_jobstep select *,'missing_sheet' from fw_core.fw_jobctl_runschedule_jobstep; -insert into fw_core.track_file select *,'missing_sheet' from fw_core.fw_jobctl_file_runschedule; -insert into fw_core.track_file_sheet select * ,'missing_sheet' from fw_core.fw_jobctl_file_sheet_runschedule; - -- validate keywords for a given file: for f in select distinct file_syspk,file_mnemonic,file_sheet_mnemonic @@ -108,35 +117,23 @@ insert into fw_core.track_file_sheet select * ,'missing_sheet' from fw_core.fw_ end if; end loop; - -- update fw_jobctl_file_runschedule table. - - ---insert into fw_core.track_jobstep select *,'keyword_' from fw_core.fw_jobctl_runschedule_jobstep; ---insert into fw_core.track_file select *,'keyword_' from fw_core.fw_jobctl_file_runschedule; ---insert into fw_core.track_file_sheet select *,'keyword_' from fw_core.fw_jobctl_file_sheet_runschedule; - ---, staging_type = 'stg1' - update fw_core.fw_jobctl_file_runschedule set end_status_note = 'generic_validation_completed', end_status='success', end_time=now() from fw_core.fw_jobctl_file_sheet_runschedule a where a.latest_runschedule_flag = '1' and a.end_status = 'success' and a.end_status_note ='generic_validation_completed' and fw_core.fw_jobctl_file_runschedule.file_syspk = a.file_syspk; - update fw_core.fw_jobctl_file_runschedule set end_status_note = 'generic_validation_failed' , end_status='error',end_time=now() from fw_core.fw_jobctl_file_sheet_runschedule a + update fw_core.fw_jobctl_file_runschedule set end_status_note = 'validation_failed' , end_status='error',end_time=now() from fw_core.fw_jobctl_file_sheet_runschedule a where a.latest_runschedule_flag = '1' and a.end_status = 'error' and a.end_status_note = 'stg1_keyword_validation_failed' and fw_core.fw_jobctl_file_runschedule.file_syspk = a.file_syspk; update fw_core.fw_jobctl_file_sheet_runschedule set end_status='error',end_status_note = 'stg1_keyword_validation_failed',end_time=now() from fw_core.fw_jobctl_file_runschedule a - where file_sheet_mnemonic is not null and a.latest_runschedule_flag = '1' and a.end_status = 'error' and a.end_status_note = 'generic_validation_failed' and fw_core.fw_jobctl_file_sheet_runschedule.file_syspk = a.file_syspk; + where file_sheet_mnemonic is not null and a.latest_runschedule_flag = '1' and a.end_status = 'error' and a.end_status_note = 'validation_failed' and fw_core.fw_jobctl_file_sheet_runschedule.file_syspk = a.file_syspk; SELECT SUM (case WHEN end_status = 'success' THEN 1 ELSE 0 END) AS "Error Sum" FROM fw_core.fw_jobctl_file_runschedule where latest_runschedule_flag = '1' INTO success_sum; if (success_sum >0 or success_sum is null) then update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'generic_validation_completed', end_status='success', end_time=now() where job_id = w_job_id and step_id = w_step_id and latest_runschedule_flag = '1'; else - update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'generic_validation_failed', end_status= 'error', end_time=now() where job_id = w_job_id and step_id = w_step_id and latest_runschedule_flag = '1'; + update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'generic_validation_failed', end_status= 'success', end_time=now() where job_id = w_job_id and step_id = w_step_id and latest_runschedule_flag = '1'; end if; ---insert into fw_core.track_jobstep select *,'keyword_missing' from fw_core.fw_jobctl_runschedule_jobstep; ---insert into fw_core.track_file select *,'keyword_missing' from fw_core.fw_jobctl_file_runschedule; ---insert into fw_core.track_file_sheet select *,'keyword_missing' from fw_core.fw_jobctl_file_sheet_runschedule; - end; $$ LANGUAGE plpgsql; + diff --git a/onetime/commonfunctions/fn_run_post_trx_validation.sql b/onetime/commonfunctions/fn_run_post_trx_validation.sql old mode 100644 new mode 100755 index 57d8182..fe84e15 --- a/onetime/commonfunctions/fn_run_post_trx_validation.sql +++ b/onetime/commonfunctions/fn_run_post_trx_validation.sql @@ -16,19 +16,16 @@ CREATE OR REPLACE FUNCTION fw_core.fn_run_trx_post_validation(p_client_id int,p_ loop select count(*) from transactional.test_instance where file_syspk = f.file_syspk into trx_record_count; if (trx_record_count = 0) then - update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'trx_post_validation_failed', end_status='error', end_time= now() where job_id = w_job_id and step_id = w_step_id and latest_runschedule_flag = '1'; + --update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'trx_post_validation_failed', end_status='success', end_time= now() where job_id = w_job_id and step_id = w_step_id and latest_runschedule_flag = '1'; update fw_core.fw_jobctl_file_sheet_runschedule set end_status_note = 'trx_post_validation_failed', end_status='error', end_time= now() where file_syspk=f.file_syspk; update fw_core.fw_jobctl_file_runschedule set end_status_note = 'trx_post_validation_failed', end_status='error', end_time= now() where file_syspk=f.file_syspk; else - update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'TRX_completed', end_status='success' , end_time= now() where job_id = w_job_id and step_id = w_step_id and latest_runschedule_flag = '1'; + --update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'TRX_completed', end_status='success' , end_time= now() where job_id = w_job_id and step_id = w_step_id and latest_runschedule_flag = '1'; update fw_core.fw_jobctl_file_sheet_runschedule set end_status_note = 'TRX_completed', end_status='success', end_time= now() where file_syspk=f.file_syspk; update fw_core.fw_jobctl_file_runschedule set end_status_note = 'TRX_completed', end_status='success', end_time= now() where file_syspk=f.file_syspk; end if; end loop; -/* ---insert into fw_core.track_jobstep select *,'trx_validation' from fw_core.fw_jobctl_runschedule_jobstep; ---insert into fw_core.track_file select *,'trx_validation' from fw_core.fw_jobctl_file_runschedule; ---insert into fw_core.track_file_sheet select *,'trx_validation' from fw_core.fw_jobctl_file_sheet_runschedule; -*/ +update fw_core.fw_jobctl_runschedule_jobstep set end_status='success', end_status_note = 'TRX_post_validation_completed', end_time= now() where job_id = w_job_id and step_id = w_step_id and latest_runschedule_flag = '1'; + end; $$ LANGUAGE plpgsql; \ No newline at end of file diff --git a/onetime/commonfunctions/fn_run_trx_rollback.sql b/onetime/commonfunctions/fn_run_trx_rollback.sql index c27e3d5..a456c69 100755 --- a/onetime/commonfunctions/fn_run_trx_rollback.sql +++ b/onetime/commonfunctions/fn_run_trx_rollback.sql @@ -4,7 +4,8 @@ CREATE OR REPLACE FUNCTION fw_core.fn_run_trx_rollback(p_client_id int,p_functio declare f record; begin - for f in select file_syspk,file_mnemonic + + for f in select file_syspk,file_mnemonic from fw_core.fw_jobctl_file_runschedule where latest_runschedule_flag = '1' and end_status = 'error' and end_status_note in ('stg2_failed','TRX_failed') order by file_syspk @@ -162,13 +163,8 @@ CREATE OR REPLACE FUNCTION fw_core.fn_run_trx_rollback(p_client_id int,p_functio delete from transactional.iht_hot_air_mapping_results where file_syspk = f.file_syspk; end if; end loop; + update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'rollback completed', end_status='success', end_time=now() where job_id = p_job_id and step_id = p_step_id and latest_runschedule_flag = '1'; - - ---insert into fw_core.track_jobstep select *,'roll_back' from fw_core.fw_jobctl_runschedule_jobstep; ---insert into fw_core.track_file select *,'roll_back' from fw_core.fw_jobctl_file_runschedule; ---insert into fw_core.track_file_sheet select *,'roll_back' from fw_core.fw_jobctl_file_sheet_runschedule; - end; $$ LANGUAGE plpgsql; \ No newline at end of file diff --git a/onetime/commonfunctions/fn_run_updates.sql b/onetime/commonfunctions/fn_run_updates.sql new file mode 100644 index 0000000..5a5045b --- /dev/null +++ b/onetime/commonfunctions/fn_run_updates.sql @@ -0,0 +1,44 @@ +drop function if exists transactional.fn_run_updates; +CREATE OR REPLACE FUNCTION transactional.fn_run_updates(p_client_id int,p_function_id int) + RETURNS void AS $$ + begin +-- Update location at test_insstance table: +update transactional.test_instance +set test_location_name = 'BUDNI' +where file_mnemonic = 'BUDNI' ; + +update transactional.test_instance +set test_location_name = 'MRV Test Track' +where file_mnemonic in ('DBSTD', 'DBOECD'); + +update transactional.test_instance +set test_location_name = 'MRV Test Track' +where file_mnemonic like 'IHT%'; + +update transactional.test_instance +set test_location_name = 'MRV' +where file_mnemonic like 'PTO%'; + +update transactional.test_instance +set season = TO_CHAR( + TO_DATE (extract( month from date_of_test)::text, 'MM'), 'Month' + ) +where season is null +and file_mnemonic in ('FTDRY','FTWET'); + +update transactional.test_instance +set date_of_test = test_report_date +where date_of_test is null +and file_mnemonic like 'IHT%'; + + + +update transactional.test_instance +set date_of_test = test_end_date +where date_of_test is null +and file_mnemonic like 'IHT%'; + + + +end; +$$ LANGUAGE plpgsql; diff --git a/onetime/commonfunctions/fn_update_generic.sql b/onetime/commonfunctions/fn_update_generic.sql index e56d956..4e5546d 100755 --- a/onetime/commonfunctions/fn_update_generic.sql +++ b/onetime/commonfunctions/fn_update_generic.sql @@ -25,50 +25,77 @@ __lead_trim_columns text; __Dots_3 text; __inverted_comma text; __underscore text; +__hashvalue text; begin loop exit when __n=53; __n := __n+1; + __na_sql := 'update staging1.staging_generic_table set '|| concat('column',__n)||' =null where '||concat('column',__n)||'=''NA'' and file_syspk=' ||filesyspk; + __space_sql := 'update staging1.staging_generic_table set '|| concat('column',__n)||' =null where '||concat('column',__n)||'='''' and file_syspk=' ||filesyspk; + __div_sql := 'update staging1.staging_generic_table set '|| concat('column',__n)||' =null where '||concat('column',__n)||'=''#REF!'' and file_syspk=' ||filesyspk; + __ref_sql := 'update staging1.staging_generic_table set '|| concat('column',__n)||' =null where '||concat('column',__n)||'=''#DIV/0!'' and file_syspk=' ||filesyspk; + __hyphen_sql := 'update staging1.staging_generic_table set '|| concat('column',__n)||' =null where '||concat('column',__n)||'=''-'' and file_syspk=' ||filesyspk; + __hyphen_3_sql := 'update staging1.staging_generic_table set '|| concat('column',__n)||' =null where '||concat('column',__n)||'=''---'' and file_syspk=' ||filesyspk; + __not_applicable := 'update staging1.staging_generic_table set '|| concat('column',__n)||' =null where '||concat('column',__n)||'=''Not Applicable '' and file_syspk=' ||filesyspk; + __NR := 'update staging1.staging_generic_table set '|| concat('column',__n)||' =null where '||concat('column',__n)||'=''NR'' and file_syspk=' ||filesyspk; + __Dots_1 := 'update staging1.staging_generic_table set '|| concat('column',__n)||' =null where '||concat('column',__n)||'=''u..'' and file_syspk=' ||filesyspk; + __Dots_2 := 'update staging1.staging_generic_table set '|| concat('column',__n)||' =null where '||concat('column',__n)||'=''u.'' and file_syspk=' ||filesyspk; + __Dots_3 := 'update staging1.staging_generic_table set '|| concat('column',__n)||' =null where '||concat('column',__n)||'=''.'' and file_syspk=' ||filesyspk; + __inverted_comma := 'update staging1.staging_generic_table set '|| concat('column',__n)||' =null where '||concat('column',__n)||'=''`'' and file_syspk=' ||filesyspk; - __trail_trim_columns:='update staging1.staging_generic_table set '|| concat('column',__n)||' = trim(trailing from '|| concat('column',__n)||')'; - __lead_trim_columns:='update staging1.staging_generic_table set '|| concat('column',__n)||' = trim(leading from '|| concat('column',__n)||')'; + + __trail_trim_columns:='update staging1.staging_generic_table set '|| concat('column',__n)||' = trim(trailing from '|| concat('column',__n)||') + where file_syspk=' ||filesyspk; + + __lead_trim_columns:='update staging1.staging_generic_table set '|| concat('column',__n)||' = trim(leading from '|| concat('column',__n)||') + where file_syspk=' ||filesyspk; + __underscore := 'update staging1.staging_generic_table set '|| concat('column',__n)||' =null where '||concat('column',__n)||'=''_'' and file_syspk=' ||filesyspk; - execute __na_sql; + + __hashvalue := 'update staging1.staging_generic_table set '|| concat('column',__n)||' =null + where '||concat('column',__n)||'=''#VALUE!'' and file_syspk=' ||filesyspk; + + + execute __na_sql; execute __space_sql; execute __div_sql; execute __ref_sql; execute __hyphen_sql; + execute __hyphen_3_sql; execute __not_applicable; execute __NR; execute __Dots_1; execute __Dots_2; + execute __Dots_3; execute __trail_trim_columns; execute __lead_trim_columns; execute __underscore; + execute __hashvalue; + execute __space_sql; end loop; end; $function$ \ No newline at end of file diff --git a/onetime/configentries/BUDNI_config.sql b/onetime/configentries/BUDNI_config.sql index d2927e7..095bcec 100755 --- a/onetime/configentries/BUDNI_config.sql +++ b/onetime/configentries/BUDNI_config.sql @@ -9,8 +9,8 @@ insert into transactional.source_config (file_mnemonic,file_sheet_mnemonic,block_tag,f1_modified,f1_keyword) values ('BUDNI','BUDNI_NMT','BUDNI_NMT_Spec_H1','Test Tractor Specifiactions','Test Tractor Specifiactions'), -('BUDNI','BUDNI_NMT','BUDNI_NMT_ Noise at bystander’s position', 'Noise at bystander''’s position: Noise Measurement Test', 'Noise at bystander''’s position: Noise Measurement Test'), -('BUDNI','BUDNI_NMT','BUDNI_NMT_ Noise at operator’s ear level','Noise at operator''’s ear level: Noise Measurement Test','Noise at operator''’s ear level: Noise Measurement Test'), +('BUDNI','BUDNI_NMT','BUDNI_NMT_Noise_at_bystander’s_position', 'Noise at bystander’s position: Noise Measurement Test', 'Noise at bystander’s position: Noise Measurement Test'), +('BUDNI','BUDNI_NMT','BUDNI_NMT_Noise_at_operator’s_ear_level','Noise at operator’s ear level: Noise Measurement Test','Noise at operator’s ear level: Noise Measurement Test'), ('BUDNI','BUDNI_NMT','BUDNI_NMT_Test_Obs_Summary','Noise Measurement Test Observations Summary','Noise Measurement Test Observations Summary'); insert into transactional.source_config @@ -23,9 +23,9 @@ insert into transactional.source_config (file_mnemonic,file_sheet_mnemonic,block_tag,f1_modified,f1_keyword) values ('BUDNI','BUDNI_PTO','BUDNI_PTO_Spec_H1','Test Tractor Specifiactions','Test Tractor Specifiactions'), -('BUDNI','BUDNI_PTO','BUDNI_PTO_Report','PTO Performance Report','PTO Performance Report'), -('BUDNI','BUDNI_PTO','BUDNI_PTO_MMTKeyword1','MMTKeyword1','MMTKeyword1'), -('BUDNI','BUDNI_PTO','BUDNI_PTO_MMTKeyword2','MMTKeyword2','MMTKeyword2'), +('BUDNI','BUDNI_PTO','BUDNI_PTO_Perf_Report','PTO Performance Report','PTO Performance Report'), +('BUDNI','BUDNI_PTO','BUDNI_PTO_Parameter1','Parameter1','Parameter1'), +('BUDNI','BUDNI_PTO','BUDNI_PTO_Parameter2','Parameter2','Parameter2'), ('BUDNI','BUDNI_PTO','BUDNI_PTO_Summary','PTO Performance Test Observations Summary','PTO Performance Test Observations Summary'); insert into transactional.source_config @@ -33,7 +33,7 @@ insert into transactional.source_config values ('BUDNI','BUDNI_HDL','BUDNI_HDL_Spec_H1','Test Tractor Specifiactions','Test Tractor Specifiactions'), ('BUDNI','BUDNI_HDL','BUDNI_HDL_Power_Test','A) Hydraulic power test:','A) Hydraulic power test:'), -('BUDNI','BUDNI_HDL','BUDNI_HDL_Lifting_Capacity_Test','B) Lifting Capacity Test','B) Lifting Capacity Test'), +('BUDNI','BUDNI_HDL','BUDNI_HDL_Lifting_Capacity_Test','Tapping Point','Tapping Point'), ('BUDNI','BUDNI_HDL','BUDNI_HDL_Maintenance_Of_Lift_Load','C) Maintenance of lift load:','C) Maintenance of lift load:'), ('BUDNI','BUDNI_HDL','BUDNI_HDL_Test_Obs_Summary','Power Lift and Hydraulic Pump Performance Test Observations Summary','Power Lift and Hydraulic Pump Performance Test Observations Summary'); diff --git a/onetime/configentries/IHT_config.sql b/onetime/configentries/IHT_config.sql index 2ef093f..f5536a1 100755 --- a/onetime/configentries/IHT_config.sql +++ b/onetime/configentries/IHT_config.sql @@ -4,7 +4,7 @@ values ('IHTNST','IHTNST_NST','IHTNST_NST_H1','Test Request No','Test Request No'), ('IHTNST','IHTNST_NST','IHTNST_NST_Tyre_Details','Tyre Details','Tyre Details'), ('IHTNST','IHTNST_NST','IHTNST_NST_Engine_RPM_Atmos','Engine RPM','Engine RPM'), -('IHTNST','IHTNST_NST','IHTNST_NST_STAND_Noise','BY STANDER’S NOISE','BY STANDER’S NOISE'), +('IHTNST','IHTNST_NST','IHTNST_NST_STAND_Noise','BY STANDERS NOISE','BY STANDERS NOISE'), ('IHTNST','IHTNST_NST','IHTNST_NST_OEL_Noise','OEL Noise without Load','OEL Noise without Load'), ('IHTNST','IHTNST_NST','IHTNST_NST_OEL_Noise_Load','OEL Noise with Load','OEL Noise with Load'), ('IHTNST','IHTNST_NST','IHTNST_NST_Footer','Prepared by','Prepared by'); @@ -60,9 +60,9 @@ insert into transactional.source_config values ('IHTSLL','IHTSLL_SLL','IHTSLL_SLL_H1','Test Request No','Test Request No'), ('IHTSLL','IHTSLL_SLL','IHTSLL_SLL_Weight_Tyre','Weight Reaction','Weight Reaction'), -('IHTSLL','IHTSLL_SLL','IHTSLL_SLL_Forward','K2-4WD HST EACH GEAR MAX SPEED - FORWARD','K2-4WD HST EACH GEAR MAX SPEED - FORWARD'), -('IHTSLL','IHTSLL_SLL','IHTSLL_SLL_Reverse','K2- 4WD HST EACH GEAR MAX SPEED REVERSE','K2- 4WD HST EACH GEAR MAX SPEED REVERSE'), -('IHTSLL','IHTSLL_SLL','IHTSLL_SLL_Lead_Lag','Lead / Lag Measurement on K2 4WD HST','Lead / Lag Measurement on K2 4WD HST'), +('IHTSLL','IHTSLL_SLL','IHTSLL_SLL_Forward','GEAR MAX SPEED-FORWARD','GEAR MAX SPEED-FORWARD'), +('IHTSLL','IHTSLL_SLL','IHTSLL_SLL_Reverse','GEAR MAX SPEED-REVERSE','GEAR MAX SPEED-REVERSE'), +('IHTSLL','IHTSLL_SLL','IHTSLL_SLL_Lead_Lag','Lead / Lag Measurement','Lead / Lag Measurement'), ('IHTSLL','IHTSLL_SLL','IHTSLL_SLL_Footer','Prepared by','Prepared by'); insert into transactional.source_config diff --git a/onetime/configentries/control-master.sql b/onetime/configentries/control-master.sql index a2a0934..7e81f70 100755 --- a/onetime/configentries/control-master.sql +++ b/onetime/configentries/control-master.sql @@ -9,11 +9,8 @@ values ,(21, 1, 'daily', '', '', '', '00:00:00', '00:00:00', 3, 1, 9004, true, 'txn_load', 'run_wrapper_txn', 'sql_fn', 'fw_core.fn_run_master_wrapper', '{}', '', '{}', '', '', '', '', 'Admin', 'Admin', now(), now()) ,(21, 1, 'daily', '', '', '', '00:00:00', '00:00:00', 3, 2, 9005, true, 'txn_load', 'txn_load_validations', 'sql_fn', 'fw_core.fn_run_trx_post_validation', '{}', '', '{}', '', '', '', '', 'Admin', 'Admin', now(), now()) ,(21, 1, 'daily', '', '', '', '00:00:00', '00:00:00', 3, 3, 9006, true, 'roll_back', 'roll_back', 'sql_fn', 'fw_core.fn_run_trx_rollback', '{}', '', '{}', '', '', '', '', 'Admin', 'Admin', now(), now()) -,(21, 1, 'daily', '', '', '', '00:00:00', '00:00:00', 3, 4, 9007, true, 'reporting_ods_load', 'reporting_ods_load', 'sql_fn', 'fw_ods.fn_fw_ods_load', '{}', '', '{}', '', '', '', '', 'Admin', 'Admin', now(), now()) -,(21, 1, 'daily', '', '', '', '00:00:00', '00:00:00', 4, 1, 9008, true, 'file_cleanup', 'move_the_files', 'shell_script', '/home/compegence/customer/MMT/sql/scripts/file_move.sh', '{}', '', '{}', '', '', '', '', 'Admin', 'Admin', now(), now()) ---,(21, 1, 'daily', '', '', '', '00:00:00', '00:00:00', 5, 1, 9009, true, 'final_checks', 'final checks before marking runschedule status as success', 'sql', 'ex2.sql', '{}', '', '{}', '', '', '', '', 'Admin', 'Admin', now(), now()) -,(21, 1, 'daily', '', '', '', '00:00:00', '00:00:00', 5, 1, 9009, true, 'archival', 'Archival of satging2 block tables', 'sql_fn', 'fw_core.fn_run_block_archive', '{}', '', '{}', '', '', '', '', 'Admin', 'Admin', now(), now()) -,(21, 1, 'daily', '', '', '', '00:00:00', '00:00:00', 6, 1, 9010, true, 'check counts', 'chech count in fw_core schema', 'sql_fn', 'fw_core.fn_run_check_count', '{}', '', '{}', '', '', '', '', 'Admin', 'Admin', now(), now()) +,(21, 1, 'daily', '', '', '', '00:00:00', '00:00:00', 4, 1, 9007, true, 'reporting_ods_load', 'reporting_ods_load', 'sql_fn', 'fw_ods.fn_fw_ods_load', '{}', '', '{}', '', '', '', '', 'Admin', 'Admin', now(), now()) +,(21, 1, 'daily', '', '', '', '00:00:00', '00:00:00', 5, 1, 9008, true, 'file_cleanup', 'move_the_files', 'shell_script', '/home/compegence/customer/MMT/sql/scripts/file_move.sh', '{}', '', '{}', '', '', '', '', 'Admin', 'Admin', now(), now()) +,(21, 1, 'daily', '', '', '', '00:00:00', '00:00:00', 6, 1, 9009, true, 'check counts', 'check count in fw_core schema', 'sql_fn', 'fw_core.fn_run_check_count', '{}', '', '{}', '', '', '', '', 'Admin', 'Admin', now(), now()) ; - diff --git a/onetime/configentries/test_lab_data.sql b/onetime/configentries/test_lab_data.sql index 3d32236..597b47a 100755 --- a/onetime/configentries/test_lab_data.sql +++ b/onetime/configentries/test_lab_data.sql @@ -26,5 +26,5 @@ INSERT INTO transactional.test_lab_location_master (client_id,function_id,locati INSERT INTO transactional.test_lab_location_master (client_id,function_id,location_name,soil_type,created_by,create_timestamp) VALUES (20,1,'Sardargarh (Jetsar)',NULL,current_user,now()) ,(20,1,'Budni',NULL,current_user,now()) -,(20,1,'MRV FD Test Track',NULL,current_user,now()) +,(20,1,'MRV Test Track',NULL,current_user,now()) ; diff --git a/onetime/createtables/common/extension.sql b/onetime/createtables/common/extension.sql index 6f66eaf..ba4dd51 100755 --- a/onetime/createtables/common/extension.sql +++ b/onetime/createtables/common/extension.sql @@ -1,3 +1,6 @@ SET search_path To staging2; drop extension tablefunc; -create extension tablefunc; \ No newline at end of file +create extension tablefunc; + + + diff --git a/onetime/createtables/control/control_tables.sql b/onetime/createtables/control/control_tables.sql index 589193b..93d9cf8 100755 --- a/onetime/createtables/control/control_tables.sql +++ b/onetime/createtables/control/control_tables.sql @@ -1,3 +1,4 @@ + SET search_path To fw_core; CREATE DOMAIN fw_flag_bool AS BOOL; @@ -312,3 +313,5 @@ CREATE TABLE staging1.staging_generic_table ( column52 varchar(1024) NULL, column53 varchar(1024) NULL ); + + diff --git a/onetime/createtables/ods/.sql b/onetime/createtables/ods/.sql index fb6acbe..15ff0a2 100755 --- a/onetime/createtables/ods/.sql +++ b/onetime/createtables/ods/.sql @@ -97,7 +97,7 @@ CREATE TABLE trx.trx ( temp_exhaust_c int4 NULL, temp_fuel_temp_c int4 NULL, pct_of_backup_torque int4 NULL, - equ_cblock_row_number_torque_nm numeric NULL, + equ_crank_torque_nm numeric NULL, max_equ_crankshaft_torque_nm numeric NULL, load_pct int4 NULL, load_kg numeric NULL, diff --git a/onetime/createtables/ods/create_table_fw_ods.sql b/onetime/createtables/ods/create_table_fw_ods.sql index a5e89cf..a42f031 100755 --- a/onetime/createtables/ods/create_table_fw_ods.sql +++ b/onetime/createtables/ods/create_table_fw_ods.sql @@ -108,6 +108,7 @@ CREATE TABLE fw_ods.fw_ods ( name_of_implement fw_text NULL, type_of_implement fw_text NULL, implement_weight_kg fw_num_dimid NULL, + platform fw_text NULL, tyre_size fw_text NULL, tyre_ply_rating fw_num_dimid NULL, tyre_pressure_kg_per_cm2 fw_num_metric NULL, @@ -204,8 +205,9 @@ CREATE TABLE fw_ods.fw_ods_detailed ( syspk serial NOT NULL, client_id fw_num_dimid NOT NULL, function_id fw_num_dimid NOT NULL, - test_file_mnemonic fw_num_dimid NULL, - test_sheet_mnemonic fw_num_dimid NULL, + test_file_mnemonic fw_text NULL NULL, + test_sheet_mnemonic fw_text NULL NULL, + test_name fw_text NULL, test_file_id fw_num_dimid NULL, test_file_name fw_text NULL, test_instance_id fw_num_dimid NULL, @@ -214,7 +216,8 @@ CREATE TABLE fw_ods.fw_ods_detailed ( tractor_engine_hp fw_num_dimid NULL, wheel_drive_type fw_text NULL, "configuration" fw_text NULL, - test_insance_tractor_id fw_num_dimid NULL, + platform fw_text NULL, + test_instance_tractor_id fw_num_dimid NULL, season fw_text NULL, test_date fw_date NULL, test_date_year fw_num_dimid NULL, @@ -265,6 +268,7 @@ create table fw_ods.fw_ods_tractor_specifications ( DROP TABLE if exists fw_ods.fw_ods_comments; + CREATE TABLE fw_ods.fw_ods_comments ( syspk bigserial NOT NULL, client_id fw_ods."fw_num_dimid" NULL, @@ -295,10 +299,10 @@ CREATE TABLE fw_ods.fw_ods_comments ( tractor_engine_hp int4 NULL, name_of_implement fw_ods."fw_text" NULL, type_of_implement fw_ods."fw_text" NULL, - season fw_ods."fw_text" NULL + season fw_ods."fw_text" NULL, + "configuration" fw_ods."fw_text" NULL ); - -- fw_ods.fw_ods_drawbar_performance definition -- Drop table @@ -320,6 +324,7 @@ CREATE TABLE fw_ods.fw_ods_drawbar_performance ( tractor_engine_hp fw_ods."fw_num_dimid" NULL, wheel_drive_type fw_ods."fw_text" NULL, "configuration" fw_ods."fw_text" NULL, + platform fw_text NULL, test_instance_tractor_id fw_ods."fw_num_dimid" NULL, season fw_ods."fw_text" NULL, test_date fw_ods."fw_date" NULL, @@ -389,38 +394,129 @@ CREATE TABLE fw_ods.fw_ods_drawbar_performance ( -- Drop table -DROP TABLE if exist fw_ods.fw_ods_observations; +drop table if exists fw_ods.fw_ods_observations; CREATE TABLE fw_ods.fw_ods_observations ( - syspk bigserial NOT NULL, - client_id fw_ods."fw_num_dimid" NULL, - function_id fw_ods."fw_num_dimid" NULL, - test_file_mnemonic fw_ods."fw_text" NULL, - test_sheet_mnemonic fw_ods."fw_text" NULL, - test_file_id fw_ods."fw_num_dimid" NULL, - test_file_name fw_ods."fw_text" NULL, - test_iteration_number fw_ods."fw_num_dimid" NULL, - platform fw_ods."fw_text" NULL, - benchmark_yn fw_ods."fw_text" NULL, - tractor_make fw_ods."fw_text" NULL, - tractor_model fw_ods."fw_text" NULL, - tractor_engine_hp fw_ods."fw_num_dimid" NULL, - wheel_drive_type fw_ods."fw_text" NULL, - name_of_implement fw_ods."fw_text" NULL, - type_of_implement fw_ods."fw_text" NULL, - season fw_ods."fw_text" NULL, - parameters fw_ods."fw_text" NULL, - "sequence" fw_ods."fw_num_dimid" NULL, - tractor_model1 fw_ods."fw_text" NULL, - tractor_model2 fw_ods."fw_text" NULL, - tractor_model3 fw_ods."fw_text" NULL, - tractor_model4 fw_ods."fw_text" NULL, - tractor_model5 fw_ods."fw_text" NULL, - display_yn fw_ods."fw_text" NULL, - created_by fw_ods."fw_text" NULL, - updated_by fw_ods."fw_text" NULL, - create_timestamp fw_ods."fw_timestamp" NULL, - update_timestamp fw_ods."fw_timestamp" NULL, - old_test_file_name fw_ods."fw_text" NULL +syspk bigserial NOT NULL, +client_id fw_ods.fw_num_dimid NULL, +function_id fw_ods.fw_num_dimid NULL, +test_file_mnemonic fw_ods.fw_text NULL, +test_sheet_mnemonic fw_ods.fw_text NULL, +test_file_id fw_ods.fw_num_dimid NULL, +test_file_name fw_ods.fw_text NULL, +test_iteration_number fw_ods.fw_num_dimid NULL, +platform fw_ods.fw_text NULL, +benchmark_yn fw_ods.fw_text NULL, +tractor_make fw_ods.fw_text NULL, +tractor_model fw_ods.fw_text NULL, +tractor_engine_hp fw_ods.fw_num_dimid NULL, +wheel_drive_type fw_ods.fw_text NULL, +name_of_implement fw_ods.fw_text NULL, +type_of_implement fw_ods.fw_text NULL, +season fw_ods.fw_text NULL, +"configuration" fw_ods.fw_text NULL, +engine_smoke_on_load fw_ods.fw_text NULL, +engine_acceleration_smoke fw_ods.fw_text NULL, +range_gear_shifting fw_ods.fw_text NULL, +speed_gear_shifting fw_ods.fw_text NULL, +draft_response fw_ods.fw_text NULL, +tractor_steer_ability fw_ods.fw_text NULL, +tractor_braking_performance fw_ods.fw_text NULL, +front_visibility fw_ods.fw_text NULL, +implement_accessibility fw_ods.fw_text NULL, +front_wheel_dragging_at_turning fw_ods.fw_text NULL, +front_end_lifting_during_operation fw_ods.fw_text NULL, +rpm_recovery_time fw_ods.fw_text NULL, +engine_vibration fw_ods.fw_text NULL, +engine_sound fw_ods.fw_text NULL, +implement_lifing_lowering_response fw_ods.fw_text NULL, +pulverization_quality fw_ods.fw_text NULL, +pulverization_index fw_ods.fw_text NULL, +created_by fw_ods.fw_text NULL DEFAULT CURRENT_USER, +create_timestamp fw_ods.fw_timestamp NULL DEFAULT now(), +updated_by fw_ods.fw_text NULL , +update_timestamp fw_ods.fw_timestamp null +); + + +-- fw_ods.tractor_info definition + DROP table if exists fw_ods.tractor_info; +CREATE TABLE fw_ods.tractor_info ( + "#" int4 NULL, + test_file_mnemonic varchar(7) NULL, + tractor_make varchar(11) NULL, + tractor_model varchar(56) NULL, + platform varchar(14) NULL, + tractor_engine_hp int4 NULL, + wheel_drive_type varchar(6) NULL, + "configuration" varchar(12) NULL ); + +-- fw_ods.fw_ods_misnomer definition + + DROP table if exists fw_ods.fw_ods_misnomer; + +CREATE TABLE fw_ods.fw_ods_misnomer ( + syspk int4 NOT NULL, + client_id int4 NOT NULL, + function_id int4 NOT NULL, + column_name text NULL, + source_value text NULL, + target_value text NULL, + created_by text NULL, + create_timestamp timestamp NULL, + updated_by text NULL, + update_timestamp timestamp NULL, + table_name text NULL +); + + + + +-- FTWET / FTDRY: field_perfm_ +alter table fw_ods.fw_ods add column implement_size fw_ods.fw_text NULL; +alter table fw_ods.fw_ods add column hitch_category fw_ods.fw_text NULL; +alter table fw_ods.fw_ods add column type_of_cage_wheel fw_ods.fw_text NULL; +alter table fw_ods.fw_ods add column cage_wheel_width_mm fw_ods.fw_num_dimid NULL; +alter table fw_ods.fw_ods add column cage_wheel_weight fw_ods.fw_num_dimid NULL; +alter table fw_ods.fw_ods add column cage_wheel_inner_and_outer_ring_dia_mm fw_ods.fw_num_dimid NULL; +alter table fw_ods.fw_ods add column cage_wheel_center_ring_dia_mm fw_ods.fw_num_dimid NULL; +alter table fw_ods.fw_ods add column dist_between_rhs_and_lhs_cage_wheel_inner_ring_mm fw_ods.fw_num_dimid NULL; +alter table fw_ods.fw_ods add column no_of_angles_on_cage_wheel fw_ods.fw_num_dimid NULL; +alter table fw_ods.fw_ods add column soil_moisture_content_pct fw_ods.fw_text NULL; +alter table fw_ods.fw_ods add column soil_bulk_density_g_per_cc fw_ods.fw_num_metric NULL; +alter table fw_ods.fw_ods add column soil_cone_index fw_ods.fw_num_metric NULL; +alter table fw_ods.fw_ods add column field_condition fw_ods.fw_text NULL; + + + + + +-- FTHLG +alter table fw_ods.fw_ods add column tire_size_and_inflation_pressure_psi fw_ods.fw_text NULL; +alter table fw_ods.fw_ods add column no_of_axle fw_ods.fw_num_dimid NULL; +alter table fw_ods.fw_ods add column no_of_wheels fw_ods.fw_num_dimid NULL; +alter table fw_ods.fw_ods add column trailer_gross_weight_kg fw_ods.fw_num_dimid NULL; +alter table fw_ods.fw_ods add column tractor_rwc_to_hitch_point_center_dist_mm fw_ods.fw_num_dimid NULL; +alter table fw_ods.fw_ods add column trailer_hitch_height_above_ground_level_mm fw_ods.fw_num_dimid NULL; +alter table fw_ods.fw_ods add column gradient_slope_1_degree fw_ods.fw_num_dimid NULL; +alter table fw_ods.fw_ods add column gradient_slope_2_degree fw_ods.fw_num_dimid NULL; + + + + +-- Percentage +alter table fw_ods.fw_ods add column fuel_consumption_var_lit_per_hr fw_ods.fw_num_metric NULL; +alter table fw_ods.fw_ods add column mileage_var_km_per_ltr fw_ods.fw_num_metric NULL; +alter table fw_ods.fw_ods add column area_covered_var_acr_per_hr fw_ods.fw_num_metric NULL; +alter table fw_ods.fw_ods add column fuel_consumption_var_lit_per_acr fw_ods.fw_num_metric NULL; +alter table fw_ods.fw_ods add column fuel_consumption_var_pct_lit_per_hr fw_ods.fw_num_metric NULL; +alter table fw_ods.fw_ods add column mileage_var_pct_km_per_ltr fw_ods.fw_num_metric NULL; +alter table fw_ods.fw_ods add column area_covered_var_pct_acr_per_hr fw_ods.fw_num_metric NULL; +alter table fw_ods.fw_ods add column fuel_consumption_var_pct_lit_per_acr fw_ods.fw_num_metric NULL; + + + + + diff --git a/onetime/createtables/ods/ods_tables.sql b/onetime/createtables/ods/ods_tables.sql index d91588b..5c50b27 100755 --- a/onetime/createtables/ods/ods_tables.sql +++ b/onetime/createtables/ods/ods_tables.sql @@ -10,6 +10,7 @@ Version History: v0.7 - ADDED unique constraint comments *************************************************************************************/ + SET search_path To transactional; drop table if exists test_master; @@ -82,7 +83,7 @@ CREATE TABLE test_instance ( Test_Start_Date date NULL, Test_End_Date date NULL, Type_of_Soil TEXT, - soil_Moisture_Content_pct NUMERIC NULL, + soil_Moisture_Content_pct Text NULL, Soil_Cone_Index NUMERIC NULL, soil_Bulk_Density_g_per_cc NUMERIC NULL, Field_Condition TEXT, @@ -156,7 +157,7 @@ CREATE TABLE test_instance_tractor_info ( Mahindra_Model_YN TEXT NULL, Test_Tractor_YN TEXT NULL, FIP_Type TEXT, - Hour_Meter_Reading INT NULL, + Hour_Meter_Reading numeric NULL, Steering_Type TEXT, Transmission_Type TEXT, Transmission_Disc_Diam TEXT, @@ -743,7 +744,7 @@ CREATE TABLE field_perf_summary_implement_info ( Dist_between_RHS_and_LHS_cage_wheel_Inner_Ring_mm INT NULL, No_of_angles_on_cage_wheel INT NULL, Soil_Type TEXT, - soil_Moisture_Content_pct NUMERIC NULL, + soil_Moisture_Content_pct text NULL, soil_Bulk_Density_g_per_cc NUMERIC NULL, Soil_Cone_Index NUMERIC NULL, Field_Condition TEXT, @@ -983,7 +984,7 @@ DROP TABLE if exists Drawbar_Perf_observations; Brake_Torque_Kg_m NUMERIC NULL, power_kw NUMERIC NULL, power_hp NUMERIC NULL, - Eq_Cblock_row_number_Torque_Nm NUMERIC NULL, + Eq_crank_torque_nm NUMERIC NULL, Fuel_Consumption_Kg_per_hr NUMERIC NULL, Fuel_Consumption_gm_per_hp_hr NUMERIC NULL, Fuel_Consumption_kg_per_kWh NUMERIC NULL, @@ -1340,7 +1341,7 @@ create table Budni_Hydraulic_Lifting_Capacity_test_Results ( Height_of_lower_hitch_pt_above_ground_in_down_position_mm INT NULL, Vertical_move_ment_with_lifting_forces_mm INT NULL, Max_force_exerted_through_full_range_kN NUMERIC NULL, - Corresponding_pressure_MPa INT NULL, + Corresponding_pressure_MPa float NULL, Moment_about_rear_axle_kN_m NUMERIC NULL, Max_tilt_angle_of_mast_from_vertical_degrees NUMERIC NULL, Created_By TEXT NULL DEFAULT current_user, @@ -1440,7 +1441,7 @@ create table Budni_Noise_Atmospheric_conditions( Tractor_Model TEXT NULL, Tractor_Make TEXT NULL, Noise_position TEXT NULL, -- UKA4 - Background_noise_level_dBA INT NULL, + Background_noise_level_dBA float NULL, Temperature_C INT NULL, Pressure_kPa NUMERIC NULL, Relative_humIdity_Pct INT NULL, @@ -1573,7 +1574,7 @@ create table Budni_Haulage_Perf_Results ( Tractor_Model TEXT NULL, Tractor_Make TEXT NULL, Trailer_type TEXT NULL, -- UKA4 - Gross_mass_of_trailer_tonne INT NULL, + Gross_mass_of_trailer_tonne float NULL, Height_of_trailer_hitch_above_ground_level_mm INT NULL, Gear_used_negotiating_slopes_up_to_8Pct TEXT NULL, Avg_travel_speed_kmph TEXT NULL, diff --git a/onetime/createtables/staging/create_tables_BUDNI_PTO.sql b/onetime/createtables/staging/create_tables_BUDNI_PTO.sql index 7c95eb2..9ec896c 100755 --- a/onetime/createtables/staging/create_tables_BUDNI_PTO.sql +++ b/onetime/createtables/staging/create_tables_BUDNI_PTO.sql @@ -2,8 +2,8 @@ drop table if exists staging2.stg_specific_table_BUDNI_PTO; drop table if exists staging2.stg_process_table_BUDNI_PTO; drop table if exists staging2.BUDNI_PTO_Spec_H1_Block; drop table if exists staging2.BUDNI_PTO_Perf_Report_block; -drop table if exists staging2.BUDNI_PTO_MMTKeyword1_Block; -drop table if exists staging2.BUDNI_PTO_MMTKeyword2_Block; +drop table if exists staging2.BUDNI_PTO_Parameter1_Block; +drop table if exists staging2.BUDNI_PTO_Parameter2_Block; drop table if exists staging2.BUDNI_PTO_Summary_Block; @@ -57,7 +57,7 @@ block_row_number int, create_time timestamp DEFAULT current_timestamp ); -create table staging2.BUDNI_PTO_MMTKeyword1_Block +create table staging2.BUDNI_PTO_Parameter1_Block ( syspk serial, file_syspk int, @@ -84,7 +84,7 @@ block_row_number int, create_time timestamp DEFAULT current_timestamp ); -create table staging2.BUDNI_PTO_MMTKeyword2_Block +create table staging2.BUDNI_PTO_Parameter2_Block ( syspk serial, file_syspk int, diff --git a/onetime/createtables/staging/create_tables_PTO.sql b/onetime/createtables/staging/create_tables_PTO.sql index 5619fe6..08a81ff 100755 --- a/onetime/createtables/staging/create_tables_PTO.sql +++ b/onetime/createtables/staging/create_tables_PTO.sql @@ -501,6 +501,24 @@ c33 text null, c34 text null, c35 text null, c36 text null, +c37_1 text null, +c37 text null, +c38 text null, +c39 text null, +c40 text null, +c41 text null, +c42_1 text null, +c42 text null, +c43 text null, +c44 text null, +c45 text null, +c46 text null, +c47_1 text null, +c47 text null, +c48 text null, +c49 text null, +c50 text null, +c51 text null, block_row_number int, trx_record int4 NULL DEFAULT 1, create_time timestamp NULL DEFAULT CURRENT_TIMESTAMP diff --git a/onetime/createtables/staging/create_tables_iht_cgm.sql b/onetime/createtables/staging/create_tables_iht_cgm.sql index 04f14e6..de1c1fb 100755 --- a/onetime/createtables/staging/create_tables_iht_cgm.sql +++ b/onetime/createtables/staging/create_tables_iht_cgm.sql @@ -29,6 +29,8 @@ Test_Request_no text, Sample_Receipt_Date text, Test_report_No text, Tractor_Model text, +Tractor_power_hp text, +variant text, Generation text, Customer_Name text, Test_Engineer text, @@ -37,6 +39,8 @@ No_of_Sample text, Test_Start_Date text, Test_End_Date text, Tractor_Sr_No text, +Drive text, +Platform text, Test_Standard_Refer text, Test_Location text, Operator_Name text, diff --git a/onetime/createtables/staging/create_tables_iht_emt.sql b/onetime/createtables/staging/create_tables_iht_emt.sql index 4e2e09d..8731bb4 100755 --- a/onetime/createtables/staging/create_tables_iht_emt.sql +++ b/onetime/createtables/staging/create_tables_iht_emt.sql @@ -30,6 +30,8 @@ Test_Request_no text, Sample_Receipt_Date text, Test_report_No text, Tractor_Model text, +Tractor_power_hp text, +variant text, Generation text, Customer_Name text, Test_Engineer text, @@ -38,6 +40,8 @@ No_of_Sample text, Test_Start_Date text, Test_End_Date text, Tractor_Sr_No text, +Drive text, +Platform text, Test_Standard_Refer text, Test_Location text, Operator_Name text, diff --git a/onetime/createtables/staging/create_tables_iht_ham.sql b/onetime/createtables/staging/create_tables_iht_ham.sql index 2f74982..5c6e5b8 100755 --- a/onetime/createtables/staging/create_tables_iht_ham.sql +++ b/onetime/createtables/staging/create_tables_iht_ham.sql @@ -31,6 +31,8 @@ Test_Request_no text, Sample_Receipt_Date text, Test_report_No text, Tractor_Model text, +Tractor_power_hp text, +variant text, Generation text, Customer_Name text, Test_Engineer text, @@ -39,6 +41,8 @@ No_of_Sample text, Test_Start_Date text, Test_End_Date text, Tractor_Sr_No text, +Drive text, +Platform text, Test_Location text, Operator_Name text, Project_Group text, diff --git a/onetime/createtables/staging/create_tables_iht_hls.sql b/onetime/createtables/staging/create_tables_iht_hls.sql index b7460b1..1bc5556 100755 --- a/onetime/createtables/staging/create_tables_iht_hls.sql +++ b/onetime/createtables/staging/create_tables_iht_hls.sql @@ -29,6 +29,8 @@ Test_Request_no text, Sample_Receipt_Date text, Test_report_No text, Tractor_Model text, +Tractor_power_hp text, +variant text, Generation text, Customer_Name text, Test_Engineer text, @@ -37,6 +39,8 @@ No_of_Sample text, Test_Start_Date text, Test_End_Date text, Tractor_Sr_No text, +Drive text, +Platform text, Test_Standard_Refer text, Test_Location text, Operator_Name text, diff --git a/onetime/createtables/staging/create_tables_iht_nst.sql b/onetime/createtables/staging/create_tables_iht_nst.sql index 1f709a9..cd334dd 100755 --- a/onetime/createtables/staging/create_tables_iht_nst.sql +++ b/onetime/createtables/staging/create_tables_iht_nst.sql @@ -31,6 +31,8 @@ Test_Request_no text, Sample_Receipt_Date text, Test_report_No text, Tractor_Model text, +Tractor_power_hp text, +variant text, Generation text, Customer_Name text, Test_Engineer text, @@ -39,6 +41,8 @@ No_of_Sample text, Test_Start_Date text, Test_End_Date text, Tractor_Sr_No text, +Drive text, +Platform text, Test_Facility text, Operator_Name text, Project_Group text, diff --git a/onetime/createtables/staging/create_tables_iht_sll.sql b/onetime/createtables/staging/create_tables_iht_sll.sql index db22729..c6d801e 100755 --- a/onetime/createtables/staging/create_tables_iht_sll.sql +++ b/onetime/createtables/staging/create_tables_iht_sll.sql @@ -30,6 +30,8 @@ Test_Request_no text, Sample_Receipt_Date text, Test_report_No text, Tractor_Model text, +tractor_power_hp text, +variant text, Generation text, Customer_Name text, Test_Engineer text, @@ -38,6 +40,8 @@ No_of_Sample text, Test_Start_Date text, Test_End_Date text, Tractor_Sr_No text, +drive text, +platform text, Test_Standard_Refer text, Test_Location text, Operator_Name text, @@ -97,6 +101,7 @@ dummy_f text, make text, model text, Weight_Reaction text, +condition text, Total_Weight_kg text, Front_Reaction_kg text, Rear_Reaction_kg text, diff --git a/onetime/createtables/staging/create_tables_ihtbt30_bt30.sql b/onetime/createtables/staging/create_tables_ihtbt30_bt30.sql index 01d257b..0cebe39 100755 --- a/onetime/createtables/staging/create_tables_ihtbt30_bt30.sql +++ b/onetime/createtables/staging/create_tables_ihtbt30_bt30.sql @@ -31,6 +31,8 @@ Test_Request_no text, Sample_Receipt_Date text, Test_report_No text, Tractor_Model text, +Tractor_power_hp text, +variant text, Generation text, Customer_Name text, Test_Engineer text, @@ -40,11 +42,12 @@ No_of_Sample text, Test_Start_Date text, Test_End_Date text, Tractor_Sr_No text, +Drive text, +Platform text, Test_Standard_Refer text, Domestic_Export text, Operator_Name text, Project_Group text, -Platform text, Objective text, Test_Standard text, Test_Standard_id text, diff --git a/onetime/createtables/staging/create_tables_ihtbt50_bt50.sql b/onetime/createtables/staging/create_tables_ihtbt50_bt50.sql index 1b55b29..d7682e4 100755 --- a/onetime/createtables/staging/create_tables_ihtbt50_bt50.sql +++ b/onetime/createtables/staging/create_tables_ihtbt50_bt50.sql @@ -31,6 +31,8 @@ Test_Request_no text, Sample_Receipt_Date text, Test_report_No text, Tractor_Model text, +Tractor_Power_hp text, +variant text, Generation text, Customer_Name text, Test_Engineer text, @@ -40,11 +42,12 @@ No_of_Sample text, Test_Start_Date text, Test_End_Date text, Tractor_Sr_No text, +drive text, +platform text, Test_Standard_Refer text, Domestic_Export text, Operator_Name text, Project_Group text, -Platform text, Objective text, Test_Standard text, Test_Standard_id text, diff --git a/onetime/createtables/staging/create_tables_ihtbtd_btd.sql b/onetime/createtables/staging/create_tables_ihtbtd_btd.sql index 4b22a95..8cae524 100755 --- a/onetime/createtables/staging/create_tables_ihtbtd_btd.sql +++ b/onetime/createtables/staging/create_tables_ihtbtd_btd.sql @@ -33,6 +33,8 @@ Test_Request_no text, Sample_Receipt_Date text, Test_report_No text, Tractor_Model text, +Tractor_power_hp text, +Variant text, Generation text, Customer_Name text, Test_Engineer text, @@ -42,11 +44,12 @@ No_of_Sample text, Test_Start_Date text, Test_End_Date text, Tractor_Sr_No text, +Drive text, +Platform text, Test_Standard_Refer text, Domestic_Export text, Operator_Name text, Project_Group text, -Platform text, Objective text, Test_Standard text, Test_Standard_id text, diff --git a/onetime/dataloadfunctions/Drawbar/DBOECD_TEST_ods.sql b/onetime/dataloadfunctions/Drawbar/DBOECD_TEST_ods.sql index 1be40bd..78ae715 100755 --- a/onetime/dataloadfunctions/Drawbar/DBOECD_TEST_ods.sql +++ b/onetime/dataloadfunctions/Drawbar/DBOECD_TEST_ods.sql @@ -920,6 +920,16 @@ update transactional.Test_instance_fuel_lubricant_info set test_instance_tractor_id=__test_instance_tractor_id where file_syspk=__file_syspk; + +update transactional.test_instance +set test_type = a.test_type, +test_name= a.test_name +from fw_core.test_file_sheet_format_master a +where transactional.test_instance.file_sheet_mnemonic = a.file_sheet_mnemonic +and transactional.test_instance.file_syspk=__file_syspk; + + + perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'trx', 'fn_dboecd_test_trx', err_state, err_msg, err_detail, err_hint, err_context,'success'); end diff --git a/onetime/dataloadfunctions/Drawbar/DBSTD_TEST_ods.sql b/onetime/dataloadfunctions/Drawbar/DBSTD_TEST_ods.sql index e5d30f0..cca26b3 100755 --- a/onetime/dataloadfunctions/Drawbar/DBSTD_TEST_ods.sql +++ b/onetime/dataloadfunctions/Drawbar/DBSTD_TEST_ods.sql @@ -841,6 +841,16 @@ set test_instance_tractor_id=__test_instance_tractor_id where file_syspk=__file_syspk; + +update transactional.test_instance +set test_type = a.test_type, +test_name= a.test_name +from fw_core.test_file_sheet_format_master a +where transactional.test_instance.file_sheet_mnemonic = a.file_sheet_mnemonic +and transactional.test_instance.file_syspk=__file_syspk; + + + err_context := ''; perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'trx', 'fn_DBSTD_test_block', err_state, err_msg, err_detail, err_hint, err_context,'success'); return err_context; diff --git a/onetime/dataloadfunctions/IHT/.IHTBT50_BT50_ODS.sql.swp b/onetime/dataloadfunctions/IHT/.IHTBT50_BT50_ODS.sql.swp new file mode 100644 index 0000000000000000000000000000000000000000..fb6b8ecfd0398942b4284f9e78f4e0553c5f8f6f GIT binary patch literal 24576 zcmeI44Ukn;9l(zXi5W_!<42;$MBgqwSauP_WfobM1uylX)`8HqGk0v_v5|0ZBZPUH5E(mPR6VMYQQC9w zSG)2|D>vu7y@v>VF0Q<=E>m(nJFlF&`SUyK+@-lXyP!NPuj;aPkbqYlDb`TV4~1pDF8n>H>UU)LJTv_Lc9s8# z@OfqU`+SxEKmQe6mxk_(!vvyq4i4Qv68=6{`LTH8tkZ>d%1g{@TeqcLngWF&ed=*wf4|KvzI0ME* z4M;c|M!`Qu3Go;BH9P_L!VT~ZxD-54Fdxo>8aNUThSv@e;`rQU@ZI{<;=721Go;p2nNiAqv2On@H6l%p_VpNZ4U_s4MuheM-^?yGdz_q=1fn~a+VndyGeFUc>0wR1QHtEwwxf5qm0! zp!pO{CkhdJDu*b)*DsrA8~V2MVoEd z-Nqu5)=ygg%iDt<5fA0Nw-y+Mm2%ReCA9quawx@IRnS@X%jE|RJC)9j>%UqL$jT~u ze!B|u6s5Mbq>EG_?13Fg_oGIu>o}`i#&u8UJ65H3RHa&^+LMn;ShYPt)%r2)uzstm z)+kh}yWE%@UBA)D>^i=b{Ff-|*RR=f>!V@=hk{?Ff!xD1!up6sQ02;u3^~K}F&8b@ zrJqt5SJ%%Fb(t0y*-gNaxe5e4*acswr zN3?iUJalLE)C!NvSm8|{!oQdFa1Q*dBL@?{y?Ex`9vyM$n6wr?RYQ0h!Q^XjEIgQo z4dosatZ z0cG~fl^)PWb!KWsOM7c`N2^@W&Px`a+uYJB=XAEUbj(}OR#}h?(SvG=M!5|7MQKv4 zl;3xW5{pC_WI<#dyIASMR<~3uEZ1{~O>Mf+>;KiP;U56K{%3jYUyrfge-s{pr}6tG zY==kSA$SmUockfU5(y*{NF8gD3}M6;1oCxjsa~uFaqAhKHwGD0gu7Gplu0m zfc5YNxCqXNInV^B!*1*bUWaY)L)Ze}g^jQd9LPc^v_cb{3WvZ8*b_ViH^X<}YWOBx z4j02xP_P)9VG5+-co+rR7UB2sB-{^o!|jj^e5O8!*;2Z^W5PL zq4YL10gcJSSv6$rTq$4Re}@D&XKG^v?J_N9tq{1JG00`=AeSkFTuvY4GI@{-<}wF% zi{IZR(p%4Q^NqA%qY-u8*YQKtifpT%{jc1nPc*17mFBv8Cf=5d^@zfwr*Kk zvb50*6Hu%dJnn`J7gU*^)j4*KS!%K58BAU=X6x(G`{7nk4_lRPQSpMlyslfLm#uUs zSJ}*u*$_l~pC8!%`F^*;hNKnh4wx_OuGrdLHpRo&iki@zC~p;N{N7S4ed|NM0(&))j=m7SiFB90|KG>DbRBD2 zz5bsWPEp=qP5%;XhX>&<*bG;}T5zBUz3_Qh2(v-!1tc5=BVae{`(5x9Y=moI16&T5 zK|3sjR+t897z?A|ZPxf&FYqip3U|TxL7y>L2VaKO;DCZ9a1Km?S~v-gg?Cu*zXm&D zJ6sD|N1))-FcNlA{@=k?(6aaptcEqv2^}y4eu}IfgKe+{Hp2#3152R`+Tk3~=MIhn zz2?_v4fI<7X1D?Ld4r9h&m3F~4rHJWX2F?|0)5^#V`kEz-cfFUgVs?!*C010)0N=D!2mHfCJs2 z&ne7;sW1UP0f)kyoHKX{o`MJ99@qi}$io>h1;)cz_!x|V0ar2&56(A46Z~Wvo=n3r zlOJ#twyQ2f6euuEH?;g@ z&3~NfVfB^0!ww2j*8RgSBFn!RcRed(s1^E{o=l6_`4m|`ZBo>wHhPOOjbqmF&sOO} zeR?bTfNLJZGg$kO?Q*VzGdN^Bt&cmZ9H(E&b8s9rR&6FXD#zC`9Utb~uv}R^TGPGv6T6R%r9=~JI+aJp5C>&z+`-RROo@76mCRuQ h{9K~r72&harLXc0pZ#10I$*62jAbtp+ 2 ORDER BY block_row_number ASC ) as q) b where a.block_row_number=b.block_row_number; @@ -617,14 +598,15 @@ ORDER BY block_row_number ASC update staging2.IHTBT30_BT30_Test_Res_3_Block a - set column10= b.first_value from (SELECT -block_row_number,column10, value_partition, first_value(column10) over (partition by value_partition order by block_row_number) + set column11= b.first_value from (SELECT +block_row_number,column11, value_partition, first_value(column11) over (partition by value_partition order by block_row_number) FROM ( SELECT block_row_number, -column10, -sum(case when column10 is null then 0 else 1 end) over (order by block_row_number) as value_partition +column11, +sum(case when column11 is null then 0 else 1 end) over (order by block_row_number) as value_partition FROM staging2.IHTBT30_BT30_Test_Res_3_Block +where block_row_number > 2 ORDER BY block_row_number ASC ) as q) b where a.block_row_number=b.block_row_number; @@ -681,14 +663,15 @@ ORDER BY block_row_number ASC update staging2.IHTBT30_BT30_Test_Res_4_Block a - set column10= b.first_value from (SELECT -block_row_number,column10, value_partition, first_value(column10) over (partition by value_partition order by block_row_number) + set column11= b.first_value from (SELECT +block_row_number,column11, value_partition, first_value(column11) over (partition by value_partition order by block_row_number) FROM ( SELECT block_row_number, -column10, -sum(case when column10 is null then 0 else 1 end) over (order by block_row_number) as value_partition +column11, +sum(case when column11 is null then 0 else 1 end) over (order by block_row_number) as value_partition FROM staging2.IHTBT30_BT30_Test_Res_4_Block +where block_row_number > 2 ORDER BY block_row_number ASC ) as q) b where a.block_row_number=b.block_row_number; @@ -734,14 +717,14 @@ update staging2.IHTBT30_BT30_Test_Condition_Block set date=b.column4, location=b.column7, --time=b.column9, -mode=b.column10 +mode=b.column11 from staging2.IHTBT30_BT30_Test_Res_1_Block b where b.block_row_number =2 and condition=b.column2; update staging2.IHTBT30_BT30_Test_Condition_Block set Wind_Velocity_Km_hr=b.column5, Ambient_Temperature_C=b.column7, -Humidity_RH=b.column9 +Humidity_RH=b.column10 from staging2.IHTBT30_BT30_Test_Res_1_Block b where b.block_row_number =3 and condition=b.column2; @@ -749,14 +732,14 @@ update staging2.IHTBT30_BT30_Test_Condition_Block set date=b.column4, location=b.column7, --time=b.column9, -mode=b.column10 +mode=b.column11 from staging2.IHTBT30_BT30_Test_Res_2_Block b where b.block_row_number =2 and condition=b.column2; update staging2.IHTBT30_BT30_Test_Condition_Block set Wind_Velocity_Km_hr=b.column5, Ambient_Temperature_C=b.column7, -Humidity_RH=b.column9 +Humidity_RH=b.column10 from staging2.IHTBT30_BT30_Test_Res_2_Block b where b.block_row_number =3 and condition=b.column2; @@ -764,14 +747,14 @@ update staging2.IHTBT30_BT30_Test_Condition_Block set date=b.column4, location=b.column7, --time=b.column9, -mode=b.column10 +mode=b.column11 from staging2.IHTBT30_BT30_Test_Res_3_Block b where b.block_row_number =2 and condition=b.column2; update staging2.IHTBT30_BT30_Test_Condition_Block set Wind_Velocity_Km_hr=b.column5, Ambient_Temperature_C=b.column7, -Humidity_RH=b.column9 +Humidity_RH=b.column10 from staging2.IHTBT30_BT30_Test_Res_3_Block b where b.block_row_number =3 and condition=b.column2; @@ -779,14 +762,14 @@ update staging2.IHTBT30_BT30_Test_Condition_Block set date=b.column4, location=b.column7, --time=b.column9, -mode=b.column10 +mode=b.column11 from staging2.IHTBT30_BT30_Test_Res_4_Block b where b.block_row_number =2 and condition=b.column2; update staging2.IHTBT30_BT30_Test_Condition_Block set Wind_Velocity_Km_hr=b.column5, Ambient_Temperature_C=b.column7, -Humidity_RH=b.column9 +Humidity_RH=b.column10 from staging2.IHTBT30_BT30_Test_Res_4_Block b where b.block_row_number=3 and condition=b.column2; diff --git a/onetime/dataloadfunctions/IHT/IHTBT50_BT50_ODS.sql b/onetime/dataloadfunctions/IHT/IHTBT50_BT50_ODS.sql index 3ff64a6..391aaa8 100755 --- a/onetime/dataloadfunctions/IHT/IHTBT50_BT50_ODS.sql +++ b/onetime/dataloadfunctions/IHT/IHTBT50_BT50_ODS.sql @@ -188,7 +188,12 @@ file_mnemonic, file_sheet_mnemonic, tractor_make, tractor_model, -tractor_platform +tractor_platform, +wheel_drive_type, +tractor_engine_hp, +generation, +domestic_export , +tractor_sr_no ) select client_id, @@ -197,7 +202,12 @@ file_syspk, file_mnemonic, file_sheet_mnemonic, make,model, -platform +platform, +drive, +tractor_power_hp::numeric, +generation, +domestic_export , +tractor_sr_no from staging2.IHTBT50_BT50_h1_block where trx_record =1; update transactional.test_instance_tractor_info @@ -247,7 +257,7 @@ column6::numeric, column7::numeric, column8::numeric, column9, -column10 +column11 from staging2.IHTBT50_BT50_test_res_1_block where trx_record =1; insert into transactional.iht_brake_perf_test_results @@ -284,7 +294,7 @@ column6::numeric, column7::numeric, column8::numeric, column9, -column10 +column11 from staging2.IHTBT50_BT50_test_res_2_block where trx_record =1; insert into transactional.iht_brake_perf_test_results @@ -321,7 +331,7 @@ column6::numeric, column7::numeric, column8::numeric, column9, -column10 +column11 from staging2.IHTBT50_BT50_test_res_3_block where trx_record =1; insert into transactional.iht_brake_perf_test_results @@ -358,7 +368,7 @@ column6::numeric, column7::numeric, column8::numeric, column9, -column10 +column11 from staging2.IHTBT50_BT50_test_res_4_block where trx_record =1; insert into transactional.iht_brake_perf_test_condition @@ -451,6 +461,19 @@ tractor_model =__model, tractor_make=__make where file_syspk=__file_syspk; +update transactional.test_instance +set test_file_name =(select a.file_name from staging1.staging_generic_table a where file_syspk = __file_syspk limit 1) +where file_syspk = __file_syspk; + + +update transactional.test_instance +set test_type = a.test_type, +test_name= a.test_name +from fw_core.test_file_sheet_format_master a +where transactional.test_instance.file_sheet_mnemonic = a.file_sheet_mnemonic +and transactional.test_instance.file_syspk=__file_syspk; + + perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'trx', 'fn_IHTBT50_BT50_TRX', err_state, err_msg, err_detail, err_hint, err_context,'success'); end diff --git a/onetime/dataloadfunctions/IHT/IHTBT50_BT50_STG2.sql b/onetime/dataloadfunctions/IHT/IHTBT50_BT50_STG2.sql index c092b12..13384b2 100755 --- a/onetime/dataloadfunctions/IHT/IHTBT50_BT50_STG2.sql +++ b/onetime/dataloadfunctions/IHT/IHTBT50_BT50_STG2.sql @@ -206,11 +206,11 @@ perform fw_core.fn_jobctl_block_begin(__client_id,__function_id,__file_syspk, err_block:='IHTBT50_BT50_H1_BLOCK'; insert into staging2.IHTBT50_BT50_H1_INT (c1,c2) select a.column3,column5 from staging2.stg_process_table_IHTBT50_BT50 a where block_tag='IHTBT50_BT50_H1' -and block_row_number <=9; +and block_row_number <=11; insert into staging2.IHTBT50_BT50_H1_INT (c1,c2) select a.column7,column9 from staging2.stg_process_table_IHTBT50_BT50 a where block_tag='IHTBT50_BT50_H1' -and block_row_number <=9; +and block_row_number <=10; insert into staging2.IHTBT50_BT50_H1_INT (c1,c2) select 'Objective',column10 @@ -220,14 +220,14 @@ and row_number= ( select row_number+1 from staging2.stg_process_table_IHTBT50_BT50 a -where column10='Objective' +where column10 like 'Objective%' and block_tag='IHTBT50_BT50_H1' ); insert into staging2.IHTBT50_BT50_H1_INT (c1,c2) select 'Acceptance criteria',column8 from staging2.stg_process_table_IHTBT50_BT50 a -where block_tag='IHTBT50_BT50_H1' and block_row_number=11; +where block_tag='IHTBT50_BT50_H1' and block_row_number=13; insert into staging2.IHTBT50_BT50_H1_INT (c1,c2) @@ -238,7 +238,7 @@ and row_number= ( select row_number+1 from staging2.stg_process_table_IHTBT50_BT50 a -where column10='Condition' +where column10 like 'Condition%' and block_tag='IHTBT50_BT50_H1' ); @@ -247,19 +247,19 @@ and block_tag='IHTBT50_BT50_H1' insert into staging2.IHTBT50_BT50_H1_INT (c1,c2) select 'Test std',column4 from staging2.stg_process_table_IHTBT50_BT50 b -where block_row_number=11 +where block_row_number=13 and block_tag='IHTBT50_BT50_H1'; insert into staging2.IHTBT50_BT50_H1_INT (c1,c2) select 'Test std Id',column3 from staging2.stg_process_table_IHTBT50_BT50 b -where block_row_number=11 +where block_row_number=13 and block_tag='IHTBT50_BT50_H1'; insert into staging2.IHTBT50_BT50_H1_INT (c1,c2) select 'Test Standard ref',split_part(column3,':',2) from staging2.stg_process_table_IHTBT50_BT50 b -where block_row_number=10 +where block_row_number=12 and block_tag='IHTBT50_BT50_H1'; @@ -284,6 +284,7 @@ file_syspk='||p_file_syspk||', file_mnemonic='''||p_file_mnemonic||''', file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; + insert into staging2.IHTBT50_BT50_H1_Block ( dummy_f, @@ -291,6 +292,8 @@ Test_Request_no, Sample_Receipt_Date, Test_report_No, Tractor_Model, +tractor_power_hp, +variant, Generation, Customer_Name, Test_Engineer, @@ -300,19 +303,20 @@ No_of_Sample, Test_Start_Date, Test_End_Date, Tractor_Sr_No, +drive, +platform, Test_Standard_Refer, Domestic_Export, Operator_Name, Project_Group, -Platform, Objective, Acceptance_Criteria, condition, Test_Standard, Test_Standard_id, Test_Standard_ref, -Remarks, -Observations +Observations, +Remarks ) SELECT * FROM crosstab( @@ -320,33 +324,11 @@ FROM crosstab( , row_number() OVER () , unnest(ARRAY[c2::text]) AS val FROM staging2.IHTBT50_BT50_H1_INT - ORDER BY generate_series(1,15),2' + ORDER BY generate_series(1,15),syspk,2' ) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text, a_9 text,a_10 text,a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text, - a_18 text,a_19 text,a_20 text,a_21 text,a_22 text,a_23 text,a_24 text,a_25 text,a_26 text); + a_18 text,a_19 text,a_20 text,a_21 text,a_22 text,a_23 text,a_24 text,a_25 text,a_26 text,a_27 text,a_28 text,a_29 text); -update staging2.IHTBT50_BT50_H1_Block - set Sample_Receipt_Date=case - when Sample_Receipt_Date like '%-%' then Sample_Receipt_Date::timestamptz - else date '1899-12-30' + Sample_Receipt_Date::int * interval '1' day - end; - - update staging2.IHTBT50_BT50_H1_Block - set Test_Report_Date=case - when Test_Report_Date like '%-%' then Test_Report_Date::timestamptz - else date '1899-12-30' + Test_Report_Date::int * interval '1' day - end; - - update staging2.IHTBT50_BT50_H1_Block - set Test_Start_Date=case - when Test_Report_Date like '%-%' then Test_Report_Date::timestamptz - else date '1899-12-30' + Test_Report_Date::int * interval '1' day - end; - update staging2.IHTBT50_BT50_H1_Block - set Test_End_Date=case - when Test_Report_Date like '%-%' then Test_Report_Date::timestamptz - else date '1899-12-30' + Test_Report_Date::int * interval '1' day - end; delete from staging2.IHTBT50_BT50_H1_Block where dummy_f is null ; update staging2.IHTBT50_BT50_H1_Block set model=__model; @@ -490,13 +472,13 @@ ORDER BY block_row_number ASC update staging2.IHTBT50_BT50_Test_Res_1_Block a - set column10= b.first_value from (SELECT -block_row_number,column10, value_partition, first_value(column10) over (partition by value_partition order by block_row_number) + set column11= b.first_value from (SELECT +block_row_number,column11, value_partition, first_value(column11) over (partition by value_partition order by block_row_number) FROM ( SELECT block_row_number, -column10, -sum(case when column10 is null then 0 else 1 end) over (order by block_row_number) as value_partition +column11, +sum(case when column11 is null then 0 else 1 end) over (order by block_row_number) as value_partition FROM staging2.IHTBT50_BT50_Test_Res_1_Block ORDER BY block_row_number ASC ) as q) b where a.block_row_number=b.block_row_number; @@ -554,13 +536,13 @@ ORDER BY block_row_number ASC update staging2.IHTBT50_BT50_Test_Res_2_Block a - set column10= b.first_value from (SELECT -block_row_number,column10, value_partition, first_value(column10) over (partition by value_partition order by block_row_number) + set column11= b.first_value from (SELECT +block_row_number,column11, value_partition, first_value(column11) over (partition by value_partition order by block_row_number) FROM ( SELECT block_row_number, -column10, -sum(case when column10 is null then 0 else 1 end) over (order by block_row_number) as value_partition +column11, +sum(case when column11 is null then 0 else 1 end) over (order by block_row_number) as value_partition FROM staging2.IHTBT50_BT50_Test_Res_2_Block ORDER BY block_row_number ASC ) as q) b where a.block_row_number=b.block_row_number; @@ -618,13 +600,13 @@ ORDER BY block_row_number ASC update staging2.IHTBT50_BT50_Test_Res_3_Block a - set column10= b.first_value from (SELECT -block_row_number,column10, value_partition, first_value(column10) over (partition by value_partition order by block_row_number) + set column11= b.first_value from (SELECT +block_row_number,column11, value_partition, first_value(column11) over (partition by value_partition order by block_row_number) FROM ( SELECT block_row_number, -column10, -sum(case when column10 is null then 0 else 1 end) over (order by block_row_number) as value_partition +column11, +sum(case when column11 is null then 0 else 1 end) over (order by block_row_number) as value_partition FROM staging2.IHTBT50_BT50_Test_Res_3_Block ORDER BY block_row_number ASC ) as q) b where a.block_row_number=b.block_row_number; @@ -682,13 +664,13 @@ ORDER BY block_row_number ASC update staging2.IHTBT50_BT50_Test_Res_4_Block a - set column10= b.first_value from (SELECT -block_row_number,column10, value_partition, first_value(column10) over (partition by value_partition order by block_row_number) + set column11= b.first_value from (SELECT +block_row_number,column11, value_partition, first_value(column11) over (partition by value_partition order by block_row_number) FROM ( SELECT block_row_number, -column10, -sum(case when column10 is null then 0 else 1 end) over (order by block_row_number) as value_partition +column11, +sum(case when column11 is null then 0 else 1 end) over (order by block_row_number) as value_partition FROM staging2.IHTBT50_BT50_Test_Res_4_Block ORDER BY block_row_number ASC ) as q) b where a.block_row_number=b.block_row_number; @@ -735,14 +717,14 @@ update staging2.IHTBT50_BT50_Test_Condition_Block set date=b.column4, location=b.column7, --time=b.column9, -mode=b.column10 +mode=b.column11 from staging2.IHTBT50_BT50_Test_Res_1_Block b where b.block_row_number =2 and condition=b.column2; update staging2.IHTBT50_BT50_Test_Condition_Block set Wind_Velocity_Km_hr=b.column5, Ambient_Temperature_C=b.column7, -Humidity_RH=b.column9 +Humidity_RH=b.column10 from staging2.IHTBT50_BT50_Test_Res_1_Block b where b.block_row_number =3 and condition=b.column2; @@ -750,14 +732,14 @@ update staging2.IHTBT50_BT50_Test_Condition_Block set date=b.column4, location=b.column7, --time=b.column9, -mode=b.column10 +mode=b.column11 from staging2.IHTBT50_BT50_Test_Res_2_Block b where b.block_row_number =2 and condition=b.column2; update staging2.IHTBT50_BT50_Test_Condition_Block set Wind_Velocity_Km_hr=b.column5, Ambient_Temperature_C=b.column7, -Humidity_RH=b.column9 +Humidity_RH=b.column10 from staging2.IHTBT50_BT50_Test_Res_2_Block b where b.block_row_number =3 and condition=b.column2; @@ -765,14 +747,14 @@ update staging2.IHTBT50_BT50_Test_Condition_Block set date=b.column4, location=b.column7, --time=b.column9, -mode=b.column10 +mode=b.column11 from staging2.IHTBT50_BT50_Test_Res_3_Block b where b.block_row_number =2 and condition=b.column2; update staging2.IHTBT50_BT50_Test_Condition_Block set Wind_Velocity_Km_hr=b.column5, Ambient_Temperature_C=b.column7, -Humidity_RH=b.column9 +Humidity_RH=b.column10 from staging2.IHTBT50_BT50_Test_Res_3_Block b where b.block_row_number =3 and condition=b.column2; @@ -780,14 +762,14 @@ update staging2.IHTBT50_BT50_Test_Condition_Block set date=b.column4, location=b.column7, --time=b.column9, -mode=b.column10 +mode=b.column11 from staging2.IHTBT50_BT50_Test_Res_4_Block b where b.block_row_number =2 and condition=b.column2; update staging2.IHTBT50_BT50_Test_Condition_Block set Wind_Velocity_Km_hr=b.column5, Ambient_Temperature_C=b.column7, -Humidity_RH=b.column9 +Humidity_RH=b.column10 from staging2.IHTBT50_BT50_Test_Res_4_Block b where b.block_row_number=3 and condition=b.column2; diff --git a/onetime/dataloadfunctions/IHT/IHTBTD_BTD_ODS.sql b/onetime/dataloadfunctions/IHT/IHTBTD_BTD_ODS.sql index 5d56a81..3514343 100755 --- a/onetime/dataloadfunctions/IHT/IHTBTD_BTD_ODS.sql +++ b/onetime/dataloadfunctions/IHT/IHTBTD_BTD_ODS.sql @@ -64,7 +64,8 @@ test_standard_desc, test_standard_id, acceptance_criteria, remarks, -observations +observations, +test_purpose ) select client_id, @@ -74,15 +75,15 @@ file_mnemonic, file_sheet_mnemonic, make,model, Test_Request_no, -to_date(sample_receipt_date,'DD-MM-YYYY'), +sample_receipt_date::Date, Test_report_No, Generation, Customer_Name, Test_Engineer, -to_date(Test_Report_Date,'DD-MM-YYYY'), +Test_Report_Date::Date, No_of_Sample, -to_date(Test_Start_Date,'DD-MM-YYYY'), -to_date(Test_End_Date, 'DD-MM-YYYY'), +Test_Start_Date::Date, +Test_End_Date::Date, Tractor_Sr_No, Test_Standard_Refer, test_location, @@ -95,7 +96,8 @@ test_standard_id::numeric, test_standard_ref acceptance_criteria, remarks, -observations +observations, +test_purpose from staging2.IHTBTD_BTD_H1_block where trx_record =1; @@ -214,6 +216,18 @@ set test_tractor_yn ='Y' where syspk in where b.file_syspk =a.file_syspk) and a.file_syspk =__file_syspk; +update transactional.test_instance_tractor_info a +set +wheel_drive_type = b.Drive, +tractor_platform = b.Platform, +tractor_engine_hp= b.Tractor_power_hp::numeric, +generation= b.generation, +domestic_export= b.domestic_export, +tractor_sr_no = b.tractor_sr_no +from staging2.IHTBTD_BTD_H1_block b +where b.trx_record=1 +and a.file_sheet_mnemonic ='IHTBTD_BTD' +and a.file_syspk =__file_syspk; insert into transactional.iht_brake_perf_test_results @@ -530,6 +544,19 @@ tractor_model =__model, tractor_make=__make where file_syspk=__file_syspk; +update transactional.test_instance +set test_file_name =(select a.file_name from staging1.staging_generic_table a where file_syspk = __file_syspk limit 1) +where file_syspk = __file_syspk; + + +update transactional.test_instance +set test_type = a.test_type, +test_name= a.test_name +from fw_core.test_file_sheet_format_master a +where transactional.test_instance.file_sheet_mnemonic = a.file_sheet_mnemonic +and transactional.test_instance.file_syspk=__file_syspk; + + perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'trx', 'fn_IHTBTD_BTD_TRX', err_state, err_msg, err_detail, err_hint, err_context,'success'); end diff --git a/onetime/dataloadfunctions/IHT/IHTBTD_BTD_STG2.sql b/onetime/dataloadfunctions/IHT/IHTBTD_BTD_STG2.sql index 05cc953..ebcea35 100755 --- a/onetime/dataloadfunctions/IHT/IHTBTD_BTD_STG2.sql +++ b/onetime/dataloadfunctions/IHT/IHTBTD_BTD_STG2.sql @@ -225,11 +225,11 @@ perform fw_core.fn_jobctl_block_begin(__client_id,__function_id,__file_syspk, err_block:='IHTBTD_BTD_H1_BLOCK'; insert into staging2.IHTBTD_BTD_H1_INT (c1,c2) select a.column3,column5 from staging2.stg_process_table_IHTBTD_BTD a where block_tag='IHTBTD_BTD_H1' -and block_row_number <=9; +and block_row_number <=11; insert into staging2.IHTBTD_BTD_H1_INT (c1,c2) select a.column7,column9 from staging2.stg_process_table_IHTBTD_BTD a where block_tag='IHTBTD_BTD_H1' -and block_row_number <=9; +and block_row_number <=10; insert into staging2.IHTBTD_BTD_H1_INT (c1,c2) select 'Objective',column11 @@ -246,7 +246,7 @@ and block_tag='IHTBTD_BTD_H1' insert into staging2.IHTBTD_BTD_H1_INT (c1,c2) select 'Acceptance criteria',column8 from staging2.stg_process_table_IHTBTD_BTD a -where block_tag='IHTBTD_BTD_H1' and block_row_number=11; +where block_tag='IHTBTD_BTD_H1' and block_row_number=13; insert into staging2.IHTBTD_BTD_H1_INT (c1,c2) @@ -266,19 +266,19 @@ and block_tag='IHTBTD_BTD_H1' insert into staging2.IHTBTD_BTD_H1_INT (c1,c2) select 'Test std',column4 from staging2.stg_process_table_IHTBTD_BTD b -where block_row_number=11 +where block_row_number=13 and block_tag='IHTBTD_BTD_H1'; insert into staging2.IHTBTD_BTD_H1_INT (c1,c2) select 'Test std Id',column3 from staging2.stg_process_table_IHTBTD_BTD b -where block_row_number=11 +where block_row_number=13 and block_tag='IHTBTD_BTD_H1'; insert into staging2.IHTBTD_BTD_H1_INT (c1,c2) select 'Test Standard ref',split_part(column3,':',2) from staging2.stg_process_table_IHTBTD_BTD b -where block_row_number=10 +where block_row_number=12 and block_tag='IHTBTD_BTD_H1'; @@ -299,7 +299,7 @@ and block_tag='IHTBTD_BTD_Weight_Tyre' insert into staging2.IHTBTD_BTD_H1_INT (c1,c2) select 'Test Purpose',column8 from staging2.stg_process_table_IHTBTD_BTD b -where block_row_number=12 +where block_row_number=14 and block_tag='IHTBTD_BTD_H1'; update staging2.IHTBTD_BTD_H1_Int set model=__model; @@ -310,6 +310,8 @@ file_syspk='||p_file_syspk||', file_mnemonic='''||p_file_mnemonic||''', file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; + + insert into staging2.IHTBTD_BTD_H1_Block ( dummy_f, @@ -317,6 +319,8 @@ Test_Request_no, Sample_Receipt_Date, Test_report_No, Tractor_Model, +tractor_power_hp, +variant, Generation, Customer_Name, Test_Engineer, @@ -326,18 +330,18 @@ No_of_Sample, Test_Start_Date, Test_End_Date, Tractor_Sr_No, +drive, +platform, Test_Standard_Refer, Domestic_Export, Operator_Name, Project_Group, -Platform, Objective, Acceptance_Criteria, condition, Test_Standard, Test_Standard_id, Test_Standard_ref, -Remarks, Observations, Test_Purpose ) @@ -347,10 +351,10 @@ FROM crosstab( , row_number() OVER () , unnest(ARRAY[c2::text]) AS val FROM staging2.IHTBTD_BTD_H1_INT - ORDER BY generate_series(1,15),2' + ORDER BY generate_series(1,15),syspk,2' ) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text, a_9 text,a_10 text,a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text, - a_18 text,a_19 text,a_20 text,a_21 text,a_22 text,a_23 text,a_24 text,a_25 text,a_26 text,a_27 text); + a_18 text,a_19 text,a_20 text,a_21 text,a_22 text,a_23 text,a_24 text,a_25 text,a_26 text,a_27 text,a_28 text,a_29 text); delete from staging2.IHTBTD_BTD_H1_Block where dummy_f is null ; diff --git a/onetime/dataloadfunctions/IHT/IHT_CGM_ODS.sql b/onetime/dataloadfunctions/IHT/IHT_CGM_ODS.sql index ada55bf..2aac5b1 100755 --- a/onetime/dataloadfunctions/IHT/IHT_CGM_ODS.sql +++ b/onetime/dataloadfunctions/IHT/IHT_CGM_ODS.sql @@ -59,7 +59,8 @@ test_operator, project_group, objective_of_test, acceptance_criteria, -remarks +remarks, +test_purpose ) select client_id, @@ -67,17 +68,18 @@ function_id, file_syspk, file_mnemonic, file_sheet_mnemonic, -make,model, +make, +model, Test_Request_no, -date '1899-12-30' + sample_receipt_date::int * interval '1' day as Sample_Receipt_Date, +sample_receipt_date::Date, Test_report_No, Generation, Customer_Name, Test_Engineer, -date '1899-12-30' + Test_Report_Date::int * interval '1' day as Test_Report_Date, +Test_Report_Date::date, No_of_Sample, -date '1899-12-30' + Test_Start_Date::int * interval '1' day as Test_Start_Date, -date '1899-12-30' + Test_End_Date::int * interval '1' day as Test_End_Date, +Test_Start_Date::date, +Test_End_Date::Date, Tractor_Sr_No, Test_Standard_Refer, Test_Location, @@ -85,7 +87,8 @@ Operator_Name, Project_Group, Objective, Acceptance_Criteria, -Remarks +Remarks, +test_purpose from staging2.IHTCGM_CGM_H1_block where trx_record=1; update transactional.test_instance a @@ -135,9 +138,9 @@ tyre_make, tyre_size, ply_rating::numeric, load_carrying_capacity, -Pressure_kg_cm2::numeric , -Dynamic_rolling_radius::numeric , +Pressure_kg_cm2::numeric , Static_rolling_radius::numeric , +Dynamic_rolling_radius::numeric , wheel_rim_make_size from staging2.IHTCGM_CGM_tyre_details_block where trx_record=1; @@ -175,6 +178,19 @@ set test_tractor_yn ='Y' where syspk in where b.file_syspk =a.file_syspk) and a.file_syspk =__file_syspk; + +update transactional.test_instance_tractor_info a +set +wheel_drive_type = b.Drive, +tractor_platform = b.Platform, +tractor_engine_hp= b.Tractor_power_hp::numeric, +tractor_sr_no= b.tractor_sr_no, +generation = b.generation +from staging2.IHTCGM_CGM_H1_block b +where b.trx_record=1 +and a.file_sheet_mnemonic ='IHTCGM_CGM' +and a.file_syspk =__file_syspk; + /*block */ insert into transactional.test_instance_weight_reaction @@ -327,6 +343,20 @@ tractor_model =__model, tractor_make=__make where file_syspk=__file_syspk; + +update transactional.test_instance +set test_file_name =(select a.file_name from staging1.staging_generic_table a where file_syspk = __file_syspk limit 1) +where file_syspk = __file_syspk; + + +update transactional.test_instance +set test_type = a.test_type, +test_name= a.test_name +from fw_core.test_file_sheet_format_master a +where transactional.test_instance.file_sheet_mnemonic = a.file_sheet_mnemonic +and transactional.test_instance.file_syspk=__file_syspk; + + perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'trx', 'fn_IHTCGM_CGM_TRX', err_state, err_msg, err_detail, err_hint, err_context,'success'); end diff --git a/onetime/dataloadfunctions/IHT/IHT_CGM_STG2.sql b/onetime/dataloadfunctions/IHT/IHT_CGM_STG2.sql index 6826a60..8700436 100755 --- a/onetime/dataloadfunctions/IHT/IHT_CGM_STG2.sql +++ b/onetime/dataloadfunctions/IHT/IHT_CGM_STG2.sql @@ -206,10 +206,12 @@ select split_part(column3,':',1),split_part(column3,':',2) from staging2.stg_process_table_IHTCGM_CGM where block_tag='IHTCGM_CGM_Lifting' and block_row_number=15; + insert into staging2.IHTCGM_CGM_H1_INT (c1,c2) select 'Test Purpose',column10 from staging2.stg_process_table_IHTCGM_CGM a -where block_tag='IHTCGM_CGM_H1' and column3='Test Purpose'; +where block_tag='IHTCGM_CGM_Weight_Tyre' and column3='Test Purpose'; + update staging2.IHTCGM_CGM_H1_Int set model=__model; execute 'update staging2.IHTCGM_CGM_H1_Int set @@ -226,6 +228,8 @@ Test_Request_no, Sample_Receipt_Date, Test_report_No, Tractor_Model, +Tractor_power_hp , +variant , Generation, Customer_Name, Test_Engineer, @@ -234,6 +238,8 @@ No_of_Sample, Test_Start_Date, Test_End_Date, Tractor_Sr_No, +Drive , +Platform , Test_Standard_Refer, Test_Location, Operator_Name, @@ -249,10 +255,10 @@ FROM crosstab( , row_number() OVER () , unnest(ARRAY[c2::text]) AS val FROM staging2.IHTCGM_CGM_H1_INT - ORDER BY generate_series(1,15),2' + ORDER BY generate_series(1,15),syspk,2' ) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text, a_9 text,a_10 text,a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text, - a_18 text,a_19 text,a_20 text); + a_18 text,a_19 text,a_20 text, a_21 text, a_22 text, a_23 text, a_24 text); delete from staging2.IHTCGM_CGM_H1_Block where dummy_f is null ; @@ -287,7 +293,7 @@ file_syspk='||p_file_syspk||', file_mnemonic='''||p_file_mnemonic||''', file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; -update staging2.IHTCGM_CGM_Weight_Tyre_Int set trx_record = 0 where block_row_number=3; +--update staging2.IHTCGM_CGM_Weight_Tyre_Int set trx_record = 0 where block_row_number=3; /*block starts - IHTCGM_CGM_Weight_Block */ diff --git a/onetime/dataloadfunctions/IHT/IHT_EMT_ODS.sql b/onetime/dataloadfunctions/IHT/IHT_EMT_ODS.sql index e134c51..112ba3d 100755 --- a/onetime/dataloadfunctions/IHT/IHT_EMT_ODS.sql +++ b/onetime/dataloadfunctions/IHT/IHT_EMT_ODS.sql @@ -70,15 +70,15 @@ file_mnemonic, file_sheet_mnemonic, make,model, Test_Request_no, -date '1899-12-30' + sample_receipt_date::int * interval '1' day as Sample_Receipt_Date, +sample_receipt_date::Date, Test_report_No, Generation, Customer_Name, Test_Engineer, -date '1899-12-30' + Test_Report_Date::int * interval '1' day as Test_Report_Date, +Test_Report_Date::Date, No_of_Sample, -date '1899-12-30' + Test_Start_Date ::int * interval '1' day as Test_Start_Date, -date '1899-12-30' + Test_End_Date ::int * interval '1' day as Test_End_Date, +Test_Start_Date::Date, +Test_End_Date::Date, Tractor_Sr_No, Test_Standard_Refer, Test_Location, @@ -178,6 +178,20 @@ where b.file_syspk =a.file_syspk) and a.file_syspk =__file_syspk; +update transactional.test_instance_tractor_info a +set +wheel_drive_type = b.Drive, +tractor_platform = b.Platform, +tractor_engine_hp= b.Tractor_power_hp::numeric, +generation= b.generation, +tractor_sr_no= b.tractor_sr_no +from staging2.IHTEMT_EMT_H1_block b +where b.trx_record=1 +and a.file_sheet_mnemonic ='IHTMT_EMT' +and a.file_syspk =__file_syspk; + + + /*block */ insert into transactional.test_instance_weight_reaction @@ -426,6 +440,19 @@ tractor_model =__model, tractor_make=__make where file_syspk=__file_syspk; +update transactional.test_instance +set test_file_name =(select a.file_name from staging1.staging_generic_table a where file_syspk = __file_syspk limit 1) +where file_syspk = __file_syspk; + + +update transactional.test_instance +set test_type = a.test_type, +test_name= a.test_name +from fw_core.test_file_sheet_format_master a +where transactional.test_instance.file_sheet_mnemonic = a.file_sheet_mnemonic +and transactional.test_instance.file_syspk=__file_syspk; + + perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'trx', 'fn_IHTEMT_EMT_TRX', err_state, err_msg, err_detail, err_hint, err_context,'success'); end diff --git a/onetime/dataloadfunctions/IHT/IHT_EMT_STD_ODS.sql b/onetime/dataloadfunctions/IHT/IHT_EMT_STD_ODS.sql index 2e15fd4..95ea36e 100755 --- a/onetime/dataloadfunctions/IHT/IHT_EMT_STD_ODS.sql +++ b/onetime/dataloadfunctions/IHT/IHT_EMT_STD_ODS.sql @@ -80,6 +80,17 @@ tractor_model =__model, tractor_make=__make where file_syspk=__file_syspk; +update transactional.test_instance +set test_file_name =(select a.file_name from staging1.staging_generic_table a where file_syspk = __file_syspk limit 1) +where file_syspk = __file_syspk; + + +update transactional.test_instance +set test_type = a.test_type, +test_name= a.test_name +from fw_core.test_file_sheet_format_master a +where transactional.test_instance.file_sheet_mnemonic = a.file_sheet_mnemonic +and transactional.test_instance.file_syspk=__file_syspk; perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'trx', 'fn_IHTEMT_STD_TRX', err_state, err_msg, err_detail, err_hint, err_context,'success'); diff --git a/onetime/dataloadfunctions/IHT/IHT_EMT_STD_STG2.sql b/onetime/dataloadfunctions/IHT/IHT_EMT_STD_STG2.sql index 205276b..83052db 100755 --- a/onetime/dataloadfunctions/IHT/IHT_EMT_STD_STG2.sql +++ b/onetime/dataloadfunctions/IHT/IHT_EMT_STD_STG2.sql @@ -125,8 +125,8 @@ perform fw_core.fn_jobctl_block_begin(__client_id,__function_id,__file_syspk, 'IHTEMT_STD_RAW_Data_Block',__file_mnemonic,__file_sheet_mnemonic,1); err_block:='IHTEMT_STD_RAW_Data_Block'; -insert into staging2.IHTEMT_STD_RAW_Data_Block (Time_s,Steering_Angle,Effort,block_row_number) -select a.column1,column2,column3,block_row_number from staging2.stg_process_table_IHTEMT_STD a +insert into staging2.IHTEMT_STD_RAW_Data_Block (Steering_Angle,Effort,block_row_number) +select a.column1,column2,block_row_number from staging2.stg_process_table_IHTEMT_STD a where block_tag='IHTEMT_STD_RAW_Data'; diff --git a/onetime/dataloadfunctions/IHT/IHT_EMT_STG2.sql b/onetime/dataloadfunctions/IHT/IHT_EMT_STG2.sql index ac9f135..1469b17 100755 --- a/onetime/dataloadfunctions/IHT/IHT_EMT_STG2.sql +++ b/onetime/dataloadfunctions/IHT/IHT_EMT_STG2.sql @@ -226,7 +226,7 @@ and block_tag='IHTEMT_EMT_H1' insert into staging2.IHTEMT_EMT_H1_INT (c1,c2) select split_part(column2,':',1),split_part(column2,':',2) from staging2.stg_process_table_IHTEMT_EMT -where block_tag='IHTEMT_EMT_Footer' and block_row_number=1; +where block_tag='IHTEMT_EMT_Brake_Pedal' and block_row_number=14; insert into staging2.IHTEMT_EMT_H1_INT (c1,c2) select 'Test Purpose',column9 @@ -249,6 +249,8 @@ Test_Request_no, Sample_Receipt_Date, Test_report_No, Tractor_Model, +tractor_power_hp, +variant, Generation, Customer_Name, Test_Engineer, @@ -257,6 +259,8 @@ No_of_Sample, Test_Start_Date, Test_End_Date, Tractor_Sr_No, +drive, +platform, Test_Standard_Refer, Test_Location, Operator_Name, @@ -272,10 +276,10 @@ FROM crosstab( , row_number() OVER () , unnest(ARRAY[c2::text]) AS val FROM staging2.IHTEMT_EMT_H1_INT - ORDER BY generate_series(1,15),2' + ORDER BY generate_series(1,15), syspk,2' ) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text, a_9 text,a_10 text,a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text, - a_18 text,a_19 text,a_20 text); + a_18 text,a_19 text,a_20 text, a_21 text, a_22 text, a_23 text, a_24 text); delete from staging2.IHTEMT_EMT_H1_Block where dummy_f is null ; @@ -379,7 +383,7 @@ FROM crosstab( , row_number() OVER () , unnest(ARRAY[column14::text,column18::text]) AS val FROM staging2.IHTEMT_EMT_Weight_Tyre_Int where block_row_number between 3 and 11 - ORDER BY generate_series(1,15),2' + ORDER BY generate_series(1,15),syspk,2' ) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,a_9 text); delete from staging2.IHTEMT_EMT_Tyre_Details_Block where dummy_f is null ; @@ -452,6 +456,7 @@ file_mnemonic='''||p_file_mnemonic||''', file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; update staging2.IHTEMT_EMT_Steering_Block set trx_record =0 where block_row_number in (1,2,3); +update staging2.IHTEMT_EMT_Steering_Block set trx_record =0 where column4 is null and column5 is null and column6 is null and column8 is null ; perform fw_core.fn_jobctl_block_end(__file_syspk,'IHTEMT_EMT_Steering_Block'); diff --git a/onetime/dataloadfunctions/IHT/IHT_HAM_ODS.sql b/onetime/dataloadfunctions/IHT/IHT_HAM_ODS.sql index 602b39b..83e059f 100755 --- a/onetime/dataloadfunctions/IHT/IHT_HAM_ODS.sql +++ b/onetime/dataloadfunctions/IHT/IHT_HAM_ODS.sql @@ -422,6 +422,17 @@ tractor_model =__model, tractor_make=__make where file_syspk=__file_syspk; +update transactional.test_instance +set test_file_name =(select a.file_name from staging1.staging_generic_table a where file_syspk = __file_syspk limit 1) +where file_syspk = __file_syspk; + + +update transactional.test_instance +set test_type = a.test_type, +test_name= a.test_name +from fw_core.test_file_sheet_format_master a +where transactional.test_instance.file_sheet_mnemonic = a.file_sheet_mnemonic +and transactional.test_instance.file_syspk=__file_syspk; perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'trx', 'fn_IHTHAM_HAM_TRX', err_state, err_msg, err_detail, err_hint, err_context,'success'); diff --git a/onetime/dataloadfunctions/IHT/IHT_HAM_STG2.sql b/onetime/dataloadfunctions/IHT/IHT_HAM_STG2.sql index 8da8659..4c23386 100755 --- a/onetime/dataloadfunctions/IHT/IHT_HAM_STG2.sql +++ b/onetime/dataloadfunctions/IHT/IHT_HAM_STG2.sql @@ -1,3 +1,4 @@ + drop function if exists staging2.fn_IHTHAM_HAM_block; CREATE OR REPLACE FUNCTION staging2.fn_IHTHAM_HAM_block(p_client_id int,p_function_id int, p_file_mnemonic text,p_file_sheet_mnemonic text, p_file_syspk int) RETURNS void @@ -238,6 +239,8 @@ Test_Request_no, Sample_Receipt_Date, Test_report_No, Tractor_Model, +tractor_power_hp, +variant, Generation, Customer_Name, Test_Engineer, @@ -246,6 +249,8 @@ No_of_Sample, Test_Start_Date, Test_End_Date, Tractor_Sr_No, +drive, +platform, Test_Location, Operator_Name, Project_Group, @@ -264,32 +269,9 @@ FROM crosstab( ORDER BY generate_series(1,15),2' ) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text, a_9 text,a_10 text,a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text,a_18 text, - a_19 text,a_20 text); + a_19 text,a_20 text,a_21 text,a_22 text,a_23 text,a_24 text); - update staging2.IHTHAM_HAM_H1_Block - set Sample_Receipt_Date=case - when Sample_Receipt_Date like '%-%' then Sample_Receipt_Date::timestamptz - else date '1899-12-30' + Sample_Receipt_Date::int * interval '1' day - end; - - update staging2.IHTHAM_HAM_H1_Block - set Test_Report_Date=case - when Test_Report_Date like '%-%' then Test_Report_Date::timestamptz - else date '1899-12-30' + Test_Report_Date::int * interval '1' day - end; - - update staging2.IHTHAM_HAM_H1_Block - set Test_Start_Date=case - when Test_Report_Date like '%-%' then Test_Report_Date::timestamptz - else date '1899-12-30' + Test_Report_Date::int * interval '1' day - end; - update staging2.IHTHAM_HAM_H1_Block - set Test_End_Date=case - when Test_Report_Date like '%-%' then Test_Report_Date::timestamptz - else date '1899-12-30' + Test_Report_Date::int * interval '1' day - end; - delete from staging2.IHTHAM_HAM_H1_Block where dummy_f is null ; update staging2.IHTHAM_HAM_H1_Block set model=__model; execute 'update staging2.IHTHAM_HAM_H1_Block set diff --git a/onetime/dataloadfunctions/IHT/IHT_HLS_ODS.sql b/onetime/dataloadfunctions/IHT/IHT_HLS_ODS.sql index 97c1ea5..36bf379 100755 --- a/onetime/dataloadfunctions/IHT/IHT_HLS_ODS.sql +++ b/onetime/dataloadfunctions/IHT/IHT_HLS_ODS.sql @@ -72,15 +72,15 @@ file_mnemonic, file_sheet_mnemonic, make,model, Test_Request_no, -date '1899-12-30' + sample_receipt_date::int * interval '1' day as Sample_Receipt_Date, +sample_receipt_date::Date, Test_report_No, Generation, Customer_Name, Test_Engineer, -date '1899-12-30' + Test_Report_Date::int * interval '1' day as Test_Report_Date, +Test_Report_Date::Date, No_of_Sample, -to_date(Test_Start_Date,'DD-MM-YYYY'), -to_date(Test_End_Date, 'DD-MM-YYYY'), +Test_Start_Date::date, +Test_End_Date::date, Tractor_Sr_No, Test_Standard_Refer, Test_Location, @@ -180,6 +180,17 @@ where b.file_syspk =a.file_syspk) and a.file_syspk =__file_syspk; +update transactional.test_instance_tractor_info a +set +wheel_drive_type = b.Drive, +tractor_platform = b.Platform, +tractor_engine_hp= b.Tractor_power_hp::numeric, +generation=b.generation +from staging2.IHTHLS_HLS_H1_block b +where b.trx_record=1 +and a.file_sheet_mnemonic ='IHTHLS_HLS' +and a.file_syspk =__file_syspk; + /*block */ @@ -295,6 +306,18 @@ tractor_model =__model, tractor_make=__make where file_syspk=__file_syspk; +update transactional.test_instance +set test_file_name =(select a.file_name from staging1.staging_generic_table a where file_syspk = __file_syspk limit 1) +where file_syspk = __file_syspk; + + +update transactional.test_instance +set test_type = a.test_type, +test_name= a.test_name +from fw_core.test_file_sheet_format_master a +where transactional.test_instance.file_sheet_mnemonic = a.file_sheet_mnemonic +and transactional.test_instance.file_syspk=__file_syspk; + perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'trx', 'fn_IHTHLS_HLS_TRX', err_state, err_msg, err_detail, err_hint, err_context,'success'); diff --git a/onetime/dataloadfunctions/IHT/IHT_HLS_STG2.sql b/onetime/dataloadfunctions/IHT/IHT_HLS_STG2.sql index 88bc1ed..d7a3bf7 100755 --- a/onetime/dataloadfunctions/IHT/IHT_HLS_STG2.sql +++ b/onetime/dataloadfunctions/IHT/IHT_HLS_STG2.sql @@ -230,6 +230,8 @@ Test_Request_no, Sample_Receipt_Date, Test_report_No, Tractor_Model, +tractor_power_hp, +variant, Generation, Customer_Name, Test_Engineer, @@ -238,6 +240,8 @@ No_of_Sample, Test_Start_Date, Test_End_Date, Tractor_Sr_No, +drive, +platform, Test_Standard_Refer, Test_Location, Operator_Name, @@ -253,10 +257,10 @@ FROM crosstab( , row_number() OVER () , unnest(ARRAY[c2::text]) AS val FROM staging2.IHTHLS_HLS_H1_INT - ORDER BY generate_series(1,15),2' + ORDER BY generate_series(1,15),syspk,2' ) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text, a_9 text,a_10 text,a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text, - a_18 text,a_19 text,a_20 text); + a_18 text,a_19 text,a_20 text,a_21 text,a_22 text,a_23 text,a_24 text); delete from staging2.IHTHLS_HLS_H1_Block where dummy_f is null ; @@ -357,7 +361,7 @@ FROM crosstab( , row_number() OVER () , unnest(ARRAY[column15::text,column19::text]) AS val FROM staging2.IHTHLS_HLS_Weight_Tyre_Int where block_row_number between 3 and 11 - ORDER BY generate_series(1,15),2' + ORDER BY generate_series(1,15),syspk,2' ) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,a_9 text); delete from staging2.IHTHLS_HLS_Tyre_Details_Block where dummy_f is null ; diff --git a/onetime/dataloadfunctions/IHT/IHT_NST_ODS.sql b/onetime/dataloadfunctions/IHT/IHT_NST_ODS.sql index d9ef157..06ce84f 100755 --- a/onetime/dataloadfunctions/IHT/IHT_NST_ODS.sql +++ b/onetime/dataloadfunctions/IHT/IHT_NST_ODS.sql @@ -1,34 +1,34 @@ drop function if exists staging2.fn_IHTNST_NST_TRX; CREATE OR REPLACE FUNCTION staging2.fn_IHTNST_NST_TRX(p_client_id int,p_function_id int, p_file_mnemonic text, p_file_sheet_mnemonic text, p_file_syspk int) - RETURNS void - LANGUAGE plpgsql +RETURNS void +LANGUAGE plpgsql AS $function$ - declare __test_instance_id int; - declare __client_id int :=p_client_id; - declare __function_id int :=p_function_id; - declare __file_mnemonic text :=p_file_mnemonic; - declare __file_sheet_mnemonic text :=p_file_sheet_mnemonic; - declare __file_syspk int :=p_file_syspk; - declare __make text; - declare __model text; - declare err_state text; - declare err_msg text; - declare err_detail text; - declare err_hint text; - declare err_context text; - declare _error int; - declare __test_master_id int; - declare __test_instance_tractor_id int; - begin -__file_syspk := p_file_syspk; +declare __test_instance_id int; +declare __client_id int :=p_client_id; +declare __function_id int :=p_function_id; +declare __file_mnemonic text :=p_file_mnemonic; +declare __file_sheet_mnemonic text :=p_file_sheet_mnemonic; +declare __file_syspk int :=p_file_syspk; +declare __make text; +declare __model text; +declare err_state text; +declare err_msg text; +declare err_detail text; +declare err_hint text; +declare err_context text; +declare _error int; +declare __test_master_id int; +declare __test_instance_tractor_id int; +begin +--__file_syspk := p_file_syspk; -/************************************************************ +/************************************************************ Function Name:fn_IHTNST_NST_TRX Function Desc: This function populates data into ODS File Format: IHTNST Sheet Format: IHTNST_NST -Creation Date: +Creation Date: Updation Date: Author: compegence team Function Call: select staging2.fn_IHTNST_NST_TRX() @@ -61,7 +61,7 @@ objective_of_test, test_condition, test_purpose ) -select +select client_id, function_id, file_syspk, @@ -69,15 +69,15 @@ file_mnemonic, file_sheet_mnemonic, make,model, Test_Request_no, -date '1899-12-30' + sample_receipt_date::int * interval '1' day as Sample_Receipt_Date, +sample_receipt_date::Date, Test_report_No, Generation, -Customer_Name, +Customer_Name, Test_Engineer, -date '1899-12-30' + Test_Report_Date::int * interval '1' day as Test_Report_Date, +Test_Report_Date::Date, No_of_Sample, -date '1899-12-30' + Test_Start_Date::int * interval '1' day as Test_Start_Date, -date '1899-12-30' + Test_End_Date::int * interval '1' day as Test_End_Date, +Test_Start_Date::Date, +Test_End_Date::Date, Tractor_Sr_No, Test_Standard_Refer, Test_facility, @@ -86,8 +86,8 @@ Project_Group, Objective, condition, Test_Purpose -from - staging2.IHTNST_NST_H1_block where trx_record=1; +from +staging2.IHTNST_NST_H1_block where trx_record=1; update transactional.test_instance a set report_prepared_by=b.prepared_by, @@ -98,9 +98,9 @@ report_title=b.comments, report_template_no=b.rev1, report_template_rev_date=b.rev2, report_template_rev_no= b.rev3 -from staging2.IHTNST_nst_footer_block b +from staging2.IHTNST_nst_footer_block b where a.file_sheet_mnemonic='IHTNST_NST' and trx_record=1; - + insert into transactional.test_instance_tyre_info ( client_id, @@ -117,7 +117,7 @@ tyre_ply_rating, tyre_load_carrying_capacity, tyre_wheel_rim_make_and_size ) -select +select client_id, function_id, file_syspk, @@ -133,8 +133,8 @@ wheel_rim_make_size from staging2.IHTNST_nst_tyre_details_block where trx_record=1; - insert into transactional.test_instance_engine_info - ( +insert into transactional.test_instance_engine_info +( client_id, function_id, file_syspk, @@ -148,9 +148,11 @@ high_idle_declared, high_idle_observed, rated_rpm, rated_rpm_observed, -engine_to_pto_ratio_540_pto +engine_to_pto_ratio_540_pto, +low_idle_remark, +high_idle_remark ) -select +select client_id, function_id, file_syspk, @@ -163,11 +165,13 @@ high_idle_declared, high_idle_observed::numeric, rated_rpm_declared::numeric, rated_rpm_observed::numeric, -engine_to_pto_ratio +engine_to_pto_ratio , +low_idle_remark, +high_idle_remark from staging2.IHTNST_nst_engine_rpm_block where trx_record=1; - insert into transactional.test_instance_tractor_info - ( +insert into transactional.test_instance_tractor_info +( client_id, function_id, file_syspk, @@ -175,17 +179,17 @@ file_mnemonic, file_sheet_mnemonic, tractor_make, tractor_model, -weight_reactions_front_kg, +tractor_weight_front_kg, tractor_weight_front_observed_kg, tractor_weight_front_remark, -weight_reactions_rear_kg, +tractor_weight_rear_kg, tractor_weight_rear_observed_kg, tractor_weight_rear_remark, tractor_weight_total_kg, tractor_weight_total_observed_kg, tractor_weight_total_remark ) -select +select client_id, function_id, file_syspk, @@ -203,18 +207,39 @@ total_weight_observed::numeric, total_weight_remark from staging2.IHTNST_nst_weight_block where trx_record=1; -update transactional.test_instance_tractor_info +update transactional.test_instance_tractor_info a set mahindra_model_yn = ( -case when tractor_make like 'Mahindra%' then 'Y' else 'N' end -) where file_syspk =__file_syspk; +case when tractor_make like 'Mahindra%' then 'Y' else 'N' end +) where a.file_syspk =__file_syspk; update transactional.test_instance_tractor_info a -set test_tractor_yn ='Y' where syspk in +set test_tractor_yn ='Y' where syspk in (select min(syspk) from transactional.test_instance_tractor_info b where b.file_syspk =a.file_syspk) and a.file_syspk =__file_syspk; + +update transactional.test_instance_tractor_info a +set +wheel_drive_type = b.Drive, +tractor_platform = b.Platform, +generation =b.generation , +tractor_sr_no=b.tractor_sr_no, +tractor_engine_hp= b.Tractor_power_hp::numeric +from staging2.IHTNST_NST_H1_block b +where b.trx_record=1 +and a.file_sheet_mnemonic ='IHTNST_NST' +and a.file_syspk =__file_syspk; + + +update transactional.test_instance_tyre_info b +set tractor_sr_no = a.tractor_sr_no +from transactional.test_instance_tractor_info a +where a.file_syspk =b.file_syspk; + + + /*block */ insert into transactional.test_instance_atmospheric_info @@ -232,7 +257,7 @@ pressure_kpa, background_noise_dba, wind_velocity_kmph ) -select +select client_id, function_id, file_syspk, @@ -262,7 +287,7 @@ noise_level_1_db_a, noise_level_2_db_a, noise_level_3_db_a ) -select +select client_id, function_id, file_syspk, @@ -277,42 +302,12 @@ column5::numeric, column6::numeric from staging2.IHTNST_nst_stand_noise_block where trx_record=1; -update transactional.IHT_noise_measurement_results -set test_condition = (select column4 -from staging2.IHTNST_nst_stand_noise_block -where block_row_number=3) where file_syspk = __file_syspk; +update transactional.IHT_noise_measurement_results +set test_condition = (select column4 +from staging2.IHTNST_nst_stand_noise_block a +where a.block_row_number=3) where file_syspk = __file_syspk; -insert into transactional.IHT_noise_measurement_test -( -client_id, -function_id, -file_syspk, -file_mnemonic, -file_sheet_mnemonic, -tractor_make, -tractor_model, -test_condition, -test_type, -test_mode -) -select -client_id, -function_id, -file_syspk, -file_mnemonic, -file_sheet_mnemonic, -tractor_make, -tractor_model, -test_condition, -test_type, -test_mode -from transactional.IHT_noise_measurement_results where test_type='BY STANDER’S NOISE'; -update transactional.IHT_noise_measurement_test -set acceptance_criteria=b.acceptance_criteria, -remarks =b.remarks -from staging2.IHTNST_nst_stand_noise_block b -where b.column1 ='BY STANDER’S NOISE' and test_type='BY STANDER’S NOISE' and trx_record=1; insert into transactional.IHT_noise_measurement_results ( @@ -330,7 +325,7 @@ noise_level_1_db_a, noise_level_2_db_a, noise_level_3_db_a ) -select +select client_id, function_id, file_syspk, @@ -345,42 +340,12 @@ column8::numeric, column9::numeric from staging2.IHTNST_nst_stand_noise_block where trx_record=1; -update transactional.IHT_noise_measurement_results -set test_condition = (select column7 +update transactional.IHT_noise_measurement_results a +set test_condition = (select column7 from staging2.IHTNST_nst_stand_noise_block -where block_row_number=3) where test_condition is null; +where block_row_number=3) where test_condition is null and test_type = 'BY STANDERS NOISE' +and a.file_syspk=__file_syspk; -insert into transactional.IHT_noise_measurement_test -( -client_id, -function_id, -file_syspk, -file_mnemonic, -file_sheet_mnemonic, -tractor_make, -tractor_model, -test_condition, -test_type, -test_mode -) -select -client_id, -function_id, -file_syspk, -file_mnemonic, -file_sheet_mnemonic, -tractor_make, -tractor_model, -test_condition, -test_type, -test_mode -from transactional.IHT_noise_measurement_results where test_type='BY STANDER’S NOISE'; - -update transactional.IHT_noise_measurement_test -set acceptance_criteria=b.acceptance_criteria, -remarks =b.remarks -from staging2.IHTNST_nst_stand_noise_block b -where b.column1 ='BY STANDER’S NOISE' and test_type='BY STANDER’S NOISE' and trx_record=1; insert into transactional.IHT_noise_measurement_results ( @@ -401,7 +366,7 @@ noise_level_1_db_a, noise_level_2_db_a, noise_level_3_db_a ) -select +select client_id, function_id, file_syspk, @@ -419,11 +384,8 @@ column8::numeric, column9::numeric from staging2.IHTNST_nst_oel_noise_block where trx_record=1; -update transactional.IHT_noise_measurement_test -set acceptance_criteria=b.acceptance_criteria, -remarks =b.remarks -from staging2.IHTNST_nst_oel_noise_block b -where b.column1 ='OEL Noise without Load' and test_type='OEL Noise without Load'; + + insert into transactional.IHT_noise_measurement_results ( @@ -444,7 +406,7 @@ noise_level_1_db_a, noise_level_2_db_a, noise_level_3_db_a ) -select +select client_id, function_id, file_syspk, @@ -462,11 +424,40 @@ column8::numeric, column9::numeric from staging2.IHTNST_nst_oel_noise_load_block where trx_record=1; -update transactional.IHT_noise_measurement_test + +insert into transactional.IHT_noise_measurement_test +( +client_id, +function_id, +file_syspk, +file_mnemonic, +file_sheet_mnemonic, +tractor_make, +tractor_model, +test_condition, +test_type, +test_mode +) +select +client_id, +function_id, +file_syspk, +file_mnemonic, +file_sheet_mnemonic, +tractor_make, +tractor_model, +test_condition, +test_type, +test_mode +from transactional.IHT_noise_measurement_results b where test_type='BY STANDERS NOISE' and b.file_syspk=__file_syspk; + +update transactional.IHT_noise_measurement_test a set acceptance_criteria=b.acceptance_criteria, -remarks =b.remarks -from staging2.IHTNST_nst_oel_noise_load_block b -where b.column1 ='OEL Noise with Load' and test_type='OEL Noise with Load'; +remarks =b.remarks +from staging2.IHTNST_nst_stand_noise_block b +where b.column1 ='BY STANDERS NOISE' and test_type='BY STANDERS NOISE' and trx_record=1 +and a.file_syspk=__file_syspk; + insert into transactional.IHT_noise_measurement_test ( @@ -492,7 +483,10 @@ tractor_model, test_condition, test_type, test_mode -from transactional.IHT_noise_measurement_results where test_type ='OEL Noise without Load' ; +from transactional.IHT_noise_measurement_results b where test_type ='OEL Noise without Load' and b.file_syspk=__file_syspk; + + + insert into transactional.IHT_noise_measurement_test ( @@ -518,60 +512,87 @@ tractor_model, test_condition, test_type, test_mode -from transactional.IHT_noise_measurement_results where test_type ='OEL Noise with Load'; - +from transactional.IHT_noise_measurement_results b where test_type ='OEL Noise with Load' and b.file_syspk=__file_syspk; + + delete from transactional.IHT_noise_measurement_test a using transactional.IHT_noise_measurement_test b -where (a.syspk < b.syspk and +where (a.syspk < b.syspk and a.test_condition is not null and -a.test_condition =b.test_condition and -a.test_mode =b.test_mode and a.test_type=b.test_type) or -(a.syspk < b.syspk and a.test_condition is null and a.test_mode =b.test_mode and a.test_type=b.test_type); +a.test_condition =b.test_condition and +a.test_mode =b.test_mode and a.test_type=b.test_type and a.file_syspk=b.file_syspk) or +(a.syspk < b.syspk and a.test_condition is null and a.test_mode =b.test_mode and a.test_type=b.test_type and a.file_syspk=b.file_syspk); update transactional.IHT_noise_measurement_results a -set noise_measurement_id =(select syspk +set noise_measurement_id =( +select syspk from transactional.IHT_noise_measurement_test b -where (a.test_condition =b.test_condition and a.test_condition is not null and -a.test_mode =b.test_mode and a.test_type=b.test_type) or -(a.test_condition is null and a.test_mode =b.test_mode and a.test_type=b.test_type)); +where +(a.test_condition =b.test_condition and a.test_condition is not null and a.test_mode =b.test_mode and a.test_type=b.test_type and a.file_syspk=b.file_syspk ) +or +(a.test_condition is null and a.test_mode =b.test_mode and a.test_type=b.test_type and a.file_syspk=b.file_syspk) +); + + +update transactional.IHT_noise_measurement_test a +set acceptance_criteria=b.acceptance_criteria, +remarks =b.remarks +from staging2.IHTNST_nst_oel_noise_load_block b +where b.column1 ='OEL Noise with Load' and test_type='OEL Noise with Load' +and b.block_row_number=1 +and a.file_syspk=__file_syspk; + +update transactional.IHT_noise_measurement_test a +set acceptance_criteria=b.acceptance_criteria, +remarks =b.remarks +from staging2.IHTNST_nst_oel_noise_block b +where b.column1 ='OEL Noise without Load' +and test_type='OEL Noise without Load' +and trx_record=1 +and a.file_syspk=__file_syspk; + + select syspk into __test_instance_id from transactional.test_instance where file_syspk =__file_syspk; select tractor_model into __model from transactional.test_instance where file_syspk =__file_syspk; select tractor_make into __make from transactional.test_instance where file_syspk =__file_syspk; -select syspk from transactional.test_master into __test_master_id where test_type ='In House'; -select syspk into __test_instance_tractor_id from transactional.test_instance_tractor_info where file_syspk =__file_syspk; +select syspk from transactional.test_master into __test_master_id where test_type ='In House'; +select syspk into __test_instance_tractor_id from transactional.test_instance_tractor_info where file_syspk =__file_syspk; -update transactional.test_instance + + +update transactional.test_instance set test_master_id =__test_master_id, test_tractor_id =__test_instance_tractor_id where file_syspk=__file_syspk; update transactional.test_instance_engine_info -set test_instance_id=__test_instance_id, +set +test_instance_id=__test_instance_id, test_instance_tractor_id = __test_instance_tractor_id, tractor_model =__model, tractor_make=__make where file_syspk=__file_syspk; -update transactional.test_instance_tyre_info +update transactional.test_instance_tyre_info set test_instance_id=__test_instance_id, test_instance_tractor_id = __test_instance_tractor_id, tractor_model =__model, tractor_make=__make where file_syspk=__file_syspk; -update transactional.test_instance_tractor_info +update transactional.test_instance_tractor_info set test_instance_id=__test_instance_id, tractor_model =__model, tractor_make=__make where file_syspk=__file_syspk; -update transactional.test_instance_atmospheric_info +update transactional.test_instance_atmospheric_info set test_instance_id=__test_instance_id, test_instance_tractor_id = __test_instance_tractor_id, tractor_model =__model, @@ -585,19 +606,31 @@ tractor_model =__model, tractor_make=__make where file_syspk=__file_syspk; -update transactional.IHT_noise_measurement_test +update transactional.IHT_noise_measurement_test set test_instance_id=__test_instance_id, test_instance_tractor_id = __test_instance_tractor_id, tractor_model =__model, tractor_make=__make where file_syspk=__file_syspk; -perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'trx', 'fn_IHTNST_NST_TRX', err_state, err_msg, err_detail, err_hint, err_context,'success'); +update transactional.test_instance +set test_file_name =(select a.file_name from staging1.staging_generic_table a where file_syspk = __file_syspk limit 1) +where file_syspk = __file_syspk; + + +update transactional.test_instance +set test_type = a.test_type, +test_name= a.test_name +from fw_core.test_file_sheet_format_master a +where transactional.test_instance.file_sheet_mnemonic = a.file_sheet_mnemonic +and transactional.test_instance.file_syspk=__file_syspk; + + + +perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic, __file_sheet_mnemonic ,null,'trx', 'fn_IHTNST_NST_TRX', err_state, err_msg, err_detail, err_hint, err_context,'success'); end $function$ ; - - diff --git a/onetime/dataloadfunctions/IHT/IHT_NST_STG2.sql b/onetime/dataloadfunctions/IHT/IHT_NST_STG2.sql index d845683..6e3c7eb 100755 --- a/onetime/dataloadfunctions/IHT/IHT_NST_STG2.sql +++ b/onetime/dataloadfunctions/IHT/IHT_NST_STG2.sql @@ -165,7 +165,7 @@ from staging2.stg_specific_table_IHTNST_NST a join transactional.source_config b on a.row_number >=row_number_start and (a.row_number< row_read_end or row_read_end is null) -and f1_modified=''BY STANDER’S NOISE'' +and f1_modified=''BY STANDERS NOISE'' and b.file_mnemonic='''||p_file_mnemonic||''' and b.file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; execute 'insert into staging2.stg_process_table_IHTNST_NST @@ -248,6 +248,7 @@ file_syspk='||p_file_syspk||', file_mnemonic='''||p_file_mnemonic||''', file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; + insert into staging2.IHTNST_NST_H1_Block ( dummy_f, @@ -255,6 +256,8 @@ Test_Request_no, Sample_Receipt_Date, Test_report_No, Tractor_Model, +tractor_power_hp, +variant, Generation, Customer_Name, Test_Engineer, @@ -263,6 +266,8 @@ No_of_Sample, Test_Start_Date, Test_End_Date, Tractor_Sr_No, +drive, +platform, Test_Facility, Operator_Name, Project_Group, @@ -277,10 +282,9 @@ FROM crosstab( , row_number() OVER () , unnest(ARRAY[c2::text]) AS val FROM staging2.IHTNST_NST_H1_INT - ORDER BY generate_series(1,15),2' + ORDER BY generate_series(1,23),2' ) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text, - a_9 text,a_10 text,a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text,a_18 text,a_19 text); - + a_9 text,a_10 text,a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text,a_18 text,a_19 text,a_20 text,a_21 text,a_22 text,a_23 text); delete from staging2.IHTNST_NST_H1_Block where dummy_f is null ; update staging2.IHTNST_NST_H1_Block set model=__model; @@ -583,7 +587,7 @@ where block_tag='IHTNST_NST_STAND_Noise' order by block_row_number; update staging2.IHTNST_NST_STAND_Noise_Block -set column2=column3 where column4 is null and block_row_number in (2,6); +set column2=column3 where column4 is null and column3 like 'Mode%'; update staging2.IHTNST_NST_STAND_Noise_Block set column1=column3 where column4 is null and block_row_number =1; @@ -612,8 +616,20 @@ sum(case when column2 is null then 0 else 1 end) over (order by block_row_number ORDER BY block_row_number ASC ) as q) b where a.block_row_number = b.block_row_number; -update staging2.IHTNST_NST_STAND_Noise_Block -set trx_record=0 where block_row_number <>5; +update staging2.IHTNST_NST_STAND_Noise_Block +set trx_record=0; + +update staging2.IHTNST_NST_STAND_Noise_Block +set trx_record=1 where +column3 is not null and +column4 is not null and +column5 is not null and +column6 is not null and +column7 is not null and +column8 is not null and +column9 is not null +; + update staging2.IHTNST_NST_STAND_Noise_Block set remarks=(select column3 @@ -637,6 +653,13 @@ where lower(column7)='acceptance criteria' and block_tag='IHTNST_NST_STAND_Noise' )); + +update staging2.IHTNST_NST_OEL_Noise_Block +set trx_record = 0 +where column3 = 'Remarks'; + + + update staging2.IHTNST_NST_STAND_Noise_Block set model=__model; execute 'update staging2.IHTNST_NST_STAND_Noise_Block set client_id='||p_client_id||', @@ -666,7 +689,7 @@ where block_tag='IHTNST_NST_OEL_Noise' order by block_row_number; update staging2.IHTNST_NST_OEL_Noise_Block -set column2=column3 where column4 is null and block_row_number in (2,8,14); +set column2=column3 where column4 is null and column3 like 'Mode%'; update staging2.IHTNST_NST_OEL_Noise_Block set column1=column3 where column4 is null and block_row_number =1; @@ -695,8 +718,19 @@ sum(case when column2 is null then 0 else 1 end) over (order by block_row_number ORDER BY block_row_number ASC ) as q) b where a.block_row_number = b.block_row_number; + update staging2.IHTNST_NST_OEL_Noise_Block -set trx_record=0 where block_row_number in (1,2,3,4,8,9,10,14,15,16,17,18); +set trx_record=0; + +update staging2.IHTNST_NST_OEL_Noise_Block +set trx_record=1 where +column5 is not null and +column6 is not null +; + +update staging2.IHTNST_NST_OEL_Noise_Block +set trx_record=0 where column4 like 'L%'; + update staging2.IHTNST_NST_OEL_Noise_Block set remarks=(select column3 @@ -728,6 +762,18 @@ file_syspk='||p_file_syspk||', file_mnemonic='''||p_file_mnemonic||''', file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; + + +update staging2.IHTNST_NST_OEL_Noise_Block +set trx_record = 0 +where column3 = 'Remarks'; + +update staging2.IHTNST_NST_OEL_Noise_Block +set trx_record = 0 +where block_row_number = +(select block_row_number+1 from staging2.IHTNST_NST_OEL_Noise_Block where column3 = 'Remarks' ); + + perform fw_core.fn_jobctl_block_end(__file_syspk,'IHTNST_NST_OEL_Noise_Block'); /*block starts - IHTNST_NST_OEL_Noise_Block */ @@ -748,7 +794,7 @@ where block_tag='IHTNST_NST_OEL_Noise_Load' order by block_row_number; update staging2.IHTNST_NST_OEL_Noise_Load_Block -set column2=column3 where column4 is null and block_row_number in (2,5,11); +set column2=column3 where column4 is null and column3 like 'Mode%'; update staging2.IHTNST_NST_OEL_Noise_Load_Block set column1=column3 where column4 is null and block_row_number =1; @@ -778,7 +824,16 @@ ORDER BY block_row_number ASC ) as q) b where a.block_row_number = b.block_row_number; update staging2.IHTNST_NST_OEL_Noise_Load_Block -set trx_record=0 where block_row_number not in (8,9,10,14,15,16); +set trx_record=0; + +update staging2.IHTNST_NST_OEL_Noise_Load_Block +set trx_record=1 where +column5 is not null and +column6 is not null and +column7 is not null and +column8 is not null and +column9 is not null +; update staging2.IHTNST_NST_OEL_Noise_Load_Block set remarks=(select column3 @@ -810,6 +865,17 @@ file_syspk='||p_file_syspk||', file_mnemonic='''||p_file_mnemonic||''', file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; + +update staging2.IHTNST_NST_OEL_Noise_Load_Block +set trx_record = 0 +where column3 = 'Remarks'; + +update staging2.IHTNST_NST_OEL_Noise_Load_Block +set trx_record = 0 +where block_row_number = +(select block_row_number+1 from staging2.IHTNST_NST_OEL_Noise_load_Block where column3 = 'Remarks' ); + + perform fw_core.fn_jobctl_block_end(__file_syspk,'IHTNST_NST_OEL_Noise_Load_Block'); diff --git a/onetime/dataloadfunctions/IHT/IHT_SLL_ODS.sql b/onetime/dataloadfunctions/IHT/IHT_SLL_ODS.sql index b60a742..c47b27e 100755 --- a/onetime/dataloadfunctions/IHT/IHT_SLL_ODS.sql +++ b/onetime/dataloadfunctions/IHT/IHT_SLL_ODS.sql @@ -69,15 +69,15 @@ file_mnemonic, file_sheet_mnemonic, make,model, Test_Request_no, -date '1899-12-30' + sample_receipt_date::int * interval '1' day as Sample_Receipt_Date, +sample_receipt_date::Date, Test_report_No, Generation, Customer_Name, Test_Engineer, -date '1899-12-30' + Test_Report_Date::int * interval '1' day as Test_Report_Date, +Test_Report_Date::Date, No_of_Sample, -date '1899-12-30' + Test_Start_Date::int * interval '1' day as Test_Start_Date, -date '1899-12-30' + Test_End_Date::int * interval '1' day as Test_End_Date, +Test_Start_Date::Date, +Test_End_Date::Date, Tractor_Sr_No, Test_Standard_Refer, Test_Location, @@ -177,6 +177,20 @@ where b.file_syspk =a.file_syspk) and a.file_syspk =__file_syspk; + +update transactional.test_instance_tractor_info a +set +wheel_drive_type = b.Drive, +tractor_platform = b.Platform, +tractor_engine_hp= b.Tractor_power_hp::numeric, +generation= b.generation, +tractor_sr_no= b.tractor_sr_no +from staging2.IHTSLL_SLL_H1_block b +where b.trx_record=1 +and a.file_sheet_mnemonic ='IHTSLL_SLL' +and a.file_syspk =__file_syspk; + + /*block */ insert into transactional.test_instance_weight_reaction @@ -371,6 +385,20 @@ tractor_model =__model, tractor_make=__make where file_syspk=__file_syspk; + +update transactional.test_instance +set test_file_name =(select a.file_name from staging1.staging_generic_table a where file_syspk = __file_syspk limit 1) +where file_syspk = __file_syspk; + + +update transactional.test_instance +set test_type = a.test_type, +test_name= a.test_name +from fw_core.test_file_sheet_format_master a +where transactional.test_instance.file_sheet_mnemonic = a.file_sheet_mnemonic +and transactional.test_instance.file_syspk=__file_syspk; + + perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'trx', 'fn_IHTSLL_SLL_TRX', err_state, err_msg, err_detail, err_hint, err_context,'success'); end diff --git a/onetime/dataloadfunctions/IHT/IHT_SLL_STG2.sql b/onetime/dataloadfunctions/IHT/IHT_SLL_STG2.sql index dd1dc40..d6ab679 100755 --- a/onetime/dataloadfunctions/IHT/IHT_SLL_STG2.sql +++ b/onetime/dataloadfunctions/IHT/IHT_SLL_STG2.sql @@ -149,7 +149,7 @@ from staging2.stg_specific_table_IHTSLL_SLL a join transactional.source_config b on a.row_number >=row_number_start and (a.row_number< row_read_end or row_read_end is null) -and f1_modified=''K2-4WD HST EACH GEAR MAX SPEED - FORWARD'' +and f1_modified =''GEAR MAX SPEED-FORWARD'' and b.file_mnemonic='''||p_file_mnemonic||''' and b.file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; execute 'insert into staging2.stg_process_table_IHTSLL_SLL @@ -158,7 +158,7 @@ from staging2.stg_specific_table_IHTSLL_SLL a join transactional.source_config b on a.row_number >=row_number_start and (a.row_number< row_read_end or row_read_end is null) -and f1_modified=''K2- 4WD HST EACH GEAR MAX SPEED REVERSE'' +and f1_modified =''GEAR MAX SPEED-REVERSE'' and b.file_mnemonic='''||p_file_mnemonic||''' and b.file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; execute 'insert into staging2.stg_process_table_IHTSLL_SLL @@ -167,7 +167,7 @@ from staging2.stg_specific_table_IHTSLL_SLL a join transactional.source_config b on a.row_number >=row_number_start and (a.row_number< row_read_end or row_read_end is null) -and f1_modified=''Lead / Lag Measurement on K2 4WD HST'' +and f1_modified=''Lead / Lag Measurement'' and b.file_mnemonic='''||p_file_mnemonic||''' and b.file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; @@ -245,6 +245,8 @@ Test_Request_no, Sample_Receipt_Date, Test_report_No, Tractor_Model, +Tractor_power_hp, +Variant , Generation, Customer_Name, Test_Engineer, @@ -253,6 +255,8 @@ No_of_Sample, Test_Start_Date, Test_End_Date, Tractor_Sr_No, +Drive, +Platform, Test_Standard_Refer, Test_Location, Operator_Name, @@ -268,10 +272,10 @@ FROM crosstab( , row_number() OVER () , unnest(ARRAY[c2::text]) AS val FROM staging2.IHTSLL_SLL_H1_INT - ORDER BY generate_series(1,15),2' + ORDER BY generate_series(1,15),syspk,2' ) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text, a_9 text,a_10 text,a_11 text,a_12 text,a_13 text,a_14 text,a_15 text,a_16 text,a_17 text, - a_18 text,a_19 text,a_20 text); + a_18 text,a_19 text,a_20 text,a_21 text,a_22 text,a_23 text,a_24 text); delete from staging2.IHTSLL_SLL_H1_Block where dummy_f is null ; @@ -316,6 +320,7 @@ insert into staging2.IHTSLL_SLL_Weight_Block ( dummy_f, Weight_Reaction, +condition, Total_Weight_kg, Front_Reaction_kg, Rear_Reaction_kg, @@ -335,7 +340,7 @@ FROM crosstab( FROM staging2.IHTSLL_SLL_Weight_Tyre_Int ORDER BY generate_series(1,15),block_row_number,2' ) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,a_9 text, - a_10 text,a_11 text); + a_10 text,a_11 text,a_12 text); delete from staging2.IHTSLL_SLL_Weight_Block where dummy_f is null ; update staging2.IHTSLL_SLL_Weight_Block set model=__model; @@ -371,8 +376,8 @@ FROM crosstab( 'SELECT unnest(''{column15,column19}''::text[]) AS col , row_number() OVER () , unnest(ARRAY[column15::text,column19::text]) AS val - FROM staging2.IHTSLL_SLL_Weight_Tyre_Int where block_row_number between 3 and 11 - ORDER BY generate_series(1,15),2' + FROM staging2.IHTSLL_SLL_Weight_Tyre_Int where block_row_number between 4 and 12 + ORDER BY generate_series(1,15),syspk,2' ) t (col text,a_1 text,a_2 text,a_3 text,a_4 text,a_5 text,a_6 text,a_7 text,a_8 text,a_9 text); delete from staging2.IHTSLL_SLL_Tyre_Details_Block where dummy_f is null ; @@ -450,7 +455,7 @@ file_syspk='||p_file_syspk||', file_mnemonic='''||p_file_mnemonic||''', file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; -update staging2.IHTSLL_SLL_Forward_Block set trx_record =0 where block_row_number in (1,2); +update staging2.IHTSLL_SLL_Forward_Block set trx_record =0 where column3 like 'Gear%' or column3 like 'GEAR%'; perform fw_core.fn_jobctl_block_end(__file_syspk,'IHTSLL_SLL_Forward_Block'); /*block starts - IHTSLL_SLL_Reverse_Block */ @@ -462,11 +467,11 @@ err_block:='IHTSLL_SLL_Reverse_Block'; insert into staging2.IHTSLL_SLL_Reverse_Block ( -column2,column3,column4,column5,column6,column7, +column3,column4,column5,column6,column7, column8,column9,block_row_number ) select -column2,column3,column4,column5,column6,column7, +column3,column4,column5,column6,column7, column8,column9,block_row_number from staging2.stg_process_table_IHTSLL_SLL a where block_tag='IHTSLL_SLL_Reverse' @@ -486,7 +491,7 @@ file_syspk='||p_file_syspk||', file_mnemonic='''||p_file_mnemonic||''', file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; -update staging2.IHTSLL_SLL_Reverse_Block set trx_record =0 where block_row_number in (1,2); +update staging2.IHTSLL_SLL_Reverse_Block set trx_record =0 where column3 like 'Gear%' or column3 like 'GEAR%'; perform fw_core.fn_jobctl_block_end(__file_syspk,'IHTSLL_SLL_Reverse_Block'); @@ -558,6 +563,16 @@ sum(case when column8 is null then 0 else 1 end) over (order by block_row_number ORDER BY block_row_number ASC ) as q) b where a.block_row_number = b.block_row_number; + +update staging2.IHTSLL_SLL_Lead_Lag_Block +set +column4 = null , +column7 = null , +column8 = null , +trx_record = 0 +where +column5 is null and column6 is null and block_row_number in (4,5,6,7,8,9); + update staging2.IHTSLL_SLL_Lead_Lag_Block set model=__model; execute 'update staging2.IHTSLL_SLL_Lead_Lag_Block set client_id='||p_client_id||', @@ -568,6 +583,10 @@ file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; +update staging2.IHTSLL_SLL_Lead_Lag_Block set trx_record =0 where block_row_number in (1,2,3,10); + + + update staging2.IHTSLL_SLL_Lead_Lag_Block set trx_record =0 where block_row_number in (1,2,3); perform fw_core.fn_jobctl_block_end(__file_syspk,'IHTSLL_SLL_Lead_Lag_Block'); diff --git a/onetime/dataloadfunctions/ODS_Load/fn_fw_ods_budni_load.sql b/onetime/dataloadfunctions/ODS_Load/fn_fw_ods_budni_load.sql new file mode 100755 index 0000000..c82b52c --- /dev/null +++ b/onetime/dataloadfunctions/ODS_Load/fn_fw_ods_budni_load.sql @@ -0,0 +1,253 @@ +CREATE OR REPLACE FUNCTION fw_ods.fn_fw_ods_budni_load(p_client_id int,p_function_id int, p_file_mnemonic text, +p_file_sheet_mnemonic text, p_file_syspk int) + RETURNS void +AS $$ + declare + f record; + + declare __client_id int :=p_client_id; + declare __function_id int :=p_function_id; + declare __file_mnemonic text :=p_file_mnemonic; + declare __file_sheet_mnemonic text :=p_file_sheet_mnemonic; + declare __file_syspk int :=p_file_syspk; + declare err_state text; + declare err_msg text; + declare err_detail text; + declare err_hint text; + declare err_context text; + declare _error int; + +begin +-- Adding data to file fw_ods_field: +for f in select distinct file_mnemonic from fw_core.fw_jobctl_file_runschedule + where latest_runschedule_flag = '1' and end_status = 'success' and end_status_note = 'TRX_completed' +loop +if f.file_mnemonic = 'BUDNI' +then + insert into fw_ods.fw_ods ( + client_id, + function_id, + test_file_mnemonic, + test_sheet_mnemonic, + test_name, + test_file_id, + test_file_name, + test_instance_id, + -- File Identifier + tractor_make, + tractor_model, + tractor_engine_hp, + wheel_drive_type, + "configuration", + test_instance_tractor_id, + -- Tractor Identifier tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id + season, + test_date, + test_date_year, + test_date_quarter, + test_date_month, + test_date_dayofmonth, + test_date_dayofweek, + -- season and date + mahindra_model_yn, + test_tractor_yn, + test_type, + --subtype, condition hierarchy + location_name, + test_condition, + -- location name + engine_speed_var, + fuel_consumption_lit_per_hr, + speed_kmph, + wheel_slippage_pct, + power_kw, + pull_kn, + temp_engine_oil_c, + temp_trans_oil_c, + temp_coolant_c, + temp_fuel_in_c, + temp_engine_oil_high_c, + temp_trans_oil_high_c, + temp_coolant_high_c, + temp_fuel_high_c, + specific_energy_kwh_per_ltr + -- test specific dimensions + -- test specific measures ---- + -- audit fields + -- validate how it is being done + --created_by, updated_by, create_timestamp, update_timestamp + ) + select + d.client_id, + d.function_id, + d.file_mnemonic, + d.file_sheet_mnemonic, + d.test_name, + d.file_syspk, + d.test_file_name, + d.syspk, + b.tractor_make, + b.tractor_model, + b.tractor_engine_hp, + b.wheel_drive_type, + b.configuration, + b.syspk, + -- -- test specific date & test dimensions + + concat(lpad(extract( month from d.date_of_test)::text,2,'0'),'-',(TO_CHAR( + TO_DATE (extract( month from d.date_of_test)::text, 'MM'), 'Month' + ))) AS "Month Name", + d.date_of_test, + extract( year from d.date_of_test) , + extract( quarter from d.date_of_test), + extract( month from d.date_of_test), + extract( DAY from d.date_of_test), + date_part('dow',d.date_of_test) dow, + b.mahindra_model_yn, + b.test_tractor_yn, + d.test_type, + d.test_location_name , + case split_part(a.test_condtion,' ',6) + when 'ballasted)' then 'ballasted' + when 'Unballasted)' then 'Unballasted' + end, + -- test specific dimensions + -- test specific measures + a.engine_speed_rpm, + a.fuel_consumption_ltr_per_hr, + a.travel_speed_km_per_hr, + a.wheel_slippage_pct, + a.drawbar_power_kw, + a.drawbar_pull_kn, + case split_part(a.temp_fuel_c,'to',2) when '' then a.temp_fuel_c::numeric else trim(split_part(a.temp_fuel_c,'to',1))::numeric end, + case split_part(a.temp_trans_oil_c,'to',2) when '' then a.temp_trans_oil_c::numeric else trim(split_part(a.temp_trans_oil_c,'to',1))::numeric end, + case split_part(a.temp_coolant_c,'to',2) when '' then a.temp_coolant_c::numeric else trim(split_part(a.temp_coolant_c,'to',1))::numeric end, + case split_part(a.temp_engine_oil_c,'to',2) when '' then a.temp_engine_oil_c::numeric else trim(split_part(a.temp_engine_oil_c,'to',1))::numeric end, + case split_part(a.temp_fuel_c,'to',2) when '' then null else trim(split_part(a.temp_fuel_c,'to',2))::numeric end, + case split_part(a.temp_trans_oil_c,'to',2) when '' then null else trim(split_part(a.temp_trans_oil_c,'to',2))::numeric end, + case split_part(a.temp_coolant_c,'to',2) when '' then null else trim(split_part(a.temp_coolant_c,'to',2))::numeric end, + case split_part(a.temp_engine_oil_c,'to',2) when '' then null else trim(split_part(a.temp_engine_oil_c,'to',2))::numeric end, + a.specific_energy_kwh_per_ltr + -- add user and timestamp fields + from transactional.budni_drawbar_perf_results a, transactional.test_instance_tractor_info b,transactional.test_instance d + where a.file_syspk = b.file_syspk + and a.file_syspk = d.file_syspk + and a.file_syspk = __file_syspk + and b.tractor_model = a.tractor_model + and b.file_sheet_mnemonic in ('BUDNI_DBP') and d.file_mnemonic =('BUDNI') and d.file_sheet_mnemonic in ('BUDNI_DBP'); + + + insert into fw_ods.fw_ods ( + client_id, + function_id, + test_file_mnemonic, + test_sheet_mnemonic, + test_name, + test_file_id, + test_file_name, + test_instance_id, + -- File Identifier + tractor_make, + tractor_model, + tractor_engine_hp, + wheel_drive_type, + "configuration", + test_instance_tractor_id, + -- Tractor Identifier tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id + season, + test_date, + test_date_year, + test_date_quarter, + test_date_month, + test_date_dayofmonth, + test_date_dayofweek, + mahindra_model_yn, + test_tractor_yn, + -- season and date + test_type, + test_sub_type, + -- test mode, type, subtype, condition hierarchy + location_name, + -- location name + engine_speed_var, + fuel_consumption_lit_per_hr, + power_kw, + speed_pto_rpm + -- test specific dimensions + -- test specific measures ---- + -- audit fields + -- validate how it is being done + --created_by, updated_by, create_timestamp, update_timestamp + ) + --SELECT COUNT(*) from( + select + d.client_id, + d.function_id, + d.file_mnemonic, + d.file_sheet_mnemonic, + d.test_name, + d.file_syspk, + d.test_file_name, + d.syspk, + b.tractor_make, + b.tractor_model, + b.tractor_engine_hp, + b.wheel_drive_type, + b.configuration, + b.syspk, + -- -- test specific date & test dimensions + concat(extract( month from d.date_of_test),'-',(TO_CHAR( + TO_DATE (extract( month from d.date_of_test)::text, 'MM'), 'Month' + ))) AS "Month Name", + d.date_of_test, + extract( year from d.date_of_test) , + extract( quarter from d.date_of_test), + extract( month from d.date_of_test), + extract( DAY from d.date_of_test), + date_part('dow',d.date_of_test) dow, + b.mahindra_model_yn, + b.test_tractor_yn, + a.pto_category, + a.pto_sub_category, + d.test_location_name , + -- test specific dimensions + -- test specific measures + a.speed_rpm_engine, + a.fuel_consumption_ltr_per_hr, + a.power_kw, + a.speed_rpm_pto + -- add user and timestamp fields + from transactional.budni_pto_perf_results_summary a, transactional.test_instance_tractor_info b,transactional.test_instance d + where a.file_syspk = b.file_syspk + and a.file_syspk = d.file_syspk + AND a.file_syspk = __file_syspk + and b.tractor_model = a.tractor_model + and b.file_sheet_mnemonic in ('BUDNI_PTO') and d.file_mnemonic =('BUDNI') and d.file_sheet_mnemonic in ('BUDNI_PTO'); + END if; + end loop; + + + +perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'ods', 'fn_fw_ods_budni_load', err_state, err_msg, err_detail, err_hint, err_context,'success'); + +EXCEPTION when OTHERS then + + err_state = returned_sqlstate, /* P0002 */ + err_msg = message_text, /* No Data in FTDRY */ + err_detail = pg_exception_detail, /* No data in table t_test_new */ + err_hint = pg_exception_hint, /* No data error capture */ + err_context = pg_exception_context; /* PL/pgSQL function staging2.fn_ftdry_trs_block(integer,integer,text,text,integer) line 69 at RAISE*/ + + +perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'ods', 'fn_fw_ods_budni_load', err_state, err_msg, err_detail, err_hint, err_context,'error'); + + + + + + + +end +$$ +LANGUAGE plpgsql; + diff --git a/onetime/dataloadfunctions/ODS_Load/fn_fw_ods_comments_load.sql b/onetime/dataloadfunctions/ODS_Load/fn_fw_ods_comments_load.sql new file mode 100755 index 0000000..b5a3115 --- /dev/null +++ b/onetime/dataloadfunctions/ODS_Load/fn_fw_ods_comments_load.sql @@ -0,0 +1,217 @@ +CREATE OR REPLACE FUNCTION fw_ods.fn_fw_ods_comments_load(p_client_id int,p_function_id int, p_file_mnemonic text, +p_file_sheet_mnemonic text, p_file_syspk int) + RETURNS void +AS $$ + declare + f record; + + declare __client_id int :=p_client_id; + declare __function_id int :=p_function_id; + declare __file_mnemonic text :=p_file_mnemonic; + declare __file_sheet_mnemonic text :=p_file_sheet_mnemonic; + declare __file_syspk int :=p_file_syspk; + declare err_state text; + declare err_msg text; + declare err_detail text; + declare err_hint text; + declare err_context text; + declare _error int; + +begin +CREATE SEQUENCE if not exists mysequence INCREMENT 1 START 1; +-- Adding data to file fw_ods_field: +for f in select distinct file_mnemonic from fw_core.fw_jobctl_file_runschedule + where latest_runschedule_flag = '1' and end_status = 'success' and end_status_note = 'TRX_completed' +loop +if f.file_mnemonic in('FTDRY','FTWET') +then +INSERT INTO fw_ods.fw_ods_comments( +client_id, +function_id, +test_file_mnemonic, +test_sheet_mnemonic, +test_file_id, +test_file_name, +test_instance_id, +tractor_make, +tractor_model, +test_iteration_number, +--old_test_file_name, +--platform, +--benchmark_yn, +wheel_drive_type, +tractor_engine_hp, +name_of_implement, +type_of_implement, +season, +users, + "role", +role_level, +note_or_title, +"timestamp", +"sequence", +note_or_comment, +created_by, +create_timestamp + ) + SELECT + a.client_id, + a.function_id, + a.file_mnemonic, + a.file_sheet_mnemonic, + a.file_syspk, + a.test_file_name, + a.syspk, + c.tractor_make, + b.tractor_model, + b.test_iteration_number, + --old filename, + --'platform data', + --'benchmark', + c.wheel_drive_type, + c.tractor_engine_hp, + d.name_of_implement, + d.Type_of_implement, + concat(lpad(extract( month from a.date_of_test)::text,2,'0'),'-',(TO_CHAR( + TO_DATE (extract( month from a.date_of_test)::text, 'MM'), 'Month' + ))) AS "Month Name", + a.test_engineer, + case WHEN b.test_engr_comments is not null THEN 'Test Engineer' + WHEN b.test_mgr_comments is not null THEN 'Test Manager' + else null + end, + case WHEN b.test_engr_comments is not null THEN 1 + WHEN b.test_mgr_comments is not null THEN 2 + else null + end, + 'note', + a.test_report_date::date, + nextval('mysequence'), + b.test_engr_comments, + current_user, + current_timestamp + + FROM + transactional.test_instance a, + transactional.field_perf_summary b, + transactional.test_instance_tractor_info c, + transactional.test_instance_implement_info d + WHERE + a.file_syspk = b.file_syspk + and b.file_syspk = c.file_syspk + and c.file_syspk = d.file_syspk + and c.tractor_model = b.tractor_model + and a.file_syspk = __file_syspk; + + ALTER SEQUENCE mysequence RESTART WITH 1; + + + + +elsif f.file_mnemonic in('FTHLG') +then +INSERT INTO fw_ods.fw_ods_comments( +client_id, +function_id, +test_file_mnemonic, +test_sheet_mnemonic, +test_file_id, +test_file_name, +test_instance_id, +tractor_make, +tractor_model, +test_iteration_number, +--old_test_file_name, +--platform, +--benchmark_yn, +wheel_drive_type, +tractor_engine_hp, +name_of_implement, +type_of_implement, +season, +users, + "role", +role_level, +note_or_title, +"timestamp", +"sequence", +note_or_comment, +created_by, +create_timestamp + ) + SELECT + a.client_id, + a.function_id, + a.file_mnemonic, + a.file_sheet_mnemonic, + a.file_syspk, + a.test_file_name, + a.syspk, + c.tractor_make, + b.tractor_model, + b.test_iteration_number, + --old filename, + --'platform data', + --'benchmark', + c.wheel_drive_type, + c.tractor_engine_hp, + 'Trailer', + d.trailer_type, + concat(lpad(extract( month from a.date_of_test)::text,2,'0'),'-',(TO_CHAR( + TO_DATE (extract( month from a.date_of_test)::text, 'MM'), 'Month' + ))) AS "Month Name", + a.test_engineer, + case WHEN b.test_engr_comments is not null THEN 'Test Engineer' + WHEN b.test_mgr_comments is not null THEN 'Test Manager' + else null + end, + case WHEN b.test_engr_comments is not null THEN 1 + WHEN b.test_mgr_comments is not null THEN 2 + else null + end, + 'note', + a.test_report_date::date, + nextval('mysequence'), + b.test_engr_comments, + current_user, + current_timestamp + + FROM + transactional.test_instance a, + transactional.field_perf_summary b, + transactional.test_instance_tractor_info c, + transactional.field_perf_summary_trailer_info d + WHERE + a.file_syspk = b.file_syspk + and b.file_syspk = c.file_syspk + and c.file_syspk = d.file_syspk + and c.tractor_model = b.tractor_model + and a.file_syspk = __file_syspk; + + ALTER SEQUENCE mysequence RESTART WITH 1; +END IF; + end loop; + + + +perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'ods', 'fn_fw_ods_comments_load', err_state, err_msg, err_detail, err_hint, err_context,'success'); + + + + + +EXCEPTION when OTHERS then + + err_state = returned_sqlstate, /* P0002 */ + err_msg = message_text, /* No Data in FTDRY */ + err_detail = pg_exception_detail, /* No data in table t_test_new */ + err_hint = pg_exception_hint, /* No data error capture */ + err_context = pg_exception_context; /* PL/pgSQL function staging2.fn_ftdry_trs_block(integer,integer,text,text,integer) line 69 at RAISE*/ + + +perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'ods', 'fn_fw_ods_comments_load', err_state, err_msg, err_detail, err_hint, err_context,'error'); + + +end +$$ +LANGUAGE plpgsql; diff --git a/onetime/dataloadfunctions/ODS_Load/fn_fw_ods_detailed_load.sql b/onetime/dataloadfunctions/ODS_Load/fn_fw_ods_detailed_load.sql new file mode 100755 index 0000000..ff1b825 --- /dev/null +++ b/onetime/dataloadfunctions/ODS_Load/fn_fw_ods_detailed_load.sql @@ -0,0 +1,149 @@ +CREATE OR REPLACE FUNCTION fw_ods.fn_fw_ods_detailed_load(p_client_id int,p_function_id int, p_file_mnemonic text, +p_file_sheet_mnemonic text, p_file_syspk int) + RETURNS void +AS $$ + declare + f record; + + declare __client_id int :=p_client_id; + declare __function_id int :=p_function_id; + declare __file_mnemonic text :=p_file_mnemonic; + declare __file_sheet_mnemonic text :=p_file_sheet_mnemonic; + declare __file_syspk int :=p_file_syspk; + declare err_state text; + declare err_msg text; + declare err_detail text; + declare err_hint text; + declare err_context text; + declare _error int; + +begin +-- Adding data to file fw_ods_field: +for f in select distinct file_mnemonic from fw_core.fw_jobctl_file_runschedule + where latest_runschedule_flag = '1' and end_status = 'success' and end_status_note = 'TRX_completed' +loop +if f.file_mnemonic = 'IHTEMT' +then +insert into fw_ods.fw_ods_detailed + ( + -- File Identifier: Test_Mnemonic, Sheet_Mnemonic, file_syspk(id), test_instance_id, test_file_name, + client_id, + function_id, + test_file_mnemonic, + test_sheet_mnemonic, + test_name, + test_file_id, + test_file_name, + test_instance_id, + -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id + tractor_make, + tractor_model, + tractor_engine_hp, + wheel_drive_type, + configuration, + test_instance_tractor_id, + --test specific: date & test dimensions + test_date, + test_date_year, + test_date_quarter, + test_date_month, + test_date_dayofmonth, + test_date_dayofweek, + --test specific: location + location_name, + test_type, + --test specific:time_sec, Steering angle type and Effort_kg + time_sec, + steering_angle_degree, + effort_kg, + created_by, + create_timestamp + ) + select + -- File Identifier: Test_Mnemonic, Sheet_Mnemonic, file_syspk(id), test_instance_id, test_file_name, + a.client_id, + a.function_id, + a.file_mnemonic, + a.file_sheet_mnemonic, + a.test_name, + a.file_syspk, + a.test_file_name, + a.syspk, + -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id + b.tractor_make, + b.tractor_model, + b.tractor_engine_hp, + b.wheel_drive_type, + b.configuration, + b.syspk, + --test specific: date & test dimensions + a.date_of_test, + extract( year from a.date_of_test), + extract( quarter from a.date_of_test), + extract( month from a.date_of_test), + extract( day from a.date_of_test), + extract( dow from a.date_of_test), + --test specific: location + a.test_location_name, + a.test_type, + --test specific:time_sec, Steering angle type and Effort_kg + c.time_sec, + c.steering_anglel, + c.effort_kg, + current_user, + current_timestamp + from + transactional.test_instance a, + transactional.test_instance_tractor_info b, + transactional.iht_steering_effort_raw_data c + where + a.file_syspk = b.file_syspk + and b.file_syspk = c.file_syspk + and a.file_syspk = __file_syspk +-- and c.tractor_model = b.tractor_model + and a.file_mnemonic in ('IHTEMT'); + + + +update fw_ods.fw_ods b +set platform = a.tractor_platform +from transactional.test_instance_tractor_info a +where +b.platform is null and +b.test_file_id = a.file_syspk +and a.file_syspk = __file_syspk +and test_file_mnemonic = a.file_mnemonic +and a.file_mnemonic like 'IHT%'; + + + end if; + end loop; + + + + +perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'ods', 'fn_fw_ods_detailed_load', err_state, err_msg, err_detail, err_hint, err_context,'success'); + + + + + +EXCEPTION when OTHERS then + + err_state = returned_sqlstate, /* P0002 */ + err_msg = message_text, /* No Data in FTDRY */ + err_detail = pg_exception_detail, /* No data in table t_test_new */ + err_hint = pg_exception_hint, /* No data error capture */ + err_context = pg_exception_context; /* PL/pgSQL function staging2.fn_ftdry_trs_block(integer,integer,text,text,integer) line 69 at RAISE*/ + + +perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'ods', 'fn_fw_ods_detailed_load', err_state, err_msg, err_detail, err_hint, err_context,'error'); + + + + + +end +$$ +LANGUAGE plpgsql; + diff --git a/onetime/dataloadfunctions/ODS_Load/fn_fw_ods_drawbar_load.sql b/onetime/dataloadfunctions/ODS_Load/fn_fw_ods_drawbar_load.sql new file mode 100755 index 0000000..8e79a8a --- /dev/null +++ b/onetime/dataloadfunctions/ODS_Load/fn_fw_ods_drawbar_load.sql @@ -0,0 +1,175 @@ +CREATE OR REPLACE FUNCTION fw_ods.fn_fw_ods_drawbar_load(p_client_id int,p_function_id int, p_file_mnemonic text, +p_file_sheet_mnemonic text, p_file_syspk int) + RETURNS void +AS $$ + declare + f record; + + declare __client_id int :=p_client_id; + declare __function_id int :=p_function_id; + declare __file_mnemonic text :=p_file_mnemonic; + declare __file_sheet_mnemonic text :=p_file_sheet_mnemonic; + declare __file_syspk int :=p_file_syspk; + declare err_state text; + declare err_msg text; + declare err_detail text; + declare err_hint text; + declare err_context text; + declare _error int; + +begin +-- Adding data to file fw_ods_field: +for f in select distinct file_mnemonic from fw_core.fw_jobctl_file_runschedule + where latest_runschedule_flag = '1' and end_status = 'success' and end_status_note = 'TRX_completed' and file_mnemonic = 'DBSTD' + +loop + +insert into fw_ods.fw_ods( +client_id, +function_id, +test_file_mnemonic, +test_sheet_mnemonic, +test_file_id, +test_file_name, +test_instance_id, +test_name, +-- File Identifier +tractor_make, +tractor_model, +tractor_engine_hp, +wheel_drive_type , +"configuration", +test_instance_tractor_id, +-- Tractor Identifier tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id +test_date, +test_date_year, +test_date_quarter, +test_date_month, +test_date_dayofmonth, +test_date_dayofweek, +season, +mahindra_model_yn, +test_tractor_yn, +test_condition, +-- test mode, type, subtype, condition hierarchy +location_name, +test_type, +-- location name +tyre_size, +tyre_ply_rating, +tyre_pressure_kg_per_cm2, +engine_speed_var, +gear_used, +fuel_consumption_lit_per_hr, +speed_kmph, +wheel_slippage_pct, +power_kw, +power_hp, +pull_kn, +pull_kgf, +temp_engine_oil_c, +temp_trans_oil_c, +temp_coolant_c, +temp_fuel_in_c, +temp_fuel_out_c, +sfc_g_per_kwh, +specific_energy_kwh_per_ltr +) +select +d.client_id, +d.function_id, +d.file_mnemonic, +d.file_sheet_mnemonic, +d.file_syspk, +d.test_file_name, +d.syspk, +d.test_name, +b.tractor_make, +b.tractor_model, +b.tractor_engine_hp, +b.wheel_drive_type, +b.configuration, +b.syspk, +-- -- test specific date & test dimensions +d.date_of_test, +extract( year from d.date_of_test) , +extract( month from d.date_of_test), +extract( quarter from d.date_of_test), +extract( DAY from d.date_of_test), +date_part('dow',d.date_of_test) dow, +concat(lpad(extract( month from d.date_of_test)::text,2,'0'),'-',(TO_CHAR( + TO_DATE (extract( month from d.date_of_test)::text, 'MM'), 'Month' + ))) AS "Month Name", +'Y', +'Y', +d.test_condition, +d.test_location_name , +d.test_type, +-- test specific dimensions +c.tyre_size, +c.tyre_ply_rating, +c.tyre_pressure_kg_per_cm2, +a.engine_speed_min_1, +-- test specific measures +a.gear_number_and_range, +a.fuel_consumption_l_per_h, +a.travel_speed_km_per_hr, +a.wheel_slip_pct_rear, +a.drawbar_power_kw, +a.drawbar_power_hp, +a.drawbar_pull_kn, +a.drawbar_pull_kgf, +a.temp_engine_oil_c, +a.temp_trans_oil_c, +a.temp_coolant_c, +a.temp_fuel_in_c, +a.temp_fuel_out_c, +a.fuel_consumption_g_per_kwh, +a.fuel_consumption_kwh_per_l +-- add user and timestamp fields +from transactional.drawbar_perf_results_summary a, transactional.test_instance_tractor_info b,transactional.test_instance_tyre_info c,transactional.test_instance d +where a.file_syspk = b.file_syspk +and a.file_syspk = c.file_syspk +and a.file_syspk = d.file_syspk +and a.file_syspk = __file_syspk +and b.tractor_model = a.tractor_model +and d.file_mnemonic in ('DBSTD') and c.tyre_type = 'rear'; + +update fw_ods.fw_ods set test_file_name = file_name from staging1.staging_generic_table a where file_mnemonic = 'DBSTD' and test_file_id = a.file_syspk; +update fw_ods.fw_ods set wheel_drive_type = substring(a.file_name from '%#"_WD#"%' for '#') from staging1.staging_generic_table a where file_mnemonic = 'DBSTD' and test_file_id = a.file_syspk; +UPDATE fw_ods.fw_ods set test_mode = CASE WHEN a.file_name like '%Normal%' THEN 'Normal' + WHEN a.file_name like '%Eco%' THEN 'Eco' + WHEN a.file_name like '%Boost%' THEN 'Boost' + ELSE NULL + END +FROM staging1.staging_generic_table a where file_mnemonic = 'DBSTD' and test_file_id = a.file_syspk; + + + end loop; + + + + +perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'ods', 'fn_fw_ods_drawbar_load', err_state, err_msg, err_detail, err_hint, err_context,'success'); + + + + + +EXCEPTION when OTHERS then + + err_state = returned_sqlstate, /* P0002 */ + err_msg = message_text, /* No Data in FTDRY */ + err_detail = pg_exception_detail, /* No data in table t_test_new */ + err_hint = pg_exception_hint, /* No data error capture */ + err_context = pg_exception_context; /* PL/pgSQL function staging2.fn_ftdry_trs_block(integer,integer,text,text,integer) line 69 at RAISE*/ + + +perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'ods', 'fn_fw_ods_drawbar_load', err_state, err_msg, err_detail, err_hint, err_context,'error'); + + + + +end +$$ +LANGUAGE plpgsql; diff --git a/onetime/dataloadfunctions/ODS_Load/fn_fw_ods_drawbar_performance_load.sql b/onetime/dataloadfunctions/ODS_Load/fn_fw_ods_drawbar_performance_load.sql new file mode 100755 index 0000000..066110b --- /dev/null +++ b/onetime/dataloadfunctions/ODS_Load/fn_fw_ods_drawbar_performance_load.sql @@ -0,0 +1,190 @@ +CREATE OR REPLACE FUNCTION fw_ods.fn_fw_ods_drawbar_performance_load(p_client_id int,p_function_id int, p_file_mnemonic text, +p_file_sheet_mnemonic text, p_file_syspk int) + RETURNS void +AS $$ + declare + f record; + + declare __client_id int :=p_client_id; + declare __function_id int :=p_function_id; + declare __file_mnemonic text :=p_file_mnemonic; + declare __file_sheet_mnemonic text :=p_file_sheet_mnemonic; + declare __file_syspk int :=p_file_syspk; + declare err_state text; + declare err_msg text; + declare err_detail text; + declare err_hint text; + declare err_context text; + declare _error int; + +begin +-- Adding data to file fw_ods_field: +for f in select distinct file_mnemonic from fw_core.fw_jobctl_file_runschedule + where latest_runschedule_flag = '1' and end_status = 'success' and end_status_note = 'TRX_completed' +loop +if f.file_mnemonic = 'DBSTD' +then +insert into fw_ods.fw_ods_drawbar_performance ( + client_id, + function_id, + test_file_mnemonic, + test_sheet_mnemonic, + test_file_id, + test_file_name, + test_instance_id, + test_name, + -- File Identifier + tractor_make, + tractor_model, + tractor_engine_hp, + wheel_drive_type , + "configuration", + test_instance_tractor_id, + -- Tractor Identifier tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id + test_date, + test_date_year, + test_date_quarter, + test_date_month, + test_date_dayofmonth, + test_date_dayofweek, + season, + mahindra_model_yn, + test_tractor_yn, + summary_yn, + test_condition, + test_type, + --subtype, condition hierarchy + location_name, + -- location name + tyre_size, + tyre_ply_rating, + tyre_pressure_kg_per_cm2, + engine_speed_var, + gear_used, + fuel_consumption_lit_per_hr, + speed_kmph, + wheel_slippage_pct_front, + wheel_slippage_pct, + power_kw, + power_hp, + pull_kn, + pull_kgf, + temp_engine_oil_c, + temp_trans_oil_c, + temp_coolant_c, + temp_fuel_in_c, + temp_fuel_out_c, + sfc_g_per_kwh, + specific_energy_kwh_per_ltr, + fan_speed_rpm_var, + no_of_load_lugs_front, + fuel_consumption_kg_per_kwh, + atm_rh_pct, + atm_temp_c, + atm_pressure_kpa + ) + select + d.client_id, + d.function_id, + d.file_mnemonic, + d.file_sheet_mnemonic, + d.file_syspk, + d.test_file_name, + d.syspk, + d.test_name, + b.tractor_make, + b.tractor_model, + b.tractor_engine_hp, + b.wheel_drive_type, + b.configuration, + b.syspk, + -- -- test specific date & test dimensions + d.date_of_test, + extract( year from d.date_of_test) , + extract( month from d.date_of_test), + extract( quarter from d.date_of_test), + extract( DAY from d.date_of_test), + date_part('dow',d.date_of_test) dow, + concat(lpad(extract( month from d.date_of_test)::text,2,'0'),'-',(TO_CHAR( + TO_DATE (extract( month from d.date_of_test)::text, 'MM'), 'Month' + ))) AS "Month Name", + 'Y', + 'Y', + 'N', + d.test_condition, + d.test_type, + d.test_location_name , + -- test specific dimensions + c.tyre_size, + c.tyre_ply_rating, + c.tyre_pressure_kg_per_cm2, + a.engine_speed_min_1, + -- test specific measures + a.gear_number_and_range, + a.fuel_consumption_l_per_h, + a.travel_speed_km_per_hr, + a.wheel_slip_pct_front, + a.wheel_slip_pct_rear, + a.drawbar_power_kw, + a.drawbar_power_hp, + a.drawbar_pull_kn, + a.drawbar_pull_kgf, + a.temp_engine_oil_c, + a.temp_trans_oil_c, + a.temp_coolant_c, + a.temp_fuel_in_c, + a.temp_fuel_out_c, + a.fuel_consumption_g_per_kwh, + a.fuel_consumption_kwh_per_l , + a.fan_speed_min_1, + a.no_of_load_lugs_front, + a.fuel_consumption_kg_per_kwh, + atm_conditions_rh_pct, + atm_conditions_temp_c, + atm_conditions_pressure_kpa + -- add user and timestamp fields + from transactional.drawbar_perf_results a, transactional.test_instance_tractor_info b , transactional.test_instance_tyre_info c, transactional.test_instance d + where a.file_syspk = b.file_syspk + and a.file_syspk = c.file_syspk + and a.file_syspk = d.file_syspk + and a.file_syspk = __file_syspk + and b.tractor_model = a.tractor_model + and d.file_mnemonic in ('DBSTD') and c.tyre_type = 'rear'; + END IF; + update fw_ods.fw_ods_drawbar_performance set test_file_name = file_name from staging1.staging_generic_table a where file_mnemonic = 'DBSTD' and test_file_id = a.file_syspk; + update fw_ods.fw_ods_drawbar_performance set wheel_drive_type = substring(a.tractor_model from '%#"_WD#"%' for '#') from fw_ods.fw_ods_drawbar_performance a where fw_ods.fw_ods_drawbar_performance.test_file_mnemonic = 'DBSTD' and fw_ods.fw_ods_drawbar_performance.test_file_id = a.test_file_id; + update fw_ods.fw_ods_drawbar_performance set test_mode = CASE WHEN a.file_name like '%Normal%' THEN 'Normal' + WHEN a.file_name like '%Eco%' THEN 'Eco' + WHEN a.file_name like '%Boost%' THEN 'Boost' + ELSE NULL + END + FROM staging1.staging_generic_table a where file_mnemonic = 'DBSTD' and test_file_id = a.file_syspk; + + end loop; + + + + +perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'ods', 'fn_fw_ods_drawbar_performance_load', err_state, err_msg, err_detail, err_hint, err_context,'success'); + + + + + +EXCEPTION when OTHERS then + + err_state = returned_sqlstate, /* P0002 */ + err_msg = message_text, /* No Data in FTDRY */ + err_detail = pg_exception_detail, /* No data in table t_test_new */ + err_hint = pg_exception_hint, /* No data error capture */ + err_context = pg_exception_context; /* PL/pgSQL function staging2.fn_ftdry_trs_block(integer,integer,text,text,integer) line 69 at RAISE*/ + + +perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'ods', 'fn_fw_ods_drawbar_performance_load', err_state, err_msg, err_detail, err_hint, err_context,'error'); + + + + +end +$$ +LANGUAGE plpgsql; diff --git a/onetime/dataloadfunctions/ODS_Load/fn_fw_ods_field_load.sql b/onetime/dataloadfunctions/ODS_Load/fn_fw_ods_field_load.sql new file mode 100755 index 0000000..14f82a8 --- /dev/null +++ b/onetime/dataloadfunctions/ODS_Load/fn_fw_ods_field_load.sql @@ -0,0 +1,483 @@ + +CREATE OR REPLACE FUNCTION fw_ods.fn_fw_ods_field_load(p_client_id int,p_function_id int, p_file_mnemonic text, +p_file_sheet_mnemonic text, p_file_syspk int) + RETURNS void +AS $$ + declare + f record; + + declare __client_id int :=p_client_id; + declare __function_id int :=p_function_id; + declare __file_mnemonic text :=p_file_mnemonic; + declare __file_sheet_mnemonic text :=p_file_sheet_mnemonic; + declare __file_syspk int :=p_file_syspk; + declare err_state text; + declare err_msg text; + declare err_detail text; + declare err_hint text; + declare err_context text; + declare _error int; + +begin +-- Adding data to file fw_ods_field: +for f in select distinct file_mnemonic from fw_core.fw_jobctl_file_runschedule + where latest_runschedule_flag = '1' and end_status = 'success' and end_status_note = 'TRX_completed' +loop +if f.file_mnemonic = 'FTDRY' +then + insert into fw_ods.fw_ods + ( + -- File Identifier: Test_Mnemonic, Sheet_Mnemonic, file_syspk(id), test_instance_id, test_file_name, + client_id, + function_id, + test_file_mnemonic, + test_sheet_mnemonic, + test_name, + test_file_id, + test_file_name, + test_instance_id, + test_iteration_number, + -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id + tractor_make, + tractor_model, + mahindra_model_yn, + test_tractor_yn, + tractor_engine_hp, + wheel_drive_type, + "configuration", + test_instance_tractor_id, + -- Test Season: + season, + --test specific: date & test dimensions + test_date, + test_date_year, + test_date_quarter, + test_date_month, + test_date_dayofmonth, + test_date_dayofweek, + --test specific: condition + test_condition, + --test specific: location + location_name, + test_type, + ----test specific: Implement details(name, type and Weight_kg) + name_of_implement, + type_of_implement, + implement_weight_kg, + -- test specific measures: Speed and gear + engine_speed_var, + gear_used, + -- test specific measures: fuel, area, speed,wheel-slip, productivity,rpm and depth-of-operation + fuel_consumption_lit_per_hr, + fuel_consumption_lit_per_acr, + area_covered_acr_per_hr, + speed_kmph, + wheel_slippage_pct, + field_efficiency_pct, + erpmdrop_straight_1stpass_low, + erpmdrop_straight_1stpass_high, + depth_of_cut_cm_low, + depth_of_cut_cm_high, + created_by, + updated_by, + create_timestamp, + update_timestamp + ) + select + -- File Identifier: Test_Mnemonic, Sheet_Mnemonic, file_syspk(id), test_instance_id, test_file_name, + a.client_id, + a.function_id, + a.file_mnemonic, + a.file_sheet_mnemonic, + a.test_name, + a.file_syspk, + a.test_file_name, + a.syspk, + c.test_iteration_number, + -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id + b.tractor_make, + b.tractor_model, + b.mahindra_model_yn, + b.test_tractor_yn, + b.tractor_engine_hp, + b.wheel_drive_type, + b.configuration, + b.syspk, + -- Test Season: + concat(lpad(extract( month from a.date_of_test)::text,2,'0'),'-',a.season) AS "Month Name", + --test specific: date & test dimensions + a.date_of_test, + extract( year from a.date_of_test), + extract( quarter from a.date_of_test), + extract( month from a.date_of_test), + extract( day from a.date_of_test), + extract( dow from a.date_of_test), + --test specific: condition + c.test_condition, + --test specific: location + a.test_location_name, + a.test_type, + ----test specific: Implement details(name, type and Weight_kg) + d.name_of_implement, + d.Type_of_implement, + d.implement_weight_kg, + -- test specific measures: Speed and gear + c.engine_rpm_set, + c.gear_used, + -- test specific measures: fuel, area, speed,wheel-slip, productivity,rpm and depth-of-operation + c.fuel_consumption_lit_per_hr, + c.fuel_consumption_lit_per_acr, + c.area_covered_acr_per_hr, + c.on_load_speed_kmph, + c.wheel_slippage_pct, + ---- test specific measures: effeciency + null, + ---- test specific measures: productivity,rpm and depth-of-operation + c.erpmdrop_straight_1stpass_low, + c.erpmdrop_straight_1stpass_high, + c.depth_of_cut_cm_low , + c.depth_of_cut_cm_high, + current_user, + current_user, + current_timestamp, + current_timestamp + -- add user and timestamp fields + from + transactional.test_instance a, + transactional.test_instance_tractor_info b, + transactional.field_perf_summary c, + transactional.test_instance_implement_info d + where + a.file_syspk = b.file_syspk + and b.file_syspk = c.file_syspk + and c.file_syspk = d.file_syspk + and c.tractor_model = b.tractor_model + and a.file_mnemonic = f.file_mnemonic + and a.file_syspk = __file_syspk; + +elsif f.file_mnemonic = 'FTWET' +then + insert into fw_ods.fw_ods + ( + -- File Identifier: Test_Mnemonic, Sheet_Mnemonic, file_syspk(id), test_instance_id, test_file_name, + client_id, + function_id, + test_file_mnemonic, + test_sheet_mnemonic, + test_name, + test_file_id, + test_file_name, + test_instance_id, + test_iteration_number, + -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id + tractor_make, + tractor_model, + mahindra_model_yn, + test_tractor_yn, + tractor_engine_hp, + wheel_drive_type, + "configuration", + test_instance_tractor_id, + -- Test Season: + season, + --test specific: date & test dimensions + test_date, + test_date_year, + test_date_quarter, + test_date_month, + test_date_dayofmonth, + test_date_dayofweek, + --test specific: condition + test_condition, + --test specific: location + location_name, + test_type, + ----test specific: Implement details(name, type and Weight_kg) + name_of_implement, + type_of_implement, + implement_weight_kg, + -- test specific measures: Speed and gear + engine_speed_var, + gear_used, + -- test specific measures: fuel, area, speed,wheel-slip, productivity,rpm and depth-of-operation + fuel_consumption_lit_per_hr, + fuel_consumption_lit_per_acr, + area_covered_acr_per_hr, + speed_kmph, + speed_pto_rpm, + wheel_slippage_pct, + no_of_passes, + field_efficiency_pct, + erpmdrop_straight_1stpass_low, + erpmdrop_straight_1stpass_high, + erpmdrop_straight_2ndpass_low, + erpmdrop_straight_2ndpass_high, + erpmdrop_straight_3rdpass_low, + erpmdrop_straight_3rdpass_high, + erpmdrop_turn_1stpass_low, + erpmdrop_turn_1stpass_high, + erpmdrop_turn_2ndpass_low, + erpmdrop_turn_2ndpass_high, + erpmdrop_turn_3rdpass_low, + erpmdrop_turn_3rdpass_high, + depth_of_cut_cm_low, + depth_of_cut_cm_high, + created_by, + updated_by, + create_timestamp, + update_timestamp + --created_by, updated_by, create_timestamp, update_timestamp + ) + select + -- File Identifier: Test_Mnemonic, Sheet_Mnemonic, file_syspk(id), test_instance_id, test_file_name, + a.client_id, + a.function_id, + a.file_mnemonic, + a.file_sheet_mnemonic, + a.test_name, + a.file_syspk, + a.test_file_name, + a.syspk, + c.test_iteration_number, + -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id + b.tractor_make, + b.tractor_model, + b.mahindra_model_yn, + b.test_tractor_yn, + b.tractor_engine_hp, + b.wheel_drive_type, + b.configuration, + b.syspk, + -- Test Season: + concat(lpad(extract( month from a.date_of_test)::text,2,'0'),'-',a.season) AS "Month Name", + --test specific: date & test dimensions + a.date_of_test, + extract( year from a.date_of_test), + extract( quarter from a.date_of_test), + extract( month from a.date_of_test), + extract( day from a.date_of_test), + extract( dow from a.date_of_test), + --test specific: condition + c.test_condition, + --test specific: location + a.test_location_name, + a.test_type, + ----test specific: Implement details(name, type and Weight_kg) + d.name_of_implement, + d.Type_of_implement, + d.implement_weight_kg, + -- test specific measures: Speed and gear + c.engine_rpm_set, + c.gear_used, + -- test specific measures: fuel, area, speed,wheel-slip, productivity,rpm and depth-of-operation + c.fuel_consumption_lit_per_hr, + c.fuel_consumption_lit_per_acr, + c.area_covered_acr_per_hr, + c.nominal_speed_kmph, + c.pto_rpm_set, + c.wheel_slippage_pct, + c.no_of_passes, + ---- test specific measures: effeciency + null, + ---- test specific measures: productivity,rpm and depth-of-operation + c.erpmdrop_straight_1stpass_low, + c.erpmdrop_straight_1stpass_high, + c.erpmdrop_straight_2ndpass_low, + c.erpmdrop_straight_2ndpass_high, + c.erpmdrop_straight_3rdpass_low, + c.erpmdrop_straight_3rdpass_high, + c.erpmdrop_turn_1stpass_low, + c.erpmdrop_turn_1stpass_high, + c.erpmdrop_turn_2ndpass_low, + c.erpmdrop_turn_2ndpass_high, + c.erpmdrop_turn_3rdpass_low, + c.erpmdrop_turn_3rdpass_high, + c.depth_of_cut_cm_low , + c.depth_of_cut_cm_high, + current_user, + current_user, + current_timestamp, + current_timestamp + + -- add user and timestamp fields + from + transactional.test_instance a, + transactional.test_instance_tractor_info b, + transactional.field_perf_summary c, + transactional.test_instance_implement_info d + where + a.file_syspk = b.file_syspk + and b.file_syspk = c.file_syspk + and c.file_syspk = d.file_syspk + and c.tractor_model = b.tractor_model + and a.file_mnemonic = f.file_mnemonic + and a.file_syspk = __file_syspk; + + +elsif f.file_mnemonic = 'FTHLG' +then + insert into fw_ods.fw_ods + ( + -- File Identifier: Test_Mnemonic, Sheet_Mnemonic, file_syspk(id), test_instance_id, test_file_name, + client_id, + function_id, + test_file_mnemonic, + test_sheet_mnemonic, + test_name, + test_file_id, + test_file_name, + test_instance_id, + -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id + tractor_make, + tractor_model, + mahindra_model_yn, + test_tractor_yn, + tractor_engine_hp, + wheel_drive_type, + "configuration", + test_instance_tractor_id, + --test specific: date & test dimensions + test_date, + test_date_year, + test_date_quarter, + test_date_month, + test_date_dayofmonth, + test_date_dayofweek, + season, + --test specific: condition + test_condition, + test_iteration_number, + --test specific: location + location_name, + test_type, + ----test specific: Implement details(name, type and Weight_kg) + name_of_implement, + type_of_implement, + implement_weight_kg, + -- test specific measures: Speed and gear + -- test specific measures: fuel, area, speed,wheel-slip, productivity,rpm and depth-of-operation + fuel_consumption_lit_per_hr, + gear_used, + gear_used_up_slope_1, + gear_used_up_slope_2, + gear_used_down_slope, + speed_kmph, + mileage_kmpl, + total_dist_travelled_km, + erpmdrop_straight_1stpass_low, + erpmdrop_straight_1stpass_high, + erpmdrop_turn_1stpass_low, + erpmdrop_turn_1stpass_high, + erpmdrop_turn_2ndpass_low, + erpmdrop_turn_2ndpass_high, + erpmdrop_turn_3rdpass_low, + erpmdrop_turn_3rdpass_high, + created_by, + updated_by, + create_timestamp, + update_timestamp + --created_by, updated_by, create_timestamp, update_timestamp + ) + select + -- File Identifier: Test_Mnemonic, Sheet_Mnemonic, file_syspk(id), test_instance_id, test_file_name, + a.client_id, + a.function_id, + a.file_mnemonic, + a.file_sheet_mnemonic, + a.test_name, + a.file_syspk, + a.test_file_name, + a.syspk, + -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id + b.tractor_make, + b.tractor_model, + b.mahindra_model_yn, + b.test_tractor_yn, + b.tractor_engine_hp, + b.wheel_drive_type, + b.configuration, + b.syspk, + --test specific: date & test dimensions + a.date_of_test, + extract( year from a.date_of_test), + extract( quarter from a.date_of_test), + extract( month from a.date_of_test), + extract( day from a.date_of_test), + extract( dow from a.date_of_test), + concat(lpad(extract( month from a.date_of_test)::text,2,'0'),'-',(TO_CHAR( + TO_DATE (extract( month from a.date_of_test)::text, 'MM'), 'Month' + ))) AS "Month Name", + --test specific: condition + c.test_condition, + c.test_iteration_number, + --test specific: location + a.test_location_name, + a.test_type, + ----test specific: Implement details(name, type and Weight_kg) + 'Trailer', + d.trailer_type, + d.trailer_gross_weight_kg, + -- test specific measures: Speed and gear + -- test specific measures: fuel, area, speed,wheel-slip, productivity,rpm and depth-of-operation + c.fuel_consumption_lit_per_hr, + c. gear_used_on_straight_road, + c.gear_used_on_up_slope_1, + c.gear_used_on_up_slope_2, + c.gear_used_on_down_slope, + c.avg_speed_of_travel_kmph, + c.Mileage_Km_per_Ltr, + c.total_dist_travelled_km, + c.erpmdrop_straight_1stpass_low, + c.erpmdrop_straight_1stpass_high, + c.erpmdrop_turn_1stpass_low, + c.erpmdrop_turn_1stpass_high, + c.erpmdrop_turn_2ndpass_low, + c.erpmdrop_turn_2ndpass_high, + c.erpmdrop_turn_3rdpass_low, + c.erpmdrop_turn_3rdpass_high, + current_user, + current_user, + current_timestamp, + current_timestamp + -- add user and timestamp fields + from + transactional.test_instance a, + transactional.test_instance_tractor_info b, + transactional.field_perf_summary c, + transactional.field_perf_summary_trailer_info d + where + a.file_syspk = b.file_syspk + and b.file_syspk = c.file_syspk + and c.file_syspk = d.file_syspk + and c.tractor_model = b.tractor_model + and a.file_mnemonic = f.file_mnemonic + and a.file_syspk = __file_syspk; + end if; + end loop; + + + +perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'ods', 'fn_fw_ods_field_load', err_state, err_msg, err_detail, err_hint, err_context,'success'); + + + + + +EXCEPTION when OTHERS then + + err_state = returned_sqlstate, /* P0002 */ + err_msg = message_text, /* No Data in FTDRY */ + err_detail = pg_exception_detail, /* No data in table t_test_new */ + err_hint = pg_exception_hint, /* No data error capture */ + err_context = pg_exception_context; /* PL/pgSQL function staging2.fn_ftdry_trs_block(integer,integer,text,text,integer) line 69 at RAISE*/ + + +perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'ods', 'fn_fw_ods_field_load', err_state, err_msg, err_detail, err_hint, err_context,'error'); + + + + + +end +$$ +LANGUAGE plpgsql; \ No newline at end of file diff --git a/onetime/dataloadfunctions/ODS_Load/fn_fw_ods_load.sql b/onetime/dataloadfunctions/ODS_Load/fn_fw_ods_iht_load.sql similarity index 54% rename from onetime/dataloadfunctions/ODS_Load/fn_fw_ods_load.sql rename to onetime/dataloadfunctions/ODS_Load/fn_fw_ods_iht_load.sql index 873cb7f..3089509 100755 --- a/onetime/dataloadfunctions/ODS_Load/fn_fw_ods_load.sql +++ b/onetime/dataloadfunctions/ODS_Load/fn_fw_ods_iht_load.sql @@ -1,470 +1,66 @@ ---drop function if exists fw_ods.fn_fw_ods_load(); +CREATE OR REPLACE FUNCTION fw_ods.fn_fw_ods_IHT_load(p_client_id int,p_function_id int, p_file_mnemonic text, +p_file_sheet_mnemonic text, p_file_syspk int) + RETURNS void +AS $$ + declare + f record; + + declare __client_id int :=p_client_id; + declare __function_id int :=p_function_id; + declare __file_mnemonic text :=p_file_mnemonic; + declare __file_sheet_mnemonic text :=p_file_sheet_mnemonic; + declare __file_syspk int :=p_file_syspk; + declare err_state text; + declare err_msg text; + declare err_detail text; + declare err_hint text; + declare err_context text; + declare _error int; -CREATE OR REPLACE FUNCTION fw_ods.fn_fw_ods_load(p_client_id int,p_function_id int,p_job_id int,p_step_id int) - RETURNS void AS $$ -declare - f record; begin -- Adding data to file fw_ods_field: - -for f in select distinct file_syspk, file_mnemonic from fw_core.fw_jobctl_file_runschedule +for f in select distinct file_mnemonic from fw_core.fw_jobctl_file_runschedule where latest_runschedule_flag = '1' and end_status = 'success' and end_status_note = 'TRX_completed' loop - -if f.file_mnemonic = 'FTDRY' +if f.file_mnemonic like 'IHT%' then - insert into fw_ods.fw_ods - ( + insert into fw_ods.fw_ods( -- File Identifier: Test_Mnemonic, Sheet_Mnemonic, file_syspk(id), test_instance_id, test_file_name, client_id, function_id, test_file_mnemonic, test_sheet_mnemonic, + test_name, test_file_id, test_file_name, test_instance_id, - test_iteration_number, - -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id + -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,""""configuration"""",Test insance tractor id tractor_make, tractor_model, mahindra_model_yn, test_tractor_yn, tractor_engine_hp, wheel_drive_type, - configuration, + "configuration", + platform, test_instance_tractor_id, - -- Test Season: + --test specific: date & test dimensions + test_date, + test_date_year, + test_date_quarter, + test_date_month, + test_date_dayofmonth, + test_date_dayofweek, season, - --test specific: date & test dimensions - test_date, - test_date_year, - test_date_quarter, - test_date_month, - test_date_dayofmonth, - test_date_dayofweek, - --test specific: condition - test_condition, - --test specific: location - location_name, - ----test specific: Implement details(name, type and Weight_kg) - name_of_implement, - type_of_implement, - implement_weight_kg, - -- test specific measures: Speed and gear - engine_speed_var, - gear_used, - -- test specific measures: fuel, area, speed,wheel-slip, productivity,rpm and depth-of-operation - fuel_consumption_lit_per_hr, - fuel_consumption_lit_per_acr, - area_covered_acr_per_hr, - speed_kmph, - wheel_slippage_pct, - field_efficiency_pct, - productivity, - erpmdrop_straight_1stpass_low, - erpmdrop_straight_1stpass_high, - depth_of_cut_cm_low, - depth_of_cut_cm_high, - created_by, - updated_by, - create_timestamp, - update_timestamp - ) - select - -- File Identifier: Test_Mnemonic, Sheet_Mnemonic, file_syspk(id), test_instance_id, test_file_name, - a.client_id, - a.function_id, - a.file_mnemonic, - a.file_sheet_mnemonic, - a.file_syspk, - a.test_file_name, - a.syspk, - c.test_iteration_number, - -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id - b.tractor_make, - b.tractor_model, - b.mahindra_model_yn, - b.test_tractor_yn, - b.tractor_engine_hp, - b.wheel_drive_type, - b.configuration, - b.syspk, - -- Test Season: - a.season, - --test specific: date & test dimensions - a.date_of_test, - extract( year from a.date_of_test), - extract( quarter from a.date_of_test), - extract( month from a.date_of_test), - extract( day from a.date_of_test), - extract( dow from a.date_of_test), - --test specific: condition - c.test_condition, - --test specific: location - a.test_location_name, - ----test specific: Implement details(name, type and Weight_kg) - d.name_of_implement, - d.Type_of_implement, - d.implement_weight_kg, - -- test specific measures: Speed and gear - c.engine_rpm_set, - c.gear_used, - -- test specific measures: fuel, area, speed,wheel-slip, productivity,rpm and depth-of-operation - c.fuel_consumption_lit_per_hr, - c.fuel_consumption_lit_per_acr, - c.area_covered_acr_per_hr, - c.on_load_speed_kmph, - c.wheel_slippage_pct, - ---- test specific measures: effeciency - null, - ---- test specific measures: productivity,rpm and depth-of-operation - (c.fuel_consumption_lit_per_hr/c.area_covered_acr_per_hr), - c.erpmdrop_straight_1stpass_low, - c.erpmdrop_straight_1stpass_high, - c.depth_of_cut_cm_low , - c.depth_of_cut_cm_high, - current_user, - current_user, - current_timestamp, - current_timestamp - -- add user and timestamp fields - from - transactional.test_instance a, - transactional.test_instance_tractor_info b, - transactional.field_perf_summary c, - transactional.test_instance_implement_info d - where - a.file_syspk = b.file_syspk - and b.file_syspk = c.file_syspk - and c.file_syspk = d.file_syspk - and c.tractor_model = b.tractor_model - and a.file_mnemonic = f.file_mnemonic - and a.file_syspk = f.file_syspk; - -elsif f.file_mnemonic = 'FTWET' -then - insert into fw_ods.fw_ods - ( - -- File Identifier: Test_Mnemonic, Sheet_Mnemonic, file_syspk(id), test_instance_id, test_file_name, - client_id, - function_id, - test_file_mnemonic, - test_sheet_mnemonic, - test_file_id, - test_file_name, - test_instance_id, - test_iteration_number, - -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id - tractor_make, - tractor_model, - mahindra_model_yn, - test_tractor_yn, - tractor_engine_hp, - wheel_drive_type, - configuration, - test_instance_tractor_id, - -- Test Season: - season, - --test specific: date & test dimensions - test_date, - test_date_year, - test_date_quarter, - test_date_month, - test_date_dayofmonth, - test_date_dayofweek, - --test specific: condition - test_condition, - --test specific: location - location_name, - ----test specific: Implement details(name, type and Weight_kg) - name_of_implement, - type_of_implement, - implement_weight_kg, - -- test specific measures: Speed and gear - engine_speed_var, - gear_used, - -- test specific measures: fuel, area, speed,wheel-slip, productivity,rpm and depth-of-operation - fuel_consumption_lit_per_hr, - fuel_consumption_lit_per_acr, - area_covered_acr_per_hr, - speed_kmph, - speed_pto_rpm, - wheel_slippage_pct, - no_of_passes, - field_efficiency_pct, - productivity, - erpmdrop_straight_1stpass_low, - erpmdrop_straight_1stpass_high, - erpmdrop_straight_2ndpass_low, - erpmdrop_straight_2ndpass_high, - erpmdrop_straight_3rdpass_low, - erpmdrop_straight_3rdpass_high, - erpmdrop_turn_1stpass_low, - erpmdrop_turn_1stpass_high, - erpmdrop_turn_2ndpass_low, - erpmdrop_turn_2ndpass_high, - erpmdrop_turn_3rdpass_low, - erpmdrop_turn_3rdpass_high, - depth_of_cut_cm_low, - depth_of_cut_cm_high, - created_by, - updated_by, - create_timestamp, - update_timestamp - --created_by, updated_by, create_timestamp, update_timestamp - ) - select - -- File Identifier: Test_Mnemonic, Sheet_Mnemonic, file_syspk(id), test_instance_id, test_file_name, - a.client_id, - a.function_id, - a.file_mnemonic, - a.file_sheet_mnemonic, - a.file_syspk, - a.test_file_name, - a.syspk, - c.test_iteration_number, - -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id - b.tractor_make, - b.tractor_model, - b.mahindra_model_yn, - b.test_tractor_yn, - b.tractor_engine_hp, - b.wheel_drive_type, - b.configuration, - b.syspk, - -- Test Season: - a.season, - --test specific: date & test dimensions - a.date_of_test, - extract( year from a.date_of_test), - extract( quarter from a.date_of_test), - extract( month from a.date_of_test), - extract( day from a.date_of_test), - extract( dow from a.date_of_test), - --test specific: condition - c.test_condition, - --test specific: location - a.test_location_name, - ----test specific: Implement details(name, type and Weight_kg) - d.name_of_implement, - d.Type_of_implement, - d.implement_weight_kg, - -- test specific measures: Speed and gear - c.engine_rpm_set, - c.gear_used, - -- test specific measures: fuel, area, speed,wheel-slip, productivity,rpm and depth-of-operation - c.fuel_consumption_lit_per_hr, - c.fuel_consumption_lit_per_acr, - c.area_covered_acr_per_hr, - c.nominal_speed_kmph, - c.pto_rpm_set, - c.wheel_slippage_pct, - c.no_of_passes, - ---- test specific measures: effeciency - null, - ---- test specific measures: productivity,rpm and depth-of-operation - c.fuel_consumption_lit_per_hr/area_covered_acr_per_hr, - c.erpmdrop_straight_1stpass_low, - c.erpmdrop_straight_1stpass_high, - c.erpmdrop_straight_2ndpass_low, - c.erpmdrop_straight_2ndpass_high, - c.erpmdrop_straight_3rdpass_low, - c.erpmdrop_straight_3rdpass_high, - c.erpmdrop_turn_1stpass_low, - c.erpmdrop_turn_1stpass_high, - c.erpmdrop_turn_2ndpass_low, - c.erpmdrop_turn_2ndpass_high, - c.erpmdrop_turn_3rdpass_low, - c.erpmdrop_turn_3rdpass_high, - c.depth_of_cut_cm_low , - c.depth_of_cut_cm_high, - current_user, - current_user, - current_timestamp, - current_timestamp - - -- add user and timestamp fields - from - transactional.test_instance a, - transactional.test_instance_tractor_info b, - transactional.field_perf_summary c, - transactional.test_instance_implement_info d - where - a.file_syspk = b.file_syspk - and b.file_syspk = c.file_syspk - and c.file_syspk = d.file_syspk - and c.tractor_model = b.tractor_model - and a.file_mnemonic = f.file_mnemonic - and a.file_syspk = f.file_syspk; - - -elsif f.file_mnemonic = 'FTHLG' -then - insert into fw_ods.fw_ods - ( - -- File Identifier: Test_Mnemonic, Sheet_Mnemonic, file_syspk(id), test_instance_id, test_file_name, - client_id, - function_id, - test_file_mnemonic, - test_sheet_mnemonic, - test_file_id, - test_file_name, - test_instance_id, - -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id - tractor_make, - tractor_model, - mahindra_model_yn, - test_tractor_yn, - tractor_engine_hp, - wheel_drive_type, - configuration, - test_instance_tractor_id, - --test specific: date & test dimensions - test_date, - test_date_year, - test_date_quarter, - test_date_month, - test_date_dayofmonth, - test_date_dayofweek, - --test specific: condition - test_condition, - test_iteration_number, - --test specific: location - location_name, - ----test specific: Implement details(name, type and Weight_kg) - name_of_implement, - type_of_implement, - implement_weight_kg, - -- test specific measures: Speed and gear - -- test specific measures: fuel, area, speed,wheel-slip, productivity,rpm and depth-of-operation - fuel_consumption_lit_per_hr, - gear_used, - gear_user_up_slope_1, - gear_user_up_slope_2, - gear_user_down_slope, - speed_kmph, - mileage_kmpl, - total_dist_travelled_km, - erpmdrop_straight_1stpass_low, - erpmdrop_straight_1stpass_high, - erpmdrop_turn_1stpass_low, - erpmdrop_turn_1stpass_high, - erpmdrop_turn_2ndpass_low, - erpmdrop_turn_2ndpass_high, - erpmdrop_turn_3rdpass_low, - erpmdrop_turn_3rdpass_high, - created_by, - updated_by, - create_timestamp, - update_timestamp - --created_by, updated_by, create_timestamp, update_timestamp - ) - select - -- File Identifier: Test_Mnemonic, Sheet_Mnemonic, file_syspk(id), test_instance_id, test_file_name, - a.client_id, - a.function_id, - a.file_mnemonic, - a.file_sheet_mnemonic, - a.file_syspk, - a.test_file_name, - a.syspk, - -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id - b.tractor_make, - b.tractor_model, - b.mahindra_model_yn, - b.test_tractor_yn, - b.tractor_engine_hp, - b.wheel_drive_type, - b.configuration, - b.syspk, - --test specific: date & test dimensions - a.date_of_test, - extract( year from a.date_of_test), - extract( quarter from a.date_of_test), - extract( month from a.date_of_test), - extract( day from a.date_of_test), - extract( dow from a.date_of_test), - --test specific: condition - c.test_condition, - c.test_iteration_number, - --test specific: location - a.test_location_name, - ----test specific: Implement details(name, type and Weight_kg) - 'Trailer', - d.trailer_type, - d.trailer_gross_weight_kg, - -- test specific measures: Speed and gear - -- test specific measures: fuel, area, speed,wheel-slip, productivity,rpm and depth-of-operation - c.fuel_consumption_lit_per_hr, - c. gear_used_on_straight_road, - c.gear_used_on_up_slope_1, - c.gear_used_on_up_slope_2, - c.gear_used_on_down_slope, - c.avg_speed_of_travel_kmph, - c.Mileage_Km_per_Ltr, - c.total_dist_travelled_km, - c.erpmdrop_straight_1stpass_low, - c.erpmdrop_straight_1stpass_high, - c.erpmdrop_turn_1stpass_low, - c.erpmdrop_turn_1stpass_high, - c.erpmdrop_turn_2ndpass_low, - c.erpmdrop_turn_2ndpass_high, - c.erpmdrop_turn_3rdpass_low, - c.erpmdrop_turn_3rdpass_high, - current_user, - current_user, - current_timestamp, - current_timestamp - -- add user and timestamp fields - from - transactional.test_instance a, - transactional.test_instance_tractor_info b, - transactional.field_perf_summary c, - transactional.field_perf_summary_trailer_info d - where - a.file_syspk = b.file_syspk - and b.file_syspk = c.file_syspk - and c.file_syspk = d.file_syspk - and c.tractor_model = b.tractor_model - and a.file_mnemonic = f.file_mnemonic - and a.file_syspk = f.file_syspk; - - -elsif f.file_mnemonic like 'IHT%' -then - insert into fw_ods.fw_ods( - -- File Identifier: Test_Mnemonic, Sheet_Mnemonic, file_syspk(id), test_instance_id, test_file_name, - client_id, - function_id, - test_file_mnemonic, - test_sheet_mnemonic, - test_file_id, - test_file_name, - test_instance_id, - -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id - tractor_make, - tractor_model, - mahindra_model_yn, - test_tractor_yn, - tractor_engine_hp, - wheel_drive_type, - configuration, - test_instance_tractor_id, - --test specific: date & test dimensions - test_date, - test_date_year, - test_date_quarter, - test_date_month, - test_date_dayofmonth, - test_date_dayofweek, --test specific: location and test purpose test_condition, test_purpose, location_name, + test_type, --Test Specific: engine_rpm_type, - lifting_time_in_secs, - lowering_time_secs, + lifting_time_sec, + lowering_time_sec, created_by, updated_by, create_timestamp, @@ -476,17 +72,19 @@ then a.function_id, a.file_mnemonic, a.file_sheet_mnemonic, + a.test_name, a.file_syspk, a.test_file_name, a.syspk, - -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id + -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,"""configuration""",Test insance tractor id b.tractor_make, b.tractor_model, b.mahindra_model_yn, b.test_tractor_yn, b.tractor_engine_hp, b.wheel_drive_type, - b.configuration, + b."configuration", + b.tractor_platform, b.syspk, --test specific: date & test dimensions a.date_of_test, @@ -495,10 +93,14 @@ then extract( month from a.date_of_test), extract( day from a.date_of_test), extract( dow from a.date_of_test), + concat(lpad(extract( month from a.date_of_test)::text,2,'0'),'-',(TO_CHAR( + TO_DATE (extract( month from a.date_of_test)::text, 'MM'), 'Month' + ))) AS "Month Name", --test specific: location c.TPL_load, a.test_purpose, a.test_location_name, + a.test_type, -- Test Specific: c.engine_rpm_type, c.lifting_time_sec, @@ -515,8 +117,8 @@ then a.file_syspk = b.file_syspk and b.file_syspk = c.file_syspk and c.tractor_model = b.tractor_model - and a.test_file_format in ('IHTHLS') - and a.file_syspk = f.file_syspk; + and a.file_mnemonic in ('IHTHLS') + and a.file_syspk = __file_syspk; -- Insert data to fw_ods_iht: for Noise: insert into fw_ods.fw_ods( @@ -525,17 +127,18 @@ then function_id, test_file_mnemonic, test_sheet_mnemonic, + test_name, test_file_id, test_file_name, test_instance_id, - -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id + -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,""""configuration"""",Test insance tractor id tractor_make, tractor_model, mahindra_model_yn, test_tractor_yn, tractor_engine_hp, wheel_drive_type, - configuration, + "configuration", test_instance_tractor_id, --test specific: date & test dimensions test_date, @@ -544,6 +147,7 @@ then test_date_month, test_date_dayofmonth, test_date_dayofweek, + season, --test specific: location and test purpose test_mode, test_type, @@ -566,17 +170,18 @@ then a.function_id, a.file_mnemonic, a.file_sheet_mnemonic, + a.test_name, a.file_syspk, a.test_file_name, a.syspk, - -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id + -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,""""configuration"""",Test insance tractor id b.tractor_make, b.tractor_model, b.mahindra_model_yn, b.test_tractor_yn, b.tractor_engine_hp, b.wheel_drive_type, - b.configuration, + b."configuration", b.syspk, --test specific: date & test dimensions a.date_of_test, @@ -585,6 +190,9 @@ then extract( month from a.date_of_test), extract( day from a.date_of_test), extract( dow from a.date_of_test), + concat(lpad(extract( month from a.date_of_test)::text,2,'0'),'-',(TO_CHAR( + TO_DATE (extract( month from a.date_of_test)::text, 'MM'), 'Month' + ))) AS "Month Name", --test specific: location c.test_mode, c.test_type, @@ -609,8 +217,8 @@ then a.file_syspk = b.file_syspk and b.file_syspk = c.file_syspk and c.tractor_model = b.tractor_model - and a.test_file_format in ('IHTNST') - and a.file_syspk = f.file_syspk; + and a.file_mnemonic in ('IHTNST') + and a.file_syspk = __file_syspk; -- Insert data to fw_ods_iht: for Speed Lag: @@ -620,17 +228,18 @@ then function_id, test_file_mnemonic, test_sheet_mnemonic, + test_name, test_file_id, test_file_name, test_instance_id, - -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id + -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,""""configuration"""",Test insance tractor id tractor_make, tractor_model, mahindra_model_yn, test_tractor_yn, tractor_engine_hp, wheel_drive_type, - configuration, + "configuration", test_instance_tractor_id, --test specific: date & test dimensions test_date, @@ -639,10 +248,12 @@ then test_date_month, test_date_dayofmonth, test_date_dayofweek, + season, --test specific: location and test purpose test_condition, test_purpose, location_name, + test_type, --Test Specific: gear_used, gear_forward_reverse, @@ -658,19 +269,20 @@ then -- File Identifier: Test_Mnemonic, Sheet_Mnemonic, file_syspk(id), test_instance_id, test_file_name, a.client_id, a.function_id, - a.test_file_format, - a.test_file_sheet_format, + a.file_mnemonic, + a.file_sheet_mnemonic, + a.test_name, a.file_syspk, a.test_file_name, a.syspk, - -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id + -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,"""configuration""",Test insance tractor id b.tractor_make, b.tractor_model, b.mahindra_model_yn, b.test_tractor_yn, b.tractor_engine_hp, b.wheel_drive_type, - b.configuration, + b."configuration", b.syspk, --test specific: date & test dimensions a.date_of_test, @@ -679,10 +291,14 @@ then extract( month from a.date_of_test), extract( day from a.date_of_test), extract( dow from a.date_of_test), + concat(lpad(extract( month from a.date_of_test)::text,2,'0'),'-',(TO_CHAR( + TO_DATE (extract( month from a.date_of_test)::text, 'MM'), 'Month' + ))) AS "Month Name", --test specific: location c.test_condition, a.test_purpose, a.test_location_name, + a.test_type, -- Test Specific: c.gear, c.test_condition, @@ -701,8 +317,8 @@ then a.file_syspk = b.file_syspk and b.file_syspk = c.file_syspk and c.tractor_model = b.tractor_model - and a.test_file_format in ('IHTSLL') - and a.file_syspk = f.file_syspk; + and a.file_mnemonic in ('IHTSLL') + and a.file_syspk = __file_syspk; -- Insert data to fw_ods_iht: for Brake: @@ -712,17 +328,18 @@ then function_id, test_file_mnemonic, test_sheet_mnemonic, + test_name, test_file_id, test_file_name, test_instance_id, - -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id + -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,""""configuration"""",Test insance tractor id tractor_make, tractor_model, mahindra_model_yn, test_tractor_yn, tractor_engine_hp, wheel_drive_type, - configuration, + "configuration", test_instance_tractor_id, --test specific: date & test dimensions test_date, @@ -731,10 +348,12 @@ then test_date_month, test_date_dayofmonth, test_date_dayofweek, + season, --test specific: location and test purpose test_mode, test_condition, location_name, + test_type, --Test Specific: effort_type, speed_kmph, @@ -751,19 +370,20 @@ then -- File Identifier: Test_Mnemonic, Sheet_Mnemonic, file_syspk(id), test_instance_id, test_file_name, a.client_id, a.function_id, - a.test_file_format, - a.test_file_sheet_format, + a.file_mnemonic, + a.file_sheet_mnemonic, + a.test_name, a.file_syspk, a.test_file_name, a.syspk, - -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id + -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,"""configuration""",Test insance tractor id b.tractor_make, b.tractor_model, b.mahindra_model_yn, b.test_tractor_yn, b.tractor_engine_hp, b.wheel_drive_type, - b.configuration, + b."configuration", b.syspk, --test specific: date & test dimensions a.date_of_test, @@ -772,10 +392,14 @@ then extract( month from a.date_of_test), extract( day from a.date_of_test), extract( dow from a.date_of_test), + concat(lpad(extract( month from a.date_of_test)::text,2,'0'),'-',(TO_CHAR( + TO_DATE (extract( month from a.date_of_test)::text, 'MM'), 'Month' + ))) AS "Month Name", --test specific: location c.test_mode, c.test_condition, a.test_location_name, + a.test_type, -- Test Specific: 'Brake', c.trigger_speed_km_per_h, @@ -795,8 +419,8 @@ then a.file_syspk = b.file_syspk and b.file_syspk = c.file_syspk and c.tractor_model = b.tractor_model - and a.test_file_format in ('IHTBT50', 'IHTBT30', 'IHTBTD') - and a.file_syspk = f.file_syspk; + and a.file_mnemonic in ('IHTBT50', 'IHTBT30', 'IHTBTD') + and a.file_syspk = __file_syspk; -- data for Pedal Effort: from transactional.iht_pedal_effort @@ -806,17 +430,18 @@ then function_id, test_file_mnemonic, test_sheet_mnemonic, + test_name, test_file_id, test_file_name, test_instance_id, - -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id + -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,"""configuration""",Test insance tractor id tractor_make, tractor_model, mahindra_model_yn, test_tractor_yn, tractor_engine_hp, wheel_drive_type, - configuration, + "configuration", test_instance_tractor_id, --test specific: date & test dimensions test_date, @@ -825,9 +450,11 @@ then test_date_month, test_date_dayofmonth, test_date_dayofweek, + season, --test specific: location and test purpose test_purpose, location_name, + test_type, --Test Specific: gear_pedal_effort_parameters, effort_type, @@ -835,7 +462,7 @@ then brake_pedal_travel_lh_in_mm, brake_pedal_travel_rh_in_mm, brake_pedal_travel_latched_in_mm, - pedal_travel_mm, + pedal_travel_in_mm, created_by, updated_by, create_timestamp, @@ -845,19 +472,20 @@ then -- File Identifier: Test_Mnemonic, Sheet_Mnemonic, file_syspk(id), test_instance_id, test_file_name, a.client_id, a.function_id, - a.test_file_format, - a.test_file_sheet_format, + a.file_mnemonic, + a.file_sheet_mnemonic, + a.test_name, a.file_syspk, a.test_file_name, a.syspk, - -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id + -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,"""configuration""",Test insance tractor id b.tractor_make, b.tractor_model, b.mahindra_model_yn, b.test_tractor_yn, b.tractor_engine_hp, b.wheel_drive_type, - b.configuration, + b."configuration", b.syspk, --test specific: date & test dimensions a.date_of_test, @@ -866,9 +494,13 @@ then extract( month from a.date_of_test), extract( day from a.date_of_test), extract( dow from a.date_of_test), + concat(lpad(extract( month from a.date_of_test)::text,2,'0'),'-',(TO_CHAR( + TO_DATE (extract( month from a.date_of_test)::text, 'MM'), 'Month' + ))) AS "Month Name", --test specific: location a.test_purpose, a.test_location_name, + a.test_type, -- Test Specific: c.parameters, 'pedal', @@ -889,8 +521,8 @@ then a.file_syspk = b.file_syspk and b.file_syspk = c.file_syspk and c.tractor_model = b.tractor_model - and a.test_file_format in ('IHTEMT') - and a.file_syspk = f.file_syspk; + and a.file_mnemonic in ('IHTEMT') + and a.file_syspk = __file_syspk; -- Data for Gear Effort from transactional.iht_gear_effort @@ -900,17 +532,18 @@ then function_id, test_file_mnemonic, test_sheet_mnemonic, + test_name, test_file_id, test_file_name, test_instance_id, - -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id + -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,"""configuration""",Test insance tractor id tractor_make, tractor_model, mahindra_model_yn, test_tractor_yn, tractor_engine_hp, wheel_drive_type, - configuration, + "configuration", test_instance_tractor_id, --test specific: date & test dimensions test_date, @@ -919,9 +552,11 @@ then test_date_month, test_date_dayofmonth, test_date_dayofweek, + season, --test specific: location test_purpose, location_name, + test_type, --Test Specific: gear_pedal_effort_parameters, effort_type, @@ -929,7 +564,7 @@ then brake_pedal_travel_lh_in_mm, brake_pedal_travel_rh_in_mm, brake_pedal_travel_latched_in_mm, - pedal_travel_mm, + pedal_travel_in_mm, created_by, updated_by, create_timestamp, @@ -939,19 +574,20 @@ then -- File Identifier: Test_Mnemonic, Sheet_Mnemonic, file_syspk(id), test_instance_id, test_file_name, a.client_id, a.function_id, - a.test_file_format, - a.test_file_sheet_format, + a.file_mnemonic, + a.file_sheet_mnemonic, + a.test_name, a.file_syspk, a.test_file_name, a.syspk, - -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id + -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,"""configuration""",Test insance tractor id b.tractor_make, b.tractor_model, b.mahindra_model_yn, b.test_tractor_yn, b.tractor_engine_hp, b.wheel_drive_type, - b.configuration, + b."configuration", b.syspk, --test specific: date & test dimensions a.date_of_test, @@ -960,9 +596,13 @@ then extract( month from a.date_of_test), extract( day from a.date_of_test), extract( dow from a.date_of_test), + concat(lpad(extract( month from a.date_of_test)::text,2,'0'),'-',(TO_CHAR( + TO_DATE (extract( month from a.date_of_test)::text, 'MM'), 'Month' + ))) AS "Month Name", --test specific: location a.test_purpose, a.test_location_name, + a.test_type, -- Test Specific: c.parameters, 'Gear', @@ -983,8 +623,8 @@ then a.file_syspk = b.file_syspk and b.file_syspk = c.file_syspk and c.tractor_model = b.tractor_model - and a.test_file_format in ('IHTEMT') - and a.file_syspk = f.file_syspk; + and a.file_mnemonic in ('IHTEMT') + and a.file_syspk = __file_syspk; @@ -995,17 +635,18 @@ then function_id, test_file_mnemonic, test_sheet_mnemonic, + test_name, test_file_id, test_file_name, test_instance_id, - -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id + -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,"""configuration""",Test insance tractor id tractor_make, tractor_model, mahindra_model_yn, test_tractor_yn, tractor_engine_hp, wheel_drive_type, - configuration, + "configuration", test_instance_tractor_id, --test specific: date & test dimensions test_date, @@ -1014,9 +655,11 @@ then test_date_month, test_date_dayofmonth, test_date_dayofweek, + season, --test specific: location test_purpose, location_name, + test_type, --Test Specific: gear_pedal_effort_parameters, effort_type, @@ -1024,7 +667,7 @@ then brake_pedal_travel_lh_in_mm, brake_pedal_travel_rh_in_mm, brake_pedal_travel_latched_in_mm, - pedal_travel_mm, + pedal_travel_in_mm, created_by, updated_by, create_timestamp, @@ -1034,19 +677,20 @@ then -- File Identifier: Test_Mnemonic, Sheet_Mnemonic, file_syspk(id), test_instance_id, test_file_name, a.client_id, a.function_id, - a.test_file_format, - a.test_file_sheet_format, + a.file_mnemonic, + a.file_sheet_mnemonic, + a.test_name, a.file_syspk, a.test_file_name, a.syspk, - -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id + -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,"""configuration""",Test insance tractor id b.tractor_make, b.tractor_model, b.mahindra_model_yn, b.test_tractor_yn, b.tractor_engine_hp, b.wheel_drive_type, - b.configuration, + b."configuration", b.syspk, --test specific: date & test dimensions a.date_of_test, @@ -1055,9 +699,13 @@ then extract( month from a.date_of_test), extract( day from a.date_of_test), extract( dow from a.date_of_test), + concat(lpad(extract( month from a.date_of_test)::text,2,'0'),'-',(TO_CHAR( + TO_DATE (extract( month from a.date_of_test)::text, 'MM'), 'Month' + ))) AS "Month Name", --test specific: location a.test_purpose, a.test_location_name, + a.test_type, -- Test Specific: null, 'Brake Pedal', @@ -1078,8 +726,8 @@ then a.file_syspk = b.file_syspk and b.file_syspk = c.file_syspk and c.tractor_model = b.tractor_model - and a.test_file_format in ('IHTEMT') - and a.file_syspk = f.file_syspk; + and a.file_mnemonic in ('IHTEMT') + and a.file_syspk = __file_syspk; --Data for Cluth PedalEffort: from transactional.iht_clutch_pedal_effort insert into fw_ods.fw_ods( @@ -1088,17 +736,18 @@ then function_id, test_file_mnemonic, test_sheet_mnemonic, + test_name, test_file_id, test_file_name, test_instance_id, - -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id + -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,"""configuration""",Test insance tractor id tractor_make, tractor_model, mahindra_model_yn, test_tractor_yn, tractor_engine_hp, wheel_drive_type, - configuration, + "configuration", test_instance_tractor_id, --test specific: date & test dimensions test_date, @@ -1107,9 +756,11 @@ then test_date_month, test_date_dayofmonth, test_date_dayofweek, + season, --test specific: location test_purpose, location_name, + test_type, --Test Specific: gear_pedal_effort_parameters, effort_type, @@ -1117,7 +768,7 @@ then brake_pedal_travel_lh_in_mm, brake_pedal_travel_rh_in_mm, brake_pedal_travel_latched_in_mm, - pedal_travel_mm, + pedal_travel_in_mm, created_by, updated_by, create_timestamp, @@ -1127,19 +778,20 @@ then -- File Identifier: Test_Mnemonic, Sheet_Mnemonic, file_syspk(id), test_instance_id, test_file_name, a.client_id, a.function_id, - a.test_file_format, - a.test_file_sheet_format, + a.file_mnemonic, + a.file_sheet_mnemonic, + a.test_name, a.file_syspk, a.test_file_name, a.syspk, - -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id + -- Tractor Identifier: tractor make,tractor model,tractor engine hp,wheel drive type,"""configuration""",Test insance tractor id b.tractor_make, b.tractor_model, b.mahindra_model_yn, b.test_tractor_yn, b.tractor_engine_hp, b.wheel_drive_type, - b.configuration, + b."configuration", b.syspk, --test specific: date & test dimensions a.date_of_test, @@ -1148,9 +800,13 @@ then extract( month from a.date_of_test), extract( day from a.date_of_test), extract( dow from a.date_of_test), + concat(lpad(extract( month from a.date_of_test)::text,2,'0'),'-',(TO_CHAR( + TO_DATE (extract( month from a.date_of_test)::text, 'MM'), 'Month' + ))) AS "Month Name", --test specific: location a.test_purpose, a.test_location_name, + a.test_type, -- Test Specific: null, 'Clutch Pedal', @@ -1171,13 +827,44 @@ then a.file_syspk = b.file_syspk and b.file_syspk = c.file_syspk and c.tractor_model = b.tractor_model - and a.test_file_format in ('IHTEMT') - and a.file_syspk = f.file_syspk; - end if; + and a.file_mnemonic in ('IHTEMT') + and a.file_syspk = __file_syspk; + + +update fw_ods.fw_ods b +set platform = a.tractor_platform +from transactional.test_instance_tractor_info a +where +b.platform is null and +b.test_file_id = a.file_syspk +and a.file_syspk = __file_syspk +and test_file_mnemonic = a.file_mnemonic +and a.file_mnemonic like 'IHT%'; + +END IF; end loop; -update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'trx_load_completed', end_status='success', end_time=now() where job_id = p_job_id and step_id = p_step_id and latest_runschedule_flag = '1'; + +perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'ods', 'fn_fw_ods_iht_load', err_state, err_msg, err_detail, err_hint, err_context,'success'); + + + + + +EXCEPTION when OTHERS then + + err_state = returned_sqlstate, /* P0002 */ + err_msg = message_text, /* No Data in FTDRY */ + err_detail = pg_exception_detail, /* No data in table t_test_new */ + err_hint = pg_exception_hint, /* No data error capture */ + err_context = pg_exception_context; /* PL/pgSQL function staging2.fn_ftdry_trs_block(integer,integer,text,text,integer) line 69 at RAISE*/ + + +perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'ods', 'fn_fw_ods_iht_load', err_state, err_msg, err_detail, err_hint, err_context,'error'); + + end $$ -LANGUAGE plpgsql; \ No newline at end of file +LANGUAGE plpgsql; + \ No newline at end of file diff --git a/onetime/dataloadfunctions/ODS_Load/fn_fw_ods_implement_details_update.sql b/onetime/dataloadfunctions/ODS_Load/fn_fw_ods_implement_details_update.sql new file mode 100644 index 0000000..277ab94 --- /dev/null +++ b/onetime/dataloadfunctions/ODS_Load/fn_fw_ods_implement_details_update.sql @@ -0,0 +1,185 @@ + + +CREATE OR REPLACE FUNCTION fw_ods.fn_fw_ods_implement_details_update(p_client_id int,p_function_id int, p_file_mnemonic text, +p_file_sheet_mnemonic text, p_file_syspk int) + RETURNS void +AS $$ + declare +f record; + + declare __client_id int :=p_client_id; + declare __function_id int :=p_function_id; + declare __file_mnemonic text :=p_file_mnemonic; + declare __file_sheet_mnemonic text :=p_file_sheet_mnemonic; + declare __file_syspk int :=p_file_syspk; + declare err_state text; + declare err_msg text; + declare err_detail text; + declare err_hint text; + declare err_context text; + declare _error int; + +begin + +for f in select distinct file_mnemonic from fw_core.fw_jobctl_file_runschedule + where latest_runschedule_flag = '1' and end_status = 'success' and end_status_note = 'TRX_completed' and file_mnemonic like 'FT%' +loop + + +-- FTDRY: +update fw_ods.fw_ods a +set +implement_size= b.implement_size, +hitch_category= b.hitch_category, +type_of_cage_wheel= b.type_of_cage_wheel, +cage_wheel_width_mm = b.cage_wheel_width_mm , +cage_wheel_weight = b.cage_wheel_weight , +cage_wheel_inner_and_outer_ring_dia_mm = b.cage_wheel_inner_and_outer_ring_dia_mm , +cage_wheel_center_ring_dia_mm = b.cage_wheel_center_ring_dia_mm , +dist_between_rhs_and_lhs_cage_wheel_inner_ring_mm = b.dist_between_rhs_and_lhs_cage_wheel_inner_ring_mm , +no_of_angles_on_cage_wheel = b.no_of_angles_on_cage_wheel , +soil_moisture_content_pct= b.soil_moisture_content_pct, +soil_bulk_density_g_per_cc= b.soil_bulk_density_g_per_cc, +soil_cone_index= b.soil_cone_index, +field_condition= b.field_condition +from transactional.field_perf_summary_implement_info b +where a.test_file_mnemonic = b.file_mnemonic +and a.test_instance_id = b.test_instance_id +and a.test_file_mnemonic ='FTDRY' +and b.file_syspk = a.test_file_id +and b.file_syspk = __file_syspk +; + + + + +update fw_ods.fw_ods a +set +fuel_consumption_var_lit_per_hr= b.fuel_consumption_var_lit_per_hr, +mileage_var_km_per_ltr= b.mileage_var_km_per_ltr, +area_covered_var_acr_per_hr= b.area_covered_var_acr_per_hr, +fuel_consumption_var_lit_per_acr= b.fuel_consumption_var_lit_per_acr, +fuel_consumption_var_pct_lit_per_hr= b.fuel_consumption_var_pct_lit_per_hr, +mileage_var_pct_km_per_ltr= b.mileage_var_pct_km_per_ltr, +area_covered_var_pct_acr_per_hr= b.area_covered_var_pct_acr_per_hr, +fuel_consumption_var_pct_lit_per_acr = b.fuel_consumption_var_pct_lit_per_acr +from transactional.field_perf_summary b +where b.file_syspk = a.test_file_id +and a.test_file_mnemonic = b.file_mnemonic +and a.test_iteration_number = b.test_iteration_number +and a.tractor_model = b.tractor_model +and a.test_instance_tractor_id = b.test_instance_tractor_id +and b.test_instance_id = a.test_instance_id +and b.file_mnemonic = 'FTDRY' +and b.file_syspk = __file_syspk +; + + + +-- FTWET: +update fw_ods.fw_ods a +set +implement_size= b.implement_size, +hitch_category= b.hitch_category, +type_of_cage_wheel= b.type_of_cage_wheel, +cage_wheel_width_mm = b.cage_wheel_width_mm , +cage_wheel_weight = b.cage_wheel_weight , +cage_wheel_inner_and_outer_ring_dia_mm = b.cage_wheel_inner_and_outer_ring_dia_mm , +cage_wheel_center_ring_dia_mm = b.cage_wheel_center_ring_dia_mm , +dist_between_rhs_and_lhs_cage_wheel_inner_ring_mm = b.dist_between_rhs_and_lhs_cage_wheel_inner_ring_mm , +no_of_angles_on_cage_wheel = b.no_of_angles_on_cage_wheel , +soil_moisture_content_pct= b.soil_moisture_content_pct, +soil_bulk_density_g_per_cc= b.soil_bulk_density_g_per_cc, +soil_cone_index= b.soil_cone_index, +field_condition= b.field_condition +from transactional.field_perf_summary_implement_info b +where a.test_file_mnemonic = b.file_mnemonic +and a.test_instance_id = b.test_instance_id +and a.test_file_mnemonic ='FTWET' +and b.file_syspk = a.test_file_id +and b.file_syspk = __file_syspk +; + + + +update fw_ods.fw_ods a +set +fuel_consumption_var_lit_per_hr= b.fuel_consumption_var_lit_per_hr, +mileage_var_km_per_ltr= b.mileage_var_km_per_ltr, +area_covered_var_acr_per_hr= b.area_covered_var_acr_per_hr, +fuel_consumption_var_lit_per_acr= b.fuel_consumption_var_lit_per_acr, +fuel_consumption_var_pct_lit_per_hr= b.fuel_consumption_var_pct_lit_per_hr, +mileage_var_pct_km_per_ltr= b.mileage_var_pct_km_per_ltr, +area_covered_var_pct_acr_per_hr= b.area_covered_var_pct_acr_per_hr, +fuel_consumption_var_pct_lit_per_acr = b.fuel_consumption_var_pct_lit_per_acr +from transactional.field_perf_summary b +where b.file_syspk = a.test_file_id +and a.test_file_mnemonic = b.file_mnemonic +and a.test_iteration_number = b.test_iteration_number +and a.tractor_model = b.tractor_model +and a.test_instance_tractor_id = b.test_instance_tractor_id +and b.test_instance_id = a.test_instance_id +and b.file_mnemonic = 'FTWET' +and b.file_syspk = __file_syspk +; + + + + +-- FTHLG: +update fw_ods.fw_ods a +set +tire_size_and_inflation_pressure_psi= b.tire_size_and_inflation_pressure_psi, +no_of_axle= b.no_of_axle, +no_of_wheels = b.no_of_wheels, +trailer_gross_weight_kg= b.trailer_gross_weight_kg, +tractor_rwc_to_hitch_point_center_dist_mm= b.tractor_rwc_to_hitch_point_center_dist_mm, +trailer_hitch_height_above_ground_level_mm= b.trailer_hitch_height_above_ground_level_mm, +gradient_slope_1_degree= b.gradient_slope_1_degree, +gradient_slope_2_degree = b.gradient_slope_2_degree +from transactional.field_perf_summary_trailer_info b +where a.test_file_mnemonic = b.file_mnemonic +and a.test_instance_id = b.test_instance_id +and a.test_file_mnemonic ='FTHLG' +and b.file_syspk = a.test_file_id +and b.file_syspk = __file_syspk +; + + + +update fw_ods.fw_ods a +set +fuel_consumption_var_lit_per_hr= b.fuel_consumption_var_lit_per_hr, +mileage_var_km_per_ltr= b.mileage_var_km_per_ltr, +area_covered_var_acr_per_hr= b.area_covered_var_acr_per_hr, +fuel_consumption_var_lit_per_acr= b.fuel_consumption_var_lit_per_acr, +fuel_consumption_var_pct_lit_per_hr= b.fuel_consumption_var_pct_lit_per_hr, +mileage_var_pct_km_per_ltr= b.mileage_var_pct_km_per_ltr, +area_covered_var_pct_acr_per_hr= b.area_covered_var_pct_acr_per_hr, +fuel_consumption_var_pct_lit_per_acr = b.fuel_consumption_var_pct_lit_per_acr +from transactional.field_perf_summary b +where b.file_syspk = a.test_file_id +and a.test_file_mnemonic = b.file_mnemonic +and a.test_iteration_number = b.test_iteration_number +and a.tractor_model = b.tractor_model +and a.test_instance_tractor_id = b.test_instance_tractor_id +and b.test_instance_id = a.test_instance_id +and b.file_mnemonic = 'FTHLG' +and b.file_syspk = __file_syspk +; + +end loop; + +perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'ods', 'fn_fw_ods_implement_details_update', err_state, err_msg, err_detail, err_hint, err_context,'success'); + +EXCEPTION when OTHERS then + err_state = returned_sqlstate, /* P0002 */ + err_msg = message_text, /* No Data in FTDRY */ + err_detail = pg_exception_detail, /* No data in table t_test_new */ + err_hint = pg_exception_hint, /* No data error capture */ + err_context = pg_exception_context; /* PL/pgSQL function staging2.fn_ftdry_trs_block(integer,integer,text,text,integer) line 69 at RAISE*/ + +perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'ods', 'fn_fw_ods_implement_details_update', err_state, err_msg, err_detail, err_hint, err_context,'error'); + +end +$$ LANGUAGE plpgsql; \ No newline at end of file diff --git a/onetime/dataloadfunctions/ODS_Load/fn_fw_ods_observation_ftdry_load.sql b/onetime/dataloadfunctions/ODS_Load/fn_fw_ods_observation_ftdry_load.sql new file mode 100755 index 0000000..674f71c --- /dev/null +++ b/onetime/dataloadfunctions/ODS_Load/fn_fw_ods_observation_ftdry_load.sql @@ -0,0 +1,214 @@ + + +CREATE OR REPLACE FUNCTION fw_ods.fn_fw_ods_observations_load(p_client_id int,p_function_id int, p_file_mnemonic text, +p_file_sheet_mnemonic text, p_file_syspk int) + RETURNS void +AS $$ + declare +f record; + + declare __client_id int :=p_client_id; + declare __function_id int :=p_function_id; + declare __file_mnemonic text :=p_file_mnemonic; + declare __file_sheet_mnemonic text :=p_file_sheet_mnemonic; + declare __file_syspk int :=p_file_syspk; + declare err_state text; + declare err_msg text; + declare err_detail text; + declare err_hint text; + declare err_context text; + declare _error int; + +begin + +for f in select distinct file_mnemonic from fw_core.fw_jobctl_file_runschedule + where latest_runschedule_flag = '1' and end_status = 'success' and end_status_note = 'TRX_completed' and file_mnemonic like 'FT%' +loop + + insert into fw_ods.fw_ods_observations + ( + client_id , + function_id , + test_file_mnemonic , + test_sheet_mnemonic , + test_file_id , + test_file_name , + test_iteration_number , + --platform , + --benchmark_yn , + tractor_make , + tractor_model , + tractor_engine_hp , + wheel_drive_type , + name_of_implement , + type_of_implement , + season , + engine_smoke_on_load, + engine_acceleration_smoke , + range_gear_shifting , + speed_gear_shifting , + draft_response , + tractor_steer_ability , + tractor_braking_performance , + front_visibility , + implement_accessibility , + front_wheel_dragging_at_turning , + front_end_lifting_during_operation , + rpm_recovery_time , + engine_vibration , + engine_sound , + implement_lifing_lowering_response , + pulverization_quality , + pulverization_index + ) + + select + a.client_id , + a.function_id , + a.file_mnemonic, + a.file_sheet_mnemonic , + b.file_syspk , + a.test_file_name , + b.test_iteration_number , + --platform , + --benchmark_yn , + b.tractor_make , + b.tractor_model , + d.tractor_engine_hp , + d.wheel_drive_type , + c.name_of_implement , + c.type_of_implement , + concat(lpad(extract( month from a.date_of_test)::text,2,'0'),'-',a.season) AS "Month Name", + b.engine_smoke_on_load, + b.engine_acceleration_smoke , + b.range_gear_shifting , + b.speed_gear_shifting , + b.draft_response , + b.tractor_steer_ability , + b.tractor_braking_perf , + b.front_visibility , + b.implement_accessibility , + b.front_wheel_dragging_at_turning , + b.front_end_lifting_during_operation , + b.rpm_recovery_time , + b.engine_vibration , + b.engine_sound , + b.implement_lifting_per_lowering_response, + b.pulverization_quality , + b.pulverization_index + from + transactional.test_instance a, + transactional.field_perf_summary b, + transactional.test_instance_implement_info c , + transactional.test_instance_tractor_info d + where + a.file_syspk= b.file_syspk + and b.file_syspk = c.file_syspk + and c.file_syspk = d.file_syspk + and d.tractor_model = b.tractor_model + and a.file_mnemonic in ('FTDRY','FTWET') + and a.file_syspk = __file_syspk; + + + insert into fw_ods.fw_ods_observations + ( + client_id , + function_id , + test_file_mnemonic , + test_sheet_mnemonic , + test_file_id , + test_file_name , + test_iteration_number , + --platform , + --benchmark_yn , + tractor_make , + tractor_model , + tractor_engine_hp , + wheel_drive_type , + name_of_implement , + type_of_implement , + season , + engine_smoke_on_load, + engine_acceleration_smoke , + range_gear_shifting , + speed_gear_shifting , + draft_response , + tractor_steer_ability , + tractor_braking_performance , + front_visibility , + implement_accessibility , + front_wheel_dragging_at_turning , + front_end_lifting_during_operation , + rpm_recovery_time , + engine_vibration , + engine_sound , + implement_lifing_lowering_response , + pulverization_quality , + pulverization_index + ) + select + a.client_id , + a.function_id , + a.file_mnemonic, + a.file_sheet_mnemonic , + b.file_syspk , + a.test_file_name , + b.test_iteration_number , + --platform , + --benchmark_yn , + b.tractor_make , + b.tractor_model , + d.tractor_engine_hp , + d.wheel_drive_type , + 'Trailer', + c.trailer_type , + concat(lpad(extract( month from a.date_of_test)::text,2,'0'),'-',(TO_CHAR( + TO_DATE (extract( month from a.date_of_test)::text, 'MM'), 'Month' + ))) AS "Month Name", + b.engine_smoke_on_load, + b.engine_acceleration_smoke , + b.range_gear_shifting , + b.speed_gear_shifting , + b.draft_response , + b.tractor_steer_ability , + b.tractor_braking_perf , + b.front_visibility , + b.implement_accessibility , + b.front_wheel_dragging_at_turning , + b.front_end_lifting_during_operation , + b.rpm_recovery_time , + b.engine_vibration , + b.engine_sound , + b.implement_lifting_per_lowering_response, + b.pulverization_quality , + b.pulverization_index + from + transactional.test_instance a, + transactional.field_perf_summary b, + transactional.field_perf_summary_trailer_info c , + transactional.test_instance_tractor_info d + where + a.file_syspk= b.file_syspk + and b.file_syspk = c.file_syspk + and c.file_syspk = d.file_syspk + and d.tractor_model = b.tractor_model + and a.file_mnemonic= 'FTHLG' + and a.file_syspk = __file_syspk; + +end loop; + +perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'ods', 'fn_fw_ods_observations_load', err_state, err_msg, err_detail, err_hint, err_context,'success'); + +EXCEPTION when OTHERS then + + err_state = returned_sqlstate, /* P0002 */ + err_msg = message_text, /* No Data in FTDRY */ + err_detail = pg_exception_detail, /* No data in table t_test_new */ + err_hint = pg_exception_hint, /* No data error capture */ + err_context = pg_exception_context; /* PL/pgSQL function staging2.fn_ftdry_trs_block(integer,integer,text,text,integer) line 69 at RAISE*/ + + +perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'ods', 'fn_fw_ods_observations_load', err_state, err_msg, err_detail, err_hint, err_context,'error'); + +end +$$ LANGUAGE plpgsql; \ No newline at end of file diff --git a/onetime/dataloadfunctions/ODS_Load/fn_fw_ods_pto_load.sql b/onetime/dataloadfunctions/ODS_Load/fn_fw_ods_pto_load.sql new file mode 100644 index 0000000..47a0069 --- /dev/null +++ b/onetime/dataloadfunctions/ODS_Load/fn_fw_ods_pto_load.sql @@ -0,0 +1,364 @@ +CREATE OR REPLACE FUNCTION fw_ods.fn_fw_ods_PTO_load(p_client_id int,p_function_id int, p_file_mnemonic text, +p_file_sheet_mnemonic text, p_file_syspk int) + RETURNS void +AS $$ + declare + f record; + + declare __client_id int :=p_client_id; + declare __function_id int :=p_function_id; + declare __file_mnemonic text :=p_file_mnemonic; + declare __file_sheet_mnemonic text :=p_file_sheet_mnemonic; + declare __file_syspk int :=p_file_syspk; + declare err_state text; + declare err_msg text; + declare err_detail text; + declare err_hint text; + declare err_context text; + declare _error int; + +begin +-- Adding data to file fw_ods_field: +for f in select distinct file_mnemonic from fw_core.fw_jobctl_file_runschedule + where latest_runschedule_flag = '1' and end_status = 'success' and end_status_note = 'TRX_completed' +loop +if f.file_mnemonic LIKE 'PTO%' +then + --pto_perf_results + insert into fw_ods.fw_ods ( + client_id, + function_id, + test_file_mnemonic, + test_sheet_mnemonic, + test_name, + test_file_id, + test_file_name, + test_instance_id, + -- File Identifier + tractor_make, + tractor_model, + tractor_engine_hp, + wheel_drive_type, + "configuration", + test_instance_tractor_id, + mahindra_model_yn, + test_tractor_yn, + -- Tractor Identifier tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id + season, + test_date, + test_date_year, + test_date_quarter, + test_date_month, + test_date_dayofmonth, + test_date_dayofweek, + -- season and date + test_mode, + test_type, + test_sub_type, + -- test mode, type, subtype, condition hierarchy + location_name, + -- location name + engine_speed_var, + -- test specific dimensions + -- test specific measures ---- + fuel_consumption_lit_per_hr, + power_kw, + power_hp, + torque_kg_m , + sfc_gms_per_hp_hr , + fuelling_mm3_per_stroke_per_cyl, + temp_engine_oil_c, + equ_crank_torque_nm, + speed_pto_rpm, + torque_Nm , + temp_water_outlet_c, + temp_exhaust_c, + temp_fuel_temp_c + -- audit fields + -- validate how it is being done + --created_by, updated_by, create_timestamp, update_timestamp + ) + select + d.client_id, + d.function_id, + d.file_mnemonic, + d.file_sheet_mnemonic, + d.test_name, + d.file_syspk, + d.test_file_name, + d.syspk, + b.tractor_make, + b.tractor_model, + b.tractor_engine_hp, + b.wheel_drive_type, + b.configuration, + b.syspk, + 'Y', + 'Y', + -- -- test specific date & test dimensions + concat(lpad(extract( month from d.date_of_test)::text,2,'0'),'-',(TO_CHAR( + TO_DATE (extract( month from d.date_of_test)::text, 'MM'), 'Month' + ))) AS "Month Name", + d.date_of_test, + extract( year from d.date_of_test) , + extract( month from d.date_of_test), + extract( quarter from d.date_of_test), + extract( DAY from d.date_of_test), + date_part('dow',d.date_of_test) dow, + a.test_mode, + a.pto_test_type , + a.pto_test_sub_type , + d.test_location_name , + -- test specific dimensions + a.speed_engine_rpm, + a.fuel_consumption_ltr_per_hr, + a.power_kw, + a.power_hp, + -- test specific measures + a.brake_torque_kg_m, + a.fuel_consumption_gm_per_hp_hr , + a.fuel_consumption_mm3_per_str_per_cyl , + a.temperatures_engine_oil_c , + a.eq_crank_torque_nm, + a.speed_pto_rpm, + a.brake_torque_n_m, + a.temperatures_water_outlet_c, + a.temperatures_exhaust_c, + a.temperatures_fuel_c + -- add user and timestamp fields + from transactional.pto_perf_results a, + transactional.test_instance_tractor_info b, + transactional.test_instance d + where a.file_syspk = b.file_syspk + and a.file_syspk = d.file_syspk + and b.tractor_model = a.tractor_model + and a.test_mode = d.test_mode + and a.file_syspk = __file_syspk + and d.file_mnemonic in ('PTOSTD','PTOBEN') and case a.test_mode + when 'Boost' then b.file_sheet_mnemonic = 'PTOBEN_PRFB' + when 'Normal' then b.file_sheet_mnemonic = 'PTOBEN_PRFN' + when 'Eco' then b.file_sheet_mnemonic = 'PTOBEN_PRFE' + when 'Standard' then b.file_sheet_mnemonic = 'PTOSTD_PRF' + end; + + --transactional.pto_multipoint_mapping + insert into fw_ods.fw_ods ( + client_id, + function_id, + test_file_mnemonic, + test_sheet_mnemonic, + test_name, + test_file_id, + test_file_name, + test_instance_id, + -- File Identifier + tractor_make, + tractor_model, + tractor_engine_hp, + wheel_drive_type, + "configuration", + test_instance_tractor_id, + -- Tractor Identifier tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id + mahindra_model_yn, + test_tractor_yn, + season, + test_date, + test_date_year, + test_date_quarter, + test_date_month, + test_date_dayofmonth, + test_date_dayofweek, + -- season and date + test_mode, + test_type, + test_condition, + -- test mode, type, subtype, condition hierarchy + location_name, + -- location name + engine_speed_var, + engine_load_pct_var, + -- test specific dimensions + -- test specific measures ---- + sfc_gms_per_hp_hr, + fuel_consumption_lit_per_hr + -- audit fields + -- validate how it is being done + --created_by, updated_by, create_timestamp, update_timestamp + ) + select + d.client_id, + d.function_id, + a.file_mnemonic, + a.file_sheet_mnemonic, + d.test_name, + a.file_syspk, + d.test_file_name, + d.syspk, + -- d.syspk = test_instance_id, b.syspk = test_instance_tractor_id + b.tractor_make, + a.tractor_model, + b.tractor_engine_hp, + b.wheel_drive_type, + b.configuration, + b.syspk, + 'Y', + 'Y', + -- -- test specific date & test dimensions + concat(lpad(extract( month from d.date_of_test)::text,2,'0'),'-',(TO_CHAR( + TO_DATE (extract( month from d.date_of_test)::text, 'MM'), 'Month' + ))) AS "Month Name", + d.date_of_test, + extract( year from d.date_of_test) , + extract( month from d.date_of_test), + extract( quarter from d.date_of_test), + extract( DAY from d.date_of_test), + date_part('dow',d.date_of_test) dow, + a.test_mode, + a.test_condition, + a.test_condition, + d.test_location_name , + -- test specific dimensions + a.engine_speed_rpm, + a.engine_load_pct, + -- test specific measures + a.sfc_gm_per_hp_hr, + a.fuel_consumption_ltr_per_hr + -- add user and timestamp fields + from transactional.pto_multipoint_mapping a, transactional.test_instance_tractor_info b,transactional.test_instance d + where a.file_syspk = b.file_syspk + and a.file_syspk = d.file_syspk + and b.tractor_model = a.tractor_model + and a.file_syspk = __file_syspk + and d.file_mnemonic in ('PTOSTD','PTOBEN') + and b.file_sheet_mnemonic in ('PTOBEN_PRFN','PTOSTD_PRF') and + d.file_sheet_mnemonic in ('PTOSTD_MPM','PTOBEN_MPM'); + + --pto_perf_governing_graph + insert into fw_ods.fw_ods ( + client_id, + function_id, + test_file_mnemonic, + test_sheet_mnemonic, + test_name, + test_file_id, + test_file_name, + test_instance_id, + -- File Identifier + tractor_make, + tractor_model, + tractor_engine_hp, + wheel_drive_type, + "configuration", + test_instance_tractor_id, + -- Tractor Identifier tractor make,tractor model,tractor engine hp,wheel drive type,configuration,Test insance tractor id + mahindra_model_yn, + test_tractor_yn, + season, + test_date, + test_date_year, + test_date_quarter, + test_date_month, + test_date_dayofmonth, + test_date_dayofweek, + -- season and date + test_mode, + test_type, + test_condition, + -- test mode, type, subtype, condition hierarchy + location_name, + -- location name + -- test specific dimensions + -- test specific measures ---- + engine_speed_var, + power_hp, + torque_kg_m, + fuelling_mm3_per_stroke_per_cyl + -- audit fields + -- validate how it is being done + --created_by, updated_by, create_timestamp, update_timestamp + ) + select + d.client_id, + d.function_id, + a.file_mnemonic, + a.file_sheet_mnemonic, + d.test_name, + a.file_syspk, + d.test_file_name, + d.syspk, + -- d.syspk = test_instance_id, b.syspk = test_instance_tractor_id + b.tractor_make, + a.tractor_model, + b.tractor_engine_hp, + b.wheel_drive_type, + b.configuration, + b.syspk, + 'Y', + 'Y', + -- -- test specific date & test dimensions + concat(lpad(extract( month from d.date_of_test)::text,2,'0'),'-',(TO_CHAR( + TO_DATE (extract( month from d.date_of_test)::text, 'MM'), 'Month' + ))) AS "Month Name", + d.date_of_test, + extract( year from d.date_of_test) , + extract( month from d.date_of_test), + extract( quarter from d.date_of_test), + extract( DAY from d.date_of_test), + date_part('dow',d.date_of_test) dow, + a.test_mode, + --a.test_condition, + a.test_condition, + a.test_type, + d.test_location_name , + -- test specific dimensions + a.engine_speed_rpm, + a.power_hp, + -- test specific measures + a.torque_kg_m, + a.fuelling_mm3_per_stroke_per_cyl + -- add user and timestamp fields + from transactional.pto_perf_governing_graph a, transactional.test_instance_tractor_info b,transactional.test_instance d + where a.file_syspk = b.file_syspk + and a.file_syspk = d.file_syspk + and b.tractor_model = a.tractor_model + and a.file_syspk = __file_syspk + and d.file_mnemonic in ('PTOSTD','PTOBEN') + and b.file_sheet_mnemonic in ('PTOBEN_PRFN','PTOSTD_PRF') + and d.file_sheet_mnemonic in ('PTOSTD_GVG','PTOBEN_GVG'); + + update fw_ods.fw_ods set test_ambient = CASE WHEN test_type like '%Natural Ambient%' THEN 'Natural' + WHEN test_type like '%High Ambient%' THEN 'High' + END ; + update fw_ods.fw_ods set tractor_engine_hp = trim((substring(lower(tractor_model) from '%#"___hp#"%' for '#')),'hp')::int where test_file_mnemonic in ('PTOSTD','PTOBEN') and test_file_id = __file_syspk; + update fw_ods.fw_ods set configuration = 'NA' where test_file_mnemonic in ('PTOSTD','PTOBEN') and test_file_id = __file_syspk; + + + + + end if; + end loop; + + + +perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'ods', 'fn_fw_ods_pto_load', err_state, err_msg, err_detail, err_hint, err_context,'success'); + + + + + +EXCEPTION when OTHERS then + + err_state = returned_sqlstate, /* P0002 */ + err_msg = message_text, /* No Data in FTDRY */ + err_detail = pg_exception_detail, /* No data in table t_test_new */ + err_hint = pg_exception_hint, /* No data error capture */ + err_context = pg_exception_context; /* PL/pgSQL function staging2.fn_ftdry_trs_block(integer,integer,text,text,integer) line 69 at RAISE*/ + + +perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'ods', 'fn_fw_ods_pto_load', err_state, err_msg, err_detail, err_hint, err_context,'error'); + + + +end +$$ +LANGUAGE plpgsql; diff --git a/onetime/dataloadfunctions/PTO/PTO_GVG_ods.sql b/onetime/dataloadfunctions/PTO/PTO_GVG_ods.sql old mode 100755 new mode 100644 index 2080e85..211f905 --- a/onetime/dataloadfunctions/PTO/PTO_GVG_ods.sql +++ b/onetime/dataloadfunctions/PTO/PTO_GVG_ods.sql @@ -158,8 +158,8 @@ select client_id, function_id, file_syspk, -model, make, +model, test_condition , c22_1, c22::numeric, @@ -177,8 +177,8 @@ select client_id, function_id, file_syspk, -model, make, +model, test_condition , c27_1, c27::numeric, @@ -196,8 +196,8 @@ select client_id, function_id, file_syspk, -model, make, +model, test_condition , c32_1, c32::numeric, @@ -209,7 +209,64 @@ file_mnemonic, file_sheet_mnemonic from staging2.PTOBEN_GVG_performance_governing_trails_block where trx_record=1 -and (c32 is not null and c33 is not null and c34 is not null and c35 is not null and c36 is not null); +and (c32 is not null and c33 is not null and c34 is not null and c35 is not null and c36 is not null) +union +select +client_id, +function_id, +file_syspk, +make, +model, +test_condition , +c37_1, +c37::numeric, +c38::numeric, +c39::numeric, +c30::numeric, +c41::numeric, +file_mnemonic, +file_sheet_mnemonic +from staging2.PTOBEN_GVG_performance_governing_trails_block +where trx_record=1 +and (c37 is not null and c38 is not null and c39 is not null and c40 is not null and c41 is not null) +union +select +client_id, +function_id, +file_syspk, +make, +model, +test_condition, +c42_1, +c42::numeric, +c43::numeric, +c44::numeric, +c45::numeric, +c46::numeric, +file_mnemonic, +file_sheet_mnemonic +from staging2.PTOBEN_GVG_performance_governing_trails_block +where trx_record=1 +and (c42 is not null and c43 is not null and c44 is not null and c45 is not null and c46 is not null) +union +select +client_id, +function_id, +file_syspk, +make, +model, +test_condition , +c47_1, +c47::numeric, +c48::numeric, +c49::numeric, +c50::numeric, +c51::numeric, +file_mnemonic, +file_sheet_mnemonic +from staging2.PTOBEN_GVG_performance_governing_trails_block +where trx_record=1 +and (c47 is not null and c48 is not null and c49 is not null and c50 is not null and c51 is not null); update transactional.PTO_Perf_Governing_Graph set test_mode = 'Normal Mode' where file_sheet_mnemonic = 'PTOBEN_GVGN' and file_syspk = __file_syspk; update transactional.PTO_Perf_Governing_Graph set test_mode = 'Boost Mode' where file_sheet_mnemonic = 'PTOBEN_GVGB' and file_syspk = __file_syspk; @@ -232,7 +289,7 @@ test_master_id = __test_master_id where file_syspk=__file_syspk and file_sheet_mnemonic =__file_sheet_mnemonic; update transactional.test_instance a -set (test_location_name,test_engineer,date_of_test) = (select place,test_engineer,TO_DATE(test_date, 'DD/MM/YYYY') from staging2.PTOBEN_PRF_Key_Performance_Parameters_block where file_syspk = __file_syspk and test_condition='observed') +set (test_location_name,test_engineer,date_of_test) = (select place,test_engineer,test_date::date from staging2.PTOBEN_PRF_Key_Performance_Parameters_block where file_syspk = __file_syspk and test_condition='observed') where file_syspk = __file_syspk; UPDATE transactional.pto_perf_governing_graph a set test_mode = CASE WHEN a.test_condition like '%Normal%' THEN 'Normal' @@ -242,6 +299,16 @@ UPDATE transactional.pto_perf_governing_graph a set test_mode = CASE WHEN a.tes ELSE NULL end; +update transactional.test_instance +set test_type = a.test_type, +test_name= a.test_name +from fw_core.test_file_sheet_format_master a +where transactional.test_instance.file_sheet_mnemonic = a.file_sheet_mnemonic +and transactional.test_instance.file_syspk=__file_syspk; + + + + err_context := ''; perform fw_core.fn_insert_db_error( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'trx', 'fn_PTO_GVG_trx', err_state, err_msg, err_detail, err_hint, err_context,'success'); return err_context; diff --git a/onetime/dataloadfunctions/PTO/PTO_GVG_stg2.sql b/onetime/dataloadfunctions/PTO/PTO_GVG_stg2.sql old mode 100755 new mode 100644 index c765813..b2a79d0 --- a/onetime/dataloadfunctions/PTO/PTO_GVG_stg2.sql +++ b/onetime/dataloadfunctions/PTO/PTO_GVG_stg2.sql @@ -1,383 +1,458 @@ -drop function if exists staging2.fn_PTO_GVG_block; -CREATE OR REPLACE FUNCTION staging2.fn_PTO_GVG_block(p_client_id int,p_function_id int, p_file_mnemonic text, -p_file_sheet_mnemonic text, p_file_syspk int) - RETURNS text AS $$ - declare __make text; - declare __model text; - - declare __client_id int :=p_client_id; - declare __function_id int :=p_function_id; - declare __file_mnemonic text :=p_file_mnemonic; - declare __file_sheet_mnemonic text :=p_file_sheet_mnemonic; - declare __file_syspk int :=p_file_syspk; - declare err_state text; - declare err_msg text; - declare err_detail text; - declare err_hint text; - declare err_context text; - declare err_query int; - declare err_block text; - - begin -/************************************************************************************ -Function Name:fn_PTOBEN_GVG_block -Function Desc: This function populates data into staging2 blocks -File Format: PTOBEN -Sheet Format: PTOBEN_GVG -Creation Date: April 27 2021 -Updation Date: -Author: compegence team -Function Call: select staging2.fn_PTO_GVG_block(1,1,'PTOBEN','PTOBEN_GVG',944) -***************************************************************************************/ - -SET search_path TO staging2; - - -/* rerunnability - delete block tables and update config tables to null */ -truncate table staging2.stg_specific_table_PTOBEN_GVG; -truncate table staging2.stg_process_table_PTOBEN_GVG; -truncate table staging2.PTOBEN_GVG_performance_governing_trails_block; - - -execute 'delete from fw_core.fw_jobctl_file_sheet_block_run_schedule where file_syspk='||p_file_syspk||' and file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; - -execute 'update transactional.source_config a -set row_number_start=null, -row_previous_number=null, -row_read_end=null, -run_time=null -where a.file_mnemonic='''||p_file_mnemonic||''' and a.file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; - -/* transfer data from generic to specific for PTOBEN */ -execute 'insert into staging2.stg_specific_table_PTOBEN_GVG -select * from staging1.staging_generic_table a -where a.file_mnemonic='''||p_file_mnemonic||''' and a.file_sheet_mnemonic='''||p_file_sheet_mnemonic||''' -and a.file_syspk='||p_file_syspk||''; - -select count(*) into err_query from staging2.stg_specific_table_PTOBEN_GVG; - -if err_query=0 then -err_context := 'data not present'; - raise exception using - message = 'No Data for pto', - detail = 'No data in table stg_specific_table_PTOBEN_PRF', - errcode = 'PTO', - hint = 'check sheet mnemonic in generic table, if it is null update it'; -end if; - - -/* trimming data */ -update staging2.stg_specific_table_PTOBEN_GVG set column3 = TRIM (TRAILING FROM column3 ); -update staging2.stg_specific_table_PTOBEN_GVG set column3 = TRIM (LEADING FROM column3 ); - -update transactional.source_config set F1_modified = TRIM (TRAILING FROM F1_modified) ; -update transactional.source_config set F1_modified = TRIM (LEADING FROM F1_modified) ; -update transactional.source_config set F1_source=F1_modified ; -update transactional.source_config set F1_source = TRIM (TRAILING FROM F1_source); -update transactional.source_config set F1_source = TRIM (LEADING FROM F1_source); - -execute 'update transactional.source_config a -set row_number_start=(select min(b.row_number) -from staging2.stg_specific_table_PTOBEN_GVG b -where trim(upper(F1_modified))=trim(upper(column2)) -and b.is_rownumber_fetched is null) -where a.row_number_start is null -and a.file_mnemonic='''||p_file_mnemonic||''' and a.file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; - -/* keyword match in config table*/ -execute 'update staging2.stg_specific_table_PTOBEN_GVG a -set is_rownumber_fetched=1 -from transactional.source_config b -where trim(upper(F1_modified))=trim(upper(column3)) -and b.row_number_start=a.row_number -and is_rownumber_fetched is null -and a.file_mnemonic='''||p_file_mnemonic||''' and a.file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; - -execute 'update transactional.source_config a set row_previous_number=row_number_start-1 -where a.file_mnemonic='''||p_file_mnemonic||''' and a.file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; - -execute 'update transactional.source_config a -set row_read_end= (select b.row_number_start -from transactional.source_config b -where b.syspk=a.syspk+1 and file_mnemonic='''||p_file_mnemonic||''' and file_sheet_mnemonic='''||p_file_sheet_mnemonic||''' ) -where a.file_mnemonic='''||p_file_mnemonic||''' and a.file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; - - -/* config file last field update as null otherwise it picks up next format row number*/ -execute 'update transactional.source_config a -set row_read_end = null ,run_time=current_timestamp -where f1_modified =''Graphs - for Example'' -and a.file_mnemonic='''||p_file_mnemonic||''' and a.file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; - -/* tagging block_row_numbers*/ - -execute 'insert into staging2.stg_process_table_PTOBEN_GVG -select a.* , RANK () OVER ( ORDER BY row_number) as block_row_number,b.block_tag as block_tag -from staging2.stg_specific_table_PTOBEN_GVG a -join transactional.source_config b -on a.row_number >=row_number_start -and (a.row_number< row_read_end or row_read_end is null) -and f1_modified=''Data Inputs'' -and b.file_mnemonic='''||p_file_mnemonic||''' and b.file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; - -execute 'insert into staging2.stg_process_table_PTOBEN_GVG -select a.* , RANK () OVER ( ORDER BY row_number) as block_row_number,b.block_tag as block_tag -from staging2.stg_specific_table_PTOBEN_GVG a -join transactional.source_config b -on a.row_number >=row_number_start -and (a.row_number< row_read_end or row_read_end is null) -and f1_modified=''Graphs - for Example'' -and b.file_mnemonic='''||p_file_mnemonic||''' and b.file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; - -select column5 into __make from staging2.stg_process_table_PTOBEN_PRF a -where block_tag='PTOBEN_PRF_Key_Performance_Parameters' and block_row_number=7 ; - -select column5 into __model from staging2.stg_process_table_PTOBEN_PRF a -where block_tag='PTOBEN_PRF_Key_Performance_Parameters' and block_row_number=9; - - -/* block PTOBEN_GVG_performance_governing_trails_block */ - -perform fw_core.fn_jobctl_block_begin(__client_id,__function_id,__file_syspk, -'PTOBEN_GVG_performance_governing_trails_block',__file_mnemonic,__file_sheet_mnemonic,1); - -err_block := 'PTOBEN_GVG_performance_governing_trails_block'; - -insert into staging2.PTOBEN_GVG_performance_governing_trails_block -( -c2, -c3, -c4, -c5, -c6, -c7, -c8, -c9, -c10, -c11, -c12, -c13, -c14, -c15, -c16, -c17, -c18, -c19, -c20, -c21, -c22, -c23, -c24, -c25, -c26, -c27, -c28, -c29, -c30, -c31, -c32, -c33, -c34, -c35, -c36, -block_row_number -) - -select column2, -column3, -column4, -column5, -column6, -column7, -column8, -column9, -column10, -column11, -column12, -column13, -column14, -column15, -column16, -column17, -column18, -column19, -column20, -column21, -column22, -column23, -column24, -column25, -column26, -column27, -column28, -column29, -column30, -column31, -column32, -column33, -column34, -column35, -column36, -block_row_number - from staging2.stg_process_table_PTOBEN_GVG a -where block_tag='PTOBEN_GVG_data_inputs'; - -update staging2.PTOBEN_GVG_performance_governing_trails_block -set test_condition=c2 -where block_row_number=2; - -update staging2.PTOBEN_GVG_performance_governing_trails_block -set c2=null -where block_row_number=2; - -update staging2.PTOBEN_GVG_performance_governing_trails_block a -set test_condition= b.first_value from (SELECT - block_row_number, test_condition, value_partition, first_value(test_condition) over (partition by value_partition order by block_row_number) -FROM ( - SELECT - block_row_number, - test_condition, - sum(case when test_condition is null then 0 else 1 end) over (order by block_row_number) as value_partition - FROM staging2.PTOBEN_GVG_performance_governing_trails_block - ORDER BY block_row_number ASC -) as q) b where a.block_row_number = b.block_row_number ; - -update staging2.PTOBEN_GVG_performance_governing_trails_block -set c1=c2 where block_row_number=5; - -update staging2.PTOBEN_GVG_performance_governing_trails_block a -set c1= b.first_value from (SELECT - block_row_number, c1, value_partition, first_value(c1) over (partition by value_partition order by block_row_number) -FROM ( - SELECT - block_row_number, - c1, - sum(case when c1 is null then 0 else 1 end) over (order by block_row_number) as value_partition - FROM staging2.PTOBEN_GVG_performance_governing_trails_block - ORDER BY block_row_number ASC -) as q) b where a.block_row_number = b.block_row_number ; - - -update staging2.PTOBEN_GVG_performance_governing_trails_block -set c7_1=c7 where block_row_number=5; - -update staging2.PTOBEN_GVG_performance_governing_trails_block a -set c7_1= b.first_value from (SELECT - block_row_number, c7_1, value_partition, first_value(c7_1) over (partition by value_partition order by block_row_number) -FROM ( - SELECT - block_row_number, - c7_1, - sum(case when c7_1 is null then 0 else 1 end) over (order by block_row_number) as value_partition - FROM staging2.PTOBEN_GVG_performance_governing_trails_block - ORDER BY block_row_number ASC -) as q) b where a.block_row_number = b.block_row_number ; - -update staging2.PTOBEN_GVG_performance_governing_trails_block -set c12_1=c12 where block_row_number=5; - -update staging2.PTOBEN_GVG_performance_governing_trails_block a -set c12_1= b.first_value from (SELECT - block_row_number, c12_1, value_partition, first_value(c12_1) over (partition by value_partition order by block_row_number) -FROM ( - SELECT - block_row_number, - c12_1, - sum(case when c12_1 is null then 0 else 1 end) over (order by block_row_number) as value_partition - FROM staging2.PTOBEN_GVG_performance_governing_trails_block - ORDER BY block_row_number ASC -) as q) b where a.block_row_number = b.block_row_number ; - -update staging2.PTOBEN_GVG_performance_governing_trails_block -set c17_1=c17 where block_row_number=5; - -update staging2.PTOBEN_GVG_performance_governing_trails_block a -set c17_1= b.first_value from (SELECT - block_row_number, c17_1, value_partition, first_value(c17_1) over (partition by value_partition order by block_row_number) -FROM ( - SELECT - block_row_number, - c17_1, - sum(case when c17_1 is null then 0 else 1 end) over (order by block_row_number) as value_partition - FROM staging2.PTOBEN_GVG_performance_governing_trails_block - ORDER BY block_row_number ASC -) as q) b where a.block_row_number = b.block_row_number ; - -update staging2.PTOBEN_GVG_performance_governing_trails_block -set c22_1=c22 where block_row_number=5; - -update staging2.PTOBEN_GVG_performance_governing_trails_block a -set c22_1= b.first_value from (SELECT - block_row_number, c22_1, value_partition, first_value(c22_1) over (partition by value_partition order by block_row_number) -FROM ( - SELECT - block_row_number, - c22_1, - sum(case when c22_1 is null then 0 else 1 end) over (order by block_row_number) as value_partition - FROM staging2.PTOBEN_GVG_performance_governing_trails_block - ORDER BY block_row_number ASC -) as q) b where a.block_row_number = b.block_row_number ; - -update staging2.PTOBEN_GVG_performance_governing_trails_block -set c27_1=c27 where block_row_number=5; - -update staging2.PTOBEN_GVG_performance_governing_trails_block a -set c27_1= b.first_value from (SELECT - block_row_number, c27_1, value_partition, first_value(c27_1) over (partition by value_partition order by block_row_number) -FROM ( - SELECT - block_row_number, - c27_1, - sum(case when c27_1 is null then 0 else 1 end) over (order by block_row_number) as value_partition - FROM staging2.PTOBEN_GVG_performance_governing_trails_block - ORDER BY block_row_number ASC -) as q) b where a.block_row_number = b.block_row_number ; - -update staging2.PTOBEN_GVG_performance_governing_trails_block -set c32_1=c32 where block_row_number=5; - -update staging2.PTOBEN_GVG_performance_governing_trails_block a -set c32_1= b.first_value from (SELECT - block_row_number, c32_1, value_partition, first_value(c32_1) over (partition by value_partition order by block_row_number) -FROM ( - SELECT - block_row_number, - c32_1, - sum(case when c32_1 is null then 0 else 1 end) over (order by block_row_number) as value_partition - FROM staging2.PTOBEN_GVG_performance_governing_trails_block - ORDER BY block_row_number ASC -) as q) b where a.block_row_number = b.block_row_number ; - - -update staging2.PTOBEN_GVG_performance_governing_trails_block -set trx_record=0 where block_row_number in (1,2,3,4,5); - - execute 'update staging2.PTOBEN_GVG_performance_governing_trails_block set client_id='||p_client_id||''; - execute 'update staging2.PTOBEN_GVG_performance_governing_trails_block set function_id='||p_function_id||''; - execute 'update staging2.PTOBEN_GVG_performance_governing_trails_block set file_mnemonic='''||p_file_mnemonic||''''; - execute 'update staging2.PTOBEN_GVG_performance_governing_trails_block set file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; - execute 'update staging2.PTOBEN_GVG_performance_governing_trails_block set file_syspk='||p_file_syspk||''; - - update staging2.PTOBEN_GVG_performance_governing_trails_block set make=__make; - update staging2.PTOBEN_GVG_performance_governing_trails_block set model=__model; - - -perform fw_core.fn_jobctl_block_end(__file_syspk,'PTOBEN_GVG_performance_governing_trails_block'); - - err_context := ''; -perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'stg2', 'fn_PTO_GVG_block', err_state, err_msg, err_detail, err_hint, err_context,'success'); -return err_context; - -EXCEPTION when OTHERS then - -GET STACKED DIAGNOSTICS - err_state = returned_sqlstate, - err_msg = message_text, - err_detail = pg_exception_detail, - err_hint = pg_exception_hint, - err_context = pg_exception_context; - - perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'stg2', 'fn_PTO_GVG_block', err_state, err_msg, err_detail, err_hint, err_context,'error'); -return err_context; -end -$$ LANGUAGE plpgsql; +drop function if exists staging2.fn_PTO_GVG_block; +CREATE OR REPLACE FUNCTION staging2.fn_PTO_GVG_block(p_client_id int,p_function_id int, p_file_mnemonic text, +p_file_sheet_mnemonic text, p_file_syspk int) + RETURNS text AS $$ + declare __make text; + declare __model text; + + declare __client_id int :=p_client_id; + declare __function_id int :=p_function_id; + declare __file_mnemonic text :=p_file_mnemonic; + declare __file_sheet_mnemonic text :=p_file_sheet_mnemonic; + declare __file_syspk int :=p_file_syspk; + declare err_state text; + declare err_msg text; + declare err_detail text; + declare err_hint text; + declare err_context text; + declare err_query int; + declare err_block text; + + begin +/************************************************************************************ +Function Name:fn_PTOBEN_GVG_block +Function Desc: This function populates data into staging2 blocks +File Format: PTOBEN +Sheet Format: PTOBEN_GVG +Creation Date: April 27 2021 +Updation Date: +Author: compegence team +Function Call: select staging2.fn_PTO_GVG_block(1,1,'PTOBEN','PTOBEN_GVG',944) +***************************************************************************************/ + +SET search_path TO staging2; + + +/* rerunnability - delete block tables and update config tables to null */ +truncate table staging2.stg_specific_table_PTOBEN_GVG; +truncate table staging2.stg_process_table_PTOBEN_GVG; +truncate table staging2.PTOBEN_GVG_performance_governing_trails_block; + + +execute 'delete from fw_core.fw_jobctl_file_sheet_block_run_schedule where file_syspk='||p_file_syspk||' and file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; + +execute 'update transactional.source_config a +set row_number_start=null, +row_previous_number=null, +row_read_end=null, +run_time=null +where a.file_mnemonic='''||p_file_mnemonic||''' and a.file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; + +/* transfer data from generic to specific for PTOBEN */ +execute 'insert into staging2.stg_specific_table_PTOBEN_GVG +select * from staging1.staging_generic_table a +where a.file_mnemonic='''||p_file_mnemonic||''' and a.file_sheet_mnemonic='''||p_file_sheet_mnemonic||''' +and a.file_syspk='||p_file_syspk||''; + +select count(*) into err_query from staging2.stg_specific_table_PTOBEN_GVG; + +if err_query=0 then +err_context := 'data not present'; + raise exception using + message = 'No Data for pto', + detail = 'No data in table stg_specific_table_PTOBEN_PRF', + errcode = 'PTO', + hint = 'check sheet mnemonic in generic table, if it is null update it'; +end if; + + +/* trimming data */ +update staging2.stg_specific_table_PTOBEN_GVG set column3 = TRIM (TRAILING FROM column3 ); +update staging2.stg_specific_table_PTOBEN_GVG set column3 = TRIM (LEADING FROM column3 ); + +update transactional.source_config set F1_modified = TRIM (TRAILING FROM F1_modified) ; +update transactional.source_config set F1_modified = TRIM (LEADING FROM F1_modified) ; +update transactional.source_config set F1_source=F1_modified ; +update transactional.source_config set F1_source = TRIM (TRAILING FROM F1_source); +update transactional.source_config set F1_source = TRIM (LEADING FROM F1_source); + +execute 'update transactional.source_config a +set row_number_start=(select min(b.row_number) +from staging2.stg_specific_table_PTOBEN_GVG b +where trim(upper(F1_modified))=trim(upper(column2)) +and b.is_rownumber_fetched is null) +where a.row_number_start is null +and a.file_mnemonic='''||p_file_mnemonic||''' and a.file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; + +/* keyword match in config table*/ +execute 'update staging2.stg_specific_table_PTOBEN_GVG a +set is_rownumber_fetched=1 +from transactional.source_config b +where trim(upper(F1_modified))=trim(upper(column3)) +and b.row_number_start=a.row_number +and is_rownumber_fetched is null +and a.file_mnemonic='''||p_file_mnemonic||''' and a.file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; + +execute 'update transactional.source_config a set row_previous_number=row_number_start-1 +where a.file_mnemonic='''||p_file_mnemonic||''' and a.file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; + +execute 'update transactional.source_config a +set row_read_end= (select b.row_number_start +from transactional.source_config b +where b.syspk=a.syspk+1 and file_mnemonic='''||p_file_mnemonic||''' and file_sheet_mnemonic='''||p_file_sheet_mnemonic||''' ) +where a.file_mnemonic='''||p_file_mnemonic||''' and a.file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; + + +/* config file last field update as null otherwise it picks up next format row number*/ +execute 'update transactional.source_config a +set row_read_end = null ,run_time=current_timestamp +where f1_modified =''Graphs - for Example'' +and a.file_mnemonic='''||p_file_mnemonic||''' and a.file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; + +/* tagging block_row_numbers*/ + +execute 'insert into staging2.stg_process_table_PTOBEN_GVG +select a.* , RANK () OVER ( ORDER BY row_number) as block_row_number,b.block_tag as block_tag +from staging2.stg_specific_table_PTOBEN_GVG a +join transactional.source_config b +on a.row_number >=row_number_start +and (a.row_number< row_read_end or row_read_end is null) +and f1_modified=''Data Inputs'' +and b.file_mnemonic='''||p_file_mnemonic||''' and b.file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; + +execute 'insert into staging2.stg_process_table_PTOBEN_GVG +select a.* , RANK () OVER ( ORDER BY row_number) as block_row_number,b.block_tag as block_tag +from staging2.stg_specific_table_PTOBEN_GVG a +join transactional.source_config b +on a.row_number >=row_number_start +and (a.row_number< row_read_end or row_read_end is null) +and f1_modified=''Graphs - for Example'' +and b.file_mnemonic='''||p_file_mnemonic||''' and b.file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; + +select column5 into __make from staging2.stg_process_table_PTOBEN_PRF a +where block_tag='PTOBEN_PRF_Key_Performance_Parameters' and block_row_number=7 ; + +select column5 into __model from staging2.stg_process_table_PTOBEN_PRF a +where block_tag='PTOBEN_PRF_Key_Performance_Parameters' and block_row_number=9; + + +/* block PTOBEN_GVG_performance_governing_trails_block */ + +perform fw_core.fn_jobctl_block_begin(__client_id,__function_id,__file_syspk, +'PTOBEN_GVG_performance_governing_trails_block',__file_mnemonic,__file_sheet_mnemonic,1); + +err_block := 'PTOBEN_GVG_performance_governing_trails_block'; + +insert into staging2.PTOBEN_GVG_performance_governing_trails_block +( +c2, +c3, +c4, +c5, +c6, +c7, +c8, +c9, +c10, +c11, +c12, +c13, +c14, +c15, +c16, +c17, +c18, +c19, +c20, +c21, +c22, +c23, +c24, +c25, +c26, +c27, +c28, +c29, +c30, +c31, +c32, +c33, +c34, +c35, +c36, +c37, +c38, +c39, +c40, +c41, +c42, +c43, +c44, +c45, +c46, +c47, +c48, +c49, +c50, +c51, +block_row_number +) + +select column2, +column3, +column4, +column5, +column6, +column7, +column8, +column9, +column10, +column11, +column12, +column13, +column14, +column15, +column16, +column17, +column18, +column19, +column20, +column21, +column22, +column23, +column24, +column25, +column26, +column27, +column28, +column29, +column30, +column31, +column32, +column33, +column34, +column35, +column36, +column37, +column38, +column39, +column40, +column41, +column42, +column43, +column44, +column45, +column46, +column47, +column48, +column49, +column50, +column51, +block_row_number + from staging2.stg_process_table_PTOBEN_GVG a +where block_tag='PTOBEN_GVG_data_inputs'; + +update staging2.PTOBEN_GVG_performance_governing_trails_block +set test_condition=c2 +where block_row_number=2; + +update staging2.PTOBEN_GVG_performance_governing_trails_block +set c2=null +where block_row_number=2; + +update staging2.PTOBEN_GVG_performance_governing_trails_block a +set test_condition= b.first_value from (SELECT + block_row_number, test_condition, value_partition, first_value(test_condition) over (partition by value_partition order by block_row_number) +FROM ( + SELECT + block_row_number, + test_condition, + sum(case when test_condition is null then 0 else 1 end) over (order by block_row_number) as value_partition + FROM staging2.PTOBEN_GVG_performance_governing_trails_block + ORDER BY block_row_number ASC +) as q) b where a.block_row_number = b.block_row_number ; + +update staging2.PTOBEN_GVG_performance_governing_trails_block +set c1=c2 where block_row_number=5; + +update staging2.PTOBEN_GVG_performance_governing_trails_block a +set c1= b.first_value from (SELECT + block_row_number, c1, value_partition, first_value(c1) over (partition by value_partition order by block_row_number) +FROM ( + SELECT + block_row_number, + c1, + sum(case when c1 is null then 0 else 1 end) over (order by block_row_number) as value_partition + FROM staging2.PTOBEN_GVG_performance_governing_trails_block + ORDER BY block_row_number ASC +) as q) b where a.block_row_number = b.block_row_number ; + + +update staging2.PTOBEN_GVG_performance_governing_trails_block +set c7_1=c7 where block_row_number=5; + +update staging2.PTOBEN_GVG_performance_governing_trails_block a +set c7_1= b.first_value from (SELECT + block_row_number, c7_1, value_partition, first_value(c7_1) over (partition by value_partition order by block_row_number) +FROM ( + SELECT + block_row_number, + c7_1, + sum(case when c7_1 is null then 0 else 1 end) over (order by block_row_number) as value_partition + FROM staging2.PTOBEN_GVG_performance_governing_trails_block + ORDER BY block_row_number ASC +) as q) b where a.block_row_number = b.block_row_number ; + +update staging2.PTOBEN_GVG_performance_governing_trails_block +set c12_1=c12 where block_row_number=5; + +update staging2.PTOBEN_GVG_performance_governing_trails_block a +set c12_1= b.first_value from (SELECT + block_row_number, c12_1, value_partition, first_value(c12_1) over (partition by value_partition order by block_row_number) +FROM ( + SELECT + block_row_number, + c12_1, + sum(case when c12_1 is null then 0 else 1 end) over (order by block_row_number) as value_partition + FROM staging2.PTOBEN_GVG_performance_governing_trails_block + ORDER BY block_row_number ASC +) as q) b where a.block_row_number = b.block_row_number ; + +update staging2.PTOBEN_GVG_performance_governing_trails_block +set c17_1=c17 where block_row_number=5; + +update staging2.PTOBEN_GVG_performance_governing_trails_block a +set c17_1= b.first_value from (SELECT + block_row_number, c17_1, value_partition, first_value(c17_1) over (partition by value_partition order by block_row_number) +FROM ( + SELECT + block_row_number, + c17_1, + sum(case when c17_1 is null then 0 else 1 end) over (order by block_row_number) as value_partition + FROM staging2.PTOBEN_GVG_performance_governing_trails_block + ORDER BY block_row_number ASC +) as q) b where a.block_row_number = b.block_row_number ; + +update staging2.PTOBEN_GVG_performance_governing_trails_block +set c22_1=c22 where block_row_number=5; + +update staging2.PTOBEN_GVG_performance_governing_trails_block a +set c22_1= b.first_value from (SELECT + block_row_number, c22_1, value_partition, first_value(c22_1) over (partition by value_partition order by block_row_number) +FROM ( + SELECT + block_row_number, + c22_1, + sum(case when c22_1 is null then 0 else 1 end) over (order by block_row_number) as value_partition + FROM staging2.PTOBEN_GVG_performance_governing_trails_block + ORDER BY block_row_number ASC +) as q) b where a.block_row_number = b.block_row_number ; + +update staging2.PTOBEN_GVG_performance_governing_trails_block +set c27_1=c27 where block_row_number=5; + +update staging2.PTOBEN_GVG_performance_governing_trails_block a +set c27_1= b.first_value from (SELECT + block_row_number, c27_1, value_partition, first_value(c27_1) over (partition by value_partition order by block_row_number) +FROM ( + SELECT + block_row_number, + c27_1, + sum(case when c27_1 is null then 0 else 1 end) over (order by block_row_number) as value_partition + FROM staging2.PTOBEN_GVG_performance_governing_trails_block + ORDER BY block_row_number ASC +) as q) b where a.block_row_number = b.block_row_number ; + +update staging2.PTOBEN_GVG_performance_governing_trails_block +set c32_1=c32 where block_row_number=5; + +update staging2.PTOBEN_GVG_performance_governing_trails_block a +set c32_1= b.first_value from (SELECT + block_row_number, c32_1, value_partition, first_value(c32_1) over (partition by value_partition order by block_row_number) +FROM ( + SELECT + block_row_number, + c32_1, + sum(case when c32_1 is null then 0 else 1 end) over (order by block_row_number) as value_partition + FROM staging2.PTOBEN_GVG_performance_governing_trails_block + ORDER BY block_row_number ASC +) as q) b where a.block_row_number = b.block_row_number ; + +update staging2.PTOBEN_GVG_performance_governing_trails_block +set c37_1=c37 where block_row_number=5; + +update staging2.PTOBEN_GVG_performance_governing_trails_block a +set c37_1= b.first_value from (SELECT + block_row_number, c37_1, value_partition, first_value(c37_1) over (partition by value_partition order by block_row_number) +FROM ( + SELECT + block_row_number, + c37_1, + sum(case when c37_1 is null then 0 else 1 end) over (order by block_row_number) as value_partition + FROM staging2.PTOBEN_GVG_performance_governing_trails_block + ORDER BY block_row_number ASC +) as q) b where a.block_row_number = b.block_row_number ; + +update staging2.PTOBEN_GVG_performance_governing_trails_block +set c42_1=c42 where block_row_number=5; + +update staging2.PTOBEN_GVG_performance_governing_trails_block a +set c42_1= b.first_value from (SELECT + block_row_number, c42_1, value_partition, first_value(c42_1) over (partition by value_partition order by block_row_number) +FROM ( + SELECT + block_row_number, + c42_1, + sum(case when c42_1 is null then 0 else 1 end) over (order by block_row_number) as value_partition + FROM staging2.PTOBEN_GVG_performance_governing_trails_block + ORDER BY block_row_number ASC +) as q) b where a.block_row_number = b.block_row_number ; + +update staging2.PTOBEN_GVG_performance_governing_trails_block +set c47_1=c47 where block_row_number=5; + +update staging2.PTOBEN_GVG_performance_governing_trails_block a +set c47_1= b.first_value from (SELECT + block_row_number, c47_1, value_partition, first_value(c47_1) over (partition by value_partition order by block_row_number) +FROM ( + SELECT + block_row_number, + c47_1, + sum(case when c47_1 is null then 0 else 1 end) over (order by block_row_number) as value_partition + FROM staging2.PTOBEN_GVG_performance_governing_trails_block + ORDER BY block_row_number ASC +) as q) b where a.block_row_number = b.block_row_number ; + + +update staging2.PTOBEN_GVG_performance_governing_trails_block +set trx_record=0 where block_row_number in (1,2,3,4,5); + + execute 'update staging2.PTOBEN_GVG_performance_governing_trails_block set client_id='||p_client_id||''; + execute 'update staging2.PTOBEN_GVG_performance_governing_trails_block set function_id='||p_function_id||''; + execute 'update staging2.PTOBEN_GVG_performance_governing_trails_block set file_mnemonic='''||p_file_mnemonic||''''; + execute 'update staging2.PTOBEN_GVG_performance_governing_trails_block set file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; + execute 'update staging2.PTOBEN_GVG_performance_governing_trails_block set file_syspk='||p_file_syspk||''; + + update staging2.PTOBEN_GVG_performance_governing_trails_block set make=__make; + update staging2.PTOBEN_GVG_performance_governing_trails_block set model=__model; + + +perform fw_core.fn_jobctl_block_end(__file_syspk,'PTOBEN_GVG_performance_governing_trails_block'); + + err_context := ''; +perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'stg2', 'fn_PTO_GVG_block', err_state, err_msg, err_detail, err_hint, err_context,'success'); +return err_context; + +EXCEPTION when OTHERS then + +GET STACKED DIAGNOSTICS + err_state = returned_sqlstate, + err_msg = message_text, + err_detail = pg_exception_detail, + err_hint = pg_exception_hint, + err_context = pg_exception_context; + + perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'stg2', 'fn_PTO_GVG_block', err_state, err_msg, err_detail, err_hint, err_context,'error'); +return err_context; +end +$$ LANGUAGE plpgsql; diff --git a/onetime/dataloadfunctions/PTO/PTO_MPM_ods.sql b/onetime/dataloadfunctions/PTO/PTO_MPM_ods.sql index c06bcd1..7f96ce4 100755 --- a/onetime/dataloadfunctions/PTO/PTO_MPM_ods.sql +++ b/onetime/dataloadfunctions/PTO/PTO_MPM_ods.sql @@ -101,7 +101,7 @@ test_master_id = __test_master_id where file_syspk=__file_syspk and file_sheet_mnemonic =__file_sheet_mnemonic; update transactional.test_instance a -set (test_location_name,test_engineer,date_of_test) = (select place,test_engineer,TO_DATE(test_date, 'DD/MM/YYYY') from staging2.PTOBEN_PRF_Key_Performance_Parameters_block where file_syspk = __file_syspk and test_condition='observed') +set (test_location_name,test_engineer,date_of_test) = (select place,test_engineer,test_date::date from staging2.PTOBEN_PRF_Key_Performance_Parameters_block where file_syspk = __file_syspk and test_condition='observed') where file_syspk = __file_syspk; UPDATE transactional.pto_multipoint_mapping a set test_mode = CASE WHEN a.test_condition like '%Normal%' THEN 'Normal' @@ -111,6 +111,20 @@ UPDATE transactional.pto_multipoint_mapping a set test_mode = CASE WHEN a.test_ ELSE NULL end; + + + + + +update transactional.test_instance +set test_type = a.test_type, +test_name= a.test_name +from fw_core.test_file_sheet_format_master a +where transactional.test_instance.file_sheet_mnemonic = a.file_sheet_mnemonic +and transactional.test_instance.file_syspk=__file_syspk; + + + err_context := ''; perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'trx', 'fn_PTO_MPM_TRX', err_state, err_msg, err_detail, err_hint, err_context,'success'); return err_context; diff --git a/onetime/dataloadfunctions/PTO/PTO_PRF_ods.sql b/onetime/dataloadfunctions/PTO/PTO_PRF_ods.sql index 7f9dfe8..1f5fefc 100755 --- a/onetime/dataloadfunctions/PTO/PTO_PRF_ods.sql +++ b/onetime/dataloadfunctions/PTO/PTO_PRF_ods.sql @@ -83,7 +83,7 @@ tractor_serial_number from staging2.ptoben_prf_tractor_specs_block where trx_record=1; update transactional.test_instance a -set (test_location_name,test_engineer,date_of_test) = (select place,test_engineer,TO_DATE(test_date, 'DD/MM/YYYY') from staging2.PTOBEN_PRF_Key_Performance_Parameters_block where file_syspk = __file_syspk and test_condition='observed') +set (test_location_name,test_engineer,date_of_test) = (select place,test_engineer,test_date::date from staging2.PTOBEN_PRF_Key_Performance_Parameters_block where file_syspk = __file_syspk and test_condition='observed') where file_syspk = __file_syspk; update transactional.test_instance @@ -174,7 +174,7 @@ exhaust_temperature_c, relative_humidity_pct, coolant_water_pct, test_engineer,test_bed,place,total_run_hrs::int, -TO_DATE(test_date, 'DD/MM/YYYY') , +test_date::date , tooled_up, 'Compegence' from staging2.ptoben_prf_key_performance_parameters_block @@ -238,7 +238,7 @@ brake_torque_n_m, brake_torque_kg_m, power_kw, power_hp, -eq_cblock_row_number_torque_nm, +eq_crank_torque_nm, fuel_consumption_kg_per_hr, fuel_consumption_gm_per_hp_hr, fuel_consumption_kg_per_kwh, @@ -296,7 +296,7 @@ brake_torque_n_m, brake_torque_kg_m, power_kw, power_hp, -eq_cblock_row_number_torque_nm, +eq_crank_torque_nm, fuel_consumption_kg_per_hr, fuel_consumption_gm_per_hp_hr, fuel_consumption_kg_per_kwh, @@ -358,7 +358,7 @@ brake_torque_n_m, brake_torque_kg_m, power_kw, power_hp, -eq_cblock_row_number_torque_nm, +eq_crank_torque_nm, fuel_consumption_kg_per_hr, fuel_consumption_gm_per_hp_hr, fuel_consumption_kg_per_kwh, @@ -417,7 +417,7 @@ brake_torque_n_m, brake_torque_kg_m, power_kw, power_hp, -eq_cblock_row_number_torque_nm, +eq_crank_torque_nm, fuel_consumption_kg_per_hr, fuel_consumption_gm_per_hp_hr, fuel_consumption_kg_per_kwh, @@ -475,7 +475,7 @@ brake_torque_n_m, brake_torque_kg_m, power_kw, power_hp, -eq_cblock_row_number_torque_nm, +eq_crank_torque_nm, fuel_consumption_kg_per_hr, fuel_consumption_gm_per_hp_hr, fuel_consumption_kg_per_kwh, @@ -531,7 +531,7 @@ brake_torque_n_m, brake_torque_kg_m, power_kw, power_hp, -eq_cblock_row_number_torque_nm, +eq_crank_torque_nm, fuel_consumption_kg_per_hr, fuel_consumption_gm_per_hp_hr, fuel_consumption_kg_per_kwh, @@ -670,6 +670,16 @@ set test_instance_id=__test_instance_id, test_instance_tractor_id = __test_instance_tractor_id where file_syspk=__file_syspk; + +update transactional.test_instance +set test_type = a.test_type, +test_name= a.test_name +from fw_core.test_file_sheet_format_master a +where transactional.test_instance.file_sheet_mnemonic = a.file_sheet_mnemonic +and transactional.test_instance.file_syspk=__file_syspk; + + + err_context := ''; perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'trx', 'fn_PTO_PRF_TRX', err_state, err_msg, err_detail, err_hint, err_context,'success'); return err_context; diff --git a/onetime/dataloadfunctions/budni/BUDNI_ARC_ODS.sql b/onetime/dataloadfunctions/budni/BUDNI_ARC_ODS.sql index 239f501..bc0b767 100755 --- a/onetime/dataloadfunctions/budni/BUDNI_ARC_ODS.sql +++ b/onetime/dataloadfunctions/budni/BUDNI_ARC_ODS.sql @@ -201,7 +201,7 @@ from staging2.BUDNI_ARC_test_obs_summary_block where trx_record=1; select syspk into __test_instance_id from transactional.test_instance where file_syspk =__file_syspk; select tractor_model into __model from transactional.test_instance where file_syspk =__file_syspk; select tractor_make into __make from transactional.test_instance where file_syspk =__file_syspk; -select syspk from transactional.test_master into __test_master_id where test_type ='BUDNI'; +select syspk from transactional.test_master into __test_master_id where test_type ='Budni'; select syspk into __test_instance_tractor_id from transactional.test_instance_tractor_info where file_syspk =__file_syspk; @@ -240,6 +240,26 @@ tractor_make=__make where file_syspk=__file_syspk; +update transactional.test_instance +set test_type = a.test_type, +test_name= a.test_name +from fw_core.test_file_sheet_format_master a +where transactional.test_instance.file_sheet_mnemonic = a.file_sheet_mnemonic +and transactional.test_instance.file_syspk=__file_syspk; + +update transactional.test_instance +set test_file_name =(select a.file_name from staging1.staging_generic_table a where file_syspk = __file_syspk limit 1) +where file_syspk = __file_syspk; + + +update transactional.test_instance b +set date_of_test = (select a.date_of_test from transactional.test_instance a where a.date_Of_test is not null and a.file_syspk = __file_syspk and a.file_mnemonic = 'BUDNI' and file_sheet_mnemonic='BUDNI_PTO')::date +where +b.date_Of_test is null +and b.file_syspk = __file_syspk +and b.file_mnemonic = 'BUDNI'; + + perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'trx', 'fn_BUDNI_ARC_TRX', err_state, err_msg, err_detail, err_hint, err_context,'success'); end diff --git a/onetime/dataloadfunctions/budni/BUDNI_BRK_ODS.sql b/onetime/dataloadfunctions/budni/BUDNI_BRK_ODS.sql index 20d287f..a97325a 100755 --- a/onetime/dataloadfunctions/budni/BUDNI_BRK_ODS.sql +++ b/onetime/dataloadfunctions/budni/BUDNI_BRK_ODS.sql @@ -451,7 +451,7 @@ from staging2.BUDNI_BRK_test_obs_summary_block where trx_record=1; select syspk into __test_instance_id from transactional.test_instance where file_syspk =__file_syspk; select tractor_model into __model from transactional.test_instance where file_syspk =__file_syspk; select tractor_make into __make from transactional.test_instance where file_syspk =__file_syspk; -select syspk from transactional.test_master into __test_master_id where test_type ='BUDNI'; +select syspk from transactional.test_master into __test_master_id where test_type ='Budni'; select syspk into __test_instance_tractor_id from transactional.test_instance_tractor_info where file_syspk =__file_syspk; update transactional.test_instance @@ -495,6 +495,27 @@ tractor_model =__model, tractor_make=__make where file_syspk=__file_syspk; + + +update transactional.test_instance +set test_type = a.test_type, +test_name= a.test_name +from fw_core.test_file_sheet_format_master a +where transactional.test_instance.file_sheet_mnemonic = a.file_sheet_mnemonic +and transactional.test_instance.file_syspk=__file_syspk; + +update transactional.test_instance +set test_file_name =(select a.file_name from staging1.staging_generic_table a where file_syspk = __file_syspk limit 1) +where file_syspk = __file_syspk; + + +update transactional.test_instance b +set date_of_test = (select a.date_of_test from transactional.test_instance a where a.date_Of_test is not null and a.file_syspk = __file_syspk and a.file_mnemonic = 'BUDNI' and file_sheet_mnemonic='BUDNI_PTO')::date +where +b.date_Of_test is null +and b.file_syspk = __file_syspk +and b.file_mnemonic = 'BUDNI'; + perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'trx', 'fn_BUDNI_BRK_TRX', err_state, err_msg, err_detail, err_hint, err_context,'success'); end diff --git a/onetime/dataloadfunctions/budni/BUDNI_DBP_ODS.sql b/onetime/dataloadfunctions/budni/BUDNI_DBP_ODS.sql index f97d2ed..cb7bd5e 100755 --- a/onetime/dataloadfunctions/budni/BUDNI_DBP_ODS.sql +++ b/onetime/dataloadfunctions/budni/BUDNI_DBP_ODS.sql @@ -163,7 +163,7 @@ from staging2.BUDNI_DBP_Drawbar_Perf_Block where trx_record = 1; select syspk into __test_instance_id from transactional.test_instance where file_syspk =__file_syspk; select tractor_model into __model from transactional.test_instance where file_syspk =__file_syspk; select tractor_make into __make from transactional.test_instance where file_syspk =__file_syspk; -select syspk from transactional.test_master into __test_master_id where test_type ='BUDNI'; +select syspk from transactional.test_master into __test_master_id where test_type ='Budni'; select syspk into __test_instance_tractor_id from transactional.test_instance_tractor_info where file_syspk =__file_syspk; @@ -195,6 +195,28 @@ tractor_model =__model, tractor_make=__make where file_syspk=__file_syspk; + +update transactional.test_instance +set test_type = a.test_type, +test_name= a.test_name +from fw_core.test_file_sheet_format_master a +where transactional.test_instance.file_sheet_mnemonic = a.file_sheet_mnemonic +and transactional.test_instance.file_syspk=__file_syspk; + + +update transactional.test_instance +set test_file_name =(select a.file_name from staging1.staging_generic_table a where file_syspk = __file_syspk limit 1) +where file_syspk = __file_syspk; + + +update transactional.test_instance b +set date_of_test = (select a.date_of_test from transactional.test_instance a where a.date_Of_test is not null and a.file_syspk = __file_syspk and a.file_mnemonic = 'BUDNI' and file_sheet_mnemonic='BUDNI_PTO')::date +where +b.date_Of_test is null +and b.file_syspk = __file_syspk +and b.file_mnemonic = 'BUDNI'; + + perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'trx', 'fn_BUDNI_DBP_TRX', err_state, err_msg, err_detail, err_hint, err_context,'success'); end diff --git a/onetime/dataloadfunctions/budni/BUDNI_FLD_ODS.sql b/onetime/dataloadfunctions/budni/BUDNI_FLD_ODS.sql index a05278c..f8844a6 100755 --- a/onetime/dataloadfunctions/budni/BUDNI_FLD_ODS.sql +++ b/onetime/dataloadfunctions/budni/BUDNI_FLD_ODS.sql @@ -347,7 +347,7 @@ from staging2.budni_fld_test_obs_summary_block where trx_record=1; select syspk into __test_instance_id from transactional.test_instance where file_syspk =__file_syspk; select tractor_model into __model from transactional.test_instance where file_syspk =__file_syspk; select tractor_make into __make from transactional.test_instance where file_syspk =__file_syspk; -select syspk from transactional.test_master into __test_master_id where test_type ='BUDNI'; +select syspk from transactional.test_master into __test_master_id where test_type ='Budni'; select syspk into __test_instance_tractor_id from transactional.test_instance_tractor_info where file_syspk =__file_syspk; @@ -392,6 +392,28 @@ tractor_model =__model, tractor_make=__make where file_syspk=__file_syspk; + + +update transactional.test_instance +set test_type = a.test_type, +test_name= a.test_name +from fw_core.test_file_sheet_format_master a +where transactional.test_instance.file_sheet_mnemonic = a.file_sheet_mnemonic +and transactional.test_instance.file_syspk=__file_syspk; + +update transactional.test_instance +set test_file_name =(select a.file_name from staging1.staging_generic_table a where file_syspk = __file_syspk limit 1) +where file_syspk = __file_syspk; + + +update transactional.test_instance b +set date_of_test = (select a.date_of_test from transactional.test_instance a where a.date_Of_test is not null and a.file_syspk = __file_syspk and a.file_mnemonic = 'BUDNI' and file_sheet_mnemonic='BUDNI_PTO')::date +where +b.date_Of_test is null +and b.file_syspk = __file_syspk +and b.file_mnemonic = 'BUDNI'; + + perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'trx', 'fn_budni_fld_TRX', err_state, err_msg, err_detail, err_hint, err_context,'success'); end diff --git a/onetime/dataloadfunctions/budni/BUDNI_HDL_ODS.sql b/onetime/dataloadfunctions/budni/BUDNI_HDL_ODS.sql index ef9e3a9..734c419 100755 --- a/onetime/dataloadfunctions/budni/BUDNI_HDL_ODS.sql +++ b/onetime/dataloadfunctions/budni/BUDNI_HDL_ODS.sql @@ -293,7 +293,7 @@ where trx_record=1 select syspk into __test_instance_id from transactional.test_instance where file_syspk =__file_syspk; select tractor_model into __model from transactional.test_instance where file_syspk =__file_syspk; select tractor_make into __make from transactional.test_instance where file_syspk =__file_syspk; -select syspk from transactional.test_master into __test_master_id where test_type ='BUDNI'; +select syspk from transactional.test_master into __test_master_id where test_type ='Budni'; select syspk into __test_instance_tractor_id from transactional.test_instance_tractor_info where file_syspk =__file_syspk; @@ -353,6 +353,29 @@ tractor_model =__model, tractor_make=__make where file_syspk=__file_syspk; + + +update transactional.test_instance +set test_type = a.test_type, +test_name= a.test_name +from fw_core.test_file_sheet_format_master a +where transactional.test_instance.file_sheet_mnemonic = a.file_sheet_mnemonic +and transactional.test_instance.file_syspk=__file_syspk; + +update transactional.test_instance +set test_file_name =(select a.file_name from staging1.staging_generic_table a where file_syspk = __file_syspk limit 1) +where file_syspk = __file_syspk; + + +update transactional.test_instance b +set date_of_test = (select a.date_of_test from transactional.test_instance a where a.date_Of_test is not null and a.file_syspk = __file_syspk and a.file_mnemonic = 'BUDNI' and file_sheet_mnemonic='BUDNI_PTO')::date +where +b.date_Of_test is null +and b.file_syspk = __file_syspk +and b.file_mnemonic = 'BUDNI'; + + + perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'trx', 'fn_BUDNI_HDL_TRX', err_state, err_msg, err_detail, err_hint, err_context,'success'); end diff --git a/onetime/dataloadfunctions/budni/BUDNI_HLG_ODS.sql b/onetime/dataloadfunctions/budni/BUDNI_HLG_ODS.sql index 04387f9..5158330 100755 --- a/onetime/dataloadfunctions/budni/BUDNI_HLG_ODS.sql +++ b/onetime/dataloadfunctions/budni/BUDNI_HLG_ODS.sql @@ -208,7 +208,7 @@ from staging2.budni_hlg_test_obs_summary_block where trx_record=1; select syspk into __test_instance_id from transactional.test_instance where file_syspk =__file_syspk; select tractor_model into __model from transactional.test_instance where file_syspk =__file_syspk; select tractor_make into __make from transactional.test_instance where file_syspk =__file_syspk; -select syspk from transactional.test_master into __test_master_id where test_type ='BUDNI'; +select syspk from transactional.test_master into __test_master_id where test_type ='Budni'; select syspk into __test_instance_tractor_id from transactional.test_instance_tractor_info where file_syspk =__file_syspk; @@ -248,6 +248,28 @@ tractor_model =__model, tractor_make=__make where file_syspk=__file_syspk; + + +update transactional.test_instance +set test_type = a.test_type, +test_name= a.test_name +from fw_core.test_file_sheet_format_master a +where transactional.test_instance.file_sheet_mnemonic = a.file_sheet_mnemonic +and transactional.test_instance.file_syspk=__file_syspk; + +update transactional.test_instance +set test_file_name =(select a.file_name from staging1.staging_generic_table a where file_syspk = __file_syspk limit 1) +where file_syspk = __file_syspk; + + +update transactional.test_instance b +set date_of_test = (select a.date_of_test from transactional.test_instance a where a.date_Of_test is not null and a.file_syspk = __file_syspk and a.file_mnemonic = 'BUDNI' and file_sheet_mnemonic='BUDNI_PTO')::date +where +b.date_Of_test is null +and b.file_syspk = __file_syspk +and b.file_mnemonic = 'BUDNI'; + + perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'trx', 'fn_budni_hlg_TRX', err_state, err_msg, err_detail, err_hint, err_context,'success'); end diff --git a/onetime/dataloadfunctions/budni/BUDNI_LCG_ODS.sql b/onetime/dataloadfunctions/budni/BUDNI_LCG_ODS.sql index b03c96e..ed78fa4 100755 --- a/onetime/dataloadfunctions/budni/BUDNI_LCG_ODS.sql +++ b/onetime/dataloadfunctions/budni/BUDNI_LCG_ODS.sql @@ -158,7 +158,7 @@ from staging2.budni_lcg_gravity_test_block where trx_record=1; select syspk into __test_instance_id from transactional.test_instance where file_syspk =__file_syspk; select tractor_model into __model from transactional.test_instance where file_syspk =__file_syspk; select tractor_make into __make from transactional.test_instance where file_syspk =__file_syspk; -select syspk from transactional.test_master into __test_master_id where test_type ='BUDNI'; +select syspk from transactional.test_master into __test_master_id where test_type ='Budni'; select syspk into __test_instance_tractor_id from transactional.test_instance_tractor_info where file_syspk =__file_syspk; @@ -189,6 +189,29 @@ tractor_model =__model, tractor_make=__make where file_syspk=__file_syspk; + + + +update transactional.test_instance +set test_type = a.test_type, +test_name= a.test_name +from fw_core.test_file_sheet_format_master a +where transactional.test_instance.file_sheet_mnemonic = a.file_sheet_mnemonic +and transactional.test_instance.file_syspk=__file_syspk; + +update transactional.test_instance +set test_file_name =(select a.file_name from staging1.staging_generic_table a where file_syspk = __file_syspk limit 1) +where file_syspk = __file_syspk; + + +update transactional.test_instance b +set date_of_test = (select a.date_of_test from transactional.test_instance a where a.date_Of_test is not null and a.file_syspk = __file_syspk and a.file_mnemonic = 'BUDNI' and file_sheet_mnemonic='BUDNI_PTO')::date +where +b.date_Of_test is null +and b.file_syspk = __file_syspk +and b.file_mnemonic = 'BUDNI'; + + perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'trx', 'fn_BUDNI_LCG_TRX', err_state, err_msg, err_detail, err_hint, err_context,'success'); end diff --git a/onetime/dataloadfunctions/budni/BUDNI_NMT_ODS.sql b/onetime/dataloadfunctions/budni/BUDNI_NMT_ODS.sql index 5f0346a..d6c4711 100755 --- a/onetime/dataloadfunctions/budni/BUDNI_NMT_ODS.sql +++ b/onetime/dataloadfunctions/budni/BUDNI_NMT_ODS.sql @@ -294,7 +294,7 @@ from staging2.budni_nmt_test_obs_summary_block where trx_record=1; select syspk into __test_instance_id from transactional.test_instance where file_syspk =__file_syspk; select tractor_model into __model from transactional.test_instance where file_syspk =__file_syspk; select tractor_make into __make from transactional.test_instance where file_syspk =__file_syspk; -select syspk from transactional.test_master into __test_master_id where test_type ='BUDNI'; +select syspk from transactional.test_master into __test_master_id where test_type ='Budni'; select syspk into __test_instance_tractor_id from transactional.test_instance_tractor_info where file_syspk =__file_syspk; @@ -340,6 +340,28 @@ tractor_model =__model, tractor_make=__make where file_syspk=__file_syspk; + + +update transactional.test_instance +set test_type = a.test_type, +test_name= a.test_name +from fw_core.test_file_sheet_format_master a +where transactional.test_instance.file_sheet_mnemonic = a.file_sheet_mnemonic +and transactional.test_instance.file_syspk=__file_syspk; + +update transactional.test_instance +set test_file_name =(select a.file_name from staging1.staging_generic_table a where file_syspk = __file_syspk limit 1) +where file_syspk = __file_syspk; + + +update transactional.test_instance b +set date_of_test = (select a.date_of_test from transactional.test_instance a where a.date_Of_test is not null and a.file_syspk = __file_syspk and a.file_mnemonic = 'BUDNI' and file_sheet_mnemonic='BUDNI_PTO')::date +where +b.date_Of_test is null +and b.file_syspk = __file_syspk +and b.file_mnemonic = 'BUDNI'; + + perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'trx', 'fn_BUDNI_NMT_TRX', err_state, err_msg, err_detail, err_hint, err_context,'success'); end diff --git a/onetime/dataloadfunctions/budni/BUDNI_NMT_STG2.sql b/onetime/dataloadfunctions/budni/BUDNI_NMT_STG2.sql index e2b9a15..6ae95db 100755 --- a/onetime/dataloadfunctions/budni/BUDNI_NMT_STG2.sql +++ b/onetime/dataloadfunctions/budni/BUDNI_NMT_STG2.sql @@ -214,7 +214,7 @@ select column2,column3,column4,column5,column6,column7, column8,column9,block_row_number from staging2.stg_process_table_BUDNI_NMT a -where block_tag ='BUDNI_NMT_Noise_at_bystander_position'; +where block_tag ='BUDNI_NMT_Noise_at_bystander’s_position'; update staging2.BUDNI_NMT_noise_at_bystander_position_block @@ -334,7 +334,7 @@ select column2,column3,column4,column5,column6,column7, column8,column9,block_row_number from staging2.stg_process_table_BUDNI_NMT a -where block_tag ='BUDNI_NMT_Noise_at_operator_ear_level'; +where block_tag ='BUDNI_NMT_Noise_at_operator’s_ear_level'; update staging2.BUDNI_NMT_Noise_at_operator_ear_level_block set make=__make,model=__model; execute 'update staging2.BUDNI_NMT_Noise_at_operator_ear_level_block set diff --git a/onetime/dataloadfunctions/budni/BUDNI_PTO_ODS.sql b/onetime/dataloadfunctions/budni/BUDNI_PTO_ODS.sql index b38b741..3d43f41 100755 --- a/onetime/dataloadfunctions/budni/BUDNI_PTO_ODS.sql +++ b/onetime/dataloadfunctions/budni/BUDNI_PTO_ODS.sql @@ -188,7 +188,7 @@ column4::int, column5::numeric, column6::numeric,column7::int,column8::numeric, column9::numeric,column10,column11,column12 -from staging2.BUDNI_PTO_MMTKeyword1_block +from staging2.BUDNI_PTO_Parameter1_block where trx_record=1; @@ -223,7 +223,7 @@ make,model, column3, column4::numeric,column5::numeric,column6::numeric,column7::numeric,column8::numeric,column9, column10,column11::numeric,column12::numeric -from staging2.BUDNI_PTO_MMTKeyword2_block +from staging2.BUDNI_PTO_Parameter2_block where trx_record=1 and column3='Natural Ambient'; insert into transactional.budni_test_observations @@ -257,7 +257,7 @@ where block_row_number in (3,4) and trx_record=1 select syspk into __test_instance_id from transactional.test_instance where file_syspk =__file_syspk; select tractor_model into __model from transactional.test_instance where file_syspk =__file_syspk; select tractor_make into __make from transactional.test_instance where file_syspk =__file_syspk; -select syspk from transactional.test_master into __test_master_id where test_type ='BUDNI'; +select syspk from transactional.test_master into __test_master_id where test_type ='Budni'; select syspk into __test_instance_tractor_id from transactional.test_instance_tractor_info where file_syspk =__file_syspk; @@ -304,6 +304,21 @@ tractor_model =__model, tractor_make=__make where file_syspk=__file_syspk; + + +update transactional.test_instance +set test_type = a.test_type, +test_name= a.test_name +from fw_core.test_file_sheet_format_master a +where transactional.test_instance.file_sheet_mnemonic = a.file_sheet_mnemonic +and transactional.test_instance.file_syspk=__file_syspk; + +update transactional.test_instance +set test_file_name =(select a.file_name from staging1.staging_generic_table a where file_syspk = __file_syspk limit 1) +where file_syspk = __file_syspk; + + + perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'trx', 'fn_BUDNI_PTO_TRX', err_state, err_msg, err_detail, err_hint, err_context,'success'); end diff --git a/onetime/dataloadfunctions/budni/BUDNI_PTO_STG2.sql b/onetime/dataloadfunctions/budni/BUDNI_PTO_STG2.sql index 8cff4b6..8e546d2 100755 --- a/onetime/dataloadfunctions/budni/BUDNI_PTO_STG2.sql +++ b/onetime/dataloadfunctions/budni/BUDNI_PTO_STG2.sql @@ -41,8 +41,8 @@ truncate table staging2.stg_specific_table_BUDNI_PTO; truncate table staging2.stg_process_table_BUDNI_PTO; truncate table staging2.BUDNI_PTO_Spec_H1_Block; truncate table staging2.BUDNI_PTO_Perf_Report_block; -truncate table staging2.BUDNI_PTO_MMTKeyword1_Block; -truncate table staging2.BUDNI_PTO_MMTKeyword2_Block; +truncate table staging2.BUDNI_PTO_Parameter1_Block; +truncate table staging2.BUDNI_PTO_Parameter2_Block; truncate table staging2.BUDNI_PTO_Summary_Block; @@ -126,7 +126,7 @@ execute 'insert into staging2.stg_process_table_budni_pto select a.* , RANK () OVER ( ORDER BY row_number) as block_row_number,b.block_tag as block_tag from staging2.stg_specific_table_budni_pto a join transactional.source_config b -on a.row_number >row_number_start +on a.row_number >=row_number_start and (a.row_number< row_read_end or row_read_end is null) and f1_modified=''PTO Performance Report'' and b.file_mnemonic='''||p_file_mnemonic||''' and b.file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; @@ -136,7 +136,7 @@ select a.* , RANK () OVER ( ORDER BY row_number) as block_row_number,b.block_tag join transactional.source_config b on a.row_number >=row_number_start and (a.row_number< row_read_end or row_read_end is null) -and f1_modified=''MMTKeyword1'' +and f1_modified=''Parameter1'' and b.file_mnemonic='''||p_file_mnemonic||''' and b.file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; execute 'insert into staging2.stg_process_table_budni_pto @@ -144,7 +144,7 @@ select a.* , RANK () OVER ( ORDER BY row_number) as block_row_number,b.block_tag join transactional.source_config b on a.row_number >=row_number_start and (a.row_number< row_read_end or row_read_end is null) -and f1_modified=''MMTKeyword2'' +and f1_modified=''Parameter2'' and b.file_mnemonic='''||p_file_mnemonic||''' and b.file_sheet_mnemonic='''||p_file_sheet_mnemonic||''''; execute 'insert into staging2.stg_process_table_budni_pto @@ -276,56 +276,56 @@ file_sheet_mnemonic='''||p_file_sheet_mnemonic||''', perform fw_core.fn_jobctl_block_end(__file_syspk,'BUDNI_PTO_Perf_Report_block'); -/* blocks data loading - BUDNI_PTO_MMTKeyword1_block */ +/* blocks data loading - BUDNI_PTO_Parameter1_block */ perform fw_core.fn_jobctl_block_begin(__client_id,__function_id,__file_syspk, -'BUDNI_PTO_MMTKeyword1_block',__file_mnemonic,__file_sheet_mnemonic,3); -err_block:='BUDNI_PTO_MMTKeyword1_block'; +'BUDNI_PTO_Parameter1_block',__file_mnemonic,__file_sheet_mnemonic,3); +err_block:='BUDNI_PTO_Parameter1_block'; - insert into staging2.BUDNI_PTO_MMTKeyword1_block + insert into staging2.BUDNI_PTO_Parameter1_block ( column2,column3,column4,column5,column6,column7,column8,column9,column10,column11,column12,block_row_number) select column2,column3,column4,column5,column6,column7,column8,column9,column10,column11,column12,block_row_number from staging2.stg_process_table_budni_pto -where block_tag='BUDNI_PTO_MMTKeyword1'; +where block_tag='BUDNI_PTO_Parameter1'; -update staging2.BUDNI_PTO_MMTKeyword1_block set trx_record=0 where block_row_number in (1,2); +update staging2.BUDNI_PTO_Parameter1_block set trx_record=0 where block_row_number in (1,2); -update staging2.BUDNI_PTO_MMTKeyword1_block set make=__make,model=__model; -execute 'update staging2.BUDNI_PTO_MMTKeyword1_block set +update staging2.BUDNI_PTO_Parameter1_block set make=__make,model=__model; +execute 'update staging2.BUDNI_PTO_Parameter1_block set client_id='||p_client_id||', function_id='||p_function_id||', file_mnemonic='''||p_file_mnemonic||''', file_sheet_mnemonic='''||p_file_sheet_mnemonic||''', file_syspk='||p_file_syspk||''; -perform fw_core.fn_jobctl_block_end(__file_syspk,'BUDNI_PTO_MMTKeyword1_block'); +perform fw_core.fn_jobctl_block_end(__file_syspk,'BUDNI_PTO_Parameter1_block'); -/* blocks data loading - BUDNI_PTO_MMTKeyword2_block */ +/* blocks data loading - BUDNI_PTO_Parameter2_block */ perform fw_core.fn_jobctl_block_begin(__client_id,__function_id,__file_syspk, -'BUDNI_PTO_MMTKeyword2_block',__file_mnemonic,__file_sheet_mnemonic,4); -err_block:='BUDNI_PTO_MMTKeyword2_block'; +'BUDNI_PTO_Parameter2_block',__file_mnemonic,__file_sheet_mnemonic,4); +err_block:='BUDNI_PTO_Parameter2_block'; -insert into staging2.BUDNI_PTO_MMTKeyword2_block +insert into staging2.BUDNI_PTO_Parameter2_block ( column2,column3,column4,column5,column6,column7,column8,column9,column10,column11,column12,block_row_number) select column2,column3,column4,column5,column6,column7,column8,column9,column10,column11,column12,block_row_number from staging2.stg_process_table_budni_pto -where block_tag='BUDNI_PTO_MMTKeyword2'; +where block_tag='BUDNI_PTO_Parameter2'; -update staging2.BUDNI_PTO_MMTKeyword2_block set trx_record=0 where block_row_number in (1,2); +update staging2.BUDNI_PTO_Parameter2_block set trx_record=0 where block_row_number in (1,2); - update staging2.BUDNI_PTO_MMTKeyword2_block set make=__make,model=__model; - execute 'update staging2.BUDNI_PTO_MMTKeyword2_block set + update staging2.BUDNI_PTO_Parameter2_block set make=__make,model=__model; + execute 'update staging2.BUDNI_PTO_Parameter2_block set client_id='||p_client_id||', function_id='||p_function_id||', file_mnemonic='''||p_file_mnemonic||''', file_sheet_mnemonic='''||p_file_sheet_mnemonic||''', file_syspk='||p_file_syspk||''; -perform fw_core.fn_jobctl_block_end(__file_syspk,'BUDNI_PTO_MMTKeyword2_block'); +perform fw_core.fn_jobctl_block_end(__file_syspk,'BUDNI_PTO_Parameter2_block'); /* blocks data loading -BUDNI_PTO_Summary_Block */ diff --git a/onetime/dataloadfunctions/budni/BUDNI_VMT_ODS.sql b/onetime/dataloadfunctions/budni/BUDNI_VMT_ODS.sql index ec5f627..14066dc 100755 --- a/onetime/dataloadfunctions/budni/BUDNI_VMT_ODS.sql +++ b/onetime/dataloadfunctions/budni/BUDNI_VMT_ODS.sql @@ -228,6 +228,20 @@ tractor_model =__model, tractor_make=__make where file_syspk=__file_syspk; + +update transactional.test_instance +set test_file_name =(select a.file_name from staging1.staging_generic_table a where file_syspk = __file_syspk limit 1) +where file_syspk = __file_syspk; + + +update transactional.test_instance b +set date_of_test = (select a.date_of_test from transactional.test_instance a where a.date_Of_test is not null and a.file_syspk = __file_syspk and a.file_mnemonic = 'BUDNI' and file_sheet_mnemonic='BUDNI_PTO')::date +where +b.date_Of_test is null +and b.file_syspk = __file_syspk +and b.file_mnemonic = 'BUDNI'; + + perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'trx', 'fn_BUDNI_VMT_TRX', err_state, err_msg, err_detail, err_hint, err_context,'success'); end diff --git a/onetime/dataloadfunctions/field/FTDRY_SUM_ODS.sql b/onetime/dataloadfunctions/field/FTDRY_SUM_ODS.sql index 3e371b8..797be15 100755 --- a/onetime/dataloadfunctions/field/FTDRY_SUM_ODS.sql +++ b/onetime/dataloadfunctions/field/FTDRY_SUM_ODS.sql @@ -116,7 +116,7 @@ implement_size, hitch_category, trim('kg' from implement_weight)::numeric, soil_type, -moisture_content::numeric soil_moisture_content_pct, +moisture_content::text soil_moisture_content_pct, bulk_density_g_cc::numeric soil_bulk_density_g_per_cc, trim(' Kpa' from soil_cone_index)::numeric soil_cone_index, field_condition, diff --git a/onetime/dataloadfunctions/field/FTDRY_TRS_ODS.sql b/onetime/dataloadfunctions/field/FTDRY_TRS_ODS.sql index 1789238..aee2ed2 100755 --- a/onetime/dataloadfunctions/field/FTDRY_TRS_ODS.sql +++ b/onetime/dataloadfunctions/field/FTDRY_TRS_ODS.sql @@ -78,7 +78,7 @@ objective_of_test, background_of_test, job_order_no, test_location test_location_name, -soil_moisture_content_::numeric soil_moisture_content_pct , +soil_moisture_content_::text soil_moisture_content_pct , soil_bulk_density_g_cc::int soil_bulk_density_g_per_cc, test_engineer, test_operator, @@ -200,7 +200,7 @@ tractor_sr_no, 'front', front_tyre_make tyre_make, front_tyre_size tyre_size, -front_tyre_pressure_psi::int tyre_pressure_psi +front_tyre_pressure_psi::numeric tyre_pressure_psi from staging2.ftdry_trs_spec_block where trx_record=1; update transactional.test_instance_tyre_info a @@ -238,7 +238,7 @@ tractor_sr_no, 'rear', rear_tyre_make tyre_make, rear_tyre_size tyre_size, -rear_tyre_pressure_psi::int tyre_pressure_psi +rear_tyre_pressure_psi::numeric tyre_pressure_psi from staging2.ftdry_trs_spec_block where trx_record=1; update transactional.test_instance_tyre_info a @@ -267,9 +267,9 @@ file_sheet_mnemonic select client_id, function_id, -low_idle::int low_idle_observed , -high_idle::int high_idle_observed , -rated_rpm::int, +low_idle::numeric low_idle_observed , +high_idle::numeric high_idle_observed , +rated_rpm::numeric, engine_to_pto_ratio_540_pto, engine_to_pto_ratio_540e_pto, tractor_model, @@ -364,6 +364,17 @@ update transactional.test_instance set test_file_name =(select a.file_name from staging1.staging_generic_table a where file_syspk = __file_syspk limit 1) where file_syspk = __file_syspk; + + +update transactional.test_instance +set test_type = a.test_type, +test_name= a.test_name +from fw_core.test_file_sheet_format_master a +where transactional.test_instance.file_sheet_mnemonic = a.file_sheet_mnemonic +and transactional.test_instance.file_syspk=__file_syspk; + + + perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'trx', 'fn_FTDRY_TRS_TRX', err_state, err_msg, err_detail, err_hint, err_context,'success'); end diff --git a/onetime/dataloadfunctions/field/FTHLG_TRS_ods.sql b/onetime/dataloadfunctions/field/FTHLG_TRS_ods.sql index 88eaa7f..87e60db 100755 --- a/onetime/dataloadfunctions/field/FTHLG_TRS_ods.sql +++ b/onetime/dataloadfunctions/field/FTHLG_TRS_ods.sql @@ -369,6 +369,16 @@ update transactional.test_instance set test_file_name =(select a.file_name from staging1.staging_generic_table a where file_syspk = __file_syspk limit 1) where file_syspk = __file_syspk; + +update transactional.test_instance +set test_type = a.test_type, +test_name= a.test_name +from fw_core.test_file_sheet_format_master a +where transactional.test_instance.file_sheet_mnemonic = a.file_sheet_mnemonic +and transactional.test_instance.file_syspk=__file_syspk; + + + perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'trx', 'fn_FTHLG_TRS_TRX', err_state, err_msg, err_detail, err_hint, err_context,'success'); end diff --git a/onetime/dataloadfunctions/field/FTWET_SUM_ods.sql b/onetime/dataloadfunctions/field/FTWET_SUM_ods.sql index e7790d6..e413c85 100755 --- a/onetime/dataloadfunctions/field/FTWET_SUM_ods.sql +++ b/onetime/dataloadfunctions/field/FTWET_SUM_ods.sql @@ -117,34 +117,19 @@ file_mnemonic, file_sheet_mnemonic from staging2.ftwet_sum_implement_block where trx_record=1; - -insert into transactional.field_perf_summary_implement_info -( -client_id, -function_id, -type_of_cage_wheel, -cage_wheel_width_mm, -cage_wheel_weight, -cage_wheel_inner_and_outer_ring_dia_mm, -cage_wheel_center_ring_dia_mm, -no_of_angles_on_cage_wheel, -file_syspk, -file_mnemonic, -file_sheet_mnemonic -) -select -client_id, -function_id, -Type_of_Cage_Wheel, -Cage_Wheel_Width_mm::numeric, -Cage_wheel_Weight::numeric, -Cage_Wheel_inner_Outer_Ring_Dia_mm::numeric cage_wheel_inner_and_outer_ring_dia_mm, -Cage_Wheel_Center_Ring_Dia_mm::numeric, -No_of_angles_on_cage_wheel::numeric, -file_syspk, -file_mnemonic, -file_sheet_mnemonic -from staging2.FTWET_SUM_Cage_Wheel_Block where trx_record=1; +update transactional.field_perf_summary_implement_info a +set +type_of_cage_wheel= b.Type_of_Cage_Wheel, +cage_wheel_width_mm =b.Cage_Wheel_Width_mm::numeric, +cage_wheel_weight =b.Cage_wheel_Weight::numeric, +cage_wheel_inner_and_outer_ring_dia_mm = b.Cage_Wheel_inner_Outer_Ring_Dia_mm::numeric, +cage_wheel_center_ring_dia_mm = b.Cage_Wheel_Center_Ring_Dia_mm::numeric, +no_of_angles_on_cage_wheel = b.No_of_angles_on_cage_wheel::numeric +from staging2.FTWET_SUM_Cage_Wheel_Block b +where a.file_syspk = b.file_syspk +and a.file_mnemonic = b.file_mnemonic +and a.file_sheet_mnemonic = b.file_sheet_mnemonic +and b.trx_record=1; insert into transactional.field_perf_summary diff --git a/onetime/dataloadfunctions/field/FTWET_TRS_ods.sql b/onetime/dataloadfunctions/field/FTWET_TRS_ods.sql index 297fecf..afdfa97 100755 --- a/onetime/dataloadfunctions/field/FTWET_TRS_ods.sql +++ b/onetime/dataloadfunctions/field/FTWET_TRS_ods.sql @@ -367,6 +367,17 @@ update transactional.test_instance set test_file_name =(select a.file_name from staging1.staging_generic_table a where file_syspk = __file_syspk limit 1) where file_syspk = __file_syspk; + +update transactional.test_instance +set test_type = a.test_type, +test_name= a.test_name +from fw_core.test_file_sheet_format_master a +where transactional.test_instance.file_sheet_mnemonic = a.file_sheet_mnemonic +and transactional.test_instance.file_syspk=__file_syspk; + + + + perform fw_core.fn_insert_db_error ( __client_id, __function_id, 1001, 'Compegence', __file_syspk ,__file_mnemonic,__file_sheet_mnemonic ,null,'trx', 'fn_FTWET_TRS_TRX', err_state, err_msg, err_detail, err_hint, err_context,'success'); end diff --git a/onetime/wrappers/master_wrapper.sql b/onetime/wrappers/master_wrapper.sql index f69c407..11016ba 100755 --- a/onetime/wrappers/master_wrapper.sql +++ b/onetime/wrappers/master_wrapper.sql @@ -105,7 +105,7 @@ end if; continue; end if; - +perform archive.fn_run_block_archive(w_client_id, w_function_id); --run transactional scripts depending on sheet mnemonic if f.file_sheet_mnemonic = 'FTDRY_TRS' then @@ -189,6 +189,9 @@ end if; end if; end loop; + +perform transactional.fn_run_updates(w_client_id, w_function_id); + -- update fw_jobctl_file_runschedule table. update fw_core.fw_jobctl_file_runschedule set end_status_note = 'stg2_failed', end_status='error',staging_type = 'stg2',end_time=now() from fw_core.fw_jobctl_file_sheet_runschedule a @@ -206,14 +209,10 @@ SELECT SUM (case WHEN end_status = 'success' THEN 1 if (success_sum > 0 or success_sum is null) then update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'trx_completed', end_status='success', end_time=now() where job_id = w_job_id and step_id = w_step_id and latest_runschedule_flag = '1'; else -update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'trx_failed', end_status='error', end_time=now() where job_id = w_job_id and step_id = w_step_id and latest_runschedule_flag = '1'; +update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'trx_failed', end_status='success', end_time=now() where job_id = w_job_id and step_id = w_step_id and latest_runschedule_flag = '1'; end if; ---insert into fw_core.track_jobstep select *,'master_wrapper' from fw_core.fw_jobctl_runschedule_jobstep; ---insert into fw_core.track_file select *,'mater_wrapper' from fw_core.fw_jobctl_file_runschedule; ---insert into fw_core.track_file_sheet select *,'master_wrapper' from fw_core.fw_jobctl_file_sheet_runschedule; - end; $$ LANGUAGE plpgsql; \ No newline at end of file diff --git a/onetime/wrappers/wrapper.sql b/onetime/wrappers/wrapper.sql new file mode 100755 index 0000000..eae3500 --- /dev/null +++ b/onetime/wrappers/wrapper.sql @@ -0,0 +1,163 @@ + + +CREATE OR REPLACE FUNCTION fw_ods.fn_fw_ods_load(p_client_id int,p_function_id int,p_job_id int,p_step_id int) + RETURNS void +AS $$ + declare + f record; + w_job_id int := p_job_id; + w_step_id int := p_step_id; + w_function_id int := p_function_id; + w_client_id int := p_client_id; + w_file_sheet_mnemonic text := 'Sheets'; + +begin + +for f in select distinct file_syspk, file_mnemonic + from fw_core.fw_jobctl_file_runschedule + where latest_runschedule_flag = '1' and + end_status = 'success' and + end_status_note = 'TRX_completed' + order by file_syspk +loop + + +if f.file_mnemonic in ('FTDRY', 'FTWET', 'FTHLG') +then + + perform fw_core.fn_get_function_exception('fw_ods.fn_fw_ods_field_load('||w_client_id||','||w_function_id||','''||f.file_mnemonic||''','''||w_file_sheet_mnemonic||''','||f.file_syspk||')'); + + + perform fw_core.fn_get_function_exception('fw_ods.fn_fw_ods_implement_details_update('||w_client_id||','||w_function_id||','''||f.file_mnemonic||''','''||w_file_sheet_mnemonic||''','||f.file_syspk||')'); + + perform fw_core.fn_get_function_exception('fw_ods.fn_fw_ods_comments_load('||w_client_id||','||w_function_id||','''||f.file_mnemonic||''','''||w_file_sheet_mnemonic||''','||f.file_syspk||')'); + + SET search_path To fw_ods; + drop extension tablefunc; + CREATE extension tablefunc; + + perform fw_core.fn_get_function_exception('fw_ods.fn_fw_ods_observations_load('||w_client_id||','||w_function_id||','''||f.file_mnemonic||''','''||w_file_sheet_mnemonic||''','||f.file_syspk||')'); + + SET search_path To staging2; + drop extension tablefunc; + CREATE extension tablefunc; + + + + +elsif f.file_mnemonic ='PTO' then + perform fw_core.fn_get_function_exception('fw_ods.fn_fw_ods_PTO_load('||w_client_id||','||w_function_id||','''||f.file_mnemonic||''','''||w_file_sheet_mnemonic||''','||f.file_syspk||')'); + + +elsif f.file_mnemonic = 'BUDNI' then + perform fw_core.fn_get_function_exception('fw_ods.fn_fw_ods_budni_load('||w_client_id||','||w_function_id||','''||f.file_mnemonic||''','''||w_file_sheet_mnemonic||''','||f.file_syspk||')'); + + +elsif f.file_mnemonic in ('PTOBEN', 'PTOSTD') then + perform fw_core.fn_get_function_exception('fw_ods.fn_fw_ods_PTO_load('||w_client_id||','||w_function_id||','''||f.file_mnemonic||''','''||w_file_sheet_mnemonic||''','||f.file_syspk||')'); + + + +elsif f.file_mnemonic in ('IHTBT30','IHTBT50','IHTBTD','IHTCGM','IHTHAM','IHTEMT','IHTHLS','IHTNST','IHTSLL') then + + perform fw_core.fn_get_function_exception('fw_ods.fn_fw_ods_IHT_load('||w_client_id||','||w_function_id||','''||f.file_mnemonic||''','''||w_file_sheet_mnemonic||''','||f.file_syspk||')'); + + perform fw_core.fn_get_function_exception('fw_ods.fn_fw_ods_detailed_load('||w_client_id||','||w_function_id||','''||f.file_mnemonic||''','''||w_file_sheet_mnemonic||''','||f.file_syspk||')'); + + + + +elsif f.file_mnemonic in ('DBOECD', 'DBSTD') then + perform fw_core.fn_get_function_exception('fw_ods.fn_fw_ods_drawbar_performance_load('||w_client_id||','||w_function_id||','''||f.file_mnemonic||''','''||w_file_sheet_mnemonic||''','||f.file_syspk||')'); + + perform fw_core.fn_get_function_exception('fw_ods.fn_fw_ods_drawbar_load('||w_client_id||','||w_function_id||','''||f.file_mnemonic||''','''||w_file_sheet_mnemonic||''','||f.file_syspk||')'); + + +end if; + + + +end loop; + + + update fw_ods.fw_ods set tractor_model=REGEXP_REPLACE(tractor_model,'\r|\n','','g'); + + update fw_ods.fw_ods set tractor_make = m.target_value from fw_ods.fw_ods_misnomer m where trim(tractor_make) = m.source_value ; + update fw_ods.fw_ods set tractor_model = m.target_value from fw_ods.fw_ods_misnomer m where trim(tractor_model) = m.source_value ; + update fw_ods.fw_ods set wheel_drive_type = m.target_value from fw_ods.fw_ods_misnomer m where trim(wheel_drive_type) = m.source_value ; + update fw_ods.fw_ods set name_of_implement = m.target_value from fw_ods.fw_ods_misnomer m where trim(name_of_implement) = m.source_value ; + update fw_ods.fw_ods set type_of_implement = m.target_value from fw_ods.fw_ods_misnomer m where trim(type_of_implement) = m.source_value ; + + +update fw_ods.fw_ods set "configuration" = m."configuration", +tractor_engine_hp = m.tractor_engine_hp, wheel_drive_type=m.wheel_drive_type,platform = m.platform,tractor_make = m.tractor_make +from fw_ods.tractor_info m where fw_ods.fw_ods.tractor_model = m.tractor_model; + + +update fw_ods.fw_ods_comments set tractor_model=REGEXP_REPLACE(tractor_model,'\r|\n','','g'); + + update fw_ods.fw_ods_comments set tractor_make = m.target_value from fw_ods.fw_ods_misnomer m where trim(tractor_make) = m.source_value ; + update fw_ods.fw_ods_comments set tractor_model = m.target_value from fw_ods.fw_ods_misnomer m where trim(tractor_model) = m.source_value ; + update fw_ods.fw_ods_comments set wheel_drive_type = m.target_value from fw_ods.fw_ods_misnomer m where trim(wheel_drive_type) = m.source_value ; + update fw_ods.fw_ods_comments set name_of_implement = m.target_value from fw_ods.fw_ods_misnomer m where trim(name_of_implement) = m.source_value ; + update fw_ods.fw_ods_comments set type_of_implement = m.target_value from fw_ods.fw_ods_misnomer m where trim(type_of_implement) = m.source_value ; + + +update fw_ods.fw_ods_drawbar_performance set tractor_model=REGEXP_REPLACE(tractor_model,'\r|\n','','g'); + + update fw_ods.fw_ods_drawbar_performance set tractor_make = m.target_value from fw_ods.fw_ods_misnomer m where trim(tractor_make) = m.source_value ; + update fw_ods.fw_ods_drawbar_performance set tractor_model = m.target_value from fw_ods.fw_ods_misnomer m where trim(tractor_model) = m.source_value ; + update fw_ods.fw_ods_drawbar_performance set wheel_drive_type = m.target_value from fw_ods.fw_ods_misnomer m where trim(wheel_drive_type) = m.source_value ; +-- update fw_ods.fw_ods_drawbar_performance set name_of_implement = m.target_value from fw_ods.fw_ods_misnomer m where trim(name_of_implement) = m.source_value ; +--update fw_ods.fw_ods_drawbar_performance set type_of_implement = m.target_value from fw_ods.fw_ods_misnomer m where trim(type_of_implement) = m.source_value ; + + +update fw_ods.fw_ods_drawbar_performance set "configuration" = m."configuration", +tractor_engine_hp = m.tractor_engine_hp, wheel_drive_type=m.wheel_drive_type,platform = m.platform,tractor_make = m.tractor_make +from fw_ods.tractor_info m where fw_ods.fw_ods_drawbar_performance.tractor_model = m.tractor_model; + +update fw_ods.fw_ods_comments set "configuration" = m."configuration", +tractor_engine_hp = m.tractor_engine_hp, wheel_drive_type=m.wheel_drive_type,platform = m.platform,tractor_make = m.tractor_make +from fw_ods.tractor_info m where fw_ods.fw_ods_comments.tractor_model = m.tractor_model; + + +update fw_ods.fw_ods_detailed set tractor_model=REGEXP_REPLACE(tractor_model,'\r|\n','','g'); + + update fw_ods.fw_ods_detailed set tractor_make = m.target_value from fw_ods.fw_ods_misnomer m where trim(tractor_make) = m.source_value ; + update fw_ods.fw_ods_detailed set tractor_model = m.target_value from fw_ods.fw_ods_misnomer m where trim(tractor_model) = m.source_value ; + update fw_ods.fw_ods_detailed set wheel_drive_type = m.target_value from fw_ods.fw_ods_misnomer m where trim(wheel_drive_type) = m.source_value ; +-- update fw_ods.fw_ods_detailed set name_of_implement = m.target_value from fw_ods.fw_ods_misnomer m where trim(name_of_implement) = m.source_value ; + --update fw_ods.fw_ods_detailed set type_of_implement = m.target_value from fw_ods.fw_ods_misnomer m where trim(type_of_implement) = m.source_value ; + + +update fw_ods.fw_ods_detailed set "configuration" = m."configuration", +tractor_engine_hp = m.tractor_engine_hp, wheel_drive_type=m.wheel_drive_type,platform = m.platform,tractor_make = m.tractor_make +from fw_ods.tractor_info m where fw_ods.fw_ods_detailed.tractor_model = m.tractor_model; + + + +update fw_ods.fw_ods_observations set tractor_model=REGEXP_REPLACE(tractor_model,'\r|\n','','g'); + + update fw_ods.fw_ods_observations set tractor_make = m.target_value from fw_ods.fw_ods_misnomer m where trim(tractor_make) = m.source_value ; + update fw_ods.fw_ods_observations set tractor_model = m.target_value from fw_ods.fw_ods_misnomer m where trim(tractor_model) = m.source_value ; + update fw_ods.fw_ods_observations set wheel_drive_type = m.target_value from fw_ods.fw_ods_misnomer m where trim(wheel_drive_type) = m.source_value ; + update fw_ods.fw_ods_observations set name_of_implement = m.target_value from fw_ods.fw_ods_misnomer m where trim(name_of_implement) = m.source_value ; + update fw_ods.fw_ods_observations set type_of_implement = m.target_value from fw_ods.fw_ods_misnomer m where trim(type_of_implement) = m.source_value ; + + +update fw_ods.fw_ods_observations set "configuration" = m."configuration", +tractor_engine_hp = m.tractor_engine_hp, wheel_drive_type=m.wheel_drive_type,platform = m.platform,tractor_make = m.tractor_make +from fw_ods.tractor_info m where fw_ods.fw_ods_observations.tractor_model = m.tractor_model; + + + +update fw_core.fw_jobctl_runschedule_jobstep set end_status_note = 'TRX_completed', end_status='success', end_time=now() where job_id = p_job_id and step_id = p_step_id and latest_runschedule_flag = '1'; + + + + +end +$$ +LANGUAGE plpgsql; + + diff --git a/scripts/check_duplicate_file.sh b/scripts/check_duplicate_file.sh index 2e538f6..dfb0402 100755 --- a/scripts/check_duplicate_file.sh +++ b/scripts/check_duplicate_file.sh @@ -20,6 +20,8 @@ server=${credentials[server]} postgres_con="psql -A -t postgresql://$user:$password@$host/$db" +$postgres_con -q -c "update fw_core.fw_jobctl_runschedule_jobstep set end_status_note ='Initial', end_status='success',end_time = now() where job_script_type = 'shell_script' and job_id = 1 and step_id= 1 and latest_runschedule_flag='1'" + count=`$postgres_con -c "select count(*) from fw_core.fw_jobctl_file_runschedule"` if [[ $count -eq 0 ]] then @@ -28,7 +30,7 @@ else while IFS= read -a filenames do file_name=$(echo $filenames | sed 's/[[:space:]]/\\ /g') - if [ $(echo "-f $homeDir/files/landing/$file_name") ]; + if [[ -f $homeDir/files/landing/$filenames ]]; then echo "File: $file_name is already processed and is moved to Duplicate Folder" move=$(echo "mv $homeDir/files/landing/$file_name $homeDir/files/duplicate_file/$file_name") diff --git a/scripts/run_onetime_compile.sh b/scripts/onetime_compile.sh similarity index 100% rename from scripts/run_onetime_compile.sh rename to scripts/onetime_compile.sh diff --git a/scripts/run_schedule.sh b/scripts/run_schedule.sh index b14e557..01a3a5e 100755 --- a/scripts/run_schedule.sh +++ b/scripts/run_schedule.sh @@ -96,7 +96,7 @@ echo "Executing Job: $job_name by checking Previous End Status" psql $psql_base_arg -a -f $job_step_script_name $host $port $user $pwd $dbname $param $client_id $function_id $data_from_date $data_to_date $job_scope $job_scope_qualifier else chkrun=$(psql $psql_base_arg -t -c "select TRIM(end_status) from fw_core.fw_jobctl_runschedule_jobstep where latest_runschedule_flag='1' and job_step_run_dependency_seuqence=$prev_job_seq and client_id=21 and function_id=1;") - if [[ $file_count -gt 0 ]]; then + if [[ "$chkrun" == " success" && $file_count -gt 0 ]]; then psql $psql_base_arg -a -f $job_step_script_name $host $port $user $pwd $dbname $param $client_id $function_id $data_from_date $data_to_date $job_scope $job_scope_qualifier else exit 1; @@ -111,7 +111,7 @@ echo "Executing Job: $job_name by checking Previous End Status" else chkrun=$(psql $psql_base_arg -t -c "select TRIM(end_status) from fw_core.fw_jobctl_runschedule_jobstep where latest_runschedule_flag='1' and job_step_run_dependency_seuqence=$prev_job_seq and client_id=21 and function_id=1;") - if [[ $file_count -gt 0 ]]; then + if [[ "$chkrun" == " success" && $file_count -gt 0 ]]; then $job_step_script_name else exit 1; @@ -126,7 +126,7 @@ echo "Executing Job: $job_name by checking Previous End Status" else chkrun=$(psql $psql_base_arg -t -c "select TRIM(end_status) from fw_core.fw_jobctl_runschedule_jobstep where latest_runschedule_flag='1' and job_step_run_dependency_seuqence=$prev_job_seq and client_id=21 and function_id=1;") - if [[ $file_count -gt 0 ]]; then + if [[ "$chkrun" == " success" && $file_count -gt 0 ]]; then psql $psql_base_arg -t -c "select $job_step_script_name_concat" else exit 1;