Fix scada
This commit is contained in:
Lucio Maranta
2019-06-25 09:26:03 +00:00
parent 1548a12c8e
commit b6e56bd1d7
10 changed files with 325 additions and 60 deletions
+3
View File
@@ -120,6 +120,9 @@ namespace CMS_CORE_Application
SelectedProcessData selected = new SelectedProcessData();
cmsError = N.PROC_RSelectedProcessData(1, ref selected);
cmsError = N.NC_SetScreenVisible(Nc.SCREEN_PAGE.Fanuc_Custom2);
sw.Stop();
Console.WriteLine(sw.ElapsedMilliseconds);
+26
View File
@@ -1397,8 +1397,27 @@ namespace CMS_CORE_Library.Demo
processData.Origin = val;
cmsError = MEM_RWByte(R, 1, RAPID_OVERRIDE.MemType, RAPID_OVERRIDE.Address, 0, ref val);
if (cmsError.IsError())
return cmsError;
processData.RapidOverride = val;
cmsError = MEM_RWByte(R, 1, WORK_OVERRIDE.MemType, WORK_OVERRIDE.Address, 0, ref val);
if (cmsError.IsError())
return cmsError;
processData.WorkOverride = val;
processData.ProcessMessage = "Messaggio di test decisamente lungo";
processData.OffsetData = new OffsetModel()
{
RealLength = 5,
UnitOfMeasure = "mm",
RealRadius = 15
};
return NO_ERROR;
}
@@ -2387,6 +2406,11 @@ namespace CMS_CORE_Library.Demo
return NO_ERROR;
}
public override CmsError FILES_WUploadCustomMainProgramAndActivate(int processId, string customPartProgramContent, ref ActiveProgramDataModel activeData)
{
return NO_ERROR;
}
#endregion File Management
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -3579,6 +3603,8 @@ namespace CMS_CORE_Library.Demo
internal static MEMORY_CELL CANDY_MEM = new MEMORY_CELL(MEMORY_TYPE.Demo, 472, 1);
internal static MEMORY_CELL HEADS_WORKED_TIMES = new MEMORY_CELL(MEMORY_TYPE.Demo, 480, 4);
internal static MEMORY_CELL SELF_ADAPTIVE_PATH = new MEMORY_CELL(MEMORY_TYPE.Demo, 560, 4);
internal static MEMORY_CELL RAPID_OVERRIDE = new MEMORY_CELL(MEMORY_TYPE.Demo, 570, 4);
internal static MEMORY_CELL WORK_OVERRIDE = new MEMORY_CELL(MEMORY_TYPE.Demo, 571, 4);
}
+76 -28
View File
@@ -9,6 +9,7 @@ using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using static CMS_CORE_Library.Fanuc.MEMORY_ADDRESS;
using static CMS_CORE_Library.Models.DataStructures;
@@ -440,22 +441,12 @@ namespace CMS_CORE_Library.Fanuc
if (pageToGo == 0)
return INCORRECT_PARAMETERS_ERROR;
////Read actual page
//nReturn = Focas1.cnc_getcurscrn(nLibHandle[0], out actualPage);
////Throw Exception if there's an error
//if (nReturn != 0)
// return GetNcError(nReturn);
//Write the new page
//if (actualPage != pageToGo)
//{
// Set page
nReturn = Focas1.cnc_setcurscrn(nLibHandle[0], pageToGo);
//Throw Exception if there's an error
if (nReturn != 0)
return GetNcError(nReturn);
//}
return NO_ERROR;
}
@@ -965,7 +956,18 @@ namespace CMS_CORE_Library.Fanuc
// Parse line & get parameters
parameters = ExtractM155ParametersFromNcCodeLine(actualLine, '(', ')');
if (parameters.Count() == 0)
return INCORRECT_PARAMETERS_ERROR;
{
value.Add(new M155InputIsNeededModel()
{
Process = processId,
IsNeeded = bits[processId - 1],
Message = "",
Type = M155_TYPE.REAL,
Buttons = new Dictionary<byte, string>()
});
return NO_ERROR;
}
byte i = 1;
@@ -1567,7 +1569,9 @@ namespace CMS_CORE_Library.Fanuc
if (nReturn != 0)
return GetNcError(nReturn);
name = new string(partPrg.name).Replace("\0", string.Empty);
name = new string(tmp).Replace("\0", string.Empty);
name = Path.GetFileName(name);
return NO_ERROR;
}
@@ -1671,13 +1675,16 @@ namespace CMS_CORE_Library.Fanuc
//uint lineL = 1;
//uint txtL = 50;
//short nReturn = Focas1.cnc_rdprogline2(nLibHandle[(int)processId - 1], 0, 1, line, ref lineL, ref txtL);
ushort length = 200;
char[] text = new char[201];
short nReturn = Focas1.cnc_rdexecprog(nLibHandle[(int)processId - 1], ref length, out short block, text);
if (nReturn != 0)
return GetNcError(nReturn);
ActiveProgramDataModel activeProgData = new ActiveProgramDataModel();
CmsError cmsError = FILES_RActiveProgramData((int)processId, ref activeProgData);
if (cmsError.IsError())
return cmsError;
line = activeProgData.IsoLines.FirstOrDefault();
string lines = new string(text.Take(length).ToArray());
if(!string.IsNullOrEmpty(lines))
line = lines.Split('\n').FirstOrDefault();
return NO_ERROR;
}
@@ -1744,25 +1751,27 @@ namespace CMS_CORE_Library.Fanuc
byte rapid= 0, work = 0;
bool jogIsActive = false;
// read if jog is active
cmsError = MEM_RWBoolean(R, 0, MEMORY_TYPE.Fanuc_F, 3, 2, ref jogIsActive);
if (cmsError.IsError())
return cmsError;
// Choose & read work override
int mem = jogIsActive ? (processId - 1) * 1000 + 10 : (processId - 1) * 1000 + 12;
//// read if jog is active
//cmsError = MEM_RWBoolean(R, 0, MEMORY_TYPE.Fanuc_F, 3, 2, ref jogIsActive);
//if (cmsError.IsError())
// return cmsError;
// Choose & read work override // jogIsActive ? (processId - 1) * 1000 + 10 :
int mem = (processId - 1) * 1000 + 12;
cmsError = MEM_RWByte(R, 0, MEMORY_TYPE.Fanuc_G, mem, 0, ref work);
if (cmsError.IsError())
return cmsError;
if (!jogIsActive)
work = (byte)((work - 256) + 1);
work = (byte)(((work - 256) + 1)* -1 );
// Read rapid
cmsError = MEM_RWByte(R, 0, MEMORY_TYPE.Fanuc_G, 96, 0, ref rapid);
if (cmsError.IsError())
return cmsError;
rapid = (byte)(((rapid - 256) + 1) * -1);
processData = new SelectedProcessData()
{
ActiveOffsetId = offsetId,
@@ -3183,6 +3192,45 @@ namespace CMS_CORE_Library.Fanuc
return NO_ERROR;
}
public override CmsError FILES_WUploadCustomMainProgramAndActivate(int processId, string customPartProgramContent, ref ActiveProgramDataModel activeData)
{
// Check if the NC is connected
CmsError cmsError = CheckConnection();
if (cmsError.IsError())
return cmsError;
try
{
string tmpM198FilePath = string.Format(NC_SUPPORT_FILE_PATH + CUSTOM_MAIN_PROGRAM, processId);
string fileName = string.Format(M198_FILE_NAME, processId);
string updatedProgramContent = customPartProgramContent;
Regex regex = new Regex(@"\<(.*?)\>");
Match m = regex.Match(customPartProgramContent);
if (m.Success)
{
updatedProgramContent = regex.Replace(customPartProgramContent, "<" + fileName + ">");
}
// Create new file
cmsError = WritePPInCmsFolder(NC_SUPPORT_FILE_PATH, updatedProgramContent);
if (cmsError.IsError())
return WRONG_CMS_PP_ERROR;
// Select main data
short nReturn = Focas1.cnc_pdf_slctmain(nLibHandle[processId - 1], tmpM198FilePath);
if (nReturn != 0)
return GetNcError(nReturn);
}
catch (Exception ex)
{
return ManageException(ex);
}
return NO_ERROR;
}
private string FormatPathForNc(string path, string drive)
{
if (path == "\\\\")
@@ -4496,7 +4544,7 @@ namespace CMS_CORE_Library.Fanuc
case SCREEN_PAGE.Fanuc_Message: return Focas1.page_code.ALARM;
case SCREEN_PAGE.Fanuc_System: return Focas1.page_code.PARAM;
case SCREEN_PAGE.Fanuc_Graph: return Focas1.page_code.GRAPH;
case SCREEN_PAGE.Fanuc_MGI: return Focas1.page_code.TMAC1;
case SCREEN_PAGE.Fanuc_MGI: return Focas1.page_code.C_EXECUTOR_C;
case SCREEN_PAGE.Fanuc_Custom2: return Focas1.page_code.TMAC2;
default: return 0;
}
+2 -1
View File
@@ -11879,7 +11879,8 @@ internal class Focas1
C_EXECUTOR_4_G = 0X3505,
C_EXECUTOR_5_G = 0X3605,
//CUSTOM
//CUSTOM
TMAC = 0X0006,
TMAC1 = 0X0106,
TMAC2 = 0X0206,
TMAC3 = 0X0306,
+2 -1
View File
@@ -60,6 +60,7 @@
PROGRAM_IS_SELECTED = 25,
SELECTED_PROCESS = 26,
OSAI_TT_FOLDER_NOT_FOUND = 27,
OPTION_NOT_CONSISTENT = 28
OPTION_NOT_CONSISTENT = 28,
WRONG_CMS_PP = 29
}
}
@@ -197,6 +197,7 @@ namespace CMS_CORE_Library.Models
public static CmsError SELECTED_PROCESS_ERROR = new CmsError(CMS_ERROR_CODES.SELECTED_PROCESS, "error_selected_process_not_found");
public static CmsError OSAI_TT_FOLDER_NOT_FOUND_ERROR = new CmsError(CMS_ERROR_CODES.OSAI_TT_FOLDER_NOT_FOUND, "osai_tt_folder_not_found_error");
public static CmsError OPTION_NOT_CONSISTENT_ERROR = new CmsError(CMS_ERROR_CODES.OPTION_NOT_CONSISTENT, "error_option_not_consistent");
public static CmsError WRONG_CMS_PP_ERROR = new CmsError(CMS_ERROR_CODES.WRONG_CMS_PP, "error_wrong_custom_part_program");
#endregion Cms Errors Codes
+6 -2
View File
@@ -1330,6 +1330,8 @@ namespace CMS_CORE_Library
public abstract CmsError FILES_WCleanUploadFolder();
public abstract CmsError FILES_WUploadCustomMainProgramAndActivate(int processId, string customPartProgramContent, ref ActiveProgramDataModel activeData);
#endregion File Management (To override)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1821,6 +1823,8 @@ namespace CMS_CORE_Library
internal const string DEMO_MEMTYPE = "Demo_";
internal const string UNDEFINED_MEMTYPE = "Null";
internal const string CUSTOM_MAIN_PROGRAM = "ACTIVE_LOADER_{0}";
// min-time to read static data (Cached values)
internal const ushort NC_MIN_SEC_READ_STATIC_DATA = 10;
@@ -1862,8 +1866,8 @@ namespace CMS_CORE_Library
Fanuc_Offset = 202,
Fanuc_System = 203,
Fanuc_Message = 204,
Fanuc_Graph = 205,
Fanuc_MGI = 206,
Fanuc_MGI = 205,
Fanuc_Graph = 206,
Fanuc_Custom2 = 207,
}
+136 -15
View File
@@ -971,7 +971,18 @@ namespace CMS_CORE_Library.Osai
// Parse line & get parameters
parameters = ExtractM155ParametersFromNcCodeLine(actualLine);
if (parameters.Count() == 0)
return INCORRECT_PARAMETERS_ERROR;
{
value.Add(new M155InputIsNeededModel()
{
Process = processId,
IsNeeded = bits[processId - 1],
Message = "",
Type = M155_TYPE.REAL,
Buttons = new Dictionary<byte, string>()
});
return NO_ERROR;
}
byte i = 1;
@@ -1161,8 +1172,27 @@ namespace CMS_CORE_Library.Osai
public override CmsError PLC_WScadaValue(string memIndex, SCADA_MEM_TYPE memType, object value)
{
string[] index = memIndex.Split('.');
string[] index = memIndex.Split('_');
// Split memory string
CmsError cmsError = NO_ERROR;
MEMORY_TYPE type = MEMORY_TYPE.Osai_MW;
if (index.Count() != 2)
return INCORRECT_PARAMETERS_ERROR;
// Choose memory type
switch (index[0].ToUpper())
{
case "GW": type = MEMORY_TYPE.Osai_GW; break;
case "MW": type = MEMORY_TYPE.Osai_MW; break;
case "M": type = MEMORY_TYPE.Osai_MW; break;
case "MD": type = MEMORY_TYPE.Osai_MD; break;
case "GD": type = MEMORY_TYPE.Osai_GD; break;
};
index = index[1].Split('.');
if (index.Count() == 0)
return INCORRECT_PARAMETERS_ERROR;
else if (index.Count() == 1)
@@ -1170,31 +1200,29 @@ namespace CMS_CORE_Library.Osai
if (memType == SCADA_MEM_TYPE.INT)
{
// write INT
int val = 0;
cmsError = MEM_RWInteger(W, 0, MEMORY_TYPE.Osai_MW, Convert.ToInt32(index[0]), ref val);
int val = Convert.ToInt32(value);
cmsError = MEM_RWInteger(W, 0, type, Convert.ToInt32(index[0]), ref val);
}
else if (memType == SCADA_MEM_TYPE.WORD)
{ // write WORD
ushort val = 0;
cmsError = MEM_RWWord(W, 0, MEMORY_TYPE.Osai_MW, Convert.ToInt32(index[0]), ref val);
ushort val = Convert.ToUInt16(value);
cmsError = MEM_RWWord(W, 0, type, Convert.ToInt32(index[0]), ref val);
}
else if (memType == SCADA_MEM_TYPE.REAL)
{ // write DOUBLE
double val = 0;
double val = Convert.ToDouble(value);
cmsError = MEM_RWDouble(W, 0, MEMORY_TYPE.Osai_GD, Convert.ToInt32(index[0]), ref val);
value = val;
}
else
{ // write byte
byte val = 0;
cmsError = MEM_RWByte(W, 0, MEMORY_TYPE.Osai_MW, Convert.ToInt32(index[0]), 0, ref val);
byte val = Convert.ToByte(value);
cmsError = MEM_RWByte(W, 0, type, Convert.ToInt32(index[0]), 0, ref val);
}
}
else if (index.Count() == 2 && memType == SCADA_MEM_TYPE.BOOL)
{ // write BOOL
bool val = false;
cmsError = MEM_RWBoolean(W, 0, MEMORY_TYPE.Osai_MW, Convert.ToInt32(index[0]), Convert.ToInt32(index[1]), ref val);
bool val = Convert.ToBoolean(value);
cmsError = MEM_RWBoolean(W, 0, type, Convert.ToInt32(index[0]), Convert.ToInt32(index[1]), ref val);
}
return cmsError;
@@ -1202,11 +1230,68 @@ namespace CMS_CORE_Library.Osai
public override CmsError PLC_WAssistedToolingCmd(ushort toolId, ushort familyId, ushort shankId, ushort magazineId, ushort positionId, ASSISTED_TOOLING_ACTION action)
{
return NO_ERROR;
List<ushort> values = new List<ushort>()
{
toolId,
magazineId,
positionId,
familyId,
shankId
};
// Write data
CmsError cmsError = MEM_RWWordList(W, 1, ASSISTED_TOOLING_DATA.MemType, ASSISTED_TOOLING_DATA.Address, 3, ref values);
if (cmsError.IsError())
return cmsError;
// Write action
byte val = (byte)action;
cmsError = MEM_RWByte(W, 1, ASSISTED_TOOLING_DATA.MemType, ASSISTED_TOOLING_DATA.Address + (values.Count() * 2), 0, ref val);
if (cmsError.IsError())
return cmsError;
// Write strobe to start procedure
return PLC_WStrobe(PLC_ASSISTED_TOOLING_STROBE, HMI_ASSISTED_TOOLING_STROBE, (uint)HMI_ASSISTED_TOOLING_STROBE.SubAddress + 1);
}
public override CmsError PLC_RAssistedToolingData(ref AssistedToolingModel data)
{
byte procFinalValue = 0;
// Read procedure final value
CmsError cmsError = MEM_RWByte(R, 0, PLC_ASSISTED_TOOLING_STROBE.MemType, PLC_ASSISTED_TOOLING_STROBE.Address, 0, ref procFinalValue);
if (cmsError.IsError())
return cmsError;
// Bit:
// 0: ack 1: strobe 2: unload 3: load
// Check if the procedure is finished
if (GetBitValue(procFinalValue, 1))
{
List<ushort> values = new List<ushort>();
// Read actual data
cmsError = MEM_RWWordList(R, 1, ASSISTED_TOOLING_DATA.MemType, ASSISTED_TOOLING_DATA.Address, 3, ref values);
if (cmsError.IsError())
return cmsError;
// Set action
ASSISTED_TOOLING_ACTION action = ASSISTED_TOOLING_ACTION.NONE;
if (GetBitValue(procFinalValue, 2))
action = ASSISTED_TOOLING_ACTION.UNLOAD;
if (GetBitValue(procFinalValue, 3))
action = ASSISTED_TOOLING_ACTION.EXCHANGE;
data = new AssistedToolingModel()
{
IsActive = true,
ToolId = values[0],
MagazineId = values[1],
PositionId = values[2],
Action = action
};
}
return NO_ERROR;
}
@@ -2865,6 +2950,10 @@ namespace CMS_CORE_Library.Osai
return GetNCError(errorClass, errorNum);
// Read file content
if (size >= 65536)
{
size = 65534;
}
// nReturn = OpenNC.GetFile(filePath, ref size, out fileContentContent, out errorClass, out errorNum);
nReturn = OpenNC.GetBinaryFile(filePath, size, out byte[] data, out errorClass, out errorNum);
// Convert byte[] into string
@@ -2873,7 +2962,7 @@ namespace CMS_CORE_Library.Osai
//If there's an error launch exception
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
return GetNCError(errorClass, errorNum);
}
}
catch (Exception ex)
{
return ManageException(ex);
@@ -3031,6 +3120,32 @@ namespace CMS_CORE_Library.Osai
return NO_ERROR;
}
public override CmsError FILES_WUploadCustomMainProgramAndActivate(int processId, string customPartProgramContent, ref ActiveProgramDataModel activeData)
{
string customMainName = string.Format(CUSTOM_MAIN_PROGRAM, processId);
// Open file
string newFilePath = NC_PROGRAM_UPLOAD_PATH + customMainName;
try
{
// Create directory
ushort nReturn = OpenNC.LogFSCreateDir(NC_PROGRAM_UPLOAD_PATH, out uint errClass, out uint errNum);
if (errClass != 0 || errNum != 0 || nReturn == 0)
return GetNCError(errClass, errNum);
// Crate new file file on NC
CmsError cmsError = FILES_WProgram(newFilePath, customPartProgramContent);
if (cmsError.IsError())
return cmsError;
// Activate custom file
return FILES_WSetActiveProgram(processId, newFilePath, ref activeData);
}
catch (Exception ex)
{
return ManageException(ex);
}
}
#endregion File Management
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -4744,7 +4859,13 @@ namespace CMS_CORE_Library.Osai
internal static MEMORY_CELL EXP_CANDY_MEM = new MEMORY_CELL(MEMORY_TYPE.Osai_GW, 302, 1);
internal static MEMORY_CELL SELF_ADAPTIVE_PATH = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 3472, 4);
// Assisted tooling
internal static MEMORY_CELL ASSISTED_TOOLING_DATA = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 4512, 7);
internal static MEMORY_CELL HMI_ASSISTED_TOOLING_STROBE = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 4518, 0, 1);
internal static MEMORY_CELL HMI_ASSISTED_TOOLING_ACK = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 4518, 1, 1);
internal static MEMORY_CELL PLC_ASSISTED_TOOLING_ACK = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 4519, 1, 1);
internal static MEMORY_CELL PLC_ASSISTED_TOOLING_STROBE = new MEMORY_CELL(MEMORY_TYPE.Fanuc_R, 4519, 1, 1);
}
#endregion Memory addresses
+69 -13
View File
@@ -1195,7 +1195,7 @@ namespace CMS_CORE_Library.Siemens
return NO_ERROR;
}
public override CmsError PLC_ROperatorInputIsNeeded(ref List<M155InputIsNeededModel> data)
public override CmsError PLC_ROperatorInputIsNeeded(ref List<M155InputIsNeededModel> value)
{
byte val = 0;
// Read memory
@@ -1221,7 +1221,18 @@ namespace CMS_CORE_Library.Siemens
// Parse line & get parameters
parameters = ExtractM155ParametersFromNcCodeLine(actualLine);
if (parameters.Count() == 0)
return INCORRECT_PARAMETERS_ERROR;
{
value.Add(new M155InputIsNeededModel()
{
Process = processId,
IsNeeded = bits[processId - 1],
Message = "",
Type = M155_TYPE.REAL,
Buttons = new Dictionary<byte, string>()
});
return NO_ERROR;
}
byte i = 1;
if (parameters[0].ToUpper().Trim() == "SHOWVAL")
@@ -1241,7 +1252,7 @@ namespace CMS_CORE_Library.Siemens
dataSvc.Read(item);
data.Add(new M155InputIsNeededModel()
value.Add(new M155InputIsNeededModel()
{
Process = processId,
IsNeeded = bits[processId - 1],
@@ -1262,7 +1273,7 @@ namespace CMS_CORE_Library.Siemens
// Set button with -> id = 1..5 -> value = parameter value
Dictionary<byte, string> buttons = parameters.Skip(1)?.ToDictionary(x => i++, x => x);
data.Add(new M155InputIsNeededModel()
value.Add(new M155InputIsNeededModel()
{
Process = processId,
IsNeeded = bit,
@@ -1945,10 +1956,13 @@ namespace CMS_CORE_Library.Siemens
try
{
Item[] items = new Item[2]
Item[] items = new Item[5]
{
new Item { Path = "/Channel/State/actDNumber[u" + processId + ",1]" }, // OffsetId
new Item { Path = "/Channel/State/actFrameIndex[u" + processId + "]" }, // Origin
new Item { Path = "/Channel/State/actTNumber[u" + processId + ",1]" }, // ActiveToolId
new Item { Path = "/Channel/State/actDNumber[u" + processId + ",1]" }, // OffsetId
new Item { Path = "/Channel/State/actFrameIndex[u" + processId + "]" }, // Origin
new Item { Path = "DB21.DBB4"}, // Work override
new Item { Path = "DB21.DBB5"} // Rapid override
};
// Read data
@@ -1956,20 +1970,46 @@ namespace CMS_CORE_Library.Siemens
dataSvc.Read(items);
short origin = 0;
// Convert SIEMENS enumerable to G(N)
if (Convert.ToInt16(items[1].Value) > 0)
// Convert SIEMENS enumerable to G(N) format es: G54
if (Convert.ToInt16(items[2].Value) > 0)
{
if (Convert.ToInt16(items[1].Value) >= 5)
origin = (short)(Convert.ToInt16(items[1].Value) + 500);
origin = (short)(Convert.ToInt16(items[2].Value) + 500);
else
origin = (short)(Convert.ToInt16(items[1].Value) + 53);
origin = (short)(Convert.ToInt16(items[2].Value) + 53);
}
OffsetModel offset = new OffsetModel();
if (Convert.ToInt16(items[1].Value) != 0)
{
// Find edge
EdgeModel edge = ToolTableData.Where(x => x.Id == Convert.ToInt16(items[0].Value))
.FirstOrDefault()
.EdgesData.Where(x => x.Id == Convert.ToInt16(items[1].Value))
.FirstOrDefault();
// Convert edgeModel to offsetModel
offset = new OffsetModel()
{
Id = (short)edge.Id,
Length = edge.EdgeAdditionalParams["lenght"],
Radius = edge.EdgeAdditionalParams["radius"],
WearLength = edge.EdgeAdditionalParams["wearLenght"],
WearRadius = edge.EdgeAdditionalParams["wearRadius"],
RealLength = edge.EdgeAdditionalParams["lenght"] + edge.EdgeAdditionalParams["wearLenght"],
RealRadius = edge.EdgeAdditionalParams["radius"] + edge.EdgeAdditionalParams["wearRadius"]
};
}
// Creata return model
processData = new SelectedProcessData
{
ActiveOffsetId = Convert.ToInt16(items[0].Value),
ActiveOffsetId = Convert.ToInt16(items[1].Value),
Origin = origin,
ProcessMessage = ""
ProcessMessage = "",
WorkOverride = Convert.ToByte(items[3].Value),
RapidOverride = Convert.ToByte(items[4].Value),
OffsetData = offset
};
}
catch (Exception ex)
@@ -3152,6 +3192,22 @@ namespace CMS_CORE_Library.Siemens
return FUNCTION_NOT_ALLOWED_ERROR;
}
public override CmsError FILES_WUploadCustomMainProgramAndActivate(int processId, string customPartProgramContent, ref ActiveProgramDataModel activeData)
{
string customMainName = string.Format(CUSTOM_MAIN_PROGRAM, processId);
string newFilePath = "";
CmsError cmsError = FILES_UploadPartProgram(customPartProgramContent, customMainName, ref newFilePath);
if (cmsError.IsError())
return cmsError;
cmsError = FILES_WSetActiveProgram(processId, newFilePath, ref activeData);
if (cmsError.IsError())
return cmsError;
return NO_ERROR;
}
private IEnumerable<string> GetLinesFromString(string text)
{
string line;
+4
View File
@@ -286,6 +286,10 @@ namespace CMS_CORE_Library.Utils
returnVal = tmpString.Split(',');
}
else
{
returnVal = new string[0];
}
return returnVal;
}