manage label translation messages + ack for prod
This commit is contained in:
@@ -272,6 +272,8 @@ namespace CMS_CORE_Library
|
||||
|
||||
public abstract CmsError NC_GetTranslatedPlcMessages(string language, ref Dictionary<int, string> messages);
|
||||
|
||||
public abstract CmsError NC_GetTranslatedThermoLabels(string language, ref Dictionary<string, string> messages);
|
||||
|
||||
public abstract CmsError NC_GetAvailableLanguages(ref ICollection<CultureInfo> languages);
|
||||
|
||||
/**
|
||||
@@ -639,6 +641,16 @@ namespace CMS_CORE_Library
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public abstract CmsError PLC_WAckProdUpdate();
|
||||
/// <summary>
|
||||
/// Process start prod ack
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public abstract CmsError PLC_WAckPzProdStart();
|
||||
/// <summary>
|
||||
/// Process end prod ack
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public abstract CmsError PLC_WAckPzProdEnd();
|
||||
|
||||
/// <summary>
|
||||
/// Get current recipe parameter list
|
||||
|
||||
@@ -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<int, string> 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;
|
||||
}
|
||||
/// <summary>
|
||||
/// Compilazione dizionario traduzioni THermo
|
||||
/// </summary>
|
||||
/// <param name="language"></param>
|
||||
/// <param name="messages"></param>
|
||||
/// <returns></returns>
|
||||
public override CmsError NC_GetTranslatedThermoLabels(string language, ref Dictionary<string, string> messages)
|
||||
{
|
||||
string filePath;
|
||||
Dictionary<string, string> dict01 = new Dictionary<string, string>();
|
||||
Dictionary<string, string> dict02 = new Dictionary<string, string>();
|
||||
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;
|
||||
}
|
||||
/// <summary>
|
||||
/// Process start prod ack
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
/// <summary>
|
||||
/// Process end prod ack
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// read current recipe parameter list
|
||||
|
||||
Reference in New Issue
Block a user