Compare commits

..

29 Commits

Author SHA1 Message Date
7522092a12 Finish Hotfix-1
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-12-12 09:58:37 +01:00
4dc0174800 Fix su convert mvwSitart to mtbColr 2025-12-12 09:58:32 +01:00
3a2ceaf217 Finish Hotfix-100
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-12-11 16:31:09 +01:00
c783f69a49 aggiunta setup per esportare 2025-12-11 16:30:22 +01:00
0854acacfb Merge branch 'hotfix/Hotfix-1'
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-12-11 10:30:16 +01:00
1aba141c9f Aggiunto database tempestadi nei customer db 2025-12-11 10:30:02 +01:00
82d7efc00c Merge branch 'hotfix/Hotfix-1'
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-12-11 10:13:39 +01:00
c6c2739525 Aggiunto database tempestadi nei customer db 2025-12-11 10:13:21 +01:00
798e5b532e Finish Hotfix-1
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-12-10 18:48:17 +01:00
c27c96c3d9 Aggiunto parallel stream in retrieve items dalla cache 2025-12-10 18:48:11 +01:00
0ba9297f39 Finish Hotfix-1
Some checks failed
IntegryManagementSystem_Multi/pipeline/head Something is wrong with the build of this commit
2025-12-10 18:47:36 +01:00
7c036172d8 Aggiunto parallel stream in retrieve items dalla cache 2025-12-10 18:47:22 +01:00
bb47dd458e Finish FixSavePreventivo
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-12-10 16:22:40 +01:00
530b6af4ef [CRM] fix completeOrder 2025-12-10 16:20:22 +01:00
6b71d6b784 Finish Hotfix-1
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-12-10 13:35:53 +01:00
de4d8d225f Aggiunto codMart nella richiesta di retrieveGiacenza 2025-12-10 13:35:43 +01:00
755e7394b4 Finish Hotfix-1
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-12-10 12:19:31 +01:00
ce06683722 Fix duplicate key su mtbCols 2025-12-10 12:19:11 +01:00
7a5c024005 Finish Hotfix-100
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-12-10 12:16:13 +01:00
c82f2a57d8 gestito errore date promo duplicate e sistemata retun dei Thread 2025-12-10 12:13:13 +01:00
b9e863a563 Merge branch 'hotfix/Hotfix-1'
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-12-10 12:01:54 +01:00
60e4429c3f [ANOMALIE UL]
- aggiunta eliminazione livello anomalia
2025-12-10 12:01:44 +01:00
d7012d4e1f eliminta conversione caratteri e sistemata data iniz promo 2025-12-10 11:44:10 +01:00
6a237ce4d9 Finish Hotfix-100
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-12-09 15:03:33 +01:00
a64932d918 correzioni ad esportazione e importazione dialogo 2025-12-09 15:03:21 +01:00
a15d009f76 Merge branch 'hotfix/Hotfix-1'
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-12-09 14:32:50 +01:00
a62f37d930 aggiornamento menu 2025-12-09 14:32:39 +01:00
a4a2b34379 Merge branch 'release/Release-1'
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-12-09 12:44:05 +01:00
f2d67ea89d anomalie merce
All checks were successful
IntegryManagementSystem_Multi/pipeline/head This commit looks good
2025-12-09 12:43:27 +01:00
25 changed files with 1646 additions and 265 deletions

View File

