Added user deletion
Refactored project warnings
This commit is contained in:
@@ -95,11 +95,10 @@ namespace Client.Config
|
||||
|
||||
private static ushort ValidateServerPort(String value)
|
||||
{
|
||||
ushort Port;
|
||||
if (ushort.TryParse(value, out Port))
|
||||
if (ushort.TryParse(value, out ushort Port))
|
||||
return Port;
|
||||
else
|
||||
throw new Exception(@"Configuration Error: ""Connection - ServerPort"" is not a valid Id of CMS-Client");
|
||||
throw new Exception(@"Configuration Error: ""Connection - ServerPort"" is not a valid Id of CMS-Client");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -109,6 +109,9 @@ namespace Step.Database.Controllers
|
||||
|
||||
if (user != null)
|
||||
{
|
||||
if (user.Deleted == true)
|
||||
return null;
|
||||
|
||||
// Check if the passwords match
|
||||
if (Crypto.VerifyHashedPassword(user.Password, password) != true)
|
||||
{
|
||||
@@ -181,6 +184,7 @@ namespace Step.Database.Controllers
|
||||
// Find user by Id with Role object included
|
||||
var tmpUser = dbCtx
|
||||
.Users
|
||||
.Where(x => x.Deleted == false) // Get not deleted users
|
||||
.ToList();
|
||||
|
||||
return tmpUser
|
||||
@@ -192,7 +196,8 @@ namespace Step.Database.Controllers
|
||||
LastName = x.LastName,
|
||||
Language = x.Language,
|
||||
Role = machineController.GetUserRoleData(MachineConfig.MachineId, x.UserId)
|
||||
}).ToList();
|
||||
})
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,6 +238,14 @@ namespace Step.Database.Controllers
|
||||
|
||||
return GetUserInfo(userId);
|
||||
}
|
||||
|
||||
public void DeleteUser(UserModel user)
|
||||
{
|
||||
user.Deleted = true;
|
||||
|
||||
dbCtx.SaveChanges();
|
||||
}
|
||||
|
||||
#endregion User Manager
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace Step.Database.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.2.0-61023")]
|
||||
public sealed partial class UserDeleteMigratin : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(UserDeleteMigratin));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "201904041054202_UserDeleteMigratin"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace Step.Database.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class UserDeleteMigratin : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.user", "deleted", c => c.Boolean(nullable: false));
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropColumn("dbo.user", "deleted");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -129,6 +129,10 @@
|
||||
<Compile Include="Migrations\201903070940012_InitMigrtion.Designer.cs">
|
||||
<DependentUpon>201903070940012_InitMigrtion.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\201904041054202_UserDeleteMigratin.cs" />
|
||||
<Compile Include="Migrations\201904041054202_UserDeleteMigratin.Designer.cs">
|
||||
<DependentUpon>201904041054202_UserDeleteMigratin.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\Configuration.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Redis\redUtil.cs" />
|
||||
@@ -171,6 +175,9 @@
|
||||
<EmbeddedResource Include="Migrations\201903070940012_InitMigrtion.resx">
|
||||
<DependentUpon>201903070940012_InitMigrtion.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\201904041054202_UserDeleteMigratin.resx">
|
||||
<DependentUpon>201904041054202_UserDeleteMigratin.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
||||
@@ -28,10 +28,9 @@ namespace Step.Model.DTOModels.AlarmModels
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var item = obj as DTOAlarmsModel;
|
||||
|
||||
// Object is not a DTOAlarmsModel instance
|
||||
if (item == null)
|
||||
if (!(obj is DTOAlarmsModel item))
|
||||
return false;
|
||||
|
||||
// If the numbers of the list's elemets are different, lists are different
|
||||
|
||||
@@ -7,8 +7,7 @@ namespace Step.Model.DTOModels
|
||||
{
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var item = obj as DTOActiveProgramDataModel;
|
||||
if (item == null)
|
||||
if (!(obj is DTOActiveProgramDataModel item))
|
||||
return false;
|
||||
|
||||
if (Path != item.Path)
|
||||
@@ -22,6 +21,11 @@ namespace Step.Model.DTOModels
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
public class DTOActiveImageAndNameDataModel
|
||||
|
||||
@@ -28,8 +28,7 @@ namespace Step.Model.DTOModels
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var item = obj as DTOAxesModel;
|
||||
if (item == null)
|
||||
if (!(obj is DTOAxesModel item))
|
||||
return false;
|
||||
|
||||
if (!CheckAxesDictionaries(interpolated, item.interpolated))
|
||||
@@ -68,7 +67,7 @@ namespace Step.Model.DTOModels
|
||||
// Check values are differen
|
||||
foreach (string k in x.Keys)
|
||||
{
|
||||
var a = Math.Abs(y[k] - x[k]);
|
||||
double a = Math.Abs(y[k] - x[k]);
|
||||
|
||||
if (Math.Round(a, 3) >= Constants.EPSILON)
|
||||
return false;
|
||||
|
||||
@@ -8,12 +8,11 @@ namespace Step.Model.DTOModels
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var item = obj as DTOAxisNameModel;
|
||||
|
||||
|
||||
// Object is not a DTOAxisNameModel instance
|
||||
if (item == null)
|
||||
if (!(obj is DTOAxisNameModel item))
|
||||
return false;
|
||||
|
||||
|
||||
if (item.Id != Id)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -18,10 +18,9 @@ namespace Step.Model.DTOModels
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var item = obj as DTOHeadModel;
|
||||
|
||||
// Object is not a DTOHeadModel instance or a child
|
||||
if (item == null)
|
||||
if (!(obj is DTOHeadModel item))
|
||||
return false;
|
||||
|
||||
if (Id != item.Id)
|
||||
@@ -76,10 +75,9 @@ namespace Step.Model.DTOModels
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var item = obj as DTOSpindleModel;
|
||||
|
||||
// Object is not a DTOSpindleModel
|
||||
if (item == null)
|
||||
if (!(obj is DTOSpindleModel item))
|
||||
return false;
|
||||
|
||||
// Compare the fields
|
||||
@@ -117,10 +115,9 @@ namespace Step.Model.DTOModels
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var item = obj as DTOAbrasiveWaterJet;
|
||||
|
||||
// Object is not a DTOSpindleModel
|
||||
if (item == null)
|
||||
if (!(obj is DTOAbrasiveWaterJet item))
|
||||
return false;
|
||||
|
||||
// Compare the fields
|
||||
@@ -150,10 +147,9 @@ namespace Step.Model.DTOModels
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var item = obj as DTOWaterJet;
|
||||
|
||||
// Object is not a DTOSpindleModel
|
||||
if (item == null)
|
||||
if (!(obj is DTOWaterJet item))
|
||||
return false;
|
||||
|
||||
// Compare the fields
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Step.Model.DTOModels
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var item = obj as DTONcSoftKeyModel;
|
||||
DTONcSoftKeyModel item = obj as DTONcSoftKeyModel;
|
||||
|
||||
if (Id != item.Id)
|
||||
return false;
|
||||
|
||||
@@ -18,9 +18,8 @@ namespace Step.Model.DTOModels
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var item = obj as DTOPowerOnDataModel;
|
||||
// Object is not a DTOPowerOnDataModel instance
|
||||
if (item == null)
|
||||
if (!(obj is DTOPowerOnDataModel item))
|
||||
return false;
|
||||
// If one field is different, objects are different
|
||||
if (!PrePowerOn.Equals(item.PrePowerOn) || !PostPowerOn.Equals(item.PostPowerOn) || !AxisReset.Equals(item.AxisReset))
|
||||
|
||||
@@ -25,11 +25,10 @@ namespace Step.Model.DTOModels
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var item = obj as DTOProcessesDataModel;
|
||||
// Object is not a DTOProcessDataModel instance
|
||||
if (item == null)
|
||||
return false;
|
||||
|
||||
if (!(obj is DTOProcessesDataModel item))
|
||||
return false;
|
||||
|
||||
if (IsRunning != item.IsRunning)
|
||||
return false;
|
||||
|
||||
@@ -76,9 +75,7 @@ namespace Step.Model.DTOModels
|
||||
{
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
ProcessModel item = obj as ProcessModel;
|
||||
|
||||
if (item == null)
|
||||
if (!(obj is ProcessModel item))
|
||||
return false;
|
||||
|
||||
if (Id != item.Id)
|
||||
@@ -106,10 +103,9 @@ namespace Step.Model.DTOModels
|
||||
{
|
||||
public new string Type;
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
DTOM155InputModel item = obj as DTOM155InputModel;
|
||||
|
||||
if (item == null)
|
||||
{
|
||||
|
||||
if (!(obj is DTOM155InputModel item))
|
||||
return false;
|
||||
|
||||
if (Process != item.Process)
|
||||
@@ -123,5 +119,10 @@ namespace Step.Model.DTOModels
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,8 +18,7 @@ namespace Step.Model.DTOModels
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var item = obj as DTOQueueModel;
|
||||
if (item == null)
|
||||
if (!(obj is DTOQueueModel item))
|
||||
return false;
|
||||
|
||||
if (Id != item.Id)
|
||||
@@ -39,5 +38,10 @@ namespace Step.Model.DTOModels
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,9 +12,8 @@
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var item = obj as DTORuntimeFunctionalityModel;
|
||||
// Object is not a DTORuntimeFunctionalityModel instance
|
||||
if (item == null)
|
||||
if (!(obj is DTORuntimeFunctionalityModel item))
|
||||
return false;
|
||||
|
||||
if (Id == item.Id && Enabled == item.Enabled) // Name Area don't change runtime
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Step.Model.DTOModels
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var item = obj as DTOUserSoftKeyModel;
|
||||
DTOUserSoftKeyModel item = obj as DTOUserSoftKeyModel;
|
||||
|
||||
if (Id != item.Id)
|
||||
return false;
|
||||
|
||||
@@ -13,9 +13,8 @@ namespace Step.Model.DTOModels
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var item = obj as DTOExpiredMaintenanceModel;
|
||||
// Object is not a DTOExpiredMaintenanceModel instance
|
||||
if (item == null)
|
||||
if (!(obj is DTOExpiredMaintenanceModel item))
|
||||
return false;
|
||||
|
||||
if (item.Id != Id)
|
||||
|
||||
@@ -24,8 +24,7 @@ namespace Step.Model.DTOModels.Scada
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var item = obj as DTOScadaModel;
|
||||
if (item == null)
|
||||
if (!(obj is DTOScadaModel item))
|
||||
return false;
|
||||
|
||||
if (item.Buttons.Count() != Buttons.Count() || item.Images.Count() != Images.Count() || item.ProgressBars.Count() != ProgressBars.Count() || item.Inputs.Count() != Inputs.Count())
|
||||
@@ -50,6 +49,11 @@ namespace Step.Model.DTOModels.Scada
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
//public class DTOScadaLayerModel
|
||||
@@ -76,8 +80,7 @@ namespace Step.Model.DTOModels.Scada
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var item = obj as DTOScadaButtonModel;
|
||||
if (item == null)
|
||||
if (!(obj is DTOScadaButtonModel item))
|
||||
return false;
|
||||
|
||||
if (item.Id != Id)
|
||||
@@ -88,6 +91,11 @@ namespace Step.Model.DTOModels.Scada
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
public class DTOScadaImageModel
|
||||
@@ -97,8 +105,7 @@ namespace Step.Model.DTOModels.Scada
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var item = obj as DTOScadaImageModel;
|
||||
if (item == null)
|
||||
if (!(obj is DTOScadaImageModel item))
|
||||
return false;
|
||||
|
||||
|
||||
@@ -110,6 +117,11 @@ namespace Step.Model.DTOModels.Scada
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
public class DTOScadaProgressBarModel
|
||||
@@ -119,8 +131,7 @@ namespace Step.Model.DTOModels.Scada
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var item = obj as DTOScadaProgressBarModel;
|
||||
if (item == null)
|
||||
if (!(obj is DTOScadaProgressBarModel item))
|
||||
return false;
|
||||
|
||||
if (item.Id != Id)
|
||||
@@ -131,6 +142,11 @@ namespace Step.Model.DTOModels.Scada
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
public class DTOScadaInputModel
|
||||
@@ -146,8 +162,7 @@ namespace Step.Model.DTOModels.Scada
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var item = obj as DTOScadaInputModel;
|
||||
if (item == null)
|
||||
if (!(obj is DTOScadaInputModel item))
|
||||
return false;
|
||||
|
||||
if (item.Id != Id)
|
||||
@@ -155,6 +170,11 @@ namespace Step.Model.DTOModels.Scada
|
||||
|
||||
return item.Value.Equals(Value);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
public class DTOScadaValueModel
|
||||
@@ -164,8 +184,7 @@ namespace Step.Model.DTOModels.Scada
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var item = obj as DTOScadaValueModel;
|
||||
if (item == null)
|
||||
if (!(obj is DTOScadaValueModel item))
|
||||
return false;
|
||||
|
||||
if (item.IsEnabled != IsEnabled)
|
||||
@@ -179,5 +198,10 @@ namespace Step.Model.DTOModels.Scada
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,9 +28,8 @@ namespace Step.Model.DTOModels.ToolModels
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
DTOAssistedToolingEndValueModel item = obj as DTOAssistedToolingEndValueModel;
|
||||
|
||||
if (item == null)
|
||||
if (!(obj is DTOAssistedToolingEndValueModel item))
|
||||
return false;
|
||||
|
||||
if (IsActive != item.IsActive)
|
||||
@@ -50,5 +49,10 @@ namespace Step.Model.DTOModels.ToolModels
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,10 +27,9 @@ namespace Step.Model.DTOModels.ToolModels
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var item = obj as DTOMagazineActionModel;
|
||||
|
||||
// Object is not a DTOMagazineStatusModel instance
|
||||
if (item == null)
|
||||
if (!(obj is DTOMagazineActionModel item))
|
||||
return false;
|
||||
|
||||
if (item.action != action)
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace Step.Model.DTOModels.ToolModels
|
||||
List<DTONcToolModel> tools = new List<DTONcToolModel>();
|
||||
|
||||
if (obj.Tools != null)
|
||||
foreach (var tool in obj.Tools)
|
||||
foreach (DbNcToolModel tool in obj.Tools)
|
||||
{
|
||||
tools.Add((DTONcToolModel)tool);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace Step.Model.DTOModels.ToolModels
|
||||
List<DTONcToolModel> tools = new List<DTONcToolModel>();
|
||||
|
||||
if (obj.Tools != null)
|
||||
foreach (var tool in obj.Tools)
|
||||
foreach (DbNcToolModel tool in obj.Tools)
|
||||
{
|
||||
tools.Add((DTONcToolModel)tool);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Step.Model.DTOModels.ToolModels
|
||||
public static explicit operator DTONcTool(DbNcToolModel obj)
|
||||
{
|
||||
// Get bit values
|
||||
var statusBits = new BitArray(obj.Status);
|
||||
BitArray statusBits = new BitArray(obj.Status);
|
||||
bool[] bits = new bool[8];
|
||||
statusBits.CopyTo(bits, 0);
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace Step.Model.DTOModels.ToolModels
|
||||
public static explicit operator DTONcToolModel(DbNcToolModel obj)
|
||||
{
|
||||
// Get bit values
|
||||
var statusBits = new BitArray(new byte[] { obj.Status });
|
||||
BitArray statusBits = new BitArray(new byte[] { obj.Status });
|
||||
bool[] bits = new bool[8];
|
||||
statusBits.CopyTo(bits, 0);
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace Step.Model.DTOModels.ToolModels
|
||||
public static explicit operator DTONewNcToolModel(DbNcToolModel obj)
|
||||
{
|
||||
// Get bit values
|
||||
var statusBits = new BitArray(obj.Status);
|
||||
BitArray statusBits = new BitArray(obj.Status);
|
||||
bool[] bits = new bool[8];
|
||||
statusBits.CopyTo(bits, 0);
|
||||
|
||||
|
||||
@@ -30,6 +30,9 @@ namespace Step.Model.DatabaseModels
|
||||
[Column("language")]
|
||||
public string _language { get; set; }
|
||||
|
||||
[Column("deleted")]
|
||||
public bool Deleted { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public CultureInfo Language
|
||||
{
|
||||
|
||||
@@ -1186,7 +1186,7 @@ namespace Step.NC
|
||||
DateTime newDate;
|
||||
|
||||
//Check if i have to Manage it
|
||||
if(!CandiesController.isTimeToMangeCandies())
|
||||
if(!CandiesController.IsTimeToMangeCandies())
|
||||
return NO_ERROR;
|
||||
|
||||
|
||||
@@ -1200,11 +1200,11 @@ namespace Step.NC
|
||||
cmsError = numericalControl.PLC_RCandy(ref NcCandy);
|
||||
if (cmsError.IsError())
|
||||
return cmsError;
|
||||
bNC_OK = CandiesController.getDataFromLincense(NcCandy, out NCLic, out NCMatr, out NCParam);
|
||||
bNC_OK = CandiesController.GetDataFromLincense(NcCandy, out NCLic, out NCMatr, out NCParam);
|
||||
bNC_VALID = machNumber == NCMatr && bNC_OK;
|
||||
|
||||
//Read Data from PC
|
||||
bPC_OK = CandiesController.getPCLincense(out PcPLic, out PCMatr, out PCParam);
|
||||
bPC_OK = CandiesController.GetPCLincense(out PcPLic, out PCMatr, out PCParam);
|
||||
bPC_VALID = machNumber == PCMatr && bPC_OK;
|
||||
|
||||
//Elaborate Licence and write it
|
||||
@@ -1236,10 +1236,10 @@ namespace Step.NC
|
||||
nDays = (value.Ticks / TimeSpan.TicksPerDay);
|
||||
|
||||
//Imposto nel registro
|
||||
CandiesController.setPCLincense(machNumber,nDays);
|
||||
CandiesController.SetPCLincense(machNumber,nDays);
|
||||
|
||||
//Imposto nel CN
|
||||
Lic = Int32.Parse(CandiesController.setLincenseFromData(machNumber, nDays));
|
||||
Lic = Int32.Parse(CandiesController.SetLincenseFromData(machNumber, nDays));
|
||||
numericalControl.PLC_WCandy(Lic);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Step.Utils
|
||||
Command = Int16.Parse(szVal.Substring(0, 1));
|
||||
Parameter = long.Parse(szVal.Substring(6, szVal.Length - 6 - 1));
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -60,7 +60,7 @@ namespace Step.Utils
|
||||
|
||||
|
||||
// Lettura della licenza da registro. Ereditata da CMS-Control
|
||||
public static bool getPCLincense(out long EndLincence, out int Matricola, out long Parameter)
|
||||
public static bool GetPCLincense(out long EndLincence, out int Matricola, out long Parameter)
|
||||
{
|
||||
string szLicReg_X = String.Empty;
|
||||
int Lincence = 0;
|
||||
@@ -72,21 +72,21 @@ namespace Step.Utils
|
||||
Licenza_Registry_RW(false, ref szLicReg_X);
|
||||
|
||||
Lincence = Int32.Parse(szLicReg_X);
|
||||
return getDataFromLincense(Lincence, out EndLincence, out Matricola, out Parameter);
|
||||
return GetDataFromLincense(Lincence, out EndLincence, out Matricola, out Parameter);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Scrittura della licenza nel registro. Ereditata da CMS-Control
|
||||
public static void setPCLincense(int Matricola, long Parameter)
|
||||
public static void SetPCLincense(int Matricola, long Parameter)
|
||||
{
|
||||
string Licenza = setLincenseFromData(Matricola, Parameter);
|
||||
string Licenza = SetLincenseFromData(Matricola, Parameter);
|
||||
Licenza_Registry_RW(true, ref Licenza);
|
||||
}
|
||||
|
||||
// Gestisce la creazione della licenza, da scrivere poi nel CN
|
||||
public static string setLincenseFromData(int Matricola, long Parameter)
|
||||
public static string SetLincenseFromData(int Matricola, long Parameter)
|
||||
{
|
||||
int nLic;
|
||||
int days;
|
||||
@@ -103,7 +103,7 @@ namespace Step.Utils
|
||||
}
|
||||
|
||||
// Gestisce l'export dei dati partendo dalla licenza letta dal CN
|
||||
public static bool getDataFromLincense(int RawLincence, out long EndLincence, out int Matricola,out long Parameter)
|
||||
public static bool GetDataFromLincense(int RawLincence, out long EndLincence, out int Matricola,out long Parameter)
|
||||
{
|
||||
Matricola = 0;
|
||||
Parameter = 0;
|
||||
@@ -180,7 +180,7 @@ namespace Step.Utils
|
||||
}
|
||||
|
||||
// Controllo dell'orario per iniziare a gestire la licenza
|
||||
public static bool isTimeToMangeCandies()
|
||||
public static bool IsTimeToMangeCandies()
|
||||
{
|
||||
//Aggiungo un T random in cui inizio il controllo: da 10 minuti a entro 4 ore dall'avvio
|
||||
if (randomTime == 0)
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace Step.Utils
|
||||
|
||||
public static string ExtractBase64ProgIcon(string path)
|
||||
{
|
||||
if (File.Exists(path))
|
||||
if (!File.Exists(path))
|
||||
return "";
|
||||
|
||||
Image im = Icon.ExtractAssociatedIcon(path).ToBitmap();
|
||||
|
||||
@@ -858,7 +858,7 @@ namespace Step.Controllers.WebApi
|
||||
data = JsonConvert.DeserializeObject<DTOExportToolTableModel>(jsonString);
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,138 +1,138 @@
|
||||
using Microsoft.AspNet.SignalR;
|
||||
using Step.Controllers.SignalR;
|
||||
using Step.Database.Controllers;
|
||||
using Step.Model.DatabaseModels;
|
||||
using Step.Model.DTOModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using System.Web.Http;
|
||||
using System.Web.Helpers;
|
||||
using static Step.Model.Constants;
|
||||
using static Step.Utils.LanguageController;
|
||||
|
||||
namespace Step.Controllers.WebApi
|
||||
{
|
||||
[RoutePrefix("api/user")]
|
||||
public class UserController : ApiController
|
||||
{
|
||||
[Route("logout"), HttpPost]
|
||||
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.USER_FUNCTIONS, Action = ACTIONS.WRITE)]
|
||||
public IHttpActionResult Logout()
|
||||
{
|
||||
var identity = User.Identity as ClaimsIdentity;
|
||||
// Find user id from the bearer token
|
||||
var userId = identity.Claims.Where(c => c.Type == USER_ID_KEY).FirstOrDefault();
|
||||
if (userId == null)
|
||||
return Unauthorized();
|
||||
// Find machine id from the bearer token
|
||||
var machineId = identity.Claims.Where(c => c.Type == MACHINE_ID_KEY).FirstOrDefault();
|
||||
if (machineId == null)
|
||||
return Unauthorized();
|
||||
|
||||
using (SessionsController sessionsController = new SessionsController())
|
||||
{
|
||||
// Delete all the user session on the machine
|
||||
sessionsController.DeleteSessionsByUserAndMachineId(Convert.ToInt32(machineId.Value), Convert.ToInt32(userId.Value));
|
||||
}
|
||||
// Send to the clients the id of the disconnected user
|
||||
var context = GlobalHost.ConnectionManager.GetHubContext<NcHub>();
|
||||
context.Clients.All.logout(new { id = userId.Value });
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[Route("info"), HttpGet]
|
||||
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.USER_FUNCTIONS, Action = ACTIONS.READ)]
|
||||
public IHttpActionResult UserInfo()
|
||||
{
|
||||
var identity = User.Identity as ClaimsIdentity;
|
||||
// Find user id from the bearer token
|
||||
var userId = identity.Claims.Where(c => c.Type == USER_ID_KEY).FirstOrDefault();
|
||||
if (userId == null)
|
||||
return Unauthorized();
|
||||
|
||||
using (UsersController usersController = new UsersController())
|
||||
{
|
||||
return Ok(usersController.GetUserInfo(Convert.ToInt32(userId.Value)));
|
||||
}
|
||||
}
|
||||
|
||||
[Route("language"), HttpPut]
|
||||
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.USER_FUNCTIONS, Action = ACTIONS.READ)]
|
||||
public IHttpActionResult PutUserLanguage([FromBody] dynamic user)
|
||||
{
|
||||
// If no body return 400
|
||||
if (user == null)
|
||||
return BadRequest();
|
||||
|
||||
// Validate user id
|
||||
var identity = User.Identity as ClaimsIdentity;
|
||||
var userId = identity.Claims.Where(c => c.Type == USER_ID_KEY).FirstOrDefault();
|
||||
|
||||
if (userId == null)
|
||||
return Unauthorized();
|
||||
|
||||
// Parse body data and validate language
|
||||
var newLanguage = (string)user.language;
|
||||
|
||||
if (newLanguage == null || !IsValidLanguage(newLanguage))
|
||||
return BadRequest();
|
||||
// Find if language is Available in the server directory
|
||||
if (!LanguageIsAvailable(newLanguage))
|
||||
return NotFound();
|
||||
|
||||
using (UsersController usersController = new UsersController())
|
||||
{
|
||||
// Update database with new language
|
||||
usersController.ChangeUserLanguage(Convert.ToInt32(userId.Value), CultureInfo.CreateSpecificCulture(newLanguage));
|
||||
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
|
||||
[Route("list"), HttpGet]
|
||||
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.USER_FUNCTIONS, Action = ACTIONS.READ)]
|
||||
public IHttpActionResult GetMessageUserList()
|
||||
{
|
||||
// Validate user id
|
||||
var identity = User.Identity as ClaimsIdentity;
|
||||
var userId = identity.Claims.Where(c => c.Type == USER_ID_KEY).FirstOrDefault();
|
||||
|
||||
if (userId == null)
|
||||
return Unauthorized();
|
||||
|
||||
using (UsersController usersController = new UsersController())
|
||||
{
|
||||
// Update database with new language
|
||||
List<DTOMessageUserModel> users = usersController.GetMessageUserList();
|
||||
|
||||
return Ok(users);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region User Manager
|
||||
|
||||
[Route("manager/list"), HttpGet]
|
||||
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.USER_FUNCTIONS, Action = ACTIONS.READ)]
|
||||
public IHttpActionResult GetUserList()
|
||||
{
|
||||
using (UsersController usersController = new UsersController())
|
||||
{
|
||||
// Update database with new language
|
||||
List<DTOUserModel> users = usersController.GetUserList();
|
||||
|
||||
return Ok(users);
|
||||
}
|
||||
}
|
||||
|
||||
[Route("manager/user/{userId:int}"), HttpPut]
|
||||
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.USER_FUNCTIONS, Action = ACTIONS.WRITE)]
|
||||
public IHttpActionResult UpdateUserData(int userId, [FromBody] DTONewUserModel userData)
|
||||
{
|
||||
using (UsersController usersController = new UsersController())
|
||||
using Microsoft.AspNet.SignalR;
|
||||
using Step.Controllers.SignalR;
|
||||
using Step.Database.Controllers;
|
||||
using Step.Model.DatabaseModels;
|
||||
using Step.Model.DTOModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using System.Web.Http;
|
||||
using System.Web.Helpers;
|
||||
using static Step.Model.Constants;
|
||||
using static Step.Utils.LanguageController;
|
||||
|
||||
namespace Step.Controllers.WebApi
|
||||
{
|
||||
[RoutePrefix("api/user")]
|
||||
public class UserController : ApiController
|
||||
{
|
||||
[Route("logout"), HttpPost]
|
||||
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.USER_FUNCTIONS, Action = ACTIONS.WRITE)]
|
||||
public IHttpActionResult Logout()
|
||||
{
|
||||
var identity = User.Identity as ClaimsIdentity;
|
||||
// Find user id from the bearer token
|
||||
var userId = identity.Claims.Where(c => c.Type == USER_ID_KEY).FirstOrDefault();
|
||||
if (userId == null)
|
||||
return Unauthorized();
|
||||
// Find machine id from the bearer token
|
||||
var machineId = identity.Claims.Where(c => c.Type == MACHINE_ID_KEY).FirstOrDefault();
|
||||
if (machineId == null)
|
||||
return Unauthorized();
|
||||
|
||||
using (SessionsController sessionsController = new SessionsController())
|
||||
{
|
||||
// Delete all the user session on the machine
|
||||
sessionsController.DeleteSessionsByUserAndMachineId(Convert.ToInt32(machineId.Value), Convert.ToInt32(userId.Value));
|
||||
}
|
||||
// Send to the clients the id of the disconnected user
|
||||
var context = GlobalHost.ConnectionManager.GetHubContext<NcHub>();
|
||||
context.Clients.All.logout(new { id = userId.Value });
|
||||
return Ok();
|
||||
}
|
||||
|
||||
[Route("info"), HttpGet]
|
||||
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.USER_FUNCTIONS, Action = ACTIONS.READ)]
|
||||
public IHttpActionResult UserInfo()
|
||||
{
|
||||
var identity = User.Identity as ClaimsIdentity;
|
||||
// Find user id from the bearer token
|
||||
var userId = identity.Claims.Where(c => c.Type == USER_ID_KEY).FirstOrDefault();
|
||||
if (userId == null)
|
||||
return Unauthorized();
|
||||
|
||||
using (UsersController usersController = new UsersController())
|
||||
{
|
||||
return Ok(usersController.GetUserInfo(Convert.ToInt32(userId.Value)));
|
||||
}
|
||||
}
|
||||
|
||||
[Route("language"), HttpPut]
|
||||
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.USER_FUNCTIONS, Action = ACTIONS.READ)]
|
||||
public IHttpActionResult PutUserLanguage([FromBody] dynamic user)
|
||||
{
|
||||
// If no body return 400
|
||||
if (user == null)
|
||||
return BadRequest();
|
||||
|
||||
// Validate user id
|
||||
var identity = User.Identity as ClaimsIdentity;
|
||||
var userId = identity.Claims.Where(c => c.Type == USER_ID_KEY).FirstOrDefault();
|
||||
|
||||
if (userId == null)
|
||||
return Unauthorized();
|
||||
|
||||
// Parse body data and validate language
|
||||
var newLanguage = (string)user.language;
|
||||
|
||||
if (newLanguage == null || !IsValidLanguage(newLanguage))
|
||||
return BadRequest();
|
||||
// Find if language is Available in the server directory
|
||||
if (!LanguageIsAvailable(newLanguage))
|
||||
return NotFound();
|
||||
|
||||
using (UsersController usersController = new UsersController())
|
||||
{
|
||||
// Update database with new language
|
||||
usersController.ChangeUserLanguage(Convert.ToInt32(userId.Value), CultureInfo.CreateSpecificCulture(newLanguage));
|
||||
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
|
||||
[Route("list"), HttpGet]
|
||||
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.USER_FUNCTIONS, Action = ACTIONS.READ)]
|
||||
public IHttpActionResult GetMessageUserList()
|
||||
{
|
||||
// Validate user id
|
||||
var identity = User.Identity as ClaimsIdentity;
|
||||
var userId = identity.Claims.Where(c => c.Type == USER_ID_KEY).FirstOrDefault();
|
||||
|
||||
if (userId == null)
|
||||
return Unauthorized();
|
||||
|
||||
using (UsersController usersController = new UsersController())
|
||||
{
|
||||
// Update database with new language
|
||||
List<DTOMessageUserModel> users = usersController.GetMessageUserList();
|
||||
|
||||
return Ok(users);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region User Manager
|
||||
|
||||
[Route("manager/list"), HttpGet]
|
||||
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.USER_FUNCTIONS, Action = ACTIONS.READ)]
|
||||
public IHttpActionResult GetUserList()
|
||||
{
|
||||
using (UsersController usersController = new UsersController())
|
||||
{
|
||||
// Update database with new language
|
||||
List<DTOUserModel> users = usersController.GetUserList();
|
||||
|
||||
return Ok(users);
|
||||
}
|
||||
}
|
||||
|
||||
[Route("manager/user/{userId:int}"), HttpPut]
|
||||
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.USER_FUNCTIONS, Action = ACTIONS.WRITE)]
|
||||
public IHttpActionResult UpdateUserData(int userId, [FromBody] DTONewUserModel userData)
|
||||
{
|
||||
using (UsersController usersController = new UsersController())
|
||||
{
|
||||
|
||||
UserModel user = usersController.FindById(userId);
|
||||
@@ -147,37 +147,50 @@ namespace Step.Controllers.WebApi
|
||||
return BadRequest();
|
||||
}
|
||||
return Ok(usersController.UpdateUserData(userId, userData));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Route("manager/user"), HttpPost]
|
||||
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.USER_FUNCTIONS, Action = ACTIONS.WRITE)]
|
||||
public IHttpActionResult CreateUser(UserModel model)
|
||||
{
|
||||
using (UsersController usersController = new UsersController())
|
||||
{
|
||||
if (usersController.FindByUsername(model.Username) != null)
|
||||
return BadRequest();
|
||||
|
||||
DTOUserModel user = usersController.Create(model.Username, model.Password, model.FirstName, model.LastName, model.Language);
|
||||
|
||||
return Ok(user);
|
||||
}
|
||||
}
|
||||
|
||||
[Route("manager/user/{userId:int}"), HttpDelete]
|
||||
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.USER_FUNCTIONS, Action = ACTIONS.WRITE)]
|
||||
public IHttpActionResult DeleteUserData(int userId)
|
||||
{
|
||||
return Unauthorized();
|
||||
}
|
||||
|
||||
[Route("manager/password/{userId:int}"), HttpPut]
|
||||
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.USER_FUNCTIONS, Action = ACTIONS.WRITE)]
|
||||
public IHttpActionResult UpdateUserPassword(int userId, [FromBody] DTONewPasswordrModel userData)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Route("manager/user"), HttpPost]
|
||||
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.USER_FUNCTIONS, Action = ACTIONS.WRITE)]
|
||||
public IHttpActionResult CreateUser(UserModel model)
|
||||
{
|
||||
using (UsersController usersController = new UsersController())
|
||||
using (UsersController usersController = new UsersController())
|
||||
{
|
||||
if (usersController.FindByUsername(model.Username) != null)
|
||||
return BadRequest();
|
||||
|
||||
DTOUserModel user = usersController.Create(model.Username, model.Password, model.FirstName, model.LastName, model.Language);
|
||||
|
||||
return Ok(user);
|
||||
}
|
||||
}
|
||||
|
||||
[Route("manager/user/{userId:int}"), HttpDelete]
|
||||
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.USER_FUNCTIONS, Action = ACTIONS.WRITE)]
|
||||
public IHttpActionResult DeleteUserData(int userId)
|
||||
{
|
||||
using (UsersController usersController = new UsersController())
|
||||
{
|
||||
UserModel user = usersController.FindById(userId);
|
||||
|
||||
if (user == null)
|
||||
return NotFound();
|
||||
|
||||
if (user.Username == "cms")
|
||||
return BadRequest();
|
||||
|
||||
usersController.DeleteUser(user);
|
||||
|
||||
return Ok();
|
||||
}
|
||||
}
|
||||
|
||||
[Route("manager/password/{userId:int}"), HttpPut]
|
||||
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.USER_FUNCTIONS, Action = ACTIONS.WRITE)]
|
||||
public IHttpActionResult UpdateUserPassword(int userId, [FromBody] DTONewPasswordrModel userData)
|
||||
{
|
||||
using (UsersController usersController = new UsersController())
|
||||
{
|
||||
|
||||
UserModel user = usersController.FindById(userId);
|
||||
@@ -195,36 +208,36 @@ namespace Step.Controllers.WebApi
|
||||
return BadRequest("error_password_same_old");
|
||||
|
||||
return Ok(usersController.UpdateUserPassword(userId, userData));
|
||||
}
|
||||
}
|
||||
|
||||
// Role
|
||||
|
||||
[Route("manager/role/list"), HttpGet]
|
||||
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.USER_FUNCTIONS, Action = ACTIONS.READ)]
|
||||
public IHttpActionResult GetRoleList()
|
||||
{
|
||||
using (MachinesUsersController machineController = new MachinesUsersController())
|
||||
{
|
||||
List<DTORoleModel> roles = machineController.GetRolesList();
|
||||
|
||||
return Ok(roles);
|
||||
}
|
||||
}
|
||||
|
||||
[Route("manager/user/{userId:int}/role/{roleId:int}"), HttpPut]
|
||||
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.USER_FUNCTIONS, Action = ACTIONS.WRITE)]
|
||||
public IHttpActionResult UpdateUserRole(int userId, int roleId)
|
||||
{
|
||||
using (UsersController usersController = new UsersController())
|
||||
{
|
||||
// Update database with new user's role
|
||||
var user = usersController.UpdateUserRole(userId, roleId);
|
||||
|
||||
return Ok(user);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion User Manager
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Role
|
||||
|
||||
[Route("manager/role/list"), HttpGet]
|
||||
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.USER_FUNCTIONS, Action = ACTIONS.READ)]
|
||||
public IHttpActionResult GetRoleList()
|
||||
{
|
||||
using (MachinesUsersController machineController = new MachinesUsersController())
|
||||
{
|
||||
List<DTORoleModel> roles = machineController.GetRolesList();
|
||||
|
||||
return Ok(roles);
|
||||
}
|
||||
}
|
||||
|
||||
[Route("manager/user/{userId:int}/role/{roleId:int}"), HttpPut]
|
||||
[WebApiAuthorize(FunctionAccess = FUNCTIONALITY_NAMES.USER_FUNCTIONS, Action = ACTIONS.WRITE)]
|
||||
public IHttpActionResult UpdateUserRole(int userId, int roleId)
|
||||
{
|
||||
using (UsersController usersController = new UsersController())
|
||||
{
|
||||
// Update database with new user's role
|
||||
var user = usersController.UpdateUserRole(userId, roleId);
|
||||
|
||||
return Ok(user);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion User Manager
|
||||
}
|
||||
}
|
||||
@@ -213,6 +213,7 @@
|
||||
<card-busy-depot v-if="!ncToolAtPosition(pos.positionId)" :type="pos.busyStatus"></card-busy-depot>
|
||||
</detail-card>
|
||||
</div>
|
||||
<!-- Single line -->
|
||||
<div ref="squarecontainer" class="square-container-fixed">
|
||||
<div class="square-container single" v-if="magazineType!=1 && magazineType!=3">
|
||||
<div class="linesquare">
|
||||
@@ -222,17 +223,19 @@
|
||||
@dragover=" (!ncToolAtPosition(pos.positionId) && pos.canLoadTool && checkMagPosType(pos.type) && draggingIn)? goToPosition(pos.positionId-1):{}"
|
||||
@mouseover=" (!ncToolAtPosition(pos.positionId) && pos.canLoadTool && checkMagPosType(pos.type) && draggingIn)? goToPosition(pos.positionId-1):{}"
|
||||
@touchstart.native=" test()"
|
||||
:class="{ 'full': ncToolAtPosition(pos.positionId),
|
||||
:class="{ 'full': pos.busyStatus==0 || pos.busyStatus==1,
|
||||
'red': (enableStateProblemTool && toolIsInError(ncToolAtPosition(pos.positionId))),
|
||||
'disabled': pos.disabled,
|
||||
'halfDx': pos.busyStatus==2,
|
||||
'halfSx': pos.busyStatus==3,
|
||||
'selected': !ncToolAtPosition(pos.positionId) && pos.canLoadTool && checkMagPosType(pos.type) && draggingIn,
|
||||
}"><span>{{pos.positionId}}</span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Multiple lines -->
|
||||
<div class="square-container" v-if="magazineType==1 || magazineType==3">
|
||||
<div class="linesquare">
|
||||
<div class="square empty"
|
||||
@@ -241,7 +244,7 @@
|
||||
@dragover=" (!ncToolAtPosition(pos.positionId) && pos.canLoadTool && checkMagPosType(pos.type) && draggingIn)? goToPosition(pos.positionId-1):{}"
|
||||
@mouseover=" (!ncToolAtPosition(pos.positionId) && pos.canLoadTool && checkMagPosType(pos.type) && draggingIn)? goToPosition(pos.positionId-1):{}"
|
||||
@touchstart.native=" test()"
|
||||
:class="{ 'full': ncToolAtPosition(pos.positionId),
|
||||
:class="{ 'full': pos.busyStatus==0 || pos.busyStatus==1,
|
||||
'red': (enableStateProblemTool && toolIsInError(ncToolAtPosition(pos.positionId))),
|
||||
'disabled': pos.disabled,
|
||||
'halfDx': pos.busyStatus==2,
|
||||
@@ -259,7 +262,7 @@
|
||||
@dragover=" (!ncToolAtPosition(pos.positionId) && pos.canLoadTool && checkMagPosType(pos.type) && draggingIn)? goToPosition(pos.positionId-1):{}"
|
||||
@mouseover=" (!ncToolAtPosition(pos.positionId) && pos.canLoadTool && checkMagPosType(pos.type) && draggingIn)? goToPosition(pos.positionId-1):{}"
|
||||
@touchstart.native=" test()"
|
||||
:class="{ 'full': ncToolAtPosition(pos.positionId),
|
||||
:class="{ 'full': pos.busyStatus==0 || pos.busyStatus==1,
|
||||
'red': (enableStateProblemTool && toolIsInError(ncToolAtPosition(pos.positionId))),
|
||||
'disabled': pos.disabled,
|
||||
'halfDx': pos.busyStatus==3,
|
||||
|
||||
@@ -523,7 +523,7 @@ export const toolingStore = {
|
||||
for (let index = 0; index < passo; index++) {
|
||||
start = start + 0.5
|
||||
position = element.positionId + Math.floor(start) -1
|
||||
if(magazineType != 1 && magazineType != 2){
|
||||
if(magazineType != 1 && magazineType != 3){
|
||||
if(position>=0 && position < maxPos){
|
||||
if(positionMagazines[position].busyStatus > 0){
|
||||
if(positionMagazines[position].busyStatus == 4)
|
||||
@@ -534,11 +534,13 @@ export const toolingStore = {
|
||||
positionMagazines[position].busyStatus = 0;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
} else{
|
||||
// Circular magazines
|
||||
if(position<0)
|
||||
position = maxPos + position;
|
||||
if(position>=maxPos)
|
||||
position = position - maxPos;
|
||||
position = position - maxPos;
|
||||
|
||||
if(position>=0 && position < maxPos){
|
||||
if(positionMagazines[position].busyStatus > 0){
|
||||
if(positionMagazines[position].busyStatus == 4)
|
||||
@@ -558,7 +560,7 @@ export const toolingStore = {
|
||||
for (let index = 0; index < passo; index++) {
|
||||
start = start + 0.5
|
||||
position = element.positionId - Math.floor(start) -1
|
||||
if(magazineType != 1 && magazineType != 2){
|
||||
if(magazineType != 1 && magazineType != 3){
|
||||
if(position>=0 && position < maxPos){
|
||||
if(positionMagazines[position].busyStatus > 0){
|
||||
if(positionMagazines[position].busyStatus == 4)
|
||||
|
||||
Reference in New Issue
Block a user