This commit is contained in:
Generated
-1
@@ -130,7 +130,6 @@
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(650, 128);
|
||||
this.panel1.TabIndex = 1;
|
||||
this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint);
|
||||
//
|
||||
// writeFileBtn
|
||||
//
|
||||
|
||||
@@ -487,10 +487,6 @@ namespace CMS_CORE_Application
|
||||
t.Abort();
|
||||
}
|
||||
|
||||
private void panel1_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private void Disconnect_Click(object sender, EventArgs e)
|
||||
{
|
||||
N.NC_Disconnect();
|
||||
@@ -518,20 +514,12 @@ namespace CMS_CORE_Application
|
||||
|
||||
private void writeFileBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
//using (FileStream fileStream = new FileStream("C:\\test.csv", FileMode.OpenOrCreate))
|
||||
//{
|
||||
// CmsError cms = N.FILES_WProgramFromFile(@"test\\OEM\\CMS\\SYS\\STEP\\Tools.csv", fileStream);
|
||||
// if (cms.IsError())
|
||||
// {
|
||||
// MessageBox.Show(cms.localizationKey);
|
||||
// }
|
||||
//}
|
||||
List<OffsetModel> obj = new List<OffsetModel>()
|
||||
List<NcToolModel> obj = new List<NcToolModel>()
|
||||
{
|
||||
new OffsetModel() { Id = 22, Length = 44, Radius = 44, WearLength = 44, WearRadius = 33 },
|
||||
new OffsetModel{ Id = 22, Length = 44, Radius = 44, WearLength = 44, WearRadius = 33 }
|
||||
new NcToolModel() { Id = 22, Type = 44, FamilyId = 1, OffsetId1 = 1, OffsetId2 = 2, OffsetId3 = 3, OffsetLength = 4, ResidualLife = 5, ResidualRevive = 6, ShankId = 7 },
|
||||
new NcToolModel() { Id = 22, Type = 44, FamilyId = 1, OffsetId1 = 1, OffsetId2 = 2, OffsetId3 = 3, OffsetLength = 4, ResidualLife = 5, ResidualRevive = 6, ShankId = 7 }
|
||||
};
|
||||
CmsError cms = N.TOOLS_WUpdateTool(obj);
|
||||
CmsError cms = N.TOOLS_WUpdateTools(obj);
|
||||
if (cms.IsError())
|
||||
{
|
||||
MessageBox.Show(cms.localizationKey);
|
||||
@@ -552,7 +540,12 @@ namespace CMS_CORE_Application
|
||||
|
||||
private void NetworkReadButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
N.TOOLS_WAddTool();
|
||||
List<NcToolModel> obj = new List<NcToolModel>()
|
||||
{
|
||||
new NcToolModel() { Id = 22, Type = 44, FamilyId = 1, OffsetId1 = 1, OffsetId2 = 2, OffsetId3 = 3, OffsetLength = 4, ResidualLife = 5, ResidualRevive = 6, ShankId = 7 },
|
||||
new NcToolModel() { Id = 22, Type = 44, FamilyId = 1, OffsetId1 = 1, OffsetId2 = 2, OffsetId3 = 3, OffsetLength = 4, ResidualLife = 5, ResidualRevive = 6, ShankId = 7 }
|
||||
};
|
||||
N.TOOLS_WUpdateTools(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -601,15 +601,6 @@ namespace CMS_CORE_Library
|
||||
public ShankModel ChildShank;
|
||||
}
|
||||
|
||||
//public class PositionToolModel : PositionModel
|
||||
//{
|
||||
// public MountedMultiToolModel ChildShank;
|
||||
//}
|
||||
//public class PositionWithToolModel : PositionModel
|
||||
//{
|
||||
// public MountedToolModel ChildTool;
|
||||
//}
|
||||
|
||||
public class NewToolInMagazineModel
|
||||
{
|
||||
public int PositionId;
|
||||
@@ -635,6 +626,7 @@ namespace CMS_CORE_Library
|
||||
}
|
||||
|
||||
///////////////// Tools Configuration
|
||||
|
||||
public class FieldsConfiguration
|
||||
{
|
||||
public string Name;
|
||||
@@ -706,6 +698,92 @@ namespace CMS_CORE_Library
|
||||
public double WearLength { get; set; }
|
||||
public double WearRadius { get; set; }
|
||||
}
|
||||
|
||||
public class NcToolModel
|
||||
{
|
||||
public ushort Id { get; set; }
|
||||
|
||||
public byte Type { get; set; }
|
||||
|
||||
public ushort OffsetLength { get; set; }
|
||||
|
||||
public ushort ResidualLife { get; set; }
|
||||
|
||||
public ushort ResidualRevive { get; set; }
|
||||
|
||||
public int FamilyId { get; set; }
|
||||
|
||||
public int ShankId { get; set; }
|
||||
|
||||
public int OffsetId1 { get; set; }
|
||||
|
||||
public int OffsetId2 { get; set; }
|
||||
|
||||
public int OffsetId3 { get; set; }
|
||||
}
|
||||
|
||||
public class NcShankModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public ushort Balluf { get; set; }
|
||||
|
||||
public byte MagazinePositionType { get; set; }
|
||||
|
||||
public byte MagazineId { get; set; }
|
||||
|
||||
public byte PositionId { get; set; }
|
||||
}
|
||||
|
||||
public class NcFamilyModel
|
||||
{
|
||||
public ushort Id { get; set; }
|
||||
|
||||
public byte Type { get; set; }
|
||||
|
||||
public byte RightSize { get; set; }
|
||||
|
||||
public byte LeftSize { 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 class NcMagazinePositionModel
|
||||
{
|
||||
public byte MagazineId { get; set; }
|
||||
|
||||
public byte PositionId { get; set; }
|
||||
|
||||
public byte Type { get; set; }
|
||||
|
||||
public byte Disabled { get; set; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -2463,6 +2463,7 @@ namespace CMS_CORE.Demo
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#region Nc Tool Manager
|
||||
|
||||
public override CmsError TOOLS_ROffset(short offsetId, ref OffsetModel offset)
|
||||
{
|
||||
return NO_ERROR;
|
||||
@@ -2483,15 +2484,27 @@ namespace CMS_CORE.Demo
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WAddTool()
|
||||
public override CmsError TOOLS_WUpdateTools(List<NcToolModel> list)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WUpdateTool(List<OffsetModel> list)
|
||||
public override CmsError TOOLS_WUpdateFamilies(List<NcFamilyModel> list)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
public override CmsError TOOLS_WUpdateShanks(List<NcShankModel> list)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WUpdateMagazinePositions(List<NcMagazinePositionModel> list)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
#endregion Nc Tool Manager
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -1816,16 +1816,27 @@ namespace CMS_CORE.Fanuc
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WAddTool()
|
||||
public override CmsError TOOLS_WUpdateTools(List<NcToolModel> list)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WUpdateTool(List<OffsetModel> list)
|
||||
public override CmsError TOOLS_WUpdateFamilies(List<NcFamilyModel> list)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
public override CmsError TOOLS_WUpdateShanks(List<NcShankModel> list)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WUpdateMagazinePositions(List<NcMagazinePositionModel> list)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
#endregion Nc Tool Manager
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -1524,10 +1524,14 @@ namespace CMS_CORE
|
||||
public abstract CmsError TOOLS_WStartEdit();
|
||||
|
||||
public abstract CmsError TOOLS_WStopEdit();
|
||||
|
||||
public abstract CmsError TOOLS_WUpdateTools(List<NcToolModel> list);
|
||||
|
||||
public abstract CmsError TOOLS_WAddTool();
|
||||
public abstract CmsError TOOLS_WUpdateFamilies(List<NcFamilyModel> list);
|
||||
|
||||
public abstract CmsError TOOLS_WUpdateShanks(List<NcShankModel> list);
|
||||
|
||||
public abstract CmsError TOOLS_WUpdateTool(List<OffsetModel> list);
|
||||
public abstract CmsError TOOLS_WUpdateMagazinePositions(List<NcMagazinePositionModel> list);
|
||||
|
||||
#endregion Nc Tool Manager
|
||||
|
||||
|
||||
@@ -562,33 +562,6 @@ namespace CMS_CORE.Osai
|
||||
return cmsError;
|
||||
|
||||
return NO_ERROR;
|
||||
|
||||
//// Check bit range
|
||||
//if (id > 16)
|
||||
// return INCORRECT_PARAMETERS_ERROR;
|
||||
//bool readValue = false;
|
||||
|
||||
//// Check ACK
|
||||
//CmsError cmsError = MEM_RWBoolean(R, 0, PRE_POST_POWER_ON_ACK.MemType, PRE_POST_POWER_ON_ACK.Address, (int)id, ref readValue);
|
||||
//if (cmsError.IsError())
|
||||
// return cmsError;
|
||||
|
||||
//// If PLC it's performing another request then return
|
||||
//if (readValue)
|
||||
// return NO_ERROR;
|
||||
|
||||
//// Bit = id
|
||||
//// Choose Pre-Power-On or Post-Power-Om
|
||||
//cmsError = MEM_RWBoolean(W, 0, PRE_POST_POWER_ON_CLICKED.MemType, PRE_POST_POWER_ON_CLICKED.Address, (int)id, ref value);
|
||||
//if (cmsError.IsError())
|
||||
// return cmsError;
|
||||
|
||||
//// Reset till wait ack = 1 and reset the strobe
|
||||
//cmsError = ResetStrobe((int)id, PRE_POST_POWER_ON_CLICKED.Address, PRE_POST_POWER_ON_ACK.Address, PRE_POST_POWER_ON_ACK.MemType);
|
||||
//if (cmsError.IsError())
|
||||
// return cmsError;
|
||||
|
||||
//return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError PLC_RFunctionAccess(ref List<FunctionalityModel> functions)
|
||||
@@ -2269,6 +2242,25 @@ namespace CMS_CORE.Osai
|
||||
{
|
||||
//Check if the NC is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
ushort status = 0;
|
||||
// Read tool manager status
|
||||
cmsError = MEM_RWWord(R, 0, TOOL_MANAGER_STATUS.MemType, TOOL_MANAGER_STATUS.Address, ref status);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
bool[] bits = new bool[16];
|
||||
|
||||
// Convert int into to true/false array
|
||||
bits = new BitArray(new int[] { status }).Cast<bool>().ToArray();
|
||||
// 1 = Non-editable tables, 2 = reading in progess
|
||||
if (bits[1] || bits[2])
|
||||
return MAGAZINE_BUSY_ERROR;
|
||||
|
||||
// Write busy tool manager status
|
||||
bool write = true;
|
||||
cmsError = MEM_RWBoolean(W, 0, TOOL_MANAGER_COMMAND.MemType, TOOL_MANAGER_COMMAND.Address, 2, ref write);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
@@ -2276,6 +2268,7 @@ namespace CMS_CORE.Osai
|
||||
{
|
||||
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
|
||||
@@ -2326,21 +2319,43 @@ namespace CMS_CORE.Osai
|
||||
}
|
||||
} // TODO
|
||||
|
||||
public override CmsError TOOLS_WAddTool()
|
||||
public override CmsError TOOLS_WUpdateTools(List<NcToolModel> tools)
|
||||
{
|
||||
//Check if the NC is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
List<OffsetModel> siemens = new List<OffsetModel>() { new OffsetModel() { Id = 22, Length = 33, Radius = 44, WearLength = 11, WearRadius = 5432 } };
|
||||
|
||||
string filePath = TOOL_MANAGER_DIRECTORY_PATH + TOOLS_FILE_NAME + ".csv";
|
||||
|
||||
try
|
||||
{
|
||||
// Update file
|
||||
cmsError = UpdateToolManagerFile(filePath, siemens);
|
||||
cmsError = UpdateToolManagerFile(filePath, tools);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WUpdateFamilies(List<NcFamilyModel> families)
|
||||
{
|
||||
//Check if the NC is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
string filePath = TOOL_MANAGER_DIRECTORY_PATH + FAMILIES_FILE_NAME + ".csv";
|
||||
|
||||
try
|
||||
{
|
||||
// Update file
|
||||
cmsError = UpdateToolManagerFile(filePath, families);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
@@ -2353,19 +2368,43 @@ namespace CMS_CORE.Osai
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WUpdateTool(List<OffsetModel> list)
|
||||
public override CmsError TOOLS_WUpdateShanks(List<NcShankModel> shanks)
|
||||
{
|
||||
//Check if the NC is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
string filePath = TOOL_MANAGER_DIRECTORY_PATH + TOOLS_FILE_NAME + ".csv";
|
||||
string filePath = TOOL_MANAGER_DIRECTORY_PATH + SHANKS_FILE_NAME + ".csv";
|
||||
|
||||
try
|
||||
{
|
||||
// Update file
|
||||
cmsError = UpdateToolManagerFile(filePath, list);
|
||||
cmsError = UpdateToolManagerFile(filePath, shanks);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ManageException(ex);
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WUpdateMagazinePositions(List<NcMagazinePositionModel> positions)
|
||||
{
|
||||
//Check if the NC is Connected
|
||||
CmsError cmsError = CheckConnection();
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
string filePath = TOOL_MANAGER_DIRECTORY_PATH + MAG_POSITION_FILE_NAME + ".csv";
|
||||
|
||||
try
|
||||
{
|
||||
// Update file
|
||||
cmsError = UpdateToolManagerFile(filePath, positions);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
|
||||
@@ -2932,6 +2971,9 @@ namespace CMS_CORE.Osai
|
||||
internal static MEMORY_CELL HEADS_ACK = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 12953, 4);
|
||||
internal static MEMORY_CELL HEADS_STROBE_INCREMENT = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 12955, 4);
|
||||
internal static MEMORY_CELL HEADS_STROBE_DECREMENT = new MEMORY_CELL(MEMORY_TYPE.Osai_MW, 12957, 4);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
#endregion Memory addresses
|
||||
|
||||
@@ -2893,15 +2893,25 @@ namespace CMS_CORE.Siemens
|
||||
{
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WAddTool()
|
||||
public override CmsError TOOLS_WUpdateTools(List<NcToolModel> list)
|
||||
{
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WUpdateTool(List<OffsetModel> list)
|
||||
public override CmsError TOOLS_WUpdateFamilies(List<NcFamilyModel> list)
|
||||
{
|
||||
return FUNCTION_NOT_ALLOWED_ERROR;
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
public override CmsError TOOLS_WUpdateShanks(List<NcShankModel> list)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
public override CmsError TOOLS_WUpdateMagazinePositions(List<NcMagazinePositionModel> list)
|
||||
{
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
#endregion Nc Tool Manager
|
||||
|
||||
Reference in New Issue
Block a user