@@ -152,7 +152,7 @@ public class EntityCacheComponent implements ApplicationListener {
snapshot = entityCache.get(customerDB)
.get(tableName)
.values()
.stream()
.parallelStream()
.map(x -> (T) x.clone());
if (filterPredicate != null)

View File

@@ -119,7 +119,10 @@ public enum IntegryCustomer {
IntegryCustomerDB.Suit_TenutaArianna,
IntegryCustomerDB.Suit_Valpietro),
Tempesta(IntegryCustomerDB.Tempesta_Tempesta,
IntegryCustomerDB.Tempesta_VivaiTempesta),
IntegryCustomerDB.Tempesta_DI,
IntegryCustomerDB.Tempesta_VivaiTempesta,
IntegryCustomerDB.Tempesta_VivaiTempesta_DI
),
Tosca(IntegryCustomerDB.Tosca_Ba,
IntegryCustomerDB.Tosca_Ce,
IntegryCustomerDB.Tosca_Cz,

View File

@@ -198,7 +198,9 @@ public enum IntegryCustomerDB {
Tempesta_Tempesta("tempesta"),
Tempesta_DI("tempestadi"),
Tempesta_VivaiTempesta("vivaitempesta"),
Tempesta_VivaiTempesta_DI("vivaitempestadi"),
Tosca_Ba("tosca_ba"),

View File

@@ -0,0 +1,19 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20251209114959 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
executeStatement("alter table dbo.mtb_cols add valore varchar(200)");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -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_20251211162655 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", "ORDINI_V_SLIM2K", "EXPORT_ORDINI", "N",
"Esporta gli ordini già esportati", false, "SI_NO", false, false,
false, false, false, null, false, "SELECT 'S' UNION ALL SELECT 'N'");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -63,6 +63,9 @@ public class MtbCols extends EntityBase {
@SqlField(value = "causale", nullable = false)
private Causale causale;
@SqlField(value = "valore", nullable = true)
private String valore;
public MtbCols() {
super(logger);
}
@@ -157,9 +160,18 @@ public class MtbCols extends EntityBase {
return this;
}
public String getValore() {
return valore;
}
public MtbCols setValore(String valore) {
this.valore = valore;
return this;
}
public enum Causale implements IBaseEnum<Causale> {
CREAZIONE((short) 0), RETTIFICA((short) 1), POSIZIONAMENTO((short) 2), VERSAMENTO((short) 3);
CREAZIONE((short) 0), RETTIFICA((short) 1), POSIZIONAMENTO((short) 2), VERSAMENTO((short) 3), ANOMALIA_ASSOCIATA((short) 4), ANOMALIA_RIMOSSA((short) 5);
private final short value;

View File

@@ -34,15 +34,7 @@ public class UtilityThread {
int finalI = i;
calls.add(() -> {
try {
return runnables.get(finalI).run();
} catch (Exception ex) {
logger.error("executeParallel", ex);
//if (rethrowError) throw ex;
}
return null;
return runnables.get(finalI).run();
});
}

File diff suppressed because one or more lines are too long

View File

@@ -1654,13 +1654,18 @@ public class DocumentiDialogoImportServices {
boolean existOrd = isExistOrdA(codAnag, codMdep, dataOrd, numOrd);
if (!UtilityString.isNullOrEmpty(rifOrd)) {
if (!existOrd) {
//Vs. Ord. N. 11490 del 06-09-2013
String[] datiOrdine = rifOrd.split(" ");
numOrd = Integer.parseInt(datiOrdine[3]);
dataOrd = UtilityString.parseDate(datiOrdine[5]);
if ( UtilityString.isNumber(datiOrdine[3]))
numOrd = Integer.parseInt(datiOrdine[3]);
try {
dataOrd = UtilityString.parseDate(datiOrdine[5]);
} catch (Exception e) {
logger.error(e.getMessage());
}
}
existOrd = isExistOrdA(codAnag, codMdep, dataOrd, numOrd);

View File

@@ -388,6 +388,8 @@ public class DocumentiExportManagerService {
query = UtilityDB.addwhereCond(query, whereCondDoc, false);
List<HashMap<String, Object>> listaDoc = UtilityDB.executeSimpleQuery(conn, query);
if (listaDoc == null || listaDoc.isEmpty())
throw new Exception("Nessun documento esportato");
for (HashMap<String, Object> doc : listaDoc) {
String codAnag = UtilityHashMap.getValueIfExists(doc, "cod_anag");
@@ -731,7 +733,21 @@ public class DocumentiExportManagerService {
query = UtilityDB.addwhereCond(query, whereCond, true);
query = UtilityDB.addwhereCond(query, whereCondFiltro, true);
String stringFile = new ResultSetMapper().mapQueryToCSV(conn, query, DocumentiDialogoDTO.Export.class, '\t', true, true);
PreparedStatement psRow = multiDBTransactionManager.getPrimaryConnection()
.prepareStatement(query,
ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
ResultSet rsRow = psRow.executeQuery();
rsRow.last();
int count = rsRow.getRow(); // numero righe
rsRow.beforeFirst();
String stringFile = new ResultSetMapper().mapResultSetToCSV(rsRow, DocumentiDialogoDTO.Export.class, '\t', true, true);
rsRow.close();
psRow.close();
if (count == 0 ) {
throw new Exception("La query di estrazione righe non ha ritornato nessun risultato");
}
if (!UtilityString.isNullOrEmpty(stringFile)) {
String filePath = pathFile + File.separator + fileName;

View File

@@ -338,7 +338,7 @@ public class CrmService {
);
HashMap<String, Object> ordineImportato = UtilityDB.executeSimpleQueryOnlyFirstRow(conn, sql);
if ((ordineImportato != null || ordineImportato.get("activity_id") != null) && completeOrder.getActivityId() == null)
if (completeOrder.getActivityId() == null && ordineImportato != null && ordineImportato.get("activity_id") != null)
completeOrder.setActivityId(ordineImportato.get("activity_id").toString());
if ("S".equals(ordineImportato.get("flag_elaborato").toString()))

View File

@@ -10,11 +10,13 @@ import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
import it.integry.ems_model.base.EntityBase;
import it.integry.ems_model.entity.DtbOrdr;
import it.integry.ems_model.entity.DtbOrdt;
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.UtilityBigDecimal;
import it.integry.ems_model.utility.UtilityDB;
import it.integry.ems_model.utility.UtilityHashMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
@@ -26,6 +28,9 @@ public class OrdiniVSlim2kService {
private final EntityProcessor entityProcessor;
private final EmsServices emsServices;
@Autowired
private SetupGest setupGest;
public OrdiniVSlim2kService(EntityProcessor entityProcessor, EmsServices emsServices) {
this.entityProcessor = entityProcessor;
this.emsServices = emsServices;
@@ -43,11 +48,11 @@ public class OrdiniVSlim2kService {
List<HashMap<String, Object>> articoli = new ArrayList<>();
List<HashMap<String, Object>> export = new ArrayList<>();
for(DtbOrdt ord : groupOrdini.keySet()) {
for (DtbOrdt ord : groupOrdini.keySet()) {
for (DtbOrdr dtbOrdr : groupOrdini.get(ord)) {
String sql =
Query.format("SELECT * FROM dtb_ordt WHERE gestione = %s AND data_ord = %s AND num_ord = %s",
ord.getGestione(), ord.getDataOrd(), ord.getNumOrd());
ord.getGestione(), ord.getDataOrd(), ord.getNumOrd());
ord = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), sql, DtbOrdt.class);
BigDecimal qtaCnf;
@@ -73,48 +78,51 @@ public class OrdiniVSlim2kService {
}
entityProcessor.processEntity(ord, multiDBTransactionManager, false);
boolean exportOrdini = setupGest.getSetupBoolean(multiDBTransactionManager.getPrimaryConnection(), "PVM", "ORDINI_V_SLIM2K", "EXPORT_ORDINI");
DtbOrdt finalOrd = ord;
Optional<HashMap<String, Object>> exportOpt = export.stream()
.filter(x -> ((String) x.get("cod_anag")).equalsIgnoreCase(finalOrd.getCodAnag())).findFirst();
HashMap<String, Object> datiExport;
if ( exportOpt.isPresent() ) {
datiExport = exportOpt.get();
} else {
String query =
Query.format(
"SELECT wtb_clie.cod_anag, " +
"wtb_users.user_name, wtb_users.password, wtb_users_info.format_file, COUNT(wtb_users_info.format_file) over (partition by wtb_users_info.user_name) as count_export" +
" FROM wtb_users " +
"INNER JOIN wtb_users_info ON wtb_users.User_name = wtb_users_info.user_name " +
"INNER JOIN wtb_clie ON wtb_users.User_name = wtb_clie.user_name " +
" WHERE wtb_users_info.flag_state = 'S' and " +
" wtb_clie.cod_anag = %s AND \n" +
" wtb_users_info.export_type = %s",
ord.getCodAnag(), EntityExportType.ORDINI_VENDITA.getText());
datiExport = UtilityDB.executeSimpleQueryOnlyFirstRow(multiDBTransactionManager.getPrimaryConnection(), query);
export.add(datiExport);
}
if (UtilityHashMap.isPresent(datiExport)) {
String userNameExport = UtilityHashMap.getValueIfExists(datiExport, "user_name");
String passwordExport = UtilityHashMap.getValueIfExists(datiExport, "password");
String formatExport = UtilityHashMap.getValueIfExists(datiExport, "format_file");
Integer countExport = UtilityHashMap.getValueIfExists(datiExport, "count_export");
if (countExport == 1) {
RequestDataDTO requestDataDTO = new RequestDataDTO();
requestDataDTO.setUsername(userNameExport);
requestDataDTO.setPassword(passwordExport);
String whereCond =
if (ord.getDataEsportazione() != null && exportOrdini) {
DtbOrdt finalOrd = ord;
Optional<HashMap<String, Object>> exportOpt = export.stream()
.filter(x -> ((String) x.get("cod_anag")).equalsIgnoreCase(finalOrd.getCodAnag())).findFirst();
HashMap<String, Object> datiExport;
if (exportOpt.isPresent()) {
datiExport = exportOpt.get();
} else {
String query =
Query.format(
"dtb_ordt.gestione = %s AND dtb_ordt.data_ord = %s AND dtb_ordt.num_ord = %s",
ord.getGestione(), ord.getDataOrd(), ord.getNumOrd());
"SELECT wtb_clie.cod_anag, " +
"wtb_users.user_name, wtb_users.password, wtb_users_info.format_file, COUNT(wtb_users_info.format_file) over (partition by wtb_users_info.user_name) as count_export" +
" FROM wtb_users " +
"INNER JOIN wtb_users_info ON wtb_users.User_name = wtb_users_info.user_name " +
"INNER JOIN wtb_clie ON wtb_users.User_name = wtb_clie.user_name " +
" WHERE wtb_users_info.flag_state = 'S' and " +
" wtb_clie.cod_anag = %s AND \n" +
" wtb_users_info.export_type = %s",
ord.getCodAnag(), EntityExportType.ORDINI_VENDITA.getText());
ObjectNode jsonNode = JsonNodeFactory.instance.objectNode();
jsonNode.put("whereCond", whereCond);
emsServices.export(multiDBTransactionManager, requestDataDTO, EntityExportType.ORDINI_VENDITA.getText(), formatExport, jsonNode, true);
datiExport = UtilityDB.executeSimpleQueryOnlyFirstRow(multiDBTransactionManager.getPrimaryConnection(), query);
export.add(datiExport);
}
if (UtilityHashMap.isPresent(datiExport)) {
String userNameExport = UtilityHashMap.getValueIfExists(datiExport, "user_name");
String passwordExport = UtilityHashMap.getValueIfExists(datiExport, "password");
String formatExport = UtilityHashMap.getValueIfExists(datiExport, "format_file");
Integer countExport = UtilityHashMap.getValueIfExists(datiExport, "count_export");
if (countExport == 1) {
RequestDataDTO requestDataDTO = new RequestDataDTO();
requestDataDTO.setUsername(userNameExport);
requestDataDTO.setPassword(passwordExport);
String whereCond =
Query.format(
"dtb_ordt.gestione = %s AND dtb_ordt.data_ord = %s AND dtb_ordt.num_ord = %s",
ord.getGestione(), ord.getDataOrd(), ord.getNumOrd());
ObjectNode jsonNode = JsonNodeFactory.instance.objectNode();
jsonNode.put("whereCond", whereCond);
emsServices.export(multiDBTransactionManager, requestDataDTO, EntityExportType.ORDINI_VENDITA.getText(), formatExport, jsonNode, true);
}
}
}
}

View File

@@ -132,6 +132,24 @@ public class VariazioniPvService {
String query = getQueryVariazioni(variazioniPvDTO, setup, datiLisv.getCodVlis(), UtilityHashMap.getValueIfExists(getSetupSectionDepo, "SELEZIONA_GRIGLIE"));
variazioniLisv = UtilityDB.executeSimpleQueryDTO(mdb.getPrimaryConnection(), query, VariazioniDettaglioDTO.class);
boolean duplicati = variazioniLisv.stream()
.filter(x->x.getIdPromo() !=null && !x.getIdPromo().isEmpty())
.collect(Collectors.groupingBy(
VariazioniDettaglioDTO::getIdPromo,
Collectors.mapping(
p -> p.getDataIniz() + "#" + p.getDataFine(),
Collectors.toSet()
)
))
.values().stream()
.anyMatch(set -> set.size() > 1);
if (duplicati) {
throw new Exception(String.format("Attenzione rigenerare il file del punto vendita %s ci sono articoli con dati promo errati.",
datiLisv.getCodVlis()));
}
if (variazioniLisv != null) {
variazioniLisv
.forEach(
@@ -324,7 +342,6 @@ public class VariazioniPvService {
else if (setupDescr.equalsIgnoreCase("B"))
descrizioneEstesa = var.getDescrCassa();
}
descrizioneEstesa = UtilityString.sanitizeXmlString(descrizioneEstesa);
codMartType.getContent().add(objectFactory.createCodMartTypeDescrizioneEstesa(UtilityString.streNull(descrizioneEstesa)));
codMartType.getContent().add(objectFactory.createCodMartTypeUntMis2(UtilityString.streNull(var.getUntMis2())));
codMartType.getContent().add(objectFactory.createCodMartTypeUntMis(UtilityString.streNull(var.getUntMis())));
@@ -615,8 +632,8 @@ public class VariazioniPvService {
" mtb_aart_equi.descrizione AS 'descr_art_equi',\n" +
" promozione.flag_tipo_promo,\n" +
" CASE\n" +
" WHEN promozione.flag_tipo_promo <> 'P' THEN promozione.data_iniz\n" +
" ELSE NULL END AS 'data_iniz_promo',\n" +
" WHEN promozione.flag_tipo_promo <> 'P' THEN ISNULL(vtb_list_data.data_iniz, listino.data_iniz)\n" +
" ELSE NULL END AS 'data_iniz_promo',\n" +
" CASE\n" +
" WHEN promozione.cod_promo IS NOT NULL AND promozione.flag_tipo_promo <> 'P'\n" +
" THEN listino.cod_vlis + '_' + CAST(promozione.versione AS VARCHAR)\n" +

View File

@@ -26,14 +26,6 @@ public class AnomalieController {
this.anomalieProdService = anomalieProdService;
}
@GetMapping(value = "/lista")
public ServiceRestResponse listaAnomalie(HttpServletRequest request,
@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
@RequestBody PageableRequestDTO requestData) throws Exception {
return ServiceRestResponse.createPositiveResponse(anomalieProdService.getAnomalieProd(requestData, multiDBTransactionManager.getPrimaryConnection()));
}
@GetMapping(value = "/livelli/lista")
public ServiceRestResponse listaLivelliAnomalie(HttpServletRequest request,
@RequestParam(CommonConstants.PROFILE_DB) String profileDB) throws Exception {
@@ -53,6 +45,27 @@ public class AnomalieController {
}
}
@PostMapping(value = "/livelli/{id}/elimina")
public ServiceRestResponse deleteLivelloAnomalia(HttpServletRequest request,
@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
@PathVariable Long id) throws Exception {
try {
anomalieProdService.deleteLivelloAnomalia(multiDBTransactionManager, id);
return ServiceRestResponse.createPositiveResponse();
} catch (Exception e) {
multiDBTransactionManager.rollbackAll();
throw e;
}
}
@GetMapping(value = "/lista")
public ServiceRestResponse listaAnomalie(HttpServletRequest request,
@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
@RequestBody PageableRequestDTO requestData) throws Exception {
return ServiceRestResponse.createPositiveResponse(anomalieProdService.getAnomalieProd(requestData, multiDBTransactionManager.getPrimaryConnection()));
}
@GetMapping(value = "/{id}/ul")
public ServiceRestResponse getUlAnomalia(HttpServletRequest request,
@@ -66,7 +79,8 @@ public class AnomalieController {
@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
@PathVariable Long id) throws Exception {
try {
return ServiceRestResponse.createPositiveResponse(anomalieProdService.deleteAnomalia(multiDBTransactionManager, id));
anomalieProdService.deleteAnomalia(multiDBTransactionManager, id);
return ServiceRestResponse.createPositiveResponse();
} catch (Exception e) {
multiDBTransactionManager.rollbackAll();
throw e;
@@ -85,13 +99,24 @@ public class AnomalieController {
}
}
@PostMapping(value = "/{id}/detachUls")
@PostMapping(value = "/detachUls")
public ServiceRestResponse detachUls(HttpServletRequest request,
@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
@PathVariable Long id,
@RequestBody List<String> ulsToRemove) throws Exception {
try {
return ServiceRestResponse.createPositiveResponse(anomalieProdService.detachUls(multiDBTransactionManager, id, ulsToRemove));
return ServiceRestResponse.createPositiveResponse(anomalieProdService.detachUls(multiDBTransactionManager, ulsToRemove));
} catch (Exception e) {
multiDBTransactionManager.rollbackAll();
throw e;
}
}
@PostMapping(value = "/{id}/attachUls")
public ServiceRestResponse attachUls(HttpServletRequest request,
@RequestParam(CommonConstants.PROFILE_DB) String profileDB,
@PathVariable Long id,
@RequestBody List<String> ulsToAttach) throws Exception {
try {
return ServiceRestResponse.createPositiveResponse(anomalieProdService.attachUls(multiDBTransactionManager, id, ulsToAttach));
} catch (Exception e) {
multiDBTransactionManager.rollbackAll();
throw e;

View File

@@ -31,6 +31,8 @@ public class DettaglioULDTO {
private String serCollo;
@SqlField("num_collo")
private Integer numCollo;
@SqlField("id_anomalia")
private Long idAnomalia;
public String getBarcodeUl() {
return barcodeUl;
@@ -139,4 +141,13 @@ public class DettaglioULDTO {
this.numCollo = numCollo;
return this;
}
public Long getIdAnomalia() {
return idAnomalia;
}
public DettaglioULDTO setIdAnomalia(Long idAnomalia) {
this.idAnomalia = idAnomalia;
return this;
}
}

View File

@@ -6,6 +6,7 @@ import it.integry.ems.retail.dto.AnomalieMerceDTO;
import it.integry.ems.retail.dto.DettaglioULDTO;
import it.integry.ems.retail.dto.SaveAnomaliaRequestDTO;
import it.integry.ems.retail.dto.SaveLivelloAnomaliaRequestDTO;
import it.integry.ems.retail.utility.AnomalieUlUtility;
import it.integry.ems.retail.wms.Utility.WMSUtility;
import it.integry.ems.retail.wms.generic.dto.MvwSitArtUdcDetInventarioDTO;
import it.integry.ems.service.EntityProcessor;
@@ -68,7 +69,7 @@ public class AnomalieUlService {
}
public List<DettaglioULDTO> getUlAnomalia(Connection connection, Long idAnomalia) throws Exception {
List<DettaglioULDTO> ulDetails = UtilityDB.executeSimpleQueryDTO(connection, "select mtb_colt.gestione, mtb_colt.ser_collo, mtb_colt.data_collo, mtb_colt.num_collo, barcode_ul, cod_mart, progressivo_ul, qta_col, cod_jfas\n" +
List<DettaglioULDTO> ulDetails = UtilityDB.executeSimpleQueryDTO(connection, "select mtb_colt.gestione, mtb_colt.ser_collo, mtb_colt.data_collo, mtb_colt.num_collo, barcode_ul, cod_mart, progressivo_ul, qta_col, cod_jfas, id_anomalia\n" +
"from mtb_colt\n" +
" inner join mtb_colr on mtb_colt.gestione = mtb_colr.gestione and mtb_colt.data_collo = mtb_colr.data_collo and\n" +
" mtb_colt.num_collo = mtb_colr.num_collo and mtb_colt.ser_collo = mtb_colr.ser_collo\n" +
@@ -89,16 +90,28 @@ public class AnomalieUlService {
return ulDetails;
}
public List<MtbColt> detachUls(MultiDBTransactionManager multiDBTransactionManager, Long idAnomalia, List<String> ulsToRemove) throws Exception {
String sql = "SELECT * from mtb_colt where barcode_ul in (" + UtilityDB.listValueToString(ulsToRemove) + ") and id_anomalia = " + idAnomalia;
public List<MtbColt> detachUls(MultiDBTransactionManager multiDBTransactionManager, List<String> ulsToRemove) throws Exception {
String sql = "SELECT * from mtb_colt where barcode_ul in (" + UtilityDB.listValueToString(ulsToRemove) + ") and id_anomalia is not null";
List<MtbColt> uls = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(), sql, MtbColt.class);
uls.forEach(x -> x.setIdAnomalia(EmsRestConstants.LONG_NULL).setOperation(OperationType.UPDATE));
uls.forEach(x -> AnomalieUlUtility.detachAnomaliaFromUl(x));
entityProcessor.processEntityList(uls, multiDBTransactionManager, true);
return uls;
}
public List<MtbColt> attachUls(MultiDBTransactionManager multiDBTransactionManager, Long idAnomalia, List<String> ulsToAttach) throws Exception {
List<MtbColt> uls = WMSUtility.retrieveUlsByBarcodes(multiDBTransactionManager.getPrimaryConnection(), ulsToAttach).stream().collect(Collectors.toList());
if (UtilityList.isNullOrEmpty(uls))
return new ArrayList<>();
uls.forEach(x -> AnomalieUlUtility.attachAnomaliaToUl(x, idAnomalia));
entityProcessor.processEntityList(uls, multiDBTransactionManager, true);
UtilityEntity.throwEntitiesException(uls);
return uls;
}
public MtbAnomalieUl saveAnomalia(MultiDBTransactionManager multiDBTransactionManager, SaveAnomaliaRequestDTO saveRequestDTO) throws Exception {
MtbAnomalieUl anomalia = new MtbAnomalieUl();
@@ -117,7 +130,7 @@ public class AnomalieUlService {
getUlAnomalia(multiDBTransactionManager.getPrimaryConnection(), anomalia.getId()).stream().forEach(x -> {
if (!saveRequestDTO.getBarcodeList().contains(x.getBarcodeUl())) {
MtbColt mtbColt = new MtbColt(x.getGestione(), x.getDataCollo(), x.getNumCollo(), x.getSerCollo());
mtbColt.setIdAnomalia(EmsRestConstants.LONG_NULL).setOperation(OperationType.UPDATE);
AnomalieUlUtility.detachAnomaliaFromUl(mtbColt.setIdAnomalia(x.getIdAnomalia()));
ulsAffected.add(mtbColt);
}
});
@@ -127,7 +140,7 @@ public class AnomalieUlService {
MtbColt ul = newAnomalies.get(barcode);
if (ul == null)
return;
ul.setIdAnomalia(anomalia.getId()).setOperation(OperationType.UPDATE);
AnomalieUlUtility.attachAnomaliaToUl(ul, anomalia.getId());
ulsAffected.add(ul);
});
@@ -138,22 +151,39 @@ public class AnomalieUlService {
return anomalia;
}
public Object deleteAnomalia(MultiDBTransactionManager multiDBTransactionManager, Long id) throws Exception {
public void deleteAnomalia(MultiDBTransactionManager multiDBTransactionManager, Long id) throws Exception {
List<EntityBase> entities = new ArrayList<>();
MtbAnomalieUl anomalia = new MtbAnomalieUl();
anomalia.setId(id)
.setOperation(OperationType.DELETE);
List<MtbColt> ulAnomalia = UtilityDB.executeSimpleQueryDTO(multiDBTransactionManager.getPrimaryConnection(),
"SELECT gestione,data_collo,ser_collo,num_collo from mtb_colt where id_anomalia = " + id,
"SELECT gestione,data_collo,ser_collo,num_collo, id_anomalia from mtb_colt where id_anomalia = " + id,
MtbColt.class);
ulAnomalia.forEach(x -> x.setIdAnomalia(EmsRestConstants.LONG_NULL).setOperation(OperationType.UPDATE));
entities.addAll(ulAnomalia);
if (!UtilityList.isNullOrEmpty(ulAnomalia)) {
ulAnomalia.forEach(x -> AnomalieUlUtility.detachAnomaliaFromUl(x));
entities.addAll(ulAnomalia);
}
entities.add(anomalia);
entityProcessor.processEntityList(entities, multiDBTransactionManager, true);
UtilityEntity.throwEntitiesException(entities);
return entities;
}
public void deleteLivelloAnomalia(MultiDBTransactionManager multiDBTransactionManager, Long id) throws Exception {
Integer count = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(),"SELECT count(*) from "+MtbAnomalieUl.ENTITY+" \n\r" +
"where id_livello_anomalia = " + UtilityDB.valueToString(id) + "");
if (count > 0)
throw new Exception("Impossibile eliminare il livello di anomalia se esistono anomalie associate");
MtbLivelliAnomalie anomalia = new MtbLivelliAnomalie();
anomalia.setId(id)
.setOperation(OperationType.DELETE);
entityProcessor.processEntity(anomalia, true, multiDBTransactionManager);
}
public List<MtbLivelliAnomalie> listaLivelliAnomalie(Connection connection) throws Exception {

View File

@@ -580,16 +580,14 @@ public class GiacenzaService {
}
public List<GiacenzaDTO> retrieveGiacenza(String codMdep, boolean readOrdini, String codMart) throws Exception {
String sql = Query.format(
"SELECT cod_mdep FROM stb_gest_setup_depo WHERE gest_name = %s AND section = %s AND key_section = %S AND value = %S",
gestName, section, "REPLACE_DEPO", codMdep);
String codMdepNew = UtilityDB.executeSimpleQueryOnlyFirstRowFirstColumn(multiDBTransactionManager.getPrimaryConnection(), sql);
String whereCond = UtilityDB.valueToString(codMdep);
if (codMdepNew != null) {
if (codMdepNew != null)
whereCond += ", " + UtilityDB.valueToString(codMdepNew);
}
sql = "WITH art AS (SELECT mtb_aart.cod_mart AS cod_mart,\n" +
" IIF(mtb_aart.articolo_composto = 'S'\n" +

View File

@@ -0,0 +1,33 @@
package it.integry.ems.retail.utility;
import it.integry.ems_model.config.EmsRestConstants;
import it.integry.ems_model.entity.MtbCols;
import it.integry.ems_model.entity.MtbColt;
import it.integry.ems_model.types.OperationType;
public class AnomalieUlUtility {
public static MtbColt attachAnomaliaToUl(MtbColt ul, Long idAnomalia) {
ul.setIdAnomalia(idAnomalia)
.setOperation(OperationType.UPDATE);
MtbCols cols = new MtbCols()
.setCodMdep(ul.getCodMdep())
.setCausale(MtbCols.Causale.ANOMALIA_ASSOCIATA)
.setValore(idAnomalia.toString());
cols.setOperation(OperationType.INSERT_OR_UPDATE);
ul.getMtbCols().add(cols);
return ul;
}
public static MtbColt detachAnomaliaFromUl(MtbColt ul) {
MtbCols cols = new MtbCols()
.setCodMdep(ul.getCodMdep())
.setCausale(MtbCols.Causale.ANOMALIA_RIMOSSA)
.setValore(ul.getIdAnomalia().toString());
ul.setIdAnomalia(EmsRestConstants.LONG_NULL)
.setOperation(OperationType.UPDATE);
cols.setOperation(OperationType.INSERT_OR_UPDATE);
ul.getMtbCols().add(cols);
return ul;
}
}

View File

@@ -504,6 +504,10 @@ public class WMSUtility {
public static InsertUDCRowResponseDTO insertUDCRow(InsertUDCRowRequestDTO insertUDCRowRequestDTO, EntityProcessor entityProcessor, MultiDBTransactionManager multiDBTransactionManager) throws Exception {
MtbColt targetMtbColt = insertUDCRowRequestDTO.getTargetMtbColt();
if (targetMtbColt == null)
throw new MissingDataException("UL di destinazione non presente");
targetMtbColt.setOperation(OperationType.SELECT_OBJECT);
entityProcessor.processEntity(targetMtbColt, true, multiDBTransactionManager);
@@ -577,10 +581,12 @@ public class WMSUtility {
public static List<MtbAart> getArticoliByCodMarts(List<String> codMarts, Connection connection) throws Exception {
if (codMarts == null || codMarts.isEmpty()) return null;
codMarts.replaceAll(String::toUpperCase);
final EntityCacheComponent entityCacheComponent = ApplicationContextProvider.getApplicationContext().getBean(EntityCacheComponent.class);
List<MtbAart> listMtbAart = entityCacheComponent.getCachedEntitiesList(
connection.getIntegryCustomerDB(), MtbAart.ENTITY, x -> codMarts.parallelStream().anyMatch(y -> y.equalsIgnoreCase(x.getCodMart())));
connection.getIntegryCustomerDB(), MtbAart.ENTITY, x -> codMarts.contains(x.getCodMart().toUpperCase()));
List<MtbAartBarCode> barCodeFromCod = getAlternativeMtbAartBarCodes(codMarts, connection);
@@ -659,6 +665,10 @@ public class WMSUtility {
return null;
return new MtbColr()
.setNumCollo(inputData.getNumCollo())
.setDataCollo(inputData.getDataCollo())
.setGestione(inputData.getGestione())
.setSerCollo(inputData.getSerCollo())
.setCodMart(inputData.getCodMart())
.setPartitaMag(inputData.getPartitaMag())
// .setCodCol(inputData.getCodCol())

View File

@@ -85,7 +85,7 @@ public class WMSAccettazioneService {
.setCodVdes(createUDCRequestDTO.getCodVdes())
.setDataCollo(createUDCRequestDTO.getDataCollo())
.setOraInizPrep(new Date())
.setPreparatoDa(requestDataDTO.getUsername())
.setPreparatoDa(userSession.getUsername())
.setPosizione(UtilityString.isNullOrEmpty(createUDCRequestDTO.getPosizione()) ? defaultPosizioneColliAccettazione : createUDCRequestDTO.getPosizione())
.setCodTcol(createUDCRequestDTO.getCodTcol())
.setAnnotazioni(createUDCRequestDTO.getAnnotazioni())
@@ -162,7 +162,9 @@ public class WMSAccettazioneService {
udcMtbColt.setOperation(OperationType.INSERT);
entityProcessor.processEntity(udcMtbColt, multiDBTransactionManager);
udcMtbColt.setOnlyPkMaster(false);
udcMtbColt
.setMtbCols(new ArrayList<>())
.setOnlyPkMaster(false);
return udcMtbColt;
}

View File

@@ -1714,11 +1714,16 @@ public class WMSGenericService {
anomalieList.add(AnomalieDTO.error("Non è stato trovato alcun articolo in giacenza"));
continue;
}
List<String> articoliDaScaricare = Stream.of(results).map(MvwSitArtUdcDetInventarioDTO::getCodMart).distinct().toList();
List<String> articoliDaScaricare = results.stream()
.map(MvwSitArtUdcDetInventarioDTO::getCodMart)
.distinct()
.collect(Collectors.toList());
for (String codMart : articoliDaScaricare) {
List<MvwSitArtUdcDetInventarioDTO> giacenzeArticolo = Stream.of(results).filter(x -> x.getCodMart().equalsIgnoreCase(codMart)).toList();
List<MvwSitArtUdcDetInventarioDTO> giacenzeArticolo = results.stream()
.filter(x -> x.getCodMart().equalsIgnoreCase(codMart))
.collect(Collectors.toList());
if (giacenzeArticolo.isEmpty()) {
anomalieList.add(AnomalieDTO.warning("Non è stato possibile scaricare la quantita di materia prima dell'articolo " + codMart + ". "));
continue; //throw new Exception("Non è stato trovato alcun articolo in giacenza");

View File

@@ -28,10 +28,11 @@ public class WMSVerificaGiacenzeController {
private SetupGest setupGest;
@GetMapping("retrieve")
public @ResponseBody ServiceRestResponse retrieveGiacenze(@RequestParam String codMdep) throws Exception {
public @ResponseBody ServiceRestResponse retrieveGiacenze(@RequestParam String codMdep,
@RequestParam(required = false) String codMart) throws Exception {
wmsVerificaGiacenzeService.setPrimaryDs(codMdep);
return ServiceRestResponse.createPositiveResponse(giacenzaService.retrieveGiacenza(codMdep, false, null));
return ServiceRestResponse.createPositiveResponse(giacenzaService.retrieveGiacenza(codMdep, false, codMart));
}
@PostMapping(value = "save_new_row")

View File

@@ -45,7 +45,7 @@ public class WMSVerificaGiacenzeService {
String profileDb = UtilityString.isNull(setupGest.getSetupDepo(multiDBTransactionManager.getPrimaryConnection(), "DATI_AZIENDA", "DATI_DEPOSITO", "PROFILE_DB", codMdep),
multiDBTransactionManager.getPrimaryConnection().getProfileName());
if (!multiDBTransactionManager.getPrimaryConnection().getProfileName().equals(profileDb))
if (!multiDBTransactionManager.getPrimaryConnection().getProfileName().equalsIgnoreCase(profileDb))
multiDBTransactionManager.setPrimaryDB(profileDb);
}

View File

@@ -467,6 +467,7 @@ public class WMSSpedizioneService {
.setDataVers(null)
.setDataOrd(null)
.setNumOrd(null)
.setBarcodeUl(null)
.setOperation(OperationType.INSERT);
mtbColt.getMtbColr().stream().peek(x -> {

File diff suppressed because one or more lines are too long