2 Commits

Author SHA1 Message Date
TD
09c2eb37fe 修改界面 2025-03-25 15:33:35 +08:00
TD
2a6019bfbd 初步界面测试 2025-03-25 13:56:48 +08:00
15 changed files with 1093 additions and 2027 deletions

View File

@ -20,11 +20,7 @@ namespace DH.Commons.Base
private Parity _parity = Parity.None;
private string _ip = "192.168.6.61";
private int _port = 502;
private BindingList<PLCItem> _PLCItemList = new BindingList<PLCItem>();
private BindingList<PLCItem> _PLCStartProcessList = new BindingList<PLCItem>();
private BindingList<PLCItem> _PLCStopProcessList = new BindingList<PLCItem>();
private BindingList<PLCItem> _PLCStartResetList = new BindingList<PLCItem>();
private BindingList<PLCItem> _PLCStopResetList = new BindingList<PLCItem>();
private AntList<PLCItem> _PLCItemList = new AntList<PLCItem>();
[Category("设备配置")]
[DisplayName("是否启用")]
[Description("是否启用")]
@ -183,7 +179,7 @@ namespace DH.Commons.Base
[Category("点位配置")]
[DisplayName("点位配置")]
[Description("点位配置")]
public BindingList<PLCItem> PLCItemList
public AntList<PLCItem> PLCItemList
{
get => _PLCItemList;
set
@ -193,47 +189,6 @@ namespace DH.Commons.Base
OnPropertyChanged(nameof(PLCItemList));
}
}
public BindingList<PLCItem> PLCStartProcessList
{
get => _PLCStartProcessList;
set
{
if (_PLCStartProcessList == value) return;
_PLCStartProcessList = value;
OnPropertyChanged(nameof(PLCStartProcessList));
}
}
public BindingList<PLCItem> PLCStopProcessList
{
get => _PLCStopProcessList;
set
{
if (_PLCStopProcessList == value) return;
_PLCStopProcessList = value;
OnPropertyChanged(nameof(PLCStopProcessList));
}
}
public BindingList<PLCItem> PLCStartResetList
{
get => _PLCStartResetList;
set
{
if (_PLCStartResetList == value) return;
_PLCStartResetList = value;
OnPropertyChanged(nameof(PLCStartResetList));
}
}
public BindingList<PLCItem> PLCStopResetList
{
get => _PLCStopResetList;
set
{
if (_PLCStopResetList == value) return;
_PLCStopResetList = value;
OnPropertyChanged(nameof(PLCStopResetList));
}
}
public virtual bool PLCConnect()
{
Connected = true;
@ -254,8 +209,6 @@ namespace DH.Commons.Base
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 WriteDInt1(string address, int value, bool waitForReply = true) { return false; }
public virtual bool WriteFloat(string address, float value, bool waitForReply = true) { return false; }
public virtual bool WriteBool(string address, bool value, bool waitForReply = true) { return false; }
}
@ -265,10 +218,13 @@ namespace DH.Commons.Base
{
private bool _selected;
private string _name = string.Empty;
private EnumPLCDataType _type;
private string _type = string.Empty;
private string _value = string.Empty;
private bool _startexecute;
private bool _endexecute;
private int _startindex;
private int _endindex;
private string _numtype;
private string _address;
/// <summary>
/// 是否选中
@ -301,7 +257,7 @@ namespace DH.Commons.Base
}
}
}
public EnumPLCDataType Type
public string Type
{
get => _type;
set
@ -328,7 +284,18 @@ namespace DH.Commons.Base
}
}
}
public string NumTpye
{
get => _numtype;
set
{
if (_numtype != value)
{
_numtype = value;
OnPropertyChanged(nameof(NumTpye));
}
}
}
/// <summary>
/// 参数值
/// </summary>
@ -346,7 +313,7 @@ namespace DH.Commons.Base
}
/// <summary>
/// 启用状态
/// 流程开启执行状态
/// </summary>
public bool StartExecute
{
@ -360,13 +327,27 @@ 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
{
@ -380,6 +361,21 @@ namespace DH.Commons.Base
}
}
}
/// <summary>
/// 流程结束顺序
/// </summary>
public int EndIndex
{
get => _endindex;
set
{
if (_endindex != value)
{
_endindex = value;
OnPropertyChanged(nameof(EndIndex));
}
}
}
private CellLink[] cellLinks;
[JsonIgnore]
@ -394,18 +390,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));
}
}
}

View File

@ -71,38 +71,45 @@ namespace DH.Commons.Enums
public enum EnumPLCOutputIO
{
=0,
=1,
使=2,
=3,
=4,
绿=5,
=6,
=7,
=8,
=9,
=10,
1=11,
2=12,
3=13,
4=14,
5=15,
6 = 16,
7 = 17,
8 = 18,
9 = 19,
10 = 20,
OK料盒 =21,
NG料盒=22,
OK吹气时间=23,
NG吹气时间=24,
=25,
=26,
=27,
=28,
=29,
=30,
,
使,
,
,
绿,
,
,
,
,
,
1,
2,
3,
4,
5,
6 ,
7 ,
8 ,
9 ,
10 ,
OK料盒 ,
NG料盒,
OK吹气时间,
NG吹气时间,
,
,
,
,
,
,
,
,
,
,
,
,
OK脉冲,
NG脉冲,
@ -111,16 +118,16 @@ namespace DH.Commons.Enums
public enum EnumPLCDataType
{
,
,
,
HD,
D,
M
}
public enum EnumBool
public enum EnumPLCINTType
{
,
16,
32,
16,
32
}
public enum StreamFormat

View File

@ -13,6 +13,7 @@ using DH.Commons.Enums;
using HslCommunication;
using HslCommunication.Enthernet;
using HslCommunication.Profinet.XINJE;
using OpenCvSharp;
namespace DH.Devices.PLC
{
@ -59,7 +60,7 @@ namespace DH.Devices.PLC
TcpNet.Write("M122", true);
MonitorPieces();
TurntableStop();
PrepareMotion();//心跳监听
return true;
}
else
@ -304,52 +305,7 @@ namespace DH.Devices.PLC
return false;
}
/// <summary>
/// 写单独地址 Dint 值- 待测试
/// </summary>
/// <param name="address"></param>
/// <param name="writeValue"></param>
/// <param name="waitForReply"></param>
/// <returns></returns>
public override bool WriteDInt1(string address, int writeValue, bool waitForReply = true)
{
// 1. 地址格式解析
var match = Regex.Match(address, @"^([A-Za-z]+)(\d+)$");
if (!match.Success)
{
Console.WriteLine($"地址格式错误: {address}");
return false;
}
string prefix = match.Groups[1].Value; // 提取字母部分(如"D"或"HD"
int baseAddr = int.Parse(match.Groups[2].Value); // 提取数字部分如100
// 2. 数值拆分为两个16位值大端序
byte[] bytes = BitConverter.GetBytes(writeValue);
short high = BitConverter.ToInt16(bytes, 2); // 高16位
short low = BitConverter.ToInt16(bytes, 0); // 低16位
// 3. 构造高低位地址
string highAddress = $"{prefix}{baseAddr + 1}"; // 如"D101"或"HD101"
string lowAddress = $"{prefix}{baseAddr}"; // 如"D100"或"HD100"
// 4. 写入操作(带重试)
for (int i = 0; i < 3; i++)
{
try
{
if (!TcpNet.Write(highAddress, high).IsSuccess) continue;
Thread.Sleep(10);
return TcpNet.Write(lowAddress, low).IsSuccess;
}
catch (Exception ex)
{
Console.WriteLine($"写入失败: {ex.Message}");
Thread.Sleep(50 * (i + 1));
}
}
return false;
}
/// <summary>
/// 写单独地址 float 值
/// </summary>
@ -485,6 +441,22 @@ namespace DH.Devices.PLC
OnNewPieces?.Invoke(axisIndex, pieceNumber);
});
}
public async Task HeartbeatAsync1()
{
while (Connected)
{
PLCItem pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "心跳地址");
if (pLCItem == null)
return;
string HeartbeatAddress = pLCItem.Type + pLCItem.Address;
TcpNet.Write(HeartbeatAddress, true);
await Task.Delay(900); // 非阻塞等待1秒
}
}
/// <summary>
/// 入料监听
@ -496,6 +468,7 @@ namespace DH.Devices.PLC
PLCItem pLCItem= PLCItemList.FirstOrDefault(u => u.Name == "产品计数");
if (pLCItem == null)
return;
string Count = pLCItem.Type + pLCItem.Address;
DateTime startTime = DateTime.Now;
DateTime endTime = startTime;
TimeSpan timeSpan = endTime - startTime;
@ -507,7 +480,8 @@ namespace DH.Devices.PLC
uint tmpPieceNumber = 0;
sw.Start();
var ret = TcpNet.ReadUInt16("D1016");
// var ret = TcpNet.ReadUInt16("D1016");
var ret = TcpNet.ReadUInt16(Count);
sw.Stop();
if (ret.IsSuccess)
@ -549,51 +523,539 @@ namespace DH.Devices.PLC
/// <summary>
/// 转盘开启操作
/// </summary>
public void TurntableOpen(int speed, bool Direction)
public void TurntableOpen()
{
WriteBool("M122", true);
PLCItem pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "计数清零");
if (pLCItem == null)
return;
string CountToZero = pLCItem.Type + pLCItem.Address;
PLCItem DiskSpeedItem = PLCItemList.FirstOrDefault(u => u.Name == "转盘速度");
if (DiskSpeedItem == null)
return;
string diskSpeedadress = DiskSpeedItem.Type + DiskSpeedItem.Address;
int diskSpeedValue= Convert.ToInt32( DiskSpeedItem.Value);
PLCItem DiskDirectionItem = PLCItemList.FirstOrDefault(u => u.Name == "转盘方向");
if (DiskDirectionItem == null)
return;
string diskDirectionadress = DiskDirectionItem.Type + DiskDirectionItem.Address;
bool Direction =Convert.ToBoolean( DiskDirectionItem.Value);
PLCItem DiskOpenItem = PLCItemList.FirstOrDefault(u => u.Name == "转盘使能");
if (DiskOpenItem == null)
return;
string diskopenadress = DiskOpenItem.Type + DiskOpenItem.Address;
PLCItem DiskRunItem = PLCItemList.FirstOrDefault(u => u.Name == "转盘启动");
if (DiskRunItem == null)
return;
string diskadress = DiskRunItem.Type + DiskRunItem.Address;
WriteBool(CountToZero, true);
Thread.Sleep(10);
WriteBool("M10", false);
Thread.Sleep(10);
//速度
TcpNet.Write("HD10", (ushort)speed);
TcpNet.Write(diskSpeedadress, (ushort)diskSpeedValue);
Thread.Sleep(10);
//方向
WriteBool("M1", Direction);
WriteBool(diskDirectionadress, Direction);
Thread.Sleep(10);
//使能
WriteBool("M2", true);
WriteBool(diskopenadress, true);
Thread.Sleep(10);
//启动
WriteBool("M0", true);
WriteBool(diskadress, true);
//WriteBool("M122", true);
//Thread.Sleep(10);
//WriteBool("M10", false);
//Thread.Sleep(10);
////速度
//TcpNet.Write("HD10", (ushort)10000);
//Thread.Sleep(10);
////方向
//WriteBool("M1", Direction);
//Thread.Sleep(10);
////使能
//WriteBool("M2", true);
//Thread.Sleep(10);
////启动
//WriteBool("M0", true);
Thread.Sleep(10);
// _mainMotion.CurrentState = DeviceState.DSOpen;
piecesCount = 0;
}
/// <summary>
/// 转盘停止操作
/// </summary>
public void TurntableStop()
{
WriteBool("M122", true);
PLCItem pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "计数清零");
if (pLCItem == null)
return;
string CountToZero = pLCItem.Type + pLCItem.Address;
PLCItem DiskRunItem = PLCItemList.FirstOrDefault(u => u.Name == "转盘启动");
if (DiskRunItem == null)
return;
string diskadress = DiskRunItem.Type + DiskRunItem.Address;
PLCItem DiskOpenItem = PLCItemList.FirstOrDefault(u => u.Name == "转盘使能");
if (DiskOpenItem == null)
return;
string diskopenadress = DiskOpenItem.Type + DiskOpenItem.Address;
WriteBool(CountToZero, true);
Thread.Sleep(50);
WriteBool("M0", false);
WriteBool(diskadress, false);
Thread.Sleep(50);
WriteBool("M2", false);
WriteBool(diskopenadress, false);
Thread.Sleep(50);
WriteBool("M50", false);
WriteBool("M10", false);
//WriteBool("M122", true);
//Thread.Sleep(50);
//WriteBool("M0", false);
//Thread.Sleep(50);
//WriteBool("M2", false);
//Thread.Sleep(50);
//WriteBool("M50", false);
piecesCount = 0;
}
private void PrepareMotion()
{
//心跳
//if (X018PLCConfig.Heartbeat)
//{
Task.Run(async () => await HeartbeatAsync1());
//}
////写入工件最大值、最小值
ProjectValue();
////写入工位脉冲
Workstation1Pulse();
Workstation2Pulse();
Workstation3Pulse();
Workstation4Pulse();
Workstation5Pulse();
////写入吹气时间
ChuiQiTime();
////写入吹气脉冲
OKPulse();
NGPulse();
//if (_GC01Driver == null)
//{
// _GC01Driver = DeviceCollection.FirstOrDefault(u => u is GC01Driver) as GC01Driver;
//}
//if (_GC01Driver == null)
//{
// throw new ProcessException($"未能获取激光位移传感器驱动");
//}
//if (_vibrationDriver == null)
//{
// _vibrationDriver = DeviceCollection.FirstOrDefault(u => u is JYDAMDriver) as JYDAMDriver;
//}
//if (_vibrationDriver == null)
//{
// throw new ProcessException($"未能获取振动盘控制器驱动");
//}
// ResetTimer = new Timer(FullResetProcessExcute, null, -1, -1);
//feedingProductTimer = new Timer(FeedingProductTriggerExcute, null, -1, -1);
//feedingProductTimerTimer = new Timer(UpdateFeedingProductTrigger, null, -1, -1);
//_mainMotion.OnAxisPositionChanged -= MainMotion_OnAxisPositionChanged;
//_mainMotion.OnAxisPositionChanged += MainMotion_OnAxisPositionChanged;
//_mainMotion.OnCapturePositionChanged -= MainMotion_OnCapturePositionChanged;
//_mainMotion.OnCapturePositionChanged += MainMotion_OnCapturePositionChanged;
// _mainMotion.OnNewPieces -= MainMotion_NewPieces;
// _mainMotion.OnNewPieces += MainMotion_NewPieces;
//_mainMotion.OnAlarmVibrationDisk -= MainMotion_AlarmVibrationDisk;
//_mainMotion.OnAlarmVibrationDisk += MainMotion_AlarmVibrationDisk;
// PrepareLightIndexes();
}
/// <summary>
/// 挡料电机操作
/// true: 顺时针
/// False: 逆时针
/// </summary>
/// <param name="u"></param>
public void FeedingMotor( bool direction)
{
// 设置最大等待时间,假设为 3 秒
int timeout = 3000;
int elapsedTime = 0;
int checkInterval = 100; // 每次检查等待 100ms
PLCItem pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "挡料电机回原点");
if (pLCItem == null)
return;
PLCItem zerospeeditem = PLCItemList.FirstOrDefault(u => u.Name == "挡料电机回原点速度");
if (zerospeeditem == null)
return;
PLCItem CunSpeed = PLCItemList.FirstOrDefault(u => u.Name == "挡料电机速度");
if (CunSpeed == null)
return;
PLCItem CunClockwiseItem = PLCItemList.FirstOrDefault(u => u.Name == "挡料电机顺时针");
if (CunClockwiseItem == null)
return;
PLCItem CunCounterclockwiseItem = PLCItemList.FirstOrDefault(u => u.Name == "挡料电机逆时针");
if (CunCounterclockwiseItem == null)
return;
PLCItem CunPosItem = PLCItemList.FirstOrDefault(u => u.Name == "挡料电机位置");
if (CunPosItem == null)
return;
string CunToZero = pLCItem.Type + pLCItem.Address;
string CunToZeroSpeed = zerospeeditem.Type + zerospeeditem.Address;
string CunSpeedadress = CunSpeed.Type + CunSpeed.Address;
string CunClockwise = CunClockwiseItem.Type + CunClockwiseItem.Address;
string CunCounterclockwise = CunCounterclockwiseItem.Type + CunCounterclockwiseItem.Address;
string CunPos = CunPosItem.Type + CunPosItem.Address;
short zerospeed = (short)Convert.ToInt32(zerospeeditem.Value);
short cunSpeed = (short)Convert.ToInt32(CunSpeed.Value);
short u = (short)Convert.ToInt32(CunPosItem.Value);
// WriteBool(CountToZero, true);
// 检查是否不在原点,如果不在,则回原点
if (!ReadBool(CunToZero))
{
WriteShort(CunToZeroSpeed, (short)zerospeed); // 速度
Thread.Sleep(10);
// 发送回原点指令
WriteBool(CunToZero, true);
Thread.Sleep(1000); // 给设备一些时间响应
// 等待回到原点
while (!ReadBool(CunToZero))
{
if (elapsedTime >= timeout)
{
break;
}
Thread.Sleep(checkInterval);
elapsedTime += checkInterval;
}
}
// 无论是刚回到原点还是已经在原点,执行目标位置、速度和方向设置
WriteShort(CunSpeedadress, (short)cunSpeed);
Thread.Sleep(2000);
string dir = string.Empty;
if (direction)
{
WriteBool(CunClockwise, true); // 顺时针转动
dir = "顺时针";
}
else
{
WriteBool(CunCounterclockwise, true); // 逆时针转动
dir = "逆时针";
}
Thread.Sleep(10);
WriteShort(CunPos, (short)u); // 目标位置
Thread.Sleep(2000);
}
/// <summary>
/// 计数清零
/// </summary>
public void CountToZero()
{
WriteBool("M120", true);
PLCItem pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "计数清零");
if (pLCItem == null)
return;
string CountToZero = pLCItem.Type + pLCItem.Address;
WriteBool(CountToZero, true);
Thread.Sleep(10);
}
public void RedLight(bool b)
{
PLCItem pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "指示灯红");
if (pLCItem == null)
return;
string RedLight = pLCItem.Type + pLCItem.Address;
WriteBool(RedLight, b);
Thread.Sleep(10);
}
public void GreenLight(bool b)
{
PLCItem pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "指示灯绿");
if (pLCItem == null)
return;
string Light = pLCItem.Type + pLCItem.Address;
WriteBool(Light, b);
// WriteBool(IIConfig.GreenLight, b);
Thread.Sleep(10);
}
public void YellowLight(bool b)
{
PLCItem pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "指示灯黄");
if (pLCItem == null)
return;
string Light = pLCItem.Type + pLCItem.Address;
WriteBool(Light, b);
Thread.Sleep(10);
}
public void Buzzer(bool b)
{
PLCItem pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "蜂鸣器");
if (pLCItem == null)
return;
string Light = pLCItem.Type + pLCItem.Address;
WriteBool(Light, b);
Thread.Sleep(10);
}
public void Belt(bool b)
{
PLCItem pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "皮带");
if (pLCItem == null)
return;
string Light = pLCItem.Type + pLCItem.Address;
WriteBool(Light, b);
Thread.Sleep(10);
}
public void Workstation1Pulse()
{
PLCItem pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "工位1");
if (pLCItem == null)
return;
string Workstation1Pulse = pLCItem.Type + pLCItem.Address;
int Pulse=Convert.ToInt32(pLCItem.Value);
string result = Regex.Replace(Workstation1Pulse, @"\D", "");
int r = Convert.ToInt32(result) + 1;
result = "HD" + r.ToString();
short high = (short)(Pulse >> 16); // 高 16 位
short low = (short)(Pulse & 0xFFFF); // 低 16 位
WriteShort(result, high);
Thread.Sleep(10);
WriteShort(Workstation1Pulse, low);
Thread.Sleep(10);
}
public void Workstation2Pulse()
{
PLCItem pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "工位2");
if (pLCItem == null)
return;
string Workstation1Pulse = pLCItem.Type + pLCItem.Address;
int Pulse=Convert.ToInt32(pLCItem.Value);
string result = Regex.Replace(Workstation1Pulse, @"\D", "");
int r = Convert.ToInt32(result) + 1;
result = "HD" + r.ToString();
short high = (short)(Pulse >> 16); // 高 16 位
short low = (short)(Pulse & 0xFFFF); // 低 16 位
WriteShort(result, high);
Thread.Sleep(10);
WriteShort(Workstation1Pulse, low);
Thread.Sleep(10);
}
public void Workstation3Pulse()
{
PLCItem pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "工位3");
if (pLCItem == null)
return;
string Workstation1Pulse = pLCItem.Type + pLCItem.Address;
int Pulse = Convert.ToInt32(pLCItem.Value);
string result = Regex.Replace(Workstation1Pulse, @"\D", "");
int r = Convert.ToInt32(result) + 1;
result = "HD" + r.ToString();
short high = (short)(Pulse >> 16); // 高 16 位
short low = (short)(Pulse & 0xFFFF); // 低 16 位
WriteShort(result, high);
Thread.Sleep(10);
WriteShort(Workstation1Pulse, low);
Thread.Sleep(10);
}
public void Workstation4Pulse()
{
PLCItem pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "工位4");
if (pLCItem == null)
return;
string Workstation1Pulse = pLCItem.Type + pLCItem.Address;
int Pulse = Convert.ToInt32(pLCItem.Value);
string result = Regex.Replace(Workstation1Pulse, @"\D", "");
int r = Convert.ToInt32(result) + 1;
result = "HD" + r.ToString();
short high = (short)(Pulse >> 16); // 高 16 位
short low = (short)(Pulse & 0xFFFF); // 低 16 位
WriteShort(result, high);
Thread.Sleep(10);
WriteShort(Workstation1Pulse, low);
Thread.Sleep(10);
}
public void Workstation5Pulse()
{
PLCItem pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "工位5");
if (pLCItem == null)
return;
string Workstation1Pulse = pLCItem.Type + pLCItem.Address;
int Pulse = Convert.ToInt32(pLCItem.Value);
string result = Regex.Replace(Workstation1Pulse, @"\D", "");
int r = Convert.ToInt32(result) + 1;
result = "HD" + r.ToString();
short high = (short)(Pulse >> 16); // 高 16 位
short low = (short)(Pulse & 0xFFFF); // 低 16 位
WriteShort(result, high);
Thread.Sleep(10);
WriteShort(Workstation1Pulse, low);
Thread.Sleep(10);
}
public void ProjectValue()
{
PLCItem pLCItemmax = PLCItemList.FirstOrDefault(u => u.Name == "工件最大值");
if (pLCItemmax == null)
return;
PLCItem pLCItemmin = PLCItemList.FirstOrDefault(u => u.Name == "工件最小值");
if (pLCItemmin == null)
return;
int productMax =Convert.ToInt32( pLCItemmax.Value);
int productMin = Convert.ToInt32( pLCItemmin.Value);
string ProductMax = pLCItemmax.Type + pLCItemmax.Address;
string ProductMin = pLCItemmin.Type + pLCItemmin.Address;
WriteShort(ProductMax, (short)productMax);
Thread.Sleep(10);
WriteShort(ProductMin, (short)productMin);
Thread.Sleep(10);
}
public void OKPulse()
{
PLCItem pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "OK脉冲");
if (pLCItem == null)
return;
string OKPulse = pLCItem.Type + pLCItem.Address;
int Pulse =Convert.ToInt32( pLCItem.Value);
string result = Regex.Replace(OKPulse, @"\D", "");
int r = Convert.ToInt32(result) + 1;
result = "HD" + r.ToString();
short high = (short)(Pulse >> 16); // 高 16 位
short low = (short)(Pulse & 0xFFFF); // 低 16 位
WriteShort(result, high);
Thread.Sleep(10);
WriteShort(OKPulse, low);
Thread.Sleep(10);
}
public void NGPulse()
{
PLCItem pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "NG脉冲");
if (pLCItem == null)
return;
string NGPulse = pLCItem.Type + pLCItem.Address;
int Pulse=Convert.ToInt32(pLCItem.Value);
string result = Regex.Replace(NGPulse, @"\D", "");
int r = Convert.ToInt32(result) + 1;
result = "HD" + r.ToString();
short high = (short)(Pulse >> 16); // 高 16 位
short low = (short)(Pulse & 0xFFFF); // 低 16 位
WriteShort(result, high);
Thread.Sleep(10);
WriteShort(NGPulse, low);
Thread.Sleep(10);
}
public void TurnClear(bool b)
{
PLCItem pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "转盘清料");
if (pLCItem == null)
return;
string TurnClear = pLCItem.Type + pLCItem.Address;
WriteBool(TurnClear, b);
Thread.Sleep(10);
}
public void OpenHeartbeat(bool v)
{
PLCItem pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "心跳功能");
if (pLCItem == null)
return;
string Heartbeat = pLCItem.Type + pLCItem.Address;
WriteBool(Heartbeat, v);
Thread.Sleep(10);
}
public void Vibratory(bool v)
{
PLCItem pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "振动盘");
if (pLCItem == null)
return;
string Vibratory = pLCItem.Type + pLCItem.Address;
WriteBool(Vibratory, v);
Thread.Sleep(10);
}
public void ChuiQiTime()
{
PLCItem pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "吹气时间");
if (pLCItem == null)
return;
string ChuiQiTime = pLCItem.Type + pLCItem.Address;
short time = (short)Convert.ToInt32(pLCItem.Value);
WriteShort(ChuiQiTime, time);
Thread.Sleep(10);
}
}
}
}

