首次提交lilili
This commit is contained in:
parent
fabc7606e7
commit
bc981fc7a9
@ -20,7 +20,11 @@ namespace DH.Commons.Base
|
|||||||
private Parity _parity = Parity.None;
|
private Parity _parity = Parity.None;
|
||||||
private string _ip = "192.168.6.61";
|
private string _ip = "192.168.6.61";
|
||||||
private int _port = 502;
|
private int _port = 502;
|
||||||
private AntList<PLCItem> _PLCItemList = new AntList<PLCItem>();
|
private BindingList<PLCItem> _PLCItemList = new BindingList<PLCItem>();
|
||||||
|
private BindingList<PLCItem> _PLCStartProcessList = new BindingList<PLCItem>();
|
||||||
|
private BindingList<PLCItem> _PLCStopProcessList = new BindingList<PLCItem>();
|
||||||
|
private BindingList<PLCItem> _PLCStartResetList = new BindingList<PLCItem>();
|
||||||
|
private BindingList<PLCItem> _PLCStopResetList = new BindingList<PLCItem>();
|
||||||
[Category("设备配置")]
|
[Category("设备配置")]
|
||||||
[DisplayName("是否启用")]
|
[DisplayName("是否启用")]
|
||||||
[Description("是否启用")]
|
[Description("是否启用")]
|
||||||
@ -179,7 +183,7 @@ namespace DH.Commons.Base
|
|||||||
[Category("点位配置")]
|
[Category("点位配置")]
|
||||||
[DisplayName("点位配置")]
|
[DisplayName("点位配置")]
|
||||||
[Description("点位配置")]
|
[Description("点位配置")]
|
||||||
public AntList<PLCItem> PLCItemList
|
public BindingList<PLCItem> PLCItemList
|
||||||
{
|
{
|
||||||
get => _PLCItemList;
|
get => _PLCItemList;
|
||||||
set
|
set
|
||||||
@ -189,6 +193,47 @@ namespace DH.Commons.Base
|
|||||||
OnPropertyChanged(nameof(PLCItemList));
|
OnPropertyChanged(nameof(PLCItemList));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BindingList<PLCItem> PLCStartProcessList
|
||||||
|
{
|
||||||
|
get => _PLCStartProcessList;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_PLCStartProcessList == value) return;
|
||||||
|
_PLCStartProcessList = value;
|
||||||
|
OnPropertyChanged(nameof(PLCStartProcessList));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public BindingList<PLCItem> PLCStopProcessList
|
||||||
|
{
|
||||||
|
get => _PLCStopProcessList;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_PLCStopProcessList == value) return;
|
||||||
|
_PLCStopProcessList = value;
|
||||||
|
OnPropertyChanged(nameof(PLCStopProcessList));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public BindingList<PLCItem> PLCStartResetList
|
||||||
|
{
|
||||||
|
get => _PLCStartResetList;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_PLCStartResetList == value) return;
|
||||||
|
_PLCStartResetList = value;
|
||||||
|
OnPropertyChanged(nameof(PLCStartResetList));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public BindingList<PLCItem> PLCStopResetList
|
||||||
|
{
|
||||||
|
get => _PLCStopResetList;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_PLCStopResetList == value) return;
|
||||||
|
_PLCStopResetList = value;
|
||||||
|
OnPropertyChanged(nameof(PLCStopResetList));
|
||||||
|
}
|
||||||
|
}
|
||||||
public virtual bool PLCConnect()
|
public virtual bool PLCConnect()
|
||||||
{
|
{
|
||||||
Connected = true;
|
Connected = true;
|
||||||
@ -209,6 +254,8 @@ namespace DH.Commons.Base
|
|||||||
public virtual bool WriteShort(string address, short value, bool waitForReply = true) { return false; }
|
public virtual bool WriteShort(string address, short value, bool waitForReply = true) { return false; }
|
||||||
public virtual bool WriteInt(string address, int value, bool waitForReply = true) { return false; }
|
public virtual bool WriteInt(string address, int value, bool waitForReply = true) { return false; }
|
||||||
public virtual bool WriteDInt(string address, int value, bool waitForReply = true) { return false; }
|
public virtual bool WriteDInt(string address, int value, bool waitForReply = true) { return false; }
|
||||||
|
|
||||||
|
public virtual bool WriteDInt1(string address, int value, bool waitForReply = true) { return false; }
|
||||||
public virtual bool WriteFloat(string address, float value, bool waitForReply = true) { return false; }
|
public virtual bool WriteFloat(string address, float value, bool waitForReply = true) { return false; }
|
||||||
public virtual bool WriteBool(string address, bool value, bool waitForReply = true) { return false; }
|
public virtual bool WriteBool(string address, bool value, bool waitForReply = true) { return false; }
|
||||||
}
|
}
|
||||||
@ -218,13 +265,10 @@ namespace DH.Commons.Base
|
|||||||
{
|
{
|
||||||
private bool _selected;
|
private bool _selected;
|
||||||
private string _name = string.Empty;
|
private string _name = string.Empty;
|
||||||
private string _type = string.Empty;
|
private EnumPLCDataType _type;
|
||||||
private string _value = string.Empty;
|
private string _value = string.Empty;
|
||||||
private bool _startexecute;
|
private bool _startexecute;
|
||||||
private bool _endexecute;
|
|
||||||
private int _startindex;
|
private int _startindex;
|
||||||
private int _endindex;
|
|
||||||
private string _numtype;
|
|
||||||
private string _address;
|
private string _address;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否选中
|
/// 是否选中
|
||||||
@ -257,7 +301,7 @@ namespace DH.Commons.Base
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public string Type
|
public EnumPLCDataType Type
|
||||||
{
|
{
|
||||||
get => _type;
|
get => _type;
|
||||||
set
|
set
|
||||||
@ -284,18 +328,7 @@ namespace DH.Commons.Base
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public string NumTpye
|
|
||||||
{
|
|
||||||
get => _numtype;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (_numtype != value)
|
|
||||||
{
|
|
||||||
_numtype = value;
|
|
||||||
OnPropertyChanged(nameof(NumTpye));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 参数值
|
/// 参数值
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -313,7 +346,7 @@ namespace DH.Commons.Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 流程开启执行状态
|
/// 启用状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool StartExecute
|
public bool StartExecute
|
||||||
{
|
{
|
||||||
@ -327,27 +360,13 @@ namespace DH.Commons.Base
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// 流程结束执行状态
|
|
||||||
/// </summary>
|
|
||||||
public bool EndExecute
|
|
||||||
{
|
|
||||||
get => _endexecute;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (_endexecute != value)
|
|
||||||
{
|
|
||||||
_endexecute = value;
|
|
||||||
OnPropertyChanged(nameof(EndExecute));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 流程开启顺序
|
/// 顺序
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int StartIndex
|
public int StartIndex
|
||||||
{
|
{
|
||||||
@ -361,21 +380,6 @@ namespace DH.Commons.Base
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// 流程结束顺序
|
|
||||||
/// </summary>
|
|
||||||
public int EndIndex
|
|
||||||
{
|
|
||||||
get => _endindex;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (_endindex != value)
|
|
||||||
{
|
|
||||||
_endindex = value;
|
|
||||||
OnPropertyChanged(nameof(EndIndex));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private CellLink[] cellLinks;
|
private CellLink[] cellLinks;
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
@ -390,18 +394,18 @@ namespace DH.Commons.Base
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private CellTag[] cellTags;
|
//private CellTag[] cellTags;
|
||||||
[JsonIgnore]
|
//[JsonIgnore]
|
||||||
public CellTag[] CellTags
|
//public CellTag[] CellTags
|
||||||
{
|
//{
|
||||||
get { return cellTags; }
|
// get { return cellTags; }
|
||||||
set
|
// set
|
||||||
{
|
// {
|
||||||
if (cellTags == value) return;
|
// if (cellTags == value) return;
|
||||||
cellTags = value;
|
// cellTags = value;
|
||||||
OnPropertyChanged(nameof(CellTags));
|
// OnPropertyChanged(nameof(CellTags));
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -111,16 +111,16 @@ namespace DH.Commons.Enums
|
|||||||
|
|
||||||
public enum EnumPLCDataType
|
public enum EnumPLCDataType
|
||||||
{
|
{
|
||||||
HD,
|
单字整型,
|
||||||
D,
|
双字整型,
|
||||||
M
|
浮点型,
|
||||||
|
布尔型
|
||||||
}
|
}
|
||||||
public enum EnumPLCINTType
|
|
||||||
|
public enum EnumBool
|
||||||
{
|
{
|
||||||
单字16位,
|
关闭,
|
||||||
单字32位,
|
启用
|
||||||
双字16位,
|
|
||||||
双字32位
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum StreamFormat
|
public enum StreamFormat
|
||||||
|
@ -304,7 +304,52 @@ namespace DH.Devices.PLC
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 写单独地址 Dint 值- 待测试
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="address"></param>
|
||||||
|
/// <param name="writeValue"></param>
|
||||||
|
/// <param name="waitForReply"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public override bool WriteDInt1(string address, int writeValue, bool waitForReply = true)
|
||||||
|
{
|
||||||
|
// 1. 地址格式解析
|
||||||
|
var match = Regex.Match(address, @"^([A-Za-z]+)(\d+)$");
|
||||||
|
if (!match.Success)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"地址格式错误: {address}");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
string prefix = match.Groups[1].Value; // 提取字母部分(如"D"或"HD")
|
||||||
|
int baseAddr = int.Parse(match.Groups[2].Value); // 提取数字部分(如100)
|
||||||
|
|
||||||
|
// 2. 数值拆分为两个16位值(大端序)
|
||||||
|
byte[] bytes = BitConverter.GetBytes(writeValue);
|
||||||
|
short high = BitConverter.ToInt16(bytes, 2); // 高16位
|
||||||
|
short low = BitConverter.ToInt16(bytes, 0); // 低16位
|
||||||
|
|
||||||
|
// 3. 构造高低位地址
|
||||||
|
string highAddress = $"{prefix}{baseAddr + 1}"; // 如"D101"或"HD101"
|
||||||
|
string lowAddress = $"{prefix}{baseAddr}"; // 如"D100"或"HD100"
|
||||||
|
|
||||||
|
// 4. 写入操作(带重试)
|
||||||
|
for (int i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!TcpNet.Write(highAddress, high).IsSuccess) continue;
|
||||||
|
Thread.Sleep(10);
|
||||||
|
return TcpNet.Write(lowAddress, low).IsSuccess;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"写入失败: {ex.Message}");
|
||||||
|
Thread.Sleep(50 * (i + 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 写单独地址 float 值
|
/// 写单独地址 float 值
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -684,6 +684,11 @@ namespace DHSoftware
|
|||||||
_productLists.Add(products);
|
_productLists.Add(products);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//流程执行时PLC
|
||||||
|
StartPLCAction();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 转盘操作
|
// 转盘操作
|
||||||
// if (_PLC?.IIConfig?.IsEnabled == true)
|
// if (_PLC?.IIConfig?.IsEnabled == true)
|
||||||
|
|
||||||
@ -708,6 +713,21 @@ namespace DHSoftware
|
|||||||
// MachineState = MachineState.Running;
|
// MachineState = MachineState.Running;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 流程开始执行PLC
|
||||||
|
/// </summary>
|
||||||
|
private void StartPLCAction()
|
||||||
|
{
|
||||||
|
if (PLC.PLCItemList?.Count > 0)
|
||||||
|
{
|
||||||
|
List<PLCItem> startPLCList= PLC.PLCItemList.Where(it=>it.StartExecute).ToList();
|
||||||
|
if (startPLCList?.Count > 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void PrepareMLEngine()
|
private void PrepareMLEngine()
|
||||||
{
|
{
|
||||||
//if (_visionEngine == null)
|
//if (_visionEngine == null)
|
||||||
|
361
DHSoftware/Views/MotionControl.Designer.cs
generated
361
DHSoftware/Views/MotionControl.Designer.cs
generated
@ -28,6 +28,7 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
|
AntdUI.Tabs.StyleLine styleLine1 = new AntdUI.Tabs.StyleLine();
|
||||||
stackPanel2 = new AntdUI.StackPanel();
|
stackPanel2 = new AntdUI.StackPanel();
|
||||||
swhEnable = new AntdUI.Switch();
|
swhEnable = new AntdUI.Switch();
|
||||||
label4 = new AntdUI.Label();
|
label4 = new AntdUI.Label();
|
||||||
@ -56,9 +57,32 @@
|
|||||||
stpBaud = new AntdUI.StackPanel();
|
stpBaud = new AntdUI.StackPanel();
|
||||||
cmbBaudRate = new AntdUI.Select();
|
cmbBaudRate = new AntdUI.Select();
|
||||||
label3 = new AntdUI.Label();
|
label3 = new AntdUI.Label();
|
||||||
|
tabs1 = new AntdUI.Tabs();
|
||||||
|
tabPage1 = new AntdUI.TabPage();
|
||||||
PLCItemsTable = new AntdUI.Table();
|
PLCItemsTable = new AntdUI.Table();
|
||||||
|
panel1 = new AntdUI.Panel();
|
||||||
btnDelete = new AntdUI.Button();
|
btnDelete = new AntdUI.Button();
|
||||||
btnAdd = new AntdUI.Button();
|
btnAdd = new AntdUI.Button();
|
||||||
|
tabPage2 = new AntdUI.TabPage();
|
||||||
|
TableSartProcess = new AntdUI.Table();
|
||||||
|
panel2 = new AntdUI.Panel();
|
||||||
|
btnSartProcessDelete = new AntdUI.Button();
|
||||||
|
btnSartProcessAdd = new AntdUI.Button();
|
||||||
|
tabPage3 = new AntdUI.TabPage();
|
||||||
|
TableStopProcess = new AntdUI.Table();
|
||||||
|
panel3 = new AntdUI.Panel();
|
||||||
|
btnStopProcessDelete = new AntdUI.Button();
|
||||||
|
btnStopProcessAdd = new AntdUI.Button();
|
||||||
|
tabPage4 = new AntdUI.TabPage();
|
||||||
|
TableStartReset = new AntdUI.Table();
|
||||||
|
panel4 = new AntdUI.Panel();
|
||||||
|
btnStartResetDelete = new AntdUI.Button();
|
||||||
|
btnStartResetAdd = new AntdUI.Button();
|
||||||
|
tabPage5 = new AntdUI.TabPage();
|
||||||
|
TableStopReset = new AntdUI.Table();
|
||||||
|
panel5 = new AntdUI.Panel();
|
||||||
|
btnStopResetDelete = new AntdUI.Button();
|
||||||
|
btnStopResetAdd = new AntdUI.Button();
|
||||||
stackPanel2.SuspendLayout();
|
stackPanel2.SuspendLayout();
|
||||||
stackPanel3.SuspendLayout();
|
stackPanel3.SuspendLayout();
|
||||||
stpCom.SuspendLayout();
|
stpCom.SuspendLayout();
|
||||||
@ -69,6 +93,17 @@
|
|||||||
stpStop.SuspendLayout();
|
stpStop.SuspendLayout();
|
||||||
stpData.SuspendLayout();
|
stpData.SuspendLayout();
|
||||||
stpBaud.SuspendLayout();
|
stpBaud.SuspendLayout();
|
||||||
|
tabs1.SuspendLayout();
|
||||||
|
tabPage1.SuspendLayout();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
tabPage2.SuspendLayout();
|
||||||
|
panel2.SuspendLayout();
|
||||||
|
tabPage3.SuspendLayout();
|
||||||
|
panel3.SuspendLayout();
|
||||||
|
tabPage4.SuspendLayout();
|
||||||
|
panel4.SuspendLayout();
|
||||||
|
tabPage5.SuspendLayout();
|
||||||
|
panel5.SuspendLayout();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// stackPanel2
|
// stackPanel2
|
||||||
@ -164,9 +199,10 @@
|
|||||||
stackPanel1.Controls.Add(stpCom);
|
stackPanel1.Controls.Add(stpCom);
|
||||||
stackPanel1.Controls.Add(stackPanel3);
|
stackPanel1.Controls.Add(stackPanel3);
|
||||||
stackPanel1.Controls.Add(stackPanel2);
|
stackPanel1.Controls.Add(stackPanel2);
|
||||||
stackPanel1.Location = new Point(19, 16);
|
stackPanel1.Dock = DockStyle.Left;
|
||||||
|
stackPanel1.Location = new Point(0, 0);
|
||||||
stackPanel1.Name = "stackPanel1";
|
stackPanel1.Name = "stackPanel1";
|
||||||
stackPanel1.Size = new Size(223, 478);
|
stackPanel1.Size = new Size(223, 530);
|
||||||
stackPanel1.TabIndex = 25;
|
stackPanel1.TabIndex = 25;
|
||||||
stackPanel1.Text = "stackPanel1";
|
stackPanel1.Text = "stackPanel1";
|
||||||
stackPanel1.Vertical = true;
|
stackPanel1.Vertical = true;
|
||||||
@ -331,22 +367,63 @@
|
|||||||
label3.TabIndex = 24;
|
label3.TabIndex = 24;
|
||||||
label3.Text = "波 特 率";
|
label3.Text = "波 特 率";
|
||||||
//
|
//
|
||||||
|
// tabs1
|
||||||
|
//
|
||||||
|
tabs1.Dock = DockStyle.Fill;
|
||||||
|
tabs1.Location = new Point(223, 0);
|
||||||
|
tabs1.Name = "tabs1";
|
||||||
|
tabs1.Pages.Add(tabPage1);
|
||||||
|
tabs1.Pages.Add(tabPage2);
|
||||||
|
tabs1.Pages.Add(tabPage3);
|
||||||
|
tabs1.Pages.Add(tabPage4);
|
||||||
|
tabs1.Pages.Add(tabPage5);
|
||||||
|
tabs1.Size = new Size(675, 530);
|
||||||
|
tabs1.Style = styleLine1;
|
||||||
|
tabs1.TabIndex = 26;
|
||||||
|
tabs1.Text = "tabs1";
|
||||||
|
tabs1.SelectedIndex = 0;
|
||||||
|
//
|
||||||
|
// tabPage1
|
||||||
|
//
|
||||||
|
tabPage1.Controls.Add(PLCItemsTable);
|
||||||
|
tabPage1.Controls.Add(panel1);
|
||||||
|
tabPage1.Location = new Point(3, 28);
|
||||||
|
tabPage1.Name = "tabPage1";
|
||||||
|
tabPage1.Size = new Size(669, 499);
|
||||||
|
tabPage1.TabIndex = 0;
|
||||||
|
tabPage1.Text = "点位表";
|
||||||
|
//
|
||||||
// PLCItemsTable
|
// PLCItemsTable
|
||||||
//
|
//
|
||||||
|
PLCItemsTable.Dock = DockStyle.Fill;
|
||||||
PLCItemsTable.EmptyHeader = true;
|
PLCItemsTable.EmptyHeader = true;
|
||||||
PLCItemsTable.Location = new Point(238, 71);
|
PLCItemsTable.Location = new Point(0, 45);
|
||||||
PLCItemsTable.Name = "PLCItemsTable";
|
PLCItemsTable.Name = "PLCItemsTable";
|
||||||
PLCItemsTable.Size = new Size(634, 392);
|
PLCItemsTable.Padding = new Padding(5);
|
||||||
PLCItemsTable.TabIndex = 26;
|
PLCItemsTable.Size = new Size(669, 454);
|
||||||
|
PLCItemsTable.TabIndex = 36;
|
||||||
PLCItemsTable.Text = "table1";
|
PLCItemsTable.Text = "table1";
|
||||||
//
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.Back = Color.Transparent;
|
||||||
|
panel1.BackColor = SystemColors.Window;
|
||||||
|
panel1.Controls.Add(btnDelete);
|
||||||
|
panel1.Controls.Add(btnAdd);
|
||||||
|
panel1.Dock = DockStyle.Top;
|
||||||
|
panel1.Location = new Point(0, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(669, 45);
|
||||||
|
panel1.TabIndex = 35;
|
||||||
|
panel1.Text = "panel1";
|
||||||
|
//
|
||||||
// btnDelete
|
// btnDelete
|
||||||
//
|
//
|
||||||
btnDelete.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
btnDelete.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
btnDelete.Location = new Point(331, 27);
|
btnDelete.Location = new Point(110, 10);
|
||||||
btnDelete.Name = "btnDelete";
|
btnDelete.Name = "btnDelete";
|
||||||
btnDelete.Size = new Size(80, 32);
|
btnDelete.Size = new Size(74, 32);
|
||||||
btnDelete.TabIndex = 28;
|
btnDelete.TabIndex = 36;
|
||||||
btnDelete.Text = "删除";
|
btnDelete.Text = "删除";
|
||||||
btnDelete.Type = AntdUI.TTypeMini.Error;
|
btnDelete.Type = AntdUI.TTypeMini.Error;
|
||||||
btnDelete.WaveSize = 0;
|
btnDelete.WaveSize = 0;
|
||||||
@ -354,21 +431,243 @@
|
|||||||
// btnAdd
|
// btnAdd
|
||||||
//
|
//
|
||||||
btnAdd.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
btnAdd.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
btnAdd.Location = new Point(245, 27);
|
btnAdd.Location = new Point(13, 10);
|
||||||
btnAdd.Name = "btnAdd";
|
btnAdd.Name = "btnAdd";
|
||||||
btnAdd.Size = new Size(80, 32);
|
btnAdd.Size = new Size(82, 32);
|
||||||
btnAdd.TabIndex = 27;
|
btnAdd.TabIndex = 35;
|
||||||
btnAdd.Text = "新增";
|
btnAdd.Text = "新增";
|
||||||
btnAdd.Type = AntdUI.TTypeMini.Primary;
|
btnAdd.Type = AntdUI.TTypeMini.Primary;
|
||||||
btnAdd.WaveSize = 0;
|
btnAdd.WaveSize = 0;
|
||||||
//
|
//
|
||||||
|
// tabPage2
|
||||||
|
//
|
||||||
|
tabPage2.Controls.Add(TableSartProcess);
|
||||||
|
tabPage2.Controls.Add(panel2);
|
||||||
|
tabPage2.Location = new Point(-669, -499);
|
||||||
|
tabPage2.Name = "tabPage2";
|
||||||
|
tabPage2.Size = new Size(669, 499);
|
||||||
|
tabPage2.TabIndex = 1;
|
||||||
|
tabPage2.Text = "流程启动表";
|
||||||
|
//
|
||||||
|
// TableSartProcess
|
||||||
|
//
|
||||||
|
TableSartProcess.Dock = DockStyle.Fill;
|
||||||
|
TableSartProcess.EmptyHeader = true;
|
||||||
|
TableSartProcess.Location = new Point(0, 45);
|
||||||
|
TableSartProcess.Name = "TableSartProcess";
|
||||||
|
TableSartProcess.Padding = new Padding(5);
|
||||||
|
TableSartProcess.Size = new Size(669, 454);
|
||||||
|
TableSartProcess.TabIndex = 38;
|
||||||
|
TableSartProcess.Text = "table1";
|
||||||
|
//
|
||||||
|
// panel2
|
||||||
|
//
|
||||||
|
panel2.Back = Color.Transparent;
|
||||||
|
panel2.BackColor = SystemColors.Window;
|
||||||
|
panel2.Controls.Add(btnSartProcessDelete);
|
||||||
|
panel2.Controls.Add(btnSartProcessAdd);
|
||||||
|
panel2.Dock = DockStyle.Top;
|
||||||
|
panel2.Location = new Point(0, 0);
|
||||||
|
panel2.Name = "panel2";
|
||||||
|
panel2.Size = new Size(669, 45);
|
||||||
|
panel2.TabIndex = 37;
|
||||||
|
panel2.Text = "panel2";
|
||||||
|
//
|
||||||
|
// btnSartProcessDelete
|
||||||
|
//
|
||||||
|
btnSartProcessDelete.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
btnSartProcessDelete.Location = new Point(110, 10);
|
||||||
|
btnSartProcessDelete.Name = "btnSartProcessDelete";
|
||||||
|
btnSartProcessDelete.Size = new Size(74, 32);
|
||||||
|
btnSartProcessDelete.TabIndex = 36;
|
||||||
|
btnSartProcessDelete.Text = "删除";
|
||||||
|
btnSartProcessDelete.Type = AntdUI.TTypeMini.Error;
|
||||||
|
btnSartProcessDelete.WaveSize = 0;
|
||||||
|
//
|
||||||
|
// btnSartProcessAdd
|
||||||
|
//
|
||||||
|
btnSartProcessAdd.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
btnSartProcessAdd.Location = new Point(13, 10);
|
||||||
|
btnSartProcessAdd.Name = "btnSartProcessAdd";
|
||||||
|
btnSartProcessAdd.Size = new Size(82, 32);
|
||||||
|
btnSartProcessAdd.TabIndex = 35;
|
||||||
|
btnSartProcessAdd.Text = "新增";
|
||||||
|
btnSartProcessAdd.Type = AntdUI.TTypeMini.Primary;
|
||||||
|
btnSartProcessAdd.WaveSize = 0;
|
||||||
|
//
|
||||||
|
// tabPage3
|
||||||
|
//
|
||||||
|
tabPage3.Controls.Add(TableStopProcess);
|
||||||
|
tabPage3.Controls.Add(panel3);
|
||||||
|
tabPage3.Location = new Point(-669, -499);
|
||||||
|
tabPage3.Name = "tabPage3";
|
||||||
|
tabPage3.Size = new Size(669, 499);
|
||||||
|
tabPage3.TabIndex = 2;
|
||||||
|
tabPage3.Text = "流程结束表";
|
||||||
|
//
|
||||||
|
// TableStopProcess
|
||||||
|
//
|
||||||
|
TableStopProcess.Dock = DockStyle.Fill;
|
||||||
|
TableStopProcess.EmptyHeader = true;
|
||||||
|
TableStopProcess.Location = new Point(0, 45);
|
||||||
|
TableStopProcess.Name = "TableStopProcess";
|
||||||
|
TableStopProcess.Padding = new Padding(5);
|
||||||
|
TableStopProcess.Size = new Size(669, 454);
|
||||||
|
TableStopProcess.TabIndex = 38;
|
||||||
|
TableStopProcess.Text = "table1";
|
||||||
|
//
|
||||||
|
// panel3
|
||||||
|
//
|
||||||
|
panel3.Back = Color.Transparent;
|
||||||
|
panel3.BackColor = SystemColors.Window;
|
||||||
|
panel3.Controls.Add(btnStopProcessDelete);
|
||||||
|
panel3.Controls.Add(btnStopProcessAdd);
|
||||||
|
panel3.Dock = DockStyle.Top;
|
||||||
|
panel3.Location = new Point(0, 0);
|
||||||
|
panel3.Name = "panel3";
|
||||||
|
panel3.Size = new Size(669, 45);
|
||||||
|
panel3.TabIndex = 37;
|
||||||
|
panel3.Text = "panel3";
|
||||||
|
//
|
||||||
|
// btnStopProcessDelete
|
||||||
|
//
|
||||||
|
btnStopProcessDelete.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
btnStopProcessDelete.Location = new Point(110, 10);
|
||||||
|
btnStopProcessDelete.Name = "btnStopProcessDelete";
|
||||||
|
btnStopProcessDelete.Size = new Size(74, 32);
|
||||||
|
btnStopProcessDelete.TabIndex = 36;
|
||||||
|
btnStopProcessDelete.Text = "删除";
|
||||||
|
btnStopProcessDelete.Type = AntdUI.TTypeMini.Error;
|
||||||
|
btnStopProcessDelete.WaveSize = 0;
|
||||||
|
//
|
||||||
|
// btnStopProcessAdd
|
||||||
|
//
|
||||||
|
btnStopProcessAdd.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
btnStopProcessAdd.Location = new Point(13, 10);
|
||||||
|
btnStopProcessAdd.Name = "btnStopProcessAdd";
|
||||||
|
btnStopProcessAdd.Size = new Size(82, 32);
|
||||||
|
btnStopProcessAdd.TabIndex = 35;
|
||||||
|
btnStopProcessAdd.Text = "新增";
|
||||||
|
btnStopProcessAdd.Type = AntdUI.TTypeMini.Primary;
|
||||||
|
btnStopProcessAdd.WaveSize = 0;
|
||||||
|
//
|
||||||
|
// tabPage4
|
||||||
|
//
|
||||||
|
tabPage4.Controls.Add(TableStartReset);
|
||||||
|
tabPage4.Controls.Add(panel4);
|
||||||
|
tabPage4.Location = new Point(-669, -499);
|
||||||
|
tabPage4.Name = "tabPage4";
|
||||||
|
tabPage4.Size = new Size(669, 499);
|
||||||
|
tabPage4.TabIndex = 3;
|
||||||
|
tabPage4.Text = "复位开始表";
|
||||||
|
//
|
||||||
|
// TableStartReset
|
||||||
|
//
|
||||||
|
TableStartReset.Dock = DockStyle.Fill;
|
||||||
|
TableStartReset.EmptyHeader = true;
|
||||||
|
TableStartReset.Location = new Point(0, 45);
|
||||||
|
TableStartReset.Name = "TableStartReset";
|
||||||
|
TableStartReset.Padding = new Padding(5);
|
||||||
|
TableStartReset.Size = new Size(669, 454);
|
||||||
|
TableStartReset.TabIndex = 38;
|
||||||
|
TableStartReset.Text = "table1";
|
||||||
|
//
|
||||||
|
// panel4
|
||||||
|
//
|
||||||
|
panel4.Back = Color.Transparent;
|
||||||
|
panel4.BackColor = SystemColors.Window;
|
||||||
|
panel4.Controls.Add(btnStartResetDelete);
|
||||||
|
panel4.Controls.Add(btnStartResetAdd);
|
||||||
|
panel4.Dock = DockStyle.Top;
|
||||||
|
panel4.Location = new Point(0, 0);
|
||||||
|
panel4.Name = "panel4";
|
||||||
|
panel4.Size = new Size(669, 45);
|
||||||
|
panel4.TabIndex = 37;
|
||||||
|
panel4.Text = "panel4";
|
||||||
|
//
|
||||||
|
// btnStartResetDelete
|
||||||
|
//
|
||||||
|
btnStartResetDelete.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
btnStartResetDelete.Location = new Point(110, 10);
|
||||||
|
btnStartResetDelete.Name = "btnStartResetDelete";
|
||||||
|
btnStartResetDelete.Size = new Size(74, 32);
|
||||||
|
btnStartResetDelete.TabIndex = 36;
|
||||||
|
btnStartResetDelete.Text = "删除";
|
||||||
|
btnStartResetDelete.Type = AntdUI.TTypeMini.Error;
|
||||||
|
btnStartResetDelete.WaveSize = 0;
|
||||||
|
//
|
||||||
|
// btnStartResetAdd
|
||||||
|
//
|
||||||
|
btnStartResetAdd.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
btnStartResetAdd.Location = new Point(13, 10);
|
||||||
|
btnStartResetAdd.Name = "btnStartResetAdd";
|
||||||
|
btnStartResetAdd.Size = new Size(82, 32);
|
||||||
|
btnStartResetAdd.TabIndex = 35;
|
||||||
|
btnStartResetAdd.Text = "新增";
|
||||||
|
btnStartResetAdd.Type = AntdUI.TTypeMini.Primary;
|
||||||
|
btnStartResetAdd.WaveSize = 0;
|
||||||
|
//
|
||||||
|
// tabPage5
|
||||||
|
//
|
||||||
|
tabPage5.Controls.Add(TableStopReset);
|
||||||
|
tabPage5.Controls.Add(panel5);
|
||||||
|
tabPage5.Location = new Point(-669, -499);
|
||||||
|
tabPage5.Name = "tabPage5";
|
||||||
|
tabPage5.Size = new Size(669, 499);
|
||||||
|
tabPage5.TabIndex = 4;
|
||||||
|
tabPage5.Text = "复位结束表";
|
||||||
|
//
|
||||||
|
// TableStopReset
|
||||||
|
//
|
||||||
|
TableStopReset.Dock = DockStyle.Fill;
|
||||||
|
TableStopReset.EmptyHeader = true;
|
||||||
|
TableStopReset.Location = new Point(0, 45);
|
||||||
|
TableStopReset.Name = "TableStopReset";
|
||||||
|
TableStopReset.Padding = new Padding(5);
|
||||||
|
TableStopReset.Size = new Size(669, 454);
|
||||||
|
TableStopReset.TabIndex = 38;
|
||||||
|
TableStopReset.Text = "table1";
|
||||||
|
//
|
||||||
|
// panel5
|
||||||
|
//
|
||||||
|
panel5.Back = Color.Transparent;
|
||||||
|
panel5.BackColor = SystemColors.Window;
|
||||||
|
panel5.Controls.Add(btnStopResetDelete);
|
||||||
|
panel5.Controls.Add(btnStopResetAdd);
|
||||||
|
panel5.Dock = DockStyle.Top;
|
||||||
|
panel5.Location = new Point(0, 0);
|
||||||
|
panel5.Name = "panel5";
|
||||||
|
panel5.Size = new Size(669, 45);
|
||||||
|
panel5.TabIndex = 37;
|
||||||
|
panel5.Text = "panel5";
|
||||||
|
//
|
||||||
|
// btnStopResetDelete
|
||||||
|
//
|
||||||
|
btnStopResetDelete.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
btnStopResetDelete.Location = new Point(110, 10);
|
||||||
|
btnStopResetDelete.Name = "btnStopResetDelete";
|
||||||
|
btnStopResetDelete.Size = new Size(74, 32);
|
||||||
|
btnStopResetDelete.TabIndex = 36;
|
||||||
|
btnStopResetDelete.Text = "删除";
|
||||||
|
btnStopResetDelete.Type = AntdUI.TTypeMini.Error;
|
||||||
|
btnStopResetDelete.WaveSize = 0;
|
||||||
|
//
|
||||||
|
// btnStopResetAdd
|
||||||
|
//
|
||||||
|
btnStopResetAdd.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
btnStopResetAdd.Location = new Point(13, 10);
|
||||||
|
btnStopResetAdd.Name = "btnStopResetAdd";
|
||||||
|
btnStopResetAdd.Size = new Size(82, 32);
|
||||||
|
btnStopResetAdd.TabIndex = 35;
|
||||||
|
btnStopResetAdd.Text = "新增";
|
||||||
|
btnStopResetAdd.Type = AntdUI.TTypeMini.Primary;
|
||||||
|
btnStopResetAdd.WaveSize = 0;
|
||||||
|
//
|
||||||
// MotionControl
|
// MotionControl
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 17F);
|
AutoScaleDimensions = new SizeF(7F, 17F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
Controls.Add(btnDelete);
|
Controls.Add(tabs1);
|
||||||
Controls.Add(btnAdd);
|
|
||||||
Controls.Add(PLCItemsTable);
|
|
||||||
Controls.Add(stackPanel1);
|
Controls.Add(stackPanel1);
|
||||||
Name = "MotionControl";
|
Name = "MotionControl";
|
||||||
Size = new Size(898, 530);
|
Size = new Size(898, 530);
|
||||||
@ -382,6 +681,17 @@
|
|||||||
stpStop.ResumeLayout(false);
|
stpStop.ResumeLayout(false);
|
||||||
stpData.ResumeLayout(false);
|
stpData.ResumeLayout(false);
|
||||||
stpBaud.ResumeLayout(false);
|
stpBaud.ResumeLayout(false);
|
||||||
|
tabs1.ResumeLayout(false);
|
||||||
|
tabPage1.ResumeLayout(false);
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
tabPage2.ResumeLayout(false);
|
||||||
|
panel2.ResumeLayout(false);
|
||||||
|
tabPage3.ResumeLayout(false);
|
||||||
|
panel3.ResumeLayout(false);
|
||||||
|
tabPage4.ResumeLayout(false);
|
||||||
|
panel4.ResumeLayout(false);
|
||||||
|
tabPage5.ResumeLayout(false);
|
||||||
|
panel5.ResumeLayout(false);
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -415,8 +725,31 @@
|
|||||||
private AntdUI.StackPanel stpBaud;
|
private AntdUI.StackPanel stpBaud;
|
||||||
private AntdUI.Select cmbBaudRate;
|
private AntdUI.Select cmbBaudRate;
|
||||||
private AntdUI.Label label3;
|
private AntdUI.Label label3;
|
||||||
|
private AntdUI.Tabs tabs1;
|
||||||
|
private AntdUI.TabPage tabPage1;
|
||||||
|
private AntdUI.TabPage tabPage2;
|
||||||
|
private AntdUI.TabPage tabPage3;
|
||||||
|
private AntdUI.TabPage tabPage4;
|
||||||
|
private AntdUI.TabPage tabPage5;
|
||||||
private AntdUI.Table PLCItemsTable;
|
private AntdUI.Table PLCItemsTable;
|
||||||
|
private AntdUI.Panel panel1;
|
||||||
private AntdUI.Button btnDelete;
|
private AntdUI.Button btnDelete;
|
||||||
private AntdUI.Button btnAdd;
|
private AntdUI.Button btnAdd;
|
||||||
|
private AntdUI.Table TableSartProcess;
|
||||||
|
private AntdUI.Panel panel2;
|
||||||
|
private AntdUI.Button btnSartProcessDelete;
|
||||||
|
private AntdUI.Button btnSartProcessAdd;
|
||||||
|
private AntdUI.Table TableStopProcess;
|
||||||
|
private AntdUI.Panel panel3;
|
||||||
|
private AntdUI.Button btnStopProcessDelete;
|
||||||
|
private AntdUI.Button btnStopProcessAdd;
|
||||||
|
private AntdUI.Table TableStartReset;
|
||||||
|
private AntdUI.Panel panel4;
|
||||||
|
private AntdUI.Button btnStartResetDelete;
|
||||||
|
private AntdUI.Button btnStartResetAdd;
|
||||||
|
private AntdUI.Table TableStopReset;
|
||||||
|
private AntdUI.Panel panel5;
|
||||||
|
private AntdUI.Button btnStopResetDelete;
|
||||||
|
private AntdUI.Button btnStopResetAdd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO.Ports;
|
using System.IO.Ports;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -18,26 +19,513 @@ namespace DHSoftware.Views
|
|||||||
{
|
{
|
||||||
public partial class MotionControl : UserControl
|
public partial class MotionControl : UserControl
|
||||||
{
|
{
|
||||||
Window window;
|
private Window window;
|
||||||
PLCBase pLCBase;
|
private PLCBase pLCBase;
|
||||||
public MotionControl(Window _window,PLCBase _pLCBase)
|
|
||||||
|
public MotionControl(Window _window, PLCBase _pLCBase)
|
||||||
{
|
{
|
||||||
window= _window;
|
window = _window;
|
||||||
pLCBase= _pLCBase;
|
pLCBase = _pLCBase;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
BindEventHandler();
|
BindEventHandler();
|
||||||
InitData();
|
InitData();
|
||||||
SetupDataBindings();
|
SetupDataBindings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void BindEventHandler()
|
private void BindEventHandler()
|
||||||
{
|
{
|
||||||
sltTpye.TextChanged += SltTpye_TextChanged;
|
sltTpye.TextChanged += SltTpye_TextChanged;
|
||||||
btnAdd.Click += BtnAdd_Click;
|
btnAdd.Click += BtnAdd_Click;
|
||||||
btnDelete.Click += BtnDelete_Click;
|
btnDelete.Click += BtnDelete_Click;
|
||||||
PLCItemsTable.CellButtonClick += PLCItemsTable_CellButtonClick; ;
|
PLCItemsTable.CellButtonClick += PLCItemsTable_CellButtonClick;
|
||||||
|
|
||||||
|
btnSartProcessAdd.Click += BtnSartProcessAdd_Click;
|
||||||
|
btnSartProcessDelete.Click += BtnSartProcessDelete_Click;
|
||||||
|
TableSartProcess.CellButtonClick += TableSartProcess_CellButtonClick;
|
||||||
|
|
||||||
|
btnStopProcessAdd.Click += BtnStopProcessAdd_Click;
|
||||||
|
btnStopProcessDelete.Click += BtnStopProcessDelete_Click;
|
||||||
|
TableStopProcess.CellButtonClick += TableStopProcess_CellButtonClick;
|
||||||
|
|
||||||
|
btnStartResetAdd.Click += BtnStartResetAdd_Click;
|
||||||
|
btnStartResetDelete.Click += BtnStartResetDelete_Click;
|
||||||
|
TableStartReset.CellButtonClick += TableStartReset_CellButtonClick;
|
||||||
|
|
||||||
|
btnStopResetAdd.Click += BtnStopResetAdd_Click;
|
||||||
|
btnStopResetDelete.Click += BtnStopResetDelete_Click;
|
||||||
|
TableStopReset.CellButtonClick += TableStopReset_CellButtonClick;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TableStopReset_CellButtonClick(object sender, TableButtonEventArgs e)
|
||||||
|
{
|
||||||
|
var buttontext = e.Btn.Text;
|
||||||
|
|
||||||
|
if (e.Record is PLCItem pLCItem)
|
||||||
|
{
|
||||||
|
switch (buttontext)
|
||||||
|
{
|
||||||
|
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
|
||||||
|
case "编辑":
|
||||||
|
var form = new MotionProcessEdit(window, "复位结束表操作-编辑", pLCItem, pLCBase.PLCItemList) { Size = new Size(500, 300) };
|
||||||
|
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
|
||||||
|
{
|
||||||
|
OnLoad = () =>
|
||||||
|
{
|
||||||
|
AntdUI.Message.info(window, "进入复位结束表编辑", autoClose: 1);
|
||||||
|
},
|
||||||
|
OnClose = () =>
|
||||||
|
{
|
||||||
|
AntdUI.Message.info(window, "退出复位结束表编辑", autoClose: 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "删除":
|
||||||
|
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
|
||||||
|
if (result == DialogResult.OK)
|
||||||
|
{
|
||||||
|
pLCBase.PLCStopResetList.Remove(pLCItem);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "上移":
|
||||||
|
if (e.RowIndex <= 1)
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(window, "已是第一条,无法上移!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MoveItemUp(pLCBase.PLCStopResetList, pLCItem);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "下移":
|
||||||
|
if (e.RowIndex > pLCBase.PLCStopResetList.Count - 1)
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(window, "已是最后一条,无法下移!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MoveItemDown(pLCBase.PLCStopResetList, pLCItem);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnStopResetDelete_Click(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (pLCBase.PLCStopResetList.Count == 0 || !pLCBase.PLCStopResetList.Any(x => x.Selected))
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
|
||||||
|
if (result == DialogResult.OK)
|
||||||
|
{
|
||||||
|
// 使用反转for循环删除主列表中选中的项
|
||||||
|
for (int i = pLCBase.PLCStopResetList.Count - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
// 删除选中的主列表项
|
||||||
|
if (pLCBase.PLCStopResetList[i].Selected)
|
||||||
|
{
|
||||||
|
pLCBase.PLCStopResetList.RemoveAt(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 提示删除完成
|
||||||
|
AntdUI.Message.success(window, "删除成功!", autoClose: 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnStopResetAdd_Click(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (pLCBase.PLCItemList?.Count == 0)
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(window, "点位表无数据,不允许新增!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PLCItem pLCItem = new PLCItem()
|
||||||
|
{
|
||||||
|
StartIndex = pLCBase.PLCStopResetList.Count + 1,
|
||||||
|
CellLinks = new CellLink[]
|
||||||
|
{
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary),
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var form = new MotionProcessEdit(window, "复位结束表操作-新增", pLCItem, pLCBase.PLCItemList) { Size = new Size(450, 550) };
|
||||||
|
|
||||||
|
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
|
||||||
|
{
|
||||||
|
OnLoad = () =>
|
||||||
|
{
|
||||||
|
AntdUI.Message.info(window, "进入复位结束表新增", autoClose: 1);
|
||||||
|
},
|
||||||
|
OnClose = () =>
|
||||||
|
{
|
||||||
|
if (form.submit)
|
||||||
|
{
|
||||||
|
pLCBase.PLCStopResetList.Add(pLCItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
AntdUI.Message.info(window, "退出复位结束表新增", autoClose: 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TableStartReset_CellButtonClick(object sender, TableButtonEventArgs e)
|
||||||
|
{
|
||||||
|
var buttontext = e.Btn.Text;
|
||||||
|
|
||||||
|
if (e.Record is PLCItem pLCItem)
|
||||||
|
{
|
||||||
|
switch (buttontext)
|
||||||
|
{
|
||||||
|
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
|
||||||
|
case "编辑":
|
||||||
|
var form = new MotionProcessEdit(window, "复位开始表操作-编辑", pLCItem, pLCBase.PLCItemList) { Size = new Size(500, 300) };
|
||||||
|
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
|
||||||
|
{
|
||||||
|
OnLoad = () =>
|
||||||
|
{
|
||||||
|
AntdUI.Message.info(window, "进入复位开始表编辑", autoClose: 1);
|
||||||
|
},
|
||||||
|
OnClose = () =>
|
||||||
|
{
|
||||||
|
AntdUI.Message.info(window, "退出复位开始表编辑", autoClose: 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "删除":
|
||||||
|
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
|
||||||
|
if (result == DialogResult.OK)
|
||||||
|
{
|
||||||
|
pLCBase.PLCStartResetList.Remove(pLCItem);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "上移":
|
||||||
|
if (e.RowIndex <= 1)
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(window, "已是第一条,无法上移!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MoveItemUp(pLCBase.PLCStartResetList, pLCItem);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "下移":
|
||||||
|
if (e.RowIndex > pLCBase.PLCStartResetList.Count - 1)
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(window, "已是最后一条,无法下移!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MoveItemDown(pLCBase.PLCStartResetList, pLCItem);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnStartResetDelete_Click(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (pLCBase.PLCStartResetList.Count == 0 || !pLCBase.PLCStartResetList.Any(x => x.Selected))
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
|
||||||
|
if (result == DialogResult.OK)
|
||||||
|
{
|
||||||
|
// 使用反转for循环删除主列表中选中的项
|
||||||
|
for (int i = pLCBase.PLCStartResetList.Count - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
// 删除选中的主列表项
|
||||||
|
if (pLCBase.PLCStartResetList[i].Selected)
|
||||||
|
{
|
||||||
|
pLCBase.PLCStartResetList.RemoveAt(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 提示删除完成
|
||||||
|
AntdUI.Message.success(window, "删除成功!", autoClose: 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnStartResetAdd_Click(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (pLCBase.PLCItemList?.Count == 0)
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(window, "点位表无数据,不允许新增!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PLCItem pLCItem = new PLCItem()
|
||||||
|
{
|
||||||
|
StartIndex = pLCBase.PLCStartResetList.Count + 1,
|
||||||
|
CellLinks = new CellLink[]
|
||||||
|
{
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary),
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var form = new MotionProcessEdit(window, "复位开始表操作-新增", pLCItem, pLCBase.PLCItemList) { Size = new Size(450, 550) };
|
||||||
|
|
||||||
|
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
|
||||||
|
{
|
||||||
|
OnLoad = () =>
|
||||||
|
{
|
||||||
|
AntdUI.Message.info(window, "进入复位开始表新增", autoClose: 1);
|
||||||
|
},
|
||||||
|
OnClose = () =>
|
||||||
|
{
|
||||||
|
if (form.submit)
|
||||||
|
{
|
||||||
|
pLCBase.PLCStartResetList.Add(pLCItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
AntdUI.Message.info(window, "退出复位开始表新增", autoClose: 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TableStopProcess_CellButtonClick(object sender, TableButtonEventArgs e)
|
||||||
|
{
|
||||||
|
var buttontext = e.Btn.Text;
|
||||||
|
|
||||||
|
if (e.Record is PLCItem pLCItem)
|
||||||
|
{
|
||||||
|
switch (buttontext)
|
||||||
|
{
|
||||||
|
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
|
||||||
|
case "编辑":
|
||||||
|
var form = new MotionProcessEdit(window, "流程结束表操作-编辑", pLCItem, pLCBase.PLCItemList) { Size = new Size(500, 300) };
|
||||||
|
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
|
||||||
|
{
|
||||||
|
OnLoad = () =>
|
||||||
|
{
|
||||||
|
AntdUI.Message.info(window, "进入流程结束表编辑", autoClose: 1);
|
||||||
|
},
|
||||||
|
OnClose = () =>
|
||||||
|
{
|
||||||
|
AntdUI.Message.info(window, "退出流程结束表编辑", autoClose: 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "删除":
|
||||||
|
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
|
||||||
|
if (result == DialogResult.OK)
|
||||||
|
{
|
||||||
|
pLCBase.PLCStopProcessList.Remove(pLCItem);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "上移":
|
||||||
|
if (e.RowIndex <= 1)
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(window, "已是第一条,无法上移!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MoveItemUp(pLCBase.PLCStopProcessList, pLCItem);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "下移":
|
||||||
|
if (e.RowIndex > pLCBase.PLCStopProcessList.Count - 1)
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(window, "已是最后一条,无法下移!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MoveItemDown(pLCBase.PLCStopProcessList, pLCItem);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnStopProcessDelete_Click(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (pLCBase.PLCStopProcessList.Count == 0 || !pLCBase.PLCStopProcessList.Any(x => x.Selected))
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
|
||||||
|
if (result == DialogResult.OK)
|
||||||
|
{
|
||||||
|
// 使用反转for循环删除主列表中选中的项
|
||||||
|
for (int i = pLCBase.PLCStopProcessList.Count - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
// 删除选中的主列表项
|
||||||
|
if (pLCBase.PLCStopProcessList[i].Selected)
|
||||||
|
{
|
||||||
|
pLCBase.PLCStopProcessList.RemoveAt(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 提示删除完成
|
||||||
|
AntdUI.Message.success(window, "删除成功!", autoClose: 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnStopProcessAdd_Click(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (pLCBase.PLCItemList?.Count == 0)
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(window, "点位表无数据,不允许新增!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PLCItem pLCItem = new PLCItem()
|
||||||
|
{
|
||||||
|
StartIndex = pLCBase.PLCStopProcessList.Count + 1,
|
||||||
|
CellLinks = new CellLink[]
|
||||||
|
{
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary),
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var form = new MotionProcessEdit(window, "流程结束表操作-新增", pLCItem, pLCBase.PLCItemList) { Size = new Size(450, 550) };
|
||||||
|
|
||||||
|
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
|
||||||
|
{
|
||||||
|
OnLoad = () =>
|
||||||
|
{
|
||||||
|
AntdUI.Message.info(window, "进入流程结束表新增", autoClose: 1);
|
||||||
|
},
|
||||||
|
OnClose = () =>
|
||||||
|
{
|
||||||
|
if (form.submit)
|
||||||
|
{
|
||||||
|
pLCBase.PLCStopProcessList.Add(pLCItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
AntdUI.Message.info(window, "退出流程结束表新增", autoClose: 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TableSartProcess_CellButtonClick(object sender, TableButtonEventArgs e)
|
||||||
|
{
|
||||||
|
var buttontext = e.Btn.Text;
|
||||||
|
|
||||||
|
if (e.Record is PLCItem pLCItem)
|
||||||
|
{
|
||||||
|
switch (buttontext)
|
||||||
|
{
|
||||||
|
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
|
||||||
|
case "编辑":
|
||||||
|
var form = new MotionProcessEdit(window, "流程开始表操作-编辑", pLCItem, pLCBase.PLCItemList) { Size = new Size(500, 300) };
|
||||||
|
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
|
||||||
|
{
|
||||||
|
OnLoad = () =>
|
||||||
|
{
|
||||||
|
AntdUI.Message.info(window, "进入流程开始表编辑", autoClose: 1);
|
||||||
|
},
|
||||||
|
OnClose = () =>
|
||||||
|
{
|
||||||
|
AntdUI.Message.info(window, "退出流程开始表编辑", autoClose: 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "删除":
|
||||||
|
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
|
||||||
|
if (result == DialogResult.OK)
|
||||||
|
{
|
||||||
|
pLCBase.PLCStartProcessList.Remove(pLCItem);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "上移":
|
||||||
|
if (e.RowIndex <= 1)
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(window, "已是第一条,无法上移!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MoveItemUp(pLCBase.PLCStartProcessList, pLCItem);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "下移":
|
||||||
|
if (e.RowIndex > pLCBase.PLCStartProcessList.Count - 1)
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(window, "已是最后一条,无法下移!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MoveItemDown(pLCBase.PLCStartProcessList, pLCItem);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnSartProcessDelete_Click(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (pLCBase.PLCStartProcessList.Count == 0 || !pLCBase.PLCStartProcessList.Any(x => x.Selected))
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
|
||||||
|
if (result == DialogResult.OK)
|
||||||
|
{
|
||||||
|
// 使用反转for循环删除主列表中选中的项
|
||||||
|
for (int i = pLCBase.PLCStartProcessList.Count - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
// 删除选中的主列表项
|
||||||
|
if (pLCBase.PLCStartProcessList[i].Selected)
|
||||||
|
{
|
||||||
|
pLCBase.PLCStartProcessList.RemoveAt(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 提示删除完成
|
||||||
|
AntdUI.Message.success(window, "删除成功!", autoClose: 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BtnSartProcessAdd_Click(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (pLCBase.PLCItemList?.Count == 0)
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(window, "点位表无数据,不允许新增!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PLCItem pLCItem = new PLCItem()
|
||||||
|
{
|
||||||
|
StartIndex = pLCBase.PLCStartProcessList.Count + 1,
|
||||||
|
CellLinks = new CellLink[]
|
||||||
|
{
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary),
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var form = new MotionProcessEdit(window, "流程开始表操作-新增", pLCItem, pLCBase.PLCItemList) { Size = new Size(450, 550) };
|
||||||
|
|
||||||
|
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
|
||||||
|
{
|
||||||
|
OnLoad = () =>
|
||||||
|
{
|
||||||
|
AntdUI.Message.info(window, "进入流程开始表新增", autoClose: 1);
|
||||||
|
},
|
||||||
|
OnClose = () =>
|
||||||
|
{
|
||||||
|
if (form.submit)
|
||||||
|
{
|
||||||
|
pLCBase.PLCStartProcessList.Add(pLCItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
AntdUI.Message.info(window, "退出流程开始表新增", autoClose: 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PLCItemsTable_CellButtonClick(object sender, TableButtonEventArgs e)
|
private void PLCItemsTable_CellButtonClick(object sender, TableButtonEventArgs e)
|
||||||
@ -50,7 +538,7 @@ namespace DHSoftware.Views
|
|||||||
{
|
{
|
||||||
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
|
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
|
||||||
case "编辑":
|
case "编辑":
|
||||||
var form = new MotionEdit(window, pLCItem) { Size = new Size(500, 300) };
|
var form = new MotionEdit(window, "点位表操作-编辑", pLCItem) { Size = new Size(500, 300) };
|
||||||
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
|
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
|
||||||
{
|
{
|
||||||
OnLoad = () =>
|
OnLoad = () =>
|
||||||
@ -59,26 +547,11 @@ namespace DHSoftware.Views
|
|||||||
},
|
},
|
||||||
OnClose = () =>
|
OnClose = () =>
|
||||||
{
|
{
|
||||||
pLCItem.CellTags = new CellTag[] { };
|
|
||||||
var tempList = pLCItem.CellTags.ToList();
|
|
||||||
|
|
||||||
if (pLCItem.StartExecute)
|
|
||||||
{
|
|
||||||
var newTag = new CellTag($"ON_{pLCItem.StartIndex}", TTypeMini.Primary);
|
|
||||||
tempList.Add(newTag);
|
|
||||||
}
|
|
||||||
if (pLCItem.EndExecute)
|
|
||||||
{
|
|
||||||
var newTag = new CellTag($"OFF_{pLCItem.EndIndex}", TTypeMini.Warn);
|
|
||||||
tempList.Add(newTag);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 重新赋值回数组
|
|
||||||
pLCItem.CellTags = tempList.ToArray();
|
|
||||||
AntdUI.Message.info(window, "结束编辑", autoClose: 1);
|
AntdUI.Message.info(window, "结束编辑", autoClose: 1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "删除":
|
case "删除":
|
||||||
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
|
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
|
||||||
if (result == DialogResult.OK)
|
if (result == DialogResult.OK)
|
||||||
@ -87,6 +560,62 @@ namespace DHSoftware.Views
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "上移":
|
||||||
|
if (e.RowIndex <= 1)
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(window, "已是第一条,无法上移!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MoveItemUp(pLCBase.PLCItemList, pLCItem);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "下移":
|
||||||
|
if (e.RowIndex > pLCBase.PLCItemList.Count - 1)
|
||||||
|
{
|
||||||
|
AntdUI.Message.warn(window, "已是最后一条,无法下移!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MoveItemDown(pLCBase.PLCItemList, pLCItem);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 上移项
|
||||||
|
public static void MoveItemUp(BindingList<PLCItem> list, PLCItem item)
|
||||||
|
{
|
||||||
|
int index = list.IndexOf(item);
|
||||||
|
if (index > 0)
|
||||||
|
{
|
||||||
|
// 移除并插入到前一位
|
||||||
|
list.RemoveAt(index);
|
||||||
|
list.Insert(index - 1, item);
|
||||||
|
UpdateStartIndexes(list); // 更新序号
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 下移项
|
||||||
|
public static void MoveItemDown(BindingList<PLCItem> list, PLCItem item)
|
||||||
|
{
|
||||||
|
int index = list.IndexOf(item);
|
||||||
|
if (index < list.Count - 1)
|
||||||
|
{
|
||||||
|
// 移除并插入到后一位
|
||||||
|
list.RemoveAt(index);
|
||||||
|
list.Insert(index + 1, item);
|
||||||
|
UpdateStartIndexes(list); // 更新序号
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新所有项的序号
|
||||||
|
public static void UpdateStartIndexes(BindingList<PLCItem> list)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < list.Count; i++)
|
||||||
|
{
|
||||||
|
PLCItem item = list[i];
|
||||||
|
if (item.StartIndex != i + 1)
|
||||||
|
{
|
||||||
|
item.StartIndex = i + 1; // 触发 PropertyChanged 事件
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,40 +649,43 @@ namespace DHSoftware.Views
|
|||||||
{
|
{
|
||||||
PLCItem pLCItem = new PLCItem()
|
PLCItem pLCItem = new PLCItem()
|
||||||
{
|
{
|
||||||
|
StartIndex = pLCBase.PLCItemList.Count + 1,
|
||||||
CellLinks = new CellLink[]
|
CellLinks = new CellLink[]
|
||||||
{
|
{ new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
|
||||||
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary),
|
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
|
||||||
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
|
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary),
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var form = new MotionEdit(window, pLCItem) { Size = new Size(450, 550) };
|
var form = new MotionEdit(window, "点位表操作-新增", pLCItem) { Size = new Size(450, 550) };
|
||||||
AntdUI.Modal.open(new AntdUI.Modal.Config(window, "", form, TType.None)
|
|
||||||
|
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
|
||||||
{
|
{
|
||||||
BtnHeight = 0,
|
OnLoad = () =>
|
||||||
|
{
|
||||||
|
AntdUI.Message.info(window, "进入新增", autoClose: 1);
|
||||||
|
},
|
||||||
|
OnClose = () =>
|
||||||
|
{
|
||||||
|
if (form.submit)
|
||||||
|
{
|
||||||
|
pLCBase.PLCItemList.Add(pLCItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
AntdUI.Message.info(window, "结束新增", autoClose: 1);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (form.submit)
|
//AntdUI.Modal.open(new AntdUI.Modal.Config(window, "", form, TType.None)
|
||||||
{
|
//{
|
||||||
pLCItem.CellTags = new CellTag[] { };
|
// BtnHeight = 0,
|
||||||
var tempList = pLCItem.CellTags.ToList();
|
//});
|
||||||
|
|
||||||
if (pLCItem.StartExecute)
|
//if (form.submit)
|
||||||
{
|
//{
|
||||||
var newTag = new CellTag($"ON_{pLCItem.StartIndex}", TTypeMini.Primary);
|
// pLCBase.PLCItemList.Add(pLCItem);
|
||||||
tempList.Add(newTag);
|
//}
|
||||||
}
|
|
||||||
if (pLCItem.EndExecute)
|
|
||||||
{
|
|
||||||
var newTag = new CellTag($"OFF_{pLCItem.EndIndex}", TTypeMini.Warn);
|
|
||||||
tempList.Add(newTag);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 重新赋值回数组
|
|
||||||
pLCItem.CellTags = tempList.ToArray();
|
|
||||||
|
|
||||||
pLCBase.PLCItemList.Add(pLCItem);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SltTpye_TextChanged(object? sender, EventArgs e)
|
private void SltTpye_TextChanged(object? sender, EventArgs e)
|
||||||
@ -193,17 +725,10 @@ namespace DHSoftware.Views
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void InitData()
|
private void InitData()
|
||||||
{
|
{
|
||||||
// 获取枚举字段名列表(原描述改为字段名)
|
// 获取枚举字段名列表(原描述改为字段名)
|
||||||
@ -242,47 +767,123 @@ namespace DHSoftware.Views
|
|||||||
|
|
||||||
PLCItemsTable.Columns = new ColumnCollection() {
|
PLCItemsTable.Columns = new ColumnCollection() {
|
||||||
new ColumnCheck("Selected"){Fixed = true},
|
new ColumnCheck("Selected"){Fixed = true},
|
||||||
|
new Column("StartIndex", "序号", ColumnAlign.Center),
|
||||||
new Column("Name", "名称", ColumnAlign.Center),
|
new Column("Name", "名称", ColumnAlign.Center),
|
||||||
new Column("Type", "类型",ColumnAlign.Center),
|
new Column("Type", "类型",ColumnAlign.Center),
|
||||||
new Column("Address", "地址",ColumnAlign.Center),
|
new Column("Address", "地址",ColumnAlign.Center),
|
||||||
new Column("Value", "值",ColumnAlign.Center),
|
|
||||||
new Column("CellTags", "标签",ColumnAlign.Center),
|
|
||||||
new Column("CellLinks", "操作", ColumnAlign.Center)
|
new Column("CellLinks", "操作", ColumnAlign.Center)
|
||||||
};
|
};
|
||||||
if (pLCBase.PLCItemList.Count > 0)
|
if (pLCBase.PLCItemList.Count > 0)
|
||||||
{
|
{
|
||||||
foreach( var item in pLCBase.PLCItemList)
|
foreach (var item in pLCBase.PLCItemList)
|
||||||
{
|
{
|
||||||
item.CellTags = new CellTag[] { };
|
|
||||||
var tempList = item.CellTags.ToList();
|
|
||||||
|
|
||||||
if (item.StartExecute)
|
|
||||||
{
|
|
||||||
var newTag = new CellTag($"ON_{item.StartIndex}", TTypeMini.Primary);
|
|
||||||
tempList.Add(newTag);
|
|
||||||
}
|
|
||||||
if (item.EndExecute)
|
|
||||||
{
|
|
||||||
var newTag = new CellTag($"OFF_{item.EndIndex}", TTypeMini.Warn);
|
|
||||||
tempList.Add(newTag);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 重新赋值回数组
|
|
||||||
item.CellTags = tempList.ToArray();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
item.CellLinks = new CellLink[] {
|
item.CellLinks = new CellLink[] {
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
|
||||||
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary) ,
|
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary) ,
|
||||||
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
|
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PLCItemsTable.Binding(pLCBase.PLCItemList);
|
PLCItemsTable.Binding(pLCBase.PLCItemList);
|
||||||
|
|
||||||
|
TableSartProcess.Columns = new ColumnCollection() {
|
||||||
|
new ColumnCheck("Selected"){Fixed = true},
|
||||||
|
new Column("StartIndex", "序号", ColumnAlign.Center),
|
||||||
|
new ColumnSwitch("StartExecute", "启用", ColumnAlign.Center),
|
||||||
|
new Column("Name", "名称", ColumnAlign.Center),
|
||||||
|
new Column("Type", "类型",ColumnAlign.Center){Visible=false},
|
||||||
|
new Column("Address", "地址",ColumnAlign.Center){Visible=false},
|
||||||
|
new Column("Value", "值",ColumnAlign.Center),
|
||||||
|
new Column("CellLinks", "操作", ColumnAlign.Center)
|
||||||
|
};
|
||||||
|
if (pLCBase.PLCStartProcessList.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var item in pLCBase.PLCStartProcessList)
|
||||||
|
{
|
||||||
|
item.CellLinks = new CellLink[] {
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary) ,
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//TableSartProcess.Binding(pLCBase.PLCStartProcessList);
|
||||||
|
TableSartProcess.Binding(pLCBase.PLCStartProcessList);
|
||||||
|
TableStopProcess.Columns = new ColumnCollection() {
|
||||||
|
new ColumnCheck("Selected"){Fixed = true},
|
||||||
|
new Column("StartIndex", "序号", ColumnAlign.Center),
|
||||||
|
new ColumnSwitch("StartExecute", "启用", ColumnAlign.Center),
|
||||||
|
new Column("Name", "名称", ColumnAlign.Center),
|
||||||
|
new Column("Type", "类型",ColumnAlign.Center){Visible=false},
|
||||||
|
new Column("Address", "地址",ColumnAlign.Center){Visible=false},
|
||||||
|
new Column("Value", "值",ColumnAlign.Center),
|
||||||
|
new Column("CellLinks", "操作", ColumnAlign.Center)
|
||||||
|
};
|
||||||
|
if (pLCBase.PLCStopProcessList.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var item in pLCBase.PLCStopProcessList)
|
||||||
|
{
|
||||||
|
item.CellLinks = new CellLink[] {
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary) ,
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TableStopProcess.Binding(pLCBase.PLCStopProcessList);
|
||||||
|
|
||||||
|
TableStartReset.Columns = new ColumnCollection() {
|
||||||
|
new ColumnCheck("Selected"){Fixed = true},
|
||||||
|
new Column("StartIndex", "序号", ColumnAlign.Center),
|
||||||
|
new ColumnSwitch("StartExecute", "启用", ColumnAlign.Center),
|
||||||
|
new Column("Name", "名称", ColumnAlign.Center),
|
||||||
|
new Column("Type", "类型",ColumnAlign.Center){Visible=false},
|
||||||
|
new Column("Address", "地址",ColumnAlign.Center){Visible=false},
|
||||||
|
new Column("Value", "值",ColumnAlign.Center),
|
||||||
|
new Column("CellLinks", "操作", ColumnAlign.Center)
|
||||||
|
};
|
||||||
|
if (pLCBase.PLCStartResetList.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var item in pLCBase.PLCStartResetList)
|
||||||
|
{
|
||||||
|
item.CellLinks = new CellLink[] {
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary) ,
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TableStartReset.Binding(pLCBase.PLCStartResetList);
|
||||||
|
|
||||||
|
TableStopReset.Columns = new ColumnCollection() {
|
||||||
|
new ColumnCheck("Selected"){Fixed = true},
|
||||||
|
new Column("StartIndex", "序号", ColumnAlign.Center),
|
||||||
|
new ColumnSwitch("StartExecute", "启用", ColumnAlign.Center),
|
||||||
|
new Column("Name", "名称", ColumnAlign.Center),
|
||||||
|
new Column("Type", "类型",ColumnAlign.Center){Visible=false},
|
||||||
|
new Column("Address", "地址",ColumnAlign.Center){Visible=false},
|
||||||
|
new Column("Value", "值",ColumnAlign.Center),
|
||||||
|
new Column("CellLinks", "操作", ColumnAlign.Center)
|
||||||
|
};
|
||||||
|
if (pLCBase.PLCStopResetList.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var item in pLCBase.PLCStopResetList)
|
||||||
|
{
|
||||||
|
item.CellLinks = new CellLink[] {
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary) ,
|
||||||
|
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TableStopReset.Binding(pLCBase.PLCStopResetList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void SetupDataBindings()
|
private void SetupDataBindings()
|
||||||
{
|
{
|
||||||
// 添加双向类型转换
|
// 添加双向类型转换
|
||||||
@ -296,9 +897,7 @@ namespace DHSoftware.Views
|
|||||||
iptIP.DataBindings.Add(nameof(iptIP.Text), pLCBase, nameof(pLCBase.IP));
|
iptIP.DataBindings.Add(nameof(iptIP.Text), pLCBase, nameof(pLCBase.IP));
|
||||||
iptPort.DataBindings.Add(nameof(iptPort.Text), pLCBase, nameof(pLCBase.Port));
|
iptPort.DataBindings.Add(nameof(iptPort.Text), pLCBase, nameof(pLCBase.Port));
|
||||||
|
|
||||||
swhEnable.DataBindings.Add(nameof(swhEnable.Checked),pLCBase, nameof(pLCBase.Enable));
|
swhEnable.DataBindings.Add(nameof(swhEnable.Checked), pLCBase, nameof(pLCBase.Enable));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
202
DHSoftware/Views/MotionEdit.Designer.cs
generated
202
DHSoftware/Views/MotionEdit.Designer.cs
generated
@ -35,30 +35,14 @@
|
|||||||
stackPanel1 = new AntdUI.StackPanel();
|
stackPanel1 = new AntdUI.StackPanel();
|
||||||
button_ok = new AntdUI.Button();
|
button_ok = new AntdUI.Button();
|
||||||
divider1 = new AntdUI.Divider();
|
divider1 = new AntdUI.Divider();
|
||||||
label1 = new AntdUI.Label();
|
lbTitleName = new AntdUI.Label();
|
||||||
panel1 = new AntdUI.Panel();
|
panel1 = new AntdUI.Panel();
|
||||||
stackPanel3 = new AntdUI.StackPanel();
|
|
||||||
sltEnd = new AntdUI.Select();
|
|
||||||
label6 = new AntdUI.Label();
|
|
||||||
stackPanel2 = new AntdUI.StackPanel();
|
|
||||||
sltStart = new AntdUI.Select();
|
|
||||||
label5 = new AntdUI.Label();
|
|
||||||
sltBoolValue = new AntdUI.Select();
|
|
||||||
stpNum = new AntdUI.StackPanel();
|
|
||||||
sltIntType = new AntdUI.Select();
|
|
||||||
iptValue = new AntdUI.Input();
|
|
||||||
label4 = new AntdUI.Label();
|
|
||||||
iptAddress = new AntdUI.Input();
|
iptAddress = new AntdUI.Input();
|
||||||
label7 = new AntdUI.Label();
|
label7 = new AntdUI.Label();
|
||||||
sltDataType = new AntdUI.Select();
|
sltDataType = new AntdUI.Select();
|
||||||
label3 = new AntdUI.Label();
|
label3 = new AntdUI.Label();
|
||||||
iptStartIndex = new AntdUI.InputNumber();
|
|
||||||
iptEndIndex = new AntdUI.InputNumber();
|
|
||||||
stackPanel1.SuspendLayout();
|
stackPanel1.SuspendLayout();
|
||||||
panel1.SuspendLayout();
|
panel1.SuspendLayout();
|
||||||
stackPanel3.SuspendLayout();
|
|
||||||
stackPanel2.SuspendLayout();
|
|
||||||
stpNum.SuspendLayout();
|
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// button_cancel
|
// button_cancel
|
||||||
@ -131,25 +115,18 @@
|
|||||||
divider1.Size = new Size(409, 12);
|
divider1.Size = new Size(409, 12);
|
||||||
divider1.TabIndex = 19;
|
divider1.TabIndex = 19;
|
||||||
//
|
//
|
||||||
// label1
|
// lbTitleName
|
||||||
//
|
//
|
||||||
label1.Dock = DockStyle.Top;
|
lbTitleName.Dock = DockStyle.Top;
|
||||||
label1.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
lbTitleName.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
label1.Location = new Point(18, 18);
|
lbTitleName.Location = new Point(18, 18);
|
||||||
label1.Name = "label1";
|
lbTitleName.Name = "lbTitleName";
|
||||||
label1.Size = new Size(409, 24);
|
lbTitleName.Size = new Size(409, 24);
|
||||||
label1.TabIndex = 17;
|
lbTitleName.TabIndex = 17;
|
||||||
label1.Text = "PLC点位操作";
|
lbTitleName.Text = "PLC点位操作";
|
||||||
//
|
//
|
||||||
// panel1
|
// panel1
|
||||||
//
|
//
|
||||||
panel1.Controls.Add(stackPanel3);
|
|
||||||
panel1.Controls.Add(label6);
|
|
||||||
panel1.Controls.Add(stackPanel2);
|
|
||||||
panel1.Controls.Add(label5);
|
|
||||||
panel1.Controls.Add(sltBoolValue);
|
|
||||||
panel1.Controls.Add(stpNum);
|
|
||||||
panel1.Controls.Add(label4);
|
|
||||||
panel1.Controls.Add(iptAddress);
|
panel1.Controls.Add(iptAddress);
|
||||||
panel1.Controls.Add(label7);
|
panel1.Controls.Add(label7);
|
||||||
panel1.Controls.Add(sltDataType);
|
panel1.Controls.Add(sltDataType);
|
||||||
@ -159,131 +136,16 @@
|
|||||||
panel1.Controls.Add(divider2);
|
panel1.Controls.Add(divider2);
|
||||||
panel1.Controls.Add(stackPanel1);
|
panel1.Controls.Add(stackPanel1);
|
||||||
panel1.Controls.Add(divider1);
|
panel1.Controls.Add(divider1);
|
||||||
panel1.Controls.Add(label1);
|
panel1.Controls.Add(lbTitleName);
|
||||||
panel1.Dock = DockStyle.Fill;
|
panel1.Dock = DockStyle.Fill;
|
||||||
panel1.Location = new Point(0, 0);
|
panel1.Location = new Point(0, 0);
|
||||||
panel1.Name = "panel1";
|
panel1.Name = "panel1";
|
||||||
panel1.Padding = new Padding(12);
|
panel1.Padding = new Padding(12);
|
||||||
panel1.Shadow = 6;
|
panel1.Shadow = 6;
|
||||||
panel1.Size = new Size(445, 572);
|
panel1.Size = new Size(445, 315);
|
||||||
panel1.TabIndex = 1;
|
panel1.TabIndex = 1;
|
||||||
panel1.Text = "panel1";
|
panel1.Text = "panel1";
|
||||||
//
|
//
|
||||||
// stackPanel3
|
|
||||||
//
|
|
||||||
stackPanel3.BackColor = SystemColors.Window;
|
|
||||||
stackPanel3.Controls.Add(iptEndIndex);
|
|
||||||
stackPanel3.Controls.Add(sltEnd);
|
|
||||||
stackPanel3.Dock = DockStyle.Top;
|
|
||||||
stackPanel3.Location = new Point(18, 496);
|
|
||||||
stackPanel3.Name = "stackPanel3";
|
|
||||||
stackPanel3.Size = new Size(409, 45);
|
|
||||||
stackPanel3.TabIndex = 61;
|
|
||||||
stackPanel3.Text = "stackPanel3";
|
|
||||||
//
|
|
||||||
// sltEnd
|
|
||||||
//
|
|
||||||
sltEnd.Dock = DockStyle.Left;
|
|
||||||
sltEnd.Items.AddRange(new object[] { "执行", "取消" });
|
|
||||||
sltEnd.List = true;
|
|
||||||
sltEnd.Location = new Point(3, 3);
|
|
||||||
sltEnd.Name = "sltEnd";
|
|
||||||
sltEnd.Size = new Size(268, 39);
|
|
||||||
sltEnd.TabIndex = 35;
|
|
||||||
//
|
|
||||||
// label6
|
|
||||||
//
|
|
||||||
label6.Dock = DockStyle.Top;
|
|
||||||
label6.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
|
||||||
label6.Location = new Point(18, 472);
|
|
||||||
label6.Name = "label6";
|
|
||||||
label6.Size = new Size(409, 24);
|
|
||||||
label6.TabIndex = 60;
|
|
||||||
label6.Text = "流程结束执行";
|
|
||||||
//
|
|
||||||
// stackPanel2
|
|
||||||
//
|
|
||||||
stackPanel2.BackColor = SystemColors.Window;
|
|
||||||
stackPanel2.Controls.Add(iptStartIndex);
|
|
||||||
stackPanel2.Controls.Add(sltStart);
|
|
||||||
stackPanel2.Dock = DockStyle.Top;
|
|
||||||
stackPanel2.Location = new Point(18, 427);
|
|
||||||
stackPanel2.Name = "stackPanel2";
|
|
||||||
stackPanel2.Size = new Size(409, 45);
|
|
||||||
stackPanel2.TabIndex = 59;
|
|
||||||
stackPanel2.Text = "stackPanel2";
|
|
||||||
//
|
|
||||||
// sltStart
|
|
||||||
//
|
|
||||||
sltStart.Dock = DockStyle.Left;
|
|
||||||
sltStart.Items.AddRange(new object[] { "执行", "取消" });
|
|
||||||
sltStart.List = true;
|
|
||||||
sltStart.Location = new Point(3, 3);
|
|
||||||
sltStart.Name = "sltStart";
|
|
||||||
sltStart.Size = new Size(268, 39);
|
|
||||||
sltStart.TabIndex = 35;
|
|
||||||
//
|
|
||||||
// label5
|
|
||||||
//
|
|
||||||
label5.Dock = DockStyle.Top;
|
|
||||||
label5.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
|
||||||
label5.Location = new Point(18, 403);
|
|
||||||
label5.Name = "label5";
|
|
||||||
label5.Size = new Size(409, 24);
|
|
||||||
label5.TabIndex = 58;
|
|
||||||
label5.Text = "流程开始执行";
|
|
||||||
//
|
|
||||||
// sltBoolValue
|
|
||||||
//
|
|
||||||
sltBoolValue.Dock = DockStyle.Top;
|
|
||||||
sltBoolValue.Items.AddRange(new object[] { "True", "False" });
|
|
||||||
sltBoolValue.List = true;
|
|
||||||
sltBoolValue.Location = new Point(18, 365);
|
|
||||||
sltBoolValue.Name = "sltBoolValue";
|
|
||||||
sltBoolValue.Size = new Size(409, 38);
|
|
||||||
sltBoolValue.TabIndex = 57;
|
|
||||||
//
|
|
||||||
// stpNum
|
|
||||||
//
|
|
||||||
stpNum.BackColor = SystemColors.Window;
|
|
||||||
stpNum.Controls.Add(sltIntType);
|
|
||||||
stpNum.Controls.Add(iptValue);
|
|
||||||
stpNum.Dock = DockStyle.Top;
|
|
||||||
stpNum.Location = new Point(18, 320);
|
|
||||||
stpNum.Name = "stpNum";
|
|
||||||
stpNum.Size = new Size(409, 45);
|
|
||||||
stpNum.TabIndex = 56;
|
|
||||||
stpNum.Text = "stackPanel2";
|
|
||||||
//
|
|
||||||
// sltIntType
|
|
||||||
//
|
|
||||||
sltIntType.Dock = DockStyle.Left;
|
|
||||||
sltIntType.List = true;
|
|
||||||
sltIntType.Location = new Point(277, 3);
|
|
||||||
sltIntType.Name = "sltIntType";
|
|
||||||
sltIntType.Size = new Size(132, 39);
|
|
||||||
sltIntType.TabIndex = 35;
|
|
||||||
//
|
|
||||||
// iptValue
|
|
||||||
//
|
|
||||||
iptValue.Dock = DockStyle.Left;
|
|
||||||
iptValue.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
|
||||||
iptValue.Location = new Point(3, 3);
|
|
||||||
iptValue.Name = "iptValue";
|
|
||||||
iptValue.Radius = 3;
|
|
||||||
iptValue.Size = new Size(268, 39);
|
|
||||||
iptValue.TabIndex = 24;
|
|
||||||
//
|
|
||||||
// label4
|
|
||||||
//
|
|
||||||
label4.Dock = DockStyle.Top;
|
|
||||||
label4.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
|
||||||
label4.Location = new Point(18, 296);
|
|
||||||
label4.Name = "label4";
|
|
||||||
label4.Size = new Size(409, 24);
|
|
||||||
label4.TabIndex = 55;
|
|
||||||
label4.Text = "值";
|
|
||||||
//
|
|
||||||
// iptAddress
|
// iptAddress
|
||||||
//
|
//
|
||||||
iptAddress.Dock = DockStyle.Top;
|
iptAddress.Dock = DockStyle.Top;
|
||||||
@ -323,40 +185,15 @@
|
|||||||
label3.TabIndex = 44;
|
label3.TabIndex = 44;
|
||||||
label3.Text = "数据类型";
|
label3.Text = "数据类型";
|
||||||
//
|
//
|
||||||
// iptStartIndex
|
|
||||||
//
|
|
||||||
iptStartIndex.Location = new Point(277, 3);
|
|
||||||
iptStartIndex.Maximum = new decimal(new int[] { 99999999, 0, 0, 0 });
|
|
||||||
iptStartIndex.Minimum = new decimal(new int[] { 2, 0, 0, int.MinValue });
|
|
||||||
iptStartIndex.Name = "iptStartIndex";
|
|
||||||
iptStartIndex.Size = new Size(129, 39);
|
|
||||||
iptStartIndex.TabIndex = 37;
|
|
||||||
iptStartIndex.Text = "-1";
|
|
||||||
iptStartIndex.Value = new decimal(new int[] { 1, 0, 0, int.MinValue });
|
|
||||||
//
|
|
||||||
// iptEndIndex
|
|
||||||
//
|
|
||||||
iptEndIndex.Location = new Point(277, 3);
|
|
||||||
iptEndIndex.Maximum = new decimal(new int[] { 99999999, 0, 0, 0 });
|
|
||||||
iptEndIndex.Minimum = new decimal(new int[] { 2, 0, 0, int.MinValue });
|
|
||||||
iptEndIndex.Name = "iptEndIndex";
|
|
||||||
iptEndIndex.Size = new Size(129, 39);
|
|
||||||
iptEndIndex.TabIndex = 38;
|
|
||||||
iptEndIndex.Text = "-1";
|
|
||||||
iptEndIndex.Value = new decimal(new int[] { 1, 0, 0, int.MinValue });
|
|
||||||
//
|
|
||||||
// MotionEdit
|
// MotionEdit
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(7F, 17F);
|
AutoScaleDimensions = new SizeF(7F, 17F);
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
Controls.Add(panel1);
|
Controls.Add(panel1);
|
||||||
Name = "MotionEdit";
|
Name = "MotionEdit";
|
||||||
Size = new Size(445, 572);
|
Size = new Size(445, 315);
|
||||||
stackPanel1.ResumeLayout(false);
|
stackPanel1.ResumeLayout(false);
|
||||||
panel1.ResumeLayout(false);
|
panel1.ResumeLayout(false);
|
||||||
stackPanel3.ResumeLayout(false);
|
|
||||||
stackPanel2.ResumeLayout(false);
|
|
||||||
stpNum.ResumeLayout(false);
|
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,24 +205,11 @@
|
|||||||
private AntdUI.StackPanel stackPanel1;
|
private AntdUI.StackPanel stackPanel1;
|
||||||
private AntdUI.Button button_ok;
|
private AntdUI.Button button_ok;
|
||||||
private AntdUI.Divider divider1;
|
private AntdUI.Divider divider1;
|
||||||
private AntdUI.Label label1;
|
private AntdUI.Label lbTitleName;
|
||||||
private AntdUI.Panel panel1;
|
private AntdUI.Panel panel1;
|
||||||
private AntdUI.Select sltDataType;
|
private AntdUI.Select sltDataType;
|
||||||
private AntdUI.Label label3;
|
private AntdUI.Label label3;
|
||||||
private AntdUI.StackPanel stackPanel3;
|
|
||||||
private AntdUI.Select sltEnd;
|
|
||||||
private AntdUI.Label label6;
|
|
||||||
private AntdUI.StackPanel stackPanel2;
|
|
||||||
private AntdUI.Select sltStart;
|
|
||||||
private AntdUI.Label label5;
|
|
||||||
private AntdUI.Select sltBoolValue;
|
|
||||||
private AntdUI.StackPanel stpNum;
|
|
||||||
private AntdUI.Select sltIntType;
|
|
||||||
private AntdUI.Input iptValue;
|
|
||||||
private AntdUI.Label label4;
|
|
||||||
private AntdUI.Input iptAddress;
|
private AntdUI.Input iptAddress;
|
||||||
private AntdUI.Label label7;
|
private AntdUI.Label label7;
|
||||||
private AntdUI.InputNumber iptStartIndex;
|
|
||||||
private AntdUI.InputNumber iptEndIndex;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,9 +10,10 @@ namespace DHSoftware.Views
|
|||||||
private AntdUI.Window window;
|
private AntdUI.Window window;
|
||||||
private PLCItem plcItem;
|
private PLCItem plcItem;
|
||||||
public bool submit;
|
public bool submit;
|
||||||
public MotionEdit(AntdUI.Window _window, PLCItem _plcItem)
|
public MotionEdit(AntdUI.Window _window,string TitleName, PLCItem _plcItem)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
lbTitleName.Text = TitleName;
|
||||||
plcItem = _plcItem;
|
plcItem = _plcItem;
|
||||||
// 绑定事件
|
// 绑定事件
|
||||||
BindEventHandler();
|
BindEventHandler();
|
||||||
@ -26,29 +27,9 @@ namespace DHSoftware.Views
|
|||||||
button_cancel.Click += Button_cancel_Click;
|
button_cancel.Click += Button_cancel_Click;
|
||||||
|
|
||||||
|
|
||||||
sltDataType.SelectedIndexChanged += SltDataType_SelectedIndexChanged;
|
|
||||||
sltStart.SelectedIndexChanged += SltStart_SelectedIndexChanged;
|
|
||||||
sltEnd.SelectedIndexChanged += SltEnd_SelectedIndexChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SltEnd_SelectedIndexChanged(object sender, IntEventArgs e)
|
|
||||||
{
|
|
||||||
iptEndIndex.Visible = e.Value == 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SltDataType_SelectedIndexChanged(object sender, IntEventArgs e)
|
|
||||||
{
|
|
||||||
var isMType = e.Value == 2;
|
|
||||||
stpNum.Visible = !isMType;
|
|
||||||
sltBoolValue.Visible = isMType;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SltStart_SelectedIndexChanged(object sender, IntEventArgs e)
|
|
||||||
{
|
|
||||||
iptStartIndex.Visible = e.Value == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void Button_cancel_Click(object sender, EventArgs e)
|
private void Button_cancel_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -66,17 +47,9 @@ namespace DHSoftware.Views
|
|||||||
AntdUI.Message.warn(window, "参数名称不能为空!", autoClose: 3);
|
AntdUI.Message.warn(window, "参数名称不能为空!", autoClose: 3);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
plcItem.Name = sltName.Text;
|
plcItem.Name = sltName.Text;
|
||||||
plcItem.Address = iptAddress.Text;
|
plcItem.Address = iptAddress.Text;
|
||||||
plcItem.Type = sltDataType.Text;
|
plcItem.Type = (EnumPLCDataType)sltDataType.SelectedIndex;
|
||||||
plcItem.Value = sltDataType.SelectedIndex == 2 ? sltBoolValue.Text : iptValue.Text;
|
|
||||||
plcItem.NumTpye = sltDataType.SelectedIndex == 2 ? string.Empty : sltIntType.Text;
|
|
||||||
plcItem.StartExecute = sltStart.Text == "执行" ? true : false;
|
|
||||||
plcItem.StartIndex = sltStart.Text == "执行" ? Convert.ToInt32(iptStartIndex.Value) : -1;
|
|
||||||
plcItem.EndExecute = sltEnd.Text == "执行" ? true : false;
|
|
||||||
plcItem.EndIndex = sltEnd.Text == "执行" ? Convert.ToInt32(iptEndIndex.Value) : -1;
|
|
||||||
|
|
||||||
submit = true;
|
submit = true;
|
||||||
this.Dispose();
|
this.Dispose();
|
||||||
}
|
}
|
||||||
@ -94,28 +67,13 @@ namespace DHSoftware.Views
|
|||||||
sltDataType.Items.Add(name);
|
sltDataType.Items.Add(name);
|
||||||
}
|
}
|
||||||
sltDataType.SelectedIndex = 0;
|
sltDataType.SelectedIndex = 0;
|
||||||
var PLCINTTypes = Enum.GetNames(typeof(EnumPLCINTType));
|
|
||||||
foreach (var name in PLCINTTypes)
|
|
||||||
{
|
|
||||||
sltIntType.Items.Add(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
sltStart.SelectedIndex = 1;
|
|
||||||
sltEnd.SelectedIndex = 1;
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(plcItem.Name))
|
if (!string.IsNullOrEmpty(plcItem.Name))
|
||||||
{
|
{
|
||||||
sltName.Text = plcItem.Name;
|
sltName.Text = plcItem.Name;
|
||||||
iptAddress.Text = plcItem.Address;
|
iptAddress.Text = plcItem.Address;
|
||||||
sltDataType.SelectedValue = plcItem.Type;
|
sltDataType.SelectedIndex =(int)plcItem.Type;
|
||||||
iptValue.Text = sltDataType.SelectedIndex != 2 ? plcItem.Value : string.Empty;
|
|
||||||
sltBoolValue.SelectedValue = sltDataType.SelectedIndex == 2 ? plcItem.Value : string.Empty;
|
|
||||||
sltIntType.SelectedValue = sltDataType.SelectedIndex == 2 ? string.Empty : plcItem.NumTpye;
|
|
||||||
sltStart.SelectedValue = plcItem.StartExecute == true ? "执行" : "取消";
|
|
||||||
sltEnd.SelectedValue = plcItem.EndExecute == true ? "执行" : "取消";
|
|
||||||
iptStartIndex.Value = plcItem.StartExecute == true ? plcItem.StartIndex : -1;
|
|
||||||
iptEndIndex.Value = plcItem.EndExecute == true ? plcItem.EndIndex : -1;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
270
DHSoftware/Views/MotionProcessEdit.Designer.cs
generated
Normal file
270
DHSoftware/Views/MotionProcessEdit.Designer.cs
generated
Normal file
@ -0,0 +1,270 @@
|
|||||||
|
namespace DHSoftware.Views
|
||||||
|
{
|
||||||
|
partial class MotionProcessEdit
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 必需的设计器变量。
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清理所有正在使用的资源。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 组件设计器生成的代码
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设计器支持所需的方法 - 不要修改
|
||||||
|
/// 使用代码编辑器修改此方法的内容。
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
button_cancel = new AntdUI.Button();
|
||||||
|
sltName = new AntdUI.Select();
|
||||||
|
label2 = new AntdUI.Label();
|
||||||
|
divider2 = new AntdUI.Divider();
|
||||||
|
stackPanel1 = new AntdUI.StackPanel();
|
||||||
|
button_ok = new AntdUI.Button();
|
||||||
|
divider1 = new AntdUI.Divider();
|
||||||
|
lbTitleName = new AntdUI.Label();
|
||||||
|
panel1 = new AntdUI.Panel();
|
||||||
|
iptValue = new AntdUI.Input();
|
||||||
|
label1 = new AntdUI.Label();
|
||||||
|
iptAddress = new AntdUI.Input();
|
||||||
|
label7 = new AntdUI.Label();
|
||||||
|
sltDataType = new AntdUI.Select();
|
||||||
|
label4 = new AntdUI.Label();
|
||||||
|
sltEnable = new AntdUI.Select();
|
||||||
|
label3 = new AntdUI.Label();
|
||||||
|
stackPanel1.SuspendLayout();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// button_cancel
|
||||||
|
//
|
||||||
|
button_cancel.BorderWidth = 1F;
|
||||||
|
button_cancel.Font = new Font("Microsoft YaHei UI", 9F);
|
||||||
|
button_cancel.Ghost = true;
|
||||||
|
button_cancel.Location = new Point(84, 3);
|
||||||
|
button_cancel.Name = "button_cancel";
|
||||||
|
button_cancel.Size = new Size(75, 38);
|
||||||
|
button_cancel.TabIndex = 1;
|
||||||
|
button_cancel.Text = "取消";
|
||||||
|
//
|
||||||
|
// sltName
|
||||||
|
//
|
||||||
|
sltName.Dock = DockStyle.Top;
|
||||||
|
sltName.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
sltName.Location = new Point(18, 134);
|
||||||
|
sltName.MaxCount = 10;
|
||||||
|
sltName.Name = "sltName";
|
||||||
|
sltName.Radius = 3;
|
||||||
|
sltName.Size = new Size(409, 38);
|
||||||
|
sltName.TabIndex = 23;
|
||||||
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
label2.Dock = DockStyle.Top;
|
||||||
|
label2.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
label2.Location = new Point(18, 110);
|
||||||
|
label2.Name = "label2";
|
||||||
|
label2.Size = new Size(409, 24);
|
||||||
|
label2.TabIndex = 22;
|
||||||
|
label2.Text = "名称";
|
||||||
|
//
|
||||||
|
// divider2
|
||||||
|
//
|
||||||
|
divider2.Dock = DockStyle.Top;
|
||||||
|
divider2.Location = new Point(18, 98);
|
||||||
|
divider2.Name = "divider2";
|
||||||
|
divider2.Size = new Size(409, 12);
|
||||||
|
divider2.TabIndex = 21;
|
||||||
|
//
|
||||||
|
// stackPanel1
|
||||||
|
//
|
||||||
|
stackPanel1.Controls.Add(button_cancel);
|
||||||
|
stackPanel1.Controls.Add(button_ok);
|
||||||
|
stackPanel1.Dock = DockStyle.Top;
|
||||||
|
stackPanel1.Location = new Point(18, 54);
|
||||||
|
stackPanel1.Name = "stackPanel1";
|
||||||
|
stackPanel1.RightToLeft = RightToLeft.No;
|
||||||
|
stackPanel1.Size = new Size(409, 44);
|
||||||
|
stackPanel1.TabIndex = 20;
|
||||||
|
stackPanel1.Text = "stackPanel1";
|
||||||
|
//
|
||||||
|
// button_ok
|
||||||
|
//
|
||||||
|
button_ok.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
button_ok.Location = new Point(3, 3);
|
||||||
|
button_ok.Name = "button_ok";
|
||||||
|
button_ok.Size = new Size(75, 38);
|
||||||
|
button_ok.TabIndex = 0;
|
||||||
|
button_ok.Text = "确定";
|
||||||
|
button_ok.Type = AntdUI.TTypeMini.Primary;
|
||||||
|
//
|
||||||
|
// divider1
|
||||||
|
//
|
||||||
|
divider1.Dock = DockStyle.Top;
|
||||||
|
divider1.Location = new Point(18, 42);
|
||||||
|
divider1.Name = "divider1";
|
||||||
|
divider1.Size = new Size(409, 12);
|
||||||
|
divider1.TabIndex = 19;
|
||||||
|
//
|
||||||
|
// lbTitleName
|
||||||
|
//
|
||||||
|
lbTitleName.Dock = DockStyle.Top;
|
||||||
|
lbTitleName.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
lbTitleName.Location = new Point(18, 18);
|
||||||
|
lbTitleName.Name = "lbTitleName";
|
||||||
|
lbTitleName.Size = new Size(409, 24);
|
||||||
|
lbTitleName.TabIndex = 17;
|
||||||
|
lbTitleName.Text = "PLC点位操作";
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.Controls.Add(iptValue);
|
||||||
|
panel1.Controls.Add(label1);
|
||||||
|
panel1.Controls.Add(iptAddress);
|
||||||
|
panel1.Controls.Add(label7);
|
||||||
|
panel1.Controls.Add(sltDataType);
|
||||||
|
panel1.Controls.Add(label4);
|
||||||
|
panel1.Controls.Add(sltEnable);
|
||||||
|
panel1.Controls.Add(label3);
|
||||||
|
panel1.Controls.Add(sltName);
|
||||||
|
panel1.Controls.Add(label2);
|
||||||
|
panel1.Controls.Add(divider2);
|
||||||
|
panel1.Controls.Add(stackPanel1);
|
||||||
|
panel1.Controls.Add(divider1);
|
||||||
|
panel1.Controls.Add(lbTitleName);
|
||||||
|
panel1.Dock = DockStyle.Fill;
|
||||||
|
panel1.Location = new Point(0, 0);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Padding = new Padding(12);
|
||||||
|
panel1.Shadow = 6;
|
||||||
|
panel1.Size = new Size(445, 451);
|
||||||
|
panel1.TabIndex = 1;
|
||||||
|
panel1.Text = "panel1";
|
||||||
|
panel1.Click += panel1_Click;
|
||||||
|
//
|
||||||
|
// iptValue
|
||||||
|
//
|
||||||
|
iptValue.Dock = DockStyle.Top;
|
||||||
|
iptValue.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
iptValue.Location = new Point(18, 382);
|
||||||
|
iptValue.Name = "iptValue";
|
||||||
|
iptValue.PlaceholderText = "布尔类型1(true)或0(false),其它类型实值";
|
||||||
|
iptValue.Radius = 3;
|
||||||
|
iptValue.Size = new Size(409, 38);
|
||||||
|
iptValue.TabIndex = 62;
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
label1.Dock = DockStyle.Top;
|
||||||
|
label1.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
label1.Location = new Point(18, 358);
|
||||||
|
label1.Name = "label1";
|
||||||
|
label1.Size = new Size(409, 24);
|
||||||
|
label1.TabIndex = 61;
|
||||||
|
label1.Text = "值";
|
||||||
|
//
|
||||||
|
// iptAddress
|
||||||
|
//
|
||||||
|
iptAddress.Dock = DockStyle.Top;
|
||||||
|
iptAddress.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
iptAddress.Location = new Point(18, 320);
|
||||||
|
iptAddress.Name = "iptAddress";
|
||||||
|
iptAddress.Radius = 3;
|
||||||
|
iptAddress.ReadOnly = true;
|
||||||
|
iptAddress.Size = new Size(409, 38);
|
||||||
|
iptAddress.TabIndex = 60;
|
||||||
|
//
|
||||||
|
// label7
|
||||||
|
//
|
||||||
|
label7.Dock = DockStyle.Top;
|
||||||
|
label7.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
label7.Location = new Point(18, 296);
|
||||||
|
label7.Name = "label7";
|
||||||
|
label7.Size = new Size(409, 24);
|
||||||
|
label7.TabIndex = 59;
|
||||||
|
label7.Text = "地址";
|
||||||
|
//
|
||||||
|
// sltDataType
|
||||||
|
//
|
||||||
|
sltDataType.Dock = DockStyle.Top;
|
||||||
|
sltDataType.List = true;
|
||||||
|
sltDataType.Location = new Point(18, 258);
|
||||||
|
sltDataType.Name = "sltDataType";
|
||||||
|
sltDataType.ReadOnly = true;
|
||||||
|
sltDataType.Size = new Size(409, 38);
|
||||||
|
sltDataType.TabIndex = 58;
|
||||||
|
//
|
||||||
|
// label4
|
||||||
|
//
|
||||||
|
label4.Dock = DockStyle.Top;
|
||||||
|
label4.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
label4.Location = new Point(18, 234);
|
||||||
|
label4.Name = "label4";
|
||||||
|
label4.Size = new Size(409, 24);
|
||||||
|
label4.TabIndex = 57;
|
||||||
|
label4.Text = "数据类型";
|
||||||
|
//
|
||||||
|
// sltEnable
|
||||||
|
//
|
||||||
|
sltEnable.Dock = DockStyle.Top;
|
||||||
|
sltEnable.List = true;
|
||||||
|
sltEnable.Location = new Point(18, 196);
|
||||||
|
sltEnable.Name = "sltEnable";
|
||||||
|
sltEnable.Size = new Size(409, 38);
|
||||||
|
sltEnable.TabIndex = 45;
|
||||||
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
label3.Dock = DockStyle.Top;
|
||||||
|
label3.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||||
|
label3.Location = new Point(18, 172);
|
||||||
|
label3.Name = "label3";
|
||||||
|
label3.Size = new Size(409, 24);
|
||||||
|
label3.TabIndex = 44;
|
||||||
|
label3.Text = "状态";
|
||||||
|
//
|
||||||
|
// MotionProcessEdit
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 17F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
Controls.Add(panel1);
|
||||||
|
Name = "MotionProcessEdit";
|
||||||
|
Size = new Size(445, 451);
|
||||||
|
stackPanel1.ResumeLayout(false);
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
private AntdUI.Button button_cancel;
|
||||||
|
private AntdUI.Select sltName;
|
||||||
|
private AntdUI.Label label2;
|
||||||
|
private AntdUI.Divider divider2;
|
||||||
|
private AntdUI.StackPanel stackPanel1;
|
||||||
|
private AntdUI.Button button_ok;
|
||||||
|
private AntdUI.Divider divider1;
|
||||||
|
private AntdUI.Label lbTitleName;
|
||||||
|
private AntdUI.Panel panel1;
|
||||||
|
private AntdUI.Select sltEnable;
|
||||||
|
private AntdUI.Label label3;
|
||||||
|
private AntdUI.Input iptValue;
|
||||||
|
private AntdUI.Label label1;
|
||||||
|
private AntdUI.Input iptAddress;
|
||||||
|
private AntdUI.Label label7;
|
||||||
|
private AntdUI.Select sltDataType;
|
||||||
|
private AntdUI.Label label4;
|
||||||
|
}
|
||||||
|
}
|
104
DHSoftware/Views/MotionProcessEdit.cs
Normal file
104
DHSoftware/Views/MotionProcessEdit.cs
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
using System.ComponentModel;
|
||||||
|
using AntdUI;
|
||||||
|
using DH.Commons.Base;
|
||||||
|
using DH.Commons.Enums;
|
||||||
|
using DH.Devices.PLC;
|
||||||
|
|
||||||
|
namespace DHSoftware.Views
|
||||||
|
{
|
||||||
|
public partial class MotionProcessEdit : UserControl
|
||||||
|
{
|
||||||
|
private AntdUI.Window window;
|
||||||
|
private PLCItem plcItem;
|
||||||
|
private BindingList<PLCItem> plcItemList;
|
||||||
|
public bool submit;
|
||||||
|
public MotionProcessEdit(AntdUI.Window _window, string TitleName, PLCItem _plcItem, BindingList<PLCItem> _plcItemList)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
lbTitleName.Text = TitleName;
|
||||||
|
plcItem = _plcItem;
|
||||||
|
plcItemList= _plcItemList;
|
||||||
|
// 绑定事件
|
||||||
|
BindEventHandler();
|
||||||
|
//设置默认值
|
||||||
|
InitData();
|
||||||
|
|
||||||
|
}
|
||||||
|
private void BindEventHandler()
|
||||||
|
{
|
||||||
|
sltName.SelectedIndexChanged += SltName_SelectedIndexChanged;
|
||||||
|
button_ok.Click += Button_ok_Click;
|
||||||
|
button_cancel.Click += Button_cancel_Click;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SltName_SelectedIndexChanged(object sender, IntEventArgs e)
|
||||||
|
{
|
||||||
|
Select select = (Select)sender;
|
||||||
|
var pLCItems=plcItemList.Where(it=>it.Name==select.Text).FirstOrDefault();
|
||||||
|
if (pLCItems != null)
|
||||||
|
{
|
||||||
|
sltDataType.SelectedIndex =(int)pLCItems.Type;
|
||||||
|
iptAddress.Text= pLCItems.Address;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Button_cancel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
submit = false;
|
||||||
|
this.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Button_ok_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
sltName.Status = AntdUI.TType.None;
|
||||||
|
//检查输入内容
|
||||||
|
if (String.IsNullOrEmpty(sltName.Text))
|
||||||
|
{
|
||||||
|
sltName.Status = AntdUI.TType.Error;
|
||||||
|
AntdUI.Message.warn(window, "参数名称不能为空!", autoClose: 3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
plcItem.Name = sltName.Text;
|
||||||
|
plcItem.Address = iptAddress.Text;
|
||||||
|
plcItem.Type = (EnumPLCDataType)sltDataType.SelectedIndex;
|
||||||
|
plcItem.Value=iptValue.Text;
|
||||||
|
plcItem.StartExecute = sltEnable.SelectedIndex != 0;
|
||||||
|
submit = true;
|
||||||
|
this.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitData()
|
||||||
|
{
|
||||||
|
|
||||||
|
foreach (var item in plcItemList)
|
||||||
|
{
|
||||||
|
sltName.Items.Add(item.Name);
|
||||||
|
sltDataType.Items.Add(item.Type);
|
||||||
|
}
|
||||||
|
|
||||||
|
var boolNames = Enum.GetNames(typeof(EnumBool));
|
||||||
|
foreach (var name in boolNames)
|
||||||
|
{
|
||||||
|
sltEnable.Items.Add(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(plcItem.Name))
|
||||||
|
{
|
||||||
|
sltName.Text = plcItem.Name;
|
||||||
|
iptAddress.Text = plcItem.Address;
|
||||||
|
sltDataType.SelectedIndex = (int)plcItem.Type;
|
||||||
|
sltEnable.SelectedIndex = plcItem.StartExecute ? 1 : 0;
|
||||||
|
iptValue.Text = plcItem.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void panel1_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
DHSoftware/Views/MotionProcessEdit.resx
Normal file
120
DHSoftware/Views/MotionProcessEdit.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
Loading…
x
Reference in New Issue
Block a user