Aggiunta metodo getTask2Exe in uscita GWMS
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using GWMS.Data.DatabaseModels;
|
||||
using GWMS.UI.Data;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
@@ -499,6 +500,35 @@ namespace GWMS.UI.Controllers
|
||||
return "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera TASK richiesto x macchina:
|
||||
///
|
||||
/// GET: IOB/getTask2Exe/SIMUL_03
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns>Json contenente 1..n task da eseguire</returns>
|
||||
[HttpGet("getTask2Exe/{id}")]
|
||||
public string getTask2Exe(string id)
|
||||
{
|
||||
string answ = "";
|
||||
#if false
|
||||
// scrivo keep alive!!! (se necessario, altrimenti è in cache...)
|
||||
MapoDb.MapoDb connDb = new MapoDb.MapoDb();
|
||||
DataLayer DataLayerObj = new DataLayer();
|
||||
connDb.scriviKeepAlive(id, DateTime.Now);
|
||||
#endif
|
||||
try
|
||||
{
|
||||
// leggo da REDIS eventuale elenco task x macchina...
|
||||
Dictionary<string, string> valori = _DataService.mTaskMacchina(id).Result;
|
||||
answ = JsonConvert.SerializeObject(valori);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Input singolo valore
|
||||
/// </summary>
|
||||
@@ -616,32 +646,6 @@ namespace GWMS.UI.Controllers
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera TASK richiesto x macchina:
|
||||
///
|
||||
/// GET: IOB/getTask2Exe/SIMUL_03
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns>Json contenente 1..n task da eseguire</returns>
|
||||
public string getTask2Exe(string id)
|
||||
{
|
||||
string answ = "";
|
||||
// scrivo keep alive!!! (se necessario, altrimenti è in cache...)
|
||||
MapoDb.MapoDb connDb = new MapoDb.MapoDb();
|
||||
DataLayer DataLayerObj = new DataLayer();
|
||||
connDb.scriviKeepAlive(id, DateTime.Now);
|
||||
try
|
||||
{
|
||||
// leggo da REDIS eventuale elenco task x macchina...
|
||||
Dictionary<string, string> valori = DataLayerObj.mTaskMacchina(id);
|
||||
answ = JsonConvert.SerializeObject(valori);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
|
||||
// GET: IOB (è un check alive del server)
|
||||
public string Index()
|
||||
{
|
||||
|
||||
@@ -93,6 +93,16 @@ namespace GWMS.UI.Data
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Hash dati EXE TASK x la macchina specificata
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <returns></returns>
|
||||
protected static string exeTaskHash(string idxMacchina)
|
||||
{
|
||||
return mHash(string.Format("ExeTask:{0}", idxMacchina));
|
||||
}
|
||||
|
||||
protected string getCacheKey(string TableName, SelectOrderData CurrFilter)
|
||||
{
|
||||
string answ = $"{TableName}:P_{CurrFilter.PlantId:00}:S_{CurrFilter.SupplierId:00}:T_{CurrFilter.TransporterId:00}:D_{CurrFilter.DateStart:yyyyMMddHHmm}_{CurrFilter.DateEnd:yyyyMMddHHmm}";
|
||||
@@ -103,6 +113,16 @@ namespace GWMS.UI.Data
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Hash Redis contenente i dati MP di una specifico TYPE (es StatusMacchina, StateMachineIngressi, ...)
|
||||
/// </summary>
|
||||
/// <param name="dataType"></param>
|
||||
/// <returns></returns>
|
||||
public static string mHash(string dataType)
|
||||
{
|
||||
return $"DATA:{dataType}";
|
||||
}
|
||||
|
||||
public async Task<List<GWMS.Data.DatabaseModels.ConfigModel>> ConfigGetAll()
|
||||
{
|
||||
//return Task.FromResult(dbController.ActionsGetAll());
|
||||
@@ -180,6 +200,34 @@ namespace GWMS.UI.Data
|
||||
return await Task.FromResult(dbResult);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restitusice elenco KVP dei TASK (da passare a IOB-WIN) per l'impianto indicato
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Dictionary<string, string>> mTaskMacchina(string idxMacchina)
|
||||
{
|
||||
// hard coded dimensione vettore DatiMacchine
|
||||
Dictionary<string, string> answ = new Dictionary<string, string>();
|
||||
// ORA recupero da memoria redis...
|
||||
try
|
||||
{
|
||||
string cacheKey = exeTaskHash(idxMacchina);
|
||||
string rawData;
|
||||
var redisDataList = await distributedCache.GetAsync(cacheKey);
|
||||
if (redisDataList != null)
|
||||
{
|
||||
rawData = Encoding.UTF8.GetString(redisDataList);
|
||||
answ = JsonConvert.DeserializeObject<Dictionary<string, string>>(rawData);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Info($"Errore in recupero dati EXE TASK x Redis mTaskMacchina - idxMacchina {idxMacchina}{Environment.NewLine}{exc}");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public async Task<List<OrderModel>> OrdersGetFilt(SelectOrderData CurrFilter)
|
||||
{
|
||||
List<OrderModel> dbResult = new List<OrderModel>();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<Version>1.0.2108.0217</Version>
|
||||
<Version>1.0.2108.0218</Version>
|
||||
<UserSecretsId>95c9f021-52d1-4390-a670-5810b7b777b0</UserSecretsId>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>GWMS - Gas Warehouse Management System</i>
|
||||
<h4>Versione: 1.0.2108.0217</h4>
|
||||
<h4>Versione: 1.0.2108.0218</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.0.2108.0217
|
||||
1.0.2108.0218
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>1.0.2108.0217</version>
|
||||
<version>1.0.2108.0218</version>
|
||||
<url>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip</url>
|
||||
<changelog>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user