using Community;
using DAL;
using MahApps.Metro.Controls.Dialogs;
using Model;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ViewModel
{
public class StandVM : NotificationObject
{
///
/// 上报异常的委托
///
///
public delegate void delegeateExcep(string str);
///
/// 上报异常的委托事件
///
public event delegeateExcep eventExcepReport;
///
/// 数据引擎
///
MainWindowDAL dal = new MainWindowDAL();
#region 站别参数
private StandModel myStand;
///
/// 站别参数
///
public StandModel MyStand
{
get { return myStand; }
set
{
myStand = value;
RaisePropertyChanged("MyStand");
}
}
#endregion
#region PLC连接对象
private SerialComModel myPLC;
///
/// PLC连接对象
///
public SerialComModel MyPLC
{
get { return myPLC; }
set
{
myPLC = value;
RaisePropertyChanged("MyPLC");
}
}
#endregion
#region 取料点
///
/// 取料点
///
public RobotPoint TakePoint { get; set; }
#endregion
#region 放料点
///
/// 放料点
///
public RobotPoint PutPoint { get; set; }
#endregion
#region 指令集合
private List cmdList;
///
/// 指令集合
///
public List CmdList
{
get { return cmdList; }
set { cmdList = value; RaisePropertyChanged("CmdList"); }
}
#endregion
#region 选中的测试指令
private CommonClass selectCmd;
///
/// 选中的测试指令
///
public CommonClass SelectCmd
{
get { return selectCmd; }
set { selectCmd = value; RaisePropertyChanged("SelectCmd"); }
}
#endregion
#region 各种方法
///
/// 手动发送测试指令
///
public DelegateCommand ShouDongSendCmdCommand { get; set; }
///
/// 生产数据清零
///
public DelegateCommand CountClearedCommand { get; set; }
#endregion
///
/// 当前机种对象
///
public MachineModel CurrMachine { get; set; }
private bool isEnable;
///
/// 编辑权限
///
public bool IsEnable
{
get { return isEnable; }
set { isEnable = value; RaisePropertyChanged("IsEnable"); }
}
#region 构造函数
///
/// 构造函数
///
public StandVM(StandModel sm)
{
this.MyStand = sm;
CmdList = new List() { new CommonClass() { CommonName="状态询问",CmdStr="A0 01 00 E0" },
new CommonClass() { CommonName="发送SN",CmdStr="SendSN"},
new CommonClass() { CommonName="PCB放置完成",CmdStr="A0 03 00 E0"},
new CommonClass() { CommonName="开始测试",CmdStr="A0 04 00 E0"},
};
ShouDongSendCmdCommand = new DelegateCommand() { ExecuteAction = new Action