Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
2024-05-24 17:56:54 +02:00
6 changed files with 4385 additions and 19 deletions

4256
IntegryManagementSystem.ipr Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -111,6 +111,10 @@ public class DocumentiExporter extends BaseEntityExporter implements IEntityExpo
DocumentDasExport exportDASAccise = ContextLoader.getCurrentWebApplicationContext().getBean(DocumentDasExport.class);
entityExportResponse = exportDASAccise.exportDASAccise(username,type, format, whereCond);
break;
case TOSCA:
DocumentiToscaExportService toscaExportService = context.getBean(DocumentiToscaExportService.class);
entityExportResponse = toscaExportService.export(username, type, format);
break;
}
}
@@ -219,6 +223,7 @@ public class DocumentiExporter extends BaseEntityExporter implements IEntityExpo
SIAN("SIAN"),
BRT("BRT"),
DAS("DAS"),
TOSCA("TOSCA"),
CHEP("CHEP");
private String text;

View File

@@ -0,0 +1,96 @@
package it.integry.ems.document.export.service;
import it.integry.ems.export.base.EntityExportResponse;
import it.integry.ems.response.FileItem;
import it.integry.ems.service.EntityProcessor;
import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
import it.integry.ems_model.entity.WtbUsersInfo;
import it.integry.ems_model.service.SetupGest;
import it.integry.ems_model.types.OperationType;
import it.integry.ems_model.utility.Query;
import it.integry.ems_model.utility.UtilityDB;
import it.integry.ems_model.utility.UtilityResultSet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@Service
@Scope(value = "request")
public class DocumentiToscaExportService {
@Autowired
MultiDBTransactionManager multiDBTransactionManager;
@Autowired
EntityProcessor entityProcessor;
@Autowired
SetupGest setupGest;
public EntityExportResponse export(String userName, String type, String format) throws Exception {
EntityExportResponse<List<FileItem>> entityExportResponse = new EntityExportResponse<>();
WtbUsersInfo wtbUsersInfo =
new WtbUsersInfo()
.setUserName(userName)
.setExportType(type)
.setFormatFile(format);
wtbUsersInfo.setOperation(OperationType.SELECT_OBJECT);
entityProcessor.processEntity(wtbUsersInfo, multiDBTransactionManager);
char charSeparator = ';';
String ext = "csv",
fileName = wtbUsersInfo.getFileName();
String sql = Query.format(
"SELECT (SELECT gtb_anag.cod_anag\n" +
" FROM gtb_anag\n" +
" INNER JOIN azienda ON azienda.part_iva = gtb_anag.part_iva\n" +
" INNER JOIN atb_forn ON gtb_anag.cod_anag = atb_forn.cod_anag) AS 'LOCATION_1',\n" +
" mtb_movi.cod_anag AS 'LOCATION_2',\n" +
" mtb_movi.data_reg AS 'DATE',\n" +
" IIF(mtb_movi.qta_car > 0, 'IN', 'OUT') AS 'DIRECTION',\n" +
" mtb_movi.num_doc AS 'REFERENCE',\n" +
" mtb_movi.cod_mart AS 'ITEM',\n" +
" ABS(mtb_movi.qta_car) AS 'QUANTITY'\n" +
"FROM mtb_movi\n" +
" INNER JOIN mtb_tcol\n" +
" ON mtb_tcol.cod_mart = mtb_movi.cod_mart\n" +
"WHERE mtb_movi.data_doc = '2024/05/23'\n" +
" AND mtb_tcol.circuito = 'TOSCA'"
);
PreparedStatement stm = multiDBTransactionManager
.getPrimaryConnection()
.prepareStatement(sql,
ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
ResultSet rs = stm.executeQuery();
byte[] csvContent = UtilityResultSet.mapResultSetToCSV(rs, charSeparator, true, false).getBytes();
rs.close();
stm.close();
fileName += new SimpleDateFormat("yyyyMMdd").format(new Date()) + "." + ext;
FileItem file = new FileItem(fileName, csvContent, ext);
entityExportResponse
.setResponse(new ArrayList<>())
.getResponse()
.add(file);
return entityExportResponse;
}
}

View File

@@ -374,10 +374,9 @@ public class CrmService {
List<EntityBase> entities = new ArrayList<EntityBase>();
String codJcomInterno = setupGest.getSetup(multiDBTransactionManager.getPrimaryConnection(), "PVM", "CONTATTI_COMMESSE", "CODJCOM_INTERNO");
if (listAttivita.size() > 0) {
for (int i = 0; i < listAttivita.size(); i++) {
CrmAttivita crmAttivita = listAttivita.get(i);
if (!listAttivita.isEmpty()) {
for (CrmAttivita crmAttivita : listAttivita) {
String activityId = crmAttivita.getActivityId();
String parentActivityId = crmAttivita.getParentActivityId();
String codJcom = crmAttivita.getCodJcom();
@@ -402,12 +401,14 @@ public class CrmService {
StbActivity stbActivity = new StbActivity();
boolean isNewActivity = activityId == null;
if (isNewActivity) {
if (parentActivityId != null) {
String tipoAnag = null, codAnag = null;
String sql = "SELECT tipo_anag, cod_anag FROM jtb_comt WHERE cod_jcom = " + UtilityDB.valueToString(codJcom);
HashMap<String, Object> result = UtilityDB.executeSimpleQueryOnlyFirstRow(multiDBTransactionManager.getPrimaryConnection(), sql);
if (result != null) {
tipoAnag = (String) result.get("tipo_anag");
codAnag = (String) result.get("cod_anag");
@@ -424,8 +425,7 @@ public class CrmService {
if (userName.equalsIgnoreCase(requestDataDTO.getUsername())) {
stbActivity.setOraViewAct(new Date());
}
} else if (codJcomInterno != null && codJcom.equals(codJcomInterno)) {
} else if (codJcom.equals(codJcomInterno)) {
String codAnag = crmAttivita.getCodAnag();
String tipoAnag = crmAttivita.getTipoAnag();
@@ -434,13 +434,13 @@ public class CrmService {
stbActivity.setTipoAnag(tipoAnag);
stbActivity.setCodAnag(codAnag);
stbActivity.setFlagTipologia("A");
if (userName.equalsIgnoreCase(requestDataDTO.getUsername())) {
stbActivity.setOraViewAct(new Date());
}
} else {
throw new Exception("Processo non valido");
}
} else {
stbActivity.setOperation(OperationType.UPDATE);
stbActivity.setActivityId(activityId);
@@ -463,18 +463,23 @@ public class CrmService {
if (activityTypeId != null) {
stbActivity.setActivityTypeId(activityTypeId);
}
if (estimatedDate != null) {
stbActivity.setEstimatedDate(estimatedDate);
}
if (estimatedTime != null) {
stbActivity.setEstimatedTime(estimatedTime);
}
if (estimatedEnddate != null) {
stbActivity.setEstimatedEnddate(estimatedEnddate);
}
if (estimatedEndtime != null) {
stbActivity.setEstimatedEndtime(estimatedEndtime);
}
if (activityDescription != null) {
stbActivity.setActivityDescription(activityDescription);
}
@@ -488,9 +493,9 @@ public class CrmService {
stbActivity.setEffectiveEndtime(effectiveEndtime);
entityProcessor.processEntity(stbActivity, true, multiDBTransactionManager);
if (isNewActivity) {
activityId = stbActivity.getActivityId();
} else {
// ELIMINO EVENTUALI RAPPORTINI SULL'ATTIVITA
JtbRLavt jtbRLavrDelete = new JtbRLavt();
@@ -498,9 +503,11 @@ public class CrmService {
jtbRLavrDelete.setNativeSql("DELETE FROM jtb_rlavr WHERE activity_id = " + UtilityDB.valueToString(activityId));
entityProcessor.processEntity(jtbRLavrDelete, true, multiDBTransactionManager);
}
String codJfas = stbActivity.getCodJfas();
boolean flag_creaRapportino = activityResultId != null && !effectiveTime.equals(DATE_NULL) && !effectiveEndtime.equals(DATE_NULL);
boolean flag_creaRapportino = activityResultId != null && effectiveTime != null && !effectiveTime.equals(DATE_NULL) && !effectiveEndtime.equals(DATE_NULL);
if (flag_creaRapportino) {
String codJflav = this.getCodJflavFromUsername(userName);
if (codJflav == null) {
@@ -526,11 +533,13 @@ public class CrmService {
entityProcessor.processEntity(jtbRLavt, true, multiDBTransactionManager);
}
entities.add(stbActivity);
}
} else {
throw new Exception("Lista attivita vuota");
}
return entities;
}

View File

@@ -581,14 +581,14 @@ public class MrpDailyMaterialReqDTO {
return this;
}
public String getCodMdep() {
return codMdep;
}
public DatiGg setCodMdep(String codMdep) {
this.codMdep = codMdep;
return this;
}
// public String getCodMdep() {
// return codMdep;
// }
//
// public DatiGg setCodMdep(String codMdep) {
// this.codMdep = codMdep;
// return this;
// }
public BigDecimal getFabbisogno() {
return fabbisogno;

View File

@@ -178,7 +178,7 @@ public class MrpDailyMaterialReqService {
.groupBy(x -> {
HashMap<String, Object> toMatch = new HashMap<>();
toMatch.put("data", x.getDataMrp());
toMatch.put("codMdep", x.getCodMdep());
// toMatch.put("codMdep", x.getCodMdep());
return toMatch;
})
.sorted((o1, o2) -> {
@@ -191,8 +191,8 @@ public class MrpDailyMaterialReqService {
for (Map.Entry<HashMap<String, Object>, List<MrpDailyMaterialReqDetDTO>> gg : listGG) {
MrpDailyMaterialReqDTO.DatiGg mrpGiorno =
new MrpDailyMaterialReqDTO.DatiGg()
.setDataMrp((Date) gg.getKey().get("data"))
.setCodMdep((String) gg.getKey().get("codMdep"));
.setDataMrp((Date) gg.getKey().get("data"));
// .setCodMdep((String) gg.getKey().get("codMdep"))
for (MrpDailyMaterialReqDetDTO x : gg.getValue()) {
giacenza = giacenza.add(x.getGiacenza());