Feiyu/Model/MachineModel.cs
2026-04-23 11:42:40 +08:00

486 lines
11 KiB
C#

using Community;
using Model.MotionControl;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace Model
{
/// <summary>
/// 机种类
/// </summary>
public class MachineModel : NotificationObject
{
/// <summary>
/// ID
/// </summary>
public int ID { get; set; }
private string machineName;
/// <summary>
/// 机种名称
/// </summary>
public string MachineName
{
get { return machineName; }
set
{
machineName = value;
this.RaisePropertyChanged("MachineName");
}
}
private DateTime addTime;
/// <summary>
/// 添加时间
/// </summary>
public DateTime AddTime
{
get { return addTime; }
set
{
addTime = value;
this.RaisePropertyChanged("AddTime");
}
}
private bool enableS;
/// <summary>
/// 是否启用
/// </summary>
public bool EnableS
{
get { return enableS; }
set
{
enableS = value;
this.RaisePropertyChanged("EnableS");
}
}
private long productionTime;
/// <summary>
/// 此机种生产时间
/// </summary>
public long ProductionTime
{
get { return productionTime; }
set
{
productionTime = value;
RunSpan = new TimeSpan(value);
}
}
private int quantitys;
/// <summary>
/// 生产数量(投入数量)
/// </summary>
public int Quantitys
{
get { return quantitys; }
set
{
quantitys = value;
try
{
RejectRatio = Math.Round(((decimal)Produce / value), 4);
}
catch
{
}
this.RaisePropertyChanged("Quantitys");
}
}
private int produce;
/// <summary>
/// 产出数量
/// </summary>
public int Produce
{
get { return produce; }
set
{
produce = value;
try
{
ProduceBads = Quantitys - value;
RejectRatio = Math.Round(((decimal)value / Quantitys), 4);
}
catch
{
}
this.RaisePropertyChanged("Produce");
}
}
private int produceBads;
/// <summary>
/// 产出不良
/// </summary>
public int ProduceBads
{
get { return produceBads; }
set
{
produceBads = value;
this.RaisePropertyChanged("ProduceBads");
}
}
private decimal rejectRatio;
/// <summary>
/// 良率
/// </summary>
public decimal RejectRatio
{
get { return rejectRatio; }
set
{
rejectRatio = value;
this.RaisePropertyChanged("RejectRatio");
}
}
/// <summary>
/// 此机种生产的时间间隔
/// </summary>
public TimeSpan RunSpan { get; set; }
private int capacity;
/// <summary>
/// 产能
/// </summary>
public int Capacity
{
get { return capacity; }
set
{
capacity = value;
this.RaisePropertyChanged("Capacity");
}
}
private int coloumsNumber;
/// <summary>
/// 料盘列数
/// </summary>
public int ColoumsNumber
{
get { return coloumsNumber; }
set
{
coloumsNumber = value;
this.RaisePropertyChanged("ColoumsNumber");
}
}
private int rowsNumber;
/// <summary>
/// 料盘行数
/// </summary>
public int RowsNumber
{
get { return rowsNumber; }
set
{
rowsNumber = value;
this.RaisePropertyChanged("RowsNumber");
}
}
private int pictureColoumns;
/// <summary>
/// 进料连板列数
/// </summary>
public int PictureColoumns
{
get { return pictureColoumns; }
set
{
pictureColoumns = value;
this.RaisePropertyChanged("PictureColoumns");
}
}
private int pictureRows;
/// <summary>
/// 进料连板行数
/// </summary>
public int PictureRows
{
get { return pictureRows; }
set { pictureRows = value; this.RaisePropertyChanged("PictureRows"); }
}
private double p_lenght;
/// <summary>
/// 产品长度
/// </summary>
public double P_lenght
{
get { return p_lenght; }
set { p_lenght = value; RaisePropertyChanged("P_lenght"); }
}
private double p_width;
/// <summary>
/// 产品宽度
/// </summary>
public double P_width
{
get { return p_width; }
set { p_width = value; RaisePropertyChanged("P_width"); }
}
private double lenght_dev;
/// <summary>
/// 长度偏差值
/// </summary>
public double Lenght_dev
{
get { return lenght_dev; }
set
{
lenght_dev = value;
RaisePropertyChanged("Lenght_dev");
}
}
private double width_dev;
/// <summary>
/// 宽度偏差值
/// </summary>
public double Width_dev
{
get { return width_dev; }
set
{
width_dev = value;
RaisePropertyChanged("Width_dev");
}
}
/// <summary>
/// 料盘1的产品状态字符串
/// </summary>
public string Tray1 { get; set; }
public string Tray2 { get; set; }
public string Tray3 { get; set; }
public string Tray4 { get; set; }
public string Tray5 { get; set; }
public string Tray6 { get; set; }
public string Tray7 { get; set; }
public string Tray8 { get; set; }
private List<RobotPoint> robotPointList;
/// <summary>
/// 机器人定位集合
/// </summary>
public List<RobotPoint> RobotPointList
{
get { return robotPointList; }
set { robotPointList = value; RaisePropertyChanged("RobotPointList"); }
}
private ObservableCollection<MotionPointModel> motionPointList;
/// <summary>
/// 运动点位集合
/// </summary>
public ObservableCollection<MotionPointModel> MotionPointList
{
get { return motionPointList; }
set { motionPointList = value; RaisePropertyChanged("MotionPointList"); }
}
/// <summary>
/// 运行轨迹集合
/// </summary>
public ObservableCollection<MotionTrajectoryModel> MotionTrajectoryList { get; set; }
#region 空跑模式
private bool runningMode;
/// <summary>
/// 空跑模式
/// </summary>
public bool RunningMode
{
get { return runningMode; }
set
{
runningMode = value;
this.RaisePropertyChanged("RunningMode");
}
}
#endregion
private QitaPar _MyQita;
public QitaPar MyQita
{
get { return _MyQita; }
set
{
if (value != null)
{
_MyQita = value;
}
else {
_MyQita = new QitaPar();
}
this.RaisePropertyChanged("MyQita");
}
}
public MachineModel()
{
RejectRatio = 0;
}
}
public class QitaPar : NotificationObject
{
private int _Total1;
public int Total1
{
get { return _Total1; }
set
{
_Total1 = value;
if (value > 0)
{
Yield1 = (double)_OK1 / value;
}
else
{
Yield1 = 0;
}
this.RaisePropertyChanged("Total1");
}
}
private double _Yield1;
public double Yield1
{
get { return _Yield1; }
set
{
_Yield1 = value;
this.RaisePropertyChanged("Yield1");
}
}
private int _OK1;
public int OK1
{
get { return _OK1; }
set
{
_OK1 = value;
Total1 = _OK1 + NG1;
this.RaisePropertyChanged("OK1");
}
}
private int _NG1;
public int NG1
{
get { return _NG1; }
set
{
_NG1 = value;
Total1 = _OK1 + NG1;
this.RaisePropertyChanged("NG1");
}
}
private int _Total2;
public int Total2
{
get { return _Total2; }
set
{
_Total2 = value;
if (value > 0)
{
Yield2 = (double)_OK2 / value;
}
else
{
Yield2 = 0;
}
this.RaisePropertyChanged("Total2");
}
}
private int _OK2;
public int OK2
{
get { return _OK2; }
set
{
_OK2 = value;
Total2 = _OK2 + NG2;
this.RaisePropertyChanged("OK2");
}
}
private int _NG2;
public int NG2
{
get { return _NG2; }
set
{
_NG2 = value;
Total2 = _OK2 + NG2;
this.RaisePropertyChanged("NG2");
}
}
private double _Yield2;
public double Yield2
{
get { return _Yield2; }
set
{
_Yield2 = value;
this.RaisePropertyChanged("Yield2");
}
}
}
}