messi dati MRP e MES in cache per biolevante !!TEMPORANEAMENTE!!
This commit is contained in:
2024-09-17 19:14:55 +02:00
parent 2a657043d7
commit fac88c991b
2 changed files with 42 additions and 17 deletions

View File

@@ -46,6 +46,17 @@ public class MrpConsumiHandlerService {
if ( saveCache() ) {
looperService.add(() -> this.internalCacheConsumi(consumiCachedData), (UtilityDebug.isDebugExecution()?5:1) * 60 * 1000, MrpConsumiHandlerService.class.getName());
}
if (UtilityDebug.isDebugExecution() || UtilityDebug.isIntegryServer()) {
looperService.add(() -> {
try {
loadConsumi( "biolevante", "BIOLEVANTE", consumiCachedData);
} catch (Exception e) {
throw new RuntimeException(e);
}
}, 5 * 1000, ProductionOrderDataHandlerService.class.getName());
}
}
private boolean saveCache(){
@@ -66,6 +77,17 @@ public class MrpConsumiHandlerService {
for (String dbName : databases.keySet()) {
String profileName = databases.get(dbName).get(0).getProfileName();
loadConsumi(dbName,profileName,consumiList);
}
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
}
private void loadConsumi(String dbName, String profileName, HashMap<String, HashMap<String, Map<String, List<MRPDailyConsumiDTO>>>> consumiList) throws Exception {
Date startDate = new Date();
MultiDBTransactionManager multiDBTransactionManager = new MultiDBTransactionManager(profileName, false);
@@ -83,11 +105,6 @@ public class MrpConsumiHandlerService {
multiDBTransactionManager.closeAll();
}
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
}
private static boolean isGestioneAbilitata(MultiDBTransactionManager multiDBTransactionManager) throws Exception {
String sql =
"SELECT CAST(COUNT(*) AS BIT)\n" +
@@ -234,7 +251,7 @@ public class MrpConsumiHandlerService {
public Map<String, List<MRPDailyConsumiDTO>> getConsumi() throws Exception {
MultiDBTransactionManager multiDBTransactionManager = ContextLoader.getCurrentWebApplicationContext().getBean(MultiDBTransactionManager.class);
if (!saveCache()) {
if (!saveCache() && !multiDBTransactionManager.getPrimaryDatasource().getDbName().equalsIgnoreCase("biolevante")) {
return getConsumi(multiDBTransactionManager);
} else {
HashMap<String, HashMap<String, Map<String, List<MRPDailyConsumiDTO>>>> inputMap = consumiCachedData;

View File

@@ -52,6 +52,16 @@ public class ProductionOrderDataHandlerService {
if (!UtilityDebug.isDebugExecution() && !UtilityDebug.isIntegryServer()) {
looperService.add(() -> this.internalCacheOrdiniLavorazione(true, inevasiOrdersCachedData), 5 * 1000, ProductionOrderDataHandlerService.class.getName());
}
if (UtilityDebug.isDebugExecution() || UtilityDebug.isIntegryServer()) {
looperService.add(() -> {
try {
loadOrdiniProfile(false, "biolevante", "BIOLEVANTE", inevasiOrdersCachedData);
} catch (Exception e) {
throw new RuntimeException(e);
}
}, 5 * 1000, ProductionOrderDataHandlerService.class.getName());
}
}
@@ -144,9 +154,7 @@ public class ProductionOrderDataHandlerService {
MultiDBTransactionManager multiDBTransactionManager = ContextLoader.getCurrentWebApplicationContext().getBean(MultiDBTransactionManager.class);
if (
UtilityDebug.isIntegryServer()
|| UtilityDebug.isDebugExecution()
|| UtilityString.isNullOrEmpty(flagEvaso)
UtilityString.isNullOrEmpty(flagEvaso)
|| !flagEvaso.equalsIgnoreCase("I")
|| !isMESEnabled(multiDBTransactionManager)) {
return getOrdiniLavorazione(multiDBTransactionManager, flagEvaso, linee, startDate, endDate, codAnag, whereCond);