sql
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
BIN
onetime/dataloadfunctions/IHT/.IHTBT50_BT50_ODS.sql.swp
Normal file
BIN
onetime/dataloadfunctions/IHT/.IHTBT50_BT50_ODS.sql.swp
Normal file
Binary file not shown.
@@ -34,6 +34,7 @@ Updation Date:
|
||||
Author: compegence team
|
||||
Function Call: select staging2.fn_IHTBT30_BT30_TRX()
|
||||
***************************************************************/
|
||||
|
||||
insert into transactional.test_instance
|
||||
(
|
||||
client_id,
|
||||
@@ -187,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,
|
||||
@@ -196,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.IHTBT30_BT30_h1_block where trx_record =1;
|
||||
|
||||
update transactional.test_instance_tractor_info
|
||||
@@ -246,7 +257,7 @@ column6::numeric,
|
||||
column7::numeric,
|
||||
column8::numeric,
|
||||
column9,
|
||||
column10
|
||||
column11
|
||||
from staging2.IHTBT30_BT30_test_res_1_block where trx_record =1;
|
||||
|
||||
insert into transactional.iht_brake_perf_test_results
|
||||
@@ -283,7 +294,7 @@ column6::numeric,
|
||||
column7::numeric,
|
||||
column8::numeric,
|
||||
column9,
|
||||
column10
|
||||
column11
|
||||
from staging2.IHTBT30_BT30_test_res_2_block where trx_record =1;
|
||||
|
||||
insert into transactional.iht_brake_perf_test_results
|
||||
@@ -320,7 +331,7 @@ column6::numeric,
|
||||
column7::numeric,
|
||||
column8::numeric,
|
||||
column9,
|
||||
column10
|
||||
column11
|
||||
from staging2.IHTBT30_BT30_test_res_3_block where trx_record =1;
|
||||
|
||||
insert into transactional.iht_brake_perf_test_results
|
||||
@@ -357,7 +368,7 @@ column6::numeric,
|
||||
column7::numeric,
|
||||
column8::numeric,
|
||||
column9,
|
||||
column10
|
||||
column11
|
||||
from staging2.IHTBT30_BT30_test_res_4_block where trx_record =1;
|
||||
|
||||
insert into transactional.iht_brake_perf_test_condition
|
||||
@@ -450,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_IHTBT30_BT30_TRX', err_state, err_msg, err_detail, err_hint, err_context,'success');
|
||||
|
||||
end
|
||||
|
||||
@@ -83,14 +83,14 @@ end if;
|
||||
|
||||
/* trimming data */
|
||||
update staging2.stg_specific_table_IHTBT30_BT30
|
||||
set column10='Objective' where lower(column10) like 'objective%';
|
||||
set column11='Objective' where lower(column11) like 'objective%';
|
||||
|
||||
update staging2.stg_specific_table_IHTBT30_BT30
|
||||
set column10='Acceptance criteria' where lower(column10) like 'acceptance criteria%';
|
||||
|
||||
|
||||
update staging2.stg_specific_table_IHTBT30_BT30
|
||||
set column10='Condition' where lower(column10) like 'condition%';
|
||||
set column11='Condition' where lower(column11) like 'condition%';
|
||||
|
||||
update transactional.source_config set F1_source=F1_modified ;
|
||||
|
||||
@@ -205,39 +205,39 @@ perform fw_core.fn_jobctl_block_begin(__client_id,__function_id,__file_syspk,
|
||||
err_block:='IHTBT30_BT30_H1_BLOCK';
|
||||
insert into staging2.IHTBT30_BT30_H1_INT (c1,c2)
|
||||
select a.column3,column5 from staging2.stg_process_table_IHTBT30_BT30 a where block_tag='IHTBT30_BT30_H1'
|
||||
and block_row_number <=9;
|
||||
and block_row_number <=11;
|
||||
|
||||
insert into staging2.IHTBT30_BT30_H1_INT (c1,c2)
|
||||
select a.column7,column9 from staging2.stg_process_table_IHTBT30_BT30 a where block_tag='IHTBT30_BT30_H1'
|
||||
and block_row_number <=9;
|
||||
and block_row_number <=10;
|
||||
|
||||
insert into staging2.IHTBT30_BT30_H1_INT (c1,c2)
|
||||
select 'Objective',column10
|
||||
select 'Objective',column11
|
||||
from staging2.stg_process_table_IHTBT30_BT30 a
|
||||
where block_tag='IHTBT30_BT30_H1'
|
||||
and row_number=
|
||||
(
|
||||
select row_number+1 from
|
||||
staging2.stg_process_table_IHTBT30_BT30 a
|
||||
where column10='Objective'
|
||||
where column11 like 'Objective%'
|
||||
and block_tag='IHTBT30_BT30_H1'
|
||||
);
|
||||
|
||||
insert into staging2.IHTBT30_BT30_H1_INT (c1,c2)
|
||||
select 'Acceptance criteria',column8
|
||||
from staging2.stg_process_table_IHTBT30_BT30 a
|
||||
where block_tag='IHTBT30_BT30_H1' and block_row_number=11;
|
||||
where block_tag='IHTBT30_BT30_H1' and block_row_number=13;
|
||||
|
||||
|
||||
insert into staging2.IHTBT30_BT30_H1_INT (c1,c2)
|
||||
select 'Condition',column10
|
||||
select 'Condition',column11
|
||||
from staging2.stg_process_table_IHTBT30_BT30 a
|
||||
where block_tag='IHTBT30_BT30_H1'
|
||||
and row_number=
|
||||
(
|
||||
select row_number+1 from
|
||||
staging2.stg_process_table_IHTBT30_BT30 a
|
||||
where column10='Condition'
|
||||
where column11 like 'Condition%'
|
||||
and block_tag='IHTBT30_BT30_H1'
|
||||
);
|
||||
|
||||
@@ -246,19 +246,19 @@ and block_tag='IHTBT30_BT30_H1'
|
||||
insert into staging2.IHTBT30_BT30_H1_INT (c1,c2)
|
||||
select 'Test std',column4
|
||||
from staging2.stg_process_table_IHTBT30_BT30 b
|
||||
where block_row_number=11
|
||||
where block_row_number=13
|
||||
and block_tag='IHTBT30_BT30_H1';
|
||||
|
||||
insert into staging2.IHTBT30_BT30_H1_INT (c1,c2)
|
||||
select 'Test std Id',column3
|
||||
from staging2.stg_process_table_IHTBT30_BT30 b
|
||||
where block_row_number=11
|
||||
where block_row_number=13
|
||||
and block_tag='IHTBT30_BT30_H1';
|
||||
|
||||
insert into staging2.IHTBT30_BT30_H1_INT (c1,c2)
|
||||
select 'Test Standard ref',split_part(column3,':',2)
|
||||
from staging2.stg_process_table_IHTBT30_BT30 b
|
||||
where block_row_number=10
|
||||
where block_row_number=12
|
||||
and block_tag='IHTBT30_BT30_H1';
|
||||
|
||||
|
||||
@@ -290,6 +290,8 @@ Test_Request_no,
|
||||
Sample_Receipt_Date,
|
||||
Test_report_No,
|
||||
Tractor_Model,
|
||||
tractor_power_hp,
|
||||
variant,
|
||||
Generation,
|
||||
Customer_Name,
|
||||
Test_Engineer,
|
||||
@@ -299,19 +301,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(
|
||||
@@ -319,33 +322,11 @@ FROM crosstab(
|
||||
, row_number() OVER ()
|
||||
, unnest(ARRAY[c2::text]) AS val
|
||||
FROM staging2.IHTBT30_BT30_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.IHTBT30_BT30_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.IHTBT30_BT30_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.IHTBT30_BT30_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.IHTBT30_BT30_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.IHTBT30_BT30_H1_Block where dummy_f is null ;
|
||||
update staging2.IHTBT30_BT30_H1_Block set model=__model;
|
||||
@@ -432,15 +413,14 @@ ply_rating
|
||||
)
|
||||
SELECT *
|
||||
FROM crosstab(
|
||||
'SELECT unnest(''{column10,column11}''::text[]) AS col
|
||||
'SELECT unnest(''{column11,column12}''::text[]) AS col
|
||||
, row_number() OVER ()
|
||||
, unnest(ARRAY[column10::text,column11::text]) AS val
|
||||
FROM staging2.IHTBT30_BT30_Weight_Tyre_Int where column11 is not null or column10 is not null
|
||||
, unnest(ARRAY[column11::text,column12::text]) AS val
|
||||
FROM staging2.IHTBT30_BT30_Weight_Tyre_Int where column11 is not null or column12 is not null
|
||||
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);
|
||||
|
||||
|
||||
|
||||
delete from staging2.IHTBT30_BT30_Tyre_Details_Block where dummy_f is null ;
|
||||
update staging2.IHTBT30_BT30_Tyre_Details_Block set model=__model;
|
||||
execute 'update staging2.IHTBT30_BT30_Tyre_Details_Block set
|
||||
@@ -489,13 +469,13 @@ ORDER BY block_row_number ASC
|
||||
|
||||
|
||||
update staging2.IHTBT30_BT30_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.IHTBT30_BT30_Test_Res_1_Block
|
||||
ORDER BY block_row_number ASC
|
||||
) as q) b where a.block_row_number=b.block_row_number;
|
||||
@@ -553,14 +533,15 @@ ORDER BY block_row_number ASC
|
||||
|
||||
|
||||
update staging2.IHTBT30_BT30_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.IHTBT30_BT30_Test_Res_2_Block
|
||||
where block_row_number > 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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 ;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
|
||||
@@ -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');
|
||||
|
||||
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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');
|
||||
|
||||
|
||||
@@ -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 ;
|
||||
|
||||
@@ -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$
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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');
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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');
|
||||
|
||||
253
onetime/dataloadfunctions/ODS_Load/fn_fw_ods_budni_load.sql
Executable file
253
onetime/dataloadfunctions/ODS_Load/fn_fw_ods_budni_load.sql
Executable file
@@ -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;
|
||||
|
||||
217
onetime/dataloadfunctions/ODS_Load/fn_fw_ods_comments_load.sql
Executable file
217
onetime/dataloadfunctions/ODS_Load/fn_fw_ods_comments_load.sql
Executable file
@@ -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;
|
||||
149
onetime/dataloadfunctions/ODS_Load/fn_fw_ods_detailed_load.sql
Executable file
149
onetime/dataloadfunctions/ODS_Load/fn_fw_ods_detailed_load.sql
Executable file
@@ -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;
|
||||
|
||||
175
onetime/dataloadfunctions/ODS_Load/fn_fw_ods_drawbar_load.sql
Executable file
175
onetime/dataloadfunctions/ODS_Load/fn_fw_ods_drawbar_load.sql
Executable file
@@ -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;
|
||||
190
onetime/dataloadfunctions/ODS_Load/fn_fw_ods_drawbar_performance_load.sql
Executable file
190
onetime/dataloadfunctions/ODS_Load/fn_fw_ods_drawbar_performance_load.sql
Executable file
@@ -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;
|
||||
483
onetime/dataloadfunctions/ODS_Load/fn_fw_ods_field_load.sql
Executable file
483
onetime/dataloadfunctions/ODS_Load/fn_fw_ods_field_load.sql
Executable file
@@ -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;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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;
|
||||
214
onetime/dataloadfunctions/ODS_Load/fn_fw_ods_observation_ftdry_load.sql
Executable file
214
onetime/dataloadfunctions/ODS_Load/fn_fw_ods_observation_ftdry_load.sql
Executable file
@@ -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;
|
||||
364
onetime/dataloadfunctions/ODS_Load/fn_fw_ods_pto_load.sql
Normal file
364
onetime/dataloadfunctions/ODS_Load/fn_fw_ods_pto_load.sql
Normal file
@@ -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;
|
||||
77
onetime/dataloadfunctions/PTO/PTO_GVG_ods.sql
Executable file → Normal file
77
onetime/dataloadfunctions/PTO/PTO_GVG_ods.sql
Executable file → Normal file
@@ -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;
|
||||
|
||||
841
onetime/dataloadfunctions/PTO/PTO_GVG_stg2.sql
Executable file → Normal file
841
onetime/dataloadfunctions/PTO/PTO_GVG_stg2.sql
Executable file → Normal file
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user