Compare commits
6 Commits
dev_xiao
...
5d77eebc67
Author | SHA1 | Date | |
---|---|---|---|
5d77eebc67 | |||
8868915944 | |||
2d98b2d8b8 | |||
bee7dc6f03 | |||
1046978877 | |||
bc981fc7a9 |
@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DH.Commons.Base
|
||||
{
|
||||
internal class GloablConfig
|
||||
{
|
||||
}
|
||||
}
|
131
DH.Commons/Base/GlobalConfig.cs
Normal file
131
DH.Commons/Base/GlobalConfig.cs
Normal file
@ -0,0 +1,131 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
using AntdUI;
|
||||
|
||||
namespace DH.Commons.Base
|
||||
{
|
||||
public class GlobalConfig : NotifyProperty
|
||||
{
|
||||
string _name;
|
||||
private BindingList<PLCItem> _InitProcessList = new BindingList<PLCItem>();
|
||||
private BindingList<PLCItem> _StartProcessList = new BindingList<PLCItem>();
|
||||
private BindingList<PLCItem> _StopProcessList = new BindingList<PLCItem>();
|
||||
private BindingList<PLCItem> _StartResetList = new BindingList<PLCItem>();
|
||||
private BindingList<PLCItem> _StopResetList = new BindingList<PLCItem>();
|
||||
public string Name
|
||||
{
|
||||
get => _name;
|
||||
set
|
||||
{
|
||||
if (_name != value)
|
||||
{
|
||||
_name = value;
|
||||
OnPropertyChanged(nameof(Name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public BindingList<PLCItem> InitProcessList
|
||||
{
|
||||
get => _InitProcessList;
|
||||
set
|
||||
{
|
||||
if (_InitProcessList == value) return;
|
||||
_InitProcessList = value;
|
||||
OnPropertyChanged(nameof(InitProcessList));
|
||||
}
|
||||
}
|
||||
public BindingList<PLCItem> StartProcessList
|
||||
{
|
||||
get => _StartProcessList;
|
||||
set
|
||||
{
|
||||
if (_StartProcessList == value) return;
|
||||
_StartProcessList = value;
|
||||
OnPropertyChanged(nameof(StartProcessList));
|
||||
}
|
||||
}
|
||||
public BindingList<PLCItem> StopProcessList
|
||||
{
|
||||
get => _StopProcessList;
|
||||
set
|
||||
{
|
||||
if (_StopProcessList == value) return;
|
||||
_StopProcessList = value;
|
||||
OnPropertyChanged(nameof(StopProcessList));
|
||||
}
|
||||
}
|
||||
public BindingList<PLCItem> StartResetList
|
||||
{
|
||||
get => _StartResetList;
|
||||
set
|
||||
{
|
||||
if (_StartResetList == value) return;
|
||||
_StartResetList = value;
|
||||
OnPropertyChanged(nameof(StartResetList));
|
||||
}
|
||||
}
|
||||
public BindingList<PLCItem> StopResetList
|
||||
{
|
||||
get => _StopResetList;
|
||||
set
|
||||
{
|
||||
if (_StopResetList == value) return;
|
||||
_StopResetList = value;
|
||||
OnPropertyChanged(nameof(StopResetList));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
string _imgSavePath;
|
||||
string _dbSavePath;
|
||||
string _configSavePath;
|
||||
|
||||
public string ImgSavePath
|
||||
{
|
||||
get => _imgSavePath;
|
||||
set
|
||||
{
|
||||
if (_imgSavePath != value)
|
||||
{
|
||||
_imgSavePath = value;
|
||||
OnPropertyChanged(nameof(ImgSavePath));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string DbSavePath
|
||||
{
|
||||
get => _dbSavePath;
|
||||
set
|
||||
{
|
||||
if (_dbSavePath != value)
|
||||
{
|
||||
_dbSavePath = value;
|
||||
OnPropertyChanged(nameof(DbSavePath));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string ConfigSavePath
|
||||
{
|
||||
get => _configSavePath;
|
||||
set
|
||||
{
|
||||
if (_configSavePath != value)
|
||||
{
|
||||
_configSavePath = value;
|
||||
OnPropertyChanged(nameof(ConfigSavePath));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -20,7 +20,8 @@ namespace DH.Commons.Base
|
||||
private Parity _parity = Parity.None;
|
||||
private string _ip = "192.168.6.61";
|
||||
private int _port = 502;
|
||||
private AntList<PLCItem> _PLCItemList = new AntList<PLCItem>();
|
||||
private BindingList<PLCItem> _PLCItemList = new BindingList<PLCItem>();
|
||||
|
||||
[Category("设备配置")]
|
||||
[DisplayName("是否启用")]
|
||||
[Description("是否启用")]
|
||||
@ -179,7 +180,7 @@ namespace DH.Commons.Base
|
||||
[Category("点位配置")]
|
||||
[DisplayName("点位配置")]
|
||||
[Description("点位配置")]
|
||||
public AntList<PLCItem> PLCItemList
|
||||
public BindingList<PLCItem> PLCItemList
|
||||
{
|
||||
get => _PLCItemList;
|
||||
set
|
||||
@ -189,6 +190,8 @@ namespace DH.Commons.Base
|
||||
OnPropertyChanged(nameof(PLCItemList));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public virtual bool PLCConnect()
|
||||
{
|
||||
Connected = true;
|
||||
@ -201,14 +204,23 @@ namespace DH.Commons.Base
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual Int16 ReadInt16(string address) { return 0; }
|
||||
|
||||
public virtual ushort ReadShort(string address) { return 0; }
|
||||
public virtual int ReadInt(string address) { return 0; }
|
||||
public virtual Int32 ReadInt32(string address) { return 0; }
|
||||
|
||||
public virtual UInt16 ReadUInt16(string address) { return 0; }
|
||||
|
||||
public virtual UInt32 ReadUInt32(string address) { return 0; }
|
||||
public virtual float ReadFloat(string address) { return 0; }
|
||||
public virtual bool ReadBool(string address) { 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 WriteDInt(string address, int value, bool waitForReply = true) { return false; }
|
||||
|
||||
public virtual bool WriteInt16(string address, Int16 value, bool waitForReply = true) { return false; }
|
||||
public virtual bool WriteInt32(string address, Int32 value, bool waitForReply = true) { return false; }
|
||||
|
||||
|
||||
public virtual bool WriteUInt16(string address, UInt16 value, bool waitForReply = true) { return false; }
|
||||
public virtual bool WriteUInt32(string address, UInt32 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; }
|
||||
}
|
||||
@ -218,13 +230,10 @@ namespace DH.Commons.Base
|
||||
{
|
||||
private bool _selected;
|
||||
private string _name = string.Empty;
|
||||
private string _type = string.Empty;
|
||||
private EnumPLCDataType _type;
|
||||
private string _value = string.Empty;
|
||||
private bool _startexecute;
|
||||
private bool _endexecute;
|
||||
private int _startindex;
|
||||
private int _endindex;
|
||||
private string _numtype;
|
||||
private string _address;
|
||||
/// <summary>
|
||||
/// 是否选中
|
||||
@ -257,7 +266,7 @@ namespace DH.Commons.Base
|
||||
}
|
||||
}
|
||||
}
|
||||
public string Type
|
||||
public EnumPLCDataType Type
|
||||
{
|
||||
get => _type;
|
||||
set
|
||||
@ -284,18 +293,7 @@ namespace DH.Commons.Base
|
||||
}
|
||||
}
|
||||
}
|
||||
public string NumTpye
|
||||
{
|
||||
get => _numtype;
|
||||
set
|
||||
{
|
||||
if (_numtype != value)
|
||||
{
|
||||
_numtype = value;
|
||||
OnPropertyChanged(nameof(NumTpye));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 参数值
|
||||
/// </summary>
|
||||
@ -313,7 +311,7 @@ namespace DH.Commons.Base
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 流程开启执行状态
|
||||
/// 启用状态
|
||||
/// </summary>
|
||||
public bool StartExecute
|
||||
{
|
||||
@ -327,27 +325,13 @@ namespace DH.Commons.Base
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 流程结束执行状态
|
||||
/// </summary>
|
||||
public bool EndExecute
|
||||
{
|
||||
get => _endexecute;
|
||||
set
|
||||
{
|
||||
if (_endexecute != value)
|
||||
{
|
||||
_endexecute = value;
|
||||
OnPropertyChanged(nameof(EndExecute));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 流程开启顺序
|
||||
/// 顺序
|
||||
/// </summary>
|
||||
public int StartIndex
|
||||
{
|
||||
@ -361,22 +345,7 @@ namespace DH.Commons.Base
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 流程结束顺序
|
||||
/// </summary>
|
||||
public int EndIndex
|
||||
{
|
||||
get => _endindex;
|
||||
set
|
||||
{
|
||||
if (_endindex != value)
|
||||
{
|
||||
_endindex = value;
|
||||
OnPropertyChanged(nameof(EndIndex));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private CellLink[] cellLinks;
|
||||
[JsonIgnore]
|
||||
public CellLink[] CellLinks
|
||||
@ -390,18 +359,18 @@ namespace DH.Commons.Base
|
||||
}
|
||||
}
|
||||
|
||||
private CellTag[] cellTags;
|
||||
[JsonIgnore]
|
||||
public CellTag[] CellTags
|
||||
{
|
||||
get { return cellTags; }
|
||||
set
|
||||
{
|
||||
if (cellTags == value) return;
|
||||
cellTags = value;
|
||||
OnPropertyChanged(nameof(CellTags));
|
||||
}
|
||||
}
|
||||
//private CellTag[] cellTags;
|
||||
//[JsonIgnore]
|
||||
//public CellTag[] CellTags
|
||||
//{
|
||||
// get { return cellTags; }
|
||||
// set
|
||||
// {
|
||||
// if (cellTags == value) return;
|
||||
// cellTags = value;
|
||||
// OnPropertyChanged(nameof(CellTags));
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
|
@ -7,7 +7,13 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace DH.Commons.Enums
|
||||
{
|
||||
|
||||
public enum EnumStatus
|
||||
{
|
||||
未运行,
|
||||
运行中,
|
||||
警告,
|
||||
异常
|
||||
}
|
||||
public enum ModelType
|
||||
{
|
||||
图像分类 = 1,
|
||||
@ -91,10 +97,8 @@ namespace DH.Commons.Enums
|
||||
工位8 ,
|
||||
工位9 ,
|
||||
工位10 ,
|
||||
OK料盒 ,
|
||||
NG料盒,
|
||||
OK吹气时间,
|
||||
NG吹气时间,
|
||||
相机触发时间,
|
||||
吹气时间,
|
||||
产品计数,
|
||||
计数清零,
|
||||
工件最小值,
|
||||
@ -109,6 +113,9 @@ namespace DH.Commons.Enums
|
||||
挡料电机位置,
|
||||
OK脉冲,
|
||||
NG脉冲,
|
||||
状态复位,
|
||||
启用定位,
|
||||
定位完成脉冲值
|
||||
|
||||
|
||||
|
||||
@ -118,18 +125,22 @@ namespace DH.Commons.Enums
|
||||
|
||||
public enum EnumPLCDataType
|
||||
{
|
||||
HD,
|
||||
D,
|
||||
M
|
||||
}
|
||||
public enum EnumPLCINTType
|
||||
{
|
||||
单字16位,
|
||||
单字32位,
|
||||
双字16位,
|
||||
双字32位
|
||||
单字整型,
|
||||
双字整型,
|
||||
浮点型,
|
||||
布尔型
|
||||
}
|
||||
|
||||
public enum EnumBool
|
||||
{
|
||||
关闭,
|
||||
启用
|
||||
}
|
||||
public enum EnumBool1
|
||||
{
|
||||
False,
|
||||
True
|
||||
}
|
||||
public enum StreamFormat
|
||||
{
|
||||
[Description("8位图像")]
|
||||
|
@ -101,7 +101,8 @@ namespace DH.Commons.Helper
|
||||
{
|
||||
ConfigModel.CameraBaseList,
|
||||
ConfigModel.PLCBaseList,
|
||||
ConfigModel.DetectionList
|
||||
ConfigModel.DetectionList,
|
||||
ConfigModel.GlobalList,
|
||||
}, _jsonOptions);
|
||||
|
||||
// 写入新配置
|
||||
@ -157,8 +158,9 @@ namespace DH.Commons.Helper
|
||||
var data = JsonSerializer.Deserialize<ConfigData>(json, _jsonOptions);
|
||||
|
||||
ConfigModel.CameraBaseList = data?.Cameras ?? new List<CameraBase>();
|
||||
ConfigModel.PLCBaseList = data?.PLCs ?? new List<PLCBase>();
|
||||
ConfigModel.DetectionList = data?.Detections ?? new List<DetectionConfig>();
|
||||
ConfigModel.PLCBaseList = data?.PLCs ?? new List<PLCBase>();
|
||||
ConfigModel.GlobalList = data?.GlobalConfigs ?? new List<GlobalConfig>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -261,6 +263,10 @@ namespace DH.Commons.Helper
|
||||
|
||||
[JsonPropertyName("detectionList")]
|
||||
public List<DetectionConfig> Detections { get; set; } = new List<DetectionConfig>();
|
||||
[JsonPropertyName("globalList")]
|
||||
public List<GlobalConfig> GlobalConfigs { get; set; } = new List<GlobalConfig>();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using DH.Commons.Base;
|
||||
using DH.Commons.Enums;
|
||||
|
||||
namespace DH.Commons.Models
|
||||
{
|
||||
@ -14,7 +15,10 @@ namespace DH.Commons.Models
|
||||
/// </summary>
|
||||
public static string CurrentScheme=string.Empty;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 当前状态
|
||||
/// </summary>
|
||||
public static EnumStatus CurrentStatus =EnumStatus.未运行;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -25,5 +29,6 @@ namespace DH.Commons.Models
|
||||
public static List<CameraBase> CameraBaseList = new List<CameraBase>();
|
||||
public static List<PLCBase> PLCBaseList = new List<PLCBase>();
|
||||
public static List<DetectionConfig> DetectionList = new List<DetectionConfig>();
|
||||
public static List<GlobalConfig> GlobalList = new List<GlobalConfig>();
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -14,6 +14,11 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -9,10 +9,32 @@ namespace DHSoftware
|
||||
public LoginWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
// 关键设置:允许窗体优先接收按键事件
|
||||
this.KeyPreview = true;
|
||||
|
||||
// 绑定按键事件
|
||||
this.KeyDown += Login_KeyDown;
|
||||
button_ok.Click += Button_ok_Click;
|
||||
button_cancel.Click += Button_cancel_Click;
|
||||
}
|
||||
|
||||
private void Login_KeyDown(object? sender, KeyEventArgs e)
|
||||
{
|
||||
// 监听回车键
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
{
|
||||
button_ok.PerformClick(); // 触发确定按钮的点击事件
|
||||
e.Handled = true; // 阻止其他控件处理该按键
|
||||
}
|
||||
|
||||
// 监听 ESC 键
|
||||
if (e.KeyCode == Keys.Escape)
|
||||
{
|
||||
button_cancel.PerformClick(); // 触发取消按钮的点击事件
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 窗体对象实例
|
||||
/// </summary>
|
||||
|
160
DHSoftware/MainWindow.Designer.cs
generated
160
DHSoftware/MainWindow.Designer.cs
generated
@ -37,9 +37,12 @@
|
||||
AntdUI.SegmentedItem segmentedItem9 = new AntdUI.SegmentedItem();
|
||||
AntdUI.SegmentedItem segmentedItem10 = new AntdUI.SegmentedItem();
|
||||
titlebar = new AntdUI.PageHeader();
|
||||
tabsStas=new AntdUI.Tabs();
|
||||
tabPage3=new AntdUI.TabPage();
|
||||
lbName = new AntdUI.Label();
|
||||
pageHeader1 = new AntdUI.PageHeader();
|
||||
labuph = new Label();
|
||||
tabMain=new AntdUI.TabPage();
|
||||
divider2 = new AntdUI.Divider();
|
||||
panelmain = new AntdUI.Panel();
|
||||
panel2 = new AntdUI.Panel();
|
||||
@ -58,6 +61,16 @@
|
||||
btnLoadProject = new AntdUI.Button();
|
||||
sltProjects = new AntdUI.Select();
|
||||
segmented1 = new AntdUI.Segmented();
|
||||
panel5 = new Panel();
|
||||
panel7 = new Panel();
|
||||
label2 = new Label();
|
||||
lblNum = new Label();
|
||||
lblUPH = new Label();
|
||||
label4 = new Label();
|
||||
lblstarttime = new Label();
|
||||
label6 = new Label();
|
||||
lblNowtime = new Label();
|
||||
label8 = new Label();
|
||||
titlebar.SuspendLayout();
|
||||
pageHeader1.SuspendLayout();
|
||||
panelmain.SuspendLayout();
|
||||
@ -75,6 +88,8 @@
|
||||
tabsConfig.SuspendLayout();
|
||||
panel1.SuspendLayout();
|
||||
panel3.SuspendLayout();
|
||||
panel5.SuspendLayout();
|
||||
panel7.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// titlebar
|
||||
@ -229,14 +244,43 @@
|
||||
tabImgDisplay.TabIndex = 1;
|
||||
tabImgDisplay.Text = "tabs1";
|
||||
//
|
||||
// tabMain
|
||||
//
|
||||
tabMain.Location = new Point(3, 28);
|
||||
tabMain.Name = "tabMain";
|
||||
tabMain.Size = new Size(574, 289);
|
||||
tabMain.TabIndex = 0;
|
||||
tabMain.Text = "检测";
|
||||
//
|
||||
// tabsStas
|
||||
//
|
||||
tabsStas.Dock = DockStyle.Fill;
|
||||
tabsStas.Location = new Point(0, 0);
|
||||
tabsStas.Name = "tabsStas";
|
||||
tabsStas.Pages.Add(tabPage3);
|
||||
tabsStas.Size = new Size(580, 176);
|
||||
tabsStas.TabIndex = 3;
|
||||
tabsStas.Text = "tabs3";
|
||||
//
|
||||
// tabPage3
|
||||
//
|
||||
tabPage3.Controls.Add(panel7);
|
||||
tabPage3.Controls.Add(panel5);
|
||||
tabPage3.Location = new Point(3, 28);
|
||||
tabPage3.Name = "tabPage3";
|
||||
tabPage3.Size = new Size(574, 145);
|
||||
tabPage3.TabIndex = 0;
|
||||
tabPage3.Text = "日志";
|
||||
//
|
||||
// richTextBox1
|
||||
//
|
||||
richTextBox1.Dock = DockStyle.Fill;
|
||||
richTextBox1.Location = new Point(0, 0);
|
||||
richTextBox1.Name = "richTextBox1";
|
||||
richTextBox1.Size = new Size(606, 176);
|
||||
richTextBox1.Size = new Size(374, 145);
|
||||
richTextBox1.TabIndex = 0;
|
||||
richTextBox1.Text = "";
|
||||
richTextBox1.TextChanged += richTextBox1_TextChanged;
|
||||
//
|
||||
// tabsConfig
|
||||
//
|
||||
@ -401,6 +445,103 @@
|
||||
segmented1.Text = "segmented1";
|
||||
segmented1.SelectIndexChanged += segmented1_SelectIndexChanged;
|
||||
//
|
||||
// panel5
|
||||
//
|
||||
panel5.Controls.Add(lblNowtime);
|
||||
panel5.Controls.Add(label8);
|
||||
panel5.Controls.Add(lblstarttime);
|
||||
panel5.Controls.Add(label6);
|
||||
panel5.Controls.Add(lblUPH);
|
||||
panel5.Controls.Add(label4);
|
||||
panel5.Controls.Add(lblNum);
|
||||
panel5.Controls.Add(label2);
|
||||
panel5.Dock = DockStyle.Right;
|
||||
panel5.Location = new Point(374, 0);
|
||||
panel5.Name = "panel5";
|
||||
panel5.Size = new Size(200, 145);
|
||||
panel5.TabIndex = 1;
|
||||
//
|
||||
// panel7
|
||||
//
|
||||
panel7.Controls.Add(richTextBox1);
|
||||
panel7.Dock = DockStyle.Fill;
|
||||
panel7.Location = new Point(0, 0);
|
||||
panel7.Name = "panel7";
|
||||
panel7.Size = new Size(374, 145);
|
||||
panel7.TabIndex = 2;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(7, 75);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(32, 17);
|
||||
label2.TabIndex = 0;
|
||||
label2.Text = "总数";
|
||||
//
|
||||
// lblNum
|
||||
//
|
||||
lblNum.AutoSize = true;
|
||||
lblNum.Location = new Point(70, 75);
|
||||
lblNum.Name = "lblNum";
|
||||
lblNum.Size = new Size(15, 17);
|
||||
lblNum.TabIndex = 1;
|
||||
lblNum.Text = "0";
|
||||
//
|
||||
// lblUPH
|
||||
//
|
||||
lblUPH.AutoSize = true;
|
||||
lblUPH.Location = new Point(70, 105);
|
||||
lblUPH.Name = "lblUPH";
|
||||
lblUPH.Size = new Size(15, 17);
|
||||
lblUPH.TabIndex = 3;
|
||||
lblUPH.Text = "0";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
label4.AutoSize = true;
|
||||
label4.Location = new Point(7, 105);
|
||||
label4.Name = "label4";
|
||||
label4.Size = new Size(33, 17);
|
||||
label4.TabIndex = 2;
|
||||
label4.Text = "UPH";
|
||||
//
|
||||
// lblstarttime
|
||||
//
|
||||
lblstarttime.AutoSize = true;
|
||||
lblstarttime.Location = new Point(69, 15);
|
||||
lblstarttime.Name = "lblstarttime";
|
||||
lblstarttime.Size = new Size(15, 17);
|
||||
lblstarttime.TabIndex = 5;
|
||||
lblstarttime.Text = "0";
|
||||
//
|
||||
// label6
|
||||
//
|
||||
label6.AutoSize = true;
|
||||
label6.Location = new Point(7, 15);
|
||||
label6.Name = "label6";
|
||||
label6.Size = new Size(56, 17);
|
||||
label6.TabIndex = 4;
|
||||
label6.Text = "开始时间";
|
||||
//
|
||||
// lblNowtime
|
||||
//
|
||||
lblNowtime.AutoSize = true;
|
||||
lblNowtime.Location = new Point(69, 41);
|
||||
lblNowtime.Name = "lblNowtime";
|
||||
lblNowtime.Size = new Size(15, 17);
|
||||
lblNowtime.TabIndex = 7;
|
||||
lblNowtime.Text = "0";
|
||||
//
|
||||
// label8
|
||||
//
|
||||
label8.AutoSize = true;
|
||||
label8.Location = new Point(7, 41);
|
||||
label8.Name = "label8";
|
||||
label8.Size = new Size(56, 17);
|
||||
label8.TabIndex = 6;
|
||||
label8.Text = "此刻时间";
|
||||
//
|
||||
// MainWindow
|
||||
//
|
||||
ClientSize = new Size(1024, 648);
|
||||
@ -434,6 +575,9 @@
|
||||
tabsConfig.ResumeLayout(false);
|
||||
panel1.ResumeLayout(false);
|
||||
panel3.ResumeLayout(false);
|
||||
panel5.ResumeLayout(false);
|
||||
panel5.PerformLayout();
|
||||
panel7.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
@ -461,6 +605,20 @@
|
||||
private AntdUI.Button btnAddProject;
|
||||
private AntdUI.Button btnLoadProject;
|
||||
public AntdUI.Select sltProjects;
|
||||
private Panel panel7;
|
||||
private Panel panel5;
|
||||
private Label lblNum;
|
||||
private Label label2;
|
||||
private Label lblNowtime;
|
||||
private Label label8;
|
||||
private Label lblstarttime;
|
||||
private Label label6;
|
||||
private Label lblUPH;
|
||||
private Label label4;
|
||||
private RichTextBox richTextBox1;
|
||||
private AntdUI.TabPage tabPage3;
|
||||
private AntdUI.TabPage tabMain;
|
||||
private AntdUI.Tabs tabsStas;
|
||||
private Label label1;
|
||||
}
|
||||
}
|
@ -291,7 +291,7 @@ namespace DHSoftware
|
||||
for (int i = 0; i < ConfigModel.PLCBaseList.Count; i++)
|
||||
{
|
||||
var plcBase = ConfigModel.PLCBaseList[i];
|
||||
if (plcBase.PLCType == EnumPLCType.信捷XC网口)
|
||||
if (plcBase.PLCType == EnumPLCType.信捷XC网口 || plcBase.PLCType == EnumPLCType.信捷XD网口)
|
||||
{
|
||||
PLC.IP = plcBase.IP;
|
||||
PLC.PLCType = plcBase.PLCType;
|
||||
@ -512,7 +512,8 @@ namespace DHSoftware
|
||||
{
|
||||
camera.CameraDisConnect();
|
||||
}
|
||||
PLC.PLCDisConnect();
|
||||
if (PLC != null)
|
||||
PLC.PLCDisConnect();
|
||||
CloseWindow.Instance.Close();// 关闭提示窗口
|
||||
//Application.Exit();
|
||||
System.Environment.Exit(0);
|
||||
@ -570,26 +571,25 @@ namespace DHSoftware
|
||||
private List<SimboStationMLEngineSet> SimboStationMLEngineList = new List<SimboStationMLEngineSet>();
|
||||
private Dictionary<string, HDevEngineTool> HalconToolDict = new Dictionary<string, HDevEngineTool>();
|
||||
public List<RecongnitionLabel> RecongnitionLabelList { get; set; } = new List<RecongnitionLabel>();
|
||||
public DateTime startTime;
|
||||
public DateTime ProcessstartTime;
|
||||
|
||||
private void HandleStartButton()
|
||||
{
|
||||
StartProcess();
|
||||
}
|
||||
|
||||
private static int currentRegister = 411; // 初始为 D411
|
||||
|
||||
|
||||
private void StartProcess()
|
||||
{
|
||||
startTime= DateTime.Now;
|
||||
ProcessstartTime= DateTime.Now;
|
||||
lblstarttime.Text = ProcessstartTime.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
//计数清零
|
||||
PieceCount = 0;
|
||||
//吹气点位归置
|
||||
currentRegister = 411;
|
||||
|
||||
|
||||
if (PLC?.Enable == true)
|
||||
{
|
||||
PLC.CountToZero();
|
||||
PLC.OnNewPieces -= MainMotion_NewPieces;
|
||||
PLC.OnNewPieces += MainMotion_NewPieces;
|
||||
}
|
||||
@ -691,395 +691,15 @@ namespace DHSoftware
|
||||
_productLists.Add(products);
|
||||
}
|
||||
|
||||
// 转盘操作
|
||||
// if (_PLC?.IIConfig?.IsEnabled == true)
|
||||
//流程执行时PLC
|
||||
PLC.StartProcess();
|
||||
|
||||
// _PLC.TurntableOpen(XKRSPLCConfig.TurnSpeed, XKRSPLCConfig.TurnDirection);
|
||||
PLCItem itemSpeed = PLC.PLCItemList.FirstOrDefault(u => u.Name == "转盘速度");
|
||||
if (itemSpeed != null)
|
||||
{
|
||||
PLC.TurntableOpen();
|
||||
}
|
||||
|
||||
Thread.Sleep(500);
|
||||
|
||||
//振动盘
|
||||
//if (XKRSPLCConfig.IsEnableVibratory)
|
||||
//{
|
||||
// if (_PLC.IIConfig.IsEnabled)
|
||||
// _PLC.Vibratory(true);
|
||||
//}
|
||||
|
||||
//InitialOEEStatistic();
|
||||
|
||||
// MachineState = MachineState.Running;
|
||||
|
||||
}
|
||||
|
||||
private void PrepareMLEngine()
|
||||
{
|
||||
//if (_visionEngine == null)
|
||||
//{
|
||||
// _visionEngine = DeviceCollection.FirstOrDefault(u => u is VisionEngineBase) as VisionEngineBase;
|
||||
//}
|
||||
|
||||
//if (_visionEngine == null)
|
||||
//{
|
||||
// throw new ProcessException($"未能获取检测设备");
|
||||
//}
|
||||
|
||||
//相机模组
|
||||
//_cameraRelatedDetectionDict = new();
|
||||
|
||||
//detectionList.ForEach(detection =>
|
||||
//{
|
||||
// detection.CameraCollects.ForEach(cam =>
|
||||
// {
|
||||
// List<string> Dets = new List<string>
|
||||
// {
|
||||
// detection.Id
|
||||
// };
|
||||
// if (!_cameraRelatedDetectionDict.ContainsKey(cam.CameraSourceId))
|
||||
// {
|
||||
// _cameraRelatedDetectionDict.Add(cam.CameraSourceId, Dets);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// _cameraRelatedDetectionDict[cam.CameraSourceId].Add(detection.Id);
|
||||
// }
|
||||
|
||||
// });
|
||||
//});
|
||||
|
||||
//_visionEngine.OnDetectionWarningStop += VisionEngine_OnDetectionWarningStopAsync;
|
||||
}
|
||||
|
||||
#if false
|
||||
private void HandleStartButton2()
|
||||
{
|
||||
CurrentMachine = true;
|
||||
|
||||
//_visionEngine.Start();
|
||||
//[Category("深度学习检测配置")]
|
||||
//[DisplayName("检测标签定义集合")]
|
||||
//[Description("定义检测标签的集合,例如:Seg/Detection模式:断裂、油污、划伤...;Class模式:ok、ng、上面、下面、套环、正常...")]
|
||||
//[TypeConverter(typeof(CollectionCountConvert))]
|
||||
//[Editor(typeof(ComplexCollectionEditor<RecongnitionLabel>), typeof(UITypeEditor))]
|
||||
RecongnitionLabel recongnition = new RecongnitionLabel
|
||||
{
|
||||
LabelName = "youwu",
|
||||
LabelDescription = "油污",
|
||||
LabelCategory = "A_NG"
|
||||
};
|
||||
RecongnitionLabel recongnition2 = new RecongnitionLabel
|
||||
{
|
||||
LabelName = "youwu",
|
||||
LabelDescription = "油污",
|
||||
LabelCategory = "A_NG"
|
||||
};
|
||||
RecongnitionLabel recongnition3 = new RecongnitionLabel
|
||||
{
|
||||
LabelName = "youwu",
|
||||
LabelDescription = "油污",
|
||||
LabelCategory = "A_NG"
|
||||
};
|
||||
RecongnitionLabelList.Add(recongnition);
|
||||
RecongnitionLabelList.Add(recongnition2);
|
||||
RecongnitionLabelList.Add(recongnition3);
|
||||
|
||||
var det1 = new DetectionConfig("相机1", ModelType.目标检测, @"D:\PROJECTS\X015\Vision\Cam1.onnx", false, "Cam1");
|
||||
var det2 = new DetectionConfig("相机2", ModelType.目标检测, @"D:\PROJECTS\X015\Vision\Cam2.onnx", false, "Cam2");
|
||||
var det3 = new DetectionConfig("相机3", ModelType.目标检测, @"D:\PROJECTS\X015\Vision\Cam3.onnx", false, "Cam3");
|
||||
var det4 = new DetectionConfig("相机4", ModelType.目标检测, @"D:\PROJECTS\X015\Vision\Cam4.onnx", false, "Cam4");
|
||||
var det5 = new DetectionConfig("相机5", ModelType.目标检测, @"D:\PROJECTS\X015\Vision\Cam5.onnx", false, "Cam5");
|
||||
var det6 = new DetectionConfig("相机6", ModelType.目标检测, @"D:\PROJECTS\X015\Vision\Cam6.onnx", false, "Cam6");
|
||||
var det7 = new DetectionConfig("相机7", ModelType.目标检测, @"D:\PROJECTS\X015\Vision\Cam7.onnx", false, "Cam7");
|
||||
var det8 = new DetectionConfig("相机8", ModelType.目标检测, @"D:\PROJECTS\X015\Vision\Cam8.onnx", false, "Cam8");
|
||||
List<RelatedCamera> CameraCollects = new List<RelatedCamera>();
|
||||
CameraCollects.Add(new RelatedCamera("Cam1"));
|
||||
List<RelatedCamera> CameraCollects2 = new List<RelatedCamera>();
|
||||
CameraCollects2.Add(new RelatedCamera("Cam2"));
|
||||
List<RelatedCamera> CameraCollects3 = new List<RelatedCamera>();
|
||||
CameraCollects3.Add(new RelatedCamera("Cam3"));
|
||||
List<RelatedCamera> CameraCollects4 = new List<RelatedCamera>();
|
||||
CameraCollects4.Add(new RelatedCamera("Cam4"));
|
||||
List<RelatedCamera> CameraCollects5 = new List<RelatedCamera>();
|
||||
CameraCollects5.Add(new RelatedCamera("Cam5"));
|
||||
List<RelatedCamera> CameraCollects6 = new List<RelatedCamera>();
|
||||
CameraCollects6.Add(new RelatedCamera("Cam6"));
|
||||
List<RelatedCamera> CameraCollects7 = new List<RelatedCamera>();
|
||||
CameraCollects7.Add(new RelatedCamera("Cam7"));
|
||||
List<RelatedCamera> CameraCollects8 = new List<RelatedCamera>();
|
||||
CameraCollects8.Add(new RelatedCamera("Cam8"));
|
||||
|
||||
float Conf = 0.5f;
|
||||
|
||||
det1.CameraCollects = CameraCollects;
|
||||
det1.ModelconfThreshold = Conf;
|
||||
det1.ModelWidth = 640;
|
||||
det1.ModelHeight = 640;
|
||||
det1.In_lable_path = "D:\\PROJECTS\\X015\\Vision\\Cam1.txt";
|
||||
det1.IsEnabled = true;
|
||||
det1.ShowLocation.X = 1;
|
||||
det1.ShowLocation.Y = 1;
|
||||
|
||||
det2.CameraCollects = CameraCollects2;
|
||||
det2.ModelconfThreshold = Conf;
|
||||
det2.ModelWidth = 640;
|
||||
det2.ModelHeight = 640;
|
||||
det2.In_lable_path = "D:\\PROJECTS\\X015\\Vision\\Cam2.txt";
|
||||
det2.IsEnabled = true;
|
||||
det2.ShowLocation.X = 2;
|
||||
det2.ShowLocation.Y = 1;
|
||||
|
||||
det3.CameraCollects = CameraCollects3;
|
||||
det3.ModelconfThreshold = Conf;
|
||||
det3.ModelWidth = 640;
|
||||
det3.ModelHeight = 640;
|
||||
det3.In_lable_path = "D:\\PROJECTS\\X015\\Vision\\Cam3.txt";
|
||||
det3.IsEnabled = true;
|
||||
det3.ShowLocation.X = 3;
|
||||
det3.ShowLocation.Y = 1;
|
||||
|
||||
det4.CameraCollects = CameraCollects4;
|
||||
det4.ModelconfThreshold = Conf;
|
||||
det4.ModelWidth = 640;
|
||||
det4.ModelHeight = 640;
|
||||
det4.In_lable_path = "D:\\PROJECTS\\X015\\Vision\\Cam4.txt";
|
||||
det4.IsEnabled = true;
|
||||
det4.ShowLocation.X = 4;
|
||||
det4.ShowLocation.Y = 1;
|
||||
|
||||
det5.CameraCollects = CameraCollects5;
|
||||
det5.ModelconfThreshold = Conf;
|
||||
det5.ModelWidth = 640;
|
||||
det5.ModelHeight = 640;
|
||||
det5.In_lable_path = "D:\\PROJECTS\\X015\\Vision\\Cam5.txt";
|
||||
det5.IsEnabled = true;
|
||||
det5.ShowLocation.X = 1;
|
||||
det5.ShowLocation.Y = 2;
|
||||
|
||||
det6.CameraCollects = CameraCollects6;
|
||||
det6.ModelconfThreshold = Conf;
|
||||
det6.ModelWidth = 640;
|
||||
det6.ModelHeight = 640;
|
||||
det6.In_lable_path = "D:\\PROJECTS\\X015\\Vision\\Cam6.txt";
|
||||
det6.IsEnabled = true;
|
||||
det6.ShowLocation.X = 2;
|
||||
det6.ShowLocation.Y = 2;
|
||||
|
||||
det7.CameraCollects = CameraCollects7;
|
||||
det7.ModelconfThreshold = Conf;
|
||||
det7.ModelWidth = 640;
|
||||
det7.ModelHeight = 640;
|
||||
det7.In_lable_path = "D:\\PROJECTS\\X015\\Vision\\Cam7.txt";
|
||||
det7.IsEnabled = true;
|
||||
det7.ShowLocation.X = 3;
|
||||
det7.ShowLocation.Y = 2;
|
||||
|
||||
det8.CameraCollects = CameraCollects8;
|
||||
det8.ModelconfThreshold = Conf;
|
||||
det8.ModelWidth = 640;
|
||||
det8.ModelHeight = 640;
|
||||
det8.In_lable_path = "D:\\PROJECTS\\X015\\Vision\\Cam8.txt";
|
||||
det8.IsEnabled = true;
|
||||
det8.ShowLocation.X = 4;
|
||||
det8.ShowLocation.Y = 2;
|
||||
|
||||
DetectionConfigs.Add(det1);
|
||||
DetectionConfigs.Add(det2);
|
||||
DetectionConfigs.Add(det3);
|
||||
DetectionConfigs.Add(det4);
|
||||
DetectionConfigs.Add(det5);
|
||||
DetectionConfigs.Add(det6);
|
||||
DetectionConfigs.Add(det7);
|
||||
DetectionConfigs.Add(det8);
|
||||
|
||||
Cameras.Clear();
|
||||
HKCameras.Clear();
|
||||
Dectection.Clear();
|
||||
_cameraRelatedDetectionDict = new();
|
||||
|
||||
#if false
|
||||
for (int i = 1; i <= 8; i++)
|
||||
{
|
||||
HikVisionCamera camera = new HikVisionCamera();
|
||||
camera.CameraName = $"Cam{i}";
|
||||
camera.CameraIP = $"192.168.{i}.1";
|
||||
camera.ComputerIP = $"192.168.{i}.1";
|
||||
camera.CameraConnect();
|
||||
camera.OnHImageOutput += OnCameraHImageOutput;
|
||||
HKCameras.Add(camera);
|
||||
}
|
||||
#else
|
||||
//Do3ThinkCamera do3ThinkCamera1 = new Do3ThinkCamera();
|
||||
|
||||
//do3ThinkCamera1.dvpStreamFormat = dvpStreamFormat.S_RAW8;
|
||||
//do3ThinkCamera1.CameraName = "Cam1";
|
||||
//do3ThinkCamera1.CameraConnect();
|
||||
//do3ThinkCamera1.OnHImageOutput += OnCameraHImageOutput;
|
||||
// Cameras.Add(do3ThinkCamera1);
|
||||
for (int i = 1; i <= 8; i++)
|
||||
{
|
||||
Do3ThinkCamera cam = new Do3ThinkCamera();
|
||||
if (i == 1)
|
||||
{
|
||||
cam.dvpStreamFormat = dvpStreamFormat.S_RAW8;
|
||||
}
|
||||
else
|
||||
{
|
||||
cam.dvpStreamFormat = dvpStreamFormat.S_RGB24;
|
||||
}
|
||||
|
||||
cam.CameraName = $"Cam{i}";
|
||||
Cameras.Add(cam);
|
||||
cam.CameraConnect();
|
||||
cam.OnHImageOutput += OnCameraHImageOutput;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
DetectionConfigs.ForEach(detection =>
|
||||
{
|
||||
detection.CameraCollects.ForEach(cam =>
|
||||
{
|
||||
List<string> Dets = new List<string>
|
||||
{
|
||||
detection.Id
|
||||
};
|
||||
if (!_cameraRelatedDetectionDict.ContainsKey(cam.CameraSourceId))
|
||||
{
|
||||
_cameraRelatedDetectionDict.Add(cam.CameraSourceId, Dets);
|
||||
}
|
||||
else
|
||||
{
|
||||
_cameraRelatedDetectionDict[cam.CameraSourceId].Add(detection.Id);
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
string inferenceDevice = "CPU";
|
||||
|
||||
_visionEngine = new SimboVisionDriver();
|
||||
_visionEngine.DetectionConfigs = DetectionConfigs;
|
||||
|
||||
_visionEngine.Init();
|
||||
CtrlVisionRunBase ctrlVisionRun = new CtrlVisionRunBase(_visionEngine);
|
||||
tabImgDisplay.Controls.Add(ctrlVisionRun);
|
||||
|
||||
//Add the code for the "启动" button click here
|
||||
|
||||
////初始化Halcon工具
|
||||
//InitialHalconTools();
|
||||
|
||||
////深度学习模型加载
|
||||
//bool resultOK = InitialSimboMLEnginesAsync();
|
||||
//if (resultOK)
|
||||
//{
|
||||
// //初始化失败
|
||||
// // return;
|
||||
//}
|
||||
//位置比较卡
|
||||
|
||||
sLDMotion.AxisSettings = new List<AxisSetting>();
|
||||
AxisSetting axis1 = new AxisSetting();
|
||||
axis1.AxisIndex = 0;
|
||||
axis1.AxisName = "转盘1";
|
||||
axis1.IsAxisEnabled = true;
|
||||
//axis1.AlarmLogic = AxisDirection.Positive;
|
||||
sLDMotion.IODefinitionCollection = new List<IODefinition>();
|
||||
Motion(sLDMotion.IODefinitionCollection);
|
||||
|
||||
sLDMotion.SnapshotSettings = new List<SnapshotSetting>();
|
||||
int[] cameraPositions = { 24161, 33608, 39702, 45701 };
|
||||
|
||||
sLDMotion.SnapshotSettings.Add(new SnapshotSetting
|
||||
{
|
||||
IsEnabled = true,
|
||||
CameraIO = sLDMotion.IODefinitionCollection.FirstOrDefault(t => t.IOType == IOType.OUTPUT && t.IOIndex == 13),
|
||||
CameraPosition = 7613,
|
||||
StationNumber = 0
|
||||
});
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
sLDMotion.SnapshotSettings.Add(new SnapshotSetting
|
||||
{
|
||||
IsEnabled = true,
|
||||
CameraIO = sLDMotion.IODefinitionCollection.FirstOrDefault(t => t.IOType == IOType.OUTPUT && t.IOIndex == i),
|
||||
CameraPosition = cameraPositions[i],
|
||||
StationNumber = 0
|
||||
});
|
||||
}
|
||||
|
||||
sLDMotion.BlowSettings = new List<BlowSetting>();
|
||||
int[] BlowPositions = { 61353, 68566 };
|
||||
sLDMotion.BlowSettings.Add(new BlowSetting
|
||||
{
|
||||
IsEnabled = true,
|
||||
BlowIO = sLDMotion.IODefinitionCollection.FirstOrDefault(t => t.IOType == IOType.OUTPUT && t.IOIndex == 5),
|
||||
BlowPosition = BlowPositions[0],
|
||||
StationNumber = 0
|
||||
});
|
||||
sLDMotion.BlowSettings.Add(new BlowSetting
|
||||
{
|
||||
IsEnabled = true,
|
||||
BlowIO = sLDMotion.IODefinitionCollection.FirstOrDefault(t => t.IOType == IOType.OUTPUT && t.IOIndex == 6),
|
||||
BlowPosition = BlowPositions[1],
|
||||
StationNumber = 0
|
||||
});
|
||||
|
||||
//SnapshotSetting sna1 = new SnapshotSetting();
|
||||
//sna1.IsEnabled = true;
|
||||
//sna1.CameraIO= sLDMotion.IODefinitionCollection.FirstOrDefault(t => t.IOType == IOType.OUTPUT && t.IOIndex == 0);
|
||||
//sna1.CameraPosition = 17000;
|
||||
//sna1.StationNumber = 0;
|
||||
|
||||
// sLDMotion.SnapshotSettings.Add(sna1);
|
||||
sLDMotion.AxisSettings.Add(axis1);
|
||||
sLDMotion.Init();
|
||||
sLDMotion.OnNewPieces -= MainMotion_NewPieces;
|
||||
sLDMotion.OnNewPieces += MainMotion_NewPieces;
|
||||
// sLDMotion.Start();
|
||||
|
||||
//PLC.IP = "192.168.6.6";
|
||||
//PLC.Port = 502;
|
||||
//PLC.PLCConnect();
|
||||
//PLC.OnNewPieces -= MainMotion_NewPieces;
|
||||
//PLC.OnNewPieces += MainMotion_NewPieces;
|
||||
ProductBaseCount = 8;
|
||||
for (int i = 0; i < ProductBaseCount * ProductListMulti; i++)
|
||||
{
|
||||
ConcurrentDictionary<uint, ProductData> products = new ConcurrentDictionary<uint, ProductData>();
|
||||
_productLists.Add(products);
|
||||
}
|
||||
sLDMotion.AxisStop();
|
||||
bool e = sLDMotion.CArdReset();
|
||||
//转盘速度
|
||||
sLDMotion.JOGRun(14000, 100000);
|
||||
startTime = DateTime.Now;
|
||||
}
|
||||
public void Motion(List<IODefinition> iODefinitions)
|
||||
{
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
iODefinitions.Add(new IODefinition
|
||||
{
|
||||
IOType = IOType.INPUT,
|
||||
IOIndex = i,
|
||||
IODesc = $"入料传感器{i + 1}"
|
||||
});
|
||||
}
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
iODefinitions.Add(new IODefinition
|
||||
{
|
||||
IOType = IOType.OUTPUT,
|
||||
IOIndex = i,
|
||||
IODesc = $"入料传感器{i + 1}"
|
||||
});
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
private uint PieceCount = 0;
|
||||
private List<ConcurrentDictionary<uint, ProductData>> _productLists = new List<ConcurrentDictionary<uint, ProductData>>();
|
||||
private int ProductListMulti = 2;
|
||||
@ -1282,6 +902,14 @@ namespace DHSoftware
|
||||
product.ProductResult = product.ResultCollection.Any(u => u.ResultState != ResultState.OK)
|
||||
? ResultState.B_NG
|
||||
: ResultState.OK;
|
||||
if (product.ProductResult == ResultState.OK)
|
||||
{
|
||||
PLC.Blowing(productNumber, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
PLC.Blowing(productNumber, 2);
|
||||
}
|
||||
product.ProductLabelCategory = product.ProductResult.GetEnumDescription();
|
||||
product.ProductLabel = product.ProductResult.GetEnumDescription();
|
||||
|
||||
@ -1382,21 +1010,25 @@ namespace DHSoftware
|
||||
Cameras.Clear();
|
||||
Dectection.Clear();
|
||||
// Add the code for the "停止" button click here
|
||||
PLC.TurntableStop();
|
||||
PLC.TurnStart(false);
|
||||
CurrentMachine = true;
|
||||
sLDMotion.Stop();
|
||||
//sLDMotion.Stop();
|
||||
}
|
||||
|
||||
public int UPH = 0;
|
||||
|
||||
public void CalculateOEE()
|
||||
{
|
||||
TimeSpan timeSpan = DateTime.Now - startTime;
|
||||
TimeSpan timeSpan = DateTime.Now - ProcessstartTime;
|
||||
|
||||
UPH = (int)(ProductNum_Total / timeSpan.TotalHours) + 100;
|
||||
//UPM = (int)UPH / 60;
|
||||
this.BeginInvoke(new MethodInvoker(delegate ()
|
||||
{
|
||||
lblNowtime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
label1.Text = UPH.ToString();
|
||||
lblUPH.Text = UPH.ToString();
|
||||
lblNum.Text = ProductNum_Total.ToString();
|
||||
labuph.Text = UPH.ToString();
|
||||
}));
|
||||
}
|
||||
@ -1424,5 +1056,10 @@ namespace DHSoftware
|
||||
private void splitter1_SplitterMoved(object sender, SplitterEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
private void richTextBox1_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
@ -48,7 +48,7 @@
|
||||
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
|
||||
|
@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using AntdUI;
|
||||
using DH.Commons.Enums;
|
||||
using DH.Commons.Helper;
|
||||
using DH.Commons.Models;
|
||||
using DHSoftware.Utils;
|
||||
@ -36,15 +38,56 @@ namespace DHSoftware
|
||||
WelcomeWindow.Instance.Show();
|
||||
UpdateStep(0, "正在初始化", true);
|
||||
UpdateStep(10, "正在加载数据库", true);
|
||||
DatabaseUtil.InitializeDatabase();
|
||||
try
|
||||
{
|
||||
DatabaseUtil.InitializeDatabase();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SystemModel.CurrentStatus = EnumStatus.异常;
|
||||
Modal.open(WelcomeWindow.Instance, "错误!", ex.ToString(), TType.Error);
|
||||
}
|
||||
|
||||
UpdateStep(30, "正在加载解决方案", true);
|
||||
MainWindow.Instance.LoadScheme();
|
||||
try
|
||||
{
|
||||
MainWindow.Instance.LoadScheme();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SystemModel.CurrentStatus = EnumStatus.异常;
|
||||
Modal.open(WelcomeWindow.Instance, "错误!", ex.ToString(), TType.Error);
|
||||
}
|
||||
UpdateStep(50, "正在连接相机", true);
|
||||
MainWindow.Instance.ConnectCamera();
|
||||
try
|
||||
{
|
||||
MainWindow.Instance.ConnectCamera();
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
SystemModel.CurrentStatus = EnumStatus.异常;
|
||||
Modal.open(WelcomeWindow.Instance, "错误!", ex.ToString(), TType.Error);
|
||||
}
|
||||
UpdateStep(70, "正在连接PLC", true);
|
||||
MainWindow.Instance.ConnectPLC();
|
||||
try
|
||||
{
|
||||
MainWindow.Instance.ConnectPLC();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SystemModel.CurrentStatus = EnumStatus.异常;
|
||||
Modal.open(WelcomeWindow.Instance, "错误!", ex.ToString(), TType.Error);
|
||||
}
|
||||
UpdateStep(80, "正在加载算法模型", true);
|
||||
MainWindow.Instance.InitModel();
|
||||
try
|
||||
{
|
||||
MainWindow.Instance.InitModel();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SystemModel.CurrentStatus = EnumStatus.异常;
|
||||
Modal.open(WelcomeWindow.Instance, "错误!", ex.ToString(), TType.Error);
|
||||
}
|
||||
UpdateStep(100, "程序初始化完成", true);
|
||||
Thread.Sleep(100);
|
||||
WelcomeWindow.Instance.Close();
|
||||
|
162
DHSoftware/Views/AddGlobalControl.Designer.cs
generated
Normal file
162
DHSoftware/Views/AddGlobalControl.Designer.cs
generated
Normal file
@ -0,0 +1,162 @@
|
||||
namespace DHSoftware.Views
|
||||
{
|
||||
partial class AddGlobalControl
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
panel1 = new AntdUI.Panel();
|
||||
input_name = new AntdUI.Input();
|
||||
label3 = new AntdUI.Label();
|
||||
divider1 = new AntdUI.Divider();
|
||||
stackPanel1 = new AntdUI.StackPanel();
|
||||
button_cancel = new AntdUI.Button();
|
||||
button_ok = new AntdUI.Button();
|
||||
divider2 = new AntdUI.Divider();
|
||||
lbTitleName = new AntdUI.Label();
|
||||
panel1.SuspendLayout();
|
||||
stackPanel1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(input_name);
|
||||
panel1.Controls.Add(label3);
|
||||
panel1.Controls.Add(divider1);
|
||||
panel1.Controls.Add(stackPanel1);
|
||||
panel1.Controls.Add(divider2);
|
||||
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(500, 192);
|
||||
panel1.TabIndex = 0;
|
||||
panel1.Text = "panel1";
|
||||
//
|
||||
// input_name
|
||||
//
|
||||
input_name.Dock = DockStyle.Top;
|
||||
input_name.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
input_name.Location = new Point(18, 134);
|
||||
input_name.Name = "input_name";
|
||||
input_name.Radius = 3;
|
||||
input_name.Size = new Size(464, 38);
|
||||
input_name.TabIndex = 22;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.Dock = DockStyle.Top;
|
||||
label3.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
label3.Location = new Point(18, 110);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(464, 24);
|
||||
label3.TabIndex = 21;
|
||||
label3.Text = "全局配置名称";
|
||||
//
|
||||
// divider1
|
||||
//
|
||||
divider1.Dock = DockStyle.Top;
|
||||
divider1.Location = new Point(18, 98);
|
||||
divider1.Name = "divider1";
|
||||
divider1.Size = new Size(464, 12);
|
||||
divider1.TabIndex = 20;
|
||||
//
|
||||
// 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(464, 44);
|
||||
stackPanel1.TabIndex = 19;
|
||||
stackPanel1.Text = "stackPanel1";
|
||||
//
|
||||
// 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 = "取消";
|
||||
//
|
||||
// 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;
|
||||
//
|
||||
// divider2
|
||||
//
|
||||
divider2.Dock = DockStyle.Top;
|
||||
divider2.Location = new Point(18, 42);
|
||||
divider2.Name = "divider2";
|
||||
divider2.Size = new Size(464, 12);
|
||||
divider2.TabIndex = 18;
|
||||
//
|
||||
// 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(464, 24);
|
||||
lbTitleName.TabIndex = 17;
|
||||
lbTitleName.Text = "新增全局配置操作";
|
||||
//
|
||||
// AddGlobalControl
|
||||
//
|
||||
Controls.Add(panel1);
|
||||
Name = "AddGlobalControl";
|
||||
Size = new Size(500, 192);
|
||||
panel1.ResumeLayout(false);
|
||||
stackPanel1.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private AntdUI.Panel panel1;
|
||||
private AntdUI.Label lbTitleName;
|
||||
private AntdUI.Input input_name;
|
||||
private AntdUI.Label label3;
|
||||
private AntdUI.Divider divider1;
|
||||
private AntdUI.StackPanel stackPanel1;
|
||||
private AntdUI.Button button_cancel;
|
||||
private AntdUI.Button button_ok;
|
||||
private AntdUI.Divider divider2;
|
||||
}
|
||||
}
|
48
DHSoftware/Views/AddGlobalControl.cs
Normal file
48
DHSoftware/Views/AddGlobalControl.cs
Normal file
@ -0,0 +1,48 @@
|
||||
|
||||
|
||||
namespace DHSoftware.Views
|
||||
{
|
||||
public partial class AddGlobalControl : UserControl
|
||||
{
|
||||
private AntdUI.Window window;
|
||||
public bool submit;
|
||||
public string GlobalName;
|
||||
public AddGlobalControl(AntdUI.Window _window,string TitleName)
|
||||
{
|
||||
this.window = _window;
|
||||
InitializeComponent();
|
||||
lbTitleName.Text = TitleName;
|
||||
// 绑定事件
|
||||
BindEventHandler();
|
||||
}
|
||||
|
||||
private void BindEventHandler()
|
||||
{
|
||||
button_ok.Click += Button_ok_Click;
|
||||
button_cancel.Click += Button_cancel_Click;
|
||||
}
|
||||
|
||||
private void Button_cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
submit = false;
|
||||
this.Dispose();
|
||||
}
|
||||
|
||||
private void Button_ok_Click(object sender, EventArgs e)
|
||||
{
|
||||
input_name.Status = AntdUI.TType.None;
|
||||
//检查输入内容
|
||||
if (String.IsNullOrEmpty(input_name.Text))
|
||||
{
|
||||
input_name.Status = AntdUI.TType.Error;
|
||||
AntdUI.Message.warn(window, "全局配置名称名称不能为空!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
GlobalName = input_name.Text;
|
||||
submit = true;
|
||||
this.Dispose();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
120
DHSoftware/Views/AddGlobalControl.resx
Normal file
120
DHSoftware/Views/AddGlobalControl.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>
|
425
DHSoftware/Views/GlobalControl.Designer.cs
generated
Normal file
425
DHSoftware/Views/GlobalControl.Designer.cs
generated
Normal file
@ -0,0 +1,425 @@
|
||||
namespace DHSoftware.Views
|
||||
{
|
||||
partial class GlobalControl
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
AntdUI.Tabs.StyleLine styleLine1 = new AntdUI.Tabs.StyleLine();
|
||||
tabs1 = new AntdUI.Tabs();
|
||||
tabPage6 = new AntdUI.TabPage();
|
||||
tabPage1 = new AntdUI.TabPage();
|
||||
TableInitProcess = new AntdUI.Table();
|
||||
panel1 = new AntdUI.Panel();
|
||||
btnAdd = new AntdUI.Button();
|
||||
btnDelete = 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();
|
||||
tabs1.SuspendLayout();
|
||||
tabPage1.SuspendLayout();
|
||||
panel1.SuspendLayout();
|
||||
tabPage2.SuspendLayout();
|
||||
panel2.SuspendLayout();
|
||||
tabPage3.SuspendLayout();
|
||||
panel3.SuspendLayout();
|
||||
tabPage4.SuspendLayout();
|
||||
panel4.SuspendLayout();
|
||||
tabPage5.SuspendLayout();
|
||||
panel5.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// tabs1
|
||||
//
|
||||
tabs1.Dock = DockStyle.Fill;
|
||||
tabs1.Location = new Point(0, 0);
|
||||
tabs1.Name = "tabs1";
|
||||
tabs1.Pages.Add(tabPage6);
|
||||
tabs1.Pages.Add(tabPage1);
|
||||
tabs1.Pages.Add(tabPage2);
|
||||
tabs1.Pages.Add(tabPage3);
|
||||
tabs1.Pages.Add(tabPage4);
|
||||
tabs1.Pages.Add(tabPage5);
|
||||
tabs1.Size = new Size(898, 530);
|
||||
tabs1.Style = styleLine1;
|
||||
tabs1.TabIndex = 26;
|
||||
tabs1.Text = "tabs1";
|
||||
tabs1.SelectedIndex = 1;
|
||||
//
|
||||
// tabPage6
|
||||
//
|
||||
tabPage6.Location = new Point(3, 28);
|
||||
tabPage6.Name = "tabPage6";
|
||||
tabPage6.Size = new Size(892, 499);
|
||||
tabPage6.TabIndex = 5;
|
||||
tabPage6.Text = "全局配置";
|
||||
//
|
||||
// tabPage1
|
||||
//
|
||||
tabPage1.Controls.Add(TableInitProcess);
|
||||
tabPage1.Controls.Add(panel1);
|
||||
tabPage1.Location = new Point(-892, -499);
|
||||
tabPage1.Name = "tabPage1";
|
||||
tabPage1.Size = new Size(892, 499);
|
||||
tabPage1.TabIndex = 0;
|
||||
tabPage1.Text = "流程加载操作";
|
||||
//
|
||||
// TableInitProcess
|
||||
//
|
||||
TableInitProcess.Dock = DockStyle.Fill;
|
||||
TableInitProcess.EmptyHeader = true;
|
||||
TableInitProcess.Location = new Point(0, 45);
|
||||
TableInitProcess.Name = "TableInitProcess";
|
||||
TableInitProcess.Padding = new Padding(5);
|
||||
TableInitProcess.Size = new Size(892, 454);
|
||||
TableInitProcess.TabIndex = 36;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Back = Color.Transparent;
|
||||
panel1.BackColor = SystemColors.Window;
|
||||
panel1.Controls.Add(btnAdd);
|
||||
panel1.Controls.Add(btnDelete);
|
||||
panel1.Dock = DockStyle.Top;
|
||||
panel1.Location = new Point(0, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(892, 45);
|
||||
panel1.TabIndex = 35;
|
||||
//
|
||||
// btnAdd
|
||||
//
|
||||
btnAdd.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
btnAdd.Location = new Point(13, 10);
|
||||
btnAdd.Name = "btnAdd";
|
||||
btnAdd.Size = new Size(82, 32);
|
||||
btnAdd.TabIndex = 35;
|
||||
btnAdd.Text = "新增";
|
||||
btnAdd.Type = AntdUI.TTypeMini.Primary;
|
||||
btnAdd.WaveSize = 0;
|
||||
//
|
||||
// btnDelete
|
||||
//
|
||||
btnDelete.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
btnDelete.Location = new Point(110, 10);
|
||||
btnDelete.Name = "btnDelete";
|
||||
btnDelete.Size = new Size(74, 32);
|
||||
btnDelete.TabIndex = 36;
|
||||
btnDelete.Text = "删除";
|
||||
btnDelete.Type = AntdUI.TTypeMini.Error;
|
||||
btnDelete.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;
|
||||
//
|
||||
// GlobalControl
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 17F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
Controls.Add(tabs1);
|
||||
Name = "GlobalControl";
|
||||
Size = new Size(898, 530);
|
||||
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);
|
||||
}
|
||||
|
||||
#endregion
|
||||
private AntdUI.Tabs tabs1;
|
||||
private AntdUI.TabPage tabPage2;
|
||||
private AntdUI.TabPage tabPage3;
|
||||
private AntdUI.TabPage tabPage4;
|
||||
private AntdUI.TabPage tabPage5;
|
||||
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;
|
||||
private AntdUI.TabPage tabPage1;
|
||||
private AntdUI.Table TableInitProcess;
|
||||
private AntdUI.Panel panel1;
|
||||
private AntdUI.Button btnAdd;
|
||||
private AntdUI.Button btnDelete;
|
||||
private AntdUI.TabPage tabPage6;
|
||||
}
|
||||
}
|
819
DHSoftware/Views/GlobalControl.cs
Normal file
819
DHSoftware/Views/GlobalControl.cs
Normal file
@ -0,0 +1,819 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO.Ports;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using AntdUI;
|
||||
using DH.Commons.Base;
|
||||
using DH.Commons.Enums;
|
||||
using DH.Commons.Models;
|
||||
using XKRS.CanFly;
|
||||
|
||||
namespace DHSoftware.Views
|
||||
{
|
||||
public partial class GlobalControl : UserControl
|
||||
{
|
||||
private Window window;
|
||||
private GlobalConfig global;
|
||||
public GlobalControl(Window _window, GlobalConfig _global)
|
||||
{
|
||||
window = _window;
|
||||
global = _global;
|
||||
InitializeComponent();
|
||||
BindEventHandler();
|
||||
InitData();
|
||||
|
||||
}
|
||||
|
||||
private void BindEventHandler()
|
||||
{
|
||||
|
||||
btnAdd.Click += BtnAdd_Click;
|
||||
btnDelete.Click += BtnDelete_Click;
|
||||
TableInitProcess.CellButtonClick += ItemsTable_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 Item)
|
||||
{
|
||||
switch (buttontext)
|
||||
{
|
||||
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
|
||||
case "编辑":
|
||||
var form = new MotionProcessEdit(window, "复位结束表操作-编辑", Item, ConfigModel.PLCBaseList?.FirstOrDefault()?.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)
|
||||
{
|
||||
global.StopResetList.Remove(Item);
|
||||
}
|
||||
break;
|
||||
|
||||
case "上移":
|
||||
if (e.RowIndex <= 1)
|
||||
{
|
||||
AntdUI.Message.warn(window, "已是第一条,无法上移!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
MoveItemUp(global.StopResetList, Item);
|
||||
break;
|
||||
|
||||
case "下移":
|
||||
if (e.RowIndex > global.StopResetList.Count - 1)
|
||||
{
|
||||
AntdUI.Message.warn(window, "已是最后一条,无法下移!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
MoveItemDown(global.StopResetList, Item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnStopResetDelete_Click(object? sender, EventArgs e)
|
||||
{
|
||||
if (global.StopResetList.Count == 0 || !global.StopResetList.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 = global.StopResetList.Count - 1; i >= 0; i--)
|
||||
{
|
||||
// 删除选中的主列表项
|
||||
if (global.StopResetList[i].Selected)
|
||||
{
|
||||
global.StopResetList.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
// 提示删除完成
|
||||
AntdUI.Message.success(window, "删除成功!", autoClose: 3);
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnStopResetAdd_Click(object? sender, EventArgs e)
|
||||
{
|
||||
if (ConfigModel.PLCBaseList?.FirstOrDefault()?.PLCItemList.Count == 0)
|
||||
{
|
||||
AntdUI.Message.warn(window, "点位表无数据,不允许新增!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
|
||||
PLCItem Item = new PLCItem()
|
||||
{
|
||||
StartIndex = global.StopResetList.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, "复位结束表操作-新增", Item, ConfigModel.PLCBaseList?.FirstOrDefault()?.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)
|
||||
{
|
||||
global.StopResetList.Add(Item);
|
||||
}
|
||||
|
||||
AntdUI.Message.info(window, "退出复位结束表新增", autoClose: 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void TableStartReset_CellButtonClick(object sender, TableButtonEventArgs e)
|
||||
{
|
||||
var buttontext = e.Btn.Text;
|
||||
|
||||
if (e.Record is PLCItem Item)
|
||||
{
|
||||
switch (buttontext)
|
||||
{
|
||||
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
|
||||
case "编辑":
|
||||
var form = new MotionProcessEdit(window, "复位开始表操作-编辑", Item, ConfigModel.PLCBaseList?.FirstOrDefault()?.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)
|
||||
{
|
||||
global.StartResetList.Remove(Item);
|
||||
}
|
||||
break;
|
||||
|
||||
case "上移":
|
||||
if (e.RowIndex <= 1)
|
||||
{
|
||||
AntdUI.Message.warn(window, "已是第一条,无法上移!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
MoveItemUp(global.StartResetList, Item);
|
||||
break;
|
||||
|
||||
case "下移":
|
||||
if (e.RowIndex > global.StartResetList.Count - 1)
|
||||
{
|
||||
AntdUI.Message.warn(window, "已是最后一条,无法下移!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
MoveItemDown(global.StartResetList, Item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnStartResetDelete_Click(object? sender, EventArgs e)
|
||||
{
|
||||
if (global.StartResetList.Count == 0 || !global.StartResetList.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 = global.StartResetList.Count - 1; i >= 0; i--)
|
||||
{
|
||||
// 删除选中的主列表项
|
||||
if (global.StartResetList[i].Selected)
|
||||
{
|
||||
global.StartResetList.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
// 提示删除完成
|
||||
AntdUI.Message.success(window, "删除成功!", autoClose: 3);
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnStartResetAdd_Click(object? sender, EventArgs e)
|
||||
{
|
||||
if (ConfigModel.PLCBaseList?.FirstOrDefault()?.PLCItemList.Count == 0)
|
||||
{
|
||||
AntdUI.Message.warn(window, "点位表无数据,不允许新增!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
PLCItem Item = new PLCItem()
|
||||
{
|
||||
StartIndex = global.StartResetList.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, "复位开始表操作-新增", Item, ConfigModel.PLCBaseList?.FirstOrDefault()?.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)
|
||||
{
|
||||
global.StartResetList.Add(Item);
|
||||
}
|
||||
|
||||
AntdUI.Message.info(window, "退出复位开始表新增", autoClose: 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void TableStopProcess_CellButtonClick(object sender, TableButtonEventArgs e)
|
||||
{
|
||||
var buttontext = e.Btn.Text;
|
||||
|
||||
if (e.Record is PLCItem Item)
|
||||
{
|
||||
switch (buttontext)
|
||||
{
|
||||
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
|
||||
case "编辑":
|
||||
var form = new MotionProcessEdit(window, "流程结束表操作-编辑", Item, ConfigModel.PLCBaseList?.FirstOrDefault()?.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)
|
||||
{
|
||||
global.StopProcessList.Remove(Item);
|
||||
}
|
||||
break;
|
||||
|
||||
case "上移":
|
||||
if (e.RowIndex <= 1)
|
||||
{
|
||||
AntdUI.Message.warn(window, "已是第一条,无法上移!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
MoveItemUp(global.StopProcessList, Item);
|
||||
break;
|
||||
|
||||
case "下移":
|
||||
if (e.RowIndex > global.StopProcessList.Count - 1)
|
||||
{
|
||||
AntdUI.Message.warn(window, "已是最后一条,无法下移!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
MoveItemDown(global.StopProcessList, Item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnStopProcessDelete_Click(object? sender, EventArgs e)
|
||||
{
|
||||
if (global.StopProcessList.Count == 0 || !global.StopProcessList.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 = global.StopProcessList.Count - 1; i >= 0; i--)
|
||||
{
|
||||
// 删除选中的主列表项
|
||||
if (global.StopProcessList[i].Selected)
|
||||
{
|
||||
global.StopProcessList.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
// 提示删除完成
|
||||
AntdUI.Message.success(window, "删除成功!", autoClose: 3);
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnStopProcessAdd_Click(object? sender, EventArgs e)
|
||||
{
|
||||
if (ConfigModel.PLCBaseList?.FirstOrDefault()?.PLCItemList.Count == 0)
|
||||
{
|
||||
AntdUI.Message.warn(window, "点位表无数据,不允许新增!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
PLCItem Item = new PLCItem()
|
||||
{
|
||||
StartIndex = global.StopProcessList.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, "流程结束表操作-新增", Item, ConfigModel.PLCBaseList?.FirstOrDefault()?.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)
|
||||
{
|
||||
global.StopProcessList.Add(Item);
|
||||
}
|
||||
|
||||
AntdUI.Message.info(window, "退出流程结束表新增", autoClose: 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void TableSartProcess_CellButtonClick(object sender, TableButtonEventArgs e)
|
||||
{
|
||||
var buttontext = e.Btn.Text;
|
||||
|
||||
if (e.Record is PLCItem Item)
|
||||
{
|
||||
switch (buttontext)
|
||||
{
|
||||
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
|
||||
case "编辑":
|
||||
var form = new MotionProcessEdit(window, "流程开始表操作-编辑", Item, ConfigModel.PLCBaseList?.FirstOrDefault()?.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)
|
||||
{
|
||||
global.StartProcessList.Remove(Item);
|
||||
}
|
||||
break;
|
||||
|
||||
case "上移":
|
||||
if (e.RowIndex <= 1)
|
||||
{
|
||||
AntdUI.Message.warn(window, "已是第一条,无法上移!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
MoveItemUp(global.StartProcessList, Item);
|
||||
break;
|
||||
|
||||
case "下移":
|
||||
if (e.RowIndex > global.StartProcessList.Count - 1)
|
||||
{
|
||||
AntdUI.Message.warn(window, "已是最后一条,无法下移!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
MoveItemDown(global.StartProcessList, Item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnSartProcessDelete_Click(object? sender, EventArgs e)
|
||||
{
|
||||
if (global.StartProcessList.Count == 0 || !global.StartProcessList.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 = global.StartProcessList.Count - 1; i >= 0; i--)
|
||||
{
|
||||
// 删除选中的主列表项
|
||||
if (global.StartProcessList[i].Selected)
|
||||
{
|
||||
global.StartProcessList.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
// 提示删除完成
|
||||
AntdUI.Message.success(window, "删除成功!", autoClose: 3);
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnSartProcessAdd_Click(object? sender, EventArgs e)
|
||||
{
|
||||
if (ConfigModel.PLCBaseList?.FirstOrDefault()?.PLCItemList.Count == 0)
|
||||
{
|
||||
AntdUI.Message.warn(window, "点位表无数据,不允许新增!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
PLCItem Item = new PLCItem()
|
||||
{
|
||||
StartIndex = global.StartProcessList.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, "流程开始表操作-新增", Item, ConfigModel.PLCBaseList?.FirstOrDefault()?.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)
|
||||
{
|
||||
global.StartProcessList.Add(Item);
|
||||
}
|
||||
|
||||
AntdUI.Message.info(window, "退出流程开始表新增", autoClose: 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void ItemsTable_CellButtonClick(object sender, TableButtonEventArgs e)
|
||||
{
|
||||
var buttontext = e.Btn.Text;
|
||||
|
||||
if (e.Record is PLCItem Item)
|
||||
{
|
||||
switch (buttontext)
|
||||
{
|
||||
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
|
||||
case "编辑":
|
||||
var form = new MotionProcessEdit(window, "流程加载表操作-编辑", Item, ConfigModel.PLCBaseList?.FirstOrDefault()?.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)
|
||||
{
|
||||
global.InitProcessList.Remove(Item);
|
||||
}
|
||||
break;
|
||||
|
||||
case "上移":
|
||||
if (e.RowIndex <= 1)
|
||||
{
|
||||
AntdUI.Message.warn(window, "已是第一条,无法上移!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
MoveItemUp(global.InitProcessList, Item);
|
||||
break;
|
||||
|
||||
case "下移":
|
||||
if (e.RowIndex > global.InitProcessList.Count - 1)
|
||||
{
|
||||
AntdUI.Message.warn(window, "已是最后一条,无法下移!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
MoveItemDown(global.InitProcessList, Item);
|
||||
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 事件
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnDelete_Click(object? sender, EventArgs e)
|
||||
{
|
||||
if (global.InitProcessList.Count == 0 || !global.InitProcessList.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 = global.InitProcessList.Count - 1; i >= 0; i--)
|
||||
{
|
||||
// 删除选中的主列表项
|
||||
if (global.InitProcessList[i].Selected)
|
||||
{
|
||||
global.InitProcessList.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
// 提示删除完成
|
||||
AntdUI.Message.success(window, "删除成功!", autoClose: 3);
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnAdd_Click(object? sender, EventArgs e)
|
||||
{
|
||||
if (ConfigModel.PLCBaseList?.FirstOrDefault()?.PLCItemList.Count == 0)
|
||||
{
|
||||
AntdUI.Message.warn(window, "点位表无数据,不允许新增!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
PLCItem Item = new PLCItem()
|
||||
{
|
||||
StartIndex = global.InitProcessList.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, "流程加载表操作-新增", Item, ConfigModel.PLCBaseList?.FirstOrDefault()?.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)
|
||||
{
|
||||
global.InitProcessList.Add(Item);
|
||||
}
|
||||
|
||||
AntdUI.Message.info(window, "退出流程加载表新增", autoClose: 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void InitData()
|
||||
{
|
||||
|
||||
|
||||
|
||||
TableInitProcess.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 (global.InitProcessList.Count > 0)
|
||||
{
|
||||
foreach (var item in global.InitProcessList)
|
||||
{
|
||||
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)
|
||||
};
|
||||
}
|
||||
}
|
||||
TableInitProcess.Binding(global.InitProcessList);
|
||||
|
||||
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 (global.StartProcessList.Count > 0)
|
||||
{
|
||||
foreach (var item in global.StartProcessList)
|
||||
{
|
||||
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(global.StartProcessList);
|
||||
TableSartProcess.Binding(global.StartProcessList);
|
||||
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 (global.StopProcessList.Count > 0)
|
||||
{
|
||||
foreach (var item in global.StopProcessList)
|
||||
{
|
||||
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(global.StopProcessList);
|
||||
|
||||
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 (global.StartResetList.Count > 0)
|
||||
{
|
||||
foreach (var item in global.StartResetList)
|
||||
{
|
||||
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(global.StartResetList);
|
||||
|
||||
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 (global.StopResetList.Count > 0)
|
||||
{
|
||||
foreach (var item in global.StopResetList)
|
||||
{
|
||||
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(global.StopResetList);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
120
DHSoftware/Views/GlobalControl.resx
Normal file
120
DHSoftware/Views/GlobalControl.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>
|
76
DHSoftware/Views/MotionControl.Designer.cs
generated
76
DHSoftware/Views/MotionControl.Designer.cs
generated
@ -28,6 +28,7 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AntdUI.Tabs.StyleLine styleLine1 = new AntdUI.Tabs.StyleLine();
|
||||
stackPanel2 = new AntdUI.StackPanel();
|
||||
swhEnable = new AntdUI.Switch();
|
||||
label4 = new AntdUI.Label();
|
||||
@ -56,7 +57,10 @@
|
||||
stpBaud = new AntdUI.StackPanel();
|
||||
cmbBaudRate = new AntdUI.Select();
|
||||
label3 = new AntdUI.Label();
|
||||
tabs1 = new AntdUI.Tabs();
|
||||
tabPage1 = new AntdUI.TabPage();
|
||||
PLCItemsTable = new AntdUI.Table();
|
||||
panel1 = new AntdUI.Panel();
|
||||
btnDelete = new AntdUI.Button();
|
||||
btnAdd = new AntdUI.Button();
|
||||
stackPanel2.SuspendLayout();
|
||||
@ -69,6 +73,9 @@
|
||||
stpStop.SuspendLayout();
|
||||
stpData.SuspendLayout();
|
||||
stpBaud.SuspendLayout();
|
||||
tabs1.SuspendLayout();
|
||||
tabPage1.SuspendLayout();
|
||||
panel1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// stackPanel2
|
||||
@ -164,9 +171,10 @@
|
||||
stackPanel1.Controls.Add(stpCom);
|
||||
stackPanel1.Controls.Add(stackPanel3);
|
||||
stackPanel1.Controls.Add(stackPanel2);
|
||||
stackPanel1.Location = new Point(19, 16);
|
||||
stackPanel1.Dock = DockStyle.Left;
|
||||
stackPanel1.Location = new Point(0, 0);
|
||||
stackPanel1.Name = "stackPanel1";
|
||||
stackPanel1.Size = new Size(223, 478);
|
||||
stackPanel1.Size = new Size(223, 530);
|
||||
stackPanel1.TabIndex = 25;
|
||||
stackPanel1.Text = "stackPanel1";
|
||||
stackPanel1.Vertical = true;
|
||||
@ -331,22 +339,58 @@
|
||||
label3.TabIndex = 24;
|
||||
label3.Text = "波 特 率";
|
||||
//
|
||||
// tabs1
|
||||
//
|
||||
tabs1.Dock = DockStyle.Fill;
|
||||
tabs1.Location = new Point(223, 0);
|
||||
tabs1.Name = "tabs1";
|
||||
tabs1.Pages.Add(tabPage1);
|
||||
tabs1.Size = new Size(675, 530);
|
||||
tabs1.Style = styleLine1;
|
||||
tabs1.TabIndex = 26;
|
||||
tabs1.Text = "tabs1";
|
||||
//
|
||||
// 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.Dock = DockStyle.Fill;
|
||||
PLCItemsTable.EmptyHeader = true;
|
||||
PLCItemsTable.Location = new Point(238, 71);
|
||||
PLCItemsTable.Location = new Point(0, 45);
|
||||
PLCItemsTable.Name = "PLCItemsTable";
|
||||
PLCItemsTable.Size = new Size(634, 392);
|
||||
PLCItemsTable.TabIndex = 26;
|
||||
PLCItemsTable.Padding = new Padding(5);
|
||||
PLCItemsTable.Size = new Size(669, 454);
|
||||
PLCItemsTable.TabIndex = 36;
|
||||
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.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.Size = new Size(80, 32);
|
||||
btnDelete.TabIndex = 28;
|
||||
btnDelete.Size = new Size(74, 32);
|
||||
btnDelete.TabIndex = 36;
|
||||
btnDelete.Text = "删除";
|
||||
btnDelete.Type = AntdUI.TTypeMini.Error;
|
||||
btnDelete.WaveSize = 0;
|
||||
@ -354,10 +398,10 @@
|
||||
// btnAdd
|
||||
//
|
||||
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.Size = new Size(80, 32);
|
||||
btnAdd.TabIndex = 27;
|
||||
btnAdd.Size = new Size(82, 32);
|
||||
btnAdd.TabIndex = 35;
|
||||
btnAdd.Text = "新增";
|
||||
btnAdd.Type = AntdUI.TTypeMini.Primary;
|
||||
btnAdd.WaveSize = 0;
|
||||
@ -366,9 +410,7 @@
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 17F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
Controls.Add(btnDelete);
|
||||
Controls.Add(btnAdd);
|
||||
Controls.Add(PLCItemsTable);
|
||||
Controls.Add(tabs1);
|
||||
Controls.Add(stackPanel1);
|
||||
Name = "MotionControl";
|
||||
Size = new Size(898, 530);
|
||||
@ -382,6 +424,9 @@
|
||||
stpStop.ResumeLayout(false);
|
||||
stpData.ResumeLayout(false);
|
||||
stpBaud.ResumeLayout(false);
|
||||
tabs1.ResumeLayout(false);
|
||||
tabPage1.ResumeLayout(false);
|
||||
panel1.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
@ -415,7 +460,10 @@
|
||||
private AntdUI.StackPanel stpBaud;
|
||||
private AntdUI.Select cmbBaudRate;
|
||||
private AntdUI.Label label3;
|
||||
private AntdUI.Tabs tabs1;
|
||||
private AntdUI.TabPage tabPage1;
|
||||
private AntdUI.Table PLCItemsTable;
|
||||
private AntdUI.Panel panel1;
|
||||
private AntdUI.Button btnDelete;
|
||||
private AntdUI.Button btnAdd;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO.Ports;
|
||||
using System.Linq;
|
||||
@ -18,28 +19,29 @@ namespace DHSoftware.Views
|
||||
{
|
||||
public partial class MotionControl : UserControl
|
||||
{
|
||||
Window window;
|
||||
PLCBase pLCBase;
|
||||
public MotionControl(Window _window,PLCBase _pLCBase)
|
||||
private Window window;
|
||||
private PLCBase pLCBase;
|
||||
|
||||
public MotionControl(Window _window, PLCBase _pLCBase)
|
||||
{
|
||||
window= _window;
|
||||
pLCBase= _pLCBase;
|
||||
window = _window;
|
||||
pLCBase = _pLCBase;
|
||||
InitializeComponent();
|
||||
BindEventHandler();
|
||||
InitData();
|
||||
SetupDataBindings();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void BindEventHandler()
|
||||
{
|
||||
sltTpye.TextChanged += SltTpye_TextChanged;
|
||||
btnAdd.Click += BtnAdd_Click;
|
||||
btnDelete.Click += BtnDelete_Click;
|
||||
PLCItemsTable.CellButtonClick += PLCItemsTable_CellButtonClick; ;
|
||||
PLCItemsTable.CellButtonClick += PLCItemsTable_CellButtonClick;
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void PLCItemsTable_CellButtonClick(object sender, TableButtonEventArgs e)
|
||||
{
|
||||
var buttontext = e.Btn.Text;
|
||||
@ -50,7 +52,7 @@ namespace DHSoftware.Views
|
||||
{
|
||||
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
|
||||
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)
|
||||
{
|
||||
OnLoad = () =>
|
||||
@ -59,26 +61,11 @@ namespace DHSoftware.Views
|
||||
},
|
||||
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);
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
||||
case "删除":
|
||||
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
|
||||
if (result == DialogResult.OK)
|
||||
@ -87,6 +74,62 @@ namespace DHSoftware.Views
|
||||
}
|
||||
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 +163,43 @@ namespace DHSoftware.Views
|
||||
{
|
||||
PLCItem pLCItem = new PLCItem()
|
||||
{
|
||||
StartIndex = pLCBase.PLCItemList.Count + 1,
|
||||
CellLinks = new CellLink[]
|
||||
{
|
||||
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary),
|
||||
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
|
||||
{ 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 MotionEdit(window, pLCItem) { Size = new Size(450, 550) };
|
||||
AntdUI.Modal.open(new AntdUI.Modal.Config(window, "", form, TType.None)
|
||||
var form = new MotionEdit(window, "点位表操作-新增", pLCItem) { Size = new Size(450, 550) };
|
||||
|
||||
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)
|
||||
{
|
||||
pLCItem.CellTags = new CellTag[] { };
|
||||
var tempList = pLCItem.CellTags.ToList();
|
||||
//AntdUI.Modal.open(new AntdUI.Modal.Config(window, "", form, TType.None)
|
||||
//{
|
||||
// BtnHeight = 0,
|
||||
//});
|
||||
|
||||
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();
|
||||
|
||||
pLCBase.PLCItemList.Add(pLCItem);
|
||||
}
|
||||
//if (form.submit)
|
||||
//{
|
||||
// pLCBase.PLCItemList.Add(pLCItem);
|
||||
//}
|
||||
}
|
||||
|
||||
private void SltTpye_TextChanged(object? sender, EventArgs e)
|
||||
@ -193,24 +239,17 @@ namespace DHSoftware.Views
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void InitData()
|
||||
{
|
||||
// 获取枚举字段名列表(原描述改为字段名)
|
||||
sltTpye.Items.Clear();
|
||||
foreach (EnumPLCType value in Enum.GetValues(typeof(EnumPLCType)))
|
||||
{
|
||||
sltTpye.Items.Add(value.ToString());
|
||||
sltTpye.Items.Add(value.ToString());
|
||||
}
|
||||
|
||||
// 波特率选项(保持不变)
|
||||
@ -242,46 +281,28 @@ namespace DHSoftware.Views
|
||||
|
||||
PLCItemsTable.Columns = new ColumnCollection() {
|
||||
new ColumnCheck("Selected"){Fixed = true},
|
||||
new Column("StartIndex", "序号", ColumnAlign.Center),
|
||||
new Column("Name", "名称", ColumnAlign.Center),
|
||||
new Column("Type", "类型",ColumnAlign.Center),
|
||||
new Column("Address", "地址",ColumnAlign.Center),
|
||||
new Column("Value", "值",ColumnAlign.Center),
|
||||
new Column("CellTags", "标签",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.Error)
|
||||
};
|
||||
}
|
||||
}
|
||||
PLCItemsTable.Binding(pLCBase.PLCItemList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void SetupDataBindings()
|
||||
{
|
||||
@ -296,9 +317,7 @@ namespace DHSoftware.Views
|
||||
iptIP.DataBindings.Add(nameof(iptIP.Text), pLCBase, nameof(pLCBase.IP));
|
||||
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();
|
||||
button_ok = new AntdUI.Button();
|
||||
divider1 = new AntdUI.Divider();
|
||||
label1 = new AntdUI.Label();
|
||||
lbTitleName = new AntdUI.Label();
|
||||
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();
|
||||
label7 = new AntdUI.Label();
|
||||
sltDataType = new AntdUI.Select();
|
||||
label3 = new AntdUI.Label();
|
||||
iptStartIndex = new AntdUI.InputNumber();
|
||||
iptEndIndex = new AntdUI.InputNumber();
|
||||
stackPanel1.SuspendLayout();
|
||||
panel1.SuspendLayout();
|
||||
stackPanel3.SuspendLayout();
|
||||
stackPanel2.SuspendLayout();
|
||||
stpNum.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// button_cancel
|
||||
@ -131,25 +115,18 @@
|
||||
divider1.Size = new Size(409, 12);
|
||||
divider1.TabIndex = 19;
|
||||
//
|
||||
// label1
|
||||
// lbTitleName
|
||||
//
|
||||
label1.Dock = DockStyle.Top;
|
||||
label1.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
label1.Location = new Point(18, 18);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(409, 24);
|
||||
label1.TabIndex = 17;
|
||||
label1.Text = "PLC点位操作";
|
||||
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(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(label7);
|
||||
panel1.Controls.Add(sltDataType);
|
||||
@ -159,131 +136,16 @@
|
||||
panel1.Controls.Add(divider2);
|
||||
panel1.Controls.Add(stackPanel1);
|
||||
panel1.Controls.Add(divider1);
|
||||
panel1.Controls.Add(label1);
|
||||
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, 572);
|
||||
panel1.Size = new Size(445, 315);
|
||||
panel1.TabIndex = 1;
|
||||
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.Dock = DockStyle.Top;
|
||||
@ -323,40 +185,15 @@
|
||||
label3.TabIndex = 44;
|
||||
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
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 17F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
Controls.Add(panel1);
|
||||
Name = "MotionEdit";
|
||||
Size = new Size(445, 572);
|
||||
Size = new Size(445, 315);
|
||||
stackPanel1.ResumeLayout(false);
|
||||
panel1.ResumeLayout(false);
|
||||
stackPanel3.ResumeLayout(false);
|
||||
stackPanel2.ResumeLayout(false);
|
||||
stpNum.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
@ -368,24 +205,11 @@
|
||||
private AntdUI.StackPanel stackPanel1;
|
||||
private AntdUI.Button button_ok;
|
||||
private AntdUI.Divider divider1;
|
||||
private AntdUI.Label label1;
|
||||
private AntdUI.Label lbTitleName;
|
||||
private AntdUI.Panel panel1;
|
||||
private AntdUI.Select sltDataType;
|
||||
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.Label label7;
|
||||
private AntdUI.InputNumber iptStartIndex;
|
||||
private AntdUI.InputNumber iptEndIndex;
|
||||
}
|
||||
}
|
||||
|
@ -10,9 +10,10 @@ namespace DHSoftware.Views
|
||||
private AntdUI.Window window;
|
||||
private PLCItem plcItem;
|
||||
public bool submit;
|
||||
public MotionEdit(AntdUI.Window _window, PLCItem _plcItem)
|
||||
public MotionEdit(AntdUI.Window _window,string TitleName, PLCItem _plcItem)
|
||||
{
|
||||
InitializeComponent();
|
||||
lbTitleName.Text = TitleName;
|
||||
plcItem = _plcItem;
|
||||
// 绑定事件
|
||||
BindEventHandler();
|
||||
@ -26,29 +27,9 @@ namespace DHSoftware.Views
|
||||
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)
|
||||
{
|
||||
@ -66,17 +47,9 @@ namespace DHSoftware.Views
|
||||
AntdUI.Message.warn(window, "参数名称不能为空!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
|
||||
plcItem.Name = sltName.Text;
|
||||
plcItem.Address = iptAddress.Text;
|
||||
plcItem.Type = sltDataType.Text;
|
||||
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;
|
||||
|
||||
plcItem.Type = (EnumPLCDataType)sltDataType.SelectedIndex;
|
||||
submit = true;
|
||||
this.Dispose();
|
||||
}
|
||||
@ -94,29 +67,14 @@ namespace DHSoftware.Views
|
||||
sltDataType.Items.Add(name);
|
||||
}
|
||||
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))
|
||||
{
|
||||
sltName.Text = plcItem.Name;
|
||||
iptAddress.Text = plcItem.Address;
|
||||
sltDataType.SelectedValue = 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;
|
||||
|
||||
|
||||
sltDataType.SelectedIndex =(int)plcItem.Type;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
@ -48,7 +48,7 @@
|
||||
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
|
||||
|
284
DHSoftware/Views/MotionProcessEdit.Designer.cs
generated
Normal file
284
DHSoftware/Views/MotionProcessEdit.Designer.cs
generated
Normal file
@ -0,0 +1,284 @@
|
||||
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();
|
||||
sltValue = new AntdUI.Select();
|
||||
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(sltValue);
|
||||
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, 549);
|
||||
panel1.TabIndex = 1;
|
||||
panel1.Text = "panel1";
|
||||
panel1.Click += panel1_Click;
|
||||
//
|
||||
// sltValue
|
||||
//
|
||||
sltValue.Dock = DockStyle.Top;
|
||||
sltValue.List = true;
|
||||
sltValue.Location = new Point(18, 420);
|
||||
sltValue.Name = "sltValue";
|
||||
sltValue.Size = new Size(409, 38);
|
||||
sltValue.TabIndex = 63;
|
||||
sltValue.Visible = false;
|
||||
//
|
||||
// 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 = "";
|
||||
iptValue.Radius = 3;
|
||||
iptValue.Size = new Size(409, 38);
|
||||
iptValue.TabIndex = 62;
|
||||
iptValue.Visible = false;
|
||||
//
|
||||
// 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, 549);
|
||||
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;
|
||||
private AntdUI.Select sltValue;
|
||||
}
|
||||
}
|
134
DHSoftware/Views/MotionProcessEdit.cs
Normal file
134
DHSoftware/Views/MotionProcessEdit.cs
Normal file
@ -0,0 +1,134 @@
|
||||
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;
|
||||
sltDataType.SelectedIndexChanged += SltDataType_SelectedIndexChanged;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void SltDataType_SelectedIndexChanged(object sender, IntEventArgs e)
|
||||
{
|
||||
iptValue.Visible = e.Value != 3;
|
||||
sltValue.Visible = e.Value == 3;
|
||||
}
|
||||
|
||||
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;
|
||||
if (sltDataType.SelectedIndex != 3)
|
||||
{
|
||||
plcItem.Value = iptValue.Text;
|
||||
}
|
||||
else
|
||||
{
|
||||
plcItem.Value = sltValue.Text;
|
||||
}
|
||||
|
||||
plcItem.StartExecute = sltEnable.SelectedIndex != 0;
|
||||
submit = true;
|
||||
this.Dispose();
|
||||
}
|
||||
|
||||
private void InitData()
|
||||
{
|
||||
|
||||
foreach (var item in plcItemList)
|
||||
{
|
||||
sltName.Items.Add(item.Name);
|
||||
}
|
||||
|
||||
var PLCDataTypes = Enum.GetNames(typeof(EnumPLCDataType));
|
||||
foreach (var name in PLCDataTypes)
|
||||
{
|
||||
sltDataType.Items.Add(name);
|
||||
}
|
||||
|
||||
var boolNames = Enum.GetNames(typeof(EnumBool));
|
||||
foreach (var name in boolNames)
|
||||
{
|
||||
sltEnable.Items.Add(name);
|
||||
}
|
||||
var bool1Names = Enum.GetNames(typeof(EnumBool1));
|
||||
foreach (var name in bool1Names)
|
||||
{
|
||||
sltValue.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;
|
||||
if (sltDataType.SelectedIndex != 3)
|
||||
{
|
||||
iptValue.Text = plcItem.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
sltValue.SelectedIndex=plcItem.Value=="True"?1:0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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>
|
42
DHSoftware/Views/SettingWindow.Designer.cs
generated
42
DHSoftware/Views/SettingWindow.Designer.cs
generated
@ -28,10 +28,12 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AntdUI.MenuItem menuItem1 = new AntdUI.MenuItem();
|
||||
AntdUI.MenuItem menuItem2 = new AntdUI.MenuItem();
|
||||
AntdUI.MenuItem menuItem3 = new AntdUI.MenuItem();
|
||||
AntdUI.MenuItem menuItem4 = new AntdUI.MenuItem();
|
||||
AntdUI.MenuItem menuItem5 = new AntdUI.MenuItem();
|
||||
AntdUI.MenuItem menuItem6 = new AntdUI.MenuItem();
|
||||
AntdUI.Tabs.StyleCard styleCard2 = new AntdUI.Tabs.StyleCard();
|
||||
AntdUI.Tabs.StyleCard styleCard1 = new AntdUI.Tabs.StyleCard();
|
||||
pageHeader1 = new AntdUI.PageHeader();
|
||||
panel1 = new AntdUI.Panel();
|
||||
panel2 = new AntdUI.StackPanel();
|
||||
@ -116,15 +118,25 @@
|
||||
//
|
||||
menu1.BackColor = SystemColors.Window;
|
||||
menu1.Dock = DockStyle.Top;
|
||||
menuItem4.IconSvg = "VideoCameraOutlined";
|
||||
menuItem4.Text = "相机设置";
|
||||
menuItem5.IconSvg = "AppstoreOutlined";
|
||||
menuItem5.Text = "工位设置";
|
||||
menuItem6.IconSvg = "ControlOutlined";
|
||||
menuItem6.Text = "运控设置";
|
||||
menuItem1.Expand = false;
|
||||
menuItem1.IconSvg = "VideoCameraOutlined";
|
||||
menuItem1.Text = "相机设置";
|
||||
menuItem2.Expand = false;
|
||||
menuItem2.IconSvg = "AppstoreOutlined";
|
||||
menuItem2.Text = "工位设置";
|
||||
menuItem3.Expand = false;
|
||||
menuItem3.IconSvg = "ControlOutlined";
|
||||
menuItem3.Text = "运控设置";
|
||||
menuItem4.Expand = false;
|
||||
menuItem4.IconSvg = "BarsOutlined";
|
||||
menuItem5.IconSvg = "BarsOutlined";
|
||||
menuItem5.Text = "全局设置";
|
||||
menuItem4.Sub.Add(menuItem5);
|
||||
menuItem4.Text = "其他设置";
|
||||
menu1.Items.Add(menuItem1);
|
||||
menu1.Items.Add(menuItem2);
|
||||
menu1.Items.Add(menuItem3);
|
||||
menu1.Items.Add(menuItem4);
|
||||
menu1.Items.Add(menuItem5);
|
||||
menu1.Items.Add(menuItem6);
|
||||
menu1.Location = new Point(0, 0);
|
||||
menu1.Name = "menu1";
|
||||
menu1.Size = new Size(141, 632);
|
||||
@ -152,8 +164,8 @@
|
||||
tabs1.Location = new Point(151, 33);
|
||||
tabs1.Name = "tabs1";
|
||||
tabs1.Size = new Size(891, 666);
|
||||
styleCard2.Closable = true;
|
||||
tabs1.Style = styleCard2;
|
||||
styleCard1.Closable = true;
|
||||
tabs1.Style = styleCard1;
|
||||
tabs1.TabIndex = 5;
|
||||
tabs1.Text = "tabs1";
|
||||
tabs1.Type = AntdUI.TabType.Card;
|
||||
@ -170,13 +182,13 @@
|
||||
divider1.Text = "";
|
||||
divider1.Vertical = true;
|
||||
//
|
||||
// SettingWindow1
|
||||
// SettingWindow
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 17F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1042, 699);
|
||||
Controls.Add(panel3);
|
||||
Name = "SettingWindow1";
|
||||
Name = "SettingWindow";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "SettingWinform";
|
||||
panel1.ResumeLayout(false);
|
||||
@ -195,6 +207,6 @@
|
||||
private AntdUI.Tabs tabs1;
|
||||
private AntdUI.Divider divider1;
|
||||
private AntdUI.Dropdown btnAdd;
|
||||
private AntdUI.Button btnSave;
|
||||
private AntdUI.Dropdown btnSave;
|
||||
}
|
||||
}
|
@ -173,6 +173,51 @@ namespace DHSoftware.Views
|
||||
currControl = control;
|
||||
}
|
||||
break;
|
||||
case "其他设置":
|
||||
foreach (var tab in tabs1.Pages)
|
||||
{
|
||||
if (tab is AntdUI.TabPage existingTab && existingTab.Text == $"{clickedItem.PARENTITEM.Text}-{clickedItem.Text}")
|
||||
{
|
||||
isUpdatingTabs = true;
|
||||
tabs1.SelectedTab = existingTab; // 直接跳转到已存在的 TabPage
|
||||
isUpdatingTabs = false;
|
||||
currControl = existingTab.Controls.Count > 0 ? existingTab.Controls[0] as UserControl : null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (clickedItem.Text == "全局设置")
|
||||
{
|
||||
//先获取是否存在该名称的配置
|
||||
//如果没有新建项
|
||||
GlobalConfig? global = ConfigModel
|
||||
.GlobalList.FirstOrDefault() ;
|
||||
if (global == null)
|
||||
{
|
||||
global = new GlobalConfig();
|
||||
}
|
||||
|
||||
UserControl control3 = null;
|
||||
control = new GlobalControl(this, global);
|
||||
if (control != null)
|
||||
{
|
||||
//容器添加控件,需要调整dpi
|
||||
control.Dock = DockStyle.Fill;
|
||||
AutoDpi(control);
|
||||
AntdUI.TabPage tabPage = new AntdUI.TabPage()
|
||||
{
|
||||
Text = $"{clickedItem.PARENTITEM.Text}-{clickedItem.Text}",
|
||||
ReadOnly = false,
|
||||
};
|
||||
tabPage.Controls.Add(control);
|
||||
tabs1.Pages.Add(tabPage);
|
||||
isUpdatingTabs = true;
|
||||
tabs1.SelectedTab = tabPage;
|
||||
isUpdatingTabs = false;
|
||||
currControl = control;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -186,7 +231,6 @@ namespace DHSoftware.Views
|
||||
btnAdd.Items.Add("相机设置");
|
||||
btnAdd.Items.Add("工位设置");
|
||||
btnAdd.Items.Add("运控设置");
|
||||
|
||||
x = Width;
|
||||
y = Height;
|
||||
AdaptiveHelper.setTag(this);
|
||||
@ -237,6 +281,12 @@ namespace DHSoftware.Views
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ConfigModel.GlobalList?.Count <= 0)
|
||||
{
|
||||
GlobalConfig globalConfig = new GlobalConfig();
|
||||
ConfigModel.GlobalList.Add(globalConfig);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void BtnSave_Click(object? sender, EventArgs e)
|
||||
@ -652,6 +702,8 @@ namespace DHSoftware.Views
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user