This commit is contained in:
dheepa
2021-08-09 11:14:23 +00:00
parent a0d3257be0
commit f3cf5e1d2d
89 changed files with 4769 additions and 1508 deletions

View File

@@ -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');