You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
100 lines
6.6 KiB
C#
100 lines
6.6 KiB
C#
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using Avalonia.Controls;
|
|
|
|
namespace Sln.Wcs.UI.ViewModels.HMI;
|
|
|
|
public class HmiSignalItem
|
|
{
|
|
public string Name { get; set; } = "";
|
|
public string Address { get; set; } = "";
|
|
public string Value { get; set; } = "OFF";
|
|
public bool IsOn => Value == "ON";
|
|
}
|
|
|
|
public partial class PalletizerHMIViewModel
|
|
{
|
|
public string PageTitle => "码垛机 HMI";
|
|
|
|
public ObservableCollection<HmiSignalItem> Manual1Items { get; } = new();
|
|
public ObservableCollection<HmiSignalItem> Manual2Items { get; } = new();
|
|
public ObservableCollection<HmiSignalItem> AlarmItems { get; } = new();
|
|
public ObservableCollection<HmiSignalItem> InputItems { get; } = new();
|
|
public ObservableCollection<HmiSignalItem> OutputItems { get; } = new();
|
|
|
|
public PalletizerHMIViewModel()
|
|
{
|
|
// 手动操作
|
|
Manual1Items = new ObservableCollection<HmiSignalItem>
|
|
{
|
|
new(){Name="1#滚筒线正转",Address="DB100.DBX0.0"}, new(){Name="1#皮带线正转",Address="DB100.DBX0.1"},
|
|
new(){Name="1#侧推机构伸出",Address="DB100.DBX0.2"}, new(){Name="1#侧推机构缩回",Address="DB100.DBX0.3"},
|
|
new(){Name="1#阻挡上升",Address="DB100.DBX0.4"}, new(){Name="1#阻挡下降",Address="DB100.DBX0.5"},
|
|
new(){Name="1#侧推转弯伸出",Address="DB100.DBX0.6"}, new(){Name="1#侧推转弯缩回",Address="DB100.DBX0.7"},
|
|
};
|
|
Manual2Items = new ObservableCollection<HmiSignalItem>
|
|
{
|
|
new(){Name="2#滚筒线正转",Address="DB100.DBX16.0"}, new(){Name="2#皮带线正转",Address="DB100.DBX16.1"},
|
|
new(){Name="2#侧推机构伸出",Address="DB100.DBX16.2"}, new(){Name="2#侧推机构缩回",Address="DB100.DBX16.3"},
|
|
new(){Name="2#阻挡上升",Address="DB100.DBX16.4"}, new(){Name="2#阻挡下降",Address="DB100.DBX16.5"},
|
|
new(){Name="2#侧推机构2伸出",Address="DB100.DBX16.6"}, new(){Name="2#侧推机构2缩回",Address="DB100.DBX16.7"},
|
|
};
|
|
|
|
// 报警
|
|
AlarmItems = new ObservableCollection<HmiSignalItem>
|
|
{
|
|
new(){Name="1号滚筒线异常",Address="DB102.DBX0.0"}, new(){Name="1号皮带线异常",Address="DB102.DBX0.1"},
|
|
new(){Name="2号滚筒线异常",Address="DB102.DBX0.2"}, new(){Name="2号皮带线异常",Address="DB102.DBX0.3"},
|
|
new(){Name="1号侧推伸出超时",Address="DB102.DBX0.4"}, new(){Name="1号侧推缩回超时",Address="DB102.DBX0.5"},
|
|
new(){Name="1号阻挡伸出超时",Address="DB102.DBX0.6"}, new(){Name="1号阻挡缩回超时",Address="DB102.DBX0.7"},
|
|
new(){Name="1号侧推转弯伸出超时",Address="DB102.DBX1.0"}, new(){Name="1号侧推转弯缩回超时",Address="DB102.DBX1.1"},
|
|
new(){Name="2号侧推伸出超时",Address="DB102.DBX1.2"}, new(){Name="2号侧推缩回超时",Address="DB102.DBX1.3"},
|
|
new(){Name="2号阻挡伸出超时",Address="DB102.DBX1.4"}, new(){Name="2号阻挡缩回超时",Address="DB102.DBX1.5"},
|
|
};
|
|
|
|
// 输入
|
|
InputItems = new ObservableCollection<HmiSignalItem>
|
|
{
|
|
new(){Name="急停",Address="DB103.DBX0.0"}, new(){Name="复位1",Address="DB103.DBX0.1"},
|
|
new(){Name="手动1",Address="DB103.DBX0.2"}, new(){Name="自动1",Address="DB103.DBX0.3"},
|
|
new(){Name="实施1",Address="DB103.DBX0.4"}, new(){Name="复位2",Address="DB103.DBX0.5"},
|
|
new(){Name="手动2",Address="DB103.DBX0.6"}, new(){Name="自动2",Address="DB103.DBX0.7"},
|
|
new(){Name="实施2",Address="DB103.DBX1.0"}, new(){Name="1号入口到位",Address="DB103.DBX1.1"},
|
|
new(){Name="1号出口到位",Address="DB103.DBX1.2"}, new(){Name="1号喷码到位",Address="DB103.DBX1.3"},
|
|
new(){Name="1号阻挡原位",Address="DB103.DBX1.4"}, new(){Name="1号阻挡工作位",Address="DB103.DBX1.5"},
|
|
new(){Name="1号侧推原位",Address="DB103.DBX1.6"}, new(){Name="1号侧推工作位",Address="DB103.DBX1.7"},
|
|
new(){Name="1号扫码位置",Address="DB103.DBX2.0"}, new(){Name="2号入口到位",Address="DB103.DBX2.1"},
|
|
new(){Name="2号出口到位",Address="DB103.DBX2.2"}, new(){Name="2号喷码到位",Address="DB103.DBX2.3"},
|
|
new(){Name="2号阻挡原位",Address="DB103.DBX2.4"}, new(){Name="2号阻挡工作位",Address="DB103.DBX2.5"},
|
|
new(){Name="2号侧推原位",Address="DB103.DBX2.6"}, new(){Name="2号侧推工作位",Address="DB103.DBX2.7"},
|
|
new(){Name="2号扫码位置",Address="DB103.DBX3.0"}, new(){Name="1号滚筒电机异常",Address="DB103.DBX3.1"},
|
|
new(){Name="1号皮带电机异常",Address="DB103.DBX3.2"}, new(){Name="2号滚筒电机异常",Address="DB103.DBX3.3"},
|
|
new(){Name="2号皮带电机异常",Address="DB103.DBX3.4"}, new(){Name="1号侧推转弯原位",Address="DB103.DBX3.5"},
|
|
new(){Name="1号侧推转弯工作位",Address="DB103.DBX3.6"},
|
|
};
|
|
|
|
// 输出
|
|
OutputItems = new ObservableCollection<HmiSignalItem>
|
|
{
|
|
new(){Name="1号滚筒线正转",Address="DB103.DBX4.0"}, new(){Name="1号皮带线正转",Address="DB103.DBX4.1"},
|
|
new(){Name="2号滚筒线正转",Address="DB103.DBX4.2"}, new(){Name="2号皮带线正转",Address="DB103.DBX4.3"},
|
|
new(){Name="1号侧推机构伸出",Address="DB103.DBX4.4"}, new(){Name="1号侧推机构缩回",Address="DB103.DBX4.5"},
|
|
new(){Name="2号侧推机构伸出",Address="DB103.DBX4.6"}, new(){Name="2号侧推机构缩回",Address="DB103.DBX4.7"},
|
|
new(){Name="1号阻挡器伸出",Address="DB103.DBX5.0"}, new(){Name="1号阻挡器缩回",Address="DB103.DBX5.1"},
|
|
new(){Name="2号阻挡器伸出",Address="DB103.DBX5.2"}, new(){Name="2号阻挡器缩回",Address="DB103.DBX5.3"},
|
|
new(){Name="1号侧推转弯伸出",Address="DB103.DBX5.4"}, new(){Name="1号侧推转弯缩回",Address="DB103.DBX5.5"},
|
|
new(){Name="电源指示灯",Address="DB103.DBX5.6"}, new(){Name="红灯",Address="DB103.DBX5.7"},
|
|
new(){Name="黄灯",Address="DB103.DBX6.0"}, new(){Name="绿灯",Address="DB103.DBX6.1"},
|
|
new(){Name="蜂鸣",Address="DB103.DBX6.2"}, new(){Name="运行灯1",Address="DB103.DBX6.3"},
|
|
new(){Name="复位灯1",Address="DB103.DBX6.4"}, new(){Name="运行灯2",Address="DB103.DBX6.5"},
|
|
new(){Name="复位灯2",Address="DB103.DBX6.6"},
|
|
};
|
|
}
|
|
|
|
public Control CreateView()
|
|
{
|
|
var view = new Views.HMI.PalletizerHMIView { DataContext = this };
|
|
return view;
|
|
}
|
|
}
|