Merge tag 'v1_12_18(147)' into develop

Finish v1_12_18(147)
This commit is contained in:
Valerio Castellana 2020-09-04 12:38:19 +02:00
commit a41c5b34bb
2 changed files with 145 additions and 73 deletions

View File

@ -17,8 +17,8 @@ apply plugin: 'com.google.gms.google-services'
android {
def appVersionCode = 146
def appVersionName = '1.12.17'
def appVersionCode = 147
def appVersionName = '1.12.18'
signingConfigs {
release {

View File

@ -31,7 +31,8 @@ public class ProdRecuperoMaterialeHelper {
public void loadLastULVersate(RunnableArgs<List<HistoryVersamentoProdULDTO>> onComplete, RunnableArgs<Exception> onFailed) {
String sql = "SELECT jtb_fasi.cod_jfas, " +
String sql = "WITH ul_list AS ( " +
" SELECT jtb_fasi.cod_jfas, " +
" jtb_fasi.descrizione AS descrizione_fase, " +
" mtb_colr.gestione, " +
" mtb_colr.data_collo, " +
@ -42,7 +43,6 @@ public class ProdRecuperoMaterialeHelper {
" mtb_colr.cod_tagl, " +
" SUM(mtb_colr.qta_col) AS qta_col, " +
" SUM(mtb_colr.num_cnf) AS num_cnf, " +
" mtb_colr.ser_collo, " +
" mtb_colr.partita_mag, " +
" mtb_colr.cod_jcom, " +
" mtb_colr.num_collo_rif, " +
@ -58,13 +58,14 @@ public class ProdRecuperoMaterialeHelper {
" dtb_ord_steps.gestione as gestione_ord, " +
" dtb_ord_steps.hr_num as hr, " +
" mtb_colr.riga_ord, " +
" CONVERT(INTEGER, ROUND((CAST(dtb_ord_steps.hr_num AS DECIMAL(20, 5)) / SUM(dtb_ord_steps.hr_num) OVER (PARTITION BY mtb_colr.num_collo)) * 100, 0)) as percentage_hr " +
" CONVERT(INTEGER, ROUND((CAST(dtb_ord_steps.hr_num AS DECIMAL(20, 5)) / " +
" SUM(dtb_ord_steps.hr_num) OVER (PARTITION BY mtb_colr.num_collo)) * 100, " +
" 0)) as percentage_hr " +
" FROM mtb_colr " +
" INNER JOIN mtb_colt ON mtb_colr.num_collo = mtb_colt.num_collo " +
" AND mtb_colr.data_collo = mtb_colt.data_collo " +
" AND mtb_colr.ser_collo = mtb_colt.ser_collo " +
" AND mtb_colr.gestione = mtb_colt.gestione " +
" " +
" INNER JOIN dtb_ord_steps ON dtb_ord_steps.data_ord = mtb_colr.data_ord " +
" AND dtb_ord_steps.gestione = mtb_colr.gestione " +
" AND dtb_ord_steps.num_ord = mtb_colr.num_ord " +
@ -101,7 +102,78 @@ public class ProdRecuperoMaterialeHelper {
" mtb_colr.riga_ord, " +
" dtb_ord_steps.hr_num " +
" HAVING SUM(mtb_colr.qta_col) > 0 " +
"ORDER BY data_collo DESC";
"), max_ul AS ( " +
" SELECT " +
" cod_jfas, " +
" descrizione_fase, " +
" gestione, " +
" cod_mart, " +
" cod_col, " +
" cod_tagl, " +
" ser_collo, " +
" partita_mag, " +
" cod_jcom, " +
" descrizione_art, " +
" unt_mis, " +
" num_collo_rif, " +
" data_collo_rif, " +
" ser_collo_rif, " +
" gestione_rif, " +
" segno, " +
" num_ord, " +
" data_ord, " +
" gestione_ord, " +
" riga_ord, " +
" hr, " +
" MAX (datetime_row) as max_datetime_row " +
" FROM ul_list " +
" GROUP BY cod_jfas, " +
" descrizione_fase, " +
" gestione, " +
" cod_mart, " +
" cod_col, " +
" cod_tagl, " +
" ser_collo, " +
" partita_mag, " +
" cod_jcom, " +
" descrizione_art, " +
" unt_mis, " +
" num_collo_rif, " +
" data_collo_rif, " +
" ser_collo_rif, " +
" gestione_rif, " +
" segno, " +
" num_ord, " +
" data_ord, " +
" gestione_ord, " +
" riga_ord, " +
" hr " +
") " +
" " +
"SELECT qta_col, num_cnf, * FROM max_ul " +
"LEFT OUTER JOIN ul_list ON " +
" ISNULL(max_ul.cod_jfas, '') = ISNULL(ul_list.cod_jfas, '') AND " +
" ISNULL(max_ul.descrizione_fase, '') = ISNULL(ul_list.descrizione_fase, '') AND " +
" ISNULL(max_ul.gestione, '') = ISNULL(ul_list.gestione, '') AND " +
" ISNULL(max_ul.cod_mart, '') = ISNULL(ul_list.cod_mart, '') AND " +
" ISNULL(max_ul.cod_col, '') = ISNULL(ul_list.cod_col, '') AND " +
" ISNULL(max_ul.cod_tagl, '') = ISNULL(ul_list.cod_tagl, '') AND " +
" ISNULL(max_ul.ser_collo, '') = ISNULL(ul_list.ser_collo, '') AND " +
" ISNULL(max_ul.partita_mag, '') = ISNULL(ul_list.partita_mag, '') AND " +
" ISNULL(max_ul.cod_jcom, '') = ISNULL(ul_list.cod_jcom, '') AND " +
" ISNULL(max_ul.descrizione_art, '') = ISNULL(ul_list.descrizione_art, '') AND " +
" ISNULL(max_ul.unt_mis, '') = ISNULL(ul_list.unt_mis, '') AND " +
" ISNULL(max_ul.num_collo_rif, '') = ISNULL(ul_list.num_collo_rif, '') AND " +
" ISNULL(max_ul.data_collo_rif, '') = ISNULL(ul_list.data_collo_rif, '') AND " +
" ISNULL(max_ul.ser_collo_rif, '') = ISNULL(ul_list.ser_collo_rif, '') AND " +
" ISNULL(max_ul.gestione_rif, '') = ISNULL(ul_list.gestione_rif, '') AND " +
" ISNULL(max_ul.segno, '') = ISNULL(ul_list.segno, '') AND " +
" ISNULL(max_ul.num_ord, '') = ISNULL(ul_list.num_ord, '') AND " +
" ISNULL(max_ul.data_ord, '') = ISNULL(ul_list.data_ord, '') AND " +
" ISNULL(max_ul.gestione_ord, '') = ISNULL(ul_list.gestione_ord, '') AND " +
" ISNULL(max_ul.riga_ord, '') = ISNULL(ul_list.riga_ord, '') AND " +
" ISNULL(max_ul.hr, '') = ISNULL(ul_list.hr, '') AND " +
" max_ul.max_datetime_row = ul_list.datetime_row";
Type typeOfObjectsList = new TypeToken<ArrayList<HistoryVersamentoProdULRestDTO>>() {}.getType();
SystemRESTConsumer.processSql(sql, typeOfObjectsList, new ISimpleOperationCallback<List<HistoryVersamentoProdULRestDTO>>() {