Added OriginPosition

Fixed fanuc TT
& Minorfixes
This commit is contained in:
Lucio Maranta
2018-11-30 13:26:46 +01:00
parent 00c7297ee2
commit 0f15f2e367
17 changed files with 202 additions and 175 deletions
Binary file not shown.
+1 -1
View File
@@ -127,7 +127,7 @@ namespace Step.Config
{
ExceptionManager.Manage(ERROR_LEVEL.FATAL,
// "Error while reading file: " + e.Exception.SourceUri +
"\n Error while reading configuration file: " + e.Message
"Error while reading configuration file: " + e.Message
);
}
}
@@ -147,14 +147,6 @@ namespace Step.Database.Controllers
List<DTONcShankModel> dtoShanks = dbShanks
.Select(x => (DTONcShankModel)x)
.ToList();
// new List<DTONcShankModel>();
//foreach (var shank in dbShanks)
//{
// //dbCtx.Shanks.Attach(shank);
// DTONcShankModel dtoShank = (DTONcShankModel)shank;
// dtoShanks.Add(dtoShank);
//}
return dtoShanks;
}
@@ -447,7 +439,10 @@ namespace Step.Database.Controllers
// Set ids with new positions
shank.MagazineId = magazineId;
shank.PositionId = positionId;
// Set original Ids
shank.OriginMagazineId = magazineId;
shank.OriginPositionId = positionId;
dbCtx.SaveChanges();
return FindMagazinePosition(magazineId, positionId);
@@ -459,6 +454,9 @@ namespace Step.Database.Controllers
// set id to null
shank.MagazineId = null;
shank.PositionId = null;
shank.OriginMagazineId = null;
shank.OriginPositionId = null;
dbCtx.SaveChanges();
File diff suppressed because one or more lines are too long
@@ -13,7 +13,7 @@ namespace Step.Database.Migrations
string IMigrationMetadata.Id
{
get { return "201811141155184_InitMigration"; }
get { return "201811300854588_InitMigration"; }
}
string IMigrationMetadata.Source
@@ -143,10 +143,12 @@ namespace Step.Database.Migrations
c => new
{
magazine_id = c.Byte(),
position_id = c.Byte(),
position_id = c.Int(),
id = c.Short(nullable: false),
balluf = c.Int(),
magazine_position_type = c.Byte(nullable: false),
origin_magazine_id = c.Byte(),
origin_position_id = c.Int(),
})
.PrimaryKey(t => t.id)
.ForeignKey("dbo.magazine_position", t => new { t.magazine_id, t.position_id })
@@ -157,7 +159,7 @@ namespace Step.Database.Migrations
c => new
{
magazine_id = c.Byte(nullable: false),
position_id = c.Byte(nullable: false),
position_id = c.Int(nullable: false),
type = c.Byte(nullable: false),
disabled = c.Boolean(nullable: false),
})
File diff suppressed because one or more lines are too long
+13 -13
View File
@@ -25,22 +25,22 @@ namespace Step.Database.Migrations
);
context.FunctionsAccess.AddOrUpdate(
// General Function
new FunctionAccessModel() { Name = GENERAL, Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 100, ReadLevelMin = 1, PlcId = 0 },
new FunctionAccessModel() { Name = USER_FUNCTIONS, Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 0 },
new FunctionAccessModel() { Name = NC_DATA, Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 10, ReadLevelMin = 1, PlcId = 0 },
new FunctionAccessModel() { Name = ALARM_CMD, Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 1 },
new FunctionAccessModel() { Name = STARTUP_ICONS, Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 2 },
// General Function, if plcId is 0 then the functionality is not connected to the NC
new FunctionAccessModel() { Name = GENERAL, Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 100, ReadLevelMin = 1, PlcId = 0},
new FunctionAccessModel() { Name = USER_FUNCTIONS, Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 0},
new FunctionAccessModel() { Name = NC_DATA, Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 10, ReadLevelMin = 1, PlcId = 0},
new FunctionAccessModel() { Name = ALARM_CMD, Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 1},
new FunctionAccessModel() { Name = STARTUP_ICONS, Area = GENERAL_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 2},
// Under hood
new FunctionAccessModel() { Name = PROCESS_CMD, Area = UNDER_HOOD, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 3 },
new FunctionAccessModel() { Name = NC_SOFTKEY, Area = UNDER_HOOD, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 4 },
new FunctionAccessModel() { Name = USER_SOFTKEY, Area = UNDER_HOOD, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 5 },
new FunctionAccessModel() { Name = HEADS_CMD, Area = UNDER_HOOD, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 6 },
new FunctionAccessModel() { Name = AXES_SELECTION, Area = UNDER_HOOD, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 7 },
new FunctionAccessModel() { Name = PROCESS_CMD, Area = UNDER_HOOD, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 3},
new FunctionAccessModel() { Name = NC_SOFTKEY, Area = UNDER_HOOD, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 4},
new FunctionAccessModel() { Name = USER_SOFTKEY, Area = UNDER_HOOD, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 5},
new FunctionAccessModel() { Name = HEADS_CMD, Area = UNDER_HOOD, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 6},
new FunctionAccessModel() { Name = AXES_SELECTION, Area = UNDER_HOOD, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 7},
new FunctionAccessModel() { Name = TOOL_MANAGER, Area = TOOLING_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 8 },
new FunctionAccessModel() { Name = MAINTENANCE, Area = MAINTENANCE_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 9 }
new FunctionAccessModel() { Name = TOOL_MANAGER, Area = TOOLING_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 8},
new FunctionAccessModel() { Name = MAINTENANCE, Area = MAINTENANCE_KEY, Enabled = true, WriteLevelMin = 1, ReadLevelMin = 1, PlcId = 9}
);
context.SaveChanges();
+5 -5
View File
@@ -81,9 +81,9 @@
<Compile Include="Controllers\MachinesUsersController.cs" />
<Compile Include="Controllers\UserSoftkeysController.cs" />
<Compile Include="DatabaseContext.cs" />
<Compile Include="Migrations\201811141155184_InitMigration.cs" />
<Compile Include="Migrations\201811141155184_InitMigration.Designer.cs">
<DependentUpon>201811141155184_InitMigration.cs</DependentUpon>
<Compile Include="Migrations\201811300854588_InitMigration.cs" />
<Compile Include="Migrations\201811300854588_InitMigration.Designer.cs">
<DependentUpon>201811300854588_InitMigration.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\Configuration.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -119,8 +119,8 @@
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Migrations\201811141155184_InitMigration.resx">
<DependentUpon>201811141155184_InitMigration.cs</DependentUpon>
<EmbeddedResource Include="Migrations\201811300854588_InitMigration.resx">
<DependentUpon>201811300854588_InitMigration.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
@@ -12,7 +12,7 @@ namespace Step.Model.DTOModels.ToolModels
{
public byte MagazineId { get; set; }
public byte PositionId { get; set; }
public int PositionId { get; set; }
[Required]
public bool Disabled { get; set; }
@@ -38,9 +38,15 @@ namespace Step.Model.DTOModels.ToolModels
[Range(1, byte.MaxValue)]
public byte? MagazineId { get; set; }
[Range(1, ushort.MaxValue)]
public int? PositionId { get; set; }
[Range(1, byte.MaxValue)]
public byte? PositionId { get; set; }
public byte? OriginMagazineId { get; set; }
[Range(1, ushort.MaxValue)]
public int? OriginPositionId { get; set; }
public List<DTONcToolModel> ChildsTools { get; set; }
public static explicit operator DTONcShankModel(DbNcShankModel obj)
@@ -60,6 +66,8 @@ namespace Step.Model.DTOModels.ToolModels
MagazinePositionType = obj.MagazinePositionType,
MagazineId = obj.MagazineId,
PositionId = obj.PositionId,
OriginMagazineId = obj.OriginMagazineId,
OriginPositionId = obj.OriginPositionId,
ChildsTools = tools
};
}
@@ -72,7 +80,9 @@ namespace Step.Model.DTOModels.ToolModels
Balluf = obj.Balluf,
MagazinePositionType = obj.MagazinePositionType,
MagazineId = obj.MagazineId,
PositionId = obj.PositionId
PositionId = obj.PositionId,
OriginMagazineId = obj.OriginMagazineId,
OriginPositionId = obj.OriginPositionId,
};
}
}
@@ -12,7 +12,7 @@ namespace Step.Model.DatabaseModels
public byte MagazineId { get; set; }
[Key, Column("position_id", Order = 1)]
public byte PositionId { get; set; }
public int PositionId { get; set; }
[Column("type")]
public byte Type { get; set; }
@@ -25,7 +25,7 @@ namespace Step.Model.DatabaseModels
return new NcMagazinePositionModel()
{
MagazineId = obj.MagazineId,
PositionId = obj.PositionId,
PositionId = (ushort)obj.PositionId,
Disabled = obj.Disabled ? (byte)1 : (byte)0,
Type = obj.Type
};
+11 -2
View File
@@ -24,7 +24,14 @@ namespace Step.Model.DatabaseModels
public byte? MagazineId { get; set; }
[ForeignKey("MagazinePosition"), Column("position_id", Order = 1)]
public byte? PositionId { get; set; }
public int? PositionId { get; set; }
[Column("origin_magazine_id")]
public byte? OriginMagazineId { get; set; }
[Column("origin_position_id")]
public int? OriginPositionId { get; set; }
public DbNcMagazinePositionModel MagazinePosition { get; set; }
@@ -37,8 +44,10 @@ namespace Step.Model.DatabaseModels
ShankId = (ushort)obj.ShankId,
Balluf = obj.Balluf == null ? (ushort)0 : (ushort)obj.Balluf.Value,
MagazineId = obj.MagazineId == null ? (byte)0 : obj.MagazineId.Value,
PositionId = obj.PositionId == null ? (byte)0 : obj.PositionId.Value,
PositionId = obj.PositionId == null ? (ushort)0 : (ushort)obj.PositionId.Value,
MagazinePositionType = obj.MagazinePositionType,
OriginMagazineId = obj.OriginMagazineId == null ? (byte)0 : obj.OriginMagazineId.Value,
OriginPositionId = obj.OriginPositionId == null ? (ushort)0 : (ushort)obj.OriginPositionId.Value,
};
}
}
+6 -2
View File
@@ -15,6 +15,7 @@ using Step.Utils;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
@@ -2229,7 +2230,7 @@ namespace Step.NC
.Where(x => x.MagazineId != null)
.Select(x => (NcShankModel)x)
.ToList();
// Update shanks
CmsError cmsError = numericalControl.TOOLS_WUpdateShanks(shanks);
if (cmsError.IsError())
return cmsError;
@@ -2238,6 +2239,7 @@ namespace Step.NC
List<NcMagazinePositionModel> positions = toolsManager.FindMagazinesPositions()
.Select(x => (NcMagazinePositionModel)x)
.ToList();
// Update positions
cmsError = numericalControl.TOOLS_WUpdateMagazinePositions(positions);
if (cmsError.IsError())
return cmsError;
@@ -2250,15 +2252,17 @@ namespace Step.NC
.ToList();
// Update tools
cmsError = numericalControl.TOOLS_WUpdateTools(tools);
cmsError = numericalControl.TOOLS_WUpdateTools(tools);
if (cmsError.IsError())
return cmsError;
// Get families
List<NcFamilyModel> families = toolsManager
.FindFamilies()
.Select(x => (NcFamilyModel)x)
.Where(x => tools.Any(y => y.FamilyId == x.FamilyId)) // Find only families of mounted tools
.ToList();
// Update families
cmsError = numericalControl.TOOLS_WUpdateFamilies(families);
if (cmsError.IsError())
+3 -2
View File
@@ -131,12 +131,13 @@ namespace Step.Utils
public static string FindImageBase64String(string directoryPath, string imageName)
{
string fileName = Path.GetFileNameWithoutExtension(imageName);
foreach (string ext in VALID_IMAGE_EXTENSIONS)
{
if (File.Exists(directoryPath + "\\" + imageName + ext))
if (File.Exists(directoryPath + "\\" + fileName + ext))
{
// Convert image to a base 64 string
return "data:image/" + ext + ";base64," + Convert.ToBase64String(File.ReadAllBytes(directoryPath + "\\" + imageName + ext));
return "data:image/" + ext + ";base64," + Convert.ToBase64String(File.ReadAllBytes(directoryPath + "\\" + fileName + ext));
}
}
+9 -5
View File
@@ -80,11 +80,15 @@ namespace Step
if (functionAccess.WriteLevelMin > machineUser.Role.Level)
return false; // Not authorized
}
// Check if functionality is enabled by PLC
var functionalityIsEnabled = LastRuntimeFunctionality.Where(x => x.Name == functionName).FirstOrDefault();
if (functionalityIsEnabled == null || functionalityIsEnabled.Enabled == false)
return false;
// Check if PLC bit exists
if(functionAccess.PlcId != 0)
{
// Check if functionality is enabled by PLC
var functionalityIsEnabled = LastRuntimeFunctionality.Where(x => x.Name == functionName).FirstOrDefault();
if (functionalityIsEnabled == null || functionalityIsEnabled.Enabled == false)
return false;
}
}
else
return false;
+1 -2
View File
@@ -115,8 +115,7 @@ export class Hub {
private static activeProgramData(data) {
if(data.path != ""){
fileService.getActiveFileInfo(data.path).then(r => {
var image = r.previewBase64;
processModelActions.setCurrentProgramImage(store, image);
processModelActions.setCurrentProgramImage(store, r.image);
processModelActions.setCurrentProgramName(store, r.name);
});
}