Merge branch 'hotfix/Hotfix-1' into develop
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:
@@ -93,9 +93,7 @@ public class UserCacheService {
|
||||
.filter(x -> x.getUsername().equalsIgnoreCase(user.getUsername()))
|
||||
.findFirst();
|
||||
|
||||
if (existentUser.isPresent()) {
|
||||
users.remove(existentUser.get());
|
||||
}
|
||||
existentUser.ifPresent(users::remove);
|
||||
|
||||
users.add(user);
|
||||
}
|
||||
|
||||
@@ -88,6 +88,13 @@ public class OrtoFruttaProductionService {
|
||||
"SETUP",
|
||||
"FASE_RACC");
|
||||
|
||||
String codDtipLavCar = setupGest.getSetup(multiDBTransactionManager.getPrimaryConnection(), "CRUSCOTTO_PRODUZIONE",
|
||||
"SETUP",
|
||||
"COD_DTIP_CAR");
|
||||
String serDocLavCar = setupGest.getSetup(multiDBTransactionManager.getPrimaryConnection(), "CRUSCOTTO_PRODUZIONE",
|
||||
"SETUP",
|
||||
"SER_DOC_CAR");
|
||||
|
||||
if (UtilityString.isNullOrEmpty(dto.getSerDocProvv()))
|
||||
dto.setSerDocProvv(serDocAcqCar);
|
||||
|
||||
@@ -97,18 +104,38 @@ public class OrtoFruttaProductionService {
|
||||
if (UtilityString.isNullOrEmpty(dto.getCodJfas())) {
|
||||
dto.setCodJfas(codJfas);
|
||||
}
|
||||
//controllo se il DDT richiesto è già occupato da un altro certificato
|
||||
//<editor-fold desc=" controllo se il Certificato richiesto è già occupato nell'anno">
|
||||
|
||||
String sql = "SELECT data_collo,ser_collo,num_collo,gestione\n" +
|
||||
"FROM mtb_colt\n" +
|
||||
"WHERE YEAR(data_doc) = YEAR(" + UtilityDB.valueDateToString(UtilityLocalDate.localDateToDate(dto.getDataDoc()), CommonConstants.DATE_FORMAT_YMD) + ")\n" +
|
||||
" AND num_doc = " + UtilityDB.valueToString(dto.getNumDoc()) + "\n" +
|
||||
" AND cod_anag = " + UtilityDB.valueToString(dto.getCodAnag()) + "\n" +
|
||||
"AND cod_dtip = " + UtilityDB.valueToString(codDtipLavCar) + "\n" +
|
||||
"and ser_doc = " + UtilityDB.valueToString(serDocLavCar) + "\n";
|
||||
MtbColt mtbcolt = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), sql, MtbColt.class);
|
||||
if (mtbcolt != null && (UtilityInteger.isNullOrZero(dto.getNumCollo()) || mtbcolt.equalsKey(new MtbColt(dto.getGestione(),dto.getDataCollo(),dto.getNumCollo(),dto.getSerCollo())))) {
|
||||
throw new Exception(String.format("Il certificato n. %d per l'anno %s è già stato registrato!",dto.getNumDoc(),UtilityLocalDate.formatDate(dto.getDataDoc(),"yyyy")));
|
||||
}
|
||||
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold desc=" controllo se il DDT richiesto è già occupato da un altro certificato">
|
||||
|
||||
sql = "SELECT data_collo,ser_collo,num_collo,gestione\n" +
|
||||
"FROM mtb_colt\n" +
|
||||
"WHERE data_doc_provv = " + UtilityDB.valueDateToString(UtilityLocalDate.localDateToDate(dto.getDataDocProvv()), CommonConstants.DATE_FORMAT_YMD) + "\n" +
|
||||
" AND num_doc_provv = " + UtilityDB.valueToString(dto.getNumDocProvv()) + "\n" +
|
||||
" AND cod_anag = " + UtilityDB.valueToString(dto.getCodAnag()) + "\n" +
|
||||
"AND cod_dtip_provv = " + UtilityDB.valueToString(dto.getCodDtipProvv()) + "\n" +
|
||||
"and ser_doc_provv = " + UtilityDB.valueToString(dto.getSerDocProvv()) + "\n";
|
||||
MtbColt mtbcolt = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), sql, MtbColt.class);
|
||||
mtbcolt = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), sql, MtbColt.class);
|
||||
if (mtbcolt != null && (UtilityInteger.isNullOrZero(dto.getNumCollo()) || mtbcolt.getNumCollo().compareTo(dto.getNumCollo()) != 0)) {
|
||||
throw new Exception("Il documento di trasporto inserito è già esistente!");
|
||||
}
|
||||
|
||||
//</editor-fold>
|
||||
|
||||
//</editor-fold>
|
||||
|
||||
//<editor-fold desc="Salvataggio dati base collo e Activity">
|
||||
@@ -220,14 +247,8 @@ public class OrtoFruttaProductionService {
|
||||
|
||||
//<editor-fold desc="Generazione Certificato">
|
||||
//Genero testata certificato di lavoro
|
||||
String codDtipLavCar = setupGest.getSetup(multiDBTransactionManager.getPrimaryConnection(), "CRUSCOTTO_PRODUZIONE",
|
||||
"SETUP",
|
||||
"COD_DTIP_CAR");
|
||||
String serDocLavCar = setupGest.getSetup(multiDBTransactionManager.getPrimaryConnection(), "CRUSCOTTO_PRODUZIONE",
|
||||
"SETUP",
|
||||
"SER_DOC_CAR");
|
||||
//se esiste un certificato per il carico in salvataggio con un numero diverso da quello selezionato lo vado a cancellare
|
||||
deleteOldCertificatoIfExists(activityId,codDtipLavCar,dto);
|
||||
deleteOldCertificatoIfExists(activityId, codDtipLavCar, dto);
|
||||
|
||||
DtbDoct docLav = new DtbDoct();
|
||||
docLav
|
||||
@@ -408,15 +429,15 @@ public class OrtoFruttaProductionService {
|
||||
return collo;
|
||||
}
|
||||
|
||||
private boolean deleteOldCertificatoIfExists(String activityId, String codDtipLavCar, AccettazioneOrtoFruttaDTO dto) throws Exception{
|
||||
private boolean deleteOldCertificatoIfExists(String activityId, String codDtipLavCar, AccettazioneOrtoFruttaDTO dto) throws Exception {
|
||||
String sql = "SELECT * from dtb_doct where activity_id = {} and cod_dtip = {} and cod_anag = {} and num_doc <> {}";
|
||||
|
||||
DtbDoct oldDoc = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(),Query.format(sql,activityId,codDtipLavCar,dto.getCodAnag(),dto.getNumDoc()),DtbDoct.class);
|
||||
if(oldDoc == null)
|
||||
DtbDoct oldDoc = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), Query.format(sql, activityId, codDtipLavCar, dto.getCodAnag(), dto.getNumDoc()), DtbDoct.class);
|
||||
if (oldDoc == null)
|
||||
return false;
|
||||
|
||||
oldDoc.setOperation(OperationType.DELETE);
|
||||
entityProcessor.processEntity(oldDoc,true,multiDBTransactionManager);
|
||||
entityProcessor.processEntity(oldDoc, true, multiDBTransactionManager);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1637,58 +1637,56 @@ public class PvmService {
|
||||
if (!onlyResiduo) {
|
||||
|
||||
|
||||
if (mtbColt != null) {
|
||||
String queryrows = "SELECT mtb_colr.*, mtb_aart.descrizione AS descrizione, mtb_partita_mag.flag_stato as flag_stato_partita "
|
||||
+ "FROM mtb_colr "
|
||||
+ "LEFT OUTER JOIN mtb_aart ON mtb_colr.cod_mart = mtb_aart.cod_mart "
|
||||
+ "LEFT OUTER JOIN mtb_partita_mag ON mtb_colr.cod_mart = mtb_partita_mag.cod_mart AND mtb_colr.partita_mag = mtb_partita_mag.partita_mag "
|
||||
+ "WHERE "
|
||||
+ whereCondGestione
|
||||
+ " num_collo = " + UtilityDB.valueToString(datiCollo.get("num")) + " AND "
|
||||
+ " RIGHT(YEAR(data_collo), 2) = " + UtilityDB.valueToString(datiCollo.get("anno")) + " AND "
|
||||
+ " ser_collo = " + UtilityDB.valueToString(datiCollo.get("serie"));
|
||||
String queryrows = "SELECT mtb_colr.*, mtb_aart.descrizione AS descrizione, mtb_partita_mag.flag_stato as flag_stato_partita "
|
||||
+ "FROM mtb_colr "
|
||||
+ "LEFT OUTER JOIN mtb_aart ON mtb_colr.cod_mart = mtb_aart.cod_mart "
|
||||
+ "LEFT OUTER JOIN mtb_partita_mag ON mtb_colr.cod_mart = mtb_partita_mag.cod_mart AND mtb_colr.partita_mag = mtb_partita_mag.partita_mag "
|
||||
+ "WHERE "
|
||||
+ whereCondGestione
|
||||
+ " num_collo = " + UtilityDB.valueToString(datiCollo.get("num")) + " AND "
|
||||
+ " RIGHT(YEAR(data_collo), 2) = " + UtilityDB.valueToString(datiCollo.get("anno")) + " AND "
|
||||
+ " ser_collo = " + UtilityDB.valueToString(datiCollo.get("serie"));
|
||||
|
||||
PreparedStatement psRows = multiDBTransactionManager.prepareStatement(queryrows);
|
||||
ResultSet rsRows = psRows.executeQuery();
|
||||
PreparedStatement psRows = multiDBTransactionManager.prepareStatement(queryrows);
|
||||
ResultSet rsRows = psRows.executeQuery();
|
||||
|
||||
List<HashMap<String, Object>> mapList = ResultSetMapper.mapResultSetToHashMap(rsRows);
|
||||
List<HashMap<String, Object>> mapList = ResultSetMapper.mapResultSetToHashMap(rsRows);
|
||||
|
||||
List<MtbColr> rows = new ArrayList<MtbColr>();
|
||||
List<MtbColr> rows = new ArrayList<MtbColr>();
|
||||
|
||||
for (HashMap<String, Object> mapRow : mapList) {
|
||||
MtbColr row = new MtbColr();
|
||||
for (HashMap<String, Object> mapRow : mapList) {
|
||||
MtbColr row = new MtbColr();
|
||||
|
||||
row.setGestione(UtilityHashMap.getValueIfExists(mapRow, "gestione"));
|
||||
row.setDataCollo(UtilityLocalDate.localDateFromDate(UtilityHashMap.getValueIfExists(mapRow, "data_collo")));
|
||||
row.setSerCollo(UtilityHashMap.getValueIfExists(mapRow, "ser_collo"));
|
||||
row.setNumCollo(UtilityHashMap.getValueIfExists(mapRow, "num_collo"));
|
||||
row.setCodMart(UtilityHashMap.getValueIfExists(mapRow, "cod_mart"));
|
||||
row.setPartitaMag(UtilityHashMap.getValueIfExists(mapRow, "partita_mag"));
|
||||
row.setQtaCol(UtilityHashMap.getValueIfExists(mapRow, "qta_col"));
|
||||
row.setQtaCnf(UtilityHashMap.getValueIfExists(mapRow, "qta_cnf"));
|
||||
row.setNumCnf(UtilityHashMap.getValueIfExists(mapRow, "num_cnf"));
|
||||
row.setRiga(UtilityHashMap.getValueIfExists(mapRow, "riga"));
|
||||
row.setRigaOrd(UtilityHashMap.getValueIfExists(mapRow, "riga_ord"));
|
||||
row.setDataOrd(UtilityLocalDate.localDateFromDate(UtilityHashMap.getValueIfExists(mapRow, "data_ord")));
|
||||
row.setNumOrd(UtilityHashMap.getValueIfExists(mapRow, "num_ord"));
|
||||
row.setNumEtich(UtilityHashMap.getValueIfExists(mapRow, "num_etich"));
|
||||
row.setDatetimeRow(UtilityLocalDate.localDateTimeFromDate(UtilityHashMap.<Timestamp>getValueIfExists(mapRow, "datetime_row")));
|
||||
row.setCodJcom(UtilityHashMap.getValueIfExists(mapRow, "cod_jcom"));
|
||||
row.setDescrizione(UtilityHashMap.getValueIfExists(mapRow, "descrizione"));
|
||||
row.setGestioneRif(UtilityHashMap.getValueIfExists(mapRow, "gestione_rif"));
|
||||
row.setDataColloRif(UtilityLocalDate.localDateFromDate(UtilityHashMap.getValueIfExists(mapRow, "data_collo_rif")));
|
||||
row.setNumColloRif(UtilityHashMap.getValueIfExists(mapRow, "num_collo_rif"));
|
||||
row.setSerColloRif(UtilityHashMap.getValueIfExists(mapRow, "ser_collo_rif"));
|
||||
row.setOperation(OperationType.SELECT_OBJECT);
|
||||
row.setOnlyPkMaster(false);
|
||||
row.setGestione(UtilityHashMap.getValueIfExists(mapRow, "gestione"));
|
||||
row.setDataCollo(UtilityLocalDate.localDateFromDate(UtilityHashMap.getValueIfExists(mapRow, "data_collo")));
|
||||
row.setSerCollo(UtilityHashMap.getValueIfExists(mapRow, "ser_collo"));
|
||||
row.setNumCollo(UtilityHashMap.getValueIfExists(mapRow, "num_collo"));
|
||||
row.setCodMart(UtilityHashMap.getValueIfExists(mapRow, "cod_mart"));
|
||||
row.setPartitaMag(UtilityHashMap.getValueIfExists(mapRow, "partita_mag"));
|
||||
row.setQtaCol(UtilityHashMap.getValueIfExists(mapRow, "qta_col"));
|
||||
row.setQtaCnf(UtilityHashMap.getValueIfExists(mapRow, "qta_cnf"));
|
||||
row.setNumCnf(UtilityHashMap.getValueIfExists(mapRow, "num_cnf"));
|
||||
row.setRiga(UtilityHashMap.getValueIfExists(mapRow, "riga"));
|
||||
row.setRigaOrd(UtilityHashMap.getValueIfExists(mapRow, "riga_ord"));
|
||||
row.setDataOrd(UtilityLocalDate.localDateFromDate(UtilityHashMap.getValueIfExists(mapRow, "data_ord")));
|
||||
row.setNumOrd(UtilityHashMap.getValueIfExists(mapRow, "num_ord"));
|
||||
row.setNumEtich(UtilityHashMap.getValueIfExists(mapRow, "num_etich"));
|
||||
row.setDatetimeRow(UtilityLocalDate.localDateTimeFromDate(UtilityHashMap.<Timestamp>getValueIfExists(mapRow, "datetime_row")));
|
||||
row.setCodJcom(UtilityHashMap.getValueIfExists(mapRow, "cod_jcom"));
|
||||
row.setDescrizione(UtilityHashMap.getValueIfExists(mapRow, "descrizione"));
|
||||
row.setGestioneRif(UtilityHashMap.getValueIfExists(mapRow, "gestione_rif"));
|
||||
row.setDataColloRif(UtilityLocalDate.localDateFromDate(UtilityHashMap.getValueIfExists(mapRow, "data_collo_rif")));
|
||||
row.setNumColloRif(UtilityHashMap.getValueIfExists(mapRow, "num_collo_rif"));
|
||||
row.setSerColloRif(UtilityHashMap.getValueIfExists(mapRow, "ser_collo_rif"));
|
||||
row.setOperation(OperationType.SELECT_OBJECT);
|
||||
row.setOnlyPkMaster(false);
|
||||
|
||||
rows.add(row);
|
||||
}
|
||||
rsRows.close();
|
||||
psRows.close();
|
||||
rows.add(row);
|
||||
}
|
||||
rsRows.close();
|
||||
psRows.close();
|
||||
|
||||
mtbColt.setMtbColr(rows);
|
||||
}
|
||||
mtbColt.setMtbColr(rows);
|
||||
} else {
|
||||
query = "SELECT mvw_sitart_udc_det_inventario.*, mtb_partita_mag.data_scad " +
|
||||
" FROM mvw_sitart_udc_det_inventario " +
|
||||
|
||||
Reference in New Issue
Block a user