diff --git a/IOB-WIN-NEXT/DATA/CONF/BAGLIETTO_CIMOLAI_01.json b/IOB-WIN-NEXT/DATA/CONF/BAGLIETTO_CIMOLAI_01.json index 642d8910..107db128 100644 --- a/IOB-WIN-NEXT/DATA/CONF/BAGLIETTO_CIMOLAI_01.json +++ b/IOB-WIN-NEXT/DATA/CONF/BAGLIETTO_CIMOLAI_01.json @@ -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 diff --git a/IOB-WIN-NEXT/IobGeneric.cs b/IOB-WIN-NEXT/IobGeneric.cs index 1b15b688..3ab55798 100644 --- a/IOB-WIN-NEXT/IobGeneric.cs +++ b/IOB-WIN-NEXT/IobGeneric.cs @@ -838,25 +838,6 @@ namespace IOB_WIN_NEXT return answ; } } - /// - /// URL per recupero ListValue tipo fasi... - /// - 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; - } - } /// /// URL per recupero DOSS correnti x macchina... @@ -918,6 +899,26 @@ namespace IOB_WIN_NEXT } } + /// + /// URL per recupero ListValue tipo fasi... + /// + 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; + } + } + /// /// URL per richiamo parametri da scrivere... /// @@ -4498,6 +4499,18 @@ namespace IOB_WIN_NEXT return answ; } + /// + /// Effettua traduzione da tabella listValue per chiave + /// + /// + /// + /// + protected string getLV(Dictionary currDict, string key) + { + string answ = currDict.ContainsKey(key) ? currDict[key] : key; + return answ; + } + /// /// Stringa raw dei parametri da scrivere... /// diff --git a/IOB-WIN-NEXT/IobOpcUa.cs b/IOB-WIN-NEXT/IobOpcUa.cs index bc9a0062..e24794ff 100644 --- a/IOB-WIN-NEXT/IobOpcUa.cs +++ b/IOB-WIN-NEXT/IobOpcUa.cs @@ -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) diff --git a/IOB-WIN-NEXT/IobOpcUaMBH.cs b/IOB-WIN-NEXT/IobOpcUaMBH.cs index 09569b65..0bbcddf0 100644 --- a/IOB-WIN-NEXT/IobOpcUaMBH.cs +++ b/IOB-WIN-NEXT/IobOpcUaMBH.cs @@ -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) { diff --git a/IOB-WIN-NEXT/IobOpcUaMBHCimolai.cs b/IOB-WIN-NEXT/IobOpcUaMBHCimolai.cs index e02e6ddd..037230f0 100644 --- a/IOB-WIN-NEXT/IobOpcUaMBHCimolai.cs +++ b/IOB-WIN-NEXT/IobOpcUaMBHCimolai.cs @@ -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 + + // + // This is here so CodeMaid doesn't reorganize this document + // + 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 + } + // + // This is here so CodeMaid doesn't reorganize this document + // + 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 ListaArticoli { get; set; } = new List(); @@ -170,7 +298,6 @@ namespace IOB_WIN_NEXT #region Protected Methods - /// /// Recupera da server set di dati specifici x IOB : qui per compilare files CSV /// @@ -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 - - - // - // This is here so CodeMaid doesn't reorganize this document - // - 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 - } - // - // This is here so CodeMaid doesn't reorganize this document - // - 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 /// @@ -525,7 +566,6 @@ namespace IOB_WIN_NEXT return answ; } - #endregion Private Methods } } \ No newline at end of file diff --git a/IOB-WIN-NEXT/IobSimula.cs b/IOB-WIN-NEXT/IobSimula.cs index d728d03a..1aa3663e 100644 --- a/IOB-WIN-NEXT/IobSimula.cs +++ b/IOB-WIN-NEXT/IobSimula.cs @@ -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; } - /// - /// Effettua traduzione da tabella listValue per chiave - /// - /// - /// - /// - protected string getLV(Dictionary currDict, string key) - { - string answ = currDict.ContainsKey(key) ? currDict[key] : key; - return answ; - } + /// /// Effettua upload verso server FTP della macchina dei files nella folder indicata