View File

@ -50,7 +50,6 @@
<ItemGroup>

View File

@ -28,19 +28,18 @@
/// </summary>
private void InitializeComponent()
{
AntdUI.Tabs.StyleCard styleCard1 = new AntdUI.Tabs.StyleCard();
AntdUI.Tabs.StyleCard styleCard2 = new AntdUI.Tabs.StyleCard();
AntdUI.Tabs.StyleCard styleCard3 = new AntdUI.Tabs.StyleCard();
AntdUI.SegmentedItem segmentedItem1 = new AntdUI.SegmentedItem();
AntdUI.Tabs.StyleCard styleCard4 = new AntdUI.Tabs.StyleCard();
AntdUI.SegmentedItem segmentedItem6 = new AntdUI.SegmentedItem();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainWindow));
AntdUI.SegmentedItem segmentedItem2 = new AntdUI.SegmentedItem();
AntdUI.SegmentedItem segmentedItem3 = new AntdUI.SegmentedItem();
AntdUI.SegmentedItem segmentedItem4 = new AntdUI.SegmentedItem();
AntdUI.SegmentedItem segmentedItem5 = new AntdUI.SegmentedItem();
AntdUI.SegmentedItem segmentedItem7 = new AntdUI.SegmentedItem();
AntdUI.SegmentedItem segmentedItem8 = new AntdUI.SegmentedItem();
AntdUI.SegmentedItem segmentedItem9 = new AntdUI.SegmentedItem();
AntdUI.SegmentedItem segmentedItem10 = new AntdUI.SegmentedItem();
titlebar = new AntdUI.PageHeader();
lbName = new AntdUI.Label();
pageHeader1 = new AntdUI.PageHeader();
label1 = new Label();
labuph = new Label();
divider2 = new AntdUI.Divider();
panelmain = new AntdUI.Panel();
panel2 = new AntdUI.Panel();
@ -49,9 +48,6 @@
splitContainer1 = new SplitContainer();
splitContainer2 = new SplitContainer();
tabImgDisplay = new AntdUI.Tabs();
tabMain = new AntdUI.TabPage();
tabsStas = new AntdUI.Tabs();
tabPage3 = new AntdUI.TabPage();
richTextBox1 = new RichTextBox();
tabsConfig = new AntdUI.Tabs();
tabPage2 = new AntdUI.TabPage();
@ -62,16 +58,6 @@
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();
@ -86,14 +72,9 @@
splitContainer2.Panel1.SuspendLayout();
splitContainer2.Panel2.SuspendLayout();
splitContainer2.SuspendLayout();
tabImgDisplay.SuspendLayout();
tabsStas.SuspendLayout();
tabPage3.SuspendLayout();
tabsConfig.SuspendLayout();
panel1.SuspendLayout();
panel3.SuspendLayout();
panel5.SuspendLayout();
panel7.SuspendLayout();
SuspendLayout();
//
// titlebar
@ -128,7 +109,7 @@
//
// pageHeader1
//
pageHeader1.Controls.Add(label1);
pageHeader1.Controls.Add(labuph);
pageHeader1.Controls.Add(divider2);
pageHeader1.DividerShow = true;
pageHeader1.Dock = DockStyle.Bottom;
@ -139,14 +120,14 @@
pageHeader1.TabIndex = 7;
pageHeader1.Text = "UPH";
//
// label1
// labuph
//
label1.AutoSize = true;
label1.Location = new Point(979, 10);
label1.Name = "label1";
label1.Size = new Size(64, 21);
label1.TabIndex = 1;
label1.Text = "100000";
labuph.AutoSize = true;
labuph.Location = new Point(59, 10);
labuph.Name = "labuph";
labuph.Size = new Size(64, 21);
labuph.TabIndex = 1;
labuph.Text = "100000";
//
// divider2
//
@ -215,7 +196,7 @@
splitContainer1.Panel2.BackColor = SystemColors.ButtonFace;
splitContainer1.Panel2.Controls.Add(tabsConfig);
splitContainer1.Size = new Size(1024, 500);
splitContainer1.SplitterDistance = 580;
splitContainer1.SplitterDistance = 606;
splitContainer1.SplitterIncrement = 2;
splitContainer1.SplitterWidth = 10;
splitContainer1.TabIndex = 0;
@ -233,8 +214,8 @@
//
// splitContainer2.Panel2
//
splitContainer2.Panel2.Controls.Add(tabsStas);
splitContainer2.Size = new Size(580, 500);
splitContainer2.Panel2.Controls.Add(richTextBox1);
splitContainer2.Size = new Size(606, 500);
splitContainer2.SplitterDistance = 320;
splitContainer2.TabIndex = 0;
//
@ -243,50 +224,19 @@
tabImgDisplay.Dock = DockStyle.Fill;
tabImgDisplay.Location = new Point(0, 0);
tabImgDisplay.Name = "tabImgDisplay";
tabImgDisplay.Pages.Add(tabMain);
tabImgDisplay.Size = new Size(580, 320);
tabImgDisplay.Style = styleCard1;
tabImgDisplay.Size = new Size(606, 320);
tabImgDisplay.Style = styleCard3;
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.Style = styleCard2;
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(374, 145);
richTextBox1.Size = new Size(606, 176);
richTextBox1.TabIndex = 0;
richTextBox1.Text = "";
richTextBox1.TextChanged += richTextBox1_TextChanged;
//
// tabsConfig
//
@ -294,8 +244,8 @@
tabsConfig.Location = new Point(0, 0);
tabsConfig.Name = "tabsConfig";
tabsConfig.Pages.Add(tabPage2);
tabsConfig.Size = new Size(434, 500);
tabsConfig.Style = styleCard3;
tabsConfig.Size = new Size(408, 500);
tabsConfig.Style = styleCard4;
tabsConfig.TabIndex = 2;
tabsConfig.Text = "tabs2";
//
@ -303,7 +253,7 @@
//
tabPage2.Location = new Point(3, 28);
tabPage2.Name = "tabPage2";
tabPage2.Size = new Size(428, 469);
tabPage2.Size = new Size(402, 469);
tabPage2.TabIndex = 0;
tabPage2.Text = "配置";
//
@ -384,66 +334,66 @@
segmented1.Font = new Font("Microsoft YaHei UI", 9F);
segmented1.ForeColor = Color.White;
segmented1.Full = true;
segmentedItem1.Badge = null;
segmentedItem1.BadgeAlign = AntdUI.TAlignFrom.TR;
segmentedItem1.BadgeBack = null;
segmentedItem1.BadgeMode = false;
segmentedItem1.BadgeOffsetX = 0;
segmentedItem1.BadgeOffsetY = 0;
segmentedItem1.BadgeSize = 0.6F;
segmentedItem1.BadgeSvg = null;
segmentedItem1.IconActiveSvg = resources.GetString("segmentedItem1.IconActiveSvg");
segmentedItem1.IconSvg = resources.GetString("segmentedItem1.IconSvg");
segmentedItem1.Text = "启动";
segmentedItem2.Badge = null;
segmentedItem2.BadgeAlign = AntdUI.TAlignFrom.TR;
segmentedItem2.BadgeBack = null;
segmentedItem2.BadgeMode = false;
segmentedItem2.BadgeOffsetX = 0;
segmentedItem2.BadgeOffsetY = 0;
segmentedItem2.BadgeSize = 0.6F;
segmentedItem2.BadgeSvg = null;
segmentedItem2.IconActiveSvg = resources.GetString("segmentedItem2.IconActiveSvg");
segmentedItem2.IconSvg = resources.GetString("segmentedItem2.IconSvg");
segmentedItem2.Text = "停止";
segmentedItem3.Badge = null;
segmentedItem3.BadgeAlign = AntdUI.TAlignFrom.TR;
segmentedItem3.BadgeBack = null;
segmentedItem3.BadgeMode = false;
segmentedItem3.BadgeOffsetX = 0;
segmentedItem3.BadgeOffsetY = 0;
segmentedItem3.BadgeSize = 0.6F;
segmentedItem3.BadgeSvg = null;
segmentedItem3.IconActiveSvg = resources.GetString("segmentedItem3.IconActiveSvg");
segmentedItem3.IconSvg = resources.GetString("segmentedItem3.IconSvg");
segmentedItem3.Text = "复位";
segmentedItem4.Badge = null;
segmentedItem4.BadgeAlign = AntdUI.TAlignFrom.TR;
segmentedItem4.BadgeBack = null;
segmentedItem4.BadgeMode = false;
segmentedItem4.BadgeOffsetX = 0;
segmentedItem4.BadgeOffsetY = 0;
segmentedItem4.BadgeSize = 0.6F;
segmentedItem4.BadgeSvg = null;
segmentedItem4.IconActiveSvg = resources.GetString("segmentedItem4.IconActiveSvg");
segmentedItem4.IconSvg = resources.GetString("segmentedItem4.IconSvg");
segmentedItem4.Text = "登录";
segmentedItem5.Badge = null;
segmentedItem5.BadgeAlign = AntdUI.TAlignFrom.TR;
segmentedItem5.BadgeBack = null;
segmentedItem5.BadgeMode = false;
segmentedItem5.BadgeOffsetX = 0;
segmentedItem5.BadgeOffsetY = 0;
segmentedItem5.BadgeSize = 0.6F;
segmentedItem5.BadgeSvg = null;
segmentedItem5.IconActiveSvg = resources.GetString("segmentedItem5.IconActiveSvg");
segmentedItem5.IconSvg = resources.GetString("segmentedItem5.IconSvg");
segmentedItem5.Text = "设置";
segmented1.Items.Add(segmentedItem1);
segmented1.Items.Add(segmentedItem2);
segmented1.Items.Add(segmentedItem3);
segmented1.Items.Add(segmentedItem4);
segmented1.Items.Add(segmentedItem5);
segmentedItem6.Badge = null;
segmentedItem6.BadgeAlign = AntdUI.TAlignFrom.TR;
segmentedItem6.BadgeBack = null;
segmentedItem6.BadgeMode = false;
segmentedItem6.BadgeOffsetX = 0;
segmentedItem6.BadgeOffsetY = 0;
segmentedItem6.BadgeSize = 0.6F;
segmentedItem6.BadgeSvg = null;
segmentedItem6.IconActiveSvg = resources.GetString("segmentedItem6.IconActiveSvg");
segmentedItem6.IconSvg = resources.GetString("segmentedItem6.IconSvg");
segmentedItem6.Text = "启动";
segmentedItem7.Badge = null;
segmentedItem7.BadgeAlign = AntdUI.TAlignFrom.TR;
segmentedItem7.BadgeBack = null;
segmentedItem7.BadgeMode = false;
segmentedItem7.BadgeOffsetX = 0;
segmentedItem7.BadgeOffsetY = 0;
segmentedItem7.BadgeSize = 0.6F;
segmentedItem7.BadgeSvg = null;
segmentedItem7.IconActiveSvg = resources.GetString("segmentedItem7.IconActiveSvg");
segmentedItem7.IconSvg = resources.GetString("segmentedItem7.IconSvg");
segmentedItem7.Text = "停止";
segmentedItem8.Badge = null;
segmentedItem8.BadgeAlign = AntdUI.TAlignFrom.TR;
segmentedItem8.BadgeBack = null;
segmentedItem8.BadgeMode = false;
segmentedItem8.BadgeOffsetX = 0;
segmentedItem8.BadgeOffsetY = 0;
segmentedItem8.BadgeSize = 0.6F;
segmentedItem8.BadgeSvg = null;
segmentedItem8.IconActiveSvg = resources.GetString("segmentedItem8.IconActiveSvg");
segmentedItem8.IconSvg = resources.GetString("segmentedItem8.IconSvg");
segmentedItem8.Text = "复位";
segmentedItem9.Badge = null;
segmentedItem9.BadgeAlign = AntdUI.TAlignFrom.TR;
segmentedItem9.BadgeBack = null;
segmentedItem9.BadgeMode = false;
segmentedItem9.BadgeOffsetX = 0;
segmentedItem9.BadgeOffsetY = 0;
segmentedItem9.BadgeSize = 0.6F;
segmentedItem9.BadgeSvg = null;
segmentedItem9.IconActiveSvg = resources.GetString("segmentedItem9.IconActiveSvg");
segmentedItem9.IconSvg = resources.GetString("segmentedItem9.IconSvg");
segmentedItem9.Text = "登录";
segmentedItem10.Badge = null;
segmentedItem10.BadgeAlign = AntdUI.TAlignFrom.TR;
segmentedItem10.BadgeBack = null;
segmentedItem10.BadgeMode = false;
segmentedItem10.BadgeOffsetX = 0;
segmentedItem10.BadgeOffsetY = 0;
segmentedItem10.BadgeSize = 0.6F;
segmentedItem10.BadgeSvg = null;
segmentedItem10.IconActiveSvg = resources.GetString("segmentedItem10.IconActiveSvg");
segmentedItem10.IconSvg = resources.GetString("segmentedItem10.IconSvg");
segmentedItem10.Text = "设置";
segmented1.Items.Add(segmentedItem6);
segmented1.Items.Add(segmentedItem7);
segmented1.Items.Add(segmentedItem8);
segmented1.Items.Add(segmentedItem9);
segmented1.Items.Add(segmentedItem10);
segmented1.Location = new Point(0, 0);
segmented1.Name = "segmented1";
segmented1.Size = new Size(491, 68);
@ -451,103 +401,6 @@
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);
@ -578,15 +431,9 @@
splitContainer2.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)splitContainer2).EndInit();
splitContainer2.ResumeLayout(false);
tabImgDisplay.ResumeLayout(false);
tabsStas.ResumeLayout(false);
tabPage3.ResumeLayout(false);
tabsConfig.ResumeLayout(false);
panel1.ResumeLayout(false);
panel3.ResumeLayout(false);
panel5.ResumeLayout(false);
panel5.PerformLayout();
panel7.ResumeLayout(false);
ResumeLayout(false);
}
@ -601,15 +448,11 @@
private AntdUI.Panel panel2;
private AntdUI.Panel panel4;
private AntdUI.Panel panel6;
private Label label1;
private Label labuph;
private AntdUI.Splitter splitter1;
private SplitContainer splitContainer1;
private SplitContainer splitContainer2;
private AntdUI.Tabs tabImgDisplay;
private AntdUI.TabPage tabMain;
private AntdUI.Tabs tabsStas;
private AntdUI.TabPage tabPage3;
private RichTextBox richTextBox1;
private AntdUI.Tabs tabsConfig;
private AntdUI.TabPage tabPage2;
private AntdUI.Label lbName;
@ -618,15 +461,6 @@
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;
}
}

