Added shanks family magazines to Demo application

This commit is contained in:
Lucio Maranta
2018-04-23 15:46:25 +00:00
parent 2a03078e34
commit 2c8925d2f6
27 changed files with 1327 additions and 139 deletions
+2
View File
@@ -79,6 +79,7 @@ namespace CMS_CORE_Application
ProcessDataModel processData = new ProcessDataModel();
ToolTableConfiguration toolsConfig = new ToolTableConfiguration();
List<SiemensToolModel> dataTable = new List<SiemensToolModel>();
List<ShankModel> shanks = new List<ShankModel>();
byte axisId = 0;
@@ -157,6 +158,7 @@ namespace CMS_CORE_Application
cmsError = N.PLC_RHeadsData(headsTest, 1);
cmsError = N.TOOLS_RToolTable(ref dataTable);
cmsError = N.TOOLS_RShanksData(ref shanks);
// N.PLC_WPowerOnData(6, true);
//N.PLC_RFunctionAccess(ref functionality);
@@ -9,7 +9,7 @@ namespace CMS_CORE_Application.ToolDatabase
public class ToolDatabaseContext : DbContext
{
public DbSet<ToolModel> Tools { get; set; }
public DbSet<ShankModel> Shanks { get; set; }
public DbSet<DbShankModel> Shanks { get; set; }
public DbSet<FamilyModel> Family { get; set; }
public DbSet<ManinaModello> Manine { get; set; }
@@ -22,7 +22,7 @@ namespace CMS_CORE_Application.ToolDatabase
[Column("shank")]
public int ShankId { get; set; }
[ForeignKey("ShankId")]
public ShankModel Shank { get; set; }
public DbShankModel Shank { get; set; }
[Column("family")]
public int FamilyId { get; set; }
[ForeignKey("FamilyId")]
@@ -30,7 +30,7 @@ namespace CMS_CORE_Application.ToolDatabase
}
[Table("shank")]
public class ShankModel
public class DbShankModel
{
[Key]
[Column("id")]
+2 -1
View File
@@ -132,12 +132,13 @@
<Compile Include="DataStructures.cs" />
<Compile Include="Demo\ILibraryService.cs" />
<Compile Include="Demo\Models\BinaryMemoryModel.cs" />
<Compile Include="Demo\Models\FamilyModel.cs" />
<Compile Include="Demo\Models\FileModel.cs" />
<Compile Include="Demo\Models\NcAlarmModel.cs" />
<Compile Include="Demo\Models\NcAxisModel.cs" />
<Compile Include="Demo\Models\NcDataModel.cs" />
<Compile Include="Demo\Models\NcProcessModel.cs" />
<Compile Include="Demo\Models\ToolsDataModel.cs" />
<Compile Include="Demo\Models\ToolDataModel.cs" />
<Compile Include="Demo\Nc_Demo.cs" />
<Compile Include="Exceptions\Nc_Exception.cs" />
<Compile Include="Fanuc\fwlib32_64.cs" />
+13
View File
@@ -505,6 +505,19 @@ namespace CMS_CORE_Library
public List<Dictionary<string, double>> EdgesData;
}
public class ShankModel
{
public int Id;
public List<ShankChildModel> childsTools;
}
public class ShankChildModel
{
public int ToolId;
public int ChildId;
public string FamilyName;
public int Type;
}
#endregion ToolsConfig
}
+16
View File
@@ -157,11 +157,27 @@ namespace Nc_Demo_Application.Server.Service
void GetTranslations(string language, out Dictionary<int, string> fileContent);
#endregion
#region Family
[WebGet(UriTemplate = "tool_table/families", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetFamilies(out List<FamilyModel> families);
[WebInvoke(Method = "PUT", UriTemplate = "tool_table/families", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)]
void PutFamily(FamilyModel familyData);
#endregion
#region Tools
[WebGet(UriTemplate = "tool_table", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetTools(out List<ToolsDataModel> toolsData);
[WebGet(UriTemplate = "tool_table/shanks", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetShanks(out List<ShankDataModel> shanksData);
[WebGet(UriTemplate = "tool_table/positions", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetPositions(out List<PositionsDataModel> positionsData);
#endregion
}
}
@@ -1,36 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace CMS_CORE_Library.Demo.Models
{
[DataContract]
class BinaryMemoryModel
internal class BinaryMemoryModel
{
[DataMember]
public bool boolean;
[DataMember]
public byte binary;
[DataMember]
public short word;
[DataMember]
public ushort uWord;
[DataMember]
public int integer;
[DataMember]
public uint dWord;
[DataMember]
public List<byte> byteList;
[DataMember]
public List<short> shortList;
[DataMember]
public List<ushort> wordList;
[DataMember]
public List<int> integerList;
[DataMember]
public List<uint> dWordList;
}
}
}
@@ -0,0 +1,18 @@
using System.Collections.Generic;
namespace CMS_CORE.Demo.Models
{
public class FamilyModel
{
public int id;
public string name;
public List<ChildTool> childTools;
}
public class ChildTool
{
public int id;
public int type;
public int childId;
}
}
@@ -0,0 +1,49 @@
using System.Collections.Generic;
namespace CMS_CORE.Demo.Models
{
public class ToolsDataModel
{
public int Id;
public int MagazineId;
public string FamilyName;
public int ChildId;
public int MagazinePositionType;
public int ToolType;
public int LeftSize;
public int RightSize;
public int Rotation;
public bool Cooling1;
public bool Cooling2;
public bool IsActive;
public bool FixedPlace;
public bool IsInhibited;
public bool IsMeasured;
public bool ChangeTool;
public bool IsInUse;
public bool PreAlarm;
public int ShanksId;
public List<Dictionary<string, double>> EdgesData;
}
public class ShankDataModel
{
public int Id;
public List<ShankChildDataModel> childsTools;
}
public class ShankChildDataModel
{
public int ToolId;
public int ChildId;
public string FamilyName;
public int Type;
}
public class PositionsDataModel
{
public int Id;
public int MagazineId;
public int Type;
}
}
+36
View File
@@ -1767,6 +1767,42 @@ namespace CMS_CORE.Demo
}
}
public override CmsError TOOLS_RShanksData(ref List<ShankModel> shanksData)
{
// Check if the NC Demo is Connected
CmsError cmsError = CheckConnection();
if (cmsError.IsError())
return cmsError;
try
{
shanksData = new List<ShankModel>();
// Get tool table data
serverService.GetShanks(out List<ShankDataModel> demoShanksData);
foreach (ShankDataModel shank in demoShanksData)
{
shanksData.Add(new ShankModel()
{
Id = shank.Id,
childsTools = shank.childsTools.Select(x => new ShankChildModel()
{
ToolId = x.ToolId,
ChildId = x.ChildId,
FamilyName = x.FamilyName,
Type = x.Type
}).ToList()
});
}
return NO_ERROR;
}
catch (Exception ex)
{
return ManageException(ex);
}
}
#endregion Tools Management
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+5
View File
@@ -1675,6 +1675,11 @@ namespace CMS_CORE.Fanuc
return NO_ERROR;
}
public override CmsError TOOLS_RShanksData(ref List<ShankModel> shanksData)
{
return NO_ERROR;
}
#endregion Tools Management
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+3
View File
@@ -1302,6 +1302,9 @@ namespace CMS_CORE
public abstract CmsError TOOLS_RToolTable(ref List<SiemensToolModel> toolTable);
public abstract CmsError TOOLS_RShanksData(ref List<ShankModel> shanksData);
#endregion File Management (To override)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+6
View File
@@ -2045,6 +2045,12 @@ namespace CMS_CORE.Osai
return NO_ERROR;
}
public override CmsError TOOLS_RShanksData(ref List<ShankModel> shanksData)
{
return NO_ERROR;
}
#endregion Tools Management
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+6
View File
@@ -1866,6 +1866,12 @@ namespace CMS_CORE.Siemens
return toolValues;
}
public override CmsError TOOLS_RShanksData(ref List<ShankModel> shanksData)
{
return NO_ERROR;
}
#endregion Tool Management
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,447 @@
using System.Collections.Generic;
namespace CMS_CORE_Library.Siemens
{
internal class SiemensAdditionalParams
{
public class ToolConfig
{
public string Name;
public string Path;
}
public Dictionary<int, List<ToolConfig>> ToolsSettings = new Dictionary<int, List<ToolConfig>>()
{
{
100, new List<ToolConfig>()
{
new ToolConfig{Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{Name = "Lenght", Path = "$TC_DP3["},
new ToolConfig{Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{Name = "WearLenght", Path = "$TC_DP12["},
new ToolConfig{Name = "WearRadius", Path = "$TC_DP15["},
new ToolConfig{Name = "Teeth", Path = "$TC_DPNT[" }
}
},
{
110, new List<ToolConfig>()
{
new ToolConfig{Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{Name = "Lenght", Path = "$TC_DP3["},
new ToolConfig{Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{Name = "WearLenght", Path = "$TC_DP12["},
new ToolConfig{Name = "WearRadius", Path = "$TC_DP15["},
new ToolConfig{Name = "Teeth", Path = "$TC_DPNT[" }
}
},
{
111, new List<ToolConfig>()
{
new ToolConfig{Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{Name = "Lenght", Path = "$TC_DP3["},
new ToolConfig{Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{Name = "CornerRadius", Path = "$TC_DP7["},
new ToolConfig{Name = "WearLenght", Path = "$TC_DP12["},
new ToolConfig{Name = "WearRadius", Path = "$TC_DP15["},
new ToolConfig{Name = "Teeth", Path = "$TC_DPNT[" }
}
},
{
120, new List<ToolConfig>()
{
new ToolConfig{Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{Name = "Lenght", Path = "$TC_DP3["},
new ToolConfig{Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{Name = "WearLenght", Path = "$TC_DP12["},
new ToolConfig{Name = "WearRadius", Path = "$TC_DP15["},
new ToolConfig{Name = "Teeth", Path = "$TC_DPNT[" }
}
},
{
121, new List<ToolConfig>()
{
new ToolConfig{Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{Name = "Lenght", Path = "$TC_DP3["},
new ToolConfig{Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{Name = "WearLenght", Path = "$TC_DP12["},
new ToolConfig{Name = "WearRadius", Path = "$TC_DP15["},
new ToolConfig{Name = "Teeth", Path = "$TC_DPNT[" }
}
},
{
130, new List<ToolConfig>()
{
new ToolConfig{Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{Name = "GeomLenght1", Path = "$TC_DP3["},
new ToolConfig{Name = "GeomLenght2", Path = "$TC_DP4["},
new ToolConfig{Name = "GeomLenght3", Path = "$TC_DP5["},
new ToolConfig{Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{Name = "GeomDeltaLenght1", Path = "$TC_DP12["},
new ToolConfig{Name = "GeomDeltaLenght2", Path = "$TC_DP13["},
new ToolConfig{Name = "GeomDeltaLenght3", Path = "$TC_DP14["},
new ToolConfig{Name = "WearRadius", Path = "$TC_DP15["},
new ToolConfig{Name = "AdapterLenght1", Path = "$TC_DP21["},
new ToolConfig{Name = "AdapterLenght2", Path = "$TC_DP22["},
new ToolConfig{Name = "AdapterLenght3", Path = "$TC_DP23["},
new ToolConfig{Name = "V", Path = "$TC_DPV["},
new ToolConfig{Name = "Vector1", Path = "$TC_DPV3["},
new ToolConfig{Name = "Vector2", Path = "$TC_DPV4["},
new ToolConfig{Name = "Vector3", Path = "$TC_DPV5["},
new ToolConfig{Name = "Teeth", Path = "$TC_DPNT[" }
}
},
{
131, new List<ToolConfig>()
{
new ToolConfig{Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{Name = "GeomLenght1", Path = "$TC_DP3["},
new ToolConfig{Name = "GeomLenght2", Path = "$TC_DP4["},
new ToolConfig{Name = "GeomLenght3", Path = "$TC_DP5["},
new ToolConfig{Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{Name = "GeomDeltaLenght1", Path = "$TC_DP12["},
new ToolConfig{Name = "GeomDeltaLenght2", Path = "$TC_DP13["},
new ToolConfig{Name = "GeomDeltaLenght3", Path = "$TC_DP14["},
new ToolConfig{Name = "WearRadius", Path = "$TC_DP15["},
new ToolConfig{Name = "AdapterLenght1", Path = "$TC_DP21["},
new ToolConfig{Name = "AdapterLenght2", Path = "$TC_DP22["},
new ToolConfig{Name = "AdapterLenght3", Path = "$TC_DP23["},
new ToolConfig{Name = "V", Path = "$TC_DPV["},
new ToolConfig{Name = "Vector1", Path = "$TC_DPV3["},
new ToolConfig{Name = "Vector2", Path = "$TC_DPV4["},
new ToolConfig{Name = "Vector3", Path = "$TC_DPV5["},
new ToolConfig{Name = "Teeth", Path = "$TC_DPNT[" }
}
},
{
140, new List<ToolConfig>()
{
new ToolConfig{Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{Name = "Lenght", Path = "$TC_DP3["},
new ToolConfig{Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{Name = "OutsideRadius", Path = "$TC_DP17["},
new ToolConfig{Name = "ToolAngle", Path = "$TC_DP11["},
new ToolConfig{Name = "Teeth", Path = "$TC_DPNT[" }
}
},
{
145, new List<ToolConfig>()
{
new ToolConfig{Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{Name = "Lenght", Path = "$TC_DP3["},
new ToolConfig{Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{Name = "WearLenght", Path = "$TC_DP12["},
new ToolConfig{Name = "WearRadius", Path = "$TC_DP15["},
new ToolConfig{Name = "Teeth", Path = "$TC_DPNT[" }
}
},
{
150, new List<ToolConfig>()
{
new ToolConfig{Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{Name = "Lenght", Path = "$TC_DP3["},
new ToolConfig{Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{Name = "Width", Path = "$TC_DP9[" },
new ToolConfig{Name = "WearLenght", Path = "$TC_DP12["},
new ToolConfig{Name = "WearRadius", Path = "$TC_DP15[" },
new ToolConfig{Name = "Teeth", Path = "$TC_DPNT[" }
}
},
{
151, new List<ToolConfig>()
{
new ToolConfig{Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{Name = "Lenght", Path = "$TC_DP3["},
new ToolConfig{Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{Name = "Width", Path = "$TC_DP9[" },
new ToolConfig{Name = "WearLenght", Path = "$TC_DP12["},
new ToolConfig{Name = "WearRadius", Path = "$TC_DP15[" },
new ToolConfig{Name = "Teeth", Path = "$TC_DPNT[" }
}
},
{
155, new List<ToolConfig>()
{
new ToolConfig{Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{Name = "Lenght", Path = "$TC_DP3["},
new ToolConfig{Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{Name = "TaperAngle", Path = "$TC_DP11[" },
new ToolConfig{Name = "WearLenght", Path = "$TC_DP12["},
new ToolConfig{Name = "WearRadius", Path = "$TC_DP15["},
new ToolConfig{Name = "Teeth", Path = "$TC_DPNT[" }
}
},
{
156, new List<ToolConfig>()
{
new ToolConfig{Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{Name = "Lenght", Path = "$TC_DP3["},
new ToolConfig{Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{Name = "CornerRadius", Path = "$TC_DP7["},
new ToolConfig{Name = "TaperAngle", Path = "$TC_DP11[" },
new ToolConfig{Name = "WearLenght", Path = "$TC_DP12["},
new ToolConfig{Name = "WearRadius", Path = "$TC_DP15["},
new ToolConfig{Name = "Teeth", Path = "$TC_DPNT[" }
}
},
{
157, new List<ToolConfig>()
{
new ToolConfig{Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{Name = "Lenght", Path = "$TC_DP3["},
new ToolConfig{Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{Name = "TaperAngle", Path = "$TC_DP11[" },
new ToolConfig{Name = "WearLenght", Path = "$TC_DP12["},
new ToolConfig{Name = "WearRadius", Path = "$TC_DP15["},
new ToolConfig{Name = "Teeth", Path = "$TC_DPNT[" }
}
},
{
160, new List<ToolConfig>()
{
new ToolConfig{Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{Name = "Lenght", Path = "$TC_DP3["},
new ToolConfig{Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{Name = "WearLenght", Path = "$TC_DP12["},
new ToolConfig{Name = "WearRadius", Path = "$TC_DP15["},
new ToolConfig{Name = "Teeth", Path = "$TC_DPNT[" }
}
},
//////// 200
{
200, new List<ToolConfig>()
{
new ToolConfig{ Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{ Name = "Lenght", Path = "$TC_DP3["},
new ToolConfig{ Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{ Name = "WearLenght", Path = "$TC_DP12"},
new ToolConfig{ Name = "WearRadius", Path = "$TC_DP15["},
new ToolConfig{ Name = "TipAngle", Path = "$TC_DP24["}
}
},
{
205, new List<ToolConfig>()
{
new ToolConfig{ Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{ Name = "Lenght", Path = "$TC_DP3["},
new ToolConfig{ Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{ Name = "WearLenght", Path = "$TC_DP12"},
new ToolConfig{ Name = "WearRadius", Path = "$TC_DP15["}
}
},
{
210, new List<ToolConfig>()
{
new ToolConfig{ Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{ Name = "Lenght", Path = "$TC_DP3["},
new ToolConfig{ Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{ Name = "WearLenght", Path = "$TC_DP12"},
new ToolConfig{ Name = "WearRadius", Path = "$TC_DP15["}
}
},
{
220, new List<ToolConfig>()
{
new ToolConfig{ Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{ Name = "Lenght", Path = "$TC_DP3["},
new ToolConfig{ Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{ Name = "WearLenght", Path = "$TC_DP12"},
new ToolConfig{ Name = "WearRadius", Path = "$TC_DP15["},
new ToolConfig{ Name = "TipAngle", Path = "$TC_DP24["}
}
},
{
230, new List<ToolConfig>()
{
new ToolConfig{ Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{ Name = "Lenght", Path = "$TC_DP3["},
new ToolConfig{ Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{ Name = "WearLenght", Path = "$TC_DP12"},
new ToolConfig{ Name = "WearRadius", Path = "$TC_DP15["},
new ToolConfig{ Name = "TipAngle", Path = "$TC_DP24["}
}
},
{
231, new List<ToolConfig>()
{
new ToolConfig{ Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{ Name = "Lenght", Path = "$TC_DP3["},
new ToolConfig{ Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{ Name = "WearLenght", Path = "$TC_DP12"},
new ToolConfig{ Name = "WearRadius", Path = "$TC_DP15["}
}
},
{
240, new List<ToolConfig>()
{
new ToolConfig{ Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{ Name = "Lenght", Path = "$TC_DP3["},
new ToolConfig{ Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{ Name = "Pitch", Path = "$TC_DP9["},
new ToolConfig{ Name = "WearLenght", Path = "$TC_DP12"},
new ToolConfig{ Name = "WearRadius", Path = "$TC_DP15["}
}
},
{
241, new List<ToolConfig>()
{
new ToolConfig{ Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{ Name = "Lenght", Path = "$TC_DP3["},
new ToolConfig{ Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{ Name = "WearLenght", Path = "$TC_DP12"},
new ToolConfig{ Name = "WearRadius", Path = "$TC_DP15["}
}
},
{
242, new List<ToolConfig>()
{
new ToolConfig{ Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{ Name = "Lenght", Path = "$TC_DP3["},
new ToolConfig{ Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{ Name = "Pitch", Path = "$TC_DP9["},
new ToolConfig{ Name = "WearLenght", Path = "$TC_DP12"},
new ToolConfig{ Name = "WearRadius", Path = "$TC_DP15["}
}
},
{
250, new List<ToolConfig>()
{
new ToolConfig{ Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{ Name = "Lenght", Path = "$TC_DP3["},
new ToolConfig{ Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{ Name = "Pitch", Path = "$TC_DP9["},
new ToolConfig{ Name = "WearLenght", Path = "$TC_DP12"},
new ToolConfig{ Name = "WearRadius", Path = "$TC_DP15["}
}
},
///////// 700
{
700, new List<ToolConfig>()
{
new ToolConfig{Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{Name = "GeomLenght1", Path = "$TC_DP3["},
new ToolConfig{Name = "GeomLenght2", Path = "$TC_DP4["},
new ToolConfig{Name = "GeomLenght3", Path = "$TC_DP5["},
//new ToolConfiguration{Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{Name = "GeomSlotWidth", Path = "$TC_DP7["},
new ToolConfig{Name = "GeomPrjection", Path = "$TC_DP8["},
new ToolConfig{Name = "GeomWearLenght1", Path = "$TC_DP12["},
new ToolConfig{Name = "GeomWearLenght2", Path = "$TC_DP13["},
new ToolConfig{Name = "GeomWearLenght3", Path = "$TC_DP14["},
new ToolConfig{Name = "Wear", Path = "$TC_DP15["}, // ?
new ToolConfig{Name = "WearSlotWdth", Path = "$TC_DP16["},
new ToolConfig{Name = "WearGeomPrjection", Path = "$TC_DP17["},
new ToolConfig{Name = "AdapterLenght1", Path = "$TC_DP21["},
new ToolConfig{Name = "AdapterLenght2", Path = "$TC_DP22["},
new ToolConfig{Name = "AdapterLenght3", Path = "$TC_DP23["}
}
},
{
710, new List<ToolConfig>()
{
new ToolConfig{Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{Name = "Lenght", Path = "$TC_DP3["},
new ToolConfig{Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{Name = "WearLenght", Path = "$TC_DP12["},
new ToolConfig{Name = "WearRadius", Path = "$TC_DP15["}
}
},
{
711, new List<ToolConfig>()
{
new ToolConfig{Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{Name = "Lenght", Path = "$TC_DP3["},
new ToolConfig{Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{Name = "WearLenght", Path = "$TC_DP12["},
new ToolConfig{Name = "WearRadius", Path = "$TC_DP15["}
}
},
{
712, new List<ToolConfig>()
{
new ToolConfig{Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{Name = "Lenght", Path = "$TC_DP3["},
new ToolConfig{Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{Name = "CorrAngle", Path = "$TC_DP10["},
new ToolConfig{Name = "WearLenght", Path = "$TC_DP12["},
new ToolConfig{Name = "WearRadius", Path = "$TC_DP15["}
}
},
{
713, new List<ToolConfig>()
{
new ToolConfig{Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{Name = "GeomLenght1", Path = "$TC_DP3["},
new ToolConfig{Name = "GeomLenght2", Path = "$TC_DP4["},
new ToolConfig{Name = "GeomLenght3", Path = "$TC_DP5["},
new ToolConfig{Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{Name = "BoomLenght", Path = "$TC_DP7["},
new ToolConfig{Name = "CorrAngle", Path = "$TC_DP10["},
new ToolConfig{Name = "GeomWearLenght1", Path = "$TC_DP12["},
new ToolConfig{Name = "GeomWearLenght2", Path = "$TC_DP13["},
new ToolConfig{Name = "GeomWearLenght3", Path = "$TC_DP14["},
new ToolConfig{Name = "WearRadius", Path = "$TC_DP15["},
new ToolConfig{Name = "AdapterLenght1", Path = "$TC_DP21["},
new ToolConfig{Name = "AdapterLenght2", Path = "$TC_DP22["},
new ToolConfig{Name = "AdapterLenght3", Path = "$TC_DP23["}
}
},
{
714, new List<ToolConfig>()
{
new ToolConfig{Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{Name = "GeomLenght1", Path = "$TC_DP3["},
new ToolConfig{Name = "GeomLenght2", Path = "$TC_DP4["},
new ToolConfig{Name = "GeomLenght3", Path = "$TC_DP5["},
new ToolConfig{Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{Name = "BallRadius", Path = "$TC_DP7["},
new ToolConfig{Name = "CorrAngle", Path = "$TC_DP10["},
new ToolConfig{Name = "GeomWearLenght1", Path = "$TC_DP12["},
new ToolConfig{Name = "GeomWearLenght2", Path = "$TC_DP13["},
new ToolConfig{Name = "GeomWearLenght3", Path = "$TC_DP14["},
new ToolConfig{Name = "WearRadius", Path = "$TC_DP15["},
new ToolConfig{Name = "AdapterLenght1", Path = "$TC_DP21["},
new ToolConfig{Name = "AdapterLenght2", Path = "$TC_DP22["},
new ToolConfig{Name = "AdapterLenght3", Path = "$TC_DP23["}
}
},
{
725, new List<ToolConfig>()
{
new ToolConfig{Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{Name = "GeomLenght1", Path = "$TC_DP3["},
new ToolConfig{Name = "GeomLenght2", Path = "$TC_DP4["},
new ToolConfig{Name = "GeomLenght3", Path = "$TC_DP5["},
new ToolConfig{Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{Name = "CorrAngle", Path = "$TC_DP10["},
new ToolConfig{Name = "GeomWearLenght1", Path = "$TC_DP12["},
new ToolConfig{Name = "GeomWearLenght2", Path = "$TC_DP13["},
new ToolConfig{Name = "GeomWearLenght3", Path = "$TC_DP14["},
new ToolConfig{Name = "WearRadius", Path = "$TC_DP15["},
new ToolConfig{Name = "AdapterLenght1", Path = "$TC_DP21["},
new ToolConfig{Name = "AdapterLenght2", Path = "$TC_DP22["},
new ToolConfig{Name = "AdapterLenght3", Path = "$TC_DP23["}
}
},
{
730, new List<ToolConfig>()
{
new ToolConfig{Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{Name = "Lenght", Path = "$TC_DP3["},
new ToolConfig{Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{Name = "WearLenght", Path = "$TC_DP12["},
new ToolConfig{Name = "WearRadius", Path = "$TC_DP15["}
}
},
{
900, new List<ToolConfig>()
{
new ToolConfig{Name = "CuttingEdge", Path = "$TC_DP2["},
new ToolConfig{Name = "Lenght", Path = "$TC_DP3["},
new ToolConfig{Name = "Radius", Path = "$TC_DP6["},
new ToolConfig{Name = "WearLenght", Path = "$TC_DP12["},
new ToolConfig{Name = "WearRadius", Path = "$TC_DP15["}
}
},
};
}
}
@@ -114,6 +114,7 @@
<ItemGroup>
<Compile Include="Constants.cs" />
<Compile Include="Database\DatabaseController.cs" />
<Compile Include="Database\Models\FamilyModel.cs" />
<Compile Include="Database\Models\ToolsDataModel.cs" />
<Compile Include="Server\Models\BinaryMemoryModel.cs" />
<Compile Include="Database\Models\NcAlarmModel.cs" />
@@ -157,9 +158,9 @@
<EmbeddedResource Include="Views\StartupPanel.resx">
<DependentUpon>StartupPanel.cs</DependentUpon>
</EmbeddedResource>
<None Include="Nc_Demo_Db.db">
<EmbeddedResource Include="Nc_Demo_Db.db">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</EmbeddedResource>
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
@@ -14,8 +14,11 @@ namespace Nc_Demo_Application
public const string READ_NC_ALARMS_QUERY = "SELECT * FROM alarm";
public const string READ_NC_AXES_QUERY = "SELECT * FROM axis";
public const string READ_BINARY_MEMORY_QUERY = "SELECT * FROM binary_memory";
public const string READ_TOOLS_QUERY = "SELECT * FROM tools";
public const string READ_TOOLS_QUERY = "SELECT * FROM tool";
public const string READ_FAMILIES_QUERY = "SELECT * FROM family";
public const string READ_SHANKS_QUERY = "SELECT * FROM shank";
public const string READ_MAGAZINES_QUERY = "SELECT * FROM magazine";
// Server configuration
public static string SERVER_PORT = ":8080";
public const string SERVER_IP_ADDRESS = "http://localhost";
@@ -23,21 +23,30 @@ namespace Nc_Demo_Application.Database
private DataTable NcAxesDataTable;
private DataTable BinaryMemory;
private DataTable ToolsDataTable;
private DataTable FamiliesDataTable;
private DataTable ShanksDataTable;
private DataTable MagazinesDataTable;
#region Constructor & Private functions
private DatabaseController()
{
SetConnection();
// Initialize datatables
NcDatatable = new DataTable();
NcAlarmDataTable = new DataTable();
NcAxesDataTable = new DataTable();
FamiliesDataTable = new DataTable();
ToolsDataTable = new DataTable();
ShanksDataTable = new DataTable();
MagazinesDataTable = new DataTable();
NcProcessDataTable = new DataTable();
BinaryMemory = new DataTable();
// Create ncProcess columns
NcProcessDataTable.Columns.Add("status", typeof(PROC_STATUS));
NcProcessDataTable.Columns.Add("mode", typeof(PROC_MODE));
BinaryMemory = new DataTable();
// Create byte memory dataTable columns and set order
DataColumn address = BinaryMemory.Columns.Add("address", typeof(int));
address.SetOrdinal(0);
@@ -45,8 +54,6 @@ namespace Nc_Demo_Application.Database
BinaryMemory.Columns.Add("binary", typeof(string)).SetOrdinal(2);
BinaryMemory.Columns.Add("word", typeof(short)).SetOrdinal(3);
BinaryMemory.Columns.Add("integer", typeof(int)).SetOrdinal(4);
ToolsDataTable = new DataTable();
}
public static DatabaseController getInstance()
@@ -56,10 +63,10 @@ namespace Nc_Demo_Application.Database
return databaseInstance;
}
// Setup a new database connection
private void SetConnection()
{
if (sqlConnection == null)
// Setup a new database connection
sqlConnection = new SQLiteConnection("Data Source=" + RUNNING_PATH_DIR + DATABASE_FILE_NAME + ";Version=3;New=False;");
}
@@ -70,6 +77,9 @@ namespace Nc_Demo_Application.Database
NcAlarmDataTable.Dispose();
NcAxesDataTable.Dispose();
ToolsDataTable.Dispose();
FamiliesDataTable.Dispose();
ShanksDataTable.Dispose();
MagazinesDataTable.Dispose();
sqlConnection.Close();
}
@@ -90,6 +100,33 @@ namespace Nc_Demo_Application.Database
sqlConnection.Close();
}
public void UpdateDatabaseFromGridView(DataTable newDataTable, string readingQuery)
{
try
{
SetConnection();
// Open the connection with database
sqlConnection.Open();
// Create a SQLite command with query, adapter and commandbuilder in order to update.
sqlCommand = new SQLiteCommand(readingQuery, sqlConnection);
SQLiteDataAdapter adapter = new SQLiteDataAdapter(sqlCommand);
SQLiteCommandBuilder commandBuilder = new SQLiteCommandBuilder(adapter);
// Update database with new data
adapter.Update(newDataTable);
// Close the connection with database
sqlConnection.Close();
}
catch (Exception ex)
{
Console.WriteLine("Update query: " + readingQuery + "\nException: " + ex.Message);
}
}
#endregion Constructor & Private functions
#region Nc Data Methods
public NcDataModel ReadNcData()
@@ -219,27 +256,7 @@ namespace Nc_Demo_Application.Database
public void UpdateNcProcess(DataTable ncProcessData)
{
try
{
SetConnection();
// Open the connection with database
sqlConnection.Open();
// Create a SQLite command with query, adapter and commandbuilder in order to update.
sqlCommand = new SQLiteCommand(READ_NC_PROCESS_QUERY, sqlConnection);
SQLiteDataAdapter adapter = new SQLiteDataAdapter(sqlCommand);
SQLiteCommandBuilder commandBuilder = new SQLiteCommandBuilder(adapter);
// Update ncData
adapter.Update(ncProcessData);
// Close the connection with database
sqlConnection.Close();
}
catch (Exception ex)
{
Console.WriteLine("ReadNcData exception: " + ex.Message);
}
UpdateDatabaseFromGridView(ncProcessData, READ_NC_PROCESS_QUERY);
}
#endregion Nc Processes Data
@@ -256,7 +273,7 @@ namespace Nc_Demo_Application.Database
}
catch (Exception ex)
{
Console.WriteLine("ReadNcData exception: " + ex.Message);
Console.WriteLine("Read alarms exception: " + ex.Message);
return null;
}
}
@@ -289,27 +306,7 @@ namespace Nc_Demo_Application.Database
public void UpdateNcAlarms(DataTable ncAlarms)
{
try
{
SetConnection();
// Open the connection with database
sqlConnection.Open();
// Create a SQLite command with query, adapter and commandbuilder in order to update.
sqlCommand = new SQLiteCommand(READ_NC_ALARMS_QUERY, sqlConnection);
SQLiteDataAdapter adapter = new SQLiteDataAdapter(sqlCommand);
SQLiteCommandBuilder commandBuilder = new SQLiteCommandBuilder(adapter);
// Update ncData
adapter.Update(ncAlarms);
// Close the connection with database
sqlConnection.Close();
}
catch (Exception ex)
{
Console.WriteLine("ReadNcData exception: " + ex.Message);
}
UpdateDatabaseFromGridView(ncAlarms, READ_NC_ALARMS_QUERY);
}
#endregion Nc Alarms Data
@@ -361,27 +358,7 @@ namespace Nc_Demo_Application.Database
public void UpdateNcAxes(DataTable ncAxes)
{
try
{
SetConnection();
// Open the connection with database
sqlConnection.Open();
// Create a SQLite command with query, adapter and commandbuilder in order to update.
sqlCommand = new SQLiteCommand(READ_NC_AXES_QUERY, sqlConnection);
SQLiteDataAdapter adapter = new SQLiteDataAdapter(sqlCommand);
SQLiteCommandBuilder commandBuilder = new SQLiteCommandBuilder(adapter);
// Update ncData
adapter.Update(ncAxes);
// Close the connection with database
sqlConnection.Close();
}
catch (Exception ex)
{
Console.WriteLine("ReadNcData exception: " + ex.Message);
}
UpdateDatabaseFromGridView(ncAxes, READ_NC_AXES_QUERY);
}
#endregion Nc Axes Data
@@ -437,27 +414,7 @@ namespace Nc_Demo_Application.Database
public void UpdateBinaryMemory(DataTable binaryMemory)
{
try
{
SetConnection();
// Open the connection with database
sqlConnection.Open();
// Create a SQLite command with query, adapter and commandbuilder in order to update.
sqlCommand = new SQLiteCommand(READ_BINARY_MEMORY_QUERY, sqlConnection);
SQLiteDataAdapter adapter = new SQLiteDataAdapter(sqlCommand);
SQLiteCommandBuilder commandBuilder = new SQLiteCommandBuilder(adapter);
// Update ncData
adapter.Update(binaryMemory);
// Close the connection with database
sqlConnection.Close();
}
catch (Exception ex)
{
Console.WriteLine("ReadNcData exception: " + ex.Message);
}
UpdateDatabaseFromGridView(binaryMemory, READ_BINARY_MEMORY_QUERY);
}
public byte GetByteValue(int index)
@@ -596,6 +553,135 @@ namespace Nc_Demo_Application.Database
#endregion Binary Memory
#region Families
public DataTable ReadFamilies()
{
try
{
ReadDataFromDatabase(READ_FAMILIES_QUERY, ref FamiliesDataTable);
return FamiliesDataTable;
}
catch (Exception ex)
{
Console.WriteLine("Read Families exception: " + ex.Message);
return null;
}
}
public List<FamilyModel> GetFamilies()
{
int lastId = 0;
List<FamilyModel> Family = new List<FamilyModel>();
foreach (DataRow row in FamiliesDataTable.Rows)
{
if (Convert.IsDBNull(row["id"]))
lastId = lastId + 1;
else
lastId = Convert.ToInt32(row["id"]);
string name = row["name"].ToString();
List<ChildTool> childTools = GetToolsData()
.Where(x => x.FamilyName == name)
.Select(x => new ChildTool()
{
id = x.Id,
childId = x.ChildId,
type = x.ToolType
})
.ToList();
// Convert DataTable.row into family model
FamilyModel tmpFamily = new FamilyModel
{
id = lastId,
name = name,
//childTools = childTools
};
Family.Add(tmpFamily);
}
return Family;
}
public void UpdateFamilies(DataTable families)
{
UpdateDatabaseFromGridView(families, READ_FAMILIES_QUERY);
}
public void UpdateFamily(FamilyModel familyData)
{
DataRow row = FamiliesDataTable.AsEnumerable().SingleOrDefault(x => Convert.ToInt32(x["id"]) == familyData.id);
row["name"] = familyData.name;
UpdateFamilies(FamiliesDataTable);
}
#endregion Families
#region Shanks
public DataTable ReadShanks()
{
try
{
ReadDataFromDatabase(READ_SHANKS_QUERY, ref ShanksDataTable);
return ShanksDataTable;
}
catch (Exception ex)
{
Console.WriteLine("Read Shanks exception: " + ex.Message);
return null;
}
}
public List<ShankDataModel> GetShanks()
{
int lastId = 0;
List<ShankDataModel> shanks = new List<ShankDataModel>();
foreach (DataRow row in ShanksDataTable.Rows)
{
if (Convert.IsDBNull(row["id"]))
lastId = lastId + 1;
else
lastId = Convert.ToInt32(row["id"]);
// Create&Populate shanks childs
int i = 1;
List<ShankChildDataModel> childTools = GetToolsData()
.Where(x => x.ShanksId == lastId)
.Select(x => new ShankChildDataModel()
{
ToolId = x.Id,
Type = x.ToolType,
FamilyName = x.FamilyName,
ChildId = i++
})
.ToList();
// Convert DataTable.row into family model
ShankDataModel tmpShank = new ShankDataModel
{
Id = lastId,
childsTools = childTools
};
shanks.Add(tmpShank);
}
return shanks;
}
public void UpdateShanks(DataTable shanks)
{
UpdateDatabaseFromGridView(shanks, READ_SHANKS_QUERY);
}
#endregion Shanks
#region Tools
public List<ToolsDataModel> ReadTools()
@@ -626,11 +712,12 @@ namespace Nc_Demo_Application.Database
MagazineId = Convert.ToInt32(row["magazine"]),
FamilyName = row["family"].ToString(),
ChildId = Convert.ToInt32(row["childId"]),
MagazinePositionType = Convert.ToInt32(row["magazinePositionType"]),
MagazinePositionType = Convert.ToInt32(row["magazinePositionType"]),
ToolType = Convert.ToInt32(row["toolType"]),
LeftSize = Convert.ToInt32(row["sizeLeft"]),
RightSize = Convert.ToInt32(row["sizeRight"]),
Rotation = Convert.ToInt32(row["rotation"]),
ShanksId = Convert.ToInt32(row["shankId"]),
Cooling1 = Convert.ToInt32(row["cooling1"]) == 1,
Cooling2 = Convert.ToInt32(row["cooling2"]) == 1,
IsActive = Convert.ToInt32(row["isActive"]) == 1,
@@ -665,7 +752,7 @@ namespace Nc_Demo_Application.Database
// DataRow row = ToolsDataTable.AsEnumerable().SingleOrDefault(x => Convert.ToInt32(x["id"]) == toolData.Id);
DataRow row = ToolsDataTable.NewRow();
toolData.Id = Convert.ToInt32(ToolsDataTable.Rows[ToolsDataTable.Rows.Count - 1]["id"]) + 1;
// Setup autoincrement Id
row["id"] = toolData.Id;
row["family"] = toolData.FamilyName;
@@ -716,12 +803,13 @@ namespace Nc_Demo_Application.Database
// Create new row that must be inserted
DataRow row = ToolsDataTable.AsEnumerable().SingleOrDefault(x => Convert.ToInt32(x["id"]) == toolData.Id);
row["family"] = toolData.FamilyName;
row["magazine"] = toolData.MagazineId;
row["magazinePositionType"] = toolData.MagazinePositionType;
row["childId"] = toolData.ChildId;
row["toolType"] = toolData.ToolType;
row["shankId"] = toolData.ShanksId;
row["sizeLeft"] = toolData.LeftSize;
row["sizeRight"] = toolData.RightSize;
row["rotation"] = toolData.Rotation;
@@ -777,5 +865,49 @@ namespace Nc_Demo_Application.Database
}
#endregion Tools
#region Magazines
public DataTable ReadMagazines()
{
try
{
ReadDataFromDatabase(READ_MAGAZINES_QUERY, ref MagazinesDataTable);
return MagazinesDataTable;
}
catch (Exception ex)
{
Console.WriteLine("Read magazines exception: " + ex.Message);
return null;
}
}
public void UpdateMagazines(DataTable magazines)
{
UpdateDatabaseFromGridView(magazines, READ_MAGAZINES_QUERY);
}
public List<PositionsDataModel> GetPositions()
{
List<PositionsDataModel> positions = new List<PositionsDataModel>();
foreach (DataRow row in MagazinesDataTable.Rows)
{
// Convert DataTable.row into family model
PositionsDataModel tmpPositions = new PositionsDataModel
{
Id = Convert.ToInt32(row["positionId"]),
MagazineId = Convert.ToInt32(row["magazineId"]),
Type = Convert.ToInt32(row["type"]),
};
positions.Add(tmpPositions);
}
return positions;
}
#endregion Magazines
}
}
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Nc_Demo_Application.Database.Models
{
public class FamilyModel
{
public int id;
public string name;
public List<ChildTool> childTools;
}
public class ChildTool
{
public int id;
public int type;
public int childId;
}
}
@@ -0,0 +1,49 @@
using System.Collections.Generic;
namespace Nc_Demo_Application.Database.Models
{
public class ToolsDataModel
{
public int Id;
public int MagazineId;
public string FamilyName;
public int ChildId;
public int MagazinePositionType;
public int ToolType;
public int LeftSize;
public int RightSize;
public int Rotation;
public bool Cooling1;
public bool Cooling2;
public bool IsActive;
public bool FixedPlace;
public bool IsInhibited;
public bool IsMeasured;
public bool ChangeTool;
public bool IsInUse;
public bool PreAlarm;
public int ShanksId;
public List<Dictionary<string, double>> EdgesData;
}
public class ShankDataModel
{
public int Id;
public List<ShankChildDataModel> childsTools;
}
public class ShankChildDataModel
{
public int ToolId;
public int ChildId;
public string FamilyName;
public int Type;
}
public class PositionsDataModel
{
public int Id;
public int MagazineId;
public int Type;
}
}
@@ -161,11 +161,27 @@ namespace Nc_Demo_Application.Server.Service
#endregion
#region Family
[WebGet(UriTemplate = "tool_table/families", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetFamilies(out List<FamilyModel> families);
[WebInvoke(Method = "PUT", UriTemplate = "tool_table/families", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)]
void PutFamily(FamilyModel familyData);
#endregion
#region Tools
[WebGet(UriTemplate = "tool_table", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetTools(out List<ToolsDataModel> toolsData);
[WebGet(UriTemplate = "tool_table/shanks", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetShanks(out List<ShankDataModel> shanksData);
[WebGet(UriTemplate = "tool_table/positions", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json)]
void GetPositions(out List<PositionsDataModel> positionsData);
#endregion
}
}
@@ -452,8 +452,23 @@ namespace Nc_Demo_Application.Server.Service
.ToDictionary(y => i++, y => y[0]);
}
#endregion File Management
#region Family
public void GetFamilies(out List<FamilyModel> families)
{
families = DatabaseController.getInstance().GetFamilies();
}
public void PutFamily(FamilyModel familyData)
{
DatabaseController.getInstance().UpdateFamily(familyData);
}
#endregion
#region Tools
public void GetTools(out List<ToolsDataModel> toolsData)
@@ -461,6 +476,16 @@ namespace Nc_Demo_Application.Server.Service
toolsData = DatabaseController.getInstance().ReadTools();
}
public void GetShanks(out List<ShankDataModel> shanksData)
{
shanksData = DatabaseController.getInstance().GetShanks();
}
public void GetPositions(out List<PositionsDataModel> positionsData)
{
positionsData = DatabaseController.getInstance().GetPositions();
}
#endregion
}
}
@@ -30,6 +30,11 @@ namespace Nc_Demo_Application
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
this.serverStatusLabel = new System.Windows.Forms.Label();
this.ncDataPage = new System.Windows.Forms.TabPage();
this.toolStrip5 = new Nc_Demo_Application.Views.ToolStripEx();
@@ -132,11 +137,30 @@ namespace Nc_Demo_Application
this.FamilyTxt = new System.Windows.Forms.TextBox();
this.toolsIdLlb = new System.Windows.Forms.Label();
this.toolNameTxt = new System.Windows.Forms.TextBox();
this.toolsTreeView = new System.Windows.Forms.TreeView();
this.toolStrip7 = new Nc_Demo_Application.Views.ToolStripEx();
this.removeTool = new System.Windows.Forms.ToolStripButton();
this.addTool = new System.Windows.Forms.ToolStripButton();
this.toolsTreeView = new System.Windows.Forms.TreeView();
this.familiesTab = new System.Windows.Forms.TabPage();
this.label18 = new System.Windows.Forms.Label();
this.shanksDataGridView = new System.Windows.Forms.DataGridView();
this.shanksId = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.label17 = new System.Windows.Forms.Label();
this.familiesDataGridView = new System.Windows.Forms.DataGridView();
this.id = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.toolStripEx1 = new Nc_Demo_Application.Views.ToolStripEx();
this.saveFamiliesButton = new System.Windows.Forms.ToolStripButton();
this.magazinesTab = new System.Windows.Forms.TabPage();
this.magazinesGridView = new System.Windows.Forms.DataGridView();
this.magazineId = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.positionId = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.positionType = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.toolStripEx2 = new Nc_Demo_Application.Views.ToolStripEx();
this.saveMagazinesButton = new System.Windows.Forms.ToolStripButton();
this.stopServer = new System.Windows.Forms.Button();
this.label19 = new System.Windows.Forms.Label();
this.shankIdTextBox = new System.Windows.Forms.TextBox();
this.ncDataPage.SuspendLayout();
this.toolStrip5.SuspendLayout();
this.ncTabControl.SuspendLayout();
@@ -156,6 +180,13 @@ namespace Nc_Demo_Application
this.toolStrip6.SuspendLayout();
this.toolsPage.SuspendLayout();
this.toolStrip7.SuspendLayout();
this.familiesTab.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.shanksDataGridView)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.familiesDataGridView)).BeginInit();
this.toolStripEx1.SuspendLayout();
this.magazinesTab.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.magazinesGridView)).BeginInit();
this.toolStripEx2.SuspendLayout();
this.SuspendLayout();
//
// serverStatusLabel
@@ -366,6 +397,8 @@ namespace Nc_Demo_Application
this.ncTabControl.Controls.Add(this.ncAxesPage);
this.ncTabControl.Controls.Add(this.byteMemoryPage);
this.ncTabControl.Controls.Add(this.partProgramPage);
this.ncTabControl.Controls.Add(this.magazinesTab);
this.ncTabControl.Controls.Add(this.familiesTab);
this.ncTabControl.Controls.Add(this.toolsPage);
this.ncTabControl.Location = new System.Drawing.Point(11, 14);
this.ncTabControl.Name = "ncTabControl";
@@ -429,6 +462,10 @@ namespace Nc_Demo_Application
// ncProcessIdColumn
//
this.ncProcessIdColumn.DataPropertyName = "id";
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.Color.Black;
this.ncProcessIdColumn.DefaultCellStyle = dataGridViewCellStyle1;
this.ncProcessIdColumn.HeaderText = "Process Id";
this.ncProcessIdColumn.Name = "ncProcessIdColumn";
this.ncProcessIdColumn.ReadOnly = true;
@@ -692,6 +729,10 @@ namespace Nc_Demo_Application
// BinaryMemoryAddressColumn
//
this.BinaryMemoryAddressColumn.DataPropertyName = "address";
dataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.Color.Black;
this.BinaryMemoryAddressColumn.DefaultCellStyle = dataGridViewCellStyle2;
this.BinaryMemoryAddressColumn.HeaderText = "Byte Address";
this.BinaryMemoryAddressColumn.Name = "BinaryMemoryAddressColumn";
this.BinaryMemoryAddressColumn.ReadOnly = true;
@@ -852,6 +893,8 @@ namespace Nc_Demo_Application
//
// toolsPage
//
this.toolsPage.Controls.Add(this.label19);
this.toolsPage.Controls.Add(this.shankIdTextBox);
this.toolsPage.Controls.Add(this.label16);
this.toolsPage.Controls.Add(this.magazinePositionTypeTxt);
this.toolsPage.Controls.Add(this.label15);
@@ -882,8 +925,8 @@ namespace Nc_Demo_Application
this.toolsPage.Controls.Add(this.FamilyTxt);
this.toolsPage.Controls.Add(this.toolsIdLlb);
this.toolsPage.Controls.Add(this.toolNameTxt);
this.toolsPage.Controls.Add(this.toolStrip7);
this.toolsPage.Controls.Add(this.toolsTreeView);
this.toolsPage.Controls.Add(this.toolStrip7);
this.toolsPage.Location = new System.Drawing.Point(4, 22);
this.toolsPage.Name = "toolsPage";
this.toolsPage.Padding = new System.Windows.Forms.Padding(3);
@@ -1115,7 +1158,7 @@ namespace Nc_Demo_Application
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(818, 93);
this.label8.Location = new System.Drawing.Point(739, 92);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(45, 13);
this.label8.TabIndex = 7;
@@ -1123,7 +1166,7 @@ namespace Nc_Demo_Application
//
// childIdTxt
//
this.childIdTxt.Location = new System.Drawing.Point(869, 90);
this.childIdTxt.Location = new System.Drawing.Point(790, 89);
this.childIdTxt.Name = "childIdTxt";
this.childIdTxt.Size = new System.Drawing.Size(49, 20);
this.childIdTxt.TabIndex = 6;
@@ -1131,7 +1174,7 @@ namespace Nc_Demo_Application
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(629, 93);
this.label7.Location = new System.Drawing.Point(577, 92);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(39, 13);
this.label7.TabIndex = 5;
@@ -1139,7 +1182,7 @@ namespace Nc_Demo_Application
//
// FamilyTxt
//
this.FamilyTxt.Location = new System.Drawing.Point(674, 90);
this.FamilyTxt.Location = new System.Drawing.Point(622, 89);
this.FamilyTxt.Name = "FamilyTxt";
this.FamilyTxt.Size = new System.Drawing.Size(102, 20);
this.FamilyTxt.TabIndex = 4;
@@ -1161,6 +1204,17 @@ namespace Nc_Demo_Application
this.toolNameTxt.Size = new System.Drawing.Size(100, 20);
this.toolNameTxt.TabIndex = 2;
//
// toolsTreeView
//
this.toolsTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.toolsTreeView.Location = new System.Drawing.Point(3, 31);
this.toolsTreeView.Name = "toolsTreeView";
this.toolsTreeView.Size = new System.Drawing.Size(163, 604);
this.toolsTreeView.TabIndex = 0;
this.toolsTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.ToolsTreeView_AfterSelect);
//
// toolStrip7
//
this.toolStrip7.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -1192,16 +1246,184 @@ namespace Nc_Demo_Application
this.addTool.Text = "toolStripButton1";
this.addTool.Click += new System.EventHandler(this.AddTool_Click);
//
// toolsTreeView
// familiesTab
//
this.toolsTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.toolsTreeView.Location = new System.Drawing.Point(3, 31);
this.toolsTreeView.Name = "toolsTreeView";
this.toolsTreeView.Size = new System.Drawing.Size(163, 604);
this.toolsTreeView.TabIndex = 0;
this.toolsTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.ToolsTreeView_AfterSelect);
this.familiesTab.Controls.Add(this.label18);
this.familiesTab.Controls.Add(this.shanksDataGridView);
this.familiesTab.Controls.Add(this.label17);
this.familiesTab.Controls.Add(this.familiesDataGridView);
this.familiesTab.Controls.Add(this.toolStripEx1);
this.familiesTab.Location = new System.Drawing.Point(4, 22);
this.familiesTab.Name = "familiesTab";
this.familiesTab.Padding = new System.Windows.Forms.Padding(3);
this.familiesTab.Size = new System.Drawing.Size(978, 641);
this.familiesTab.TabIndex = 7;
this.familiesTab.Text = "Families & Shanks";
this.familiesTab.UseVisualStyleBackColor = true;
//
// label18
//
this.label18.AutoSize = true;
this.label18.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F);
this.label18.Location = new System.Drawing.Point(627, 34);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(67, 20);
this.label18.TabIndex = 4;
this.label18.Text = "Shanks:";
//
// shanksDataGridView
//
this.shanksDataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.shanksDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.shanksDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.shanksId});
this.shanksDataGridView.Location = new System.Drawing.Point(624, 61);
this.shanksDataGridView.Name = "shanksDataGridView";
this.shanksDataGridView.Size = new System.Drawing.Size(291, 577);
this.shanksDataGridView.TabIndex = 3;
//
// shanksId
//
this.shanksId.DataPropertyName = "id";
this.shanksId.HeaderText = "Id";
this.shanksId.Name = "shanksId";
//
// label17
//
this.label17.AutoSize = true;
this.label17.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F);
this.label17.Location = new System.Drawing.Point(6, 34);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(110, 20);
this.label17.TabIndex = 2;
this.label17.Text = "Families Data:";
//
// familiesDataGridView
//
this.familiesDataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.familiesDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.familiesDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.id,
this.name});
this.familiesDataGridView.Location = new System.Drawing.Point(3, 61);
this.familiesDataGridView.Name = "familiesDataGridView";
this.familiesDataGridView.Size = new System.Drawing.Size(457, 584);
this.familiesDataGridView.TabIndex = 1;
//
// id
//
this.id.DataPropertyName = "id";
dataGridViewCellStyle5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
dataGridViewCellStyle5.SelectionForeColor = System.Drawing.Color.Black;
this.id.DefaultCellStyle = dataGridViewCellStyle5;
this.id.HeaderText = "Id";
this.id.Name = "id";
this.id.ReadOnly = true;
//
// name
//
this.name.DataPropertyName = "name";
this.name.HeaderText = "Name";
this.name.Name = "name";
//
// toolStripEx1
//
this.toolStripEx1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.saveFamiliesButton});
this.toolStripEx1.Location = new System.Drawing.Point(3, 3);
this.toolStripEx1.Name = "toolStripEx1";
this.toolStripEx1.Size = new System.Drawing.Size(972, 25);
this.toolStripEx1.TabIndex = 0;
this.toolStripEx1.Text = "toolStripEx1";
//
// saveFamiliesButton
//
this.saveFamiliesButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.saveFamiliesButton.Image = global::Nc_Demo_Application.Properties.Resources.saveButton;
this.saveFamiliesButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.saveFamiliesButton.Name = "saveFamiliesButton";
this.saveFamiliesButton.Size = new System.Drawing.Size(23, 22);
this.saveFamiliesButton.Click += new System.EventHandler(this.SaveFamiliesButton_Click);
//
// magazinesTab
//
this.magazinesTab.Controls.Add(this.magazinesGridView);
this.magazinesTab.Controls.Add(this.toolStripEx2);
this.magazinesTab.Location = new System.Drawing.Point(4, 22);
this.magazinesTab.Name = "magazinesTab";
this.magazinesTab.Padding = new System.Windows.Forms.Padding(3);
this.magazinesTab.Size = new System.Drawing.Size(978, 641);
this.magazinesTab.TabIndex = 8;
this.magazinesTab.Text = "Magazines";
this.magazinesTab.UseVisualStyleBackColor = true;
//
// magazinesGridView
//
this.magazinesGridView.AllowUserToAddRows = false;
this.magazinesGridView.AllowUserToDeleteRows = false;
this.magazinesGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.magazinesGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.magazinesGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.magazineId,
this.positionId,
this.positionType});
this.magazinesGridView.Location = new System.Drawing.Point(0, 31);
this.magazinesGridView.Name = "magazinesGridView";
this.magazinesGridView.Size = new System.Drawing.Size(978, 607);
this.magazinesGridView.TabIndex = 0;
//
// magazineId
//
this.magazineId.DataPropertyName = "magazineId";
dataGridViewCellStyle3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.Black;
this.magazineId.DefaultCellStyle = dataGridViewCellStyle3;
this.magazineId.FillWeight = 105.2829F;
this.magazineId.HeaderText = "Magazine Id";
this.magazineId.Name = "magazineId";
this.magazineId.ReadOnly = true;
this.magazineId.Resizable = System.Windows.Forms.DataGridViewTriState.False;
//
// positionId
//
this.positionId.DataPropertyName = "positionId";
dataGridViewCellStyle4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
dataGridViewCellStyle4.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
dataGridViewCellStyle4.SelectionForeColor = System.Drawing.Color.Black;
this.positionId.DefaultCellStyle = dataGridViewCellStyle4;
this.positionId.FillWeight = 94.61015F;
this.positionId.HeaderText = "Position Id";
this.positionId.Name = "positionId";
this.positionId.ReadOnly = true;
//
// positionType
//
this.positionType.DataPropertyName = "type";
this.positionType.FillWeight = 100.1069F;
this.positionType.HeaderText = "Type";
this.positionType.Name = "positionType";
//
// toolStripEx2
//
this.toolStripEx2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.saveMagazinesButton});
this.toolStripEx2.Location = new System.Drawing.Point(3, 3);
this.toolStripEx2.Name = "toolStripEx2";
this.toolStripEx2.Size = new System.Drawing.Size(972, 25);
this.toolStripEx2.TabIndex = 1;
this.toolStripEx2.Text = "toolStripEx2";
//
// saveMagazinesButton
//
this.saveMagazinesButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.saveMagazinesButton.Image = global::Nc_Demo_Application.Properties.Resources.saveButton;
this.saveMagazinesButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.saveMagazinesButton.Name = "saveMagazinesButton";
this.saveMagazinesButton.Size = new System.Drawing.Size(23, 22);
this.saveMagazinesButton.Text = "Save";
this.saveMagazinesButton.Click += new System.EventHandler(this.SaveMagazinesButton_Click);
//
// stopServer
//
@@ -1214,6 +1436,22 @@ namespace Nc_Demo_Application
this.stopServer.UseVisualStyleBackColor = true;
this.stopServer.Click += new System.EventHandler(this.StopServer_Click);
//
// label19
//
this.label19.AutoSize = true;
this.label19.Location = new System.Drawing.Point(845, 92);
this.label19.Name = "label19";
this.label19.Size = new System.Drawing.Size(53, 13);
this.label19.TabIndex = 33;
this.label19.Text = "Shank Id:";
//
// shankIdTextBox
//
this.shankIdTextBox.Location = new System.Drawing.Point(904, 89);
this.shankIdTextBox.Name = "shankIdTextBox";
this.shankIdTextBox.Size = new System.Drawing.Size(49, 20);
this.shankIdTextBox.TabIndex = 32;
//
// DemoApplicationForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -1260,6 +1498,17 @@ namespace Nc_Demo_Application
this.toolsPage.PerformLayout();
this.toolStrip7.ResumeLayout(false);
this.toolStrip7.PerformLayout();
this.familiesTab.ResumeLayout(false);
this.familiesTab.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.shanksDataGridView)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.familiesDataGridView)).EndInit();
this.toolStripEx1.ResumeLayout(false);
this.toolStripEx1.PerformLayout();
this.magazinesTab.ResumeLayout(false);
this.magazinesTab.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.magazinesGridView)).EndInit();
this.toolStripEx2.ResumeLayout(false);
this.toolStripEx2.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@@ -1315,11 +1564,6 @@ namespace Nc_Demo_Application
private System.Windows.Forms.ToolStripButton addRowsBinaryMemory;
private System.Windows.Forms.ToolStripButton deleteRowsBinaryMemory;
private System.Windows.Forms.DataGridView binaryMemoryGridView;
private System.Windows.Forms.DataGridViewTextBoxColumn BinaryMemoryAddressColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn BinaryMemoryDecimalColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn BinaryMemoryBinaryColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn BinaryMemoryWordColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn BinaryMemoryIntegerColumn;
private System.Windows.Forms.TabPage partProgramPage;
private System.Windows.Forms.TextBox fileContentTextBox;
private System.Windows.Forms.ToolStripButton saveFileButton;
@@ -1328,11 +1572,6 @@ namespace Nc_Demo_Application
private System.Windows.Forms.ToolStripTextBox newFileNameTextBox;
private System.Windows.Forms.TreeView fileTreeView;
private System.Windows.Forms.Button stopServer;
private System.Windows.Forms.DataGridViewTextBoxColumn ncProcessIdColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn ProcessPartProgram;
private System.Windows.Forms.DataGridViewTextBoxColumn ncProcessNameColumn;
private System.Windows.Forms.DataGridViewComboBoxColumn ncProcessStatusColumn;
private System.Windows.Forms.DataGridViewComboBoxColumn ncProcessModeColumn;
private System.Windows.Forms.LinkLabel openDoc;
private System.Windows.Forms.TabPage toolsPage;
private ToolStripEx toolStrip7;
@@ -1374,6 +1613,35 @@ namespace Nc_Demo_Application
private System.Windows.Forms.Label label15;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.TextBox magazinePositionTypeTxt;
private System.Windows.Forms.TabPage familiesTab;
private System.Windows.Forms.DataGridView familiesDataGridView;
private ToolStripEx toolStripEx1;
private System.Windows.Forms.ToolStripButton saveFamiliesButton;
private System.Windows.Forms.DataGridView shanksDataGridView;
private System.Windows.Forms.DataGridViewTextBoxColumn shanksId;
private System.Windows.Forms.Label label17;
private System.Windows.Forms.Label label18;
private System.Windows.Forms.TabPage magazinesTab;
private System.Windows.Forms.DataGridView magazinesGridView;
private System.Windows.Forms.DataGridViewTextBoxColumn magazineId;
private System.Windows.Forms.DataGridViewTextBoxColumn positionId;
private System.Windows.Forms.DataGridViewTextBoxColumn positionType;
private System.Windows.Forms.DataGridViewTextBoxColumn id;
private System.Windows.Forms.DataGridViewTextBoxColumn name;
private System.Windows.Forms.DataGridViewTextBoxColumn BinaryMemoryAddressColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn BinaryMemoryDecimalColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn BinaryMemoryBinaryColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn BinaryMemoryWordColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn BinaryMemoryIntegerColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn ncProcessIdColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn ProcessPartProgram;
private System.Windows.Forms.DataGridViewTextBoxColumn ncProcessNameColumn;
private System.Windows.Forms.DataGridViewComboBoxColumn ncProcessStatusColumn;
private System.Windows.Forms.DataGridViewComboBoxColumn ncProcessModeColumn;
private ToolStripEx toolStripEx2;
private System.Windows.Forms.ToolStripButton saveMagazinesButton;
private System.Windows.Forms.Label label19;
private System.Windows.Forms.TextBox shankIdTextBox;
}
}
@@ -43,7 +43,7 @@ namespace Nc_Demo_Application
startupPanel.Visible = !visible;
}
public void startServer(int port)
public void StartServer(int port)
{
SERVER_PORT = port.ToString();
try
@@ -66,6 +66,8 @@ namespace Nc_Demo_Application
FillNcAlarmsInput();
FillNAxisInput();
FillBinaryMemoryInput();
FillFamilyInput();
FillMagazineInput();
ReadPartProgramDirectory("./part_program");
FillToolsInput();
@@ -139,6 +141,24 @@ namespace Nc_Demo_Application
binaryMemoryGridView.DataSource = binaryMemoryData;
}
private void FillFamilyInput()
{
// Insert families data into grid view
DataTable families = DatabaseController.getInstance().ReadFamilies();
familiesDataGridView.DataSource = families;
// Insert shanks data into grid View
DataTable shanks = DatabaseController.getInstance().ReadShanks();
shanksDataGridView.DataSource = shanks;
}
private void FillMagazineInput()
{
// Insert magazines data into grid view
DataTable magazines = DatabaseController.getInstance().ReadMagazines();
magazinesGridView.DataSource = magazines;
}
private void FillToolsInput()
{
List<ToolsDataModel> toolsData = DatabaseController.getInstance().ReadTools();
@@ -174,6 +194,7 @@ namespace Nc_Demo_Application
private void SaveNcAlarmsButton_Click(object sender, EventArgs e)
{
DatabaseController.getInstance().UpdateNcAlarms((DataTable)ncAlarmsGridView.DataSource);
FillNcAlarmsInput();
}
private void SaveNcAxesButton_Click(object sender, EventArgs e)
@@ -512,6 +533,7 @@ namespace Nc_Demo_Application
ChildId = 1,
MagazinePositionType = 1,
ToolType = 100,
ShanksId = 0,
LeftSize = 1,
RightSize = 1,
Cooling1 = false,
@@ -523,9 +545,9 @@ namespace Nc_Demo_Application
ChangeTool = false,
PreAlarm = false,
IsInUse = false,
IsInhibited = false,
IsInhibited = false
};
// Add to database
DatabaseController.getInstance().AddToolToDatabase(ref newTool);
// Add to treeView
@@ -584,6 +606,7 @@ namespace Nc_Demo_Application
leftSizeTxt.Text = toolInfo.LeftSize.ToString();
cooling1CheckBox.Checked = toolInfo.Cooling1;
cooling2CheckBox.Checked = toolInfo.Cooling2;
shankIdTextBox.Text = toolInfo.ShanksId.ToString();
isActiveCheckBox.Checked = toolInfo.IsActive;
fixedPlaceCheckBox.Checked = toolInfo.FixedPlace;
@@ -622,6 +645,7 @@ namespace Nc_Demo_Application
toolInfo.LeftSize = Convert.ToInt32(leftSizeTxt.Text);
toolInfo.Cooling1 = cooling1CheckBox.Checked;
toolInfo.Cooling2 = cooling2CheckBox.Checked;
toolInfo.ShanksId = Convert.ToInt32(shankIdTextBox.Text);
toolInfo.IsActive = isActiveCheckBox.Checked;
toolInfo.FixedPlace = fixedPlaceCheckBox.Checked;
@@ -636,5 +660,21 @@ namespace Nc_Demo_Application
DatabaseController.getInstance().UpdateToolData(toolInfo);
}
private void SaveFamiliesButton_Click(object sender, EventArgs e)
{
// Save families
DatabaseController.getInstance().UpdateFamilies((DataTable)familiesDataGridView.DataSource);
// Save shanks
DatabaseController.getInstance().UpdateShanks((DataTable)shanksDataGridView.DataSource);
// Update UI
FillFamilyInput();
}
private void SaveMagazinesButton_Click(object sender, EventArgs e)
{
DatabaseController.getInstance().UpdateMagazines((DataTable)magazinesGridView.DataSource);
}
}
}
@@ -135,6 +135,30 @@
<metadata name="toolStrip6.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>542, 17</value>
</metadata>
<metadata name="magazineId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="positionId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="positionType.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="toolStripEx2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>869, 17</value>
</metadata>
<metadata name="shanksId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="toolStripEx1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>752, 17</value>
</metadata>
<metadata name="toolStrip7.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>647, 17</value>
</metadata>
@@ -19,7 +19,7 @@ namespace Nc_Demo_Application.Views
private void startupButton_Click(object sender, EventArgs e)
{
((DemoApplicationForm)Parent).startServer(Convert.ToInt32(portTextBox.Text));
((DemoApplicationForm)Parent).StartServer(Convert.ToInt32(portTextBox.Text));
}
}
}