sistemata lettura inevasi steup
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20240719120302 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (!isCustomerDb(IntegryCustomerDB.Carelli_Winact))
|
||||
return;
|
||||
|
||||
createOrUpdateFunction("steup_getInevasi", "CREATE FUNCTION [dbo].[steup_getInevasi]\n" +
|
||||
"( \n" +
|
||||
" @codMdep varchar(5), @codJfas varchar(5), @dataIspezione datetime\n" +
|
||||
")\n" +
|
||||
"RETURNS TABLE \n" +
|
||||
"AS\n" +
|
||||
"RETURN \n" +
|
||||
"with ordini as (\n" +
|
||||
"select dtb_ordr.cod_mart, gtb_anag.part_iva\n" +
|
||||
"from gestfood.dbo.dtb_ordt inner join gestfood.dbo.dtb_ordr on dtb_ordt.gestione = dtb_ordr.gestione \n" +
|
||||
"and dtb_ordt.data_ord = dtb_ordr.data_ord\n" +
|
||||
"and dtb_ordt.num_ord = dtb_ordr.num_ord\n" +
|
||||
"inner join gestfood.dbo.gtb_anag on dtb_ordt.cod_anag = gtb_anag.cod_anag \n" +
|
||||
"where dtb_ordt.gestione = 'A' \n" +
|
||||
"and dtb_ordt.cod_mdep = @codMdep\n" +
|
||||
"and dtb_ordr.data_cons between DateAdd(day, -8, @dataIspezione) and DateAdd(day, -1, Cast(GETDATE() as date))\n" +
|
||||
"and dtb_ordr.flag_evaso = 'I'\n" +
|
||||
"union\n" +
|
||||
"select dtb_ordr.cod_mart, gtb_anag.part_iva\n" +
|
||||
"from carelli.dbo.dtb_ordt inner join carelli.dbo.dtb_ordr on dtb_ordt.gestione = dtb_ordr.gestione \n" +
|
||||
"and dtb_ordt.data_ord = dtb_ordr.data_ord\n" +
|
||||
"and dtb_ordt.num_ord = dtb_ordr.num_ord\n" +
|
||||
"inner join carelli.dbo.gtb_anag on dtb_ordt.cod_anag = gtb_anag.cod_anag \n" +
|
||||
"where dtb_ordt.gestione = 'A' \n" +
|
||||
"and dtb_ordt.cod_mdep = @codMdep\n" +
|
||||
"and dtb_ordr.data_cons between DateAdd(day, -8, Cast(GETDATE() as date)) and DateAdd(day, -1, Cast(GETDATE() as date))\n" +
|
||||
"and dtb_ordr.flag_evaso = 'I'\n" +
|
||||
"union\n" +
|
||||
"select dtb_ordr.cod_mart, gtb_anag.part_iva\n" +
|
||||
"from panimal.dbo.dtb_ordt inner join panimal.dbo.dtb_ordr on dtb_ordt.gestione = dtb_ordr.gestione \n" +
|
||||
"and dtb_ordt.data_ord = dtb_ordr.data_ord\n" +
|
||||
"and dtb_ordt.num_ord = dtb_ordr.num_ord\n" +
|
||||
"inner join panimal.dbo.gtb_anag on dtb_ordt.cod_anag = gtb_anag.cod_anag \n" +
|
||||
"where dtb_ordt.gestione = 'A' \n" +
|
||||
"and dtb_ordt.cod_mdep = @codMdep\n" +
|
||||
"and dtb_ordr.data_cons between DateAdd(day, -8, Cast(GETDATE() as date)) and DateAdd(day, -1, Cast(GETDATE() as date))\n" +
|
||||
"and dtb_ordr.flag_evaso = 'I' )\n" +
|
||||
"\n" +
|
||||
"select ordini.cod_mart\n" +
|
||||
"from ordini inner join mtb_aart on ordini.cod_mart = mtb_aart.cod_mart\n" +
|
||||
"inner join jrl_fasi_mtb_grup on jrl_fasi_mtb_grup.cod_mgrp = mtb_aart.cod_mgrp\n" +
|
||||
"where jrl_fasi_mtb_grup.cod_jfas = @codJfas AND\n" +
|
||||
"part_iva in (select value_string from dbo.ParseStringIntoArray((select dbo.getGestSetup('PVM', 'RILEVAZIONI_STEUP', 'ELENCO_FORN_INEVASI')), '|'))");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import it.integry.ems.service.dto.LoginAziendaDTO;
|
||||
import it.integry.ems.status.ServiceChecker;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
import it.integry.ems_model.entity.StbActivity;
|
||||
import it.integry.ems_model.utility.UtilityDate;
|
||||
import it.integry.ems_model.utility.UtilityHashMap;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -91,7 +92,7 @@ public class SteUPController {
|
||||
) {
|
||||
ServiceRestResponse response = new ServiceRestResponse();
|
||||
try {
|
||||
response.setJsonObject(steUPService.getGrigliaPluRepo(codMdep, codJfas, activityTypeId, codCmac));
|
||||
response.setJsonObject(steUPService.getGrigliaPluRepo(codMdep, codJfas, activityTypeId, codCmac, UtilityDate.getTodayWithoutTime()));
|
||||
response.setEsito(EsitoType.OK);
|
||||
} catch (Exception e) {
|
||||
logger.error(request.getRequestURI(), e);
|
||||
|
||||
@@ -692,7 +692,7 @@ public class SteUPService {
|
||||
barcodes = chkVolantino(codJfas, codMdep, barcodes, verificaVolantino, dataCreation);
|
||||
}else if(activityTypeId.equalsIgnoreCase(tipoAttivitaRotturaStock)){
|
||||
|
||||
List<HashMap<String, Object>> pluRepo = getGrigliaPluRepo(codMdep,codJfas,activityTypeId,null);
|
||||
List<HashMap<String, Object>> pluRepo = getGrigliaPluRepo(codMdep,codJfas,activityTypeId,null, dataCreation);
|
||||
if(repartiFreschi != null && repartiFreschi.contains(codJfas)){
|
||||
List<String> finalBarcodes = barcodes;
|
||||
barcodes = pluRepo.stream().filter(a-> !finalBarcodes.contains(((String) a.get("barcode")))).map(a->(String) a.get("barcode")).collect(Collectors.toList());
|
||||
@@ -798,7 +798,7 @@ public class SteUPService {
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
public List<HashMap<String, Object>> getGrigliaPluRepo(String codMdep, String codJfas, String activityTypeId, String codCmac) throws Exception {
|
||||
public List<HashMap<String, Object>> getGrigliaPluRepo(String codMdep, String codJfas, String activityTypeId, String codCmac, Date dataCreation) throws Exception {
|
||||
String sql = "SELECT dbo.steup_getListinoDepo( " + UtilityDB.valueToString(codMdep) + ") as cod_vlis";
|
||||
String codVlis = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
if (UtilityString.isNullOrEmpty(codVlis))
|
||||
@@ -862,7 +862,7 @@ public class SteUPService {
|
||||
" AND DATEDIFF(DAY, data_validita, CAST(GETDATE() AS DATE)) < 7\n" +
|
||||
" AND g.tipo_variazione = 'I'\n" +
|
||||
" UNION " +
|
||||
" SELECT cod_mart FROM dbo.steup_getInevasi("+ UtilityDB.valueToString(codMdep)+", " + UtilityDB.valueToString(codJfas)+"))";
|
||||
" SELECT cod_mart FROM dbo.steup_getInevasi("+ UtilityDB.valueToString(codMdep)+", " + UtilityDB.valueToString(codJfas)+", " + UtilityDB.valueToString(dataCreation) + "))";
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user