View File

@ -176,11 +176,11 @@ namespace DHSoftware
InitData();
//绑定事件
BindEventHandler();
UserConfigFrm userControlFrm = new UserConfigFrm();
//UserConfigFrm userControlFrm = new UserConfigFrm();
userControlFrm.Window = this;
userControlFrm.Dock = DockStyle.Fill;
tabPage2.Controls.Add(userControlFrm);
//userControlFrm.Window = this;
//userControlFrm.Dock = DockStyle.Fill;
//tabPage2.Controls.Add(userControlFrm);
}
/// <summary>
@ -267,7 +267,7 @@ namespace DHSoftware
cam.CameraIP = cameraBase.CameraIP;
cam.IsEnabled = cameraBase.IsEnabled;
Cameras.Add(cam);
//cam.CameraConnect();
cam.CameraConnect();
cam.OnHImageOutput += OnCameraHImageOutput;
}
else if (cameraBase.CamType == EnumCamType.hik)
@ -294,6 +294,7 @@ namespace DHSoftware
if (plcBase.PLCType == EnumPLCType.XC网口)
{
PLC.IP = plcBase.IP;
PLC.PLCType = plcBase.PLCType;
PLC.Enable = plcBase.Enable;
PLC.PLCName = plcBase.PLCName;
PLC.PLCItemList = plcBase.PLCItemList;
@ -321,8 +322,10 @@ namespace DHSoftware
detectionConfig.ModelHeight = detection.ModelHeight;
detectionConfig.In_lable_path = detection.In_lable_path;
detectionConfig.IsEnabled = detection.IsEnabled;
detectionConfig.ShowLocation.X = detection.ShowLocation.X;
detectionConfig.ShowLocation.Y = detection.ShowLocation.Y;
detectionConfig.ShowLocation.X = (i + 1) % 5+ (i + 1) / 5;
// detectionConfig.ShowLocation.X = detection.ShowLocation.X;
detectionConfig.ShowLocation.Y = (i + 1) / 5+1;
// detectionConfig.ShowLocation.Y = detection.ShowLocation.Y;
DetectionConfigs.Add(detectionConfig);
}
}
@ -354,6 +357,7 @@ namespace DHSoftware
//初始化模型 加载模型
_visionEngine.Init();
CtrlVisionRunBase ctrlVisionRun = new CtrlVisionRunBase(_visionEngine);
ctrlVisionRun.Dock = DockStyle.Fill;
tabImgDisplay.Controls.Add(ctrlVisionRun);
}
@ -508,7 +512,6 @@ namespace DHSoftware
{
camera.CameraDisConnect();
}
if (PLC != null)
PLC.PLCDisConnect();
CloseWindow.Instance.Close();// 关闭提示窗口
//Application.Exit();
@ -567,7 +570,7 @@ 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 ProcessstartTime;
public DateTime startTime;
private void HandleStartButton()
{
@ -578,16 +581,17 @@ namespace DHSoftware
private void StartProcess()
{
ProcessstartTime= DateTime.Now;
lblstarttime.Text = ProcessstartTime.ToString("yyyy-MM-dd HH:mm:ss")
startTime= DateTime.Now;
//计数清零
PieceCount = 0;
//吹气点位归置
currentRegister = 411;
if (_PLCConfig?.Enable == true)
if (PLC?.Enable == true)
{
PLC.CountToZero();
PLC.OnNewPieces -= MainMotion_NewPieces;
PLC.OnNewPieces += MainMotion_NewPieces;
}
ConfigModel.CameraBaseList.ForEach(d =>
@ -687,11 +691,6 @@ namespace DHSoftware
_productLists.Add(products);
}
//流程执行时PLC
StartPLCAction();
// 转盘操作
// if (_PLC?.IIConfig?.IsEnabled == true)
@ -699,7 +698,7 @@ namespace DHSoftware
PLCItem itemSpeed = PLC.PLCItemList.FirstOrDefault(u => u.Name == "转盘速度");
if (itemSpeed != null)
{
PLC.TurntableOpen(Convert.ToInt32(itemSpeed.Value), true);
PLC.TurntableOpen();
}
Thread.Sleep(500);
@ -716,21 +715,6 @@ namespace DHSoftware
// MachineState = MachineState.Running;
}
/// <summary>
/// 流程开始执行PLC
/// </summary>
private void StartPLCAction()
{
if (PLC.PLCItemList?.Count > 0)
{
List<PLCItem> startPLCList = PLC.PLCItemList.Where(it => it.StartExecute).ToList();
if (startPLCList?.Count > 0)
{
}
}
}
private void PrepareMLEngine()
{
//if (_visionEngine == null)
@ -1407,16 +1391,13 @@ namespace DHSoftware
public void CalculateOEE()
{
TimeSpan timeSpan = DateTime.Now - ProcessstartTime;
TimeSpan timeSpan = DateTime.Now - startTime;
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();
}));
}
@ -1443,10 +1424,5 @@ namespace DHSoftware
private void splitter1_SplitterMoved(object sender, SplitterEventArgs e)
{
}
private void richTextBox1_TextChanged(object sender, EventArgs e)
{
}
}
}

