refresh OPC UA e modifiche varie baglietto

This commit is contained in:
Samuele Locatelli
2022-10-08 17:48:08 +02:00
parent 95dbe07693
commit fc806af86e
6 changed files with 220 additions and 160 deletions
@@ -7,6 +7,7 @@
"keyPartId": "",
"keyProgName": "",
"keyRunMode": "PLC/DB231/Attivita",
"runModeSend": true,
"pingAsPowerOn": true,
"forcePingOk": false,
"translRunMode": true,
@@ -20,6 +21,27 @@
"targetValue": "1"
}
],
"condWorkOpc": {
"checkMode": "OR",
"checkList": [
{
"keyName": "PLC/DB231/Attivita",
"targetValue": "2"
},
{
"keyName": "PLC/DB231/Attivita",
"targetValue": "4"
},
{
"keyName": "PLC/DB231/Attivita",
"targetValue": "6"
},
{
"keyName": "PLC/DB231/Attivita",
"targetValue": "8"
}
]
},
"condPowerOn": {
"checkMode": "AND",
"checkList": []
@@ -35,7 +57,24 @@
},
"condManual": {
"checkMode": "AND",
"checkList": []
"checkList": [
{
"keyName": "PLC/DB231/Attivita",
"targetValue": "3"
},
{
"keyName": "PLC/DB231/Attivita",
"targetValue": "4"
},
{
"keyName": "PLC/DB231/Attivita",
"targetValue": "5"
},
{
"keyName": "PLC/DB231/Attivita",
"targetValue": "9"
}
]
},
"condEStop": {
"checkMode": "AND",
@@ -44,14 +83,14 @@
"condError": {
"checkMode": "OR",
"checkList": [
{
"keyName": "PLC/DB13/Gen/ComProfibusMessage",
"targetValue": "1"
},
{
"keyName": "PLC/DB13/Gen/ComProfibusMessage",
"targetValue": "3"
},
//{
// "keyName": "PLC/DB13/Gen/ComProfibusMessage",
// "targetValue": "1"
//},
//{
// "keyName": "PLC/DB13/Gen/ComProfibusMessage",
// "targetValue": "3"
//},
{
"keyName": "PLC/DB13/Gen/Hydraulic_Unit",
"targetValue": "3"
@@ -97,7 +136,8 @@
"RunMode_6": "Inizio Comando Movimento Carrelli",
"RunMode_7": "Termine Comando Movimento Carrelli",
"RunMode_8": "Inizio Comando Sollevamento",
"RunMode_9": "Termine Comando Sollevamento"
"RunMode_9": "Termine Comando Sollevamento",
"RunMode_10": "Invio Comando Snapshot Parametri"
},
"paramsEndThresh": {
"InvDDone": 50
+32 -19
View File
@@ -838,25 +838,6 @@ namespace IOB_WIN_NEXT
return answ;
}
}
/// <summary>
/// URL per recupero ListValue tipo fasi...
/// </summary>
public string urlGetListValFasiPodl
{
get
{
string answ = "";
try
{
answ = $@"{cIobConf.serverData.TRANSP}://{cIobConf.serverData.MPIP}{cIobConf.serverData.MPURL}{cIobConf.serverData.CMDALIVE}/getListValByTable/PODL";
}
catch (Exception exc)
{
lgError(exc, "Errore in composizione urlGetListValFasiPodl");
}
return answ;
}
}
/// <summary>
/// URL per recupero DOSS correnti x macchina...
@@ -918,6 +899,26 @@ namespace IOB_WIN_NEXT
}
}
/// <summary>
/// URL per recupero ListValue tipo fasi...
/// </summary>
public string urlGetListValFasiPodl
{
get
{
string answ = "";
try
{
answ = $@"{cIobConf.serverData.TRANSP}://{cIobConf.serverData.MPIP}{cIobConf.serverData.MPURL}{cIobConf.serverData.CMDALIVE}/getListValByTable/PODL";
}
catch (Exception exc)
{
lgError(exc, "Errore in composizione urlGetListValFasiPodl");
}
return answ;
}
}
/// <summary>
/// URL per richiamo parametri da scrivere...
/// </summary>
@@ -4498,6 +4499,18 @@ namespace IOB_WIN_NEXT
return answ;
}
/// <summary>
/// Effettua traduzione da tabella listValue per chiave
/// </summary>
/// <param name="factTable"></param>
/// <param name="key"></param>
/// <returns></returns>
protected string getLV(Dictionary<string, string> currDict, string key)
{
string answ = currDict.ContainsKey(key) ? currDict[key] : key;
return answ;
}
/// <summary>
/// Stringa raw dei parametri da scrivere...
/// </summary>
+1 -1
View File
@@ -503,7 +503,7 @@ namespace IOB_WIN_NEXT
return changed;
}
internal void procRunMode(ref string currRun)
internal virtual void procRunMode(ref string currRun)
{
// variabili RUN... se richiesto invio runMode
if (opcUaParams.runModeSend)
+4 -27
View File
@@ -177,33 +177,6 @@ namespace IOB_WIN_NEXT
B_input = powerOnOk ? 1 : 0;
procRunMode(ref currRun);
#if false
// variabili RUN... se richiesto invio runMode
if (opcUaParams.runModeSend)
{
if (!string.IsNullOrEmpty(opcUaParams.keyRunMode))
{
currRun = getDataItemValue(opcUaParams.keyRunMode);
if (!string.IsNullOrEmpty(currRun))
{
// se ho valore --> invio
string sVal = "";
string descr = $"RunModeVal";
DateTime locTStamp = DateTime.Now;
sVal = $"Change: {locTStamp.ToString()} | descr: {descr} | Id: {opcUaParams.keyRunMode} | Val: {currRun}";
accodaFLog(sVal, qEncodeFLog(descr, currRun));
// se richiesto provo a tradurre
if (opcUaParams.runModeTrad)
{
string RunModeDescr = itemTranslation("RunMode", currRun);
descr = $"RunMode";
accodaFLog(sVal, qEncodeFLog(descr, RunModeDescr));
}
}
}
}
#endif
// salvo running come = working...
isRunning = isWorking;
@@ -234,6 +207,10 @@ namespace IOB_WIN_NEXT
B_input += (1 << 4);
}
}
// se abilitata gestione ODL esegue eventuale chiusura
// se abilitato watchdog...
if (opcUaParams.WatchDog.IsEnabled)
{
+131 -91
View File
@@ -8,7 +8,6 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using static IOB_UT_NEXT.CustomObj;
namespace IOB_WIN_NEXT
@@ -160,6 +159,135 @@ namespace IOB_WIN_NEXT
#endregion Public Methods
#region Internal Methods
internal override void procRunMode(ref string currRun)
{
// variabili RUN... se richiesto invio runMode
if (opcUaParams.runModeSend)
{
if (!string.IsNullOrEmpty(opcUaParams.keyRunMode))
{
currRun = getDataItemValue(opcUaParams.keyRunMode);
/* gestione specifica:
*
* - verifica valore InCorso x lavora/non lavora
*
*
*
*
*
*/
if (!string.IsNullOrEmpty(currRun))
{
// se ho valore --> invio
string sVal = "";
string descr = $"RunModeVal";
DateTime locTStamp = DateTime.Now;
sVal = $"Change: {locTStamp.ToString()} | descr: {descr} | Id: {opcUaParams.keyRunMode} | Val: {currRun}";
accodaFLog(sVal, qEncodeFLog(descr, currRun));
// se richiesto provo a tradurre
if (opcUaParams.runModeTrad)
{
string RunModeDescr = itemTranslation("RunMode", currRun);
descr = $"RunMode";
accodaFLog(sVal, qEncodeFLog(descr, RunModeDescr));
}
}
}
}
}
#endregion Internal Methods
#region Protected Class
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
protected class ArtRow
{
#region Public Properties
[Description("Matricola_articolo")]
public string Matricola { get; set; } = "";
[Description("Articolo")]
//[Display(Name = "Articolo", Order = 1)]
public string Articolo { get; set; } = "";
[Description("Identificazione")]
//[Display(Name = "Identificazione", Order = 2)]
public string Descrizione { get; set; } = "";
[Description("Peso_teorico_linea1[ton]")]
public int Peso_01 { get; set; } = 0;
[Description("Peso_teorico_linea2[ton]")]
public int Peso_02 { get; set; } = 0;
[Description("Peso_teorico_linea3[ton]")]
public int Peso_03 { get; set; } = 0;
[Description("Peso_teorico_linea4[ton]")]
public int Peso_04 { get; set; } = 0;
[Description("Pos. Carrello 1[mm]")]
public int PosizCarrello_01 { get; set; } = 0;
[Description("Pos. Carrello 2[mm]")]
public int PosizCarrello_02 { get; set; } = 0;
[Description("Pos. Carrello 3[mm]")]
public int PosizCarrello_03 { get; set; } = 0;
[Description("Pos. Carrello 4[mm]")]
public int PosizCarrello_04 { get; set; } = 0;
[Description("Limitazione_velocita_sollevamento[%]")]
//[Display(Name = "Limitazione_velocita_sollevamento[%]", Order = 3)]
public int LimiteVel { get; set; } = 100;
#endregion Public Properties
}
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
protected class JobRow
{
#region Public Properties
[Description("Matricola")]
public string Matricola { get; set; } = "";
[Description("Commessa")]
public string Commessa { get; set; } = "";
[Description("Articolo")]
public string Articolo { get; set; } = "";
[Description("Identificazione")]
public string Descrizione { get; set; } = "";
[Description("Data inserimento")]
public string DataIns { get; set; } = "";
[Description("Ora inserimento")]
public string OraIns { get; set; } = "";
[Description("Lavorazione")]
public string Lavorazione { get; set; } = "";
#endregion Public Properties
}
#endregion Protected Class
#region Protected Properties
protected List<ArtRow> ListaArticoli { get; set; } = new List<ArtRow>();
@@ -170,7 +298,6 @@ namespace IOB_WIN_NEXT
#region Protected Methods
/// <summary>
/// Recupera da server set di dati specifici x IOB : qui per compilare files CSV
/// </summary>
@@ -265,7 +392,6 @@ namespace IOB_WIN_NEXT
.Select(x => new JobRow() { Matricola = x.CodArticolo, Commessa = $"PODL{x.IdxPromessa:00000000}", Articolo = x.CodArticolo, Descrizione = x.CodArticolo, DataIns = $"{x.InsertDate:dd/MM/yyyy}", OraIns = $"{x.InsertDate:HH:mm}", Lavorazione = $"{getLV(dictAF, x.KeyRichiesta)} {x.Note}".Trim() })
.ToList();
// predispongo dati articoli
ListaArticoli = listaArt
.Select(a => new ArtRow() { Matricola = a.CodArticolo, Articolo = a.Disegno, Descrizione = a.DescArticolo, LimiteVel = 100 })
@@ -371,8 +497,8 @@ namespace IOB_WIN_NEXT
filePath = Path.Combine(tempDir, $"{csvName}");
answ = DataExport.SaveToCsv(ListaJobs, filePath);
if (answ)
{
lg.Info($"CSV: created PODL file as {csvName}");
{
lg.Info($"CSV: created PODL file as {csvName}");
}
}
return answ;
@@ -380,91 +506,6 @@ namespace IOB_WIN_NEXT
#endregion Protected Methods
#region Protected Classes
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
protected class ArtRow
{
#region Public Properties
[Description("Matricola_articolo")]
public string Matricola { get; set; } = "";
[Description("Articolo")]
//[Display(Name = "Articolo", Order = 1)]
public string Articolo { get; set; } = "";
[Description("Identificazione")]
//[Display(Name = "Identificazione", Order = 2)]
public string Descrizione { get; set; } = "";
[Description("Peso_teorico_linea1[ton]")]
public int Peso_01 { get; set; } = 0;
[Description("Peso_teorico_linea2[ton]")]
public int Peso_02 { get; set; } = 0;
[Description("Peso_teorico_linea3[ton]")]
public int Peso_03 { get; set; } = 0;
[Description("Peso_teorico_linea4[ton]")]
public int Peso_04 { get; set; } = 0;
[Description("Pos. Carrello 1[mm]")]
public int PosizCarrello_01 { get; set; } = 0;
[Description("Pos. Carrello 2[mm]")]
public int PosizCarrello_02 { get; set; } = 0;
[Description("Pos. Carrello 3[mm]")]
public int PosizCarrello_03 { get; set; } = 0;
[Description("Pos. Carrello 4[mm]")]
public int PosizCarrello_04 { get; set; } = 0;
[Description("Limitazione_velocita_sollevamento[%]")]
//[Display(Name = "Limitazione_velocita_sollevamento[%]", Order = 3)]
public int LimiteVel { get; set; } = 100;
#endregion Public Properties
}
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
protected class JobRow
{
#region Public Properties
[Description("Matricola")]
public string Matricola { get; set; } = "";
[Description("Commessa")]
public string Commessa { get; set; } = "";
[Description("Articolo")]
public string Articolo { get; set; } = "";
[Description("Identificazione")]
public string Descrizione { get; set; } = "";
[Description("Data inserimento")]
public string DataIns { get; set; } = "";
[Description("Ora inserimento")]
public string OraIns { get; set; } = "";
[Description("Lavorazione")]
public string Lavorazione { get; set; } = "";
#endregion Public Properties
}
#endregion Protected Classes
#region Private Methods
/// <summary>
@@ -525,7 +566,6 @@ namespace IOB_WIN_NEXT
return answ;
}
#endregion Private Methods
}
}
+2 -12
View File
@@ -601,7 +601,7 @@ namespace IOB_WIN_NEXT
{
// predispongo dati PODL
ListaJobs = listaPODL
.Select(x => new JobRow() { Matricola = x.CodArticolo, Commessa = $"PODL{x.IdxPromessa:00000000}", Articolo = x.CodArticolo, Descrizione = x.CodArticolo, DataIns = $"{x.InsertDate:dd/MM/yyyy}", OraIns = $"{x.InsertDate:HH:mm}", Lavorazione = $"{getLV(dictAF, x.KeyRichiesta)} {x.Note}" })
.Select(x => new JobRow() { Matricola = x.CodArticolo, Commessa = $"PODL{x.IdxPromessa:00000000}", Articolo = x.CodArticolo, Descrizione = x.CodArticolo, DataIns = $"{x.InsertDate:dd/MM/yyyy}", OraIns = $"{x.InsertDate:HH:mm}", Lavorazione = $"{getLV(dictAF, x.KeyRichiesta)} {x.Note}".Trim() })
.ToList();
@@ -633,17 +633,7 @@ namespace IOB_WIN_NEXT
}
return answ;
}
/// <summary>
/// Effettua traduzione da tabella listValue per chiave
/// </summary>
/// <param name="factTable"></param>
/// <param name="key"></param>
/// <returns></returns>
protected string getLV(Dictionary<string, string> currDict, string key)
{
string answ = currDict.ContainsKey(key) ? currDict[key] : key;
return answ;
}
/// <summary>
/// Effettua upload verso server FTP della macchina dei files nella folder indicata