Added siemens tool mounted data

Fix fanuc getFilelist
This commit is contained in:
Lucio Maranta
2019-09-24 14:29:45 +00:00
parent a7bc67fb6e
commit b52047213c
4 changed files with 51 additions and 10 deletions
+2 -2
View File
@@ -76,7 +76,7 @@ namespace CMS_CORE_Application
N = SetNcByType();
CmsError cmsError = N.NC_Connect();
MessageBox.Show(cmsError.localizationKey);
cmsError = N.NC_RModelName(ref ModelName);
List<uint> val = new List<uint>();
@@ -173,7 +173,7 @@ namespace CMS_CORE_Application
TXTPPLines.Text = string.Join(Environment.NewLine, Lines);
Connect.Enabled = true;
Disconnect.Enabled = false;
// Disconnect.Enabled = false;
});
}
}
+14 -6
View File
@@ -3021,7 +3021,7 @@ namespace CMS_CORE_Library.Fanuc
funcInput.size_kind = 1;
funcInput.dummy = 0;
maxDir = dataNum.dir_num;
maxDir =(short)(dataNum.file_num + dataNum.dir_num);
for (short i = 0; i < dataNum.file_num + dataNum.dir_num; i++)
{
funcInput.req_num = i; // Update file index
@@ -3034,10 +3034,10 @@ namespace CMS_CORE_Library.Fanuc
// Add directory to list
files.Add(new PreviewFileModel()
{
AbsolutePath = FormatPathForHighLevel(absolutePath + fileData.d_f, true),
AbsolutePath = FormatAbsolutePathForHighLevel(absolutePath + fileData.d_f, true),
IsDirectory = true,
Name = fileData.d_f,
Path = path + fileData.d_f
Path = FormatPathFroHighLevel(path, fileData.d_f)
});
}
else
@@ -3045,10 +3045,10 @@ namespace CMS_CORE_Library.Fanuc
// Add file to list
files.Add(new PreviewFileModel()
{
AbsolutePath = FormatPathForHighLevel(absolutePath + fileData.d_f, false),
AbsolutePath = FormatAbsolutePathForHighLevel(absolutePath + fileData.d_f, false),
IsDirectory = false,
Name = fileData.d_f,
Path = path + fileData.d_f
Path = FormatPathFroHighLevel(path, fileData.d_f)
});
}
}
@@ -3416,7 +3416,7 @@ namespace CMS_CORE_Library.Fanuc
return path;
}
private string FormatPathForHighLevel(string path, bool isFolder)
private string FormatAbsolutePathForHighLevel(string path, bool isFolder)
{
string tmp = path.Replace('\\', '/');
@@ -3426,6 +3426,14 @@ namespace CMS_CORE_Library.Fanuc
return tmp;
}
private string FormatPathFroHighLevel(string path, string fileName)
{
if (path == "\\\\")
return path + fileName;
return path + "/" + fileName;
}
#endregion File Management
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -344,6 +344,7 @@ namespace CMS_CORE_Library.Models
public int ChildId;
public bool Disabled;
public bool Measured;
public bool Broken;
public double MaxLoad;
public double MaxSpeed;
public double ResidualLife;
+34 -2
View File
@@ -1063,8 +1063,39 @@ namespace CMS_CORE_Library.Siemens
// Head address = posizion * size of single head in memory
var headOffset = i * headsByte;
short toolId = SwapShortEndianFormat(BitConverter.ToInt16(readValues.ToArray(), headOffset + 4));
double residualLife = 0;
// Find tool
var tool = ToolTableData.Where(x => x.Id == toolId).FirstOrDefault();
// Check if process is selected
if (readValues[headOffset] != 0)
{
try
{
// Read selected edge
Item activeEdgeId = new Item { Path = "/Channel/State/actDNumber[u" + readValues[headOffset] + ",1]" }; // OffsetId
DataSvc dataSvc = new DataSvc();
dataSvc.Read(activeEdgeId);
if (Convert.ToInt32(activeEdgeId.Value) != 0)
{
// Find edge
var edge = tool.EdgesData
.Where(x => x.Id == Convert.ToInt32(activeEdgeId.Value))
.FirstOrDefault();
// Set residual life
if (edge != null)
residualLife = edge.ResidualLife;
}
}
catch(Exception ex)
{
return ManageException(ex);
}
}
heads.Add(new HeadDataModel()
{
Id = (uint)i + 1,
@@ -1083,11 +1114,12 @@ namespace CMS_CORE_Library.Siemens
{
ChildId = tool == null ? 0 : tool.ChildId,
ToolName = tool == null ? "" : tool.FamilyName,
Disabled = tool == null ? false : !tool.IsEnabled,
Disabled = tool == null ? false : !tool.IsActive,
Measured = tool == null ? false : tool.IsMeasured,
Broken = tool == null ? false : tool.IsInhibited,
MaxLoad = tool == null ? 0 : tool.Load,
MaxSpeed = tool == null ? 0 : tool.MaxSpeed,
ResidualLife = tool.EdgesData.FirstOrDefault().ResidualLife
ResidualLife = residualLife
}
});
}