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:
@@ -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;
|
||||
@@ -73,7 +78,9 @@ public class OrdiniVSlim2kService {
|
||||
}
|
||||
|
||||
entityProcessor.processEntity(ord, multiDBTransactionManager, false);
|
||||
boolean exportOrdini = setupGest.getSetupBoolean(multiDBTransactionManager.getPrimaryConnection(), "PVM", "ORDINI_V_SLIM2K", "EXPORT_ORDINI");
|
||||
|
||||
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();
|
||||
@@ -118,6 +125,7 @@ public class OrdiniVSlim2kService {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return entities;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user