DataLayer:
- fix id prod/projCloudId
This commit is contained in:
@@ -30,7 +30,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
DtEvent = currRec.DtEvent,
|
||||
EvType = (EgwProxy.MagMan.MachLogTypes)currRec.EvType,
|
||||
ProjCloudId = currRec.ProjId,
|
||||
ProjCloudId = currRec.ProjCloudId,
|
||||
SupervId = currRec.SupervId,
|
||||
VarValue = currRec.VarValue
|
||||
};
|
||||
@@ -45,7 +45,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
public LogMachineModel ConvertFromCore(Core.MachLog coreMacLog)
|
||||
{
|
||||
int projCloudId = 0;
|
||||
// calcolo projCloudId da ProjId...
|
||||
// calcolo projCloudId da ProdId...
|
||||
using (var localDbCtx = new DatabaseContext(DbConfig.CONNECTION_STRING))
|
||||
{
|
||||
// Add to database
|
||||
@@ -65,7 +65,8 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
DtEvent = coreMacLog.AlarmDateTime,
|
||||
SupervId = coreMacLog.VarAddress,
|
||||
VarValue = coreMacLog.VarValue,
|
||||
ProjId = projCloudId
|
||||
ProdId = coreMacLog.ProdId,
|
||||
ProjCloudId = projCloudId
|
||||
};
|
||||
}
|
||||
return answ;
|
||||
@@ -78,7 +79,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// <returns></returns>
|
||||
public Core.MachLog ConvertToCore(LogMachineModel dbLog)
|
||||
{
|
||||
var newRecord = (Core.MachLog)Core.MachLog.CreateMachLog(dbLog.EvType, dbLog.DtEvent, dbLog.VarValue, dbLog.ProjId, dbLog.SupervId);
|
||||
var newRecord = (Core.MachLog)Core.MachLog.CreateMachLog(dbLog.EvType, dbLog.DtEvent, dbLog.VarValue, dbLog.ProdId, dbLog.SupervId);
|
||||
return newRecord;
|
||||
}
|
||||
|
||||
|
||||
@@ -405,7 +405,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Get BtlPartDBId by ProjId + PDN
|
||||
/// Get BtlPartDBId by ProdId + PDN
|
||||
/// </summary>
|
||||
/// <param name="ProjId"></param>
|
||||
/// <param name="PDN"></param>
|
||||
@@ -430,7 +430,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get BtlPartDBId by ProjId + BtlPartId
|
||||
/// Get BtlPartDBId by ProdId + BtlPartId
|
||||
/// </summary>
|
||||
/// <param name="ProjId"></param>
|
||||
/// <param name="BtlPartId"></param>
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
|
||||
/// <summary>
|
||||
/// Search for already imported BTL from FileName (only)
|
||||
/// =0 : NOT found >0 : ProjId (already present) for overwrite
|
||||
/// =0 : NOT found >0 : ProdId (already present) for overwrite
|
||||
/// </summary>
|
||||
/// <param name="BTLFileName"></param>
|
||||
/// <returns></returns>
|
||||
@@ -129,7 +129,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete Proj logically / on DB by ProjId
|
||||
/// Delete Proj logically / on DB by ProdId
|
||||
/// </summary>
|
||||
/// <param name="ProjId"></param>
|
||||
/// <param name="IsLogical"></param>
|
||||
@@ -256,7 +256,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get record by ProjId
|
||||
/// Get record by ProdId
|
||||
/// </summary>
|
||||
/// <param name="ProjId"></param>
|
||||
/// <returns></returns>
|
||||
@@ -274,7 +274,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get record by ProjId converted
|
||||
/// Get record by ProdId converted
|
||||
/// </summary>
|
||||
/// <param name="ProjId"></param>
|
||||
/// <returns></returns>
|
||||
@@ -530,7 +530,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
return nextId;
|
||||
}
|
||||
|
||||
/// <summary> Manage Lock by ProjId (proj & prod) </summary> <param name="ProjId">ID
|
||||
/// <summary> Manage Lock by ProdId (proj & prod) </summary> <param name="ProjId">ID
|
||||
/// Proj</param> <param name="Locked">Stato Lock da impostare</param> <param
|
||||
/// name="UserKey">User ID / Key number</param> <returns></returns>
|
||||
public Core.ProjFileM LockByProjId(int ProjId, bool Locked, string UserKey = "USER01")
|
||||
@@ -653,7 +653,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on Proj.Update: req item was not found | ProjId {updItem.ProjId} | ProjDbId {updItem.ProjDbId} | ProdDbId {updItem.ProdDbId}";
|
||||
string errMessage = $"ERROR on Proj.Update: req item was not found | ProdId {updItem.ProjId} | ProjDbId {updItem.ProjDbId} | ProdDbId {updItem.ProdDbId}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
@@ -745,7 +745,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on Proj.UpdateBtlParts: req item was not found | ProjId {ProjId} | BtlPartList {BtlPartList.Count} items";
|
||||
string errMessage = $"ERROR on Proj.UpdateBtlParts: req item was not found | ProdId {ProjId} | BtlPartList {BtlPartList.Count} items";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
@@ -788,7 +788,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on Proj.UpdateDescription: req item was not found | ProjId {ProjId} | Description {Description}";
|
||||
string errMessage = $"ERROR on Proj.UpdateDescription: req item was not found | ProdId {ProjId} | Description {Description}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
@@ -833,7 +833,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
// se ne ho esattamente 1 nel DB allora DEVE essere il record Parent
|
||||
if (duplicateList.Count == 1)
|
||||
{
|
||||
// verifico se ProjId variato
|
||||
// verifico se ProdId variato
|
||||
if (!duplicateList[0].ProjId.Equals(currData.ProjId))
|
||||
{
|
||||
// in questo caso ho il PRIMO duplicato
|
||||
@@ -879,7 +879,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on Proj.UpdateInfo: req item was not found | ProjId {ProjId} | Description {BTLFileName} | ListName {ListName} | DtExported {DtExported} | PType {PType} | Machine {Machine}";
|
||||
string errMessage = $"ERROR on Proj.UpdateInfo: req item was not found | ProdId {ProjId} | Description {BTLFileName} | ListName {ListName} | DtExported {DtExported} | PType {PType} | Machine {Machine}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
@@ -915,7 +915,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on Proj.UpdateListName: req item was not found | ProjId {ProjId} | ListName {ListName}";
|
||||
string errMessage = $"ERROR on Proj.UpdateListName: req item was not found | ProdId {ProjId} | ListName {ListName}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
@@ -958,7 +958,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
string errMessage = $"ERROR on Proj.UpdateMachine: req item was not found | ProjId {ProjId} | Machine {Machine}";
|
||||
string errMessage = $"ERROR on Proj.UpdateMachine: req item was not found | ProdId {ProjId} | Machine {Machine}";
|
||||
Console.WriteLine(errMessage);
|
||||
Log.Error(errMessage);
|
||||
}
|
||||
|
||||
@@ -34,10 +34,16 @@ namespace EgtBEAMWALL.DataLayer.DatabaseModels
|
||||
public DateTime DtEvent { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// Key progetto (DB locale)
|
||||
/// Key prod attivo (DB locale)
|
||||
/// </summary>
|
||||
[Column("ProjId")]
|
||||
public int ProjId { get; set; } = 0;
|
||||
[Column("ProdId")]
|
||||
public int ProdId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Key progetto (cloud)
|
||||
/// </summary>
|
||||
[Column("ProjCloudId")]
|
||||
public int ProjCloudId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// ID Supervisore (Indirizzo VAR)
|
||||
|
||||
@@ -256,6 +256,10 @@
|
||||
<Compile Include="Migrations\202404290906337_UpdateLogMachineTable03.Designer.cs">
|
||||
<DependentUpon>202404290906337_UpdateLogMachineTable03.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202404291620416_UpdateLogMachineTable04.cs" />
|
||||
<Compile Include="Migrations\202404291620416_UpdateLogMachineTable04.Designer.cs">
|
||||
<DependentUpon>202404291620416_UpdateLogMachineTable04.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\Configuration.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Utils.cs" />
|
||||
@@ -334,6 +338,9 @@
|
||||
<EmbeddedResource Include="Migrations\202404290906337_UpdateLogMachineTable03.resx">
|
||||
<DependentUpon>202404290906337_UpdateLogMachineTable03.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202404291620416_UpdateLogMachineTable04.resx">
|
||||
<DependentUpon>202404291620416_UpdateLogMachineTable04.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.LogMachine", "ProjId", c => c.Int(nullable: false));
|
||||
AddColumn("dbo.LogMachine", "ProdId", c => c.Int(nullable: false));
|
||||
RenameColumn("dbo.LogMachine", "VarAddress", "SupervId");
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
{
|
||||
|
||||
RenameColumn("dbo.LogMachine", "SupervId", "VarAddress");
|
||||
DropColumn("dbo.LogMachine", "ProjId");
|
||||
DropColumn("dbo.LogMachine", "ProdId");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.4.4")]
|
||||
public sealed partial class UpdateLogMachineTable04 : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(UpdateLogMachineTable04));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202404291620416_UpdateLogMachineTable04"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
namespace EgtBEAMWALL.DataLayer.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class UpdateLogMachineTable04 : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.LogMachine", "ProjCloudId", c => c.Int(nullable: false));
|
||||
RenameColumn("dbo.LogMachine", "ProjId", "ProdId");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
RenameColumn("dbo.LogMachine", "ProdId", "ProjId");
|
||||
DropColumn("dbo.LogMachine", "ProjCloudId");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user