Nell'inserimento dei dati da griglia inserita data inizio popolamento se le griglie sono molto vecchie
This commit is contained in:
@@ -85,6 +85,15 @@ public class GiacenzaService {
|
||||
logger.debug(String.format(GiacenzaService.class.getSimpleName() + " - Deposito %s - Cancellazione kit: Timing " + ((new Date().getTime() - startDate.getTime()) / 1000) + " secs", codMdep));
|
||||
|
||||
|
||||
|
||||
String dataParm = setupGest.getSetupDepo(multiDBTransactionManager.getPrimaryConnection(), "DATI_AZIENDA", "GIACENZA_DA_INV", "DATA_INIZ", codMdep);
|
||||
Date dataIniz ;
|
||||
if (!UtilityString.isNullOrEmpty(dataParm))
|
||||
dataIniz = UtilityString.parseDate(dataParm);
|
||||
else
|
||||
throw new Exception(String.format("Data inizio popolamento non valorizzata per il depostio %s", codMdep));
|
||||
|
||||
|
||||
String sql;
|
||||
sql =
|
||||
Query.format(
|
||||
@@ -93,18 +102,18 @@ public class GiacenzaService {
|
||||
"WHERE carelli_giacenza_prog.cod_mdep = %s", codMdep);
|
||||
|
||||
List<String> articoliSalvati = UtilityDB.executeSimpleQueryOnlyFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
nuoviInserimenti(codMdep, queryArt);
|
||||
nuoviInserimenti(codMdep, dataIniz, queryArt);
|
||||
logger.debug(String.format(GiacenzaService.class.getSimpleName() + " - Deposito %s - Popolamento da griglia: Timing " + ((new Date().getTime() - startDate.getTime()) / 1000) + " secs", codMdep));
|
||||
popolaQtaCarInventario(codMdep, queryArt, articoliSalvati, codDtipRett);
|
||||
popolaQtaCarInventario(codMdep, dataIniz, queryArt, articoliSalvati, codDtipRett);
|
||||
logger.debug(String.format(GiacenzaService.class.getSimpleName() + " - Deposito %s - Popolamento da inventario: Timing " + ((new Date().getTime() - startDate.getTime()) / 1000) + " secs", codMdep));
|
||||
popolaQtaMovimenti(codMdep, queryArt, articoliSalvati);
|
||||
logger.debug(String.format(GiacenzaService.class.getSimpleName() + " - Deposito %s - Popolamento da movimenti: Timing " + ((new Date().getTime() - startDate.getTime()) / 1000) + " secs", codMdep));
|
||||
}
|
||||
|
||||
private void nuoviInserimenti(String codMdep, String queryArt) throws Exception {
|
||||
private void nuoviInserimenti(String codMdep, Date dataIniz, String queryArt) throws Exception {
|
||||
String sql = Query.format(
|
||||
"SELECT g.cod_mdep, a.cod_mart_mov as cod_mart, GETDATE() as data_ins, 'G' as tipo_car,\n" +
|
||||
"min(g.data_validita) as data_reg \n" +
|
||||
"case when min(g.data_validita) < %s THEN %s ELSE min(g.data_validita) END as data_reg \n" +
|
||||
"FROM dbo.getgrigliaacquisto(NULL, null, %s, NULL, NULL) g\n" +
|
||||
" INNER JOIN (" + queryArt + ") a ON g.cod_mart = a.cod_mart\n" +
|
||||
" INNER JOIN mtb_aart ON a.cod_mart_mov = mtb_aart.cod_mart\n" +
|
||||
@@ -115,7 +124,7 @@ public class GiacenzaService {
|
||||
" WHERE carelli_giacenza_prog.cod_mart = a.cod_mart_mov\n" +
|
||||
" AND carelli_giacenza_prog.cod_mdep = g.cod_mdep)\n" +
|
||||
"GROUP BY g.cod_mdep, a.cod_mart_mov",
|
||||
codMdep);
|
||||
dataIniz, dataIniz, codMdep);
|
||||
|
||||
List<CarelliGiacenzaProg> carelliGiacenzaProgs = new ResultSetMapper().mapQuerySetToList(multiDBTransactionManager.getPrimaryConnection(), sql, CarelliGiacenzaProg.class, OperationType.INSERT);
|
||||
|
||||
@@ -209,20 +218,12 @@ public class GiacenzaService {
|
||||
//UtilityEntity.throwEntitiesException(entityRet);
|
||||
}
|
||||
|
||||
private void popolaQtaCarInventario(String codMdep, String queryArt, List<String> articoliSalvati, String codDtipRett) throws Exception {
|
||||
private void popolaQtaCarInventario(String codMdep, Date dataIniz, String queryArt, List<String> articoliSalvati, String codDtipRett) throws Exception {
|
||||
String sql =
|
||||
Query.format("SELECT min(id_inventario) from carelli_giacenza_prog WHERE cod_mdep = %s and id_inventario is not null", codMdep);
|
||||
|
||||
Integer maxIdInv = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
|
||||
|
||||
String dataParm = setupGest.getSetupDepo(multiDBTransactionManager.getPrimaryConnection(), "DATI_AZIENDA", "GIACENZA_DA_INV", "DATA_INIZ", codMdep);
|
||||
Date dataIniz ;
|
||||
if (!UtilityString.isNullOrEmpty(dataParm))
|
||||
dataIniz = UtilityString.parseDate(dataParm);
|
||||
else
|
||||
throw new Exception(String.format("Data inizio popolamento non valorizzata per il depostio %s", codMdep));
|
||||
|
||||
sql =
|
||||
Query.format(
|
||||
"SELECT id_inventario,\n" +
|
||||
|
||||
Reference in New Issue
Block a user