diff --git a/CMS_CORE_Library/NcThermo.cs b/CMS_CORE_Library/NcThermo.cs index 5e68f5a..471203b 100644 --- a/CMS_CORE_Library/NcThermo.cs +++ b/CMS_CORE_Library/NcThermo.cs @@ -272,6 +272,8 @@ namespace CMS_CORE_Library public abstract CmsError NC_GetTranslatedPlcMessages(string language, ref Dictionary messages); + public abstract CmsError NC_GetTranslatedThermoLabels(string language, ref Dictionary messages); + public abstract CmsError NC_GetAvailableLanguages(ref ICollection languages); /** @@ -639,6 +641,16 @@ namespace CMS_CORE_Library /// /// public abstract CmsError PLC_WAckProdUpdate(); + /// + /// Process start prod ack + /// + /// + public abstract CmsError PLC_WAckPzProdStart(); + /// + /// Process end prod ack + /// + /// + public abstract CmsError PLC_WAckPzProdEnd(); /// /// Get current recipe parameter list diff --git a/CMS_CORE_Library/S7Net/Nc_S7Net.cs b/CMS_CORE_Library/S7Net/Nc_S7Net.cs index 147d314..96417c2 100644 --- a/CMS_CORE_Library/S7Net/Nc_S7Net.cs +++ b/CMS_CORE_Library/S7Net/Nc_S7Net.cs @@ -8,6 +8,7 @@ using System.IO; using System.Linq; using System.Net; using System.Net.NetworkInformation; +using System.ServiceModel.Channels; using System.Text; using System.Threading; using static CMS_CORE_Library.Models.DataStructures; @@ -42,7 +43,7 @@ namespace CMS_CORE_Library.S7Net // Alarms data private static Dictionary PlcMessages; private const string PLC_MESSAGE_PATH = "C:/CMS/S7NET/"; - private const string THERMO_DICT_PATH = "C:/CMS/ThermoActive/Dict/"; + private const string THERMO_DICT_PATH = @"Dict\"; private static ushort SelectedProcess = 1; @@ -228,7 +229,54 @@ namespace CMS_CORE_Library.S7Net .Where(line => line.Count() == 2) .ToDictionary(line => Convert.ToInt32(line[0]), line => line[1].Trim()); - return NO_ERROR; + } + catch (Exception ex) + { + return ManageException(ex); + } + return NO_ERROR; + } + /// + /// Compilazione dizionario traduzioni THermo + /// + /// + /// + /// + public override CmsError NC_GetTranslatedThermoLabels(string language, ref Dictionary messages) + { + string filePath; + Dictionary dict01 = new Dictionary(); + Dictionary dict02 = new Dictionary(); + try + { + CultureInfo cultureInfo = CultureInfo.CreateSpecificCulture(language); + string langName = ""; + if (cultureInfo.IsNeutralCulture) + langName = cultureInfo.EnglishName; + else + langName = cultureInfo.Parent.EnglishName; + + // Setup the Path for enums + filePath = THERMO_DICT_PATH + @"Enums_" + language + @".txt"; + + // Read From File... + dict01 = File.ReadAllLines(filePath, Encoding.Default) + .Select(line => line.Split(',')) + .Where(line => line.Count() == 2) + .ToDictionary(line => line[0].Trim(), line => line[1].Trim()); + + // Setup the Path for labels + filePath = THERMO_DICT_PATH + @"labels_" + language + @".txt"; + + // Read From File... + dict02 = File.ReadAllLines(filePath, Encoding.Default) + .Select(line => line.Split(',')) + .Where(line => line.Count() == 2) + .ToDictionary(line => line[0].Trim(), line => line[1].Trim()); + + // combine 2 dictionary... + messages = dict01.Union(dict02).ToDictionary(d => d.Key, d => d.Value); + } catch (Exception ex) { @@ -1967,6 +2015,36 @@ namespace CMS_CORE_Library.S7Net return libraryError; } + /// + /// Process start prod ack + /// + /// + public override CmsError PLC_WAckPzProdStart() + { + CmsError libraryError = NO_ERROR; + + // Call ack for prod update + libraryError = PLC_WAck(REQ_CONF_ACK, REQ_CONF_STROBE, 11); + if (libraryError.IsError()) + return libraryError; + + return libraryError; + } + /// + /// Process end prod ack + /// + /// + public override CmsError PLC_WAckPzProdEnd() + { + CmsError libraryError = NO_ERROR; + + // Call ack for prod update + libraryError = PLC_WAck(REQ_CONF_ACK, REQ_CONF_STROBE, 12); + if (libraryError.IsError()) + return libraryError; + + return libraryError; + } /// /// read current recipe parameter list