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,7 +1637,6 @@ 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 "
|
||||
@@ -1688,7 +1687,6 @@ public class PvmService {
|
||||
psRows.close();
|
||||
|
||||
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