View File

@ -117,34 +117,34 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="segmentedItem1.IconActiveSvg" xml:space="preserve">
<data name="segmentedItem6.IconActiveSvg" xml:space="preserve">
<value>&lt;svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"&gt;&lt;path d="M731.818667 500.280889L386.844444 239.729778a14.677333 14.677333 0 0 0-23.495111 11.719111v521.159111a14.677333 14.677333 0 0 0 23.495111 11.662222l344.860445-260.608a14.677333 14.677333 0 0 0 0.113778-23.381333z" fill="#FFFFFF"/&gt;&lt;path d="M512 1024a512 512 0 1 1 512-512 512.568889 512.568889 0 0 1-512 512z m0-946.915556A434.915556 434.915556 0 1 0 946.915556 512 435.427556 435.427556 0 0 0 512 77.084444z" fill="#FFFFFF"/&gt;&lt;/svg&gt;</value>
</data>
<data name="segmentedItem1.IconSvg" xml:space="preserve">
<data name="segmentedItem6.IconSvg" xml:space="preserve">
<value>&lt;svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"&gt;&lt;path d="M731.818667 500.280889L386.844444 239.729778a14.677333 14.677333 0 0 0-23.495111 11.719111v521.159111a14.677333 14.677333 0 0 0 23.495111 11.662222l344.860445-260.608a14.677333 14.677333 0 0 0 0.113778-23.381333z" fill="#FFFFFF"/&gt;&lt;path d="M512 1024a512 512 0 1 1 512-512 512.568889 512.568889 0 0 1-512 512z m0-946.915556A434.915556 434.915556 0 1 0 946.915556 512 435.427556 435.427556 0 0 0 512 77.084444z" fill="#FFFFFF"/&gt;&lt;/svg&gt;</value>
</data>
<data name="segmentedItem2.IconActiveSvg" xml:space="preserve">
<data name="segmentedItem7.IconActiveSvg" xml:space="preserve">
<value>&lt;svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"&gt;&lt;path d="M365.014704 657.815846H657.084939V365.74561H365.014704V657.815846zm584.140471-146.035118c0-240.906781-197.125482-438.105353-438.105353-438.105353-240.979872 0-438.105353 197.198572-438.105354 438.105353 0 240.979872 197.125482 438.178444 438.105354 438.178444 240.979872 0 438.105353-197.198572 438.105353-438.178444zM511.634547 0.730906c281.399001 0 511.634547 230.235546 511.634547 511.634547s-230.235546 511.634547-511.634547 511.634547-511.634547-230.235546-511.634547-511.634547 230.235546-511.634547 511.634547-511.634547z" fill="#FFFFFF"/&gt;&lt;/svg&gt;</value>
</data>
<data name="segmentedItem2.IconSvg" xml:space="preserve">
<data name="segmentedItem7.IconSvg" xml:space="preserve">
<value>&lt;svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"&gt;&lt;path d="M365.014704 657.815846H657.084939V365.74561H365.014704V657.815846zm584.140471-146.035118c0-240.906781-197.125482-438.105353-438.105353-438.105353-240.979872 0-438.105353 197.198572-438.105354 438.105353 0 240.979872 197.125482 438.178444 438.105354 438.178444 240.979872 0 438.105353-197.198572 438.105353-438.178444zM511.634547 0.730906c281.399001 0 511.634547 230.235546 511.634547 511.634547s-230.235546 511.634547-511.634547 511.634547-511.634547-230.235546-511.634547-511.634547 230.235546-511.634547 511.634547-511.634547z" fill="#FFFFFF"/&gt;&lt;/svg&gt;</value>
</data>
<data name="segmentedItem3.IconActiveSvg" xml:space="preserve">
<data name="segmentedItem8.IconActiveSvg" xml:space="preserve">
<value>&lt;svg viewBox="0 0 1027 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"&gt;&lt;path d="M512 0C229.376 0 0 229.376 0 512s229.376 512 512 512 512-229.376 512-512S794.624 0 512 0zm0 963.584c-249.344 0-451.584-202.24-451.584-451.584S262.656 60.416 512 60.416s451.584 202.24 451.584 451.584-202.24 451.584-451.584 451.584z" fill="#FFFFFF"/&gt;&lt;path d="M527.36 351.744V292.864L410.624 380.416 527.36 468.48V410.624c72.192 8.192 124.416 73.216 116.224 145.408-8.192 72.192-73.216 124.416-145.408 116.224-66.56-7.168-117.248-64-117.248-131.072-0.512-5.12-0.512-9.728 0-14.848H323.584c-0.512 5.12-0.512 9.728 0 14.848 0 104.96 85.504 189.952 190.464 189.952s189.952-85.504 189.952-190.464c-0.512-99.328-77.312-181.76-176.64-188.928z" fill="#FFFFFF"/&gt;&lt;/svg&gt;</value>
</data>
<data name="segmentedItem3.IconSvg" xml:space="preserve">
<data name="segmentedItem8.IconSvg" xml:space="preserve">
<value>&lt;svg viewBox="0 0 1027 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"&gt;&lt;path d="M512 0C229.376 0 0 229.376 0 512s229.376 512 512 512 512-229.376 512-512S794.624 0 512 0zm0 963.584c-249.344 0-451.584-202.24-451.584-451.584S262.656 60.416 512 60.416s451.584 202.24 451.584 451.584-202.24 451.584-451.584 451.584z" fill="#FFFFFF"/&gt;&lt;path d="M527.36 351.744V292.864L410.624 380.416 527.36 468.48V410.624c72.192 8.192 124.416 73.216 116.224 145.408-8.192 72.192-73.216 124.416-145.408 116.224-66.56-7.168-117.248-64-117.248-131.072-0.512-5.12-0.512-9.728 0-14.848H323.584c-0.512 5.12-0.512 9.728 0 14.848 0 104.96 85.504 189.952 190.464 189.952s189.952-85.504 189.952-190.464c-0.512-99.328-77.312-181.76-176.64-188.928z" fill="#FFFFFF"/&gt;&lt;/svg&gt;</value>
</data>
<data name="segmentedItem4.IconActiveSvg" xml:space="preserve">
<data name="segmentedItem9.IconActiveSvg" xml:space="preserve">
<value>&lt;svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"&gt;&lt;path d="M512 0C229.376 0 0 229.376 0 512s229.376 512 512 512 512-229.376 512-512S794.624 0 512 0zm0 963.584c-249.344 0-451.584-202.24-451.584-451.584S262.656 60.416 512 60.416s451.584 202.24 451.584 451.584-202.24 451.584-451.584 451.584z" fill="#FFFFFF"/&gt;&lt;path transform="scale(0.8) translate(128,128)" d="M960.853333 903.816533a463.633067 463.633067 0 0 0-11.264-39.185066c-1.536-4.539733-3.413333-8.942933-5.051733-13.448534a484.078933 484.078933 0 0 0-9.557333-24.4736c-2.2528-5.188267-4.881067-10.274133-7.338667-15.394133-3.413333-7.099733-6.8608-14.165333-10.6496-21.0944-2.901333-5.3248-6.075733-10.513067-9.181867-15.701333-2.423467-4.061867-4.573867-8.226133-7.133866-12.219734-1.604267-2.4576-3.413333-4.778667-5.0176-7.202133-1.501867-2.218667-2.730667-4.608-4.266667-6.792533-0.4096-0.6144-1.058133-0.887467-1.501867-1.4336a461.482667 461.482667 0 0 0-90.385066-96.768c-13.5168-10.786133-27.7504-20.48-42.257067-29.5936-0.477867-0.341333-0.7168-0.8192-1.194667-1.1264-3.6864-2.286933-7.509333-4.3008-11.264-6.485334-4.266667-2.491733-8.4992-5.051733-12.868266-7.441066-6.826667-3.6864-13.789867-7.099733-20.753067-10.478934-3.618133-1.7408-7.202133-3.618133-10.8544-5.290666a449.194667 449.194667 0 0 0-31.607467-12.731734c-0.7168-0.273067-1.365333-0.6144-2.082133-0.8192-3.140267-1.1264-6.417067-1.911467-9.557333-2.935466-4.164267-1.399467-8.328533-2.833067-12.561067-4.096a259.9936 259.9936 0 0 0 129.194667-225.450667 260.061867 260.061867 0 0 0-76.629334-185.002667 259.9936 259.9936 0 0 0-185.002666-76.629333H512h-0.034133a259.857067 259.857067 0 0 0-185.002667 76.629333 259.925333 259.925333 0 0 0-76.629333 185.002667 259.584 259.584 0 0 0 76.629333 185.002667c15.906133 15.940267 33.655467 29.2864 52.565333 40.448-4.266667 1.262933-8.430933 2.730667-12.663466 4.096-3.140267 1.058133-6.3488 1.8432-9.489067 2.935466-0.7168 0.238933-1.365333 0.580267-2.048 0.8192-10.683733 3.822933-21.265067 8.0896-31.675733 12.765867-3.584 1.604267-7.0656 3.4816-10.615467 5.154133-7.099733 3.413333-14.165333 6.826667-21.0944 10.615467-4.266667 2.321067-8.3968 4.8128-12.561067 7.2704-3.822933 2.218667-7.748267 4.266667-11.502933 6.621867-0.512 0.3072-0.750933 0.8192-1.2288 1.160533-14.506667 9.147733-28.706133 18.807467-42.222933 29.559467a459.6736 459.6736 0 0 0-90.385067 96.768c-0.443733 0.546133-1.092267 0.8192-1.501867 1.4336-1.536 2.184533-2.7648 4.573867-4.266666 6.792533-1.604267 2.423467-3.447467 4.744533-5.0176 7.202133-2.56 3.9936-4.7104 8.157867-7.133867 12.219734-3.106133 5.188267-6.280533 10.376533-9.181867 15.701333-3.7888 6.929067-7.202133 13.994667-10.6496 21.0944-2.4576 5.12-5.051733 10.205867-7.338666 15.394133-3.515733 8.021333-6.519467 16.247467-9.557334 24.4736-1.672533 4.5056-3.549867 8.9088-5.051733 13.448534-4.3008 12.868267-8.0896 25.941333-11.264 39.185066-3.072 12.970667 2.594133 25.770667 13.073067 32.802134a31.3344 31.3344 0 0 0 9.966933 4.608 30.9248 30.9248 0 0 0 34.030933-15.2576 30.446933 30.446933 0 0 0 3.345067-7.7824c2.833067-11.844267 6.178133-23.483733 10.0352-34.9184 0.6144-1.8432 1.399467-3.549867 2.013867-5.358934 3.447467-9.762133 7.133867-19.456 11.332266-28.945066 0.512-1.160533 1.1264-2.2528 1.6384-3.447467 4.7104-10.308267 9.728-20.48 15.291734-30.344533l0.068266-0.1024a402.773333 402.773333 0 0 1 19.694934-31.4368l0.136533-0.375467a397.4144 397.4144 0 0 1 116.599467-111.2064c0.136533-0.1024 0.3072-0.068267 0.443733-0.170667a397.824 397.824 0 0 1 94.993067-42.973866c2.7648-0.8192 5.495467-1.7408 8.2944-2.491734 5.7344-1.604267 11.5712-3.003733 17.373866-4.334933a367.8208 367.8208 0 0 1 47.342934-7.953067c3.8912-0.443733 7.7824-0.9216 11.6736-1.2288 10.410667-0.785067 20.8896-1.3312 31.505066-1.3312s21.060267 0.546133 31.505067 1.3312c3.8912 0.3072 7.816533 0.785067 11.707733 1.2288a361.3696 361.3696 0 0 1 47.240534 7.953067c5.870933 1.3312 11.707733 2.730667 17.5104 4.334933 2.696533 0.750933 5.358933 1.6384 8.021333 2.4576 33.348267 10.103467 65.365333 24.405333 95.197867 43.008 0.136533 0.1024 0.3072 0.068267 0.443733 0.170667a396.151467 396.151467 0 0 1 116.599467 111.2064c0.1024 0.136533 0.1024 0.273067 0.170666 0.375467 13.687467 19.7632 25.3952 40.5504 35.191467 62.1568l1.467733 3.037866c4.3008 9.659733 8.055467 19.592533 11.605334 29.5936 0.546133 1.604267 1.2288 3.106133 1.774933 4.7104 3.822933 11.4688 7.236267 23.176533 10.0352 35.0208a31.061333 31.061333 0 0 0 60.450133-14.336zm-249.275733-560.2304A199.850667 199.850667 0 0 1 512 543.197867a199.850667 199.850667 0 0 1-199.5776-199.611734A199.816533 199.816533 0 0 1 512 144.008533a199.816533 199.816533 0 0 1 199.5776 199.5776z" fill="#FFFFFF"/&gt;&lt;/svg&gt;</value>
</data>
<data name="segmentedItem4.IconSvg" xml:space="preserve">
<data name="segmentedItem9.IconSvg" xml:space="preserve">
<value>&lt;svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"&gt;&lt;path d="M512 0C229.376 0 0 229.376 0 512s229.376 512 512 512 512-229.376 512-512S794.624 0 512 0zm0 963.584c-249.344 0-451.584-202.24-451.584-451.584S262.656 60.416 512 60.416s451.584 202.24 451.584 451.584-202.24 451.584-451.584 451.584z" fill="#FFFFFF"/&gt;&lt;path transform="scale(0.8) translate(128,128)" d="M960.853333 903.816533a463.633067 463.633067 0 0 0-11.264-39.185066c-1.536-4.539733-3.413333-8.942933-5.051733-13.448534a484.078933 484.078933 0 0 0-9.557333-24.4736c-2.2528-5.188267-4.881067-10.274133-7.338667-15.394133-3.413333-7.099733-6.8608-14.165333-10.6496-21.0944-2.901333-5.3248-6.075733-10.513067-9.181867-15.701333-2.423467-4.061867-4.573867-8.226133-7.133866-12.219734-1.604267-2.4576-3.413333-4.778667-5.0176-7.202133-1.501867-2.218667-2.730667-4.608-4.266667-6.792533-0.4096-0.6144-1.058133-0.887467-1.501867-1.4336a461.482667 461.482667 0 0 0-90.385066-96.768c-13.5168-10.786133-27.7504-20.48-42.257067-29.5936-0.477867-0.341333-0.7168-0.8192-1.194667-1.1264-3.6864-2.286933-7.509333-4.3008-11.264-6.485334-4.266667-2.491733-8.4992-5.051733-12.868266-7.441066-6.826667-3.6864-13.789867-7.099733-20.753067-10.478934-3.618133-1.7408-7.202133-3.618133-10.8544-5.290666a449.194667 449.194667 0 0 0-31.607467-12.731734c-0.7168-0.273067-1.365333-0.6144-2.082133-0.8192-3.140267-1.1264-6.417067-1.911467-9.557333-2.935466-4.164267-1.399467-8.328533-2.833067-12.561067-4.096a259.9936 259.9936 0 0 0 129.194667-225.450667 260.061867 260.061867 0 0 0-76.629334-185.002667 259.9936 259.9936 0 0 0-185.002666-76.629333H512h-0.034133a259.857067 259.857067 0 0 0-185.002667 76.629333 259.925333 259.925333 0 0 0-76.629333 185.002667 259.584 259.584 0 0 0 76.629333 185.002667c15.906133 15.940267 33.655467 29.2864 52.565333 40.448-4.266667 1.262933-8.430933 2.730667-12.663466 4.096-3.140267 1.058133-6.3488 1.8432-9.489067 2.935466-0.7168 0.238933-1.365333 0.580267-2.048 0.8192-10.683733 3.822933-21.265067 8.0896-31.675733 12.765867-3.584 1.604267-7.0656 3.4816-10.615467 5.154133-7.099733 3.413333-14.165333 6.826667-21.0944 10.615467-4.266667 2.321067-8.3968 4.8128-12.561067 7.2704-3.822933 2.218667-7.748267 4.266667-11.502933 6.621867-0.512 0.3072-0.750933 0.8192-1.2288 1.160533-14.506667 9.147733-28.706133 18.807467-42.222933 29.559467a459.6736 459.6736 0 0 0-90.385067 96.768c-0.443733 0.546133-1.092267 0.8192-1.501867 1.4336-1.536 2.184533-2.7648 4.573867-4.266666 6.792533-1.604267 2.423467-3.447467 4.744533-5.0176 7.202133-2.56 3.9936-4.7104 8.157867-7.133867 12.219734-3.106133 5.188267-6.280533 10.376533-9.181867 15.701333-3.7888 6.929067-7.202133 13.994667-10.6496 21.0944-2.4576 5.12-5.051733 10.205867-7.338666 15.394133-3.515733 8.021333-6.519467 16.247467-9.557334 24.4736-1.672533 4.5056-3.549867 8.9088-5.051733 13.448534-4.3008 12.868267-8.0896 25.941333-11.264 39.185066-3.072 12.970667 2.594133 25.770667 13.073067 32.802134a31.3344 31.3344 0 0 0 9.966933 4.608 30.9248 30.9248 0 0 0 34.030933-15.2576 30.446933 30.446933 0 0 0 3.345067-7.7824c2.833067-11.844267 6.178133-23.483733 10.0352-34.9184 0.6144-1.8432 1.399467-3.549867 2.013867-5.358934 3.447467-9.762133 7.133867-19.456 11.332266-28.945066 0.512-1.160533 1.1264-2.2528 1.6384-3.447467 4.7104-10.308267 9.728-20.48 15.291734-30.344533l0.068266-0.1024a402.773333 402.773333 0 0 1 19.694934-31.4368l0.136533-0.375467a397.4144 397.4144 0 0 1 116.599467-111.2064c0.136533-0.1024 0.3072-0.068267 0.443733-0.170667a397.824 397.824 0 0 1 94.993067-42.973866c2.7648-0.8192 5.495467-1.7408 8.2944-2.491734 5.7344-1.604267 11.5712-3.003733 17.373866-4.334933a367.8208 367.8208 0 0 1 47.342934-7.953067c3.8912-0.443733 7.7824-0.9216 11.6736-1.2288 10.410667-0.785067 20.8896-1.3312 31.505066-1.3312s21.060267 0.546133 31.505067 1.3312c3.8912 0.3072 7.816533 0.785067 11.707733 1.2288a361.3696 361.3696 0 0 1 47.240534 7.953067c5.870933 1.3312 11.707733 2.730667 17.5104 4.334933 2.696533 0.750933 5.358933 1.6384 8.021333 2.4576 33.348267 10.103467 65.365333 24.405333 95.197867 43.008 0.136533 0.1024 0.3072 0.068267 0.443733 0.170667a396.151467 396.151467 0 0 1 116.599467 111.2064c0.1024 0.136533 0.1024 0.273067 0.170666 0.375467 13.687467 19.7632 25.3952 40.5504 35.191467 62.1568l1.467733 3.037866c4.3008 9.659733 8.055467 19.592533 11.605334 29.5936 0.546133 1.604267 1.2288 3.106133 1.774933 4.7104 3.822933 11.4688 7.236267 23.176533 10.0352 35.0208a31.061333 31.061333 0 0 0 60.450133-14.336zm-249.275733-560.2304A199.850667 199.850667 0 0 1 512 543.197867a199.850667 199.850667 0 0 1-199.5776-199.611734A199.816533 199.816533 0 0 1 512 144.008533a199.816533 199.816533 0 0 1 199.5776 199.5776z" fill="#FFFFFF"/&gt;&lt;/svg&gt;</value>
</data>
<data name="segmentedItem5.IconActiveSvg" xml:space="preserve">
<data name="segmentedItem10.IconActiveSvg" xml:space="preserve">
<value>&lt;svg viewBox="0 0 1027 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"&gt;&lt;path d="M512 0C229.376 0 0 229.376 0 512s229.376 512 512 512 512-229.376 512-512S794.624 0 512 0zm0 963.584c-249.344 0-451.584-202.24-451.584-451.584S262.656 60.416 512 60.416s451.584 202.24 451.584 451.584-202.24 451.584-451.584 451.584z" fill="#FFFFFF"/&gt;&lt;path d="M437.314 840.84l-18.967-5.795c-43.935-13.425-84.182-35.551-119.623-65.767l-15.203-12.962 11.199-16.544c17.376-25.668 17.938-59.158 1.433-85.319-14.356-22.787-39.028-36.385-66.006-36.385-4.102 0-8.229 0.328-12.267 0.974l-19.752 3.158-5.301-19.288c-8.196-29.823-12.353-59.896-12.353-89.381 0-19.675 1.863-39.491 5.694-60.582l3.652-20.105 20.349 1.862c2.343 0.214 4.726 0.323 7.081 0.323 29.007 0 55.436-15.908 68.974-41.516 14.941-28.2 11.264-62.223-9.356-86.694l-13.166-15.625L278.1 276.7c38.694-38.954 86.677-68.095 138.76-84.273l19.741-6.132 7.631 19.211c11.88 29.908 40.312 49.234 72.432 49.234 32.097 0 60.521-19.328 72.413-49.241l7.632-19.197 19.73 6.122c43.968 13.642 84.295 36.164 119.862 66.938l15.414 13.337-11.883 16.561c-18.636 25.975-19.684 60.166-2.671 87.105 14.369 22.78 39.055 36.373 66.04 36.372 4.344 0 8.71-0.366 12.978-1.087l20.143-3.403 5.176 19.762c7.539 28.792 11.362 57.566 11.362 85.522 0 21.328-2.143 43.048-6.365 64.554l-3.859 19.65-19.952-1.709a77.999 77.999 0 0 0-6.612-0.281c-28.998 0-55.44 15.917-69.009 41.542-14.47 27.405-11.311 60.816 8.063 85.095l12.496 15.661-14.222 14.111c-38.674 38.378-86.551 67.041-138.455 82.892l-18.968 5.792-7.988-18.152c-12.462-28.318-40.459-46.617-71.325-46.617-30.883 0-58.893 18.299-71.36 46.619l-7.99 18.152zm-95.455-94.18c22.324 16.82 46.59 30.174 72.469 39.881 22.445-34.023 60.731-55.125 102.336-55.125 41.59 0 79.862 21.1 102.303 55.12 32.745-12.298 63.249-30.557 89.663-53.667-19.709-35.774-20.525-79.555-1.04-116.455 19.699-37.203 56.634-61.386 98.053-64.883 1.705-12.731 2.565-25.453 2.565-38 0-18.339-1.923-37.155-5.729-56.144-42.123-0.241-80.616-21.581-103.077-57.189-22.944-36.331-25.024-81.029-6.697-118.768-22.165-16.932-46.203-30.4-71.788-40.221-8.847 14.328-20.577 26.719-34.618 36.447-20.522 14.219-44.602 21.735-69.635 21.735-25.044 0-49.131-7.516-69.657-21.734-14.042-9.727-25.773-22.116-34.618-36.441-32.551 12.503-62.856 30.935-89.106 54.196 21.198 36.233 22.547 80.974 2.407 118.987-19.71 37.285-56.808 61.499-98.402 64.875-1.45 11.713-2.161 23.035-2.161 34.255 0 19.715 2.166 39.792 6.449 59.894 41.851 0.474 80.029 21.785 102.35 57.214 22.218 35.217 24.782 78.871 7.933 116.023z" fill="#FFFFFF"/&gt;&lt;path d="M516.664 633.864c-66.246 0-120.141-53.897-120.141-120.147 0-66.249 53.895-120.146 120.141-120.146 66.237 0 120.127 53.897 120.127 120.146 0 66.25-53.89 120.147-120.127 120.147zm0-195.641c-41.625 0-75.488 33.866-75.488 75.494s33.863 75.495 75.488 75.495c41.617 0 75.475-33.867 75.475-75.495s-33.858-75.494-75.475-75.494z" fill="#FFFFFF"/&gt;&lt;/svg&gt;</value>
</data>
<data name="segmentedItem5.IconSvg" xml:space="preserve">
<data name="segmentedItem10.IconSvg" xml:space="preserve">
<value>&lt;svg viewBox="0 0 1027 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"&gt;&lt;path d="M512 0C229.376 0 0 229.376 0 512s229.376 512 512 512 512-229.376 512-512S794.624 0 512 0zm0 963.584c-249.344 0-451.584-202.24-451.584-451.584S262.656 60.416 512 60.416s451.584 202.24 451.584 451.584-202.24 451.584-451.584 451.584z" fill="#FFFFFF"/&gt;&lt;path d="M437.314 840.84l-18.967-5.795c-43.935-13.425-84.182-35.551-119.623-65.767l-15.203-12.962 11.199-16.544c17.376-25.668 17.938-59.158 1.433-85.319-14.356-22.787-39.028-36.385-66.006-36.385-4.102 0-8.229 0.328-12.267 0.974l-19.752 3.158-5.301-19.288c-8.196-29.823-12.353-59.896-12.353-89.381 0-19.675 1.863-39.491 5.694-60.582l3.652-20.105 20.349 1.862c2.343 0.214 4.726 0.323 7.081 0.323 29.007 0 55.436-15.908 68.974-41.516 14.941-28.2 11.264-62.223-9.356-86.694l-13.166-15.625L278.1 276.7c38.694-38.954 86.677-68.095 138.76-84.273l19.741-6.132 7.631 19.211c11.88 29.908 40.312 49.234 72.432 49.234 32.097 0 60.521-19.328 72.413-49.241l7.632-19.197 19.73 6.122c43.968 13.642 84.295 36.164 119.862 66.938l15.414 13.337-11.883 16.561c-18.636 25.975-19.684 60.166-2.671 87.105 14.369 22.78 39.055 36.373 66.04 36.372 4.344 0 8.71-0.366 12.978-1.087l20.143-3.403 5.176 19.762c7.539 28.792 11.362 57.566 11.362 85.522 0 21.328-2.143 43.048-6.365 64.554l-3.859 19.65-19.952-1.709a77.999 77.999 0 0 0-6.612-0.281c-28.998 0-55.44 15.917-69.009 41.542-14.47 27.405-11.311 60.816 8.063 85.095l12.496 15.661-14.222 14.111c-38.674 38.378-86.551 67.041-138.455 82.892l-18.968 5.792-7.988-18.152c-12.462-28.318-40.459-46.617-71.325-46.617-30.883 0-58.893 18.299-71.36 46.619l-7.99 18.152zm-95.455-94.18c22.324 16.82 46.59 30.174 72.469 39.881 22.445-34.023 60.731-55.125 102.336-55.125 41.59 0 79.862 21.1 102.303 55.12 32.745-12.298 63.249-30.557 89.663-53.667-19.709-35.774-20.525-79.555-1.04-116.455 19.699-37.203 56.634-61.386 98.053-64.883 1.705-12.731 2.565-25.453 2.565-38 0-18.339-1.923-37.155-5.729-56.144-42.123-0.241-80.616-21.581-103.077-57.189-22.944-36.331-25.024-81.029-6.697-118.768-22.165-16.932-46.203-30.4-71.788-40.221-8.847 14.328-20.577 26.719-34.618 36.447-20.522 14.219-44.602 21.735-69.635 21.735-25.044 0-49.131-7.516-69.657-21.734-14.042-9.727-25.773-22.116-34.618-36.441-32.551 12.503-62.856 30.935-89.106 54.196 21.198 36.233 22.547 80.974 2.407 118.987-19.71 37.285-56.808 61.499-98.402 64.875-1.45 11.713-2.161 23.035-2.161 34.255 0 19.715 2.166 39.792 6.449 59.894 41.851 0.474 80.029 21.785 102.35 57.214 22.218 35.217 24.782 78.871 7.933 116.023z" fill="#FFFFFF"/&gt;&lt;path d="M516.664 633.864c-66.246 0-120.141-53.897-120.141-120.147 0-66.249 53.895-120.146 120.141-120.146 66.237 0 120.127 53.897 120.127 120.146 0 66.25-53.89 120.147-120.127 120.147zm0-195.641c-41.625 0-75.488 33.866-75.488 75.494s33.863 75.495 75.488 75.495c41.617 0 75.475-33.867 75.475-75.495s-33.858-75.494-75.475-75.494z" fill="#FFFFFF"/&gt;&lt;/svg&gt;</value>
</data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

