157 lines
4.2 KiB
C#
157 lines
4.2 KiB
C#
using CMS_CORE_Library.Models;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using static CMS_CORE_Library.Models.DataStructures;
|
|
|
|
namespace Thermo.Active.Model.DTOModels
|
|
{
|
|
public class DTOProcessesDataModel
|
|
{
|
|
public bool IsRunning;
|
|
public ushort SelectedProcess;
|
|
public byte SelectedAxis;
|
|
public QUEUE_STATUS QueueStatus;
|
|
public bool StartStopQueueEnabled;
|
|
public short ActiveOrigin;
|
|
public short ActiveOffsetId;
|
|
public List<ProcessModel> processes;
|
|
public string UnitMeasure;
|
|
public bool CanLoadProgram;
|
|
public string ProcessMessage;
|
|
|
|
public byte RapidOverride;
|
|
public byte WorkOverride;
|
|
public double FeedOverride;
|
|
|
|
public OffsetModel offsetData;
|
|
|
|
|
|
public DTOProcessesDataModel()
|
|
{
|
|
ProcessMessage = "";
|
|
IsRunning = false;
|
|
processes = new List<ProcessModel>();
|
|
}
|
|
|
|
public override bool Equals(object obj)
|
|
{
|
|
// Object is not a DTOProcessDataModel instance
|
|
if (!(obj is DTOProcessesDataModel item))
|
|
return false;
|
|
|
|
if (IsRunning != item.IsRunning)
|
|
return false;
|
|
|
|
if (SelectedProcess != item.SelectedProcess)
|
|
return false;
|
|
if (SelectedAxis != item.SelectedAxis)
|
|
return false;
|
|
// If the numbers of the list's elemets are different, lists are different
|
|
if (item.processes.Count != processes.Count)
|
|
return false;
|
|
// Check list's elements
|
|
bool listAreEquals = item.processes.All(processes.Contains);
|
|
if (!listAreEquals)
|
|
return false;
|
|
|
|
if (QueueStatus != item.QueueStatus)
|
|
return false;
|
|
|
|
if (StartStopQueueEnabled != item.StartStopQueueEnabled)
|
|
return false;
|
|
|
|
// Selected process data
|
|
if (ActiveOffsetId != item.ActiveOffsetId)
|
|
return false;
|
|
|
|
if (ActiveOrigin != item.ActiveOrigin)
|
|
return false;
|
|
|
|
if (ProcessMessage != item.ProcessMessage)
|
|
return false;
|
|
|
|
if (UnitMeasure != item.UnitMeasure)
|
|
return false;
|
|
|
|
if (CanLoadProgram != item.CanLoadProgram)
|
|
return false;
|
|
|
|
if (RapidOverride != item.RapidOverride)
|
|
return false;
|
|
|
|
if (WorkOverride != item.WorkOverride)
|
|
return false;
|
|
|
|
//if (offsetData.RealLength != item.offsetData.RealLength)
|
|
// return false;
|
|
|
|
//if (offsetData.RealRadius != item.offsetData.RealRadius)
|
|
// return false;
|
|
|
|
if (FeedOverride != item.FeedOverride)
|
|
return false;
|
|
|
|
return true;
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return base.GetHashCode();
|
|
}
|
|
}
|
|
|
|
public class ProcessModel : ProcessDataModel
|
|
{
|
|
public override bool Equals(object obj)
|
|
{
|
|
if (!(obj is ProcessModel item))
|
|
return false;
|
|
|
|
if (Id != item.Id)
|
|
return false;
|
|
|
|
if (Type != item.Type ||
|
|
IsInAlarm != item.IsInAlarm ||
|
|
PartProgramName != item.PartProgramName ||
|
|
Status != item.Status ||
|
|
Visible != item.Visible ||
|
|
Reps != item.Reps ||
|
|
CanLoadProgram != item.CanLoadProgram)
|
|
return false;
|
|
|
|
return true;
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return base.GetHashCode();
|
|
}
|
|
}
|
|
|
|
public class DTOM155InputModel : M155InputIsNeededModel
|
|
{
|
|
public new string Type;
|
|
public override bool Equals(object obj)
|
|
{
|
|
|
|
if (!(obj is DTOM155InputModel item))
|
|
return false;
|
|
|
|
if (Process != item.Process)
|
|
return false;
|
|
|
|
if (Type != item.Type)
|
|
return false;
|
|
|
|
if (Message != item.Message)
|
|
return false;
|
|
|
|
return true;
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return base.GetHashCode();
|
|
}
|
|
}
|
|
} |