Modifica procedura importazione ordini PUDDY
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
This commit is contained in:
@@ -38,6 +38,7 @@ import java.sql.ResultSet;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import static it.integry.ems.rules.completing.QueryRules.getSingleValue;
|
||||
@@ -87,7 +88,7 @@ public class PuddyService {
|
||||
Connection conn = multiDBTransactionManager.getPrimaryDatasource().getConnection();
|
||||
String profileDB = multiDBTransactionManager.getPrimaryDatasource().getProfile();
|
||||
ArrayNode arrayNode = objectMapper.createArrayNode();
|
||||
String rifOrd = "Ord.Provv. N. " + UtilityDB.valueToString(numOrdProv) + " del " + UtilityDB.valueDateToString(dataOrdProv, CommonConstants.DATE_FORMAT_YMD);
|
||||
String rifOrd = "Ord.Provv. N. " + UtilityDB.valueToString(numOrdProv) + " del " + UtilityString.replaceSubString(UtilityDB.valueDateToString(dataOrdProv, CommonConstants.DATE_FORMAT_DMY), "'", "");
|
||||
|
||||
|
||||
if ("NO_TD".equals(codFornTD)) {
|
||||
@@ -421,19 +422,16 @@ public class PuddyService {
|
||||
return List;
|
||||
}
|
||||
|
||||
private void importColloReso(MultiDBTransactionManager multiDBTransactionManager, MultiDBTransactionManager multiDBTransactionManagerVG, String serieOrd, Date dataOrdProv, Integer numOrdProv, String codFornTD, Date dataOrd, Integer numOrd) throws Exception {
|
||||
private void importColloReso(MultiDBTransactionManager multiDBTransactionManager, MultiDBTransactionManager multiDBTransactionManagerVG, String serieOrd, Date dataOrdProv, Integer numOrdProv, String codFornTD, Date dataOrd, Integer numOrd, String azienda) throws Exception {
|
||||
int i = 0, segno = 1;
|
||||
String aziendaOld = "";
|
||||
String sql, flagTD, gestione = "V";
|
||||
PreparedStatement info = null;
|
||||
ResultSet res = null;
|
||||
String sql, flagTD, gestione = "V", codFornTDOld = "";
|
||||
MtbColt colT = new MtbColt();
|
||||
MtbColr colR = new MtbColr();
|
||||
|
||||
Connection conn = multiDBTransactionManager.getPrimaryDatasource().getConnection();
|
||||
String profileDB = multiDBTransactionManager.getPrimaryDatasource().getProfile();
|
||||
String profileDBVG = multiDBTransactionManagerVG.getPrimaryDatasource().getProfile();
|
||||
String rifOrd = "Ord.Provv. N. " + UtilityDB.valueToString(numOrdProv) + " del " + UtilityDB.valueDateToString(dataOrdProv, CommonConstants.DATE_FORMAT_YMD);
|
||||
String rifOrd = "Ord.Provv. N. " + UtilityString.replaceSubString(UtilityDB.valueToString(numOrdProv) + " del " + UtilityDB.valueDateToString(dataOrdProv, CommonConstants.DATE_FORMAT_DMY), "'", "");
|
||||
|
||||
|
||||
if ("NO_TD".equals(codFornTD)) {
|
||||
@@ -453,7 +451,6 @@ public class PuddyService {
|
||||
" ,right(x_puddy3_prev_ordini.serie, 2) " +
|
||||
" ,x_puddy3_prev_intercode_clienti_VG.cod_anag_vg, " +
|
||||
" ,x_puddy3_prev_intercode_clienti_VG.cod_vdes_vg " +
|
||||
" ,case when x_puddy3_prev_griglie_art_vg.cod_mart is not null then 'SEVENBAR' else 'VG' end as azienda " +
|
||||
" ,righ(x_puddy3_prev_agenti.serie_vg,2) as serie_vg " +
|
||||
" FROM x_puddy3_prev_ordini left outer join x_puddy3_prev_intercode_clienti_VG on x_puddy3_prev_ordini.cod_anag = x_puddy3_prev_intercode_clienti_VG.cod_anag and " +
|
||||
" x_puddy3_prev_ordini.cod_vdes = x_puddy3_prev_intercode_clienti_VG.cod_vdes " +
|
||||
@@ -469,6 +466,7 @@ public class PuddyService {
|
||||
" x_puddy3_prev_ordini.serie = " + UtilityDB.valueToString(serieOrd) + " AND " +
|
||||
" x_puddy3_prev_ordini.data_ord_provv= " + UtilityDB.valueDateToString(dataOrdProv, CommonConstants.DATE_FORMAT_YMD) + " AND " +
|
||||
" x_puddy3_prev_ordini.num_ord_provv = " + UtilityDB.valueToString(numOrdProv) + " AND " +
|
||||
" case when x_puddy3_prev_griglie_art_vg.cod_mart is null then 'SEVENBAR' else 'VG' end = " + UtilityDB.valueToString(azienda) + " AND " +
|
||||
condResi +
|
||||
"ORDER BY 12, 1, 2, 3";
|
||||
} else {
|
||||
@@ -483,7 +481,6 @@ public class PuddyService {
|
||||
" ,right(x_puddy3_prev_ordini.serie, 2) " +
|
||||
" ,x_puddy3_prev_intercode_clienti_VG.cod_anag_vg " +
|
||||
" ,x_puddy3_prev_intercode_clienti_VG.cod_vdes_vg " +
|
||||
" ,case when x_puddy3_prev_griglie_art_vg.cod_mart is null then 'SEVENBAR' else 'VG' end as azienda " +
|
||||
" ,right(x_puddy3_prev_agenti.serie_vg,2) as serie_vg " +
|
||||
" FROM x_puddy3_prev_ordini left outer join x_puddy3_prev_intercode_clienti_VG on x_puddy3_prev_ordini.cod_anag = x_puddy3_prev_intercode_clienti_VG.cod_anag and " +
|
||||
" x_puddy3_prev_ordini.cod_vdes = x_puddy3_prev_intercode_clienti_VG.cod_vdes " +
|
||||
@@ -496,12 +493,13 @@ public class PuddyService {
|
||||
" x_puddy3_prev_ordini.serie = " + UtilityDB.valueToString(serieOrd) + " AND " +
|
||||
" x_puddy3_prev_ordini.data_ord_provv= " + UtilityDB.valueDateToString(dataOrdProv, CommonConstants.DATE_FORMAT_YMD) + " AND " +
|
||||
" x_puddy3_prev_ordini.num_ord_provv = " + UtilityDB.valueToString(numOrdProv) + " AND " +
|
||||
" case when x_puddy3_prev_griglie_art_vg.cod_mart is null then 'SEVENBAR' else 'VG' end = " + UtilityDB.valueToString(azienda) + " AND " +
|
||||
condResi +
|
||||
"ORDER BY 12, 1, 2, 3";
|
||||
}
|
||||
|
||||
info = conn.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||
res = info.executeQuery();
|
||||
PreparedStatement info = conn.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||
ResultSet res = info.executeQuery();
|
||||
int rows = UtilityDB.countRow(res);
|
||||
while (res.next()) {
|
||||
String codAnag = res.getString(1);
|
||||
@@ -515,13 +513,12 @@ public class PuddyService {
|
||||
String serCollo = res.getString(9);
|
||||
String codAnagVG = res.getString(10);
|
||||
String codVdesVG = res.getString(11);
|
||||
String azienda = res.getString(12);
|
||||
String serColloVG = res.getString(13);
|
||||
String serColloVG = res.getString(12);
|
||||
i++;
|
||||
|
||||
String codAnagAss = codAnag;
|
||||
String codVdesAss = codVdes;
|
||||
String serieColloAss = serieOrd;
|
||||
String serieColloAss = serCollo;
|
||||
if (azienda.compareTo("VG") == 0) {
|
||||
codAnagAss = codAnagVG;
|
||||
codVdesAss = codVdesVG;
|
||||
@@ -529,7 +526,7 @@ public class PuddyService {
|
||||
}
|
||||
|
||||
// Insermento testata ordine
|
||||
if (i == 1) {
|
||||
if (codFornTDOld.compareTo(codFornTD) != 0) {
|
||||
colT = new MtbColt();
|
||||
colT.setOperation(OperationType.INSERT);
|
||||
colT.setGestione(gestione);
|
||||
@@ -555,15 +552,15 @@ public class PuddyService {
|
||||
colR.setQtaCol(qtaResi);
|
||||
colT.getMtbColr().add(colR);
|
||||
|
||||
aziendaOld = azienda;
|
||||
codFornTDOld = codFornTD;
|
||||
if (i < rows) {
|
||||
res.next();
|
||||
codFornTD = res.getString(2);
|
||||
res.previous();
|
||||
}
|
||||
|
||||
if (i == rows || azienda.compareTo(aziendaOld) != 0) {
|
||||
if (aziendaOld.compareTo("VG") == 0) {
|
||||
if (i == rows || codFornTDOld.compareTo(codFornTD) != 0) {
|
||||
if (azienda.compareTo("VG") == 0) {
|
||||
entityProcessor.processEntity(colT, true, true, profileDBVG, multiDBTransactionManagerVG);
|
||||
} else {
|
||||
entityProcessor.processEntity(colT, true, true, profileDB, multiDBTransactionManager);
|
||||
@@ -575,18 +572,15 @@ public class PuddyService {
|
||||
}
|
||||
|
||||
private ServiceRestResponse importOrdine(MultiDBTransactionManager multiDBTransactionManager, String serieOrd, Date dataOrdProv, Integer numOrdProv, String flagTD, String codVage) throws Exception {
|
||||
String codFornTDOld = "";
|
||||
String aziendaOld = "";
|
||||
String sql, gestione = "V", erroreMsg = "";
|
||||
PreparedStatement info = null;
|
||||
ResultSet res = null;
|
||||
String codFornTDOld = "", aziendaOld = "", sql, gestione = "V", codVageVG = null, serieVG = null, azienda = null, gestioneDef = "V";
|
||||
ServiceRestResponse List = new ServiceRestResponse();
|
||||
DtbOrdt ordT = null;
|
||||
DtbOrdr ordR = null;
|
||||
BigDecimal scontoMerce = new BigDecimal(100);
|
||||
BigDecimal cambioMerce = new BigDecimal(100);
|
||||
BigDecimal scontoFreschezza = new BigDecimal(100);
|
||||
DtbOrdr ordR;
|
||||
Date dataOrdDef = null, dataOrdDefVG = null;
|
||||
BigDecimal scontoMerce = new BigDecimal(100), cambioMerce = new BigDecimal(100), scontoFreschezza = new BigDecimal(100);
|
||||
Integer numOrdDef = 0, numOrdDefVG = 0;
|
||||
Connection conn = multiDBTransactionManager.getPrimaryDatasource().getConnection();
|
||||
boolean existOrdDef = false;
|
||||
|
||||
String gestioneScontofreschezza = UtilityString.streNull(setupGest.getSetup(conn, "W_MLUPDSRV_CONFIG_DLG", "SETUP", "GESTIONE_SCONTO_FRESCHEZZA"));
|
||||
String profileDBVG = setupGest.getSetup("IMPORT_ORDINI", "PUDDY", "PROFILE_DB_VG");
|
||||
@@ -606,24 +600,66 @@ public class PuddyService {
|
||||
dsSync.initialize(profileDBVG);
|
||||
multiDBTransactionManagerVG.setPrimaryDs(profileDBVG);
|
||||
|
||||
// TODO: gestire controllo e sovracrittura ordine collegandosi ad entrambi i database e leggendo la serie dalla vista di sevenbar x_puddy3_prev_intercode_giro_clienti
|
||||
|
||||
// Controllo esistenza ordine
|
||||
// Acquisizione dati agente VG
|
||||
sql =
|
||||
"SELECT count(*) " +
|
||||
"SELECT cod_vage_vg, serie_vg " +
|
||||
"FROM x_puddy3_prev_agenti " +
|
||||
"WHERE codAgente = " + UtilityDB.valueToString(codVage);
|
||||
|
||||
PreparedStatement info = conn.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||
ResultSet res = info.executeQuery();
|
||||
while (res.next()) {
|
||||
codVageVG = res.getString(1);
|
||||
serieVG = res.getString(2);
|
||||
setLog(logList, dataOrdProv, numOrdProv, "ORDINE GIA' IMPORTATO SU VGALIMENTI", "ORDINE AGENTE " + codVage);
|
||||
}
|
||||
res.close();
|
||||
info.close();
|
||||
|
||||
|
||||
|
||||
// Controllo esistenza ordine su SEVENBAR
|
||||
sql =
|
||||
"SELECT num_ord, data_ord " +
|
||||
"FROM dtb_ordt " +
|
||||
"WHERE gestione = 'V' AND " +
|
||||
" dtb_ordt.serie = " + UtilityDB.valueToString(serieOrd) + " AND " +
|
||||
" DATEPART(year, dtb_ordt.data_ord) = " + UtilityDB.valueDateToString(dataOrdProv, "yyyy") + " AND " +
|
||||
" dtb_ordt.num_ord_provv = " + UtilityDB.valueToString(numOrdProv);
|
||||
|
||||
info = conn.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||
res = info.executeQuery();
|
||||
while (res.next()) {
|
||||
existOrdDef = true;
|
||||
numOrdDef = res.getInt(1);
|
||||
dataOrdDef = res.getDate(2);
|
||||
setLog(logList, dataOrdProv, numOrdProv, "ORDINE GIA' IMPORTATO SU VGALIMENTI", "ORDINE AGENTE " + codVage);
|
||||
}
|
||||
res.close();
|
||||
info.close();
|
||||
|
||||
// Controllo esistenza ordine su VG
|
||||
boolean existOrdDefVG = false;
|
||||
sql =
|
||||
"SELECT num_ord, data_ord " +
|
||||
"FROM dtb_ordt " +
|
||||
"WHERE gestione = 'V' AND " +
|
||||
" dtb_ordt.serie = " + UtilityDB.valueToString(serieOrd) + " AND " +
|
||||
" dtb_ordt.serie = " + UtilityDB.valueToString(serieVG) + " AND " +
|
||||
" DATEPART(year, dtb_ordt.data_ord) = " + UtilityDB.valueDateToString(dataOrdProv, "yyyy") + " AND " +
|
||||
" dtb_ordt.num_ord_provv = " + UtilityDB.valueToString(numOrdProv);
|
||||
Integer count = (Integer) getSingleValue(conn, sql);
|
||||
if (count != 0) {
|
||||
setLog(logList, dataOrdProv, numOrdProv, "ORDINE GIA' IMPORTATO", "ORDINE AGENTE " + codVage);
|
||||
|
||||
info = multiDBTransactionManagerVG.getPrimaryConnection().prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||
res = info.executeQuery();
|
||||
while (res.next()) {
|
||||
existOrdDefVG = true;
|
||||
numOrdDefVG = res.getInt(1);
|
||||
dataOrdDefVG = res.getDate(2);
|
||||
setLog(logList, dataOrdProv, numOrdProv, "ORDINE GIA' IMPORTATO SU VG", "ORDINE AGENTE " + codVageVG);
|
||||
}
|
||||
res.close();
|
||||
info.close();
|
||||
|
||||
try {
|
||||
/*ArrayNode arrayNode = objectMapper.createArrayNode();*/
|
||||
/*ArrayNode arrayNodeVG = objectMapper.createArrayNode();*/
|
||||
if ("S".equals(flagTD)) {
|
||||
// Acquisizione dati ordine
|
||||
sql = "SELECT x_puddy3_prev_ordini.cod_vage" +
|
||||
@@ -643,11 +679,11 @@ public class PuddyService {
|
||||
" ,x_puddy3_prev_ordini.sconto2 " +
|
||||
" ,x_puddy3_prev_ordini.sconto3 " +
|
||||
" ,x_puddy3_prev_ordini.sconto4 " +
|
||||
" ,case when x_puddy3_prev_ordini.cod_promo IS NOT NULL AND substring(x_puddy3_prev_ordini.cod_promo, 1, 2) <> 'SE' then x_puddy3_prev_ordini.cod_promo else 'SE' + replace(x_puddy3_prev_ordini.cod_promo, 'SE', '20') end as cod_promo " +
|
||||
" ,case when x_puddy3_prev_ordini.cod_promo IS NOT NULL AND substring(x_puddy3_prev_ordini.cod_promo, 1, 2) <> 'SE' then x_puddy3_prev_ordini.cod_promo else replace(x_puddy3_prev_ordini.cod_promo, 'SE', '20') end as cod_promo " +
|
||||
" ,x_puddy3_prev_intercode_clienti_VG.cod_anag_vg, " +
|
||||
" ,x_puddy3_prev_intercode_clienti_VG.cod_vdes_vg " +
|
||||
" ,x_puddy3_prev_agenti.cod_vage_vg " +
|
||||
" ,case when x_puddy3_prev_griglie_art_vg.cod_mart is not null then 'SEVENBAR' else 'VG' end as azienda " +
|
||||
" ,case when x_puddy3_prev_griglie_art_vg.cod_mart is null then 'SEVENBAR' else 'VG' end as azienda " +
|
||||
" ,x_puddy3_prev_agenti.serie_vg " +
|
||||
" FROM x_puddy3_prev_ordini left outer join x_puddy3_prev_intercode_clienti_VG on x_puddy3_prev_ordini.cod_anag = x_puddy3_prev_intercode_clienti_VG.cod_anag and " +
|
||||
" x_puddy3_prev_ordini.cod_vdes = x_puddy3_prev_intercode_clienti_VG.cod_vdes " +
|
||||
@@ -679,7 +715,7 @@ public class PuddyService {
|
||||
" ,x_puddy3_prev_ordini.sconto2 " +
|
||||
" ,x_puddy3_prev_ordini.sconto3 " +
|
||||
" ,x_puddy3_prev_ordini.sconto4 " +
|
||||
" ,case when x_puddy3_prev_ordini.cod_promo IS NOT NULL AND substring(x_puddy3_prev_ordini.cod_promo, 1, 2) <>'SE' then x_puddy3_prev_ordini.cod_promo else 'SE' + replace(x_puddy3_prev_ordini.cod_promo, 'SE', '20') end as cod_promo " +
|
||||
" ,case when x_puddy3_prev_ordini.cod_promo IS NOT NULL AND substring(x_puddy3_prev_ordini.cod_promo, 1, 2) <>'SE' then x_puddy3_prev_ordini.cod_promo else replace(x_puddy3_prev_ordini.cod_promo, 'SE', '20') end as cod_promo " +
|
||||
" ,x_puddy3_prev_intercode_clienti_VG.cod_anag_vg " +
|
||||
" ,x_puddy3_prev_intercode_clienti_VG.cod_vdes_vg " +
|
||||
" ,x_puddy3_prev_agenti.cod_vage_vg " +
|
||||
@@ -720,15 +756,15 @@ public class PuddyService {
|
||||
String codPromo = res.getString(18);
|
||||
String codAnagVG = res.getString(19);
|
||||
String codVdesVG = res.getString(20);
|
||||
String codVageVG = res.getString(21);
|
||||
String azienda = res.getString(22);
|
||||
String serieVG = res.getString(23);
|
||||
codVageVG = res.getString(21);
|
||||
azienda = res.getString(22);
|
||||
serieVG = res.getString(23);
|
||||
i++;
|
||||
|
||||
// Se si tratta di un cliente non presente in VG allora viene letto il codice cliente nuovo fittizio dell'agente
|
||||
if (codAnagVG == null){
|
||||
codAnagVG = setupGest.getSetup("IMPORT_ORDINI", "PUDDY", "NUOVO_CLIENT_AGENTE_" + codVage);
|
||||
codVdesVG = (String) getSingleValue(conn, "select cod_vdes from vtb_dest where cod_anag = " + UtilityDB.valueToString(codAnagVG));
|
||||
codVdesVG = (String) getSingleValue(multiDBTransactionManagerVG.getPrimaryConnection(), "select cod_vdes from vtb_dest where cod_anag = " + UtilityDB.valueToString(codAnagVG));
|
||||
}
|
||||
|
||||
String codVageAss = codVage;
|
||||
@@ -752,6 +788,26 @@ public class PuddyService {
|
||||
ordT.setCodVdes(codVdesAss);
|
||||
ordT.setDataOrd(dataOrdProv);
|
||||
ordT.setNumOrdProvv(numOrdProv);
|
||||
if (existOrdDefVG && azienda.compareTo("VG") == 0) {
|
||||
ordT.setOperation(OperationType.DELETE_THEN_INSERT);
|
||||
ordT.setNumOrd(numOrdDefVG);
|
||||
|
||||
HashMap<String, Object> oldPk = new HashMap<>();
|
||||
oldPk.put("gestione", gestioneDef);
|
||||
oldPk.put("numOrd", numOrdDefVG);
|
||||
oldPk.put("dataOrd", dataOrdDefVG);
|
||||
ordT.setOldPk(oldPk);
|
||||
}
|
||||
if (existOrdDef && azienda.compareTo("SEVENBAR") == 0) {
|
||||
ordT.setOperation(OperationType.DELETE_THEN_INSERT);
|
||||
ordT.setNumOrd(numOrdDef);
|
||||
|
||||
HashMap<String, Object> oldPk = new HashMap<>();
|
||||
oldPk.put("gestione", gestioneDef);
|
||||
oldPk.put("numOrd", numOrdDef);
|
||||
oldPk.put("dataOrd", dataOrdDef);
|
||||
ordT.setOldPk(oldPk);
|
||||
}
|
||||
ordT.setCodVage(codVageAss);
|
||||
ordT.setCodMdep(codMdep);
|
||||
ordT.setSerie(serieAss);
|
||||
@@ -765,7 +821,6 @@ public class PuddyService {
|
||||
|
||||
// Inserimento righe ordine
|
||||
ordR = new DtbOrdr();
|
||||
ordR.setOperation(OperationType.INSERT);
|
||||
ordR.setCodMart(codMart);
|
||||
ordR.setPartitaMag(partitaMag);
|
||||
ordR.setCodPromo(codPromo);
|
||||
@@ -786,7 +841,6 @@ public class PuddyService {
|
||||
ordR.setQtaOrd(qtaResi);
|
||||
} else if (qtaResi.compareTo(BigDecimal.ZERO) != 0 && "C".equals(flagTipoReso)) {
|
||||
/*SCONTO FRESCHEZZA*/
|
||||
ordR.setSconto5(scontoMerce);
|
||||
ordR.setQtaOrd(qtaResi);
|
||||
ordR.setCodAliq(null);
|
||||
ordR.setSconto8(scontoFreschezza);
|
||||
@@ -851,17 +905,22 @@ public class PuddyService {
|
||||
numOrdProv,
|
||||
codFornTDOld,
|
||||
ordT.getDataOrd(),
|
||||
ordT.getNumOrd());
|
||||
|
||||
// Assegnazione flag_elaborato = 'S' su righe processione
|
||||
sql = "UPDATE x_puddy3_prev_ordini SET flag_elaborato = 'S' WHERE " + condWhereRigheOrdine;
|
||||
conn.createStatement().executeUpdate(sql);
|
||||
|
||||
ordT.getNumOrd(),
|
||||
aziendaOld);
|
||||
}
|
||||
}
|
||||
res.close();
|
||||
info.close();
|
||||
|
||||
// Assegnazione flag_elaborato = 'S' su righe processione
|
||||
sql = "UPDATE x_puddy3_prev_ordini SET flag_elaborato = 'S' " +
|
||||
" WHERE x_puddy3_prev_ordini.flag_elaborato = 'N' AND " +
|
||||
" x_puddy3_prev_ordini.serie = " + UtilityDB.valueToString(serieOrd) + " AND " +
|
||||
" x_puddy3_prev_ordini.data_ord_provv= " + UtilityDB.valueDateToString(dataOrdProv, CommonConstants.DATE_FORMAT_YMD) + " AND " +
|
||||
" x_puddy3_prev_ordini.num_ord_provv = " + UtilityDB.valueToString(numOrdProv) ;
|
||||
|
||||
conn.createStatement().executeUpdate(sql);
|
||||
|
||||
multiDBTransactionManager.commitAll();
|
||||
multiDBTransactionManagerVG.commitAll();
|
||||
|
||||
@@ -870,9 +929,10 @@ public class PuddyService {
|
||||
multiDBTransactionManager.rollbackAll();
|
||||
multiDBTransactionManagerVG.rollbackAll();
|
||||
|
||||
/* List.setEsito(EsitoType.KO);
|
||||
List.setErrorMessage("ERRORE ORDINE PROVV. N." + numOrdProv + " agente " + codVage + CommonConstants.A_CAPO + e.getMessage());*/
|
||||
throw e;
|
||||
|
||||
List.setEsito(EsitoType.KO);
|
||||
List.setErrorMessage("Errore durante l'importazione dell'ordine di vendita provvisorio N." + numOrdProv + " serie " + serieOrd + " per l'agente " + codVage + " nel database " + azienda + CommonConstants.A_CAPO + CommonConstants.A_CAPO + e.getMessage());
|
||||
return List;
|
||||
}
|
||||
|
||||
return List;
|
||||
@@ -932,14 +992,14 @@ public class PuddyService {
|
||||
String emailForLog = setupGest.getSetup("IMPORT_ORDINI", "PUDDY", "EMAIL_FOR_LOG");
|
||||
if (existAnomalia) {
|
||||
if (!UtilityString.isNullOrEmpty(emailForLog)) {
|
||||
oggetto = "ERRORE Importazione ordini agente " + codVage;
|
||||
oggetto = "ERRORE IMPORTAZIONE ORDINI DI VENDITA AGENTE " + codVage;
|
||||
messaggio = resp.getErrorMessage();
|
||||
}
|
||||
|
||||
multiDBTransactionManager.rollbackAll();
|
||||
} else {
|
||||
if (!UtilityString.isNullOrEmpty(emailForLog)) {
|
||||
oggetto = "Importazione ordini agente " + codVage + " avvenuta con successo";
|
||||
oggetto = "IMPORTAZIONE ORDINI VENDITA AGENTE " + codVage + " AVVENUTA CON SUCCESSO";
|
||||
messaggio = oggetto + CommonConstants.A_CAPO;
|
||||
}
|
||||
|
||||
@@ -979,9 +1039,6 @@ public class PuddyService {
|
||||
vtbAgen.setCodVage(codVage);
|
||||
resp = importOrdAgenti(multiDBTransactionManager, codVage);
|
||||
if (resp.getEsito() == EsitoType.OK) {
|
||||
vtbAgen.setException(new EntityException("ERRORE IMPORTAZIONE ORDINE"));
|
||||
response.add(vtbAgen);
|
||||
} else {
|
||||
response.add(vtbAgen);
|
||||
}
|
||||
}
|
||||
@@ -989,7 +1046,7 @@ public class PuddyService {
|
||||
info.close();
|
||||
|
||||
// Verifica esistenza anomalie da segnalare
|
||||
try {
|
||||
/* try {
|
||||
if (!logList.isEmpty()) {
|
||||
List<FileItem> fileAttachmentList = new ArrayList<FileItem>();
|
||||
|
||||
@@ -1011,13 +1068,10 @@ public class PuddyService {
|
||||
true,
|
||||
fileAttachmentList,
|
||||
false);
|
||||
}/*else{
|
||||
mailService.sendMailPrimary(null, null, emailLog, null, null, "IMPORTAZIONE EFFETTUATA CON SUCCESSO", "Sono stati importati correttamente gli ordini dei seguenti agenti", false, false, null);
|
||||
}*/
|
||||
} catch (Exception e) {
|
||||
logger.error("NON E' STATO POSSIBILE INVIARE LA MAIL DI NOTIFICA ERRORE IMPORTAZIONE " + e.toString());
|
||||
}
|
||||
respList.add(new ServiceRestResponse(EsitoType.OK, "Importazione completata"));
|
||||
}*/
|
||||
//respList.add(new ServiceRestResponse(EsitoType.OK, "Importazione completata"));
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user