Osai toolManager
This commit is contained in:
@@ -703,8 +703,6 @@ namespace CMS_CORE_Library
|
||||
{
|
||||
public ushort Id { get; set; }
|
||||
|
||||
public byte Type { get; set; }
|
||||
|
||||
public ushort OffsetLength { get; set; }
|
||||
|
||||
public ushort ResidualLife { get; set; }
|
||||
@@ -774,6 +772,66 @@ namespace CMS_CORE_Library
|
||||
public ushort ReviveDelta { get; set; }
|
||||
}
|
||||
|
||||
internal class NcFamilyFileModel
|
||||
{
|
||||
public ushort Id { get; set; }
|
||||
public byte Type { get; set; }
|
||||
public byte TcpTable { get; set; }
|
||||
public byte Gamma { get; set; }
|
||||
public byte RotationType { get; set; }
|
||||
public byte CoolingByte { get; set; }
|
||||
public ushort MaxSpeed { get; set; }
|
||||
public byte MaxLoad { get; set; }
|
||||
public byte MinLoadPctAutoload { get; set; }
|
||||
public byte MaxLoadPctAutoload { get; set; }
|
||||
public byte DynamicCompensation { get; set; }
|
||||
public byte MinLoadDynamicCompensation { get; set; }
|
||||
public byte MaxLoadDynamicCompensation { get; set; }
|
||||
public byte LifeType { get; set; }
|
||||
public uint NominalLife { get; set; }
|
||||
public ushort ReviveDelta { get; set; }
|
||||
|
||||
public static explicit operator NcFamilyFileModel(NcFamilyModel obj)
|
||||
{
|
||||
return new NcFamilyFileModel()
|
||||
{
|
||||
Id = obj.Id,
|
||||
Type = obj.Type,
|
||||
TcpTable = obj.TcpTable,
|
||||
Gamma = obj.Gamma,
|
||||
RotationType = obj.RotationType,
|
||||
CoolingByte = obj.CoolingByte,
|
||||
MaxSpeed = obj.MaxSpeed,
|
||||
MaxLoad = obj.MaxLoad,
|
||||
MinLoadDynamicCompensation = obj.MinLoadDynamicCompensation,
|
||||
MaxLoadDynamicCompensation = obj.MaxLoadDynamicCompensation,
|
||||
MaxLoadPctAutoload = obj.MaxLoadPctAutoload,
|
||||
MinLoadPctAutoload = obj.MinLoadPctAutoload,
|
||||
DynamicCompensation = obj.DynamicCompensation,
|
||||
LifeType = obj.LifeType,
|
||||
NominalLife = obj.NominalLife,
|
||||
ReviveDelta = obj.ReviveDelta
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
internal class NcFamilySizeFileModel
|
||||
{
|
||||
public ushort Id { get; set; }
|
||||
public byte RightSize { get; set; }
|
||||
public byte LeftSize { get; set; }
|
||||
|
||||
public static explicit operator NcFamilySizeFileModel(NcFamilyModel obj)
|
||||
{
|
||||
return new NcFamilySizeFileModel()
|
||||
{
|
||||
Id = obj.Id,
|
||||
RightSize = obj.RightSize,
|
||||
LeftSize = obj.LeftSize
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public class NcMagazinePositionModel
|
||||
{
|
||||
public byte MagazineId { get; set; }
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace CMS_CORE.Demo
|
||||
private DemoEdgesConfiguration DemoEdgesConfiguration = new DemoEdgesConfiguration();
|
||||
|
||||
// Magazine config parameters
|
||||
List<MagazineConfigModel> MagazineConfig = new List<MagazineConfigModel>()
|
||||
private List<MagazineConfigModel> MagazineConfig = new List<MagazineConfigModel>()
|
||||
{
|
||||
new MagazineConfigModel{Id = 1, Type = MAGAZINE_TYPE.CHAIN, LoadingIsActive = true, Name = "MAG1"},
|
||||
new MagazineConfigModel{Id = 2, Type = MAGAZINE_TYPE.BOX_MAGAZINE, LoadingIsActive = true, Name = "MAG2"},
|
||||
@@ -952,7 +952,7 @@ namespace CMS_CORE.Demo
|
||||
|
||||
#region PROCESS-AXES (PATH) High-level data
|
||||
|
||||
public override CmsError AXES_RInterpPosition(ushort ProcNumber, ref Dictionary<string, double> Axes)
|
||||
public override CmsError AXES_RInterpPosition(ushort ProcNumber, ref Dictionary<string, double> axes)
|
||||
{
|
||||
// Check if the NC Demo is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
@@ -967,7 +967,7 @@ namespace CMS_CORE.Demo
|
||||
// Parse server response
|
||||
foreach (NcAxisModel demoAxis in demoAxes)
|
||||
{
|
||||
Axes.Add(demoAxis.name, demoAxis.actual);
|
||||
axes.Add(demoAxis.id.ToString(), demoAxis.actual);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -978,7 +978,7 @@ namespace CMS_CORE.Demo
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError AXES_RProgrPosition(ushort ProcNumber, ref Dictionary<string, double> Axes)
|
||||
public override CmsError AXES_RProgrPosition(ushort ProcNumber, ref Dictionary<string, double> axes)
|
||||
{
|
||||
// Check if the NC Demo is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
@@ -992,7 +992,7 @@ namespace CMS_CORE.Demo
|
||||
// Parse server response and retrieve programmed position
|
||||
foreach (NcAxisModel demoAxis in demoAxes)
|
||||
{
|
||||
Axes.Add(demoAxis.name, demoAxis.programmed);
|
||||
axes.Add(demoAxis.id.ToString(), demoAxis.programmed);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -1003,7 +1003,7 @@ namespace CMS_CORE.Demo
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError AXES_RMachinePosition(ushort procNumber, ref Dictionary<string, double> Axes)
|
||||
public override CmsError AXES_RMachinePosition(ushort procNumber, ref Dictionary<string, double> axes)
|
||||
{
|
||||
// Check if the NC Demo is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
@@ -1017,7 +1017,7 @@ namespace CMS_CORE.Demo
|
||||
// Parse Server response and retrieve machine position
|
||||
foreach (NcAxisModel demoAxis in demoAxes)
|
||||
{
|
||||
Axes.Add(demoAxis.name, demoAxis.machinePosition);
|
||||
axes.Add(demoAxis.id.ToString(), demoAxis.machinePosition);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -1028,7 +1028,7 @@ namespace CMS_CORE.Demo
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError AXES_RFollowingError(ushort procNumber, ref Dictionary<string, double> Axes)
|
||||
public override CmsError AXES_RFollowingError(ushort procNumber, ref Dictionary<string, double> axes)
|
||||
{
|
||||
// Check if the NC Demo is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
@@ -1042,7 +1042,7 @@ namespace CMS_CORE.Demo
|
||||
// Parse response retrieve following error
|
||||
foreach (NcAxisModel demoAxis in demoAxes)
|
||||
{
|
||||
Axes.Add(demoAxis.name, demoAxis.distanceToGo);
|
||||
axes.Add(demoAxis.id.ToString(), demoAxis.distanceToGo);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -1053,7 +1053,7 @@ namespace CMS_CORE.Demo
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError AXES_RDistanceToGo(ushort procNumber, ref Dictionary<string, double> Axes)
|
||||
public override CmsError AXES_RDistanceToGo(ushort procNumber, ref Dictionary<string, double> axes)
|
||||
{
|
||||
// Check if the NC Demo is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
@@ -1066,7 +1066,7 @@ namespace CMS_CORE.Demo
|
||||
// Parse response and retrieve distance to go
|
||||
foreach (NcAxisModel demoAxis in demoAxes)
|
||||
{
|
||||
Axes.Add(demoAxis.name, demoAxis.distanceToGo);
|
||||
axes.Add(demoAxis.id.ToString(), demoAxis.distanceToGo);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -1087,13 +1087,13 @@ namespace CMS_CORE.Demo
|
||||
try
|
||||
{
|
||||
serverService.GetAxesPosition(process.ToString(), out List<NcAxisModel> demoAxes);
|
||||
int i = 1;
|
||||
|
||||
// Parse response get distance to go
|
||||
foreach (NcAxisModel demoAxis in demoAxes)
|
||||
{
|
||||
axesData.Add(new AxisModel()
|
||||
{
|
||||
Id = i++,
|
||||
Id = demoAxis.id,
|
||||
Name = demoAxis.name
|
||||
});
|
||||
}
|
||||
@@ -1719,11 +1719,11 @@ namespace CMS_CORE.Demo
|
||||
int magazineId = 0;
|
||||
int positionId = 0;
|
||||
|
||||
foreach(var tool in mag1)
|
||||
foreach (var tool in mag1)
|
||||
{
|
||||
if (tool.IsMultiTool)
|
||||
{
|
||||
if(tool.Shank != null)
|
||||
if (tool.Shank != null)
|
||||
if (tool.Shank.Id == demoTool.Id)
|
||||
{
|
||||
magazineId = tool.MagazineId;
|
||||
@@ -1732,7 +1732,7 @@ namespace CMS_CORE.Demo
|
||||
}
|
||||
else
|
||||
{
|
||||
if(tool.ChildTools != null)
|
||||
if (tool.ChildTools != null)
|
||||
if (tool.ChildTools.Id == demoTool.Id)
|
||||
{
|
||||
magazineId = tool.MagazineId;
|
||||
@@ -2358,7 +2358,7 @@ namespace CMS_CORE.Demo
|
||||
ToolTableConfiguration config = new ToolTableConfiguration();
|
||||
cmsError = TOOLS_RConfiguration(ref config);
|
||||
|
||||
// Get mag config
|
||||
// Get mag config
|
||||
MagazineConfigModel magConfig = config.Magazines.Where(x => x.Id == magazineId).FirstOrDefault();
|
||||
if (magConfig == null || !magConfig.LoadingIsActive)
|
||||
return INCORRECT_PARAMETERS_ERROR;
|
||||
@@ -2474,12 +2474,12 @@ namespace CMS_CORE.Demo
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WStartEdit()
|
||||
public override CmsError TOOLS_WStartEditData()
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WStopEdit()
|
||||
public override CmsError TOOLS_WStopEditData()
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
@@ -2494,7 +2494,6 @@ namespace CMS_CORE.Demo
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
public override CmsError TOOLS_WUpdateShanks(List<NcShankModel> list)
|
||||
{
|
||||
return NO_ERROR;
|
||||
@@ -2505,7 +2504,23 @@ namespace CMS_CORE.Demo
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WStartEditTooling(int magazineId)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WStopEditTooling(int magazineId)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WRestoreBackup()
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
#endregion Nc Tool Manager
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region Subordinate Private Functions
|
||||
|
||||
@@ -1807,12 +1807,12 @@ namespace CMS_CORE.Fanuc
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WStartEdit()
|
||||
public override CmsError TOOLS_WStartEditData()
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WStopEdit()
|
||||
public override CmsError TOOLS_WStopEditData()
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
@@ -1837,6 +1837,20 @@ namespace CMS_CORE.Fanuc
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WStartEditTooling(int magazineId)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WStopEditTooling(int magazineId)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
public override CmsError TOOLS_WRestoreBackup()
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
#endregion Nc Tool Manager
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -1521,9 +1521,9 @@ namespace CMS_CORE
|
||||
|
||||
public abstract CmsError TOOLS_WOffset(short offsetId, OffsetModel offset);
|
||||
|
||||
public abstract CmsError TOOLS_WStartEdit();
|
||||
public abstract CmsError TOOLS_WStartEditData();
|
||||
|
||||
public abstract CmsError TOOLS_WStopEdit();
|
||||
public abstract CmsError TOOLS_WStopEditData();
|
||||
|
||||
public abstract CmsError TOOLS_WUpdateTools(List<NcToolModel> list);
|
||||
|
||||
@@ -1533,6 +1533,12 @@ namespace CMS_CORE
|
||||
|
||||
public abstract CmsError TOOLS_WUpdateMagazinePositions(List<NcMagazinePositionModel> list);
|
||||
|
||||
public abstract CmsError TOOLS_WStartEditTooling(int magazineId);
|
||||
|
||||
public abstract CmsError TOOLS_WStopEditTooling(int magazineId);
|
||||
|
||||
public abstract CmsError TOOLS_WRestoreBackup();
|
||||
|
||||
#endregion Nc Tool Manager
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
+292
-167
@@ -80,7 +80,6 @@ namespace CMS_CORE.Osai
|
||||
//Connect Method
|
||||
public override CmsError NC_Connect()
|
||||
{
|
||||
uint errorClass, errorNum;
|
||||
ushort nReturn;
|
||||
|
||||
//Setup Binding
|
||||
@@ -97,7 +96,7 @@ namespace CMS_CORE.Osai
|
||||
try
|
||||
{
|
||||
//Try to retireve the NC-Status
|
||||
nReturn = OpenNC.BootPhaseEnquiry(out CNCPhase, out errorClass, out errorNum);
|
||||
nReturn = OpenNC.BootPhaseEnquiry(out CNCPhase, out uint errorClass, out uint errorNum);
|
||||
|
||||
//If there's an error
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
@@ -219,16 +218,13 @@ namespace CMS_CORE.Osai
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
uint errorClass, errorNum;
|
||||
ushort nReturn;
|
||||
ushort Year, Month, Day, Hour, Minute, Second;
|
||||
|
||||
//Try to get information
|
||||
try
|
||||
{
|
||||
//Execute the method
|
||||
nReturn = OpenNC.GetDateTime(out Year, out Month, out Day, out Hour, out Minute, out Second, out errorClass, out errorNum);
|
||||
nReturn = OpenNC.GetDateTime(out ushort Year, out ushort Month, out ushort Day, out ushort Hour, out ushort Minute, out ushort Second, out uint errorClass, out uint errorNum);
|
||||
|
||||
//If there's an error launch exception
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
@@ -267,10 +263,7 @@ namespace CMS_CORE.Osai
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
uint errorClass, errorNum;
|
||||
ushort num = 0, nReturn, i;
|
||||
PROCDATA status;
|
||||
|
||||
//i didn't find a method that returns the amount of the processes
|
||||
//so i read all the processes status until i will found an error CLASS 2 And NUM 6
|
||||
@@ -281,7 +274,7 @@ namespace CMS_CORE.Osai
|
||||
for (i = 1; i < (MAX_PROC + 1); i++)
|
||||
{
|
||||
//Execute the method
|
||||
nReturn = OpenNC.GetProcessStatus(i, out status, out errorClass, out errorNum);
|
||||
nReturn = OpenNC.GetProcessStatus(i, out PROCDATA status, out uint errorClass, out uint errorNum);
|
||||
//If there's the error "process not found"
|
||||
if (errorClass == 2 && errorNum == 6 && nReturn == 0)
|
||||
break;
|
||||
@@ -313,10 +306,7 @@ namespace CMS_CORE.Osai
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
uint errorClass, errorNum;
|
||||
ushort nReturn;
|
||||
MSGEMERGENCY errEmgy;
|
||||
|
||||
//Try to get information
|
||||
try
|
||||
@@ -325,7 +315,7 @@ namespace CMS_CORE.Osai
|
||||
alarms.Clear();
|
||||
|
||||
//Execute the method
|
||||
nReturn = OpenNC.ReadCurrentEmergMsg(0, out errEmgy, out errorClass, out errorNum);
|
||||
nReturn = OpenNC.ReadCurrentEmergMsg(0, out MSGEMERGENCY errEmgy, out uint errorClass, out uint errorNum);
|
||||
|
||||
//If there's an error launch exception
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
@@ -766,19 +756,19 @@ namespace CMS_CORE.Osai
|
||||
bool readValue = false;
|
||||
bool writeValue = true;
|
||||
|
||||
SetupAckStrobeAddresses(ackCell.Address, strobeCell.Address, id, out int ackWord, out int strobeWord, out int alarmBitId);
|
||||
SetupAckStrobeAddresses(ackCell.Address, strobeCell.Address, id, out int ackWord, out int strobeWord, out int bitIndex);
|
||||
|
||||
// Check Strobe
|
||||
cmsError = MEM_RWBoolean(R, 0, strobeCell.MemType, strobeWord, alarmBitId, ref readValue);
|
||||
cmsError = MEM_RWBoolean(R, 0, strobeCell.MemType, strobeWord, bitIndex, ref readValue);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
// If PLC it's performing another request then return
|
||||
// If strobe == 1 return
|
||||
if (readValue)
|
||||
return NO_ERROR;
|
||||
|
||||
// Check ACK
|
||||
cmsError = MEM_RWBoolean(R, 0, ackCell.MemType, ackWord, alarmBitId, ref readValue);
|
||||
cmsError = MEM_RWBoolean(R, 0, ackCell.MemType, ackWord, bitIndex, ref readValue);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
@@ -787,36 +777,39 @@ namespace CMS_CORE.Osai
|
||||
return NO_ERROR;
|
||||
|
||||
// Write strobe into memory
|
||||
cmsError = MEM_RWBoolean(W, 0, strobeCell.MemType, strobeWord, alarmBitId, ref writeValue);
|
||||
cmsError = MEM_RWBoolean(W, 0, strobeCell.MemType, strobeWord, bitIndex, ref writeValue);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
// Reset wait ack = 1 and reset the strobe
|
||||
cmsError = ResetStrobe(alarmBitId, strobeWord, ackWord, ackCell.MemType);
|
||||
cmsError = ResetStrobe(bitIndex, strobeWord, ackWord, ackCell.MemType);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
private CmsError ResetStrobe(int bitId, int strobeByte, int ackByte, MEMORY_TYPE memType)
|
||||
private CmsError ResetStrobe(int strobeBit, int strobeByte, int ackByte, MEMORY_TYPE memType, int ackBit = -1)
|
||||
{
|
||||
int n = 200;
|
||||
int n = 720; // 5 minutes
|
||||
bool readValue = false;
|
||||
bool writeValue = false;
|
||||
if (ackBit == -1)
|
||||
ackBit = strobeBit;
|
||||
|
||||
CmsError cmsError;
|
||||
do
|
||||
{
|
||||
// Check ACK
|
||||
cmsError = MEM_RWBoolean(R, 0, memType, ackByte, bitId, ref readValue);
|
||||
cmsError = MEM_RWBoolean(R, 0, memType, ackByte, ackBit, ref readValue);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
// If true reset strobe
|
||||
if (readValue == true)
|
||||
if (readValue)
|
||||
{
|
||||
// Reset strobe
|
||||
cmsError = MEM_RWBoolean(W, 0, memType, strobeByte, bitId, ref writeValue);
|
||||
cmsError = MEM_RWBoolean(W, 0, memType, strobeByte, strobeBit, ref writeValue);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
// Exit from cycle
|
||||
@@ -847,16 +840,13 @@ namespace CMS_CORE.Osai
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
uint errorClass, errorNum;
|
||||
ushort nReturn;
|
||||
PROCDATA status;
|
||||
|
||||
//Try to get information
|
||||
try
|
||||
{
|
||||
//Execute the method
|
||||
nReturn = OpenNC.GetProcessStatus(Number, out status, out errorClass, out errorNum);
|
||||
nReturn = OpenNC.GetProcessStatus(Number, out PROCDATA status, out uint errorClass, out uint errorNum);
|
||||
|
||||
Status = ConverToSTEPStatus(status.Status);
|
||||
|
||||
@@ -879,16 +869,13 @@ namespace CMS_CORE.Osai
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
uint errorClass, errorNum;
|
||||
ushort nReturn;
|
||||
PROCDATA status;
|
||||
|
||||
//Try to get information
|
||||
try
|
||||
{
|
||||
//Execute the method
|
||||
nReturn = OpenNC.GetProcessStatus(Number, out status, out errorClass, out errorNum);
|
||||
nReturn = OpenNC.GetProcessStatus(Number, out PROCDATA status, out uint errorClass, out uint errorNum);
|
||||
|
||||
Mode = ConverToSTEPMode(status.Mode);
|
||||
|
||||
@@ -911,10 +898,7 @@ namespace CMS_CORE.Osai
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
uint errorClass, errorNum;
|
||||
ushort nReturn;
|
||||
MSGERROR err;
|
||||
|
||||
//Try to get information
|
||||
try
|
||||
@@ -923,7 +907,7 @@ namespace CMS_CORE.Osai
|
||||
alarms.Clear();
|
||||
|
||||
//Execute the method
|
||||
nReturn = OpenNC.ReadCurrentErrorMsg(procNumber, out err, out errorClass, out errorNum);
|
||||
nReturn = OpenNC.ReadCurrentErrorMsg(procNumber, out MSGERROR err, out uint errorClass, out uint errorNum);
|
||||
|
||||
//If there's an error launch exception
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
@@ -958,8 +942,6 @@ namespace CMS_CORE.Osai
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
uint errorClass, errorNum;
|
||||
ushort nReturn;
|
||||
String L1 = "";
|
||||
String L2 = "";
|
||||
@@ -974,7 +956,7 @@ namespace CMS_CORE.Osai
|
||||
try
|
||||
{
|
||||
//Execute the method
|
||||
nReturn = OpenNC.GetPartProgramLines(ProcNumber, out L1, out L2, out L3, out L4, out L5, out L6, out L7, out L8, out errorClass, out errorNum);
|
||||
nReturn = OpenNC.GetPartProgramLines(ProcNumber, out L1, out L2, out L3, out L4, out L5, out L6, out L7, out L8, out uint errorClass, out uint errorNum);
|
||||
|
||||
//If there's an error launch exception
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
@@ -1008,8 +990,6 @@ namespace CMS_CORE.Osai
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
uint errorClass, errorNum;
|
||||
ushort nReturn;
|
||||
ushort Level = 0;
|
||||
String MainName = "";
|
||||
@@ -1019,7 +999,7 @@ namespace CMS_CORE.Osai
|
||||
try
|
||||
{
|
||||
//Execute the method
|
||||
nReturn = OpenNC.GetActivePartProgram(ProcNumber, out Level, out MainName, out SubName, out errorClass, out errorNum);
|
||||
nReturn = OpenNC.GetActivePartProgram(ProcNumber, out Level, out MainName, out SubName, out uint errorClass, out uint errorNum);
|
||||
|
||||
//If there's an error launch exception
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
@@ -1134,18 +1114,15 @@ namespace CMS_CORE.Osai
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
uint errorClass, errorNum;
|
||||
ushort nReturn;
|
||||
ushort nAxis = 20;
|
||||
String AxName = "";
|
||||
GETINTDATAC4array Pos;
|
||||
KeyValuePair<String, double> val;
|
||||
|
||||
//Try to get information
|
||||
try
|
||||
{
|
||||
nReturn = OpenNC.GetAxesPosition(process, 0, OSAI_INTERPOLPOS, ref nAxis, out Pos, out errorClass, out errorNum);
|
||||
nReturn = OpenNC.GetAxesPosition(process, 0, OSAI_INTERPOLPOS, ref nAxis, out GETINTDATAC4array Pos, out uint errorClass, out uint errorNum);
|
||||
|
||||
//If there's an error launch exception
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
@@ -1186,18 +1163,15 @@ namespace CMS_CORE.Osai
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
uint errorClass, errorNum;
|
||||
ushort nReturn;
|
||||
ushort nAxis = 20;
|
||||
String AxName = "";
|
||||
GETINTDATAC4array Pos;
|
||||
KeyValuePair<String, double> val;
|
||||
|
||||
//Try to get information
|
||||
try
|
||||
{
|
||||
nReturn = OpenNC.GetAxesPosition(process, 0, OSAI_PROGRAMMEDPOS, ref nAxis, out Pos, out errorClass, out errorNum);
|
||||
nReturn = OpenNC.GetAxesPosition(process, 0, OSAI_PROGRAMMEDPOS, ref nAxis, out GETINTDATAC4array Pos, out uint errorClass, out uint errorNum);
|
||||
|
||||
//If there's an error launch exception
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
@@ -1238,18 +1212,15 @@ namespace CMS_CORE.Osai
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
uint errorClass, errorNum;
|
||||
ushort nReturn;
|
||||
ushort nAxis = 20;
|
||||
String AxName = "";
|
||||
GETINTDATAC4array Pos;
|
||||
KeyValuePair<String, double> val;
|
||||
|
||||
//Try to get information
|
||||
try
|
||||
{
|
||||
nReturn = OpenNC.GetAxesPosition(process, 0, OSAI_MACHINEPOS, ref nAxis, out Pos, out errorClass, out errorNum);
|
||||
nReturn = OpenNC.GetAxesPosition(process, 0, OSAI_MACHINEPOS, ref nAxis, out GETINTDATAC4array Pos, out uint errorClass, out uint errorNum);
|
||||
|
||||
//If there's an error launch exception
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
@@ -1290,18 +1261,15 @@ namespace CMS_CORE.Osai
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
uint errorClass, errorNum;
|
||||
ushort nReturn;
|
||||
ushort nAxis = 20;
|
||||
String AxName = "";
|
||||
GETINTDATAC4array Pos;
|
||||
KeyValuePair<String, double> val;
|
||||
|
||||
//Try to get information
|
||||
try
|
||||
{
|
||||
nReturn = OpenNC.GetAxesPosition(process, 0, OSAI_FOLLERROR, ref nAxis, out Pos, out errorClass, out errorNum);
|
||||
nReturn = OpenNC.GetAxesPosition(process, 0, OSAI_FOLLERROR, ref nAxis, out GETINTDATAC4array Pos, out uint errorClass, out uint errorNum);
|
||||
|
||||
//If there's an error launch exception
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
@@ -1342,18 +1310,15 @@ namespace CMS_CORE.Osai
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
uint errorClass, errorNum;
|
||||
ushort nReturn;
|
||||
ushort nAxis = 20;
|
||||
String AxName = "";
|
||||
GETINTDATAC4array Pos;
|
||||
KeyValuePair<String, double> val;
|
||||
|
||||
//Try to get information
|
||||
try
|
||||
{
|
||||
nReturn = OpenNC.GetAxesPosition(process, 0, OSAI_FOLLERROR, ref nAxis, out Pos, out errorClass, out errorNum);
|
||||
nReturn = OpenNC.GetAxesPosition(process, 0, OSAI_FOLLERROR, ref nAxis, out GETINTDATAC4array Pos, out uint errorClass, out uint errorNum);
|
||||
|
||||
//If there's an error launch exception
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
@@ -1397,17 +1362,12 @@ namespace CMS_CORE.Osai
|
||||
axesData.Clear();
|
||||
|
||||
ushort nReturn, axesNumber = 64;
|
||||
uint errorClass, errorNum;
|
||||
unsignedshortarray axesProcess;
|
||||
unsignedshortarray axesType;
|
||||
unsignedshortarray axesInterface;
|
||||
byte[] axesName;
|
||||
|
||||
//Try to get information
|
||||
try
|
||||
{
|
||||
// Read axes info from NC
|
||||
nReturn = OpenNC.GetAxesInfo3(ushort.MaxValue, ref axesNumber, out axesProcess, out axesName, out axesType, out axesInterface, out errorClass, out errorNum);
|
||||
nReturn = OpenNC.GetAxesInfo3(ushort.MaxValue, ref axesNumber, out unsignedshortarray axesProcess, out byte[] axesName, out unsignedshortarray axesType, out unsignedshortarray axesInterface, out uint errorClass, out uint errorNum);
|
||||
|
||||
for (int i = 0; i < axesNumber; i++)
|
||||
{
|
||||
@@ -1884,13 +1844,12 @@ namespace CMS_CORE.Osai
|
||||
return cmsError;
|
||||
|
||||
ushort nReturn;
|
||||
uint errorClass, errorNum;
|
||||
uint size = 0;
|
||||
|
||||
try
|
||||
{
|
||||
// Get part program file size
|
||||
nReturn = OpenNC.LogFSGetFileSize(filePath, out size, out errorClass, out errorNum);
|
||||
nReturn = OpenNC.LogFSGetFileSize(filePath, out size, out uint errorClass, out uint errorNum);
|
||||
//If there's an error launch exception
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
return GetNCError(errorClass, errorNum);
|
||||
@@ -1938,12 +1897,10 @@ namespace CMS_CORE.Osai
|
||||
return cmsError;
|
||||
|
||||
ushort nReturn;
|
||||
uint errorClass, errorNum;
|
||||
|
||||
try
|
||||
{
|
||||
// Write the local file NC
|
||||
nReturn = OpenNC.PutFile(partProgramContent, (uint)partProgramContent.Length, partProgramPath, out errorClass, out errorNum);
|
||||
nReturn = OpenNC.PutFile(partProgramContent, (uint)partProgramContent.Length, partProgramPath, out uint errorClass, out uint errorNum);
|
||||
|
||||
//If there's an error launch exception
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
@@ -1963,8 +1920,6 @@ namespace CMS_CORE.Osai
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
uint errorClass, errorNum;
|
||||
ushort nReturn;
|
||||
|
||||
// If the 2 path are the same
|
||||
@@ -1973,7 +1928,7 @@ namespace CMS_CORE.Osai
|
||||
try
|
||||
{
|
||||
// Copy Nc part program to the new path
|
||||
nReturn = OpenNC.LogFSCopyFile(partProgramPath, newPartProgramPath, failIfExist, out errorClass, out errorNum);
|
||||
nReturn = OpenNC.LogFSCopyFile(partProgramPath, newPartProgramPath, failIfExist, out uint errorClass, out uint errorNum);
|
||||
|
||||
//If there's an error launch exception
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
@@ -1994,13 +1949,16 @@ namespace CMS_CORE.Osai
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
uint errorClass, errorNum;
|
||||
ushort nReturn;
|
||||
|
||||
try
|
||||
{
|
||||
// Delete part program
|
||||
nReturn = OpenNC.LogFSRemoveFile(partProgramPath, partProgramName, out errorClass, out errorNum);
|
||||
nReturn = OpenNC.LogFSRemoveFile(partProgramPath, partProgramName, out uint errorClass, out uint errorNum);
|
||||
|
||||
// File doesn't exist/already deleted
|
||||
if (errorClass == 5 && errorNum == 17)
|
||||
return NO_ERROR;
|
||||
|
||||
//If there's an error launch exception
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
@@ -2172,73 +2130,7 @@ namespace CMS_CORE.Osai
|
||||
|
||||
#region Nc Tool Manager
|
||||
|
||||
public override CmsError TOOLS_ROffset(short offsetId, ref OffsetModel offset)
|
||||
{
|
||||
//Check if the NC is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
ushort nReturn;
|
||||
|
||||
try
|
||||
{
|
||||
offset = new OffsetModel() { Id = offsetId };
|
||||
// Read data from offset table
|
||||
nReturn = OpenNC.GetOffsetTabRecordII((uint)offsetId, out OFFSETTABLEII offsetData, out uint errorClass, out uint errorNum);
|
||||
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
return GetNCError(errorClass, errorNum);
|
||||
|
||||
// Populate return object
|
||||
offset.Radius = offsetData.DiaVal[0].ValOrig;
|
||||
offset.WearRadius = offsetData.DiaVal[0].ActChangeVal;
|
||||
offset.Length = offsetData.LenVal[0].ValOrig;
|
||||
offset.WearLength = offsetData.LenVal[0].ActChangeVal;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WOffset(short offsetId, OffsetModel offset)
|
||||
{
|
||||
//Check if the NC is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
ushort nReturn;
|
||||
|
||||
try
|
||||
{
|
||||
// Read offset and use it as template for SetOffsetTabRecordII
|
||||
nReturn = OpenNC.GetOffsetTabRecordII((uint)offsetId, out OFFSETTABLEII offsetData, out uint errorClass, out uint errorNum);
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
return GetNCError(errorClass, errorNum);
|
||||
|
||||
// Populate return object
|
||||
offsetData.DiaVal[0].ValOrig = offset.Radius;
|
||||
offsetData.DiaVal[0].ActChangeVal = offset.WearRadius;
|
||||
offsetData.LenVal[0].ValOrig = offset.Length;
|
||||
offsetData.LenVal[0].ActChangeVal = offset.WearLength;
|
||||
|
||||
nReturn = OpenNC.SetOffsetTabRecordII((uint)offsetId, offsetData, out errorClass, out errorNum);
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
return GetNCError(errorClass, errorNum);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WStartEdit()
|
||||
public override CmsError TOOLS_WStartEditData()
|
||||
{
|
||||
//Check if the NC is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
@@ -2260,19 +2152,128 @@ namespace CMS_CORE.Osai
|
||||
|
||||
// Write busy tool manager status
|
||||
bool write = true;
|
||||
cmsError = MEM_RWBoolean(W, 0, TOOL_MANAGER_COMMAND.MemType, TOOL_MANAGER_COMMAND.Address, 2, ref write);
|
||||
cmsError = MEM_RWBoolean(W, 0, TOOL_MANAGER_COMMAND.MemType, TOOL_MANAGER_COMMAND.Address, 1, ref write);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
try
|
||||
{
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
|
||||
cmsError = CreateBackup();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
Console.WriteLine("Backup" + sw.ElapsedMilliseconds);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WStopEditData()
|
||||
{
|
||||
//Check if the NC is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
try
|
||||
{
|
||||
// Write busy tool manager status
|
||||
bool write = true;
|
||||
cmsError = MEM_RWBoolean(W, 0, TOOL_MANAGER_COMMAND.MemType, TOOL_MANAGER_COMMAND.Address, 0, ref write);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
cmsError = DeleteBackup();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ManageException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WStartEditTooling(int magazineId)
|
||||
{
|
||||
//Check if the NC is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
bool status = false;
|
||||
// Read tool manager status
|
||||
cmsError = MEM_RWBoolean(R, 0, MAGAZINES_ENABLED_COMMAND.MemType, MAGAZINES_ENABLED_COMMAND.Address, magazineId - 1, ref status);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
if (!status)
|
||||
return MAGAZINE_BUSY_ERROR;
|
||||
|
||||
// Write busy
|
||||
bool write = true;
|
||||
cmsError = MEM_RWBoolean(W, 0, MAGAZINES_TOOLING_COMMAND.MemType, MAGAZINES_TOOLING_COMMAND.Address, magazineId - 1, ref write);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
try
|
||||
{
|
||||
cmsError = CreateBackup();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WStopEditTooling(int magazineId)
|
||||
{
|
||||
//Check if the NC is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
// Write busy
|
||||
bool write = false;
|
||||
cmsError = MEM_RWBoolean(W, 0, MAGAZINES_TOOLING_COMMAND.MemType, MAGAZINES_TOOLING_COMMAND.Address, magazineId - 1, ref write);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
try
|
||||
{
|
||||
cmsError = DeleteBackup();
|
||||
if(cmsError.IsError())
|
||||
return cmsError;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
private CmsError CreateBackup()
|
||||
{
|
||||
try
|
||||
{
|
||||
string filePath = TOOL_MANAGER_DIRECTORY_PATH + "{0}.csv";
|
||||
string backupFilePath = TOOL_MANAGER_DIRECTORY_PATH + "{0}_bak.csv";
|
||||
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
// Create tool manager file backup
|
||||
cmsError = FILES_CopyProgram(string.Format(filePath, FAMILIES_FILE_NAME), string.Format(backupFilePath, FAMILIES_FILE_NAME), false);
|
||||
// Create tool manager backup file
|
||||
CmsError cmsError = FILES_CopyProgram(string.Format(filePath, FAMILIES_FILE_NAME), string.Format(backupFilePath, FAMILIES_FILE_NAME), false);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
@@ -2288,36 +2289,84 @@ namespace CMS_CORE.Osai
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
cmsError = FILES_CopyProgram(string.Format(filePath, TOOLS_FILE_NAME), string.Format(backupFilePath, TOOLS_FILE_NAME), false);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
Console.WriteLine(sw.ElapsedMilliseconds);
|
||||
return FILES_CopyProgram(string.Format(filePath, TOOLS_FILE_NAME), string.Format(backupFilePath, TOOLS_FILE_NAME), false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ManageException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
} // WIP, NEED Memory control word
|
||||
|
||||
public override CmsError TOOLS_WStopEdit()
|
||||
private CmsError DeleteBackup()
|
||||
{
|
||||
try
|
||||
{
|
||||
string backupFilePath = "{0}_bak.csv";
|
||||
|
||||
// Delete tool manager backup file
|
||||
CmsError cmsError = FILES_DeleteProgram(TOOL_MANAGER_DIRECTORY_PATH, string.Format(backupFilePath, FAMILIES_FILE_NAME));
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
cmsError = FILES_DeleteProgram(TOOL_MANAGER_DIRECTORY_PATH, string.Format(backupFilePath, FAM_SIZE_FILE_NAME));
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
cmsError = FILES_DeleteProgram(TOOL_MANAGER_DIRECTORY_PATH, string.Format(backupFilePath, MAG_POSITION_FILE_NAME));
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
cmsError = FILES_DeleteProgram(TOOL_MANAGER_DIRECTORY_PATH, string.Format(backupFilePath, SHANKS_FILE_NAME));
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
return FILES_DeleteProgram(TOOL_MANAGER_DIRECTORY_PATH, string.Format(backupFilePath, TOOLS_FILE_NAME));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ManageException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WRestoreBackup()
|
||||
{
|
||||
//Check if the NC is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
try
|
||||
{
|
||||
return NO_ERROR;
|
||||
string filePath = TOOL_MANAGER_DIRECTORY_PATH + "{0}.csv";
|
||||
string backupFilePath = TOOL_MANAGER_DIRECTORY_PATH + "{0}_bak.csv";
|
||||
|
||||
// Create tool manager backup file
|
||||
cmsError = FILES_CopyProgram( string.Format(backupFilePath, FAMILIES_FILE_NAME), string.Format(filePath, FAMILIES_FILE_NAME), false);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
// FamilySize
|
||||
cmsError = FILES_CopyProgram(string.Format(backupFilePath, FAM_SIZE_FILE_NAME), string.Format(filePath, FAM_SIZE_FILE_NAME), false);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
// Mag positions
|
||||
cmsError = FILES_CopyProgram( string.Format(backupFilePath, MAG_POSITION_FILE_NAME), string.Format(filePath, MAG_POSITION_FILE_NAME), false);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
// Shanks
|
||||
cmsError = FILES_CopyProgram(string.Format(backupFilePath, SHANKS_FILE_NAME), string.Format(filePath, SHANKS_FILE_NAME), false);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
// Tools
|
||||
cmsError = FILES_CopyProgram(string.Format(backupFilePath, TOOLS_FILE_NAME), string.Format(filePath, TOOLS_FILE_NAME), false);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
return DeleteBackup();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ManageException(ex);
|
||||
}
|
||||
} // TODO
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WUpdateTools(List<NcToolModel> tools)
|
||||
{
|
||||
@@ -2354,8 +2403,17 @@ namespace CMS_CORE.Osai
|
||||
|
||||
try
|
||||
{
|
||||
List<NcFamilyFileModel> familiesData = families.Select(x => (NcFamilyFileModel)x).ToList();
|
||||
// Update file
|
||||
cmsError = UpdateToolManagerFile(filePath, families);
|
||||
cmsError = UpdateToolManagerFile(filePath, familiesData);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
// Write size file
|
||||
filePath = TOOL_MANAGER_DIRECTORY_PATH + FAM_SIZE_FILE_NAME + ".csv";
|
||||
List<NcFamilySizeFileModel> familiesSizeData = families.Select(x => (NcFamilySizeFileModel)x).ToList();
|
||||
// Update file
|
||||
cmsError = UpdateToolManagerFile(filePath, familiesSizeData);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
@@ -2392,7 +2450,7 @@ namespace CMS_CORE.Osai
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WUpdateMagazinePositions(List<NcMagazinePositionModel> positions)
|
||||
public override CmsError TOOLS_WUpdateMagazinePositions(List<NcMagazinePositionModel> positions)
|
||||
{
|
||||
//Check if the NC is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
@@ -2477,6 +2535,72 @@ namespace CMS_CORE.Osai
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_ROffset(short offsetId, ref OffsetModel offset)
|
||||
{
|
||||
//Check if the NC is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
ushort nReturn;
|
||||
|
||||
try
|
||||
{
|
||||
offset = new OffsetModel() { Id = offsetId };
|
||||
// Read data from offset table
|
||||
nReturn = OpenNC.GetOffsetTabRecordII((uint)offsetId, out OFFSETTABLEII offsetData, out uint errorClass, out uint errorNum);
|
||||
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
return GetNCError(errorClass, errorNum);
|
||||
|
||||
// Populate return object
|
||||
offset.Radius = offsetData.DiaVal[0].ValOrig;
|
||||
offset.WearRadius = offsetData.DiaVal[0].ActChangeVal;
|
||||
offset.Length = offsetData.LenVal[0].ValOrig;
|
||||
offset.WearLength = offsetData.LenVal[0].ActChangeVal;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WOffset(short offsetId, OffsetModel offset)
|
||||
{
|
||||
//Check if the NC is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
ushort nReturn;
|
||||
|
||||
try
|
||||
{
|
||||
// Read offset and use it as template for SetOffsetTabRecordII
|
||||
nReturn = OpenNC.GetOffsetTabRecordII((uint)offsetId, out OFFSETTABLEII offsetData, out uint errorClass, out uint errorNum);
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
return GetNCError(errorClass, errorNum);
|
||||
|
||||
// Populate return object
|
||||
offsetData.DiaVal[0].ValOrig = offset.Radius;
|
||||
offsetData.DiaVal[0].ActChangeVal = offset.WearRadius;
|
||||
offsetData.LenVal[0].ValOrig = offset.Length;
|
||||
offsetData.LenVal[0].ActChangeVal = offset.WearLength;
|
||||
|
||||
nReturn = OpenNC.SetOffsetTabRecordII((uint)offsetId, offsetData, out errorClass, out errorNum);
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
return GetNCError(errorClass, errorNum);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
#endregion Nc Tool Manager
|
||||
|
||||
@@ -2533,7 +2657,6 @@ namespace CMS_CORE.Osai
|
||||
//Read Static Data
|
||||
private CmsError ReadStaticNCData()
|
||||
{
|
||||
uint errorClass, errorNum;
|
||||
ushort nReturn;
|
||||
|
||||
//Read oly one time every X seconds
|
||||
@@ -2543,7 +2666,7 @@ namespace CMS_CORE.Osai
|
||||
try
|
||||
{
|
||||
//Execute the method
|
||||
nReturn = OpenNC.GetCodeNumber(out Cnc_SeriesNum, out Cnc_SftVersion, out errorClass, out errorNum);
|
||||
nReturn = OpenNC.GetCodeNumber(out Cnc_SeriesNum, out Cnc_SftVersion, out uint errorClass, out uint errorNum);
|
||||
|
||||
//If there's an error launch exception
|
||||
if (errorClass != 0 || errorNum != 0 || nReturn == 0)
|
||||
@@ -2974,6 +3097,8 @@ namespace CMS_CORE.Osai
|
||||
|
||||
internal static MEMORY_CELL TOOL_MANAGER_STATUS = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 13001, 2);
|
||||
internal static MEMORY_CELL TOOL_MANAGER_COMMAND = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 13000, 2);
|
||||
internal static MEMORY_CELL MAGAZINES_ENABLED_COMMAND = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 13082, 4);
|
||||
internal static MEMORY_CELL MAGAZINES_TOOLING_COMMAND = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 13084, 4);
|
||||
}
|
||||
|
||||
#endregion Memory addresses
|
||||
|
||||
@@ -2884,36 +2884,49 @@ namespace CMS_CORE.Siemens
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WStartEdit()
|
||||
public override CmsError TOOLS_WStartEditData()
|
||||
{
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WStopEdit()
|
||||
public override CmsError TOOLS_WStopEditData()
|
||||
{
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
public override CmsError TOOLS_WUpdateTools(List<NcToolModel> list)
|
||||
{
|
||||
return NO_ERROR;
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WUpdateFamilies(List<NcFamilyModel> list)
|
||||
{
|
||||
return NO_ERROR;
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
|
||||
public override CmsError TOOLS_WUpdateShanks(List<NcShankModel> list)
|
||||
{
|
||||
return NO_ERROR;
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WUpdateMagazinePositions(List<NcMagazinePositionModel> list)
|
||||
{
|
||||
return NO_ERROR;
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
public override CmsError TOOLS_WStartEditTooling(int magazineId)
|
||||
{
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WStopEditTooling(int magazineId)
|
||||
{
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WRestoreBackup()
|
||||
{
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
#endregion Nc Tool Manager
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user