-
-
-
-
+
\ No newline at end of file
diff --git a/MP-TAB/SendParameters.aspx.designer.cs b/MP-TAB/SendParameters.aspx.designer.cs
index c2822fd8..36a519bc 100644
--- a/MP-TAB/SendParameters.aspx.designer.cs
+++ b/MP-TAB/SendParameters.aspx.designer.cs
@@ -1,44 +1,44 @@
//------------------------------------------------------------------------------
-//
-// Codice generato da uno strumento.
+//
+// This code was generated by a tool.
//
-// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
-// il codice viene rigenerato.
-//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
//------------------------------------------------------------------------------
namespace MoonProTablet
{
- public partial class SendParameters
- {
+ public partial class SendParameters
+ {
- ///
- /// Controllo mod_dettMacchina.
- ///
- ///
- /// Campo generato automaticamente.
- /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
- ///
- protected global::MoonProTablet.WebUserControls.mod_dettMacchina mod_dettMacchina;
+ ///
+ /// mod_dettMacchina control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::MoonProTablet.WebUserControls.mod_dettMacchina mod_dettMacchina;
- ///
- /// Controllo mod_sendParameters.
- ///
- ///
- /// Campo generato automaticamente.
- /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
- ///
- protected global::MoonProTablet.WebUserControls.mod_sendParameters mod_sendParameters;
+ ///
+ /// mod_sendParameters control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::MoonProTablet.WebUserControls.mod_sendParameters mod_sendParameters;
- ///
- /// Controllo mod_directLinks.
- ///
- ///
- /// Campo generato automaticamente.
- /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
- ///
- protected global::MoonProTablet.WebUserControls.mod_directLinks mod_directLinks;
- }
+ ///
+ /// mod_directLinks control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::MoonProTablet.WebUserControls.mod_directLinks mod_directLinks;
+ }
}
diff --git a/MP-TAB/WebUserControls/mod_ODL.ascx.cs b/MP-TAB/WebUserControls/mod_ODL.ascx.cs
index 5dc90174..f4f3b072 100644
--- a/MP-TAB/WebUserControls/mod_ODL.ascx.cs
+++ b/MP-TAB/WebUserControls/mod_ODL.ascx.cs
@@ -857,6 +857,9 @@ namespace MoonProTablet.WebUserControls
Response.Redirect("~/DettaglioMacchina.aspx");
}
}
+ // invio task x end produzione...
+ DataLayerObj.addTask4Machine(idxMacchinaFix, taskType.endProd, "");
+
// resetto ODL su redis...
DataLayerObj.emptyCurrODL(idxMacchinaFix);
// reset ODL!...
diff --git a/MP-TAB/WebUserControls/mod_sendParameters.ascx.cs b/MP-TAB/WebUserControls/mod_sendParameters.ascx.cs
index 5aba9a1c..f7497b3b 100644
--- a/MP-TAB/WebUserControls/mod_sendParameters.ascx.cs
+++ b/MP-TAB/WebUserControls/mod_sendParameters.ascx.cs
@@ -13,10 +13,29 @@ namespace MoonProTablet.WebUserControls
{
public partial class mod_sendParameters : BaseUserControl
{
+ #region Protected Methods
+
+ protected void grView_RowEditing(object sender, GridViewEditEventArgs e)
+ {
+ }
+
+ protected void grView_RowUpdating(object sender, GridViewUpdateEventArgs e)
+ {
+ }
+
+ protected void lbtReload_Click(object sender, EventArgs e)
+ {
+ grView.DataBind();
+ }
+
protected void Page_Load(object sender, EventArgs e)
{
}
+ #endregion Protected Methods
+
+ #region Public Methods
+
///
/// wrapper recupero parametri macchina
///
@@ -53,38 +72,7 @@ namespace MoonProTablet.WebUserControls
DataLayerObj.updateMachineParameter(idxMacchina, Original_uid, reqValue);
}
}
- protected void lbtReload_Click(object sender, EventArgs e)
- {
- grView.DataBind();
- }
- protected void grView_RowUpdating(object sender, GridViewUpdateEventArgs e)
- {
-#if false
- var txtReqVal = grView.Rows[e.RowIndex].FindControl("txtReqValue") as TextBox;
- string Original_uid = e.Keys[0].ToString();
- // recupero items...
- List
dcList = DataLayer.getCurrObjItems(idxMacchina);
- // cerco quello da aggiornare
- objItem trovato = dcList.Find(obj => obj.uid == Original_uid);
- List list2Update = new List();
- // se trovato procedo
- if (trovato != null)
- {
- // aggiorno valore richiesto + dt richiesta
- trovato.reqValue = txtReqVal.Text.Trim();
- trovato.lastRequest = DateTime.Now;
- list2Update.Add(trovato);
- DataLayer.upsertCurrObjItems(idxMacchina, list2Update);
- // accodo in task 2 exe la richiesta di processing
- DataLayer.addTask4Machine(idxMacchina, taskType.setParameter, trovato.uid);
- }
-#endif
- }
-
- protected void grView_RowEditing(object sender, GridViewEditEventArgs e)
- {
-
- }
+ #endregion Public Methods
}
}
\ No newline at end of file
diff --git a/MapoDb/DataLayer.cs b/MapoDb/DataLayer.cs
index 3d6e9cac..b20e56fd 100644
--- a/MapoDb/DataLayer.cs
+++ b/MapoDb/DataLayer.cs
@@ -786,6 +786,16 @@ namespace MapoDb
return mHash(string.Format("PzCount:{0}", idxMacchina));
}
+ ///
+ /// Hash dati SAVED (EXE) TASK x la macchina specificata x poter ripristinare in caso di perdita valore WRITE
+ ///
+ ///
+ ///
+ public static string savedTaskHash(string idxMacchina)
+ {
+ return mHash(string.Format("SavedTask:{0}", idxMacchina));
+ }
+
///
/// Hash dati STATUS x la macchina specificata.
/// - dati ODL
@@ -809,6 +819,41 @@ namespace MapoDb
return mHash($"VetoOdlMacc:{idxMacchina}");
}
+ ///
+ /// verifica se sia da reinviare un task alla macchina dall'elenco di quelli salvati (in modalità upsert) se non scaduti
+ ///
+ ///
+ ///
+ ///
+ ///
+ public bool addCheckTask4Machine(string idxMacchina, taskType taskKey, string taskVal)
+ {
+ bool answ = false;
+ string currHash = exeTaskHash(idxMacchina);
+ logger.lg.scriviLog($"addCheckTask4Machine idxMacchina: {idxMacchina} | taskKey: {taskKey} | taskVal: {taskVal}");
+ try
+ {
+ Dictionary savedTask = mSavedTaskMacchina(idxMacchina);
+ // cerco valore saved
+ string savedVal = savedTask[taskKey.ToString()];
+ // se ho un valore != "" --> rimetto in coda di invio...
+ if (!string.IsNullOrEmpty(savedVal) && (savedVal != taskVal))
+ {
+ // leggo task attuali...
+ Dictionary currTask = mTaskMacchina(idxMacchina);
+ // rimetto in task da eseguire...
+ currTask[taskKey.ToString()] = savedVal;
+ answ = memLayer.ML.redSaveHashDict(currHash, currTask);
+ logger.lg.scriviLog($"re-issued task4machine: idxMacchina: {idxMacchina} | taskKey: {taskKey} | savedVal: {savedVal}");
+ }
+ }
+ catch
+ { }
+ // chiamo update come task di scrittura
+
+ return answ;
+ }
+
///
/// Aggiunge un PARAMETRO OPZIONALE all'elenco di quelli salvati (in modalità upsert)
///
@@ -842,15 +887,40 @@ namespace MapoDb
{
bool answ = false;
string currHash = exeTaskHash(idxMacchina);
+ string currSavedParHash = savedTaskHash(idxMacchina);
+ Dictionary currTask = new Dictionary();
+ Dictionary savedTask = new Dictionary();
try
{
// leggo task attuali...
- var currTask = mTaskMacchina(idxMacchina);
+ currTask = mTaskMacchina(idxMacchina);
currTask[taskKey.ToString()] = taskVal;
answ = memLayer.ML.redSaveHashDict(currHash, currTask);
- logger.lg.scriviLog($"Task ADD - idxMacchina: {idxMacchina} | taskKey: {taskKey.ToString()} | taskVal: {taskVal}");
+ logger.lg.scriviLog($"Task ADD - idxMacchina: {idxMacchina} | taskKey: {taskKey} | taskVal: {taskVal}");
}
catch { }
+ // verifico in base al tipo di task se fare backup...
+ switch (taskKey)
+ {
+ case taskType.setArt:
+ case taskType.setComm:
+ case taskType.setPzComm:
+ case taskType.setProg:
+ // leggo task SALVATI attuali...
+ savedTask = mSavedTaskMacchina(idxMacchina);
+ savedTask[taskKey.ToString()] = taskVal;
+ answ = memLayer.ML.redSaveHashDict(currSavedParHash, savedTask);
+ break;
+
+ case taskType.endProd:
+ // salvo un DICT vuoto x resettare
+ savedTask = new Dictionary();
+ answ = memLayer.ML.redSaveHashDict(currSavedParHash, savedTask);
+ break;
+
+ default:
+ break;
+ }
return answ;
}
@@ -1931,6 +2001,28 @@ namespace MapoDb
return answ;
}
+ ///
+ /// Restitusice elenco KVP dei TASK SALVATI (da passare a IOB-WIN) per l'impianto indicato
+ ///
+ ///
+ ///
+ public Dictionary mSavedTaskMacchina(string idxMacchina)
+ {
+ // hard coded dimensione vettore DatiMacchine
+ Dictionary answ = new Dictionary();
+ // ORA recupero da memoria redis...
+ try
+ {
+ string currHash = savedTaskHash(idxMacchina);
+ answ = memLayer.ML.redGetHashDict(currHash);
+ }
+ catch (Exception exc)
+ {
+ logger.lg.scriviLog(string.Format("Errore in recupero dati SAVED TASK x Redis mSavedTaskMacchina - idxMacchina {2}:{0}{1}", Environment.NewLine, exc, idxMacchina));
+ }
+ return answ;
+ }
+
///
/// Restitusice elenco KVP
/// key: IdxMacchina
@@ -2010,7 +2102,7 @@ namespace MapoDb
}
catch (Exception exc)
{
- logger.lg.scriviLog(string.Format("Errore in compilazione dati EXE TASK x Redis - idxMacchina {2}:{0}{1}", Environment.NewLine, exc, idxMacchina));
+ logger.lg.scriviLog(string.Format("Errore in recupero dati EXE TASK x Redis mTaskMacchina - idxMacchina {2}:{0}{1}", Environment.NewLine, exc, idxMacchina));
}
return answ;
}
@@ -3333,6 +3425,17 @@ namespace MapoDb
{
string serVal = JsonConvert.SerializeObject(currValues);
memLayer.ML.setRSV(currParametersHash(idxMacchina), serVal);
+
+ // controllo se ha valori write...
+ foreach (var item in currValues)
+ {
+ // se fosse un valore WRITE e mi ha dato un valore vuoto --> mando un fix x riscrittura
+ if (item.writable && string.IsNullOrEmpty(item.value))
+ {
+ taskType currTask = (taskType)Enum.Parse(typeof(taskType), item.uid);
+ addCheckTask4Machine(idxMacchina, currTask, item.value);
+ }
+ }
}
return answ;
}
@@ -3467,57 +3570,4 @@ namespace MapoDb
#endregion Public Methods
}
-}
-
-#if false
-
-///
-/// Elenco task ammessi (x IOB-WIN da eseguire...)
-///
-public enum taskType {
- ///
- /// Task nullo / fake
- ///
- nihil,
- ///
- /// Rimanda a PLC eventuale segnale NON in setup (MA NON RESETTA)
- ///
- fixStopSetup,
- ///
- /// Indica al PLC di forzare il reset del contapezzi
- ///
- forceResetPzCount,
- ///
- /// Indica al PLC di forzare il NUOVO valore di contapezzi (impostato come value)
- ///
- forceSetPzCount,
- ///
- /// Imposta Articolo su PLC
- ///
- setArt,
- ///
- /// Imposta Commessa su PLC
- ///
- setComm,
- ///
- /// Set Programma CNC su PLC
- ///
- setProg,
- ///
- /// Indica al PLC iniziato setup (e secondo casi ferma contapezzi /resetta)
- ///
- startSetup,
- ///
- /// Indica al PLC finito setup (e secondo casi ferma contapezzi /resetta)
- ///
- stopSetup,
- ///
- /// Richiesta invio watchdog a PLC
- ///
- sendWatchDogMes2Plc
-}
-public enum tipoSelettore {
- articoli
-}
-
-#endif
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/MapoSDK/Enums.cs b/MapoSDK/Enums.cs
index 41535fca..63196da3 100644
--- a/MapoSDK/Enums.cs
+++ b/MapoSDK/Enums.cs
@@ -173,7 +173,12 @@
///
/// Richiesta invio watchdog a PLC
///
- sendWatchDogMes2Plc
+ sendWatchDogMes2Plc,
+
+ ///
+ /// Indica che è FINITA la produzione (e quindi cancello dati backup)
+ ///
+ endProd,
}
///