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.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
MtbDepoPosizioni mtbDepoPosizioni = new MtbDepoPosizioni();
|
||||
if (!UtilityString.isNullOrEmpty(requestDTO.getPosizione())) {
|
||||
MtbDepoPosizioni mtbDepoPosizioni = new MtbDepoPosizioni()
|
||||
.setCodMdep(requestDTO.getCodMdep())
|
||||
mtbDepoPosizioni.setCodMdep(requestDTO.getCodMdep())
|
||||
.setPosizione(requestDTO.getPosizione());
|
||||
mtbDepoPosizioni.setOperation(OperationType.SELECT_OBJECT);
|
||||
|
||||
@@ -2163,13 +2163,19 @@ public class WMSGenericService {
|
||||
WMSUtility.trasferisciPedane(mtbColtToMove, listaPedane, dtbDoct);
|
||||
}
|
||||
|
||||
mtbColtToMove.setOperation(OperationType.UPDATE);
|
||||
mtbColtToMove
|
||||
.setMtbColr(new ArrayList<>())
|
||||
.setPosizione(UtilityString.isNull(requestDTO.getPosizione(), EmsRestConstants.NULL))
|
||||
.setCodMdep(requestDTO.getCodMdep());
|
||||
if (!UtilityString.isNullOrEmpty(mtbDepoPosizioni.getPosizione()) && mtbDepoPosizioni.isFlagMonoCollo()) {
|
||||
MtbColt ulMonocollo = WMSUtility.getUlPosizioneMonoUl(multiDBTransactionManager.getPrimaryConnection(),mtbDepoPosizioni.getPosizione());
|
||||
WMSUtility.spostaArtsTraUL(multiDBTransactionManager.getPrimaryConnection(), mtbColtToMove, ulMonocollo, false, entityProcessor, requestDataDTO);
|
||||
} else {
|
||||
|
||||
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())) {
|
||||
|
||||
Reference in New Issue
Block a user