Added file info / activate info
This commit is contained in:
@@ -872,7 +872,7 @@ namespace CMS_CORE.Demo
|
||||
{
|
||||
processData.Id = procNumber;
|
||||
// Read part program name
|
||||
CmsError cmsError = PROC_RPPName(procNumber, ref processData.PartProgramName);
|
||||
CmsError cmsError = PROC_RSelectedPPName(procNumber, ref processData.PartProgramName);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
@@ -2768,7 +2768,7 @@ namespace CMS_CORE.Demo
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError PROC_RPPName(ushort ProcNumber, ref string Name)
|
||||
public override CmsError PROC_RSelectedPPName(ushort ProcNumber, ref string Name)
|
||||
{
|
||||
// Check if the NC Demo is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
|
||||
@@ -546,7 +546,7 @@ namespace CMS_CORE.Fanuc
|
||||
}
|
||||
|
||||
//Get Active PP Name
|
||||
public override CmsError PROC_RPPName(ushort ProcNumber, ref string Name)
|
||||
public override CmsError PROC_RSelectedPPName(ushort ProcNumber, ref string Name)
|
||||
{
|
||||
//Check if the NC is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
|
||||
@@ -691,7 +691,7 @@ namespace CMS_CORE
|
||||
* <param name="Name">Reference of a String Variables where data will be saved</param>
|
||||
* */
|
||||
|
||||
public abstract CmsError PROC_RPPName(ushort procNumber, ref String Name);
|
||||
public abstract CmsError PROC_RSelectedPPName(ushort procNumber, ref String Name);
|
||||
|
||||
/**
|
||||
*<summary>
|
||||
|
||||
@@ -1051,7 +1051,7 @@ namespace CMS_CORE.Osai
|
||||
}
|
||||
|
||||
//Get Active PP Name
|
||||
public override CmsError PROC_RPPName(ushort ProcNumber, ref string Name)
|
||||
public override CmsError PROC_RSelectedPPName(ushort ProcNumber, ref string Name)
|
||||
{
|
||||
//Check if the NC is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
@@ -1088,7 +1088,7 @@ namespace CMS_CORE.Osai
|
||||
{
|
||||
processData.Id = procNumber;
|
||||
// Read part program name
|
||||
CmsError cmsError = PROC_RPPName(procNumber, ref processData.PartProgramName);
|
||||
CmsError cmsError = PROC_RSelectedPPName(procNumber, ref processData.PartProgramName);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
|
||||
@@ -1050,14 +1050,14 @@ namespace CMS_CORE.Siemens
|
||||
}
|
||||
|
||||
//Get PP Name
|
||||
public override CmsError PROC_RPPName(ushort ProcNumber, ref string Name)
|
||||
public override CmsError PROC_RSelectedPPName(ushort ProcNumber, ref string Name)
|
||||
{
|
||||
//Check if the NC is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
String RetString;
|
||||
string RetString;
|
||||
int LastUnderscore;
|
||||
|
||||
//Try to get information
|
||||
@@ -1075,7 +1075,7 @@ namespace CMS_CORE.Siemens
|
||||
Data.Read(ReadItem);
|
||||
|
||||
//Elaborate String
|
||||
RetString = ((String)ReadItem.Value);
|
||||
RetString = ((string)ReadItem.Value);
|
||||
RetString = RetString.Replace("_N_", "");
|
||||
LastUnderscore = RetString.LastIndexOf("_");
|
||||
if (LastUnderscore >= 0)
|
||||
@@ -1108,7 +1108,7 @@ namespace CMS_CORE.Siemens
|
||||
{
|
||||
processData.Id = procNumber;
|
||||
// Read part program name
|
||||
CmsError cmsError = PROC_RPPName(procNumber, ref processData.PartProgramName);
|
||||
CmsError cmsError = PROC_RSelectedPPName(procNumber, ref processData.PartProgramName);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
@@ -1207,7 +1207,7 @@ namespace CMS_CORE.Siemens
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
public override CmsError AXES_RMachinePosition(ushort channel, ref Dictionary<string, double> axes)
|
||||
{
|
||||
try
|
||||
@@ -1235,7 +1235,7 @@ namespace CMS_CORE.Siemens
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
public override CmsError AXES_RFollowingError(ushort channel, ref Dictionary<string, double> axes)
|
||||
{
|
||||
try
|
||||
@@ -1249,7 +1249,7 @@ namespace CMS_CORE.Siemens
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
public override CmsError AXES_RDistanceToGo(ushort channel, ref Dictionary<string, double> axes)
|
||||
{
|
||||
try
|
||||
@@ -1268,7 +1268,7 @@ namespace CMS_CORE.Siemens
|
||||
Dictionary<string, double> axes = new Dictionary<string, double>();
|
||||
List<AxisModel> axesConf = new List<AxisModel>();
|
||||
CmsError cmsError = AXES_RAxesNames(channel, ref axesConf);
|
||||
|
||||
|
||||
foreach (var conf in axesConf)
|
||||
{
|
||||
DataSvc dataSvc = new DataSvc();
|
||||
@@ -1845,6 +1845,7 @@ namespace CMS_CORE.Siemens
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region File Management
|
||||
|
||||
public override CmsError FILES_RGetFileList(string path, ref List<PreviewFileModel> files)
|
||||
{
|
||||
try
|
||||
@@ -1862,7 +1863,7 @@ namespace CMS_CORE.Siemens
|
||||
{
|
||||
AbsolutePath = path,
|
||||
IsDirectory = element.IsDirNode,
|
||||
Name = element.LogicalPath
|
||||
Name = element.Name
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1879,24 +1880,17 @@ namespace CMS_CORE.Siemens
|
||||
try
|
||||
{
|
||||
FileSvc fileSvc = new FileSvc();
|
||||
var splittedPath = path.Split('/');
|
||||
var filePath = String.Join(@"/", splittedPath.Take(splittedPath.Count() - 1));
|
||||
var fileName = splittedPath[splittedPath.Count() - 1];
|
||||
|
||||
// Preapare folder node
|
||||
Node folderNode = new Node(BASE_FILE_PATH + filePath);
|
||||
Node fileNode = new Node(BASE_FILE_PATH + path);
|
||||
|
||||
// Read files in the folder
|
||||
Node[] nodeArray = fileSvc.List(folderNode);
|
||||
fileInfo = nodeArray.Where(x => x.Name == fileName).Select(x =>
|
||||
new InfoFile()
|
||||
fileInfo = new InfoFile()
|
||||
{
|
||||
CreationDate = nodeArray[0].Attributes.LastAccess,
|
||||
LastModDate = nodeArray[0].Attributes.LastAccess,
|
||||
Name = nodeArray[0].Name,
|
||||
Content = new List<string>() { nodeArray[0].LogicalPath },
|
||||
PreviewBase64 = nodeArray[0].RealPath
|
||||
}).FirstOrDefault();
|
||||
CreationDate = fileNode.Attributes.LastAccess,
|
||||
LastModDate = fileNode.Attributes.LastAccess,
|
||||
Name = fileNode.Name,
|
||||
Content = new List<string>() { fileNode.LogicalPath }
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -1908,21 +1902,81 @@ namespace CMS_CORE.Siemens
|
||||
|
||||
public override CmsError FILES_WSetActiveProgram(int processId, string filePath, ref ActiveProgramDataModel data)
|
||||
{
|
||||
return NO_ERROR;
|
||||
try
|
||||
{
|
||||
FileSvc fileSvc = new FileSvc();
|
||||
|
||||
// Preapare folder node
|
||||
Node selectedNode = new Node(BASE_FILE_PATH + filePath);
|
||||
|
||||
fileSvc.Select(selectedNode, processId);
|
||||
|
||||
return FILES_RActiveProgramData(processId, ref data);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ManageException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public override CmsError FILES_WDeactivateProgram(int processId)
|
||||
{
|
||||
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError FILES_RActiveProgramData(int processId, ref ActiveProgramDataModel data)
|
||||
{
|
||||
try
|
||||
{
|
||||
int lastUnderscore;
|
||||
|
||||
//Setup variables
|
||||
DataSvc Data = new DataSvc
|
||||
{
|
||||
Timeout = TimeoutConn,
|
||||
PriorityFlag = SlPriority.highPriority
|
||||
};
|
||||
|
||||
Item readItem = new Item("/Channel/ProgramInfo/actPartProgram" + "[u" + processId + "]");
|
||||
|
||||
//Read Data
|
||||
Data.Read(readItem);
|
||||
|
||||
//Elaborate String
|
||||
string trimString = ((string)readItem.Value);
|
||||
trimString = trimString.Replace("_N_", "");
|
||||
lastUnderscore = trimString.LastIndexOf("_");
|
||||
if (lastUnderscore >= 0)
|
||||
trimString = trimString.Remove(lastUnderscore, 1).Insert(lastUnderscore, ".");
|
||||
|
||||
data = new ActiveProgramDataModel()
|
||||
{
|
||||
Path = "",
|
||||
IsoLines = GetLinesFromString(trimString).ToList(),
|
||||
TimeLeft = new DateTime()
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ManageException(ex);
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
private IEnumerable<string> GetLinesFromString(string text)
|
||||
{
|
||||
string line;
|
||||
using (StringReader reader = new StringReader(text))
|
||||
{
|
||||
while ((line = reader.ReadLine()) != null)
|
||||
{
|
||||
yield return line;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override CmsError FILES_CopyProgram(string partProgramPath, string newPartProgramPath, bool failIfExist)
|
||||
{
|
||||
//Check if the NC is Connected
|
||||
@@ -2132,7 +2186,6 @@ namespace CMS_CORE.Siemens
|
||||
PiSvc pi = new PiSvc(piArgs);
|
||||
pi.Start();
|
||||
|
||||
|
||||
// Get new tool id
|
||||
tool.Id = GetLastToolId();
|
||||
|
||||
@@ -2728,7 +2781,7 @@ namespace CMS_CORE.Siemens
|
||||
|
||||
// Get position type
|
||||
int newToolPositionType = tool is SiemensToolModel ?
|
||||
(tool as SiemensToolModel).MagazinePositionType :
|
||||
(tool as SiemensToolModel).MagazinePositionType :
|
||||
(tool as ShankModel).MagazinePositionType;
|
||||
|
||||
// Check type
|
||||
@@ -3039,6 +3092,7 @@ namespace CMS_CORE.Siemens
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region Nc Tool Manager
|
||||
|
||||
public override CmsError TOOLS_RMagazineConfig(ref List<NcMagazineConfigModel> config)
|
||||
{
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
|
||||
Reference in New Issue
Block a user