View File

@ -28,7 +28,6 @@
/// </summary>
private void InitializeComponent()
{
AntdUI.Tabs.StyleLine styleLine1 = new AntdUI.Tabs.StyleLine();
stackPanel2 = new AntdUI.StackPanel();
swhEnable = new AntdUI.Switch();
label4 = new AntdUI.Label();
@ -57,32 +56,9 @@
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();
tabPage2 = new AntdUI.TabPage();
TableSartProcess = new AntdUI.Table();
panel2 = new AntdUI.Panel();
btnSartProcessDelete = new AntdUI.Button();
btnSartProcessAdd = new AntdUI.Button();
tabPage3 = new AntdUI.TabPage();
TableStopProcess = new AntdUI.Table();
panel3 = new AntdUI.Panel();
btnStopProcessDelete = new AntdUI.Button();
btnStopProcessAdd = new AntdUI.Button();
tabPage4 = new AntdUI.TabPage();
TableStartReset = new AntdUI.Table();
panel4 = new AntdUI.Panel();
btnStartResetDelete = new AntdUI.Button();
btnStartResetAdd = new AntdUI.Button();
tabPage5 = new AntdUI.TabPage();
TableStopReset = new AntdUI.Table();
panel5 = new AntdUI.Panel();
btnStopResetDelete = new AntdUI.Button();
btnStopResetAdd = new AntdUI.Button();
stackPanel2.SuspendLayout();
stackPanel3.SuspendLayout();
stpCom.SuspendLayout();
@ -93,17 +69,6 @@
stpStop.SuspendLayout();
stpData.SuspendLayout();
stpBaud.SuspendLayout();
tabs1.SuspendLayout();
tabPage1.SuspendLayout();
panel1.SuspendLayout();
tabPage2.SuspendLayout();
panel2.SuspendLayout();
tabPage3.SuspendLayout();
panel3.SuspendLayout();
tabPage4.SuspendLayout();
panel4.SuspendLayout();
tabPage5.SuspendLayout();
panel5.SuspendLayout();
SuspendLayout();
//
// stackPanel2
@ -199,10 +164,9 @@
stackPanel1.Controls.Add(stpCom);
stackPanel1.Controls.Add(stackPanel3);
stackPanel1.Controls.Add(stackPanel2);
stackPanel1.Dock = DockStyle.Left;
stackPanel1.Location = new Point(0, 0);
stackPanel1.Location = new Point(19, 16);
stackPanel1.Name = "stackPanel1";
stackPanel1.Size = new Size(223, 530);
stackPanel1.Size = new Size(223, 478);
stackPanel1.TabIndex = 25;
stackPanel1.Text = "stackPanel1";
stackPanel1.Vertical = true;
@ -367,63 +331,22 @@
label3.TabIndex = 24;
label3.Text = "波 特 率";
//
// tabs1
//
tabs1.Dock = DockStyle.Fill;
tabs1.Location = new Point(223, 0);
tabs1.Name = "tabs1";
tabs1.Pages.Add(tabPage1);
tabs1.Pages.Add(tabPage2);
tabs1.Pages.Add(tabPage3);
tabs1.Pages.Add(tabPage4);
tabs1.Pages.Add(tabPage5);
tabs1.Size = new Size(675, 530);
tabs1.Style = styleLine1;
tabs1.TabIndex = 26;
tabs1.Text = "tabs1";
tabs1.SelectedIndex = 0;
//
// tabPage1
//
tabPage1.Controls.Add(PLCItemsTable);
tabPage1.Controls.Add(panel1);
tabPage1.Location = new Point(3, 28);
tabPage1.Name = "tabPage1";
tabPage1.Size = new Size(669, 499);
tabPage1.TabIndex = 0;
tabPage1.Text = "点位表";
//
// PLCItemsTable
//
PLCItemsTable.Dock = DockStyle.Fill;
PLCItemsTable.EmptyHeader = true;
PLCItemsTable.Location = new Point(0, 45);
PLCItemsTable.Location = new Point(238, 71);
PLCItemsTable.Name = "PLCItemsTable";
PLCItemsTable.Padding = new Padding(5);
PLCItemsTable.Size = new Size(669, 454);
PLCItemsTable.TabIndex = 36;
PLCItemsTable.Size = new Size(634, 392);
PLCItemsTable.TabIndex = 26;
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(110, 10);
btnDelete.Location = new Point(331, 27);
btnDelete.Name = "btnDelete";
btnDelete.Size = new Size(74, 32);
btnDelete.TabIndex = 36;
btnDelete.Size = new Size(80, 32);
btnDelete.TabIndex = 28;
btnDelete.Text = "删除";
btnDelete.Type = AntdUI.TTypeMini.Error;
btnDelete.WaveSize = 0;
@ -431,243 +354,21 @@
// btnAdd
//
btnAdd.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
btnAdd.Location = new Point(13, 10);
btnAdd.Location = new Point(245, 27);
btnAdd.Name = "btnAdd";
btnAdd.Size = new Size(82, 32);
btnAdd.TabIndex = 35;
btnAdd.Size = new Size(80, 32);
btnAdd.TabIndex = 27;
btnAdd.Text = "新增";
btnAdd.Type = AntdUI.TTypeMini.Primary;
btnAdd.WaveSize = 0;
//
// tabPage2
//
tabPage2.Controls.Add(TableSartProcess);
tabPage2.Controls.Add(panel2);
tabPage2.Location = new Point(-669, -499);
tabPage2.Name = "tabPage2";
tabPage2.Size = new Size(669, 499);
tabPage2.TabIndex = 1;
tabPage2.Text = "流程启动表";
//
// TableSartProcess
//
TableSartProcess.Dock = DockStyle.Fill;
TableSartProcess.EmptyHeader = true;
TableSartProcess.Location = new Point(0, 45);
TableSartProcess.Name = "TableSartProcess";
TableSartProcess.Padding = new Padding(5);
TableSartProcess.Size = new Size(669, 454);
TableSartProcess.TabIndex = 38;
TableSartProcess.Text = "table1";
//
// panel2
//
panel2.Back = Color.Transparent;
panel2.BackColor = SystemColors.Window;
panel2.Controls.Add(btnSartProcessDelete);
panel2.Controls.Add(btnSartProcessAdd);
panel2.Dock = DockStyle.Top;
panel2.Location = new Point(0, 0);
panel2.Name = "panel2";
panel2.Size = new Size(669, 45);
panel2.TabIndex = 37;
panel2.Text = "panel2";
//
// btnSartProcessDelete
//
btnSartProcessDelete.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
btnSartProcessDelete.Location = new Point(110, 10);
btnSartProcessDelete.Name = "btnSartProcessDelete";
btnSartProcessDelete.Size = new Size(74, 32);
btnSartProcessDelete.TabIndex = 36;
btnSartProcessDelete.Text = "删除";
btnSartProcessDelete.Type = AntdUI.TTypeMini.Error;
btnSartProcessDelete.WaveSize = 0;
//
// btnSartProcessAdd
//
btnSartProcessAdd.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
btnSartProcessAdd.Location = new Point(13, 10);
btnSartProcessAdd.Name = "btnSartProcessAdd";
btnSartProcessAdd.Size = new Size(82, 32);
btnSartProcessAdd.TabIndex = 35;
btnSartProcessAdd.Text = "新增";
btnSartProcessAdd.Type = AntdUI.TTypeMini.Primary;
btnSartProcessAdd.WaveSize = 0;
//
// tabPage3
//
tabPage3.Controls.Add(TableStopProcess);
tabPage3.Controls.Add(panel3);
tabPage3.Location = new Point(-669, -499);
tabPage3.Name = "tabPage3";
tabPage3.Size = new Size(669, 499);
tabPage3.TabIndex = 2;
tabPage3.Text = "流程结束表";
//
// TableStopProcess
//
TableStopProcess.Dock = DockStyle.Fill;
TableStopProcess.EmptyHeader = true;
TableStopProcess.Location = new Point(0, 45);
TableStopProcess.Name = "TableStopProcess";
TableStopProcess.Padding = new Padding(5);
TableStopProcess.Size = new Size(669, 454);
TableStopProcess.TabIndex = 38;
TableStopProcess.Text = "table1";
//
// panel3
//
panel3.Back = Color.Transparent;
panel3.BackColor = SystemColors.Window;
panel3.Controls.Add(btnStopProcessDelete);
panel3.Controls.Add(btnStopProcessAdd);
panel3.Dock = DockStyle.Top;
panel3.Location = new Point(0, 0);
panel3.Name = "panel3";
panel3.Size = new Size(669, 45);
panel3.TabIndex = 37;
panel3.Text = "panel3";
//
// btnStopProcessDelete
//
btnStopProcessDelete.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
btnStopProcessDelete.Location = new Point(110, 10);
btnStopProcessDelete.Name = "btnStopProcessDelete";
btnStopProcessDelete.Size = new Size(74, 32);
btnStopProcessDelete.TabIndex = 36;
btnStopProcessDelete.Text = "删除";
btnStopProcessDelete.Type = AntdUI.TTypeMini.Error;
btnStopProcessDelete.WaveSize = 0;
//
// btnStopProcessAdd
//
btnStopProcessAdd.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
btnStopProcessAdd.Location = new Point(13, 10);
btnStopProcessAdd.Name = "btnStopProcessAdd";
btnStopProcessAdd.Size = new Size(82, 32);
btnStopProcessAdd.TabIndex = 35;
btnStopProcessAdd.Text = "新增";
btnStopProcessAdd.Type = AntdUI.TTypeMini.Primary;
btnStopProcessAdd.WaveSize = 0;
//
// tabPage4
//
tabPage4.Controls.Add(TableStartReset);
tabPage4.Controls.Add(panel4);
tabPage4.Location = new Point(-669, -499);
tabPage4.Name = "tabPage4";
tabPage4.Size = new Size(669, 499);
tabPage4.TabIndex = 3;
tabPage4.Text = "复位开始表";
//
// TableStartReset
//
TableStartReset.Dock = DockStyle.Fill;
TableStartReset.EmptyHeader = true;
TableStartReset.Location = new Point(0, 45);
TableStartReset.Name = "TableStartReset";
TableStartReset.Padding = new Padding(5);
TableStartReset.Size = new Size(669, 454);
TableStartReset.TabIndex = 38;
TableStartReset.Text = "table1";
//
// panel4
//
panel4.Back = Color.Transparent;
panel4.BackColor = SystemColors.Window;
panel4.Controls.Add(btnStartResetDelete);
panel4.Controls.Add(btnStartResetAdd);
panel4.Dock = DockStyle.Top;
panel4.Location = new Point(0, 0);
panel4.Name = "panel4";
panel4.Size = new Size(669, 45);
panel4.TabIndex = 37;
panel4.Text = "panel4";
//
// btnStartResetDelete
//
btnStartResetDelete.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
btnStartResetDelete.Location = new Point(110, 10);
btnStartResetDelete.Name = "btnStartResetDelete";
btnStartResetDelete.Size = new Size(74, 32);
btnStartResetDelete.TabIndex = 36;
btnStartResetDelete.Text = "删除";
btnStartResetDelete.Type = AntdUI.TTypeMini.Error;
btnStartResetDelete.WaveSize = 0;
//
// btnStartResetAdd
//
btnStartResetAdd.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
btnStartResetAdd.Location = new Point(13, 10);
btnStartResetAdd.Name = "btnStartResetAdd";
btnStartResetAdd.Size = new Size(82, 32);
btnStartResetAdd.TabIndex = 35;
btnStartResetAdd.Text = "新增";
btnStartResetAdd.Type = AntdUI.TTypeMini.Primary;
btnStartResetAdd.WaveSize = 0;
//
// tabPage5
//
tabPage5.Controls.Add(TableStopReset);
tabPage5.Controls.Add(panel5);
tabPage5.Location = new Point(-669, -499);
tabPage5.Name = "tabPage5";
tabPage5.Size = new Size(669, 499);
tabPage5.TabIndex = 4;
tabPage5.Text = "复位结束表";
//
// TableStopReset
//
TableStopReset.Dock = DockStyle.Fill;
TableStopReset.EmptyHeader = true;
TableStopReset.Location = new Point(0, 45);
TableStopReset.Name = "TableStopReset";
TableStopReset.Padding = new Padding(5);
TableStopReset.Size = new Size(669, 454);
TableStopReset.TabIndex = 38;
TableStopReset.Text = "table1";
//
// panel5
//
panel5.Back = Color.Transparent;
panel5.BackColor = SystemColors.Window;
panel5.Controls.Add(btnStopResetDelete);
panel5.Controls.Add(btnStopResetAdd);
panel5.Dock = DockStyle.Top;
panel5.Location = new Point(0, 0);
panel5.Name = "panel5";
panel5.Size = new Size(669, 45);
panel5.TabIndex = 37;
panel5.Text = "panel5";
//
// btnStopResetDelete
//
btnStopResetDelete.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
btnStopResetDelete.Location = new Point(110, 10);
btnStopResetDelete.Name = "btnStopResetDelete";
btnStopResetDelete.Size = new Size(74, 32);
btnStopResetDelete.TabIndex = 36;
btnStopResetDelete.Text = "删除";
btnStopResetDelete.Type = AntdUI.TTypeMini.Error;
btnStopResetDelete.WaveSize = 0;
//
// btnStopResetAdd
//
btnStopResetAdd.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
btnStopResetAdd.Location = new Point(13, 10);
btnStopResetAdd.Name = "btnStopResetAdd";
btnStopResetAdd.Size = new Size(82, 32);
btnStopResetAdd.TabIndex = 35;
btnStopResetAdd.Text = "新增";
btnStopResetAdd.Type = AntdUI.TTypeMini.Primary;
btnStopResetAdd.WaveSize = 0;
//
// MotionControl
//
AutoScaleDimensions = new SizeF(7F, 17F);
AutoScaleMode = AutoScaleMode.Font;
Controls.Add(tabs1);
Controls.Add(btnDelete);
Controls.Add(btnAdd);
Controls.Add(PLCItemsTable);
Controls.Add(stackPanel1);
Name = "MotionControl";
Size = new Size(898, 530);
@ -681,17 +382,6 @@
stpStop.ResumeLayout(false);
stpData.ResumeLayout(false);
stpBaud.ResumeLayout(false);
tabs1.ResumeLayout(false);
tabPage1.ResumeLayout(false);
panel1.ResumeLayout(false);
tabPage2.ResumeLayout(false);
panel2.ResumeLayout(false);
tabPage3.ResumeLayout(false);
panel3.ResumeLayout(false);
tabPage4.ResumeLayout(false);
panel4.ResumeLayout(false);
tabPage5.ResumeLayout(false);
panel5.ResumeLayout(false);
ResumeLayout(false);
}
@ -725,31 +415,8 @@
private AntdUI.StackPanel stpBaud;
private AntdUI.Select cmbBaudRate;
private AntdUI.Label label3;
private AntdUI.Tabs tabs1;
private AntdUI.TabPage tabPage1;
private AntdUI.TabPage tabPage2;
private AntdUI.TabPage tabPage3;
private AntdUI.TabPage tabPage4;
private AntdUI.TabPage tabPage5;
private AntdUI.Table PLCItemsTable;
private AntdUI.Panel panel1;
private AntdUI.Button btnDelete;
private AntdUI.Button btnAdd;
private AntdUI.Table TableSartProcess;
private AntdUI.Panel panel2;
private AntdUI.Button btnSartProcessDelete;
private AntdUI.Button btnSartProcessAdd;
private AntdUI.Table TableStopProcess;
private AntdUI.Panel panel3;
private AntdUI.Button btnStopProcessDelete;
private AntdUI.Button btnStopProcessAdd;
private AntdUI.Table TableStartReset;
private AntdUI.Panel panel4;
private AntdUI.Button btnStartResetDelete;
private AntdUI.Button btnStartResetAdd;
private AntdUI.Table TableStopReset;
private AntdUI.Panel panel5;
private AntdUI.Button btnStopResetDelete;
private AntdUI.Button btnStopResetAdd;
}
}

