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:
commit
a04b2fa4a1
@ -32,6 +32,7 @@ public class DbmsChangeTrackerComponent {
|
||||
add(MtbAartBarCode.ENTITY);
|
||||
add(MtbUntMis.ENTITY);
|
||||
add(MtbDepo.ENTITY);
|
||||
add(MtbDepoPosizioni.ENTITY);
|
||||
add(StbEditLimit.ENTITY);
|
||||
add(StbGestSetup.ENTITY);
|
||||
add(StbGestSetupDepo.ENTITY);
|
||||
|
||||
@ -57,6 +57,7 @@ public class EntityCacheComponent implements ApplicationListener {
|
||||
put(MtbAartBarCode.ENTITY, MtbAartBarCode.class);
|
||||
put(MtbUntMis.ENTITY, MtbUntMis.class);
|
||||
put(MtbDepo.ENTITY, MtbDepo.class);
|
||||
put(MtbDepoPosizioni.ENTITY, MtbDepoPosizioni.class);
|
||||
put(StbEditLimit.ENTITY, StbEditLimit.class);
|
||||
put(StbGestSetup.ENTITY, StbGestSetup.class);
|
||||
put(StbGestSetupDepo.ENTITY, StbGestSetupDepo.class);
|
||||
|
||||
@ -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 {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package it.integry.ems.utility.entity;
|
||||
|
||||
import it.integry.ems._context.ApplicationContextProvider;
|
||||
import it.integry.ems.dynamic_cache.EntityCacheComponent;
|
||||
import it.integry.ems.migration._base.IntegryCustomerDB;
|
||||
import it.integry.ems_model.entity.MtbDepoPosizioni;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MtbDepoPosizioniUtils {
|
||||
|
||||
|
||||
public static final List<MtbDepoPosizioni> getAllMonoUlPositions(IntegryCustomerDB customerDB) {
|
||||
final EntityCacheComponent entityCacheComponent = ApplicationContextProvider.getApplicationContext().getBean(EntityCacheComponent.class);
|
||||
|
||||
return entityCacheComponent.<MtbDepoPosizioni>getCachedEntitiesList(customerDB, MtbDepoPosizioni.ENTITY,
|
||||
x -> x.isFlagMonoCollo());
|
||||
}
|
||||
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -709,4 +709,11 @@ public class WMSGenericController {
|
||||
) throws Exception {
|
||||
return ServiceRestResponse.createPositiveResponse(WMSUtility.retrieveBarcodesByBarcodeAndCodJfas(multiDBTransactionManager.getPrimaryConnection(),barcodeUl,codJfas, maxResults));
|
||||
}
|
||||
|
||||
@GetMapping("wms/resetta-posizioni-mono-ul")
|
||||
ServiceRestResponse resettaPosizioniMonoUl() throws Exception {
|
||||
wmsGenericService.resettaPosizioniMonoUL(multiDBTransactionManager, entityProcessor);
|
||||
|
||||
return ServiceRestResponse.createPositiveResponse();
|
||||
}
|
||||
}
|
||||
@ -37,6 +37,7 @@ import it.integry.ems.sync.MultiDBTransaction.MultiDBTransactionManager;
|
||||
import it.integry.ems.user.UserSession;
|
||||
import it.integry.ems.utility.UtilityEntity;
|
||||
import it.integry.ems.utility.entity.MtbAartUtils;
|
||||
import it.integry.ems.utility.entity.MtbDepoPosizioniUtils;
|
||||
import it.integry.ems_model.base.EntityBase;
|
||||
import it.integry.ems_model.config.EmsRestConstants;
|
||||
import it.integry.ems_model.db.ResultSetMapper;
|
||||
@ -103,6 +104,8 @@ public class WMSGenericService {
|
||||
|
||||
@Autowired
|
||||
private WMSAccettazioneService wmsAccettazioneService;
|
||||
@Autowired
|
||||
private WMSGiacenzaULService wmsGiacenzaULService;
|
||||
|
||||
public List<AvailableCodMdepDTO> getAvailableCodMdepsForUser() throws Exception {
|
||||
|
||||
@ -3099,4 +3102,59 @@ public class WMSGenericService {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public void resettaPosizioniMonoUL(MultiDBTransactionManager multiDBTransactionManager, EntityProcessor entityProcessor) throws Exception {
|
||||
List<MtbDepoPosizioni> posizioniMonoUL = MtbDepoPosizioniUtils.getAllMonoUlPositions(multiDBTransactionManager.getPrimaryConnection().getIntegryCustomerDB());
|
||||
|
||||
try {
|
||||
for (MtbDepoPosizioni posizione : posizioniMonoUL) {
|
||||
final List<MtbColt> oldUdcs = getULInPosizione(posizione, false);
|
||||
|
||||
if (oldUdcs == null)
|
||||
continue;
|
||||
|
||||
oldUdcs.removeIf(ul -> ul.getSegno() != 1); //consider only Lavorazione UDCs
|
||||
|
||||
|
||||
if (oldUdcs.isEmpty()) {
|
||||
//skip position
|
||||
continue;
|
||||
} else if (oldUdcs.size() > 1) {
|
||||
throw new Exception("Posizione " + posizione.getPosizione() + " contiene più di una UDC in una posizione mono UL");
|
||||
}
|
||||
final MtbColt newUdc = wmsLavorazioneService.createUDC(new CreateUDCRequestDTO()
|
||||
.setCodMdep(posizione.getCodMdep())
|
||||
.setPosizione(posizione.getPosizione()));
|
||||
|
||||
final MtbColt oldUdc = oldUdcs.get(0);
|
||||
|
||||
final List<MvwSitArtUdcDetInventarioDTO> giacenzaItems = wmsGiacenzaULService.retrieveArtsInGiacenzaByPosition(multiDBTransactionManager.getPrimaryConnection(), posizione.getPosizione());
|
||||
|
||||
if (giacenzaItems != null) {
|
||||
oldUdc.setMtbColr(WMSUtility.convertMvwItemsToMtbColrs(giacenzaItems));
|
||||
|
||||
WMSUtility.spostaArtsTraUL(multiDBTransactionManager.getPrimaryConnection(),
|
||||
oldUdc, newUdc, false, entityProcessor, RequestDataDTO.systemMockupData());
|
||||
|
||||
}
|
||||
|
||||
//remove position from old UL
|
||||
UtilityDB.executeStatement(multiDBTransactionManager.getPrimaryConnection(),
|
||||
"UPDATE mtb_colt SET posizione = NULL " +
|
||||
"WHERE gestione = " + UtilityDB.valueToString(oldUdc.getGestione()) + " " +
|
||||
"AND data_collo = " + UtilityDB.valueToString(oldUdc.getDataCollo()) + " " +
|
||||
"AND ser_collo = " + UtilityDB.valueToString(oldUdc.getSerCollo()) + " " +
|
||||
"AND num_collo = " + UtilityDB.valueToString(oldUdc.getNumCollo())
|
||||
);
|
||||
|
||||
//save all
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
multiDBTransactionManager.rollbackAll();
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user