sql
This commit is contained in:
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');
|
||||
|
||||
Reference in New Issue
Block a user