Merge remote-tracking branch 'origin/develop' 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:
@@ -10,6 +10,8 @@ public class Migration_20250522150750 extends BaseMigration implements Migration
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
if (isDMS()) return;
|
||||
|
||||
if (!existsTable( "stb_multiplier")) {
|
||||
executeStatement( "CREATE TABLE stb_multiplier\n" +
|
||||
"(\n" +
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package it.integry.ems.migration.model;
|
||||
|
||||
import it.integry.ems.migration._base.BaseMigration;
|
||||
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||
|
||||
public class Migration_20250529103927 extends BaseMigration implements MigrationModelInterface {
|
||||
|
||||
@Override
|
||||
public void up() throws Exception {
|
||||
if (isHistoryDB())
|
||||
return;
|
||||
|
||||
createSetupQuery("SI_NO", "SI_NO", "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
createSetup("PVM", "PREVISIONI_RACCOLTA", "VARIETA_EDITABLE", "N",
|
||||
"Mostra o meno il campo varietà in fase di nuova produzione", false, "SI_NO", false, false,
|
||||
false, false, false, null, false, "SELECT 'S' UNION ALL SELECT 'N'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void down() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -42,22 +42,25 @@ public class ConfigActivityRules extends QueryRules {
|
||||
blocca = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
}
|
||||
} else {
|
||||
List<Date> dataDaControllare = new ArrayList<>();
|
||||
//if (stbActivity.getEstimatedDate() != null) dataDaControllare.add(stbActivity.getEstimatedDate());
|
||||
if (stbActivity.getEffectiveDate() != null) dataDaControllare.add(stbActivity.getEffectiveDate());
|
||||
Date dataCheck;
|
||||
if (!(stbActivity.getOperation() == OperationType.DELETE && stbActivity.getEffectiveDate() == null)) {
|
||||
if (stbActivity.getEffectiveDate() != null)
|
||||
dataCheck = stbActivity.getEffectiveDate();
|
||||
else if (stbActivity.getEstimatedDate() != null)
|
||||
dataCheck = stbActivity.getEstimatedDate();
|
||||
else
|
||||
return false;
|
||||
|
||||
|
||||
for (Date data : dataDaControllare) {
|
||||
String sql =
|
||||
Query.format(
|
||||
"SELECT CAST(COUNT(*) AS BIT)\n" +
|
||||
"FROM stb_activity_check\n" +
|
||||
"WHERE stb_activity_check.cod_jcom = %s\n" +
|
||||
" AND %s BETWEEN stb_activity_check.data_iniz AND stb_activity_check.data_fine",
|
||||
stbActivity.getCodJcom(), data);
|
||||
stbActivity.getCodJcom(), dataCheck);
|
||||
|
||||
blocca = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(conn, sql);
|
||||
if (blocca)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (blocca)
|
||||
|
||||
@@ -3,6 +3,8 @@ package it.integry.ems.rules.completing;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
import it.integry.ems_model.entity.DtbOrdt;
|
||||
import it.integry.ems_model.entity.PtbPrevn;
|
||||
import it.integry.ems_model.entity.PtbPrevtFile;
|
||||
import it.integry.ems_model.types.OperationType;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityString;
|
||||
@@ -12,6 +14,31 @@ import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import java.sql.Statement;
|
||||
|
||||
public class PreventRules extends QueryRules {
|
||||
public static PtbPrevn setPtbPrevn(Connection connection, PtbPrevtFile ptbPrevtFile) throws Exception {
|
||||
String sql = "SELECT num_file_descr FROM ptb_prevn";
|
||||
Integer numFileDB = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(connection, sql);
|
||||
|
||||
String nomeFile = ptbPrevtFile.getNomeFile();
|
||||
nomeFile = nomeFile.substring(0, nomeFile.lastIndexOf("."));
|
||||
|
||||
String sqlUpdate;
|
||||
PtbPrevn ptbPrevn = new PtbPrevn();
|
||||
if (numFileDB == null || numFileDB < Integer.parseInt(nomeFile)) {
|
||||
if (numFileDB == null)
|
||||
sqlUpdate = "INSERT INTO ptb_prevn (num_file_descr) VALUES (" + UtilityDB.valueToString(Integer.parseInt(nomeFile)) + ")";
|
||||
else
|
||||
sqlUpdate = "UPDATE ptb_prevn SET num_file_descr = " + UtilityDB.valueToString(Integer.parseInt(nomeFile));
|
||||
|
||||
|
||||
ptbPrevn.setNativeSql(sqlUpdate);
|
||||
ptbPrevn.setOperation(OperationType.INSERT_OR_UPDATE);
|
||||
} else {
|
||||
ptbPrevn.setOperation(OperationType.NO_OP);
|
||||
}
|
||||
|
||||
return ptbPrevn;
|
||||
}
|
||||
|
||||
public static void updateRifOrdOfferta(Connection conn, DtbOrdt entity) throws Exception {
|
||||
String importFromOfferta = setupGest.getSetup(conn, "w_vordi_rc", "OFFERTE", "IMPORT_ORDINE_DA_OFFERTA");
|
||||
if (UtilityString.streNull(importFromOfferta).compareTo("S") == 0) {
|
||||
|
||||
@@ -69,7 +69,7 @@ public class MrpSetupHandlerService {
|
||||
}
|
||||
|
||||
public boolean isGestioneAbilitata(String dbName) {
|
||||
if (!canBeExecuted) return false;
|
||||
if (!canBeExecuted ) return false;
|
||||
return executionPermission.getOrDefault(dbName, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package it.integry.ems_model.entity;
|
||||
|
||||
import it.integry.ems_model.annotation.PK;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.annotation.Master;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
import it.integry.ems_model.annotation.Table;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
|
||||
@Master()
|
||||
@PropertyReactive()
|
||||
@Table(value = PtbPrevn.ENTITY)
|
||||
@JsonTypeName(value = PtbPrevn.ENTITY)
|
||||
public class PtbPrevn extends EntityBase {
|
||||
|
||||
public final static String ENTITY = "ptb_prevn";
|
||||
|
||||
private final static Long serialVersionUID = 1L;
|
||||
|
||||
private final static Logger logger = LogManager.getLogger();
|
||||
|
||||
public PtbPrevn() {
|
||||
super(logger);
|
||||
}
|
||||
|
||||
@SqlField(value = "num_file_descr", nullable = false)
|
||||
private Integer numFileDescr;
|
||||
|
||||
public Integer getNumFileDescr() {
|
||||
return numFileDescr;
|
||||
}
|
||||
|
||||
public PtbPrevn setNumFileDescr(Integer numFileDescr) {
|
||||
this.numFileDescr = numFileDescr;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,7 @@ package it.integry.ems_model.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import it.integry.common.var.CommonConstants;
|
||||
import it.integry.ems_model.annotation.Master;
|
||||
import it.integry.ems_model.annotation.PK;
|
||||
import it.integry.ems_model.annotation.SqlField;
|
||||
import it.integry.ems_model.annotation.Table;
|
||||
import it.integry.ems_model.annotation.*;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import org.kie.api.definition.type.PropertyReactive;
|
||||
import java.util.Date;
|
||||
@@ -40,6 +37,9 @@ public class PtbPrevtFile extends EntityBase {
|
||||
@SqlField(value = "descrizione", maxLength = 255)
|
||||
private String descrizione;
|
||||
|
||||
@Priority(value = 101)
|
||||
private PtbPrevn ptbPrevn;
|
||||
|
||||
public PtbPrevtFile() {
|
||||
super(logger);
|
||||
}
|
||||
@@ -48,31 +48,44 @@ public class PtbPrevtFile extends EntityBase {
|
||||
return idOfferta;
|
||||
}
|
||||
|
||||
public void setIdOfferta(String idOfferta) {
|
||||
public PtbPrevtFile setIdOfferta(String idOfferta) {
|
||||
this.idOfferta = idOfferta;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Date getDataGen() {
|
||||
return dataGen;
|
||||
}
|
||||
|
||||
public void setDataGen(Date dataGen) {
|
||||
public PtbPrevtFile setDataGen(Date dataGen) {
|
||||
this.dataGen = dataGen;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNomeFile() {
|
||||
return nomeFile;
|
||||
}
|
||||
|
||||
public void setNomeFile(String nomeFile) {
|
||||
public PtbPrevtFile setNomeFile(String nomeFile) {
|
||||
this.nomeFile = nomeFile;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return descrizione;
|
||||
}
|
||||
|
||||
public void setDescrizione(String descrizione) {
|
||||
public PtbPrevtFile setDescrizione(String descrizione) {
|
||||
this.descrizione = descrizione;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PtbPrevn getPtbPrevn() {
|
||||
return ptbPrevn;
|
||||
}
|
||||
|
||||
public PtbPrevtFile setPtbPrevn(PtbPrevn ptbPrevn) {
|
||||
this.ptbPrevn = ptbPrevn;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,8 @@ public class DroolsDataCompleting {
|
||||
"OrdP.drl", "DocL.drl", "LottiProd.drl", "Agenti.drl",
|
||||
"commesse.drl", "inventari.drl", "DistBase.drl",
|
||||
"tabGenTextiles.drl", "OrdWebV.drl", "ordini.drl",
|
||||
"attach.drl", "sian.drl","Integry.drl", "RossoGargano.drl"
|
||||
"attach.drl", "sian.drl","Integry.drl", "RossoGargano.drl",
|
||||
"prev.drl"
|
||||
};
|
||||
|
||||
@PreDestroy
|
||||
|
||||
@@ -43,6 +43,7 @@ public class UtilityLocalDate {
|
||||
public static boolean isAfterToday(LocalDate inputDate) {
|
||||
return inputDate != null && inputDate.isAfter(getNow());
|
||||
}
|
||||
|
||||
public static boolean isSameDay(LocalDateTime date1, LocalDateTime date2) {
|
||||
|
||||
if (date1 == null && date2 == null) {
|
||||
@@ -55,6 +56,7 @@ public class UtilityLocalDate {
|
||||
|
||||
return date1.toLocalDate().equals(date2.toLocalDate());
|
||||
}
|
||||
|
||||
public static boolean isSameDay(LocalDate date1, LocalDate date2) {
|
||||
if (date1 == null && date2 == null) {
|
||||
return true;
|
||||
@@ -72,9 +74,9 @@ public class UtilityLocalDate {
|
||||
}
|
||||
|
||||
public static LocalDate localDateFromDate(Date dateToConvert) {
|
||||
if(dateToConvert == null) return null;
|
||||
if (dateToConvert == null) return null;
|
||||
|
||||
if (dateToConvert instanceof java.sql.Date){
|
||||
if (dateToConvert instanceof java.sql.Date) {
|
||||
dateToConvert = new Date(dateToConvert.getTime());
|
||||
}
|
||||
return dateToConvert.toInstant()
|
||||
@@ -83,7 +85,7 @@ public class UtilityLocalDate {
|
||||
}
|
||||
|
||||
public static LocalDateTime localDateTimeFromDate(Date dateToConvert) {
|
||||
if(dateToConvert == null) return null;
|
||||
if (dateToConvert == null) return null;
|
||||
|
||||
return dateToConvert.toInstant()
|
||||
.atZone(currentZone)
|
||||
@@ -91,7 +93,7 @@ public class UtilityLocalDate {
|
||||
}
|
||||
|
||||
public static LocalDateTime localDateTimeFromLocalDate(LocalDate dateToConvert) {
|
||||
if(dateToConvert == null) return null;
|
||||
if (dateToConvert == null) return null;
|
||||
|
||||
return dateToConvert
|
||||
.atStartOfDay();
|
||||
@@ -121,7 +123,7 @@ public class UtilityLocalDate {
|
||||
}
|
||||
|
||||
public static Date localDateTimeToDate(LocalDateTime localDateTime) {
|
||||
if(localDateTime == null) return null;
|
||||
if (localDateTime == null) return null;
|
||||
|
||||
long seconds = localDateTimeToTime(localDateTime, null);
|
||||
return new Date(seconds * 1000);
|
||||
@@ -133,12 +135,14 @@ public class UtilityLocalDate {
|
||||
}
|
||||
|
||||
public static Date localDateToDate(LocalDate localDate) {
|
||||
if (localDate == null) return null;
|
||||
|
||||
// long seconds = localDateToTime(localDate);
|
||||
long seconds = localDate.atStartOfDay(currentZone).toEpochSecond();
|
||||
return new Date(seconds * 1000);
|
||||
}
|
||||
|
||||
public static long daysAfterDate (LocalDate dataIniz, LocalDate dataFine) {
|
||||
public static long daysAfterDate(LocalDate dataIniz, LocalDate dataFine) {
|
||||
return DAYS.between(dataIniz, dataFine);
|
||||
}
|
||||
|
||||
|
||||
27
ems-core/src/main/resources/rules/prev.drl
Normal file
27
ems-core/src/main/resources/rules/prev.drl
Normal file
@@ -0,0 +1,27 @@
|
||||
package it.integry.rules
|
||||
|
||||
import java.math.*
|
||||
import java.util.*
|
||||
import it.integry.ems_model.entity.*
|
||||
import it.integry.ems_model.base.EntityBase
|
||||
import it.integry.ems.rules.util.*
|
||||
import it.integry.ems.rules.completing.*
|
||||
import it.integry.ems.sync.MultiDBTransaction.Connection;
|
||||
import it.integry.ems_model.types.OperationType
|
||||
import it.integry.ems_model.utility.UtilityDB
|
||||
|
||||
global Connection conn
|
||||
global String username
|
||||
global Boolean postRulesEnabled
|
||||
global Boolean checkRulesEnabled
|
||||
global Boolean completeRulesEnabled
|
||||
|
||||
rule "completeNumFilePrev"
|
||||
no-loop
|
||||
when
|
||||
eval(completeRulesEnabled)
|
||||
$entity: PtbPrevtFile(nomeFile != null)
|
||||
then
|
||||
PtbPrevn ptbPrevn = PreventRules.setPtbPrevn(conn, $entity);
|
||||
modify ( $entity ) { setPtbPrevn(ptbPrevn) }
|
||||
end
|
||||
@@ -651,8 +651,10 @@ public class ActivityService {
|
||||
" FROM stb_activity " +
|
||||
" WHERE stb_activity.parent_activity_id = " + UtilityDB.valueToString(parentStbActivity.getActivityId()) + " AND " +
|
||||
"stb_activity.user_name = " + UtilityDB.valueToString(user.getUsername()) + " AND " +
|
||||
"stb_activity.estimated_time = " + UtilityDB.valueDateToString(startDate, CommonConstants.DATETIME_FORMAT_YMD);
|
||||
|
||||
"stb_activity.estimated_time = " + UtilityDB.valueDateToString(startDate, CommonConstants.DATETIME_FORMAT_YMD) +
|
||||
(!UtilityString.isNullOrEmpty(planActivityDTO.getDescription())?
|
||||
" AND " +
|
||||
"stb_activity.activity_description = " + UtilityDB.valueToString(planActivityDTO.getDescription()):"");
|
||||
|
||||
String activityId = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
|
||||
|
||||
|
||||
@@ -2136,9 +2136,6 @@ public class DocumentService {
|
||||
|
||||
if (!archiviazioneElettronica && impostazioniStampa != null && !UtilityString.isNullOrEmpty(impostazioniStampa.getPrinterName()) && printDocumentRequest.isStampa()) {
|
||||
byte[] printedReport = printerService.printReportType(reportTypeDto);
|
||||
|
||||
if (i > 0)
|
||||
continue;
|
||||
listPdf.add(printedReport);
|
||||
} else {
|
||||
listPdf.add(generateReportFromCodDtip(printDocumentRequest, codDtip, i));
|
||||
|
||||
Reference in New Issue
Block a user