modifica DB con migrazione x gestione last image thermo
This commit is contained in:
@@ -6,206 +6,224 @@ using Thermo.Active.Model.DatabaseModels;
|
||||
|
||||
namespace Thermo.Active.Database.Controllers
|
||||
{
|
||||
public class ProdInfoController : IDisposable
|
||||
{
|
||||
private DatabaseContext dbCtx;
|
||||
public class ProdInfoController : IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
public ProdInfoController()
|
||||
{
|
||||
// Initialize database context
|
||||
dbCtx = new DatabaseContext();
|
||||
}
|
||||
private DatabaseContext dbCtx;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
dbCtx.Dispose();
|
||||
}
|
||||
/// <summary>
|
||||
/// Get record by NumDone
|
||||
/// </summary>
|
||||
/// <param name="num"></param>
|
||||
/// <returns></returns>
|
||||
public ProdInfoModel FindByNumDone(int num)
|
||||
{
|
||||
return dbCtx
|
||||
.ProdInfo
|
||||
.Where(x => x.NumDone == num)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
/// <summary>
|
||||
/// Get historical paginated data from DB (DESC ordered)
|
||||
/// </summary>
|
||||
/// <param name="numStart"></param>
|
||||
/// <param name="numRecord"></param>
|
||||
/// <returns></returns>
|
||||
public List<ProdInfoModel> GetPaginatedDesc(int numStart, int numRecord)
|
||||
{
|
||||
int numEnd = numStart - numRecord;
|
||||
// check numEnd
|
||||
if (numEnd < 0)
|
||||
numEnd = 0;
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.ProdInfo
|
||||
.Where(x => x.NumDone <= numStart)
|
||||
//.Where(x => x.NumDone <= numStart && x.NumDone > numEnd)
|
||||
.OrderByDescending(x => x.DtEvent)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
/// <summary>
|
||||
/// Get historical paginated data from DB (ASC ordered)
|
||||
/// </summary>
|
||||
/// <param name="numStart"></param>
|
||||
/// <param name="numRecord"></param>
|
||||
/// <returns></returns>
|
||||
public List<ProdInfoModel> GetPaginatedAsc(int numStart, int numRecord)
|
||||
{
|
||||
int numEnd = numStart + numRecord;
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.ProdInfo
|
||||
.Where(x => x.NumDone >= numStart)
|
||||
.OrderBy(x => x.DtEvent)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
/// <summary>
|
||||
/// Create new prodInfo record on DB
|
||||
/// </summary>
|
||||
/// <param name="NumTarget"></param>
|
||||
/// <param name="NumDone"></param>
|
||||
/// <param name="TimeWarm"></param>
|
||||
/// <param name="TimeVent"></param>
|
||||
/// <param name="TimeVacuum"></param>
|
||||
/// <param name="TimeCycleGross"></param>
|
||||
/// <param name="TimeCycleNet"></param>
|
||||
/// <param name="MaterialTempEndWarm"></param>
|
||||
/// <param name="MaterialTempEndVent"></param>
|
||||
/// <param name="MoldTemp"></param>
|
||||
/// <param name="VacuumReadVal"></param>
|
||||
/// <param name="MouldEnergyOUT"></param>
|
||||
/// <param name="MouldEnergyIN"></param>
|
||||
/// <param name="IsScrap"></param>
|
||||
/// <returns></returns>
|
||||
public ProdInfoModel Create(short NumTarget, short NumDone, int TimeWarm, int TimeVent, int TimeVacuum, int TimeCycleGross, int TimeCycleNet, double MaterialTempEndWarm, double MaterialTempEndVent, double MoldTemp, double VacuumReadVal, double MouldEnergyOUT, double MouldEnergyIN, bool IsScrap)
|
||||
{
|
||||
// Create database machine model
|
||||
ProdInfoModel prodData = new ProdInfoModel()
|
||||
{
|
||||
DtEvent = DateTime.Now,
|
||||
NumTarget = NumTarget,
|
||||
NumDone = NumDone,
|
||||
TimeWarm = TimeWarm,
|
||||
TimeVent = TimeVent,
|
||||
TimeVacuum = TimeVacuum,
|
||||
TimeCycleGross = TimeCycleGross,
|
||||
TimeCycleNet = TimeCycleNet,
|
||||
MaterialTempEndWarm = MaterialTempEndWarm,
|
||||
MaterialTempEndVent = MaterialTempEndVent,
|
||||
MoldTemp = MoldTemp,
|
||||
VacuumReadVal = VacuumReadVal,
|
||||
MouldEnergyOUT = MouldEnergyOUT,
|
||||
MouldEnergyIN = MouldEnergyIN,
|
||||
IsScrap = IsScrap
|
||||
};
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
dbCtx.ProdInfo.AddOrUpdate(prodData);
|
||||
//dbCtx.ProdInfo.Add(prodData);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
#endregion Private Fields
|
||||
|
||||
return prodData;
|
||||
}
|
||||
/// <summary>
|
||||
/// Process table and set as scrap by num value
|
||||
/// </summary>
|
||||
/// <param name="maxKeep"></param>
|
||||
/// <returns></returns>
|
||||
public bool SetScrap(int num, bool isScrap)
|
||||
{
|
||||
bool answ = false;
|
||||
#region Public Constructors
|
||||
|
||||
var currRecord = dbCtx
|
||||
.ProdInfo
|
||||
.Where(x => x.NumDone == num)
|
||||
.SingleOrDefault();
|
||||
try
|
||||
{
|
||||
if (currRecord != null)
|
||||
public ProdInfoController()
|
||||
{
|
||||
currRecord.IsScrap = isScrap;
|
||||
// Initialize database context
|
||||
dbCtx = new DatabaseContext();
|
||||
}
|
||||
// save!
|
||||
dbCtx.SaveChanges();
|
||||
answ = true;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Process table and keep only maxKeep most recent ones
|
||||
/// </summary>
|
||||
/// <param name="maxKeep"></param>
|
||||
/// <returns></returns>
|
||||
public bool PurgeOldest(int maxKeep)
|
||||
{
|
||||
bool answ = false;
|
||||
#endregion Public Constructors
|
||||
|
||||
// check if purge needed
|
||||
int numRec = dbCtx.ProdInfo.Count();
|
||||
if (numRec > maxKeep)
|
||||
{
|
||||
ProdInfoModel firstToDelete = (ProdInfoModel)(from p in dbCtx.ProdInfo
|
||||
orderby p.DtEvent descending
|
||||
select p).Skip(maxKeep).Take(1);
|
||||
#region Public Methods
|
||||
|
||||
// call deletion
|
||||
dbCtx
|
||||
.ProdInfo
|
||||
.RemoveRange(
|
||||
dbCtx
|
||||
/// <summary>
|
||||
/// Create new prodInfo record on DB
|
||||
/// </summary>
|
||||
/// <param name="NumTarget"></param>
|
||||
/// <param name="NumDone"></param>
|
||||
/// <param name="TimeWarm"></param>
|
||||
/// <param name="TimeVent"></param>
|
||||
/// <param name="TimeVacuum"></param>
|
||||
/// <param name="TimeCycleGross"></param>
|
||||
/// <param name="TimeCycleNet"></param>
|
||||
/// <param name="MaterialTempEndWarm"></param>
|
||||
/// <param name="MaterialTempEndVent"></param>
|
||||
/// <param name="MoldTemp"></param>
|
||||
/// <param name="VacuumReadVal"></param>
|
||||
/// <param name="MouldEnergyOUT"></param>
|
||||
/// <param name="MouldEnergyIN"></param>
|
||||
/// <param name="IsScrap"></param>
|
||||
/// <returns></returns>
|
||||
public ProdInfoModel Create(short NumTarget, short NumDone, int TimeWarm, int TimeVent, int TimeVacuum, int TimeCycleGross, int TimeCycleNet, float MaterialTempEndWarm, float MaterialTempEndVent, float MoldTemp, float VacuumReadVal, float MouldEnergyOUT, float MouldEnergyIN, bool IsScrap, string ThermoImage)
|
||||
{
|
||||
// Create database machine model
|
||||
ProdInfoModel prodData = new ProdInfoModel()
|
||||
{
|
||||
DtEvent = DateTime.Now,
|
||||
NumTarget = NumTarget,
|
||||
NumDone = NumDone,
|
||||
TimeWarm = TimeWarm,
|
||||
TimeVent = TimeVent,
|
||||
TimeVacuum = TimeVacuum,
|
||||
TimeCycleGross = TimeCycleGross,
|
||||
TimeCycleNet = TimeCycleNet,
|
||||
MaterialTempEndWarm = MaterialTempEndWarm,
|
||||
MaterialTempEndVent = MaterialTempEndVent,
|
||||
MoldTemp = MoldTemp,
|
||||
VacuumReadVal = VacuumReadVal,
|
||||
MouldEnergyOUT = MouldEnergyOUT,
|
||||
MouldEnergyIN = MouldEnergyIN,
|
||||
IsScrap = IsScrap,
|
||||
ThermoImage = ThermoImage
|
||||
};
|
||||
try
|
||||
{
|
||||
// Add to database
|
||||
dbCtx.ProdInfo.AddOrUpdate(prodData);
|
||||
//dbCtx.ProdInfo.Add(prodData);
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
|
||||
return prodData;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
dbCtx.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get record by NumDone
|
||||
/// </summary>
|
||||
/// <param name="num"></param>
|
||||
/// <returns></returns>
|
||||
public ProdInfoModel FindByNumDone(int num)
|
||||
{
|
||||
return dbCtx
|
||||
.ProdInfo
|
||||
.Where(x => x.DtEvent <= firstToDelete.DtEvent)
|
||||
);
|
||||
|
||||
try
|
||||
{
|
||||
// save!
|
||||
dbCtx.SaveChanges();
|
||||
answ = true;
|
||||
.Where(x => x.NumDone == num)
|
||||
.SingleOrDefault();
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Process table and delete all record (truncate)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool PurgeAll()
|
||||
{
|
||||
bool answ = false;
|
||||
/// <summary>
|
||||
/// Get historical paginated data from DB (ASC ordered)
|
||||
/// </summary>
|
||||
/// <param name="numStart"></param>
|
||||
/// <param name="numRecord"></param>
|
||||
/// <returns></returns>
|
||||
public List<ProdInfoModel> GetPaginatedAsc(int numStart, int numRecord)
|
||||
{
|
||||
int numEnd = numStart + numRecord;
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.ProdInfo
|
||||
.Where(x => x.NumDone >= numStart)
|
||||
.OrderBy(x => x.DtEvent)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
dbCtx
|
||||
.Database
|
||||
.ExecuteSqlCommand("TRUNCATE TABLE prodInfo");
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
/// <summary>
|
||||
/// Get historical paginated data from DB (DESC ordered)
|
||||
/// </summary>
|
||||
/// <param name="numStart"></param>
|
||||
/// <param name="numRecord"></param>
|
||||
/// <returns></returns>
|
||||
public List<ProdInfoModel> GetPaginatedDesc(int numStart, int numRecord)
|
||||
{
|
||||
int numEnd = numStart - numRecord;
|
||||
// check numEnd
|
||||
if (numEnd < 0)
|
||||
numEnd = 0;
|
||||
// retrieve
|
||||
return dbCtx
|
||||
.ProdInfo
|
||||
.Where(x => x.NumDone <= numStart)
|
||||
//.Where(x => x.NumDone <= numStart && x.NumDone > numEnd)
|
||||
.OrderByDescending(x => x.DtEvent)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Process table and delete all record (truncate)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool PurgeAll()
|
||||
{
|
||||
bool answ = false;
|
||||
|
||||
try
|
||||
{
|
||||
dbCtx
|
||||
.Database
|
||||
.ExecuteSqlCommand("TRUNCATE TABLE prodInfo");
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Process table and keep only maxKeep most recent ones
|
||||
/// </summary>
|
||||
/// <param name="maxKeep"></param>
|
||||
/// <returns></returns>
|
||||
public bool PurgeOldest(int maxKeep)
|
||||
{
|
||||
bool answ = false;
|
||||
|
||||
// check if purge needed
|
||||
int numRec = dbCtx.ProdInfo.Count();
|
||||
if (numRec > maxKeep)
|
||||
{
|
||||
ProdInfoModel firstToDelete = (ProdInfoModel)(from p in dbCtx.ProdInfo
|
||||
orderby p.DtEvent descending
|
||||
select p).Skip(maxKeep).Take(1);
|
||||
|
||||
// call deletion
|
||||
dbCtx
|
||||
.ProdInfo
|
||||
.RemoveRange(
|
||||
dbCtx
|
||||
.ProdInfo
|
||||
.Where(x => x.DtEvent <= firstToDelete.DtEvent)
|
||||
);
|
||||
|
||||
try
|
||||
{
|
||||
// save!
|
||||
dbCtx.SaveChanges();
|
||||
answ = true;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Process table and set as scrap by num value
|
||||
/// </summary>
|
||||
/// <param name="maxKeep"></param>
|
||||
/// <returns></returns>
|
||||
public bool SetScrap(int num, bool isScrap)
|
||||
{
|
||||
bool answ = false;
|
||||
|
||||
var currRecord = dbCtx
|
||||
.ProdInfo
|
||||
.Where(x => x.NumDone == num)
|
||||
.SingleOrDefault();
|
||||
try
|
||||
{
|
||||
if (currRecord != null)
|
||||
{
|
||||
currRecord.IsScrap = isScrap;
|
||||
}
|
||||
// save!
|
||||
dbCtx.SaveChanges();
|
||||
answ = true;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace Thermo.Active.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 Added_ThermoImage_prodInfo : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(Added_ThermoImage_prodInfo));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "202102171753226_Added_ThermoImage_prodInfo"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
namespace Thermo.Active.Database.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class Added_ThermoImage_prodInfo : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.ProdInfo", "ThermoImage", c => c.String(unicode: false));
|
||||
AlterColumn("dbo.ProdInfo", "MaterialTempEndWarm", c => c.Single(nullable: false));
|
||||
AlterColumn("dbo.ProdInfo", "MaterialTempEndVent", c => c.Single(nullable: false));
|
||||
AlterColumn("dbo.ProdInfo", "MoldTemp", c => c.Single(nullable: false));
|
||||
AlterColumn("dbo.ProdInfo", "VacuumReadVal", c => c.Single(nullable: false));
|
||||
AlterColumn("dbo.ProdInfo", "MouldEnergyOUT", c => c.Single(nullable: false));
|
||||
AlterColumn("dbo.ProdInfo", "MouldEnergyIN", c => c.Single(nullable: false));
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
AlterColumn("dbo.ProdInfo", "MouldEnergyIN", c => c.Double(nullable: false));
|
||||
AlterColumn("dbo.ProdInfo", "MouldEnergyOUT", c => c.Double(nullable: false));
|
||||
AlterColumn("dbo.ProdInfo", "VacuumReadVal", c => c.Double(nullable: false));
|
||||
AlterColumn("dbo.ProdInfo", "MoldTemp", c => c.Double(nullable: false));
|
||||
AlterColumn("dbo.ProdInfo", "MaterialTempEndVent", c => c.Double(nullable: false));
|
||||
AlterColumn("dbo.ProdInfo", "MaterialTempEndWarm", c => c.Double(nullable: false));
|
||||
DropColumn("dbo.ProdInfo", "ThermoImage");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -154,6 +154,10 @@
|
||||
<Compile Include="Migrations\202011051531133_AddedKeyboaSoftkey.Designer.cs">
|
||||
<DependentUpon>202011051531133_AddedKeyboaSoftkey.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\202102171753226_Added_ThermoImage_prodInfo.cs" />
|
||||
<Compile Include="Migrations\202102171753226_Added_ThermoImage_prodInfo.Designer.cs">
|
||||
<DependentUpon>202102171753226_Added_ThermoImage_prodInfo.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\Configuration.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Redis\redUtil.cs" />
|
||||
@@ -205,6 +209,9 @@
|
||||
<EmbeddedResource Include="Migrations\202011051531133_AddedKeyboaSoftkey.resx">
|
||||
<DependentUpon>202011051531133_AddedKeyboaSoftkey.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\202102171753226_Added_ThermoImage_prodInfo.resx">
|
||||
<DependentUpon>202102171753226_Added_ThermoImage_prodInfo.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -7,95 +7,112 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Thermo.Active.Model.DTOModels.ThProd
|
||||
{
|
||||
public class DTOProdInfo
|
||||
{
|
||||
public DateTime DtEvent { get; set; }
|
||||
public short NumTarget { get; set; } = 0;
|
||||
public short NumDone { get; set; } = 0;
|
||||
public double TimeWarm { get; set; } = 0;
|
||||
public double TimeVent { get; set; } = 0;
|
||||
public double TimeVacuum { get; set; } = 0;
|
||||
public double TimeCycleGross { get; set; } = 0;
|
||||
public double TimeCycleNet { get; set; } = 0;
|
||||
public int NumDec { get; set; } = 1;
|
||||
public int ScaleFactor { get; set; } = 1000;
|
||||
public double MaterialTempEndWarm { get; set; } = 0;
|
||||
public double MaterialTempEndVent { get; set; } = 0;
|
||||
public double MoldTemp { get; set; } = 0;
|
||||
public double VacuumReadVal { get; set; } = 0;
|
||||
public double MouldEnergyOUT { get; set; } = 0;
|
||||
public double MouldEnergyIN { get; set; } = 0;
|
||||
public bool IsScrap { get; set; } = false;
|
||||
public short NumPreHot { get; set; } = 0;
|
||||
|
||||
public override bool Equals(object obj)
|
||||
public class DTOProdInfo
|
||||
{
|
||||
// Object is not a GaugeModel instance
|
||||
if (!(obj is DTOProdInfo item))
|
||||
return false;
|
||||
#region Public Constructors
|
||||
|
||||
if (DtEvent != item.DtEvent)
|
||||
return false;
|
||||
if (NumTarget != item.NumTarget)
|
||||
return false;
|
||||
if (NumDone != item.NumDone)
|
||||
return false;
|
||||
if (Math.Round(Math.Abs(TimeWarm - item.TimeWarm), 1) >= Constants.EPSILON)
|
||||
return false;
|
||||
if (Math.Round(Math.Abs(TimeVent - item.TimeVent), 1) >= Constants.EPSILON)
|
||||
return false;
|
||||
if (Math.Round(Math.Abs(TimeVacuum - item.TimeVacuum), 1) >= Constants.EPSILON)
|
||||
return false;
|
||||
if (Math.Round(Math.Abs(TimeCycleGross - item.TimeCycleGross), 1) >= Constants.EPSILON)
|
||||
return false;
|
||||
if (Math.Round(Math.Abs(TimeCycleNet - item.TimeCycleNet), 1) >= Constants.EPSILON)
|
||||
return false;
|
||||
if (Math.Round(Math.Abs(MaterialTempEndWarm - item.MaterialTempEndWarm), 1) >= Constants.EPSILON)
|
||||
return false;
|
||||
if (Math.Round(Math.Abs(MaterialTempEndVent - item.MaterialTempEndVent), 1) >= Constants.EPSILON)
|
||||
return false;
|
||||
if (Math.Round(Math.Abs(MoldTemp - item.MoldTemp), 1) >= Constants.EPSILON)
|
||||
return false;
|
||||
if (Math.Round(Math.Abs(VacuumReadVal - item.VacuumReadVal), 1) >= Constants.EPSILON)
|
||||
return false;
|
||||
if (Math.Round(Math.Abs(MouldEnergyOUT - item.MouldEnergyOUT), 1) >= Constants.EPSILON)
|
||||
return false;
|
||||
if (Math.Round(Math.Abs(MouldEnergyIN - item.MouldEnergyIN), 1) >= Constants.EPSILON)
|
||||
return false;
|
||||
if (IsScrap != item.IsScrap)
|
||||
return false;
|
||||
if (NumPreHot != item.NumPreHot)
|
||||
return false;
|
||||
public DTOProdInfo()
|
||||
{
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
public DTOProdInfo(ThermoModels.ProdInfoModel pimRawData)
|
||||
{
|
||||
this.DtEvent = pimRawData.DtEvent;
|
||||
this.NumDone = pimRawData.NumDone;
|
||||
this.NumTarget = pimRawData.NumTarget;
|
||||
this.ThermoImage = pimRawData.ThermoImage;
|
||||
this.TimeCycleGross = Math.Round((double)pimRawData.TimeCycleGross / this.ScaleFactor, 2);
|
||||
this.TimeCycleNet = Math.Round((double)pimRawData.TimeCycleNet / this.ScaleFactor, 2);
|
||||
this.TimeVacuum = Math.Round((double)pimRawData.TimeVacuum / this.ScaleFactor, 2);
|
||||
this.TimeVent = Math.Round((double)pimRawData.TimeVent / this.ScaleFactor, 2);
|
||||
this.TimeWarm = Math.Round((double)pimRawData.TimeWarm / this.ScaleFactor, 2);
|
||||
this.MaterialTempEndWarm = pimRawData.MaterialTempEndWarm;
|
||||
this.MaterialTempEndVent = pimRawData.MaterialTempEndVent;
|
||||
this.MoldTemp = pimRawData.MoldTemp;
|
||||
this.VacuumReadVal = pimRawData.VacuumReadVal;
|
||||
this.MouldEnergyIN = pimRawData.MouldEnergyIN;
|
||||
this.MouldEnergyOUT = pimRawData.MouldEnergyOUT;
|
||||
this.IsScrap = pimRawData.IsScrap;
|
||||
this.NumPreHot = pimRawData.NumPreHot;
|
||||
}
|
||||
|
||||
public DTOProdInfo()
|
||||
{
|
||||
}
|
||||
#endregion Public Constructors
|
||||
|
||||
public DTOProdInfo(ThermoModels.ProdInfoModel pimRawData)
|
||||
{
|
||||
this.DtEvent = pimRawData.DtEvent;
|
||||
this.NumDone = pimRawData.NumDone;
|
||||
this.NumTarget = pimRawData.NumTarget;
|
||||
this.TimeCycleGross = Math.Round((double)pimRawData.TimeCycleGross / this.ScaleFactor, 2);
|
||||
this.TimeCycleNet = Math.Round((double)pimRawData.TimeCycleNet / this.ScaleFactor, 2);
|
||||
this.TimeVacuum = Math.Round((double)pimRawData.TimeVacuum / this.ScaleFactor, 2);
|
||||
this.TimeVent = Math.Round((double)pimRawData.TimeVent / this.ScaleFactor, 2);
|
||||
this.TimeWarm = Math.Round((double)pimRawData.TimeWarm / this.ScaleFactor, 2);
|
||||
this.MaterialTempEndWarm = pimRawData.MaterialTempEndWarm;
|
||||
this.MaterialTempEndVent = pimRawData.MaterialTempEndVent;
|
||||
this.MoldTemp = pimRawData.MoldTemp;
|
||||
this.VacuumReadVal = pimRawData.VacuumReadVal;
|
||||
this.MouldEnergyIN = pimRawData.MouldEnergyIN;
|
||||
this.MouldEnergyOUT = pimRawData.MouldEnergyOUT;
|
||||
this.IsScrap = pimRawData.IsScrap;
|
||||
this.NumPreHot = pimRawData.NumPreHot;
|
||||
#region Public Properties
|
||||
|
||||
public DateTime DtEvent { get; set; }
|
||||
public bool IsScrap { get; set; } = false;
|
||||
public double MaterialTempEndVent { get; set; } = 0;
|
||||
public double MaterialTempEndWarm { get; set; } = 0;
|
||||
public double MoldTemp { get; set; } = 0;
|
||||
public double MouldEnergyIN { get; set; } = 0;
|
||||
public double MouldEnergyOUT { get; set; } = 0;
|
||||
public int NumDec { get; set; } = 1;
|
||||
public short NumDone { get; set; } = 0;
|
||||
public short NumPreHot { get; set; } = 0;
|
||||
public short NumTarget { get; set; } = 0;
|
||||
public int ScaleFactor { get; set; } = 1000;
|
||||
public string ThermoImage { get; set; } = "";
|
||||
public double TimeCycleGross { get; set; } = 0;
|
||||
public double TimeCycleNet { get; set; } = 0;
|
||||
public double TimeVacuum { get; set; } = 0;
|
||||
public double TimeVent { get; set; } = 0;
|
||||
public double TimeWarm { get; set; } = 0;
|
||||
public double VacuumReadVal { get; set; } = 0;
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
// Object is not a GaugeModel instance
|
||||
if (!(obj is DTOProdInfo item))
|
||||
return false;
|
||||
|
||||
if (DtEvent != item.DtEvent)
|
||||
return false;
|
||||
if (NumTarget != item.NumTarget)
|
||||
return false;
|
||||
if (NumDone != item.NumDone)
|
||||
return false;
|
||||
if (ThermoImage != item.ThermoImage)
|
||||
return false;
|
||||
if (Math.Round(Math.Abs(TimeWarm - item.TimeWarm), 1) >= Constants.EPSILON)
|
||||
return false;
|
||||
if (Math.Round(Math.Abs(TimeVent - item.TimeVent), 1) >= Constants.EPSILON)
|
||||
return false;
|
||||
if (Math.Round(Math.Abs(TimeVacuum - item.TimeVacuum), 1) >= Constants.EPSILON)
|
||||
return false;
|
||||
if (Math.Round(Math.Abs(TimeCycleGross - item.TimeCycleGross), 1) >= Constants.EPSILON)
|
||||
return false;
|
||||
if (Math.Round(Math.Abs(TimeCycleNet - item.TimeCycleNet), 1) >= Constants.EPSILON)
|
||||
return false;
|
||||
if (Math.Round(Math.Abs(MaterialTempEndWarm - item.MaterialTempEndWarm), 1) >= Constants.EPSILON)
|
||||
return false;
|
||||
if (Math.Round(Math.Abs(MaterialTempEndVent - item.MaterialTempEndVent), 1) >= Constants.EPSILON)
|
||||
return false;
|
||||
if (Math.Round(Math.Abs(MoldTemp - item.MoldTemp), 1) >= Constants.EPSILON)
|
||||
return false;
|
||||
if (Math.Round(Math.Abs(VacuumReadVal - item.VacuumReadVal), 1) >= Constants.EPSILON)
|
||||
return false;
|
||||
if (Math.Round(Math.Abs(MouldEnergyOUT - item.MouldEnergyOUT), 1) >= Constants.EPSILON)
|
||||
return false;
|
||||
if (Math.Round(Math.Abs(MouldEnergyIN - item.MouldEnergyIN), 1) >= Constants.EPSILON)
|
||||
return false;
|
||||
if (IsScrap != item.IsScrap)
|
||||
return false;
|
||||
if (NumPreHot != item.NumPreHot)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,43 +7,58 @@ namespace Thermo.Active.Model.DatabaseModels
|
||||
[Table("ProdInfo")]
|
||||
public class ProdInfoModel
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
[Column("DtEvent", Order = 0)]
|
||||
public DateTime DtEvent { get; set; }
|
||||
|
||||
[Column("NumTarget")]
|
||||
public short NumTarget { get; set; }
|
||||
[Column("NumDone")]
|
||||
public short NumDone { get; set; }
|
||||
|
||||
[Column("TimeWarm")]
|
||||
public int TimeWarm { get; set; }
|
||||
[Column("TimeVent")]
|
||||
public int TimeVent { get; set; }
|
||||
[Column("TimeVacuum")]
|
||||
public int TimeVacuum { get; set; }
|
||||
[Column("TimeCycleGross")]
|
||||
public int TimeCycleGross { get; set; }
|
||||
[Column("TimeCycleNet")]
|
||||
public int TimeCycleNet { get; set; }
|
||||
|
||||
[Column("MaterialTempEndWarm")]
|
||||
public double MaterialTempEndWarm { get; set; }
|
||||
[Column("MaterialTempEndVent")]
|
||||
public double MaterialTempEndVent { get; set; }
|
||||
[Column("MoldTemp")]
|
||||
public double MoldTemp { get; set; }
|
||||
|
||||
[Column("VacuumReadVal")]
|
||||
public double VacuumReadVal { get; set; }
|
||||
|
||||
[Column("MouldEnergyOUT")]
|
||||
public double MouldEnergyOUT { get; set; }
|
||||
[Column("MouldEnergyIN")]
|
||||
public double MouldEnergyIN { get; set; }
|
||||
[Column("IsScrap")]
|
||||
public bool IsScrap { get; set; }
|
||||
|
||||
[Column("MaterialTempEndVent")]
|
||||
public float MaterialTempEndVent { get; set; }
|
||||
|
||||
[Column("MaterialTempEndWarm")]
|
||||
public float MaterialTempEndWarm { get; set; }
|
||||
|
||||
[Column("MoldTemp")]
|
||||
public float MoldTemp { get; set; }
|
||||
|
||||
[Column("MouldEnergyIN")]
|
||||
public float MouldEnergyIN { get; set; }
|
||||
|
||||
[Column("MouldEnergyOUT")]
|
||||
public float MouldEnergyOUT { get; set; }
|
||||
|
||||
[Column("NumDone")]
|
||||
public short NumDone { get; set; }
|
||||
|
||||
[Column("NumTarget")]
|
||||
public short NumTarget { get; set; }
|
||||
|
||||
[Column("ThermoImage")]
|
||||
public string ThermoImage { get; set; }
|
||||
|
||||
[Column("TimeCycleGross")]
|
||||
public int TimeCycleGross { get; set; }
|
||||
|
||||
[Column("TimeCycleNet")]
|
||||
public int TimeCycleNet { get; set; }
|
||||
|
||||
[Column("TimeVacuum")]
|
||||
public int TimeVacuum { get; set; }
|
||||
|
||||
[Column("TimeVent")]
|
||||
public int TimeVent { get; set; }
|
||||
|
||||
[Column("TimeWarm")]
|
||||
public int TimeWarm { get; set; }
|
||||
|
||||
[Column("VacuumReadVal")]
|
||||
public float VacuumReadVal { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
}
|
||||
+867
-859
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user