FIX PODL
- verifica PODL attrezzabili (=senza OIDL correnti)
This commit is contained in:
@@ -742,19 +742,18 @@ namespace MP.Data.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero Odl CORRENTE x macchina (SE c'è)
|
||||
/// Recupero Odl CORRENTI
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <returns></returns>
|
||||
public ODLModel OdlGetCurrentByMacc(string idxMacchina)
|
||||
public List<ODLModel> OdlGetCurrent()
|
||||
{
|
||||
ODLModel dbResult = new ODLModel();
|
||||
|
||||
List<ODLModel> dbResult = new List<ODLModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetODL
|
||||
.FirstOrDefault(x => x.IdxMacchina == idxMacchina && x.DataInizio != null && x.DataFine == null);
|
||||
.Where(x => x.DataInizio != null && x.DataFine == null)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
@using MP.SPEC.Components
|
||||
@using MP.SPEC.Data
|
||||
|
||||
@if (ListRecords == null)
|
||||
@if (ListRecords == null || isLoading)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ namespace MP.SPEC.Components
|
||||
[Parameter]
|
||||
public SelectPOdlParams actFilter { get; set; } = new SelectPOdlParams();
|
||||
|
||||
private SelectPOdlParams lastFilter { get; set; } = new SelectPOdlParams();
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> PagerResetReq { get; set; }
|
||||
|
||||
@@ -56,11 +58,6 @@ namespace MP.SPEC.Components
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#if false
|
||||
[Inject]
|
||||
protected MessageService MsgService { get; set; } = null!;
|
||||
#endif
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task cloneRecord(PODLModel selRec)
|
||||
@@ -119,7 +116,11 @@ namespace MP.SPEC.Components
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
await reloadData();
|
||||
if (!lastFilter.Equals(actFilter))
|
||||
{
|
||||
lastFilter = actFilter.clone();
|
||||
await reloadData();
|
||||
}
|
||||
}
|
||||
|
||||
protected async void OnSeachUpdated()
|
||||
@@ -325,17 +326,11 @@ namespace MP.SPEC.Components
|
||||
/// <returns></returns>
|
||||
private bool canStartOdl(string idxMacchina)
|
||||
{
|
||||
var currOdl = MDService.OdlGetCurrentByMacc(idxMacchina);
|
||||
bool answ = (currOdl == null || currOdl.IdxOdl == 0);
|
||||
var listOdlCurr = MDService.OdlGetCurrent();
|
||||
bool answ = !listOdlCurr.Contains(idxMacchina);
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
private async void MessageService_EA_PageUpdated()
|
||||
{
|
||||
await reloadData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// processa evento richiesto
|
||||
/// </summary>
|
||||
|
||||
@@ -665,37 +665,42 @@ namespace MP.SPEC.Data
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ODL corrente x macchina
|
||||
/// ODL correnti (tutti)
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <returns></returns>
|
||||
public ODLModel OdlGetCurrentByMacc(string idxMacchina)
|
||||
public List<string> OdlGetCurrent()
|
||||
{
|
||||
ODLModel dbResult = new ODLModel();
|
||||
List<string> dbResult = new List<string>();
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
string readType = "DB";
|
||||
string currKey = $"{redisOdlCurrByMac}:{idxMacchina}";
|
||||
string currKey = $"{redisOdlCurrByMac}";
|
||||
// cerco in redis dato valore sel macchina...
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
if (rawData.HasValue)
|
||||
{
|
||||
dbResult = JsonConvert.DeserializeObject<ODLModel>($"{rawData}");
|
||||
try
|
||||
{
|
||||
dbResult = JsonConvert.DeserializeObject<List<string>>($"{rawData}");
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
readType = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = dbController.OdlGetCurrentByMacc(idxMacchina);
|
||||
dbResult = dbController.OdlGetCurrent().Select(x => x.IdxMacchina).Distinct().ToList();
|
||||
rawData = JsonConvert.SerializeObject(dbResult);
|
||||
redisDb.StringSet(currKey, rawData, TimeSpan.FromSeconds(3));
|
||||
}
|
||||
if (dbResult == null)
|
||||
{
|
||||
dbResult = new ODLModel();
|
||||
dbResult = new List<string>();
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"OdlGetCurrentByMacc | Read from {readType}: {ts.TotalMilliseconds}ms");
|
||||
Log.Debug($"OdlGetCurrent | Read from {readType}: {ts.TotalMilliseconds}ms");
|
||||
|
||||
|
||||
return dbResult;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using MP.Data;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace MP.SPEC.Data
|
||||
{
|
||||
@@ -9,6 +10,21 @@ namespace MP.SPEC.Data
|
||||
public SelectPOdlParams()
|
||||
{ }
|
||||
|
||||
public SelectPOdlParams clone()
|
||||
{
|
||||
SelectPOdlParams clonedData = new SelectPOdlParams()
|
||||
{
|
||||
CodFase = this.CodFase,
|
||||
CurrPage = this.CurrPage,
|
||||
IdxMacchina = this.IdxMacchina,
|
||||
MaxRecord = this.MaxRecord,
|
||||
NumRec = this.NumRec,
|
||||
SearchVal = this.SearchVal,
|
||||
TotCount = this.TotCount
|
||||
};
|
||||
return clonedData;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
@@ -18,10 +34,7 @@ namespace MP.SPEC.Data
|
||||
public int CurrPage { get; set; } = 1;
|
||||
public int NumRec { get; set; } = 10;
|
||||
public int TotCount { get; set; } = 0;
|
||||
public DateTime DtEnd { get; set; } = Utils.InitDatetime(DateTime.Now, 5);
|
||||
public DateTime DtStart { get; set; } = Utils.InitDatetime(DateTime.Now, 5).AddDays(-7);
|
||||
public int MaxRecord { get; set; } = 100;
|
||||
public bool IsActive { get; set; } = true;
|
||||
public string SearchVal { get; set; } = "*";
|
||||
|
||||
#endregion Public Properties
|
||||
@@ -33,15 +46,9 @@ namespace MP.SPEC.Data
|
||||
if (!(obj is SelectOdlParams item))
|
||||
return false;
|
||||
|
||||
if (IsActive != item.IsActive)
|
||||
return false;
|
||||
|
||||
if (CodFase != item.CodStato)
|
||||
return false;
|
||||
|
||||
if (IdxMacchina != item.IdxMacchina)
|
||||
return false;
|
||||
|
||||
if (MaxRecord != item.MaxRecord)
|
||||
return false;
|
||||
|
||||
@@ -50,15 +57,12 @@ namespace MP.SPEC.Data
|
||||
if (TotCount != item.TotCount)
|
||||
return false;
|
||||
|
||||
if (DtStart != item.DtStart)
|
||||
return false;
|
||||
|
||||
if (DtEnd != item.DtEnd)
|
||||
return false;
|
||||
|
||||
if (CurrPage != item.CurrPage)
|
||||
return false;
|
||||
|
||||
if (IdxMacchina != item.IdxMacchina)
|
||||
return false;
|
||||
|
||||
if (SearchVal != item.SearchVal)
|
||||
return false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user