Aggiunta LUT stati semaforo in RAM
This commit is contained in:
+74
-61
@@ -1,5 +1,5 @@
|
||||
using AjaxControlToolkit;
|
||||
using MapoDb;
|
||||
using MapoDb.DS_applicazioneTableAdapters;
|
||||
using Newtonsoft.Json;
|
||||
using SteamWare;
|
||||
using System;
|
||||
@@ -164,6 +164,39 @@ public class resoconti
|
||||
return _answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera commessa attiva al momento indicato
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <param name="inizio"></param>
|
||||
/// <param name="fine"></param>
|
||||
/// <param name="dataRif"></param>
|
||||
/// <returns></returns>
|
||||
public string commessaAttiva(string idxMacchina, DateTime inizio, DateTime fine, DateTime dataRif)
|
||||
{
|
||||
string answ = "NA";
|
||||
var tabOdl = OdlPeriodo(idxMacchina, inizio, fine);
|
||||
if (tabOdl != null)
|
||||
{
|
||||
var currRow = tabOdl
|
||||
.Where(x => x.DataInizio <= dataRif && (x.DataFine >= dataRif || x.DataFine == null))
|
||||
.FirstOrDefault();
|
||||
// 2023.05.17: se NON trovasse "sposto avanti" un sec...
|
||||
if (currRow == null)
|
||||
{
|
||||
dataRif = dataRif.AddSeconds(1);
|
||||
currRow = tabOdl
|
||||
.Where(x => x.DataInizio <= dataRif && (x.DataFine >= dataRif || x.DataFine == null))
|
||||
.FirstOrDefault();
|
||||
}
|
||||
if (currRow != null)
|
||||
{
|
||||
answ = currRow.KeyRichiesta;
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// oggetto GRUPPI x sequencer formato VisJS
|
||||
/// </summary>
|
||||
@@ -283,13 +316,22 @@ public class resoconti
|
||||
public string semaforoDaIdxStato(int idx)
|
||||
{
|
||||
string _answ = "";
|
||||
if (memLayer.ML.CRB("fastColorDecode"))
|
||||
// cerco in LUT...
|
||||
if (SemapLUT.ContainsKey(idx))
|
||||
{
|
||||
_answ = codSemaforo[idx];
|
||||
_answ = SemapLUT[idx];
|
||||
}
|
||||
else
|
||||
{
|
||||
_answ = Stati.FindByIdxStato(idx).Semaforo;
|
||||
if (memLayer.ML.CRB("fastColorDecode"))
|
||||
{
|
||||
_answ = codSemaforo[idx];
|
||||
}
|
||||
else
|
||||
{
|
||||
_answ = Stati.FindByIdxStato(idx).Semaforo;
|
||||
}
|
||||
SemapLUT.Add(idx, _answ);
|
||||
}
|
||||
return _answ;
|
||||
}
|
||||
@@ -576,16 +618,17 @@ public class resoconti
|
||||
protected DS_applicazione.MacchineDataTable _Macchine;
|
||||
protected DS_applicazione.AnagraficaStatiDataTable _Stati;
|
||||
protected DS_applicazione.StatoMacchineDataTable _StatoMacchine;
|
||||
protected Dictionary<int, string> SemapLUT = new Dictionary<int, string>();
|
||||
protected MapoDb.DS_applicazioneTableAdapters.AnagArticoliTableAdapter taAnagArt;
|
||||
protected MapoDb.DS_applicazioneTableAdapters.AnagraficaOperatoriTableAdapter taAnagOpr;
|
||||
protected MapoDb.DS_applicazioneTableAdapters.AnagraficaEventiTableAdapter taAnagraficaEventi;
|
||||
protected MapoDb.DS_applicazioneTableAdapters.DiarioDiBordoTableAdapter taDiarioDiBordo;
|
||||
protected MapoDb.DS_applicazioneTableAdapters.MacchineTableAdapter taMacchine;
|
||||
protected MapoDb.DS_ProdTempiTableAdapters.ODLTableAdapter taODL;
|
||||
protected MapoDb.DS_applicazioneTableAdapters.ParetoDurateTableAdapter taParetoDurate;
|
||||
protected MapoDb.DS_applicazioneTableAdapters.AnagraficaStatiTableAdapter taStati;
|
||||
protected MapoDb.DS_applicazioneTableAdapters.StatoMacchineTableAdapter taStatoMacchine;
|
||||
protected MapoDb.DS_ProdTempiTableAdapters.TempiCicloRilevatiTableAdapter taTempiCiclo;
|
||||
protected MapoDb.DS_ProdTempiTableAdapters.ODLTableAdapter taODL;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
@@ -803,6 +846,32 @@ public class resoconti
|
||||
return _StatoMacchine;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Recupera record odl al momento indicato
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <param name="inizio"></param>
|
||||
/// <param name="fine"></param>
|
||||
/// <param name="dataRif"></param>
|
||||
/// <returns></returns>
|
||||
protected DS_ProdTempi.ODLRow currOdl(string idxMacchina, DateTime inizio, DateTime fine, DateTime dataRif)
|
||||
{
|
||||
DS_ProdTempi.ODLRow answ = null;
|
||||
var tabOdl = OdlPeriodo(idxMacchina, inizio, fine);
|
||||
if (tabOdl != null)
|
||||
{
|
||||
answ = tabOdl
|
||||
.Where(x => x.DataInizio <= dataRif && (x.DataFine >= dataRif || x.DataFine == null))
|
||||
.FirstOrDefault();
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera tab ODL per periodo e impianto indicati
|
||||
/// </summary>
|
||||
@@ -834,62 +903,6 @@ public class resoconti
|
||||
}
|
||||
return odlReq;
|
||||
}
|
||||
/// <summary>
|
||||
/// Recupera record odl al momento indicato
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <param name="inizio"></param>
|
||||
/// <param name="fine"></param>
|
||||
/// <param name="dataRif"></param>
|
||||
/// <returns></returns>
|
||||
protected DS_ProdTempi.ODLRow currOdl(string idxMacchina, DateTime inizio, DateTime fine, DateTime dataRif)
|
||||
{
|
||||
DS_ProdTempi.ODLRow answ = null;
|
||||
var tabOdl = OdlPeriodo(idxMacchina, inizio, fine);
|
||||
if (tabOdl != null)
|
||||
{
|
||||
answ = tabOdl
|
||||
.Where(x => x.DataInizio <= dataRif && (x.DataFine >= dataRif || x.DataFine == null))
|
||||
.FirstOrDefault();
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Recupera commessa attiva al momento indicato
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <param name="inizio"></param>
|
||||
/// <param name="fine"></param>
|
||||
/// <param name="dataRif"></param>
|
||||
/// <returns></returns>
|
||||
public string commessaAttiva(string idxMacchina, DateTime inizio, DateTime fine, DateTime dataRif)
|
||||
{
|
||||
string answ = "NA";
|
||||
var tabOdl = OdlPeriodo(idxMacchina, inizio, fine);
|
||||
if (tabOdl != null)
|
||||
{
|
||||
var currRow = tabOdl
|
||||
.Where(x => x.DataInizio <= dataRif && (x.DataFine >= dataRif || x.DataFine == null))
|
||||
.FirstOrDefault();
|
||||
// 2023.05.17: se NON trovasse "sposto avanti" un sec...
|
||||
if (currRow == null)
|
||||
{
|
||||
dataRif = dataRif.AddSeconds(1);
|
||||
currRow = tabOdl
|
||||
.Where(x => x.DataInizio <= dataRif && (x.DataFine >= dataRif || x.DataFine == null))
|
||||
.FirstOrDefault();
|
||||
}
|
||||
if (currRow != null)
|
||||
{
|
||||
answ = currRow.KeyRichiesta;
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Effettua riduzione per accorpamento valori
|
||||
|
||||
Reference in New Issue
Block a user