Fix siemens

This commit is contained in:
Lucio Maranta
2018-10-04 15:56:39 +00:00
parent 7bbe923ea3
commit 656c5bd8ad
3 changed files with 33 additions and 21 deletions
+24 -16
View File
@@ -3572,20 +3572,20 @@ namespace CMS_CORE_Library.Osai
}
// Convert the internal error in a readable-String error
private string GetNCErrorMessage(uint Class, uint Num)
private string GetNCErrorMessage(uint errorClass, uint errorNum)
{
string szErrorClassDesc = "", szErrorDesc = "", ErrorOwner = "";
ErrorOwner = "Osai-Core-Error: ";
if (Class == 0 && Num == 0)
if (errorClass == 0 && errorNum == 0)
return ErrorOwner + "Generic Error On Function";
switch (Class)
switch (errorClass)
{
case 2:
szErrorClassDesc = "SERVER error class";
switch (Num)
switch (errorNum)
{
case 1: szErrorDesc = "Memory for dynamic allocations insufficient"; break;
case 2: szErrorDesc = "Impossible to create synchronisation events"; break;
@@ -3633,11 +3633,11 @@ namespace CMS_CORE_Library.Osai
case 48: szErrorDesc = "Error while writing data to file"; break;
case 49: szErrorDesc = "CNC name too long"; break;
}
return ErrorOwner + szErrorClassDesc + ": " + szErrorDesc + " (" + Class + "-" + Num + ")";
return ErrorOwner + szErrorClassDesc + ": " + szErrorDesc + " (" + errorClass + "-" + errorNum + ")";
case 3:
szErrorClassDesc = "NETBIOS error class";
switch (Num)
switch (errorNum)
{
case 0x1: szErrorDesc = "Illegal buffer length"; break;
case 0x3: szErrorDesc = "Illegal command"; break;
@@ -3677,11 +3677,11 @@ namespace CMS_CORE_Library.Osai
case 0x3F: szErrorDesc = "NETBIOS not loaded"; break;
case 0x40: szErrorDesc = "System error"; break;
}
return ErrorOwner + szErrorClassDesc + ": " + szErrorDesc + " (" + Class + "-" + Num + ")";
return ErrorOwner + szErrorClassDesc + ": " + szErrorDesc + " (" + errorClass + "-" + errorNum + ")";
case 4:
szErrorClassDesc = "CNC error class";
switch (Num)
switch (errorNum)
{
case 0x101: szErrorDesc = "Command unknown"; break;
case 0x102: szErrorDesc = "No channel available"; break;
@@ -3698,11 +3698,11 @@ namespace CMS_CORE_Library.Osai
case 0x203: szErrorDesc = "Dry run already being executed"; break;
case 0x204: szErrorDesc = "Dry run already in stop status"; break;
}
return ErrorOwner + szErrorClassDesc + ": " + szErrorDesc + " (" + Class + "-" + Num + ")";
return ErrorOwner + szErrorClassDesc + ": " + szErrorDesc + " (" + errorClass + "-" + errorNum + ")";
case 5:
szErrorClassDesc = "FILESYSTEM error class";
switch (Num)
switch (errorNum)
{
case 0x001: szErrorDesc = "An error has occurred while opening a transaction with the target for file transfer."; break;
case 0x002: szErrorDesc = "An error has occurred while closing a transaction with the target for file transfer."; break;
@@ -3721,17 +3721,17 @@ namespace CMS_CORE_Library.Osai
case 0x010: szErrorDesc = "Insufficient disk space to complete the requested operation."; break;
case 0x011: szErrorDesc = "The requested file was not found."; break;
}
return ErrorOwner + szErrorClassDesc + ": " + szErrorDesc + " (" + Class + "-" + Num + ")";
return ErrorOwner + szErrorClassDesc + ": " + szErrorDesc + " (" + errorClass + "-" + errorNum + ")";
case 6:
szErrorClassDesc = "WINDOWS error class";
szErrorDesc = new Win32Exception((int)Num).Message;
return ErrorOwner + szErrorClassDesc + ": " + szErrorDesc + " (" + Class + "-" + Num + ")";
szErrorDesc = new Win32Exception((int)errorNum).Message;
return ErrorOwner + szErrorClassDesc + ": " + szErrorDesc + " (" + errorClass + "-" + errorNum + ")";
case 10:
szErrorClassDesc = "DLL_INTERFACE error class";
switch (Num)
switch (errorNum)
{
case 1: szErrorDesc = "The server has been created more than once"; break;
case 2: szErrorDesc = "An error has occurred during the creation of the Cndex server"; break;
@@ -3739,9 +3739,17 @@ namespace CMS_CORE_Library.Osai
case 4: szErrorDesc = "One or more function input parameters are not valid"; break;
case 5: szErrorDesc = "Option A06 -CndexLink communication- for network communications with external applications is not enabled on the CNC you are trying to connect to"; break;
}
return ErrorOwner + szErrorClassDesc + ": " + szErrorDesc + " (" + Class + "-" + Num + ")";
return ErrorOwner + szErrorClassDesc + ": " + szErrorDesc + " (" + errorClass + "-" + errorNum + ")";
case 23:
{
switch (errorNum)
{
case 161: szErrorDesc = "file_not_valid"; break;
}
}
return ErrorOwner + szErrorClassDesc + ": " + szErrorDesc + " (" + errorClass + "-" + errorNum + ")";
default: return ErrorOwner + " Generic Osai Error - Class: " + Class + " Num: " + Num;
default: return ErrorOwner + " Generic Osai Error - Class: " + errorClass + " Num: " + errorNum;
}
}
+8 -4
View File
@@ -1916,15 +1916,18 @@ namespace CMS_CORE_Library.Siemens
}
public override CmsError FILES_RGetFileInfo(string path, ref InfoFile fileInfo)
{
{
try
{
string tmpPath = FormatPath(path);
tmpPath = BASE_FILE_PATH + tmpPath;
FileSvc fileSvc = new FileSvc();
// string trimString = tmpPath.Replace("_DIR", "");
// Preapare folder node
Node fileNode = new Node(tmpPath);
Node fileNode = new Node(@"//PARTPRG:/ciao.spf");
fileInfo = new InfoFile()
{
@@ -1995,7 +1998,7 @@ namespace CMS_CORE_Library.Siemens
//Read Data
Data.Read(readItem);
//Elaborate String
// Elaborate String
string trimString = ((string)readItem.Value);
trimString = trimString.Replace("_N_", "");
lastUnderscore = trimString.LastIndexOf("_");
@@ -2005,7 +2008,7 @@ namespace CMS_CORE_Library.Siemens
data = new ActiveProgramDataModel()
{
Path = trimString,
IsoLines = GetLinesFromString(trimString).ToList(),
IsoLines = new List<string>(),
TimeLeft = new DateTime()
};
}
@@ -2187,6 +2190,7 @@ namespace CMS_CORE_Library.Siemens
private string FormatPath(string path)
{
path = path.TrimStart('\\');
path = path.TrimStart('/');
path = path.TrimEnd('\\');
return path.Replace('\\', '/');
+1 -1
View File
@@ -209,7 +209,7 @@ namespace CMS_CORE_Library
new FieldsConfiguration{ Name = "leftSize", Type = "int", SelectValues = null, Category = "magazine", ReadOnly = false, MinValue = 0, MaxValue = byte.MaxValue},
new FieldsConfiguration{ Name = "rightSize", Type = "int", SelectValues = null, Category = "magazine", ReadOnly = false, MinValue = 0, MaxValue = byte.MaxValue},
new FieldsConfiguration{ Name = "tcpTable", Type = "int", SelectValues = null, Category = "tcp", ReadOnly = false, MinValue = 0, MaxValue = byte.MaxValue},
new FieldsConfiguration{ Name = "gamma", Type = "int", SelectValues = null, Category = "general", ReadOnly = false, MinValue = 0, MaxValue = byte.MaxValue},
new FieldsConfiguration{ Name = "gamma", Type = "int", SelectValues = null, Category = "gamma", ReadOnly = false, MinValue = 0, MaxValue = byte.MaxValue},
new FieldsConfiguration{ Name = "rotationType", Type = "select", SelectValues = cmsRotationTypeList, Category = "general", ReadOnly = false, MinValue = 0, MaxValue = byte.MaxValue},
new FieldsConfiguration{ Name = "cooling", Type = "boolean", SelectValues = null, Category = "cooling", ReadOnly = false, MinValue = 0, MaxValue = int.MaxValue},