View File

@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO.Ports;
using System.Linq;
@ -19,9 +18,8 @@ namespace DHSoftware.Views
{
public partial class MotionControl : UserControl
{
private Window window;
private PLCBase pLCBase;
Window window;
PLCBase pLCBase;
public MotionControl(Window _window,PLCBase _pLCBase)
{
window= _window;
@ -32,500 +30,14 @@ namespace DHSoftware.Views
SetupDataBindings();
}
private void BindEventHandler()
{
sltTpye.TextChanged += SltTpye_TextChanged;
btnAdd.Click += BtnAdd_Click;
btnDelete.Click += BtnDelete_Click;
PLCItemsTable.CellButtonClick += PLCItemsTable_CellButtonClick;
btnSartProcessAdd.Click += BtnSartProcessAdd_Click;
btnSartProcessDelete.Click += BtnSartProcessDelete_Click;
TableSartProcess.CellButtonClick += TableSartProcess_CellButtonClick;
btnStopProcessAdd.Click += BtnStopProcessAdd_Click;
btnStopProcessDelete.Click += BtnStopProcessDelete_Click;
TableStopProcess.CellButtonClick += TableStopProcess_CellButtonClick;
btnStartResetAdd.Click += BtnStartResetAdd_Click;
btnStartResetDelete.Click += BtnStartResetDelete_Click;
TableStartReset.CellButtonClick += TableStartReset_CellButtonClick;
btnStopResetAdd.Click += BtnStopResetAdd_Click;
btnStopResetDelete.Click += BtnStopResetDelete_Click;
TableStopReset.CellButtonClick += TableStopReset_CellButtonClick;
}
private void TableStopReset_CellButtonClick(object sender, TableButtonEventArgs e)
{
var buttontext = e.Btn.Text;
if (e.Record is PLCItem pLCItem)
{
switch (buttontext)
{
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
case "编辑":
var form = new MotionProcessEdit(window, "复位结束表操作-编辑", pLCItem, pLCBase.PLCItemList) { Size = new Size(500, 300) };
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
{
OnLoad = () =>
{
AntdUI.Message.info(window, "进入复位结束表编辑", autoClose: 1);
},
OnClose = () =>
{
AntdUI.Message.info(window, "退出复位结束表编辑", autoClose: 1);
}
});
break;
case "删除":
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK)
{
pLCBase.PLCStopResetList.Remove(pLCItem);
}
break;
case "上移":
if (e.RowIndex <= 1)
{
AntdUI.Message.warn(window, "已是第一条,无法上移!", autoClose: 3);
return;
}
MoveItemUp(pLCBase.PLCStopResetList, pLCItem);
break;
case "下移":
if (e.RowIndex > pLCBase.PLCStopResetList.Count - 1)
{
AntdUI.Message.warn(window, "已是最后一条,无法下移!", autoClose: 3);
return;
}
MoveItemDown(pLCBase.PLCStopResetList, pLCItem);
break;
}
}
}
private void BtnStopResetDelete_Click(object? sender, EventArgs e)
{
if (pLCBase.PLCStopResetList.Count == 0 || !pLCBase.PLCStopResetList.Any(x => x.Selected))
{
AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3);
return;
}
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK)
{
// 使用反转for循环删除主列表中选中的项
for (int i = pLCBase.PLCStopResetList.Count - 1; i >= 0; i--)
{
// 删除选中的主列表项
if (pLCBase.PLCStopResetList[i].Selected)
{
pLCBase.PLCStopResetList.RemoveAt(i);
}
}
// 提示删除完成
AntdUI.Message.success(window, "删除成功!", autoClose: 3);
}
}
private void BtnStopResetAdd_Click(object? sender, EventArgs e)
{
if (pLCBase.PLCItemList?.Count == 0)
{
AntdUI.Message.warn(window, "点位表无数据,不允许新增!", autoClose: 3);
return;
}
PLCItem pLCItem = new PLCItem()
{
StartIndex = pLCBase.PLCStopResetList.Count + 1,
CellLinks = new CellLink[]
{
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary),
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
}
};
var form = new MotionProcessEdit(window, "复位结束表操作-新增", pLCItem, pLCBase.PLCItemList) { Size = new Size(450, 550) };
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
{
OnLoad = () =>
{
AntdUI.Message.info(window, "进入复位结束表新增", autoClose: 1);
},
OnClose = () =>
{
if (form.submit)
{
pLCBase.PLCStopResetList.Add(pLCItem);
}
AntdUI.Message.info(window, "退出复位结束表新增", autoClose: 1);
}
});
}
private void TableStartReset_CellButtonClick(object sender, TableButtonEventArgs e)
{
var buttontext = e.Btn.Text;
if (e.Record is PLCItem pLCItem)
{
switch (buttontext)
{
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
case "编辑":
var form = new MotionProcessEdit(window, "复位开始表操作-编辑", pLCItem, pLCBase.PLCItemList) { Size = new Size(500, 300) };
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
{
OnLoad = () =>
{
AntdUI.Message.info(window, "进入复位开始表编辑", autoClose: 1);
},
OnClose = () =>
{
AntdUI.Message.info(window, "退出复位开始表编辑", autoClose: 1);
}
});
break;
case "删除":
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK)
{
pLCBase.PLCStartResetList.Remove(pLCItem);
}
break;
case "上移":
if (e.RowIndex <= 1)
{
AntdUI.Message.warn(window, "已是第一条,无法上移!", autoClose: 3);
return;
}
MoveItemUp(pLCBase.PLCStartResetList, pLCItem);
break;
case "下移":
if (e.RowIndex > pLCBase.PLCStartResetList.Count - 1)
{
AntdUI.Message.warn(window, "已是最后一条,无法下移!", autoClose: 3);
return;
}
MoveItemDown(pLCBase.PLCStartResetList, pLCItem);
break;
}
}
}
private void BtnStartResetDelete_Click(object? sender, EventArgs e)
{
if (pLCBase.PLCStartResetList.Count == 0 || !pLCBase.PLCStartResetList.Any(x => x.Selected))
{
AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3);
return;
}
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK)
{
// 使用反转for循环删除主列表中选中的项
for (int i = pLCBase.PLCStartResetList.Count - 1; i >= 0; i--)
{
// 删除选中的主列表项
if (pLCBase.PLCStartResetList[i].Selected)
{
pLCBase.PLCStartResetList.RemoveAt(i);
}
}
// 提示删除完成
AntdUI.Message.success(window, "删除成功!", autoClose: 3);
}
}
private void BtnStartResetAdd_Click(object? sender, EventArgs e)
{
if (pLCBase.PLCItemList?.Count == 0)
{
AntdUI.Message.warn(window, "点位表无数据,不允许新增!", autoClose: 3);
return;
}
PLCItem pLCItem = new PLCItem()
{
StartIndex = pLCBase.PLCStartResetList.Count + 1,
CellLinks = new CellLink[]
{
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary),
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
}
};
var form = new MotionProcessEdit(window, "复位开始表操作-新增", pLCItem, pLCBase.PLCItemList) { Size = new Size(450, 550) };
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
{
OnLoad = () =>
{
AntdUI.Message.info(window, "进入复位开始表新增", autoClose: 1);
},
OnClose = () =>
{
if (form.submit)
{
pLCBase.PLCStartResetList.Add(pLCItem);
}
AntdUI.Message.info(window, "退出复位开始表新增", autoClose: 1);
}
});
}
private void TableStopProcess_CellButtonClick(object sender, TableButtonEventArgs e)
{
var buttontext = e.Btn.Text;
if (e.Record is PLCItem pLCItem)
{
switch (buttontext)
{
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
case "编辑":
var form = new MotionProcessEdit(window, "流程结束表操作-编辑", pLCItem, pLCBase.PLCItemList) { Size = new Size(500, 300) };
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
{
OnLoad = () =>
{
AntdUI.Message.info(window, "进入流程结束表编辑", autoClose: 1);
},
OnClose = () =>
{
AntdUI.Message.info(window, "退出流程结束表编辑", autoClose: 1);
}
});
break;
case "删除":
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK)
{
pLCBase.PLCStopProcessList.Remove(pLCItem);
}
break;
case "上移":
if (e.RowIndex <= 1)
{
AntdUI.Message.warn(window, "已是第一条,无法上移!", autoClose: 3);
return;
}
MoveItemUp(pLCBase.PLCStopProcessList, pLCItem);
break;
case "下移":
if (e.RowIndex > pLCBase.PLCStopProcessList.Count - 1)
{
AntdUI.Message.warn(window, "已是最后一条,无法下移!", autoClose: 3);
return;
}
MoveItemDown(pLCBase.PLCStopProcessList, pLCItem);
break;
}
}
}
private void BtnStopProcessDelete_Click(object? sender, EventArgs e)
{
if (pLCBase.PLCStopProcessList.Count == 0 || !pLCBase.PLCStopProcessList.Any(x => x.Selected))
{
AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3);
return;
}
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK)
{
// 使用反转for循环删除主列表中选中的项
for (int i = pLCBase.PLCStopProcessList.Count - 1; i >= 0; i--)
{
// 删除选中的主列表项
if (pLCBase.PLCStopProcessList[i].Selected)
{
pLCBase.PLCStopProcessList.RemoveAt(i);
}
}
// 提示删除完成
AntdUI.Message.success(window, "删除成功!", autoClose: 3);
}
}
private void BtnStopProcessAdd_Click(object? sender, EventArgs e)
{
if (pLCBase.PLCItemList?.Count == 0)
{
AntdUI.Message.warn(window, "点位表无数据,不允许新增!", autoClose: 3);
return;
}
PLCItem pLCItem = new PLCItem()
{
StartIndex = pLCBase.PLCStopProcessList.Count + 1,
CellLinks = new CellLink[]
{
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary),
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
}
};
var form = new MotionProcessEdit(window, "流程结束表操作-新增", pLCItem, pLCBase.PLCItemList) { Size = new Size(450, 550) };
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
{
OnLoad = () =>
{
AntdUI.Message.info(window, "进入流程结束表新增", autoClose: 1);
},
OnClose = () =>
{
if (form.submit)
{
pLCBase.PLCStopProcessList.Add(pLCItem);
}
AntdUI.Message.info(window, "退出流程结束表新增", autoClose: 1);
}
});
}
private void TableSartProcess_CellButtonClick(object sender, TableButtonEventArgs e)
{
var buttontext = e.Btn.Text;
if (e.Record is PLCItem pLCItem)
{
switch (buttontext)
{
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
case "编辑":
var form = new MotionProcessEdit(window, "流程开始表操作-编辑", pLCItem, pLCBase.PLCItemList) { Size = new Size(500, 300) };
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
{
OnLoad = () =>
{
AntdUI.Message.info(window, "进入流程开始表编辑", autoClose: 1);
},
OnClose = () =>
{
AntdUI.Message.info(window, "退出流程开始表编辑", autoClose: 1);
}
});
break;
case "删除":
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK)
{
pLCBase.PLCStartProcessList.Remove(pLCItem);
}
break;
case "上移":
if (e.RowIndex <= 1)
{
AntdUI.Message.warn(window, "已是第一条,无法上移!", autoClose: 3);
return;
}
MoveItemUp(pLCBase.PLCStartProcessList, pLCItem);
break;
case "下移":
if (e.RowIndex > pLCBase.PLCStartProcessList.Count - 1)
{
AntdUI.Message.warn(window, "已是最后一条,无法下移!", autoClose: 3);
return;
}
MoveItemDown(pLCBase.PLCStartProcessList, pLCItem);
break;
}
}
}
private void BtnSartProcessDelete_Click(object? sender, EventArgs e)
{
if (pLCBase.PLCStartProcessList.Count == 0 || !pLCBase.PLCStartProcessList.Any(x => x.Selected))
{
AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3);
return;
}
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
if (result == DialogResult.OK)
{
// 使用反转for循环删除主列表中选中的项
for (int i = pLCBase.PLCStartProcessList.Count - 1; i >= 0; i--)
{
// 删除选中的主列表项
if (pLCBase.PLCStartProcessList[i].Selected)
{
pLCBase.PLCStartProcessList.RemoveAt(i);
}
}
// 提示删除完成
AntdUI.Message.success(window, "删除成功!", autoClose: 3);
}
}
private void BtnSartProcessAdd_Click(object? sender, EventArgs e)
{
if (pLCBase.PLCItemList?.Count == 0)
{
AntdUI.Message.warn(window, "点位表无数据,不允许新增!", autoClose: 3);
return;
}
PLCItem pLCItem = new PLCItem()
{
StartIndex = pLCBase.PLCStartProcessList.Count + 1,
CellLinks = new CellLink[]
{
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary),
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
}
};
var form = new MotionProcessEdit(window, "流程开始表操作-新增", pLCItem, pLCBase.PLCItemList) { Size = new Size(450, 550) };
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
{
OnLoad = () =>
{
AntdUI.Message.info(window, "进入流程开始表新增", autoClose: 1);
},
OnClose = () =>
{
if (form.submit)
{
pLCBase.PLCStartProcessList.Add(pLCItem);
}
AntdUI.Message.info(window, "退出流程开始表新增", autoClose: 1);
}
});
PLCItemsTable.CellButtonClick += PLCItemsTable_CellButtonClick; ;
}
private void PLCItemsTable_CellButtonClick(object sender, TableButtonEventArgs e)
@ -538,7 +50,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 = () =>
@ -547,11 +59,26 @@ 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)
@ -560,62 +87,6 @@ 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 事件
}
}
}
@ -649,43 +120,40 @@ namespace DHSoftware.Views
{
PLCItem pLCItem = new PLCItem()
{
StartIndex = pLCBase.PLCItemList.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 MotionEdit(window, "点位表操作-新增", pLCItem) { Size = new Size(450, 550) };
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
var form = new MotionEdit(window, pLCItem) { Size = new Size(450, 550) };
AntdUI.Modal.open(new AntdUI.Modal.Config(window, "", form, TType.None)
{
OnLoad = () =>
{
AntdUI.Message.info(window, "进入新增", autoClose: 1);
},
OnClose = () =>
{
if (form.submit)
{
pLCBase.PLCItemList.Add(pLCItem);
}
AntdUI.Message.info(window, "结束新增", autoClose: 1);
}
BtnHeight = 0,
});
//AntdUI.Modal.open(new AntdUI.Modal.Config(window, "", form, TType.None)
//{
// BtnHeight = 0,
//});
if (form.submit)
{
pLCItem.CellTags = new CellTag[] { };
var tempList = pLCItem.CellTags.ToList();
//if (form.submit)
//{
// pLCBase.PLCItemList.Add(pLCItem);
//}
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);
}
}
private void SltTpye_TextChanged(object? sender, EventArgs e)
@ -725,10 +193,17 @@ namespace DHSoftware.Views
}
else
{
}
}
}
private void InitData()
{
// 获取枚举字段名列表(原描述改为字段名)
@ -767,122 +242,46 @@ 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)
{
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[] {
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);
}
TableSartProcess.Columns = new ColumnCollection() {
new ColumnCheck("Selected"){Fixed = true},
new Column("StartIndex", "序号", ColumnAlign.Center),
new ColumnSwitch("StartExecute", "启用", ColumnAlign.Center),
new Column("Name", "名称", ColumnAlign.Center),
new Column("Type", "类型",ColumnAlign.Center){Visible=false},
new Column("Address", "地址",ColumnAlign.Center){Visible=false},
new Column("Value", "值",ColumnAlign.Center),
new Column("CellLinks", "操作", ColumnAlign.Center)
};
if (pLCBase.PLCStartProcessList.Count > 0)
{
foreach (var item in pLCBase.PLCStartProcessList)
{
item.CellLinks = new CellLink[] {
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary) ,
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
};
}
}
//TableSartProcess.Binding(pLCBase.PLCStartProcessList);
TableSartProcess.Binding(pLCBase.PLCStartProcessList);
TableStopProcess.Columns = new ColumnCollection() {
new ColumnCheck("Selected"){Fixed = true},
new Column("StartIndex", "序号", ColumnAlign.Center),
new ColumnSwitch("StartExecute", "启用", ColumnAlign.Center),
new Column("Name", "名称", ColumnAlign.Center),
new Column("Type", "类型",ColumnAlign.Center){Visible=false},
new Column("Address", "地址",ColumnAlign.Center){Visible=false},
new Column("Value", "值",ColumnAlign.Center),
new Column("CellLinks", "操作", ColumnAlign.Center)
};
if (pLCBase.PLCStopProcessList.Count > 0)
{
foreach (var item in pLCBase.PLCStopProcessList)
{
item.CellLinks = new CellLink[] {
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary) ,
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
};
}
}
TableStopProcess.Binding(pLCBase.PLCStopProcessList);
TableStartReset.Columns = new ColumnCollection() {
new ColumnCheck("Selected"){Fixed = true},
new Column("StartIndex", "序号", ColumnAlign.Center),
new ColumnSwitch("StartExecute", "启用", ColumnAlign.Center),
new Column("Name", "名称", ColumnAlign.Center),
new Column("Type", "类型",ColumnAlign.Center){Visible=false},
new Column("Address", "地址",ColumnAlign.Center){Visible=false},
new Column("Value", "值",ColumnAlign.Center),
new Column("CellLinks", "操作", ColumnAlign.Center)
};
if (pLCBase.PLCStartResetList.Count > 0)
{
foreach (var item in pLCBase.PLCStartResetList)
{
item.CellLinks = new CellLink[] {
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary) ,
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
};
}
}
TableStartReset.Binding(pLCBase.PLCStartResetList);
TableStopReset.Columns = new ColumnCollection() {
new ColumnCheck("Selected"){Fixed = true},
new Column("StartIndex", "序号", ColumnAlign.Center),
new ColumnSwitch("StartExecute", "启用", ColumnAlign.Center),
new Column("Name", "名称", ColumnAlign.Center),
new Column("Type", "类型",ColumnAlign.Center){Visible=false},
new Column("Address", "地址",ColumnAlign.Center){Visible=false},
new Column("Value", "值",ColumnAlign.Center),
new Column("CellLinks", "操作", ColumnAlign.Center)
};
if (pLCBase.PLCStopResetList.Count > 0)
{
foreach (var item in pLCBase.PLCStopResetList)
{
item.CellLinks = new CellLink[] {
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary) ,
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
};
}
}
TableStopReset.Binding(pLCBase.PLCStopResetList);
}
private void SetupDataBindings()
{
@ -899,5 +298,7 @@ namespace DHSoftware.Views
swhEnable.DataBindings.Add(nameof(swhEnable.Checked),pLCBase, nameof(pLCBase.Enable));
}
}
}

View File

@ -35,14 +35,30 @@
stackPanel1 = new AntdUI.StackPanel();
button_ok = new AntdUI.Button();
divider1 = new AntdUI.Divider();
lbTitleName = new AntdUI.Label();
label1 = 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
@ -115,18 +131,25 @@
divider1.Size = new Size(409, 12);
divider1.TabIndex = 19;
//
// lbTitleName
// label1
//
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点位操作";
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点位操作";
//
// 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);
@ -136,16 +159,131 @@
panel1.Controls.Add(divider2);
panel1.Controls.Add(stackPanel1);
panel1.Controls.Add(divider1);
panel1.Controls.Add(lbTitleName);
panel1.Controls.Add(label1);
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, 315);
panel1.Size = new Size(445, 572);
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;
@ -185,15 +323,40 @@
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, 315);
Size = new Size(445, 572);
stackPanel1.ResumeLayout(false);
panel1.ResumeLayout(false);
stackPanel3.ResumeLayout(false);
stackPanel2.ResumeLayout(false);
stpNum.ResumeLayout(false);
ResumeLayout(false);
}
@ -205,11 +368,24 @@
private AntdUI.StackPanel stackPanel1;
private AntdUI.Button button_ok;
private AntdUI.Divider divider1;
private AntdUI.Label lbTitleName;
private AntdUI.Label label1;
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;
}
}

View File

@ -10,10 +10,9 @@ namespace DHSoftware.Views
private AntdUI.Window window;
private PLCItem plcItem;
public bool submit;
public MotionEdit(AntdUI.Window _window,string TitleName, PLCItem _plcItem)
public MotionEdit(AntdUI.Window _window, PLCItem _plcItem)
{
InitializeComponent();
lbTitleName.Text = TitleName;
plcItem = _plcItem;
// 绑定事件
BindEventHandler();
@ -27,9 +26,29 @@ 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)
{
@ -47,9 +66,17 @@ namespace DHSoftware.Views
AntdUI.Message.warn(window, "参数名称不能为空!", autoClose: 3);
return;
}
plcItem.Name = sltName.Text;
plcItem.Address = iptAddress.Text;
plcItem.Type = (EnumPLCDataType)sltDataType.SelectedIndex;
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;
submit = true;
this.Dispose();
}
@ -67,13 +94,28 @@ 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.SelectedIndex =(int)plcItem.Type;
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;
}
}

View File

@ -1,270 +0,0 @@
namespace DHSoftware.Views
{
partial class MotionProcessEdit
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
button_cancel = new AntdUI.Button();
sltName = new AntdUI.Select();
label2 = new AntdUI.Label();
divider2 = new AntdUI.Divider();
stackPanel1 = new AntdUI.StackPanel();
button_ok = new AntdUI.Button();
divider1 = new AntdUI.Divider();
lbTitleName = new AntdUI.Label();
panel1 = new AntdUI.Panel();
iptValue = new AntdUI.Input();
label1 = new AntdUI.Label();
iptAddress = new AntdUI.Input();
label7 = new AntdUI.Label();
sltDataType = new AntdUI.Select();
label4 = new AntdUI.Label();
sltEnable = new AntdUI.Select();
label3 = new AntdUI.Label();
stackPanel1.SuspendLayout();
panel1.SuspendLayout();
SuspendLayout();
//
// button_cancel
//
button_cancel.BorderWidth = 1F;
button_cancel.Font = new Font("Microsoft YaHei UI", 9F);
button_cancel.Ghost = true;
button_cancel.Location = new Point(84, 3);
button_cancel.Name = "button_cancel";
button_cancel.Size = new Size(75, 38);
button_cancel.TabIndex = 1;
button_cancel.Text = "取消";
//
// sltName
//
sltName.Dock = DockStyle.Top;
sltName.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
sltName.Location = new Point(18, 134);
sltName.MaxCount = 10;
sltName.Name = "sltName";
sltName.Radius = 3;
sltName.Size = new Size(409, 38);
sltName.TabIndex = 23;
//
// label2
//
label2.Dock = DockStyle.Top;
label2.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
label2.Location = new Point(18, 110);
label2.Name = "label2";
label2.Size = new Size(409, 24);
label2.TabIndex = 22;
label2.Text = "名称";
//
// divider2
//
divider2.Dock = DockStyle.Top;
divider2.Location = new Point(18, 98);
divider2.Name = "divider2";
divider2.Size = new Size(409, 12);
divider2.TabIndex = 21;
//
// stackPanel1
//
stackPanel1.Controls.Add(button_cancel);
stackPanel1.Controls.Add(button_ok);
stackPanel1.Dock = DockStyle.Top;
stackPanel1.Location = new Point(18, 54);
stackPanel1.Name = "stackPanel1";
stackPanel1.RightToLeft = RightToLeft.No;
stackPanel1.Size = new Size(409, 44);
stackPanel1.TabIndex = 20;
stackPanel1.Text = "stackPanel1";
//
// button_ok
//
button_ok.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
button_ok.Location = new Point(3, 3);
button_ok.Name = "button_ok";
button_ok.Size = new Size(75, 38);
button_ok.TabIndex = 0;
button_ok.Text = "确定";
button_ok.Type = AntdUI.TTypeMini.Primary;
//
// divider1
//
divider1.Dock = DockStyle.Top;
divider1.Location = new Point(18, 42);
divider1.Name = "divider1";
divider1.Size = new Size(409, 12);
divider1.TabIndex = 19;
//
// lbTitleName
//
lbTitleName.Dock = DockStyle.Top;
lbTitleName.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
lbTitleName.Location = new Point(18, 18);
lbTitleName.Name = "lbTitleName";
lbTitleName.Size = new Size(409, 24);
lbTitleName.TabIndex = 17;
lbTitleName.Text = "PLC点位操作";
//
// panel1
//
panel1.Controls.Add(iptValue);
panel1.Controls.Add(label1);
panel1.Controls.Add(iptAddress);
panel1.Controls.Add(label7);
panel1.Controls.Add(sltDataType);
panel1.Controls.Add(label4);
panel1.Controls.Add(sltEnable);
panel1.Controls.Add(label3);
panel1.Controls.Add(sltName);
panel1.Controls.Add(label2);
panel1.Controls.Add(divider2);
panel1.Controls.Add(stackPanel1);
panel1.Controls.Add(divider1);
panel1.Controls.Add(lbTitleName);
panel1.Dock = DockStyle.Fill;
panel1.Location = new Point(0, 0);
panel1.Name = "panel1";
panel1.Padding = new Padding(12);
panel1.Shadow = 6;
panel1.Size = new Size(445, 451);
panel1.TabIndex = 1;
panel1.Text = "panel1";
panel1.Click += panel1_Click;
//
// iptValue
//
iptValue.Dock = DockStyle.Top;
iptValue.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
iptValue.Location = new Point(18, 382);
iptValue.Name = "iptValue";
iptValue.PlaceholderText = "布尔类型1(true)或0(false),其它类型实值";
iptValue.Radius = 3;
iptValue.Size = new Size(409, 38);
iptValue.TabIndex = 62;
//
// label1
//
label1.Dock = DockStyle.Top;
label1.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
label1.Location = new Point(18, 358);
label1.Name = "label1";
label1.Size = new Size(409, 24);
label1.TabIndex = 61;
label1.Text = "值";
//
// iptAddress
//
iptAddress.Dock = DockStyle.Top;
iptAddress.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
iptAddress.Location = new Point(18, 320);
iptAddress.Name = "iptAddress";
iptAddress.Radius = 3;
iptAddress.ReadOnly = true;
iptAddress.Size = new Size(409, 38);
iptAddress.TabIndex = 60;
//
// label7
//
label7.Dock = DockStyle.Top;
label7.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
label7.Location = new Point(18, 296);
label7.Name = "label7";
label7.Size = new Size(409, 24);
label7.TabIndex = 59;
label7.Text = "地址";
//
// sltDataType
//
sltDataType.Dock = DockStyle.Top;
sltDataType.List = true;
sltDataType.Location = new Point(18, 258);
sltDataType.Name = "sltDataType";
sltDataType.ReadOnly = true;
sltDataType.Size = new Size(409, 38);
sltDataType.TabIndex = 58;
//
// label4
//
label4.Dock = DockStyle.Top;
label4.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
label4.Location = new Point(18, 234);
label4.Name = "label4";
label4.Size = new Size(409, 24);
label4.TabIndex = 57;
label4.Text = "数据类型";
//
// sltEnable
//
sltEnable.Dock = DockStyle.Top;
sltEnable.List = true;
sltEnable.Location = new Point(18, 196);
sltEnable.Name = "sltEnable";
sltEnable.Size = new Size(409, 38);
sltEnable.TabIndex = 45;
//
// label3
//
label3.Dock = DockStyle.Top;
label3.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
label3.Location = new Point(18, 172);
label3.Name = "label3";
label3.Size = new Size(409, 24);
label3.TabIndex = 44;
label3.Text = "状态";
//
// MotionProcessEdit
//
AutoScaleDimensions = new SizeF(7F, 17F);
AutoScaleMode = AutoScaleMode.Font;
Controls.Add(panel1);
Name = "MotionProcessEdit";
Size = new Size(445, 451);
stackPanel1.ResumeLayout(false);
panel1.ResumeLayout(false);
ResumeLayout(false);
}
#endregion
private AntdUI.Button button_cancel;
private AntdUI.Select sltName;
private AntdUI.Label label2;
private AntdUI.Divider divider2;
private AntdUI.StackPanel stackPanel1;
private AntdUI.Button button_ok;
private AntdUI.Divider divider1;
private AntdUI.Label lbTitleName;
private AntdUI.Panel panel1;
private AntdUI.Select sltEnable;
private AntdUI.Label label3;
private AntdUI.Input iptValue;
private AntdUI.Label label1;
private AntdUI.Input iptAddress;
private AntdUI.Label label7;
private AntdUI.Select sltDataType;
private AntdUI.Label label4;
}
}

View File

@ -1,104 +0,0 @@
using System.ComponentModel;
using AntdUI;
using DH.Commons.Base;
using DH.Commons.Enums;
using DH.Devices.PLC;
namespace DHSoftware.Views
{
public partial class MotionProcessEdit : UserControl
{
private AntdUI.Window window;
private PLCItem plcItem;
private BindingList<PLCItem> plcItemList;
public bool submit;
public MotionProcessEdit(AntdUI.Window _window, string TitleName, PLCItem _plcItem, BindingList<PLCItem> _plcItemList)
{
InitializeComponent();
lbTitleName.Text = TitleName;
plcItem = _plcItem;
plcItemList= _plcItemList;
// 绑定事件
BindEventHandler();
//设置默认值
InitData();
}
private void BindEventHandler()
{
sltName.SelectedIndexChanged += SltName_SelectedIndexChanged;
button_ok.Click += Button_ok_Click;
button_cancel.Click += Button_cancel_Click;
}
private void SltName_SelectedIndexChanged(object sender, IntEventArgs e)
{
Select select = (Select)sender;
var pLCItems=plcItemList.Where(it=>it.Name==select.Text).FirstOrDefault();
if (pLCItems != null)
{
sltDataType.SelectedIndex =(int)pLCItems.Type;
iptAddress.Text= pLCItems.Address;
}
}
private void Button_cancel_Click(object sender, EventArgs e)
{
submit = false;
this.Dispose();
}
private void Button_ok_Click(object sender, EventArgs e)
{
sltName.Status = AntdUI.TType.None;
//检查输入内容
if (String.IsNullOrEmpty(sltName.Text))
{
sltName.Status = AntdUI.TType.Error;
AntdUI.Message.warn(window, "参数名称不能为空!", autoClose: 3);
return;
}
plcItem.Name = sltName.Text;
plcItem.Address = iptAddress.Text;
plcItem.Type = (EnumPLCDataType)sltDataType.SelectedIndex;
plcItem.Value=iptValue.Text;
plcItem.StartExecute = sltEnable.SelectedIndex != 0;
submit = true;
this.Dispose();
}
private void InitData()
{
foreach (var item in plcItemList)
{
sltName.Items.Add(item.Name);
sltDataType.Items.Add(item.Type);
}
var boolNames = Enum.GetNames(typeof(EnumBool));
foreach (var name in boolNames)
{
sltEnable.Items.Add(name);
}
if (!string.IsNullOrEmpty(plcItem.Name))
{
sltName.Text = plcItem.Name;
iptAddress.Text = plcItem.Address;
sltDataType.SelectedIndex = (int)plcItem.Type;
sltEnable.SelectedIndex = plcItem.StartExecute ? 1 : 0;
iptValue.Text = plcItem.Value;
}
}
private void panel1_Click(object sender, EventArgs e)
{
}
}
}

View File

@ -1,120 +0,0 @@
<?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>