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:
@@ -0,0 +1,30 @@
|
|||||||
|
package it.integry.ems.migration.model;
|
||||||
|
|
||||||
|
import it.integry.ems.migration._base.BaseMigration;
|
||||||
|
import it.integry.ems.migration._base.IntegryCustomer;
|
||||||
|
import it.integry.ems.migration._base.MigrationModelInterface;
|
||||||
|
|
||||||
|
public class Migration_20251211085116 extends BaseMigration implements MigrationModelInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void up() throws Exception {
|
||||||
|
if (isHistoryDB())
|
||||||
|
return;
|
||||||
|
|
||||||
|
createSetup("W_CREG_IVA_DISP", "DATAWINDOW", "D_CREG_IVA_REP", null,
|
||||||
|
null, false, null, false, false,
|
||||||
|
false, false, false, null, false, null);
|
||||||
|
|
||||||
|
if(isCustomer(IntegryCustomer.Cosmapack)) {
|
||||||
|
updateSetupValue("W_CREG_IVA_DISP", "DATAWINDOW", "D_CREG_IVA_REP", "d_creg_iva_cosmopack_rep");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void down() throws Exception {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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 {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -10,11 +10,13 @@ import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
|||||||
import it.integry.ems_model.base.EntityBase;
|
import it.integry.ems_model.base.EntityBase;
|
||||||
import it.integry.ems_model.entity.DtbOrdr;
|
import it.integry.ems_model.entity.DtbOrdr;
|
||||||
import it.integry.ems_model.entity.DtbOrdt;
|
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.types.OperationType;
|
||||||
import it.integry.ems_model.utility.Query;
|
import it.integry.ems_model.utility.Query;
|
||||||
import it.integry.ems_model.utility.UtilityBigDecimal;
|
import it.integry.ems_model.utility.UtilityBigDecimal;
|
||||||
import it.integry.ems_model.utility.UtilityDB;
|
import it.integry.ems_model.utility.UtilityDB;
|
||||||
import it.integry.ems_model.utility.UtilityHashMap;
|
import it.integry.ems_model.utility.UtilityHashMap;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -26,6 +28,9 @@ public class OrdiniVSlim2kService {
|
|||||||
private final EntityProcessor entityProcessor;
|
private final EntityProcessor entityProcessor;
|
||||||
private final EmsServices emsServices;
|
private final EmsServices emsServices;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SetupGest setupGest;
|
||||||
|
|
||||||
public OrdiniVSlim2kService(EntityProcessor entityProcessor, EmsServices emsServices) {
|
public OrdiniVSlim2kService(EntityProcessor entityProcessor, EmsServices emsServices) {
|
||||||
this.entityProcessor = entityProcessor;
|
this.entityProcessor = entityProcessor;
|
||||||
this.emsServices = emsServices;
|
this.emsServices = emsServices;
|
||||||
@@ -43,11 +48,11 @@ public class OrdiniVSlim2kService {
|
|||||||
List<HashMap<String, Object>> articoli = new ArrayList<>();
|
List<HashMap<String, Object>> articoli = new ArrayList<>();
|
||||||
List<HashMap<String, Object>> export = 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)) {
|
for (DtbOrdr dtbOrdr : groupOrdini.get(ord)) {
|
||||||
String sql =
|
String sql =
|
||||||
Query.format("SELECT * FROM dtb_ordt WHERE gestione = %s AND data_ord = %s AND num_ord = %s",
|
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);
|
ord = UtilityDB.executeSimpleQueryOnlyFirstRowDTO(multiDBTransactionManager.getPrimaryConnection(), sql, DtbOrdt.class);
|
||||||
BigDecimal qtaCnf;
|
BigDecimal qtaCnf;
|
||||||
@@ -73,48 +78,51 @@ public class OrdiniVSlim2kService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
entityProcessor.processEntity(ord, multiDBTransactionManager, false);
|
entityProcessor.processEntity(ord, multiDBTransactionManager, false);
|
||||||
|
boolean exportOrdini = setupGest.getSetupBoolean(multiDBTransactionManager.getPrimaryConnection(), "PVM", "ORDINI_V_SLIM2K", "EXPORT_ORDINI");
|
||||||
|
|
||||||
DtbOrdt finalOrd = ord;
|
if (ord.getDataEsportazione() != null && exportOrdini) {
|
||||||
Optional<HashMap<String, Object>> exportOpt = export.stream()
|
DtbOrdt finalOrd = ord;
|
||||||
.filter(x -> ((String) x.get("cod_anag")).equalsIgnoreCase(finalOrd.getCodAnag())).findFirst();
|
Optional<HashMap<String, Object>> exportOpt = export.stream()
|
||||||
HashMap<String, Object> datiExport;
|
.filter(x -> ((String) x.get("cod_anag")).equalsIgnoreCase(finalOrd.getCodAnag())).findFirst();
|
||||||
if ( exportOpt.isPresent() ) {
|
HashMap<String, Object> datiExport;
|
||||||
datiExport = exportOpt.get();
|
if (exportOpt.isPresent()) {
|
||||||
} else {
|
datiExport = exportOpt.get();
|
||||||
String query =
|
} else {
|
||||||
Query.format(
|
String query =
|
||||||
"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 =
|
|
||||||
Query.format(
|
Query.format(
|
||||||
"dtb_ordt.gestione = %s AND dtb_ordt.data_ord = %s AND dtb_ordt.num_ord = %s",
|
"SELECT wtb_clie.cod_anag, " +
|
||||||
ord.getGestione(), ord.getDataOrd(), ord.getNumOrd());
|
"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();
|
datiExport = UtilityDB.executeSimpleQueryOnlyFirstRow(multiDBTransactionManager.getPrimaryConnection(), query);
|
||||||
jsonNode.put("whereCond", whereCond);
|
export.add(datiExport);
|
||||||
emsServices.export(multiDBTransactionManager, requestDataDTO, EntityExportType.ORDINI_VENDITA.getText(), formatExport, jsonNode, true);
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -653,4 +653,14 @@ public class WMSUtility {
|
|||||||
|
|
||||||
return UtilityDB.executeSimpleQueryDTO(connection,Query.format("SELECT * from mtb_colt where barcode_ul in ("+UtilityDB.listValueToString(barcodeList)+")"), MtbColt.class);
|
return UtilityDB.executeSimpleQueryDTO(connection,Query.format("SELECT * from mtb_colt where barcode_ul in ("+UtilityDB.listValueToString(barcodeList)+")"), MtbColt.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static MtbColt getUlPosizioneMonoUl(Connection connection, String posizione) throws Exception {
|
||||||
|
String sql = "SELECT * FROM mtb_colt " +
|
||||||
|
" inner join mtb_depo_posizioni on mtb_colt.posizione = mtb_depo_posizioni.posizione" +
|
||||||
|
" WHERE mtb_colt.segno = 1 AND mtb_depo_posizioni.flag_mono_collo = 'S' and mtb_depo_posizioni.posizione = " + UtilityDB.valueToString(posizione) ;
|
||||||
|
List<MtbColt> listaUl = UtilityDB.executeSimpleQueryDTO(connection,sql,MtbColt.class);
|
||||||
|
if (listaUl.isEmpty()) throw new Exception("Nessuna UL trovata per la posizione " + posizione);
|
||||||
|
if (listaUl.size() > 1) throw new Exception("Ci sono più UL disponibili per la posizione " + posizione);
|
||||||
|
return listaUl.get(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2045,9 +2045,9 @@ public class WMSGenericService {
|
|||||||
|
|
||||||
boolean gestisciColli = WMSUtility.isGestisciColli(mtbDepo, entityProcessor, multiDBTransactionManager);
|
boolean gestisciColli = WMSUtility.isGestisciColli(mtbDepo, entityProcessor, multiDBTransactionManager);
|
||||||
|
|
||||||
|
MtbDepoPosizioni mtbDepoPosizioni = new MtbDepoPosizioni();
|
||||||
if (!UtilityString.isNullOrEmpty(requestDTO.getPosizione())) {
|
if (!UtilityString.isNullOrEmpty(requestDTO.getPosizione())) {
|
||||||
MtbDepoPosizioni mtbDepoPosizioni = new MtbDepoPosizioni()
|
mtbDepoPosizioni.setCodMdep(requestDTO.getCodMdep())
|
||||||
.setCodMdep(requestDTO.getCodMdep())
|
|
||||||
.setPosizione(requestDTO.getPosizione());
|
.setPosizione(requestDTO.getPosizione());
|
||||||
mtbDepoPosizioni.setOperation(OperationType.SELECT_OBJECT);
|
mtbDepoPosizioni.setOperation(OperationType.SELECT_OBJECT);
|
||||||
|
|
||||||
@@ -2163,13 +2163,19 @@ public class WMSGenericService {
|
|||||||
WMSUtility.trasferisciPedane(mtbColtToMove, listaPedane, dtbDoct);
|
WMSUtility.trasferisciPedane(mtbColtToMove, listaPedane, dtbDoct);
|
||||||
}
|
}
|
||||||
|
|
||||||
mtbColtToMove.setOperation(OperationType.UPDATE);
|
if (!UtilityString.isNullOrEmpty(mtbDepoPosizioni.getPosizione()) && mtbDepoPosizioni.isFlagMonoCollo()) {
|
||||||
mtbColtToMove
|
MtbColt ulMonocollo = WMSUtility.getUlPosizioneMonoUl(multiDBTransactionManager.getPrimaryConnection(),mtbDepoPosizioni.getPosizione());
|
||||||
.setMtbColr(new ArrayList<>())
|
WMSUtility.spostaArtsTraUL(multiDBTransactionManager.getPrimaryConnection(), mtbColtToMove, ulMonocollo, false, entityProcessor, requestDataDTO);
|
||||||
.setPosizione(UtilityString.isNull(requestDTO.getPosizione(), EmsRestConstants.NULL))
|
} else {
|
||||||
.setCodMdep(requestDTO.getCodMdep());
|
|
||||||
|
mtbColtToMove.setOperation(OperationType.UPDATE);
|
||||||
|
mtbColtToMove
|
||||||
|
.setMtbColr(new ArrayList<>())
|
||||||
|
.setPosizione(UtilityString.isNull(requestDTO.getPosizione(), EmsRestConstants.NULL))
|
||||||
|
.setCodMdep(requestDTO.getCodMdep());
|
||||||
|
entitiesToSave.add(mtbColtToMove);
|
||||||
|
}
|
||||||
|
|
||||||
entitiesToSave.add(mtbColtToMove);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dtbDoct != null && !UtilityString.isNullOrEmpty(requestDTO.getAnnotazioni())) {
|
if (dtbDoct != null && !UtilityString.isNullOrEmpty(requestDTO.getAnnotazioni())) {
|
||||||
|
|||||||
Reference in New Issue
Block a user