448 lines
10 KiB
C#
448 lines
10 KiB
C#
using Community;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
|
|
namespace Model
|
|
{
|
|
/// <summary>
|
|
/// 站别模型
|
|
/// </summary>
|
|
public class StandModel : NotificationObject
|
|
{
|
|
/// <summary>
|
|
/// 刷新图表的委托
|
|
/// </summary>
|
|
/// <param name="hv"></param>
|
|
public delegate void delegeateRefreshChart(int InOnOut, int number);
|
|
/// <summary>
|
|
/// 刷新图表的委托事件
|
|
/// </summary>
|
|
public event delegeateRefreshChart eventRefreshChart;
|
|
|
|
#region 基本信息
|
|
public int ID { get; set; }
|
|
/// <summary>
|
|
/// 上级ID
|
|
/// </summary>
|
|
public int ParentID { get; set; }
|
|
|
|
#region 站别名称
|
|
private string standName;
|
|
/// <summary>
|
|
/// 站别名称
|
|
/// </summary>
|
|
public string StandName
|
|
{
|
|
get { return standName; }
|
|
set
|
|
{
|
|
standName = value;
|
|
RaisePropertyChanged("StandName");
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 简码
|
|
private string shortCode;
|
|
/// <summary>
|
|
/// 简码
|
|
/// </summary>
|
|
public string ShortCode
|
|
{
|
|
get { return shortCode; }
|
|
set
|
|
{
|
|
shortCode = value;
|
|
RaisePropertyChanged("ShortCode");
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 工位
|
|
private string stationNo;
|
|
/// <summary>
|
|
/// 工位
|
|
/// </summary>
|
|
public string StationNo
|
|
{
|
|
get { return stationNo; }
|
|
set
|
|
{
|
|
stationNo = value;
|
|
RaisePropertyChanged("StationNo");
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 机台编号
|
|
private string machineNumber;
|
|
/// <summary>
|
|
/// 机台编号
|
|
/// </summary>
|
|
public string MachineNumber
|
|
{
|
|
get { return machineNumber; }
|
|
set
|
|
{
|
|
machineNumber = value;
|
|
RaisePropertyChanged("MachineNumber");
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 站别类型 预留
|
|
private int standType;
|
|
/// <summary>
|
|
/// 站别类型 预留
|
|
/// </summary>
|
|
public int StandType
|
|
{
|
|
get { return standType; }
|
|
set
|
|
{
|
|
standType = value;
|
|
RaisePropertyChanged("StandType");
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region PLCID
|
|
private int plcID;
|
|
/// <summary>
|
|
/// PLCID
|
|
/// </summary>
|
|
public int PlcID
|
|
{
|
|
get { return plcID; }
|
|
set
|
|
{
|
|
plcID = value;
|
|
RaisePropertyChanged("PlcID");
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 设备1 ID
|
|
private int deviceID1;
|
|
/// <summary>
|
|
/// 设备1 ID
|
|
/// </summary>
|
|
public int DeviceID1
|
|
{
|
|
get { return deviceID1; }
|
|
set
|
|
{
|
|
deviceID1 = value;
|
|
RaisePropertyChanged("DeviceID1");
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 设备2 ID
|
|
private int deviceID2;
|
|
/// <summary>
|
|
/// 设备2 ID
|
|
/// </summary>
|
|
public int DeviceID2
|
|
{
|
|
get { return deviceID2; }
|
|
set
|
|
{
|
|
deviceID2 = value;
|
|
RaisePropertyChanged("DeviceID2");
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 设备3 ID
|
|
private int deviceID3;
|
|
/// <summary>
|
|
/// 设备3 ID
|
|
/// </summary>
|
|
public int DeviceID3
|
|
{
|
|
get { return deviceID3; }
|
|
set
|
|
{
|
|
deviceID3 = value;
|
|
RaisePropertyChanged("DeviceID3");
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 设备4 ID
|
|
private int deviceID4;
|
|
/// <summary>
|
|
/// 设备4 ID
|
|
/// </summary>
|
|
public int DeviceID4
|
|
{
|
|
get { return deviceID4; }
|
|
set
|
|
{
|
|
deviceID4 = value;
|
|
RaisePropertyChanged("DeviceID4");
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 设备5 ID
|
|
private int deviceID5;
|
|
/// <summary>
|
|
/// 设备5 ID
|
|
/// </summary>
|
|
public int DeviceID5
|
|
{
|
|
get { return deviceID5; }
|
|
set
|
|
{
|
|
deviceID5 = value;
|
|
RaisePropertyChanged("DeviceID5");
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 连续NG次数
|
|
private int ngCount;
|
|
/// <summary>
|
|
/// 连续NG次数
|
|
/// </summary>
|
|
public int NgCount
|
|
{
|
|
get { return ngCount; }
|
|
set { ngCount = value; RaisePropertyChanged("NgCount"); }
|
|
}
|
|
#endregion
|
|
|
|
#region 站别状态
|
|
private ShowInfo standState;
|
|
/// <summary>
|
|
/// 站别状态
|
|
/// </summary>
|
|
public ShowInfo StandState
|
|
{
|
|
get { return standState; }
|
|
set
|
|
{
|
|
standState = value == null ? StandState = new ShowInfo() { StatusBackground = ColorStr.Gray, StatuInfo = "等待运行" } : value;
|
|
RaisePropertyChanged("StandState");
|
|
}
|
|
}
|
|
|
|
private ShowInfo product;
|
|
/// <summary>
|
|
/// 产品信息
|
|
/// </summary>
|
|
public ShowInfo Product
|
|
{
|
|
get { return product; }
|
|
set
|
|
{
|
|
product = value == null ? new ShowInfo() : value;
|
|
RaisePropertyChanged("Product");
|
|
}
|
|
}
|
|
|
|
private ShowInfo testRes;
|
|
/// <summary>
|
|
/// 测试结果
|
|
/// </summary>
|
|
public ShowInfo TestRes
|
|
{
|
|
get { return testRes; }
|
|
set { testRes = value; RaisePropertyChanged("TestRes"); }
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 启用
|
|
private bool enableing;
|
|
/// <summary>
|
|
/// 启用
|
|
/// </summary>
|
|
public bool Enableing
|
|
{
|
|
get { return enableing; }
|
|
set
|
|
{
|
|
enableing = value;
|
|
if (!value)
|
|
{
|
|
VisibilitySoft = Visibility.Collapsed;
|
|
}
|
|
else
|
|
{
|
|
VisibilitySoft = Visibility.Visible;
|
|
}
|
|
RaisePropertyChanged("Enableing");
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 机台数据
|
|
private string runTime;
|
|
/// <summary>
|
|
/// 测试时间
|
|
/// </summary>
|
|
public string RunTime
|
|
{
|
|
get { return runTime; }
|
|
set
|
|
{
|
|
runTime = value;
|
|
RaisePropertyChanged("RunTime");
|
|
}
|
|
}
|
|
|
|
private int inputQuantity;
|
|
/// <summary>
|
|
/// 投入数量
|
|
/// </summary>
|
|
public int InputQuantity
|
|
{
|
|
get { return inputQuantity; }
|
|
set
|
|
{
|
|
inputQuantity = value;
|
|
try
|
|
{
|
|
if (OutputQuantity != 0)
|
|
{
|
|
Yield = Math.Round(((decimal)OutputQuantity / value), 4);
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
|
|
}
|
|
RaisePropertyChanged("InputQuantity");
|
|
}
|
|
}
|
|
|
|
|
|
private int outputQuantity;
|
|
/// <summary>
|
|
/// 产出数量
|
|
/// </summary>
|
|
public int OutputQuantity
|
|
{
|
|
get { return outputQuantity; }
|
|
set
|
|
{
|
|
outputQuantity = value;
|
|
try
|
|
{
|
|
if (value != 0 && value <= InputQuantity)
|
|
{
|
|
Yield = Math.Round(((decimal)value / InputQuantity), 4);
|
|
}
|
|
BadQuantity = InputQuantity - value;
|
|
}
|
|
catch
|
|
{
|
|
|
|
}
|
|
RaisePropertyChanged("OutputQuantity");
|
|
}
|
|
}
|
|
|
|
private int badQuantity;
|
|
/// <summary>
|
|
/// 不良数量
|
|
/// </summary>
|
|
public int BadQuantity
|
|
{
|
|
get { return badQuantity; }
|
|
set
|
|
{
|
|
badQuantity = value;
|
|
RaisePropertyChanged("BadQuantity");
|
|
}
|
|
}
|
|
|
|
private double cTime;
|
|
/// <summary>
|
|
/// C/T时间
|
|
/// </summary>
|
|
public double CTime
|
|
{
|
|
get { return cTime; }
|
|
set
|
|
{
|
|
cTime = value;
|
|
RaisePropertyChanged("CTime");
|
|
}
|
|
}
|
|
|
|
private decimal yield;
|
|
/// <summary>
|
|
/// 良率
|
|
/// </summary>
|
|
public decimal Yield
|
|
{
|
|
get { return yield; }
|
|
set
|
|
{
|
|
yield = value;
|
|
RaisePropertyChanged("Yield");
|
|
}
|
|
}
|
|
|
|
private int capacity;
|
|
/// <summary>
|
|
/// 产能
|
|
/// </summary>
|
|
public int Capacity
|
|
{
|
|
get { return capacity; }
|
|
set
|
|
{
|
|
capacity = value;
|
|
RaisePropertyChanged("Capacity");
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region 站别是否可见
|
|
private Visibility visibilitySoft;
|
|
/// <summary>
|
|
/// 站别是否可见
|
|
/// </summary>
|
|
public Visibility VisibilitySoft
|
|
{
|
|
get { return visibilitySoft; }
|
|
set
|
|
{
|
|
visibilitySoft = value;
|
|
RaisePropertyChanged("VisibilitySoft");
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 构造函数
|
|
/// <summary>
|
|
/// 构造函数
|
|
/// </summary>
|
|
public StandModel()
|
|
{
|
|
StandState = new ShowInfo() { StatusBackground = ColorStr.Gray, StatuInfo = "等待运行" };
|
|
|
|
TestRes = new ShowInfo() { StatusBackground = ColorStr.Gray, StatuInfo = "unknown" };
|
|
Product = new ShowInfo();
|
|
|
|
|
|
}
|
|
#endregion
|
|
|
|
|
|
}
|
|
}
|