Compare commits
No commits in common. "dev_update" and "dev_xiao" have entirely different histories.
dev_update
...
dev_xiao
@ -3,47 +3,12 @@ using System.ComponentModel;
|
||||
using System.Drawing.Imaging;
|
||||
using AntdUI;
|
||||
using DH.Commons.Enums;
|
||||
using HalconDotNet;
|
||||
using OpenCvSharp;
|
||||
|
||||
namespace DH.Commons.Base
|
||||
{
|
||||
public class MatSet
|
||||
{
|
||||
public DateTime ImageTime { get; set; } = DateTime.Now;
|
||||
|
||||
private string id = "";
|
||||
public string Id
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(id))
|
||||
{
|
||||
id = ImageTime.ToString("HHmmssfff");
|
||||
}
|
||||
return id;
|
||||
}
|
||||
set
|
||||
{
|
||||
id = value;
|
||||
}
|
||||
}
|
||||
public string CameraId { get; set; }
|
||||
public Mat _mat { get; set; } = null;
|
||||
|
||||
public ImageFormat _imageFormat { get; set; } = ImageFormat.Jpeg;
|
||||
public virtual void Dispose()
|
||||
{
|
||||
_mat?.Dispose();
|
||||
_mat = null;
|
||||
|
||||
}
|
||||
}
|
||||
public class CameraBase : NotifyProperty
|
||||
{
|
||||
|
||||
// public LoggerHelper LoggerHelper { get; set; } = new LoggerHelper();
|
||||
|
||||
// 私有字段 + 带通知的属性(与DetectionLabel风格一致)
|
||||
private bool _isEnabled = false;
|
||||
private bool _isallPicEnabled = true;//默认全画幅
|
||||
|
@ -9,7 +9,6 @@ using AntdUI;
|
||||
using static DH.Commons.Enums.EnumHelper;
|
||||
using System.Text.Json.Serialization;
|
||||
using DH.Commons.Enums;
|
||||
using System.Drawing.Imaging;
|
||||
|
||||
namespace DH.Commons.Base
|
||||
{
|
||||
@ -105,20 +104,20 @@ namespace DH.Commons.Base
|
||||
/// </summary>
|
||||
public class DetectionResultDetail
|
||||
{
|
||||
|
||||
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
|
||||
public string LabelBGR { get; set; }//识别到对象的标签BGR
|
||||
|
||||
|
||||
|
||||
public int LabelNo { get; set; } // 识别到对象的标签索引
|
||||
|
||||
|
||||
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
|
||||
public string LabelName { get; set; }//识别到对象的标签名称
|
||||
|
||||
|
||||
public double Score { get; set; }//识别目标结果的可能性、得分
|
||||
|
||||
|
||||
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
|
||||
public string LabelDisplay { get; set; }//识别到对象的 显示信息
|
||||
|
||||
|
||||
@ -139,10 +138,10 @@ namespace DH.Commons.Base
|
||||
public class MLResult
|
||||
{
|
||||
public bool IsSuccess = false;
|
||||
|
||||
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
|
||||
public string ResultMessage;
|
||||
|
||||
|
||||
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
|
||||
public Bitmap ResultMap;
|
||||
|
||||
public List<DetectionResultDetail> ResultDetails = new List<DetectionResultDetail>();
|
||||
@ -166,7 +165,8 @@ namespace DH.Commons.Base
|
||||
public bool IsGPU;
|
||||
public int GPUId;
|
||||
public float Score_thre;
|
||||
|
||||
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
|
||||
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
|
||||
public MLInit(string modelFile, bool isGPU, int gpuId, float score_thre)
|
||||
|
||||
|
||||
@ -191,32 +191,18 @@ namespace DH.Commons.Base
|
||||
}
|
||||
public class DetectStationResult
|
||||
{
|
||||
public DateTime ImageTime { get; set; } = DateTime.Now;
|
||||
|
||||
private string id = "";
|
||||
public string Id
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(id))
|
||||
{
|
||||
id = ImageTime.ToString("HHmmssfff");
|
||||
}
|
||||
return id;
|
||||
}
|
||||
set
|
||||
{
|
||||
id = value;
|
||||
}
|
||||
}
|
||||
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
|
||||
public string Pid { get; set; }
|
||||
|
||||
public string TempPid { get; set; }
|
||||
|
||||
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
|
||||
public string TempPid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 检测工位名称
|
||||
/// </summary>
|
||||
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑声明为可以为 null。
|
||||
public string DetectName { get; set; }
|
||||
|
||||
|
||||
@ -226,11 +212,8 @@ namespace DH.Commons.Base
|
||||
/// </summary>
|
||||
public List<DetectionResultDetail> DetectDetails = new List<DetectionResultDetail>();
|
||||
public List<IShapeElement> DetectionResultShapes = new List<IShapeElement>();
|
||||
/// <summary>
|
||||
/// 视觉测量结果集合
|
||||
/// </summary>
|
||||
|
||||
public List<IndexedSpec> realSpecs { get; set; } = new List<IndexedSpec>();
|
||||
|
||||
/// <summary>
|
||||
/// 工位检测结果
|
||||
/// </summary>
|
||||
@ -255,24 +238,35 @@ namespace DH.Commons.Base
|
||||
/// 预处理阶段已经NG
|
||||
/// </summary>
|
||||
public bool IsPreTreatNG { get; set; } = false;
|
||||
/// <summary>
|
||||
/// 检测原图
|
||||
/// </summary>
|
||||
public Bitmap DetectionOriginImage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 目标检测NG
|
||||
/// </summary>
|
||||
public bool IsObjectDetectNG { get; set; } = false;
|
||||
public ImageFormat ImageFormat { get; set; } = ImageFormat.Jpeg;
|
||||
|
||||
public DateTime EndTime { get; set; }
|
||||
|
||||
public string ImageSaveDirectory { get; set; }
|
||||
public int StationDetectElapsed { get; set; }
|
||||
public bool SaveOKOriginal = false;
|
||||
public bool SaveNGOriginal = false;
|
||||
public bool SaveOKDetect = false;
|
||||
public bool SaveNGDetect = false;
|
||||
public static string NormalizeAndClean(string input)
|
||||
{
|
||||
#pragma warning disable CS8603 // 可能返回 null 引用。
|
||||
if (input == null) return null;
|
||||
#pragma warning restore CS8603 // 可能返回 null 引用。
|
||||
|
||||
// Step 1: 标准化字符编码为 Form C (规范组合)
|
||||
string normalizedString = input.Normalize(NormalizationForm.FormC);
|
||||
|
||||
// Step 2: 移除所有空白字符,包括制表符和换行符
|
||||
string withoutWhitespace = Regex.Replace(normalizedString, @"\s+", "");
|
||||
|
||||
// Step 3: 移除控制字符 (Unicode 控制字符,范围 \u0000 - \u001F 和 \u007F)
|
||||
string withoutControlChars = Regex.Replace(withoutWhitespace, @"[\u0000-\u001F\u007F]+", "");
|
||||
|
||||
// Step 4: 移除特殊的不可见字符(如零宽度空格等)
|
||||
string cleanedString = Regex.Replace(withoutControlChars, @"[\u200B\u200C\u200D\uFEFF]+", "");
|
||||
|
||||
return cleanedString;
|
||||
}
|
||||
|
||||
}
|
||||
public class RelatedCamera : NotifyProperty
|
||||
@ -509,7 +503,7 @@ namespace DH.Commons.Base
|
||||
private AntList<SizeTreatParam> _sizeTreatParamList = new AntList<SizeTreatParam>();
|
||||
|
||||
private CustomizedPoint _showLocation = new CustomizedPoint();
|
||||
private string _imageSaveDirectory="D://Images";
|
||||
|
||||
private bool _saveOKOriginal = false;
|
||||
private bool _saveNGOriginal = false;
|
||||
private bool _saveOKDetect = false;
|
||||
@ -627,19 +621,7 @@ namespace DH.Commons.Base
|
||||
OnPropertyChanged(nameof(IsAddStation));
|
||||
}
|
||||
}
|
||||
[Category("图片保存")]
|
||||
[DisplayName("图片保存文件夹")]
|
||||
[Description("图片保存文件夹")]
|
||||
public virtual string ImageSaveDirectory
|
||||
{
|
||||
get => _imageSaveDirectory;
|
||||
set
|
||||
{
|
||||
if (_imageSaveDirectory == value) return;
|
||||
_imageSaveDirectory = value;
|
||||
OnPropertyChanged(nameof(ImageSaveDirectory));
|
||||
}
|
||||
}
|
||||
|
||||
[Category("1.预处理(视觉算子)")]
|
||||
[DisplayName("预处理-算法文件路径")]
|
||||
public string HalconAlgorithemPath_Pre
|
||||
|
@ -1,389 +0,0 @@
|
||||
|
||||
using DH.Commons.Enums;
|
||||
using OpenCvSharp.Internal;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using static DH.Commons.Enums.EnumHelper;
|
||||
using Timer = System.Threading.Timer;
|
||||
|
||||
namespace DH.Commons.Base
|
||||
{
|
||||
public abstract class DeviceBase : IDisposable
|
||||
{
|
||||
#region Event
|
||||
[JsonIgnore]
|
||||
[Browsable(false)]
|
||||
public Action<DateTime, Exception> OnExceptionOccured { get; set; }
|
||||
//public event Action<DateTime, LogLevel, string> OnLog;
|
||||
public event Action<LogMsg> OnLog;
|
||||
// public event Action<IDevice, DeviceState> OnDeviceStateChanged;
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
#endregion
|
||||
|
||||
#region field
|
||||
int RetryTime = 3;
|
||||
/// <summary>
|
||||
/// 和设备暂停状态关联的信号量
|
||||
/// </summary>
|
||||
private readonly ManualResetEvent pauseHandle = new ManualResetEvent(true);
|
||||
readonly Timer stateChangedTimer;
|
||||
#endregion
|
||||
|
||||
#region Property
|
||||
#region State
|
||||
private EnumHelper.DeviceState _currentStateToBe = EnumHelper.DeviceState.DSUninit;
|
||||
/// <summary>
|
||||
/// 当前设备状态
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
internal EnumHelper.DeviceState CurrentStateToBe
|
||||
{
|
||||
get
|
||||
{
|
||||
return _currentStateToBe;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != _currentStateToBe)
|
||||
{
|
||||
var initialState = _currentStateToBe;
|
||||
_currentStateToBe = value;
|
||||
|
||||
if (_currentStateToBe != EnumHelper.DeviceState.DSExcept)
|
||||
{
|
||||
// OnStateChanged(initialState);
|
||||
}
|
||||
else
|
||||
{
|
||||
stateChangedTimer.Change(Timeout.Infinite, Timeout.Infinite);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//private EnumHelper.DeviceState initialState = EnumHelper.DeviceState.DSUninit;
|
||||
private EnumHelper.DeviceState _currentState = EnumHelper.DeviceState.DSUninit;
|
||||
public EnumHelper.DeviceState CurrentState
|
||||
{
|
||||
get
|
||||
{
|
||||
return _currentState;
|
||||
}
|
||||
set
|
||||
{
|
||||
_currentState = value;
|
||||
|
||||
if (value != EnumHelper.DeviceState.TBD)
|
||||
{
|
||||
// OnDeviceStateChanged?.Invoke(this, _currentState);
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("CurrentState"));
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// initialState = _currentState;
|
||||
//}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 设备标识符 从数据库获取
|
||||
/// </summary>
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备名称 从数据库获取
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
//private IInitialConfig initialConfig = null;
|
||||
///// <summary>
|
||||
///// 设备初始化配置 从数据库获取
|
||||
///// </summary>
|
||||
//public virtual IInitialConfig InitialConfig
|
||||
//{
|
||||
// get => initialConfig;
|
||||
// set
|
||||
// {
|
||||
// initialConfig = value;
|
||||
// Id = initialConfig.Id;
|
||||
// Name = initialConfig.Name;
|
||||
|
||||
// LoggerHelper.LogPath = initialConfig.LogPath;
|
||||
// LoggerHelper.LogPrefix = initialConfig.Name;
|
||||
// }
|
||||
//}
|
||||
#endregion
|
||||
|
||||
#region 构造函数
|
||||
public DeviceBase()
|
||||
{
|
||||
RegisterFileWriterException();
|
||||
// stateChangedTimer = new Timer(new TimerCallback(CheckDeviceOpTimeOut), null, Timeout.Infinite, Timeout.Infinite);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 设备抽象方法
|
||||
protected virtual void Init()
|
||||
{
|
||||
LogAsync(DateTime.Now, LogLevel.Information, $"{Name}初始化完成");
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected virtual void Start()
|
||||
{
|
||||
LogAsync(DateTime.Now, LogLevel.Information, $"{Name}启动");
|
||||
}
|
||||
|
||||
protected virtual void Stop()
|
||||
{
|
||||
LogAsync(DateTime.Now, LogLevel.Information, $"{Name}停止");
|
||||
}
|
||||
|
||||
//public abstract void AttachToProcess(IProcess process);
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 常用操作封装方法
|
||||
/// </summary>
|
||||
/// <param name="opConfig"></param>
|
||||
/// <returns></returns>
|
||||
//public virtual ResponseMessage RunWrap(IOperationConfig opConfig)
|
||||
//{
|
||||
// ResponseMessage msg = new ResponseMessage();
|
||||
// msg.Message = "设备基类默认操作";
|
||||
// return msg;
|
||||
//}
|
||||
|
||||
#region 状态切换
|
||||
//[DeviceExceptionAspect]
|
||||
//public void StateChange(EnumHelper.DeviceState stateToBe)
|
||||
//{
|
||||
// if (CurrentState == stateToBe)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// if (!stateToBe.CheckPreStateValid((int)CurrentStateToBe))
|
||||
// {
|
||||
// string currentStateStr = CurrentStateToBe.GetEnumDescription();
|
||||
// string stateToBeStr = stateToBe.GetEnumDescription();
|
||||
// throw new ProcessException($"{InitialConfig.Name}设备的当前状态为{currentStateStr},无法切换至{stateToBeStr}");
|
||||
// }
|
||||
|
||||
// CurrentState = EnumHelper.DeviceState.TBD;
|
||||
// CurrentStateToBe = stateToBe;
|
||||
//}
|
||||
|
||||
//[DeviceExceptionAspect]
|
||||
//private void OnStateChanged(EnumHelper.DeviceState initialState)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// if (CurrentStateToBe != EnumHelper.DeviceState.DSExcept)
|
||||
// {
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (CurrentState == EnumHelper.DeviceState.DSExcept)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// throw new ProcessException($"{InitialConfig.Name}设备操作超时");
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (RetryTime >= 0)
|
||||
// {
|
||||
// if (initialState == CurrentStateToBe)
|
||||
// {
|
||||
// CurrentState = CurrentStateToBe;
|
||||
// return;
|
||||
// }
|
||||
|
||||
// #region 状态切换操作
|
||||
// switch (CurrentStateToBe)
|
||||
// {
|
||||
// case EnumHelper.DeviceState.DSInit:
|
||||
// if (initialState == EnumHelper.DeviceState.DSOpen)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Init();
|
||||
// }
|
||||
// break;
|
||||
// case EnumHelper.DeviceState.DSOpen:
|
||||
// if (initialState == EnumHelper.DeviceState.DSInit)
|
||||
// {
|
||||
// Start();
|
||||
// }
|
||||
// else if (initialState == EnumHelper.DeviceState.DSPause)
|
||||
// {
|
||||
// Resume();
|
||||
// pauseHandle.Set();
|
||||
// }
|
||||
// break;
|
||||
// case EnumHelper.DeviceState.DSPause:
|
||||
// pauseHandle.Reset();
|
||||
// Pause();
|
||||
// break;
|
||||
// case EnumHelper.DeviceState.DSClose:
|
||||
// if (initialState != DeviceState.DSUninit)
|
||||
// {
|
||||
// Stop();
|
||||
// }
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
|
||||
// RetryTime = 3;
|
||||
// CurrentState = CurrentStateToBe;
|
||||
// #endregion
|
||||
// }
|
||||
|
||||
// stateChangedTimer.Change(Timeout.Infinite, Timeout.Infinite);
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// RetryTime--;
|
||||
// if (RetryTime > 0)
|
||||
// {
|
||||
// OnStateChanged(initialState);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (CurrentState != EnumHelper.DeviceState.DSExcept)
|
||||
// {
|
||||
// RetryTime = 3;
|
||||
// throw new ProcessException($"设备{InitialConfig.Name}的{CurrentStateToBe.GetEnumDescription()}操作重复3次失败", ex, ExceptionLevel.Warning);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
//private void CheckDeviceOpTimeOut(object state)
|
||||
//{
|
||||
// stateChangedTimer?.Change(Timeout.Infinite, Timeout.Infinite);
|
||||
|
||||
// if (CurrentState != EnumHelper.DeviceState.DSExcept)
|
||||
// {
|
||||
// StateChange(EnumHelper.DeviceState.DSExcept);
|
||||
// }
|
||||
//}
|
||||
#endregion
|
||||
|
||||
#region 日志处理
|
||||
private void RegisterFileWriterException()
|
||||
{
|
||||
LoggerHelper.OnLogExceptionRaised -= LoggerHelper_OnLogExceptionRaised;
|
||||
// CSVHelper.OnCSVExceptionRaised -= LoggerHelper_OnLogExceptionRaised;
|
||||
|
||||
LoggerHelper.OnLogExceptionRaised += LoggerHelper_OnLogExceptionRaised;
|
||||
// CSVHelper.OnCSVExceptionRaised += LoggerHelper_OnLogExceptionRaised;
|
||||
}
|
||||
// public CSVHelper CSVHelper { get; set; } = new CSVHelper();
|
||||
|
||||
public LoggerHelper LoggerHelper { get; set; } = new LoggerHelper();
|
||||
|
||||
public virtual void LogAsync(LogMsg msg)
|
||||
{
|
||||
msg.MsgSource = Name;
|
||||
msg.ThreadId = Thread.CurrentThread.ManagedThreadId;
|
||||
|
||||
//OnLog?.BeginInvoke(msg, null, null);
|
||||
OnLog?.Invoke(msg);
|
||||
|
||||
//if (InitialConfig.IsEnableLog)
|
||||
//{
|
||||
// LoggerHelper.LogAsync(msg);
|
||||
//}
|
||||
}
|
||||
|
||||
public virtual void LogAsync(DateTime dt, LogLevel logLevel, string msg)
|
||||
{
|
||||
LogAsync(new LogMsg(dt, logLevel, msg));
|
||||
}
|
||||
private void LoggerHelper_OnLogExceptionRaised(DateTime dt, string msg)
|
||||
{
|
||||
OnLog?.Invoke(new LogMsg(dt, LogLevel.Error, msg));
|
||||
}
|
||||
/// <summary>
|
||||
/// CSV异步数据输出
|
||||
/// </summary>
|
||||
/// <param name="csvFile">CSV输出文件的文件全路径</param>
|
||||
/// <param name="csvData">CSV输出数据</param>
|
||||
/// <param name="csvHead">CSV文件表头</param>
|
||||
public virtual void CSVRecordAsync(string csvFile, string csvData, string csvHead = "")
|
||||
{
|
||||
// CSVHelper.CSVOutputAsync(csvFile, csvData, csvHead);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 报警记录
|
||||
//object _alarmLock = new object();
|
||||
//protected virtual async void SaveAlarmCSVAsync(DateTime now, string deviceName, IWarningSet ws)
|
||||
//{
|
||||
// await Task.Run(() =>
|
||||
// {
|
||||
// LogAsync(now, LogLevel.Warning, $"{ws.WarningCode}-{ws.WarningDescription} {(ws.CurrentStatus ? "发生" : "取消")}");
|
||||
|
||||
// if (string.IsNullOrWhiteSpace(this.InitialConfig.LogPath) || !InitialConfig.IsEnableCSV)
|
||||
// return;
|
||||
|
||||
// string path = Path.Combine(InitialConfig.LogPath, $"Alarm_{Name}_{now.ToString("yyyyMMdd")}.csv");
|
||||
// string head = "Time,Source,AlarmCode,AlarmDescription,AlarmStatus";
|
||||
// string data = $"{now.ToString("HH:mm:ss.fff")},{deviceName},{ws.WarningCode},{ws.WarningDescription},{(ws.CurrentStatus ? "报警发生" : "报警取消")}";
|
||||
// CSVRecordAsync(path, data, head);
|
||||
// });
|
||||
//}
|
||||
#endregion
|
||||
|
||||
#region IDisposable Support
|
||||
private bool disposedValue = false; // 要检测冗余调用
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!disposedValue)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
//释放托管状态(托管对象)。
|
||||
stateChangedTimer?.Dispose();
|
||||
pauseHandle?.Dispose();
|
||||
}
|
||||
|
||||
// TODO: 释放未托管的资源(未托管的对象)并在以下内容中替代终结器。
|
||||
// TODO: 将大型字段设置为 null。
|
||||
|
||||
disposedValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: 仅当以上 Dispose(bool disposing) 拥有用于释放未托管资源的代码时才替代终结器。
|
||||
// ~DeviceBase()
|
||||
// {
|
||||
// // 请勿更改此代码。将清理代码放入以上 Dispose(bool disposing) 中。
|
||||
// Dispose(false);
|
||||
// }
|
||||
|
||||
// 添加此代码以正确实现可处置模式。
|
||||
public void Dispose()
|
||||
{
|
||||
// 请勿更改此代码。将清理代码放入以上 Dispose(bool disposing) 中。
|
||||
Dispose(true);
|
||||
// TODO: 如果在以上内容中替代了终结器,则取消注释以下行。
|
||||
// GC.SuppressFinalize(this);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
12
DH.Commons/Base/GloablConfig.cs
Normal file
12
DH.Commons/Base/GloablConfig.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DH.Commons.Base
|
||||
{
|
||||
internal class GloablConfig
|
||||
{
|
||||
}
|
||||
}
|
@ -1,131 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
using AntdUI;
|
||||
|
||||
namespace DH.Commons.Base
|
||||
{
|
||||
public class GlobalConfig : NotifyProperty
|
||||
{
|
||||
string _name;
|
||||
private BindingList<PLCItem> _InitProcessList = new BindingList<PLCItem>();
|
||||
private BindingList<PLCItem> _StartProcessList = new BindingList<PLCItem>();
|
||||
private BindingList<PLCItem> _StopProcessList = new BindingList<PLCItem>();
|
||||
private BindingList<PLCItem> _StartResetList = new BindingList<PLCItem>();
|
||||
private BindingList<PLCItem> _StopResetList = new BindingList<PLCItem>();
|
||||
public string Name
|
||||
{
|
||||
get => _name;
|
||||
set
|
||||
{
|
||||
if (_name != value)
|
||||
{
|
||||
_name = value;
|
||||
OnPropertyChanged(nameof(Name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public BindingList<PLCItem> InitProcessList
|
||||
{
|
||||
get => _InitProcessList;
|
||||
set
|
||||
{
|
||||
if (_InitProcessList == value) return;
|
||||
_InitProcessList = value;
|
||||
OnPropertyChanged(nameof(InitProcessList));
|
||||
}
|
||||
}
|
||||
public BindingList<PLCItem> StartProcessList
|
||||
{
|
||||
get => _StartProcessList;
|
||||
set
|
||||
{
|
||||
if (_StartProcessList == value) return;
|
||||
_StartProcessList = value;
|
||||
OnPropertyChanged(nameof(StartProcessList));
|
||||
}
|
||||
}
|
||||
public BindingList<PLCItem> StopProcessList
|
||||
{
|
||||
get => _StopProcessList;
|
||||
set
|
||||
{
|
||||
if (_StopProcessList == value) return;
|
||||
_StopProcessList = value;
|
||||
OnPropertyChanged(nameof(StopProcessList));
|
||||
}
|
||||
}
|
||||
public BindingList<PLCItem> StartResetList
|
||||
{
|
||||
get => _StartResetList;
|
||||
set
|
||||
{
|
||||
if (_StartResetList == value) return;
|
||||
_StartResetList = value;
|
||||
OnPropertyChanged(nameof(StartResetList));
|
||||
}
|
||||
}
|
||||
public BindingList<PLCItem> StopResetList
|
||||
{
|
||||
get => _StopResetList;
|
||||
set
|
||||
{
|
||||
if (_StopResetList == value) return;
|
||||
_StopResetList = value;
|
||||
OnPropertyChanged(nameof(StopResetList));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
string _imgSavePath;
|
||||
string _dbSavePath;
|
||||
string _configSavePath;
|
||||
|
||||
public string ImgSavePath
|
||||
{
|
||||
get => _imgSavePath;
|
||||
set
|
||||
{
|
||||
if (_imgSavePath != value)
|
||||
{
|
||||
_imgSavePath = value;
|
||||
OnPropertyChanged(nameof(ImgSavePath));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string DbSavePath
|
||||
{
|
||||
get => _dbSavePath;
|
||||
set
|
||||
{
|
||||
if (_dbSavePath != value)
|
||||
{
|
||||
_dbSavePath = value;
|
||||
OnPropertyChanged(nameof(DbSavePath));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string ConfigSavePath
|
||||
{
|
||||
get => _configSavePath;
|
||||
set
|
||||
{
|
||||
if (_configSavePath != value)
|
||||
{
|
||||
_configSavePath = value;
|
||||
OnPropertyChanged(nameof(ConfigSavePath));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -8,7 +8,6 @@ namespace DH.Commons.Base
|
||||
{
|
||||
public class PLCBase : NotifyProperty
|
||||
{
|
||||
|
||||
// 私有字段
|
||||
private bool _enable;
|
||||
private bool _connected;
|
||||
@ -21,8 +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 AntList<PLCItem> _PLCItemList = new AntList<PLCItem>();
|
||||
[Category("设备配置")]
|
||||
[DisplayName("是否启用")]
|
||||
[Description("是否启用")]
|
||||
@ -181,7 +179,7 @@ namespace DH.Commons.Base
|
||||
[Category("点位配置")]
|
||||
[DisplayName("点位配置")]
|
||||
[Description("点位配置")]
|
||||
public BindingList<PLCItem> PLCItemList
|
||||
public AntList<PLCItem> PLCItemList
|
||||
{
|
||||
get => _PLCItemList;
|
||||
set
|
||||
@ -191,8 +189,6 @@ namespace DH.Commons.Base
|
||||
OnPropertyChanged(nameof(PLCItemList));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public virtual bool PLCConnect()
|
||||
{
|
||||
Connected = true;
|
||||
@ -205,23 +201,14 @@ namespace DH.Commons.Base
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual Int16 ReadInt16(string address) { return 0; }
|
||||
|
||||
public virtual Int32 ReadInt32(string address) { return 0; }
|
||||
|
||||
public virtual UInt16 ReadUInt16(string address) { return 0; }
|
||||
|
||||
public virtual UInt32 ReadUInt32(string address) { return 0; }
|
||||
public virtual ushort ReadShort(string address) { return 0; }
|
||||
public virtual int ReadInt(string address) { return 0; }
|
||||
public virtual float ReadFloat(string address) { return 0; }
|
||||
public virtual bool ReadBool(string address) { return false; }
|
||||
|
||||
public virtual bool WriteInt16(string address, Int16 value, bool waitForReply = true) { return false; }
|
||||
public virtual bool WriteInt32(string address, Int32 value, bool waitForReply = true) { return false; }
|
||||
|
||||
|
||||
public virtual bool WriteUInt16(string address, UInt16 value, bool waitForReply = true) { return false; }
|
||||
public virtual bool WriteUInt32(string address, UInt32 value, bool waitForReply = true) { return false; }
|
||||
|
||||
public virtual bool 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 WriteFloat(string address, float value, bool waitForReply = true) { return false; }
|
||||
public virtual bool WriteBool(string address, bool value, bool waitForReply = true) { return false; }
|
||||
}
|
||||
@ -231,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>
|
||||
/// 是否选中
|
||||
@ -267,7 +257,7 @@ namespace DH.Commons.Base
|
||||
}
|
||||
}
|
||||
}
|
||||
public EnumPLCDataType Type
|
||||
public string Type
|
||||
{
|
||||
get => _type;
|
||||
set
|
||||
@ -294,7 +284,18 @@ namespace DH.Commons.Base
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string NumTpye
|
||||
{
|
||||
get => _numtype;
|
||||
set
|
||||
{
|
||||
if (_numtype != value)
|
||||
{
|
||||
_numtype = value;
|
||||
OnPropertyChanged(nameof(NumTpye));
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 参数值
|
||||
/// </summary>
|
||||
@ -312,7 +313,7 @@ namespace DH.Commons.Base
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 启用状态
|
||||
/// 流程开启执行状态
|
||||
/// </summary>
|
||||
public bool StartExecute
|
||||
{
|
||||
@ -326,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
|
||||
{
|
||||
@ -346,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]
|
||||
@ -360,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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -3,7 +3,6 @@ using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using DH.Commons.Enums;
|
||||
using DH.Commons.Helper;
|
||||
using HalconDotNet;
|
||||
using OpenCvSharp;
|
||||
|
||||
@ -19,7 +18,7 @@ namespace DH.Commons.Base
|
||||
/// Object Detection 目标检测:寻找图像中的物体并进行定位;
|
||||
/// Instance Segmentation 实例分割:定位图中每个物体,并进行像素级标注,区分不同个体;
|
||||
/// </summary>
|
||||
public abstract class VisionEngineBase : DeviceBase
|
||||
public abstract class VisionEngineBase
|
||||
{
|
||||
public List<DetectionConfig> DetectionConfigs = new List<DetectionConfig>();
|
||||
#region event
|
||||
@ -51,25 +50,134 @@ namespace DH.Commons.Base
|
||||
{
|
||||
OnDetectionWarningStop?.Invoke(detectionDes);
|
||||
}
|
||||
public ImageSaveHelper ImageSaveHelper { get; set; } = new ImageSaveHelper();
|
||||
|
||||
public virtual void SaveImageAsync(string fullname, Bitmap saveMap, ImageFormat imageFormat)
|
||||
{
|
||||
if (saveMap != null)
|
||||
{
|
||||
ImageSaveSet imageSaveSet = new ImageSaveSet()
|
||||
{
|
||||
FullName = fullname,
|
||||
SaveImage = saveMap.CopyBitmap(),
|
||||
ImageFormat = imageFormat.DeepSerializeClone()
|
||||
//ImageSaveSet imageSaveSet = new ImageSaveSet()
|
||||
//{
|
||||
// FullName = fullname,
|
||||
// SaveImage = saveMap.CopyBitmap(),
|
||||
// ImageFormat = imageFormat.DeepSerializeClone()
|
||||
//};
|
||||
|
||||
};
|
||||
|
||||
ImageSaveHelper.ImageSaveAsync(imageSaveSet);
|
||||
//ImageSaveHelper.ImageSaveAsync(imageSaveSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
public class CamModuleXY
|
||||
{
|
||||
[Category("图片行")]
|
||||
[DisplayName("行")]
|
||||
[Description("行")]
|
||||
// [TypeConverter(typeof(DeviceIdSelectorConverter<CameraBase>))]
|
||||
//[TypeConverter(typeof(CollectionCountConvert))]
|
||||
public int PicRows { get; set; } = 1;
|
||||
|
||||
[Category("图片列")]
|
||||
[DisplayName("列")]
|
||||
[Description("列")]
|
||||
// [TypeConverter(typeof(DeviceIdSelectorConverter<CameraBase>))]
|
||||
//[TypeConverter(typeof(CollectionCountConvert))]
|
||||
public int PicCols { get; set; } = 1;
|
||||
|
||||
public string GetDisplayText()
|
||||
{
|
||||
return "行:" + PicRows.ToString() + "列:" + PicCols.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
//public class RelatedCamera
|
||||
//{
|
||||
|
||||
// [Category("关联相机")]
|
||||
// [DisplayName("关联相机")]
|
||||
// [Description("关联相机描述")]
|
||||
// //[TypeConverter(typeof(DeviceIdSelectorConverter<CameraBase>))]
|
||||
// //[TypeConverter(typeof(CollectionCountConvert))]
|
||||
// public string CameraSourceId { get; set; } = "";
|
||||
|
||||
|
||||
// //public string GetDisplayText()
|
||||
// //{
|
||||
// // using (var scope = GlobalVar.Container.BeginLifetimeScope())
|
||||
// // {
|
||||
// // List<IDevice> deviceList = scope.Resolve<List<IDevice>>();
|
||||
// // IDevice CameraDevice = deviceList.FirstOrDefault(dev => dev.Id.Equals(CameraSourceId));
|
||||
|
||||
// // if (CameraDevice != null && CameraDevice is CameraBase)
|
||||
// // {
|
||||
// // return CameraDevice.Name;
|
||||
// // }
|
||||
|
||||
// // }
|
||||
// // return CameraSourceId;
|
||||
// //}
|
||||
//}
|
||||
public class VisionEngineInitialConfigBase //: InitialConfigBase
|
||||
{
|
||||
[Category("深度学习检测配置")]
|
||||
[DisplayName("检测配置集合")]
|
||||
[Description("检测配置集合")]
|
||||
//[TypeConverter(typeof(CollectionCountConvert))]
|
||||
//[Editor(typeof(ComplexCollectionEditor<DetectionConfig>), typeof(UITypeEditor))]
|
||||
public List<DetectionConfig> DetectionConfigs { get; set; } = new List<DetectionConfig>();
|
||||
|
||||
[Category("深度学习检测配置")]
|
||||
[DisplayName("标签分类")]
|
||||
[Description("标签分类,A_NG,B_TBD...")]
|
||||
// [TypeConverter(typeof(CollectionCountConvert))]
|
||||
// [Editor(typeof(ComplexCollectionEditor<RecongnitionLabelCategory>), typeof(UITypeEditor))]
|
||||
public List<RecongnitionLabelCategory> RecongnitionLabelCategoryList { get; set; } = new List<RecongnitionLabelCategory>();
|
||||
|
||||
[Category("深度学习检测配置")]
|
||||
[DisplayName("检测标签定义集合")]
|
||||
[Description("定义检测标签的集合,例如:Seg/Detection模式:断裂、油污、划伤...;Class模式:ok、ng、上面、下面、套环、正常...")]
|
||||
// [TypeConverter(typeof(CollectionCountConvert))]
|
||||
// [Editor(typeof(ComplexCollectionEditor<RecongnitionLabel>), typeof(UITypeEditor))]
|
||||
public List<RecongnitionLabel> RecongnitionLabelList { get; set; } = new List<RecongnitionLabel>();
|
||||
|
||||
[Category("深度学习检测配置")]
|
||||
[DisplayName("标签置信度")]
|
||||
[Description("标签置信度,过滤小于改置信度的标签,大于该设置的标签才能识别")]
|
||||
public float Score { get; set; } = 0.5f;
|
||||
|
||||
[Category("深度学习检测配置")]
|
||||
[DisplayName("CPU线程数量")]
|
||||
[Description("用于深度学习的CPU线程数量,不要设置太大,会单独占用线程,影响其他程序运行")]
|
||||
public int CPUNums { get; set; } = 1;
|
||||
|
||||
//[Category("深度学习检测配置")]
|
||||
//[DisplayName("检测项GPU指定")]
|
||||
//[Description("将检测项指定到GPU")]
|
||||
// [TypeConverter(typeof(CollectionCountConvert))]
|
||||
// [Editor(typeof(ComplexCollectionEditor<DetectionGPUConfig>), typeof(UITypeEditor))]
|
||||
// public List<DetectionGPUConfig> DetectionGPUList { get; set; } = new List<DetectionGPUConfig>();
|
||||
|
||||
// [Category("数据保存配置")]
|
||||
//[DisplayName("是否保存检测明细CSV")]
|
||||
//[Description("是否保存 检测明细CSV")]
|
||||
//public override bool IsEnableCSV { get; set; } = true;
|
||||
|
||||
//[Category("数据保存配置")]
|
||||
//[DisplayName("是否保存检测图片")]
|
||||
//[Description("是否保存 检测图片,总开关")]
|
||||
//public bool IsSaveImage { get; set; } = true;
|
||||
|
||||
//[Category("数据保存配置")]
|
||||
//[Description("检测图片 保存文件夹")]
|
||||
//[DisplayName("检测图片保存文件夹")]
|
||||
//[Editor(typeof(FoldDialogEditor), typeof(UITypeEditor))]
|
||||
//public string ImageSaveDirectory { get; set; } = "D:\\PROJECTS\\X017\\Images";
|
||||
|
||||
//[Category("数据保存配置")]
|
||||
//[Description("检测明细CSV文件夹")]
|
||||
//[DisplayName("检测明细CSV文件夹")]
|
||||
//[Editor(typeof(FoldDialogEditor), typeof(UITypeEditor))]
|
||||
//public string CSVDataPath { get; set; } = "D:\\PROJECTS\\X017\\Images";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -14,9 +14,14 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AntdUI" Version="1.8.9" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="OpenCvSharp4" Version="4.10.0.20241108" />
|
||||
<PackageReference Include="OpenCvSharp4.Extensions" Version="4.10.0.20241108" />
|
||||
<PackageReference Include="OpenCvSharp4.runtime.win" Version="4.10.0.20241108" />
|
||||
|
@ -7,13 +7,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace DH.Commons.Enums
|
||||
{
|
||||
public enum EnumStatus
|
||||
{
|
||||
未运行,
|
||||
运行中,
|
||||
警告,
|
||||
异常
|
||||
}
|
||||
|
||||
public enum ModelType
|
||||
{
|
||||
图像分类 = 1,
|
||||
@ -97,8 +91,10 @@ namespace DH.Commons.Enums
|
||||
工位8 ,
|
||||
工位9 ,
|
||||
工位10 ,
|
||||
相机触发时间,
|
||||
吹气时间,
|
||||
OK料盒 ,
|
||||
NG料盒,
|
||||
OK吹气时间,
|
||||
NG吹气时间,
|
||||
产品计数,
|
||||
计数清零,
|
||||
工件最小值,
|
||||
@ -113,9 +109,6 @@ namespace DH.Commons.Enums
|
||||
挡料电机位置,
|
||||
OK脉冲,
|
||||
NG脉冲,
|
||||
状态复位,
|
||||
启用定位,
|
||||
定位完成脉冲值
|
||||
|
||||
|
||||
|
||||
@ -125,22 +118,18 @@ namespace DH.Commons.Enums
|
||||
|
||||
public enum EnumPLCDataType
|
||||
{
|
||||
单字整型,
|
||||
双字整型,
|
||||
浮点型,
|
||||
布尔型
|
||||
HD,
|
||||
D,
|
||||
M
|
||||
}
|
||||
public enum EnumPLCINTType
|
||||
{
|
||||
单字16位,
|
||||
单字32位,
|
||||
双字16位,
|
||||
双字32位
|
||||
}
|
||||
|
||||
public enum EnumBool
|
||||
{
|
||||
关闭,
|
||||
启用
|
||||
}
|
||||
public enum EnumBool1
|
||||
{
|
||||
False,
|
||||
True
|
||||
}
|
||||
public enum StreamFormat
|
||||
{
|
||||
[Description("8位图像")]
|
||||
|
@ -1,64 +0,0 @@
|
||||
using System;
|
||||
using static DH.Commons.Enums.EnumHelper;
|
||||
|
||||
|
||||
namespace DH.Commons.Helper
|
||||
{
|
||||
public enum ExceptionLevel
|
||||
{
|
||||
Info = 0,
|
||||
Warning = 1,
|
||||
Fatal = 2,
|
||||
}
|
||||
|
||||
//public delegate void OnProcessExceptionRaisedDelegate(DateTime dt, ProcessException ex);
|
||||
//[Serializable]
|
||||
public class ProcessException : Exception
|
||||
{
|
||||
public ExceptionLevel Level { get; set; } = ExceptionLevel.Warning;
|
||||
|
||||
public ProcessException()
|
||||
{
|
||||
}
|
||||
|
||||
public ProcessException(Exception ex, ExceptionLevel lvl = ExceptionLevel.Warning) : base(ex.Message, ex)
|
||||
{
|
||||
Level = lvl;
|
||||
ExceptionNotice();
|
||||
}
|
||||
|
||||
public ProcessException(string error, Exception ex = null, ExceptionLevel lvl = ExceptionLevel.Warning) : base(error, ex)
|
||||
{
|
||||
Level = lvl;
|
||||
ExceptionNotice();
|
||||
}
|
||||
|
||||
public void ExceptionNotice()
|
||||
{
|
||||
//OnProcessExceptionRaised?.Invoke(DateTime.Now, this);
|
||||
}
|
||||
}
|
||||
|
||||
public static class ExceptionHelper
|
||||
{
|
||||
public static LogLevel LogLevel = LogLevel.Information;
|
||||
public static string GetExceptionMessage(this Exception ex)
|
||||
{
|
||||
string msg = "异常信息:" + ex.Message;
|
||||
if (ex.InnerException != null)
|
||||
{
|
||||
msg += ";\t内部异常信息:" + ex.InnerException.GetExceptionMessage();
|
||||
}
|
||||
|
||||
if (LogLevel <= LogLevel.Assist)
|
||||
{
|
||||
msg += (";\r\n\t\tStackTrace:" + ex.StackTrace);
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
|
||||
public class AuthorityException : ProcessException
|
||||
{
|
||||
}
|
||||
}
|
@ -1,162 +0,0 @@
|
||||
using DH.Commons.Enums;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using static DH.Commons.Enums.EnumHelper;
|
||||
|
||||
|
||||
namespace DH.Commons.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备特性,指示该信息的设备类型,适用于设备信息和配置信息
|
||||
/// </summary>
|
||||
public class DeviceAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备类型
|
||||
/// </summary>
|
||||
public string TypeCode { get; set; }
|
||||
|
||||
public string TypeDescription { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 特性修饰类别
|
||||
/// </summary>
|
||||
public DeviceAttributeType AttrType { get; set; }
|
||||
|
||||
public DeviceAttribute(string typeCode, string typeDesc, EnumHelper.DeviceAttributeType attrType)
|
||||
{
|
||||
TypeCode = typeCode;
|
||||
TypeDescription = typeDesc;
|
||||
AttrType = attrType;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 预置状态特性 指定该修饰信息的前置状态允许范围
|
||||
/// </summary>
|
||||
public class PreStateAttribute : Attribute
|
||||
{
|
||||
public int PreState { get; set; }
|
||||
public PreStateAttribute(int _preState)
|
||||
{
|
||||
PreState = _preState;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查当前待执行操作的前置状态要求是否合法
|
||||
/// </summary>
|
||||
/// <param name="currentState"></param>
|
||||
/// <returns></returns>
|
||||
public bool CheckPreStateValid(int currentState)
|
||||
{
|
||||
return (currentState & PreState) == currentState;
|
||||
}
|
||||
}
|
||||
|
||||
public class ColorSelectAttribute : Attribute
|
||||
{
|
||||
public string SelectedColor { get; set; }
|
||||
public ColorSelectAttribute(string selectedColor)
|
||||
{
|
||||
SelectedColor = selectedColor;
|
||||
}
|
||||
}
|
||||
|
||||
public class FontColorSelectAttribute : Attribute
|
||||
{
|
||||
public string SelectedColor { get; set; }
|
||||
public FontColorSelectAttribute(string selectedColor)
|
||||
{
|
||||
SelectedColor = selectedColor;
|
||||
}
|
||||
}
|
||||
|
||||
public enum InvokeType
|
||||
{
|
||||
/// <summary>
|
||||
/// 不公开调用
|
||||
/// </summary>
|
||||
[Description("不公开调用")]
|
||||
NoneInvoke = 0,
|
||||
/// <summary>
|
||||
/// 测试调用
|
||||
/// </summary>
|
||||
[Description("测试调用")]
|
||||
TestInvoke = 1,
|
||||
/// <summary>
|
||||
/// 标定调用
|
||||
/// </summary>
|
||||
[Description("标定调用")]
|
||||
CalibInvoke = 2,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 用来修饰对外开放的调用方法的特性
|
||||
/// 调用方法参数顺序:IOperationConfig,InvokeDevice,SourceDevice
|
||||
/// </summary>
|
||||
public class ProcessMethodAttribute : Attribute
|
||||
{
|
||||
public string MethodCode { get; set; }
|
||||
public string MethodDesc { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否提供人工调用测试
|
||||
/// </summary>
|
||||
public InvokeType InvokeType { get; set; }
|
||||
|
||||
public string DeviceType { get; set; }
|
||||
|
||||
public ProcessMethodAttribute(string deviceType, string code, string description, InvokeType invokeType)
|
||||
{
|
||||
DeviceType = deviceType;
|
||||
MethodCode = code;
|
||||
MethodDesc = description;
|
||||
InvokeType = invokeType;
|
||||
}
|
||||
}
|
||||
|
||||
public class SwitchDisplayAttribute : Attribute
|
||||
{
|
||||
public string SwitchName { get; set; }
|
||||
|
||||
public bool SwithOnStatus { get; set; } = true;
|
||||
|
||||
public SwitchDisplayAttribute(string name, bool status)
|
||||
{
|
||||
SwitchName = name;
|
||||
SwithOnStatus = status;
|
||||
}
|
||||
}
|
||||
|
||||
public class ElementAttribute : Attribute
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Desc { get; set; }
|
||||
|
||||
public string IconPath { get; set; }
|
||||
|
||||
public bool IsShowInToolBar { get; set; }
|
||||
|
||||
public ElementAttribute(string desc, string iconPath, bool isShowInToolBar = true, [CallerMemberName] string name = "")
|
||||
{
|
||||
Name = name;
|
||||
Desc = desc;
|
||||
IconPath = iconPath;
|
||||
IsShowInToolBar = isShowInToolBar;
|
||||
}
|
||||
}
|
||||
|
||||
public class ProcessAttribute : Attribute
|
||||
{
|
||||
public string ProcessCode { get; set; }
|
||||
public DeviceAttributeType AttrType { get; set; }
|
||||
|
||||
public ProcessAttribute(string stationCode, DeviceAttributeType attrType)
|
||||
{
|
||||
ProcessCode = stationCode;
|
||||
AttrType = attrType;
|
||||
}
|
||||
}
|
||||
}
|
@ -101,8 +101,7 @@ namespace DH.Commons.Helper
|
||||
{
|
||||
ConfigModel.CameraBaseList,
|
||||
ConfigModel.PLCBaseList,
|
||||
ConfigModel.DetectionList,
|
||||
ConfigModel.GlobalList,
|
||||
ConfigModel.DetectionList
|
||||
}, _jsonOptions);
|
||||
|
||||
// 写入新配置
|
||||
@ -158,9 +157,8 @@ namespace DH.Commons.Helper
|
||||
var data = JsonSerializer.Deserialize<ConfigData>(json, _jsonOptions);
|
||||
|
||||
ConfigModel.CameraBaseList = data?.Cameras ?? new List<CameraBase>();
|
||||
ConfigModel.DetectionList = data?.Detections ?? new List<DetectionConfig>();
|
||||
ConfigModel.PLCBaseList = data?.PLCs ?? new List<PLCBase>();
|
||||
ConfigModel.GlobalList = data?.GlobalConfigs ?? new List<GlobalConfig>();
|
||||
ConfigModel.DetectionList = data?.Detections ?? new List<DetectionConfig>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -263,10 +261,6 @@ namespace DH.Commons.Helper
|
||||
|
||||
[JsonPropertyName("detectionList")]
|
||||
public List<DetectionConfig> Detections { get; set; } = new List<DetectionConfig>();
|
||||
[JsonPropertyName("globalList")]
|
||||
public List<GlobalConfig> GlobalConfigs { get; set; } = new List<GlobalConfig>();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -120,40 +120,6 @@ namespace DH.Commons.Enums
|
||||
.FirstOrDefault() as DescriptionAttribute;
|
||||
return attribute?.Description ?? value.ToString();
|
||||
}
|
||||
|
||||
public static System.Drawing.Color GetEnumSelectedColor(this Enum enumObj)
|
||||
{
|
||||
Type t = enumObj.GetType();
|
||||
FieldInfo f = t.GetField(enumObj.ToString());
|
||||
|
||||
ColorSelectAttribute attr = f.GetCustomAttribute<ColorSelectAttribute>();
|
||||
if (attr != null)
|
||||
{
|
||||
return System.Drawing.Color.FromName(attr.SelectedColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
return System.Drawing.Color.Transparent;
|
||||
}
|
||||
}
|
||||
|
||||
public static System.Drawing.Color GetEnumSelectedFontColor(this Enum enumObj)
|
||||
{
|
||||
Type t = enumObj.GetType();
|
||||
FieldInfo f = t.GetField(enumObj.ToString());
|
||||
|
||||
var attr = f.GetCustomAttribute<FontColorSelectAttribute>();
|
||||
if (attr != null)
|
||||
{
|
||||
return System.Drawing.Color.FromName(attr.SelectedColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
return System.Drawing.Color.Transparent;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Flags]
|
||||
public enum DeviceAttributeType
|
||||
{
|
||||
@ -286,37 +252,6 @@ namespace DH.Commons.Enums
|
||||
MeasureResult = 31,
|
||||
}
|
||||
|
||||
public enum LogLevel
|
||||
{
|
||||
[Description("详细")]
|
||||
[ColorSelect("White")]
|
||||
[FontColorSelect("Green")]
|
||||
Detail = 2,
|
||||
[Description("信息")]
|
||||
[ColorSelect("White")]
|
||||
[FontColorSelect("Dark")]
|
||||
Information = 3,
|
||||
[Description("辅助")]
|
||||
[ColorSelect("White")]
|
||||
[FontColorSelect("Blue")]
|
||||
Assist = 4,
|
||||
[Description("动作")]
|
||||
[ColorSelect("DarkGreen")]
|
||||
[FontColorSelect("Yellow")]
|
||||
Action = 5,
|
||||
[Description("错误")]
|
||||
[ColorSelect("Orange")]
|
||||
[FontColorSelect("White")]
|
||||
Error = 6,
|
||||
[Description("警报")]
|
||||
[ColorSelect("Brown")]
|
||||
[FontColorSelect("White")]
|
||||
Warning = 7,
|
||||
[Description("异常")]
|
||||
[ColorSelect("Red")]
|
||||
[FontColorSelect("White")]
|
||||
Exception = 8,
|
||||
}
|
||||
//public enum CameraDriverType
|
||||
//{
|
||||
// Halcon,
|
||||
@ -337,59 +272,6 @@ namespace DH.Commons.Enums
|
||||
// NG = -1,
|
||||
// IGNORE = -999,
|
||||
//}
|
||||
public enum DeviceState
|
||||
{
|
||||
TBD = -1,
|
||||
|
||||
[ColorSelect("Gray")]
|
||||
[FontColorSelect("Black")]
|
||||
[Description("未初始化")]
|
||||
DSUninit = 1,
|
||||
|
||||
[ColorSelect("Gold")]
|
||||
[FontColorSelect("White")]
|
||||
[PreState(1 + 2 + 4 + 8 + 32)]
|
||||
[Description("初始化")]
|
||||
DSInit = 2,
|
||||
|
||||
[ColorSelect("Lime")]
|
||||
[FontColorSelect("Black")]
|
||||
[PreState(2 + 4 + 16)]
|
||||
[Description("运行中")]
|
||||
DSOpen = 4,
|
||||
|
||||
[ColorSelect("Gray")]
|
||||
[FontColorSelect("White")]
|
||||
[PreState(1 + 4 + 8 + 16 + 32)]
|
||||
[Description("关闭")]
|
||||
DSClose = 8,
|
||||
|
||||
[ColorSelect("Gold")]
|
||||
[FontColorSelect("White")]
|
||||
[PreState(4 + 16)]
|
||||
[Description("暂停")]
|
||||
DSPause = 16,
|
||||
|
||||
[ColorSelect("Red")]
|
||||
[FontColorSelect("White")]
|
||||
[Description("异常")]
|
||||
DSExcept = 32
|
||||
}
|
||||
public enum RunState
|
||||
{
|
||||
[ColorSelect("Gold")]
|
||||
[Description("空闲")]
|
||||
Idle = 1,
|
||||
[ColorSelect("Lime")]
|
||||
[Description("运行中")]
|
||||
Running = 2,
|
||||
[ColorSelect("Gray")]
|
||||
[Description("停止")]
|
||||
Stop = 3,
|
||||
[ColorSelect("Red")]
|
||||
[Description("宕机")]
|
||||
Down = 99,
|
||||
}
|
||||
|
||||
public enum PriorityDirection
|
||||
{
|
||||
|
@ -1,107 +0,0 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using DH.Commons.Helper;
|
||||
|
||||
namespace DH.Commons.Enums
|
||||
{
|
||||
public class ImageSaveHelper
|
||||
{
|
||||
public event Action<DateTime, string> OnImageSaveExceptionRaised;
|
||||
|
||||
//private string baseDirectory = "";
|
||||
//public string BaseDirectory
|
||||
//{
|
||||
// get => baseDirectory;
|
||||
// set
|
||||
// {
|
||||
// baseDirectory = value;
|
||||
// if (string.IsNullOrWhiteSpace(baseDirectory) || !Path.IsPathRooted(baseDirectory))
|
||||
// {
|
||||
// baseDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Images");
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
public bool EnableImageSave { get; set; } = true;
|
||||
|
||||
public ImageSaveHelper() { }
|
||||
public ImageSaveHelper(bool enableImageSave = true)
|
||||
{
|
||||
EnableImageSave = enableImageSave;
|
||||
}
|
||||
|
||||
|
||||
object lockObj = new object();
|
||||
////耗时操作从 _taskFactory分配线程
|
||||
//public TaskFactory _taskFactory = new TaskFactory(TaskCreationOptions.LongRunning, TaskContinuationOptions.LongRunning);
|
||||
readonly ConcurrentQueue<ImageSaveSet> _imageQueue = new ConcurrentQueue<ImageSaveSet>();
|
||||
Task _saveTask = null;
|
||||
readonly object _saveLock = new object();
|
||||
|
||||
public async void ImageSaveAsync(ImageSaveSet set)
|
||||
{
|
||||
if (!EnableImageSave)
|
||||
return;
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
_imageQueue.Enqueue(set);
|
||||
|
||||
lock (_saveLock)
|
||||
{
|
||||
if (_saveTask == null)
|
||||
{
|
||||
_saveTask = Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
while (_imageQueue.Count > 0)
|
||||
{
|
||||
if (_imageQueue.TryDequeue(out ImageSaveSet saveSet))
|
||||
{
|
||||
if (!Directory.Exists(Path.GetDirectoryName(saveSet.FullName)))
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(saveSet.FullName));
|
||||
}
|
||||
if (saveSet.SaveImage != null)
|
||||
{
|
||||
saveSet.SaveImage.Save(saveSet.FullName, saveSet.ImageFormat);
|
||||
saveSet.SaveImage.Dispose();
|
||||
}
|
||||
saveSet = null;
|
||||
}
|
||||
}
|
||||
|
||||
await Task.Delay(2000);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
OnImageSaveExceptionRaised?.Invoke(DateTime.Now, $"图片保存异常:{ex.GetExceptionMessage()}");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public class ImageSaveSet
|
||||
{
|
||||
public string FullName { get; set; }//带后缀 全路径
|
||||
|
||||
public Bitmap SaveImage { get; set; }
|
||||
|
||||
public ImageFormat ImageFormat { get; set; } = ImageFormat.Jpeg;
|
||||
}
|
||||
}
|
@ -1,138 +0,0 @@
|
||||
using DH.Commons.Helper;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using static DH.Commons.Enums.EnumHelper;
|
||||
|
||||
namespace DH.Commons.Enums
|
||||
{
|
||||
public interface ILogOutput
|
||||
{
|
||||
event Action<LogMsg> OnLogMsgOutput;
|
||||
void LogDisplay(LogMsg msg);
|
||||
}
|
||||
public interface ILogger
|
||||
{
|
||||
event Action<LogMsg> OnLog;
|
||||
LoggerHelper LoggerHelper { get; set; }
|
||||
//void LogAsync(DateTime dt, LogLevel loglevel, string msg);
|
||||
void LogAsync(LogMsg msg);
|
||||
}
|
||||
public class LoggerHelper
|
||||
{
|
||||
public event Action<DateTime, string> OnLogExceptionRaised;
|
||||
|
||||
public string LogPath { get; set; }
|
||||
public string LogPrefix { get; set; }
|
||||
|
||||
LogLevel LogLevel = LogLevel.Information;
|
||||
|
||||
public LoggerHelper() { }
|
||||
public LoggerHelper(string logPath, string logPrefix, LogLevel logLevel = LogLevel.Information)
|
||||
{
|
||||
LogPath = logPath;
|
||||
LogPrefix = logPrefix;
|
||||
|
||||
LogLevel = logLevel;
|
||||
}
|
||||
|
||||
public void SetLogLevel(LogLevel logLevel)
|
||||
{
|
||||
if (LogLevel != logLevel)
|
||||
LogLevel = logLevel;
|
||||
}
|
||||
////耗时操作从 _taskFactory分配线程
|
||||
//public TaskFactory _taskFactory = new TaskFactory(TaskCreationOptions.LongRunning, TaskContinuationOptions.LongRunning);
|
||||
readonly ConcurrentQueue<LogMsg> _logQueue = new ConcurrentQueue<LogMsg>();
|
||||
Task _logTask = null;
|
||||
readonly object _logLock = new object();
|
||||
|
||||
public async void LogAsync(LogMsg msg)
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
_logQueue.Enqueue(msg);
|
||||
|
||||
lock (_logLock)
|
||||
{
|
||||
if (_logTask == null)
|
||||
{
|
||||
_logTask = Task.Run(async () =>
|
||||
{
|
||||
string filePath = Path.Combine(LogPath, $"{(string.IsNullOrWhiteSpace(LogPrefix) ? "Log_" : ("Log_" + LogPrefix + "_"))}{DateTime.Now.ToString("yyyyMMdd")}.txt");
|
||||
try
|
||||
{
|
||||
if (!StaticHelper.CheckFilesCanUse(filePath))
|
||||
{
|
||||
OnLogExceptionRaised?.Invoke(DateTime.Now, $"日志文件{filePath}被占用,无法写入");
|
||||
return;
|
||||
}
|
||||
using (StreamWriter writer = new StreamWriter(filePath, true, System.Text.Encoding.UTF8))
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
if (!Directory.Exists(LogPath))
|
||||
{
|
||||
Directory.CreateDirectory(LogPath);
|
||||
}
|
||||
|
||||
while (_logQueue.Count > 0)
|
||||
{
|
||||
if (_logQueue.TryDequeue(out LogMsg log))
|
||||
{
|
||||
if (log.LogLevel >= LogLevel)
|
||||
{
|
||||
writer.WriteLine($"{log.LogTime.ToString("yyyy-MM-dd HH:mm:ss.fff")}[{log.ThreadId}]\t{log.LogLevel.GetEnumDescription()}\t{log.Msg}");
|
||||
}
|
||||
}
|
||||
}
|
||||
writer.Flush();
|
||||
|
||||
await Task.Delay(2000);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//OnLogExceptionRaised?.Invoke(DateTime.Now, $"日志文件{filePath}写入异常:/*{ex.GetExceptionMessage()*/}");
|
||||
OnLogExceptionRaised?.Invoke(DateTime.Now, $"日志文件{filePath}写入异常");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void LogAsync(DateTime dt, LogLevel logLevel, string msg)
|
||||
{
|
||||
LogAsync(new LogMsg(dt, logLevel, msg));
|
||||
}
|
||||
}
|
||||
|
||||
public class LogMsg
|
||||
{
|
||||
public DateTime LogTime { get; set; }
|
||||
public LogLevel LogLevel { get; set; }
|
||||
//public string Prefix { get; set; }
|
||||
public string Msg { get; set; }
|
||||
|
||||
public string MsgSource { get; set; }
|
||||
|
||||
public int ThreadId { get; set; }
|
||||
|
||||
public LogMsg() { }
|
||||
public LogMsg(DateTime dt, LogLevel logLevel, string msg)
|
||||
{
|
||||
LogTime = dt;
|
||||
LogLevel = logLevel;
|
||||
Msg = msg;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{LogTime.ToString("HH:mm:ss.fff")}\t{MsgSource}\t{Msg}";
|
||||
}
|
||||
}
|
||||
}
|
@ -1,680 +0,0 @@
|
||||
using Microsoft.CSharp.RuntimeBinder;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Dynamic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.ExceptionServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
|
||||
namespace DH.Commons.Helper
|
||||
{
|
||||
public static class StaticHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 数值转换为byte数组 高位在前,低位在后
|
||||
/// </summary>
|
||||
/// <param name="number"></param>
|
||||
/// <param name="size"></param>
|
||||
/// <returns></returns>
|
||||
public static byte[] IntToBytes(this int number, int size = 2)
|
||||
{
|
||||
byte[] result = new byte[size];
|
||||
|
||||
int temp = size;
|
||||
while (temp > 0)
|
||||
{
|
||||
result[size - temp] = (byte)(number >> ((temp - 1) * 8) & 0xff);
|
||||
|
||||
temp--;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
public static T DeepSerializeClone<T>(this T t)
|
||||
{
|
||||
return JsonConvert.DeserializeObject<T>(JsonConvert.SerializeObject(t));
|
||||
}
|
||||
/// <summary>
|
||||
/// 字节数组转换为整数
|
||||
/// </summary>
|
||||
/// <param name="data">字节数组</param>
|
||||
/// <param name="HtL">true:数组序号低的在高位 false:数组序号低的在低位</param>
|
||||
/// <returns></returns>
|
||||
public static int BytesToInt(this byte[] data, bool HtL = true)
|
||||
{
|
||||
int res = 0;
|
||||
|
||||
for (int i = 0; i < data.Length; i++)
|
||||
{
|
||||
int index = i;
|
||||
|
||||
if (HtL)
|
||||
{
|
||||
index = data.Length - 1 - i;
|
||||
}
|
||||
|
||||
res += data[index] << (8 * i);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取一个类指定的属性值
|
||||
/// </summary>
|
||||
/// <param name="info">object对象</param>
|
||||
/// <param name="field">属性名称</param>
|
||||
/// <returns></returns>
|
||||
public static object GetPropertyValue(object info, string field)
|
||||
{
|
||||
if (info == null) return null;
|
||||
Type t = info.GetType();
|
||||
IEnumerable<System.Reflection.PropertyInfo> property = from pi in t.GetProperties() where pi.Name.ToLower() == field.ToLower() select pi;
|
||||
return property.First().GetValue(info, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将32位整形拆分为无符号16位整形
|
||||
/// </summary>
|
||||
/// <param name="num">需要拆分的32位整形</param>
|
||||
/// <param name="bitNum">拆分为16位整形的位数 1或者2</param>
|
||||
/// <param name="HtL">true:高位在前,低位在后;false:高位在后,低位在前</param>
|
||||
/// <returns></returns>
|
||||
public static List<ushort> ParseIntToUnsignShortList(this int num, int bitNum = 2, bool HtL = false)
|
||||
{
|
||||
if (bitNum == 2)
|
||||
{
|
||||
ushort high = (ushort)(num >> 16);
|
||||
ushort low = (ushort)num;
|
||||
|
||||
if (HtL)
|
||||
{
|
||||
return new List<ushort>() { high, low };
|
||||
}
|
||||
else
|
||||
{
|
||||
return new List<ushort>() { low, high };
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (num < 0)
|
||||
{
|
||||
num = ushort.MaxValue + 1 + num;
|
||||
}
|
||||
|
||||
return new List<ushort>() { (ushort)num };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将32位整形数组拆分为无符号16位整形数组
|
||||
/// </summary>
|
||||
/// <param name="list">需要拆分的32位整形</param>
|
||||
/// <param name="bitNum">拆分为16位整形的位数 1或者2</param>
|
||||
/// <param name="HtL">true:高位在前,低位在后;false:高位在后,低位在前</param>
|
||||
/// <returns></returns>
|
||||
public static List<ushort> ParseIntToUnsignShortList(this List<int> list, int bitNum = 2, bool HtL = false)
|
||||
{
|
||||
return list.SelectMany(u => u.ParseIntToUnsignShortList(bitNum, HtL)).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将ushort的集合转换为16位带符号整形
|
||||
/// </summary>
|
||||
/// <param name="numList"></param>
|
||||
/// <param name="bitNum">合并的位数 1或者2</param>
|
||||
/// <param name="HtL">true:高位在前,低位在后;false:高位在后,低位在前</param>
|
||||
/// <returns></returns>
|
||||
public static List<int> ParseUnsignShortListToInt(this List<int> numList, int bitNum = 2, bool HtL = false)
|
||||
{
|
||||
if (bitNum == 1)
|
||||
{
|
||||
return numList.ConvertAll(n =>
|
||||
{
|
||||
int num = n;
|
||||
if (num > short.MaxValue)
|
||||
{
|
||||
num = num - ushort.MaxValue - 1;
|
||||
}
|
||||
|
||||
return num;
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
List<int> list = new List<int>();
|
||||
for (int i = 0; i < numList.Count; i += 2)
|
||||
{
|
||||
int high = HtL ? numList[i] : numList[i + 1];
|
||||
int low = HtL ? numList[i + 1] : numList[i];
|
||||
list.Add((high << 16) | low);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
//public static T DeepSerializeClone<T>(this T t)
|
||||
//{
|
||||
// return JsonConvert.DeserializeObject<T>(JsonConvert.SerializeObject(t));
|
||||
//}
|
||||
|
||||
public static void DataFrom<T1, T2>(this T1 destT, T2 sourceT, List<string> exceptionProps = null) where T1 : class where T2 : class
|
||||
{
|
||||
if (sourceT == null)
|
||||
{
|
||||
destT = null;
|
||||
return;
|
||||
}
|
||||
|
||||
PropertyInfo[] propDest = destT.GetType().GetProperties();//.Where(p => !(p.GetMethod.IsVirtual && !p.GetMethod.IsFinal)).ToArray();
|
||||
PropertyInfo[] propSource = sourceT.GetType().GetProperties();
|
||||
|
||||
Array.ForEach(propDest, prop =>
|
||||
{
|
||||
if (exceptionProps == null || !exceptionProps.Contains(prop.Name))
|
||||
{
|
||||
if (prop.CanWrite)
|
||||
{
|
||||
PropertyInfo propS = propSource.FirstOrDefault(p => p.Name == prop.Name);
|
||||
if (propS != null && propS.CanRead)
|
||||
{
|
||||
prop.SetValue(destT, propS.GetValue(sourceT));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//RtlMoveMemory
|
||||
[DllImport("kernel32.dll", EntryPoint = "RtlMoveMemory", SetLastError = false)]
|
||||
public static extern void CopyMemory(IntPtr dest, IntPtr src, uint count);
|
||||
[HandleProcessCorruptedStateExceptions]
|
||||
//public static Bitmap CopyBitmap(this Bitmap source)
|
||||
//{
|
||||
// Bitmap clone = new Bitmap(source.Width, source.Height, source.PixelFormat);
|
||||
// try
|
||||
// {
|
||||
// int PixelSize = Bitmap.GetPixelFormatSize(source.PixelFormat) / 8;
|
||||
// if (PixelSize == 1)
|
||||
// {
|
||||
// ColorPalette cp = clone.Palette;
|
||||
// for (int i = 0; i < 256; i++)
|
||||
// {
|
||||
// cp.Entries[i] = Color.FromArgb(255, i, i, i);
|
||||
// }
|
||||
// clone.Palette = cp;
|
||||
// }
|
||||
|
||||
// Rectangle rect = new Rectangle(0, 0, source.Width, source.Height);
|
||||
// BitmapData sourceData = source.LockBits(rect, ImageLockMode.ReadWrite, source.PixelFormat);
|
||||
// BitmapData cloneData = clone.LockBits(rect, ImageLockMode.ReadWrite, source.PixelFormat);
|
||||
// if (source.Width % 4 == 0)
|
||||
// {
|
||||
// unsafe
|
||||
// {
|
||||
// CopyMemory(cloneData.Scan0, sourceData.Scan0, (uint)(sourceData.Stride * sourceData.Height));
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Parallel.For(0, source.Height, h =>
|
||||
// {
|
||||
// unsafe
|
||||
// {
|
||||
// CopyMemory(cloneData.Scan0 + h * sourceData.Stride, sourceData.Scan0 + h * sourceData.Stride, (uint)sourceData.Width);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
// clone.UnlockBits(cloneData);
|
||||
// source.UnlockBits(sourceData);
|
||||
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// return clone;
|
||||
// }
|
||||
|
||||
// return clone;
|
||||
//}
|
||||
public static Bitmap CopyBitmap(this Bitmap source)
|
||||
{
|
||||
Bitmap clone = new Bitmap(source.Width, source.Height, source.PixelFormat);
|
||||
|
||||
try
|
||||
{
|
||||
int pixelSize = Bitmap.GetPixelFormatSize(source.PixelFormat) / 8;
|
||||
if (pixelSize == 1)
|
||||
{
|
||||
ColorPalette cp = clone.Palette;
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
cp.Entries[i] = Color.FromArgb(255, i, i, i);
|
||||
}
|
||||
clone.Palette = cp;
|
||||
}
|
||||
|
||||
Rectangle rect = new Rectangle(0, 0, source.Width, source.Height);
|
||||
BitmapData sourceData = source.LockBits(rect, ImageLockMode.ReadOnly, source.PixelFormat);
|
||||
BitmapData cloneData = clone.LockBits(rect, ImageLockMode.WriteOnly, source.PixelFormat);
|
||||
|
||||
int stride = sourceData.Stride;
|
||||
int height = sourceData.Height;
|
||||
|
||||
if (stride % 4 == 0)
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
CopyMemory(cloneData.Scan0, sourceData.Scan0, (uint)(stride * height));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Parallel.For(0, height, h =>
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
CopyMemory(cloneData.Scan0 + h * stride, sourceData.Scan0 + h * stride, (uint)stride);
|
||||
}
|
||||
});
|
||||
}
|
||||
source.UnlockBits(sourceData); clone.UnlockBits(cloneData);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{ // Handle or log exception if needed
|
||||
} return clone; }
|
||||
|
||||
|
||||
public static Bitmap BitmapDeepClone(Bitmap source)
|
||||
{
|
||||
Bitmap clone = new Bitmap(source.Width, source.Height, source.PixelFormat);
|
||||
|
||||
try
|
||||
{
|
||||
int PixelSize = Bitmap.GetPixelFormatSize(source.PixelFormat) / 8;
|
||||
if (PixelSize == 1)
|
||||
{
|
||||
ColorPalette cp = clone.Palette;
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
cp.Entries[i] = Color.FromArgb(255, i, i, i);
|
||||
}
|
||||
clone.Palette = cp;
|
||||
}
|
||||
Rectangle rect = new Rectangle(0, 0, source.Width, source.Height);
|
||||
BitmapData source_bitmap = source.LockBits(rect, ImageLockMode.ReadWrite, source.PixelFormat);
|
||||
BitmapData destination_bitmap = clone.LockBits(rect, ImageLockMode.ReadWrite, clone.PixelFormat);
|
||||
|
||||
int depth_width = source_bitmap.Width * PixelSize;
|
||||
|
||||
unsafe
|
||||
{
|
||||
byte* source_ptr = (byte*)source_bitmap.Scan0;
|
||||
byte* destination_ptr = (byte*)destination_bitmap.Scan0;
|
||||
|
||||
int offset = source_bitmap.Stride - depth_width;
|
||||
|
||||
for (int i = 0; i < source_bitmap.Height; i++)
|
||||
{
|
||||
for (int j = 0; j < depth_width; j++, source_ptr++, destination_ptr++)
|
||||
{
|
||||
*destination_ptr = *source_ptr;
|
||||
}
|
||||
|
||||
source_ptr += offset;
|
||||
destination_ptr += offset;
|
||||
}
|
||||
}
|
||||
|
||||
source.UnlockBits(source_bitmap);
|
||||
clone.UnlockBits(destination_bitmap);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
return clone;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static Bitmap HConnectBitmap(this Bitmap map1, Bitmap map2)
|
||||
{
|
||||
Bitmap connectImage = null;
|
||||
if (map1 == null || map2 == null)
|
||||
return null;
|
||||
//横向拼接
|
||||
int width = map1.Width + map2.Width;
|
||||
//高度不变
|
||||
int height = Math.Max(map1.Height, map2.Height);
|
||||
connectImage = new Bitmap(width, height);
|
||||
using (Graphics graph = Graphics.FromImage(connectImage))
|
||||
{
|
||||
graph.DrawImage(connectImage, width, height);
|
||||
graph.Clear(System.Drawing.Color.White);
|
||||
graph.DrawImage(map1, 0, 0);
|
||||
graph.DrawImage(map2, map1.Width, 0);
|
||||
}
|
||||
return connectImage;
|
||||
}
|
||||
|
||||
public static IntPtr FloatToIntptr(float[] bytes)
|
||||
{
|
||||
GCHandle hObject = GCHandle.Alloc(bytes, GCHandleType.Pinned);
|
||||
return hObject.AddrOfPinnedObject();
|
||||
}
|
||||
|
||||
// 将Btimap类转换为byte[]类函数
|
||||
public static byte[] GetBGRValues(Bitmap bmp, out int stride)
|
||||
{
|
||||
var rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
|
||||
var bmpData = bmp.LockBits(rect, ImageLockMode.ReadOnly, bmp.PixelFormat);
|
||||
stride = bmpData.Stride;
|
||||
var rowBytes = bmpData.Width * Image.GetPixelFormatSize(bmp.PixelFormat) / 8;
|
||||
var imgBytes = bmp.Height * rowBytes;
|
||||
byte[] rgbValues = new byte[imgBytes];
|
||||
IntPtr ptr = bmpData.Scan0;
|
||||
for (var i = 0; i < bmp.Height; i++)
|
||||
{
|
||||
Marshal.Copy(ptr, rgbValues, i * rowBytes, rowBytes);
|
||||
ptr += bmpData.Stride;
|
||||
}
|
||||
bmp.UnlockBits(bmpData);
|
||||
return rgbValues;
|
||||
}
|
||||
/// <summary>
|
||||
/// 缺陷灰度图转彩色图像函数
|
||||
/// </summary>
|
||||
/// <param name="src">灰度图</param>
|
||||
/// <returns>返回构造的伪彩色图像</returns>
|
||||
public static Bitmap GrayMapToColorMap(this Bitmap src, Dictionary<int, Color> indexColorDict = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
//Stopwatch sw = new Stopwatch();
|
||||
//sw.Start();
|
||||
|
||||
Bitmap dest = new Bitmap(src.Width, src.Height, PixelFormat.Format32bppArgb);
|
||||
|
||||
int destHeight = dest.Height;
|
||||
int destWidth = dest.Width;
|
||||
|
||||
Rectangle rect = new Rectangle(0, 0, destWidth, destHeight);
|
||||
BitmapData bmpDataDest = dest.LockBits(rect, ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
|
||||
BitmapData bmpDataSrc = src.LockBits(rect, ImageLockMode.ReadWrite, PixelFormat.Format8bppIndexed);
|
||||
int strideDest = bmpDataDest.Stride;
|
||||
|
||||
int strideSrc = bmpDataSrc.Stride;
|
||||
unsafe
|
||||
{
|
||||
byte* pDest = (byte*)bmpDataDest.Scan0.ToPointer();
|
||||
byte* pSrc = (byte*)bmpDataSrc.Scan0.ToPointer();
|
||||
|
||||
Parallel.For(0, destHeight, y =>
|
||||
{
|
||||
Parallel.For(0, destWidth, x =>
|
||||
{
|
||||
int pixel = pSrc[y * strideSrc + x];
|
||||
int startIndex = y * strideDest + x * 4;
|
||||
if (pixel >= 0 && pixel <= 63)
|
||||
{
|
||||
Color color = Color.Red;
|
||||
if (indexColorDict != null && indexColorDict.ContainsKey(pixel))
|
||||
{
|
||||
color = indexColorDict[pixel];
|
||||
}
|
||||
|
||||
byte R = color.R;
|
||||
byte G = color.G;
|
||||
byte B = color.B;
|
||||
|
||||
pDest[startIndex] = B;
|
||||
pDest[startIndex + 1] = G;
|
||||
pDest[startIndex + 2] = R;
|
||||
pDest[startIndex + 3] = 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
pDest[startIndex] = 255;
|
||||
pDest[startIndex + 1] = 255;
|
||||
pDest[startIndex + 2] = 255;
|
||||
pDest[startIndex + 3] = 0;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
dest.UnlockBits(bmpDataDest);
|
||||
src.UnlockBits(bmpDataSrc);
|
||||
|
||||
//sw.Stop();
|
||||
//Console.WriteLine($"转换耗时:{sw.ElapsedMilliseconds}");
|
||||
|
||||
return dest;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Sort<T>(this ObservableCollection<T> collection) where T : IComparable<T>
|
||||
{
|
||||
List<T> sortedList = collection.OrderByDescending(x => x).ToList();//这里用降序
|
||||
for (int i = 0; i < sortedList.Count(); i++)
|
||||
{
|
||||
collection.Move(collection.IndexOf(sortedList[i]), i);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得字符串中开始和结束字符串中间的值
|
||||
/// </summary>
|
||||
/// <param name="sourse"></param>
|
||||
/// <param name="startstr"></param>
|
||||
/// <param name="endstr"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetMidString(string sourse, string startstr, string endstr)
|
||||
{
|
||||
string result = string.Empty;
|
||||
int startindex, endindex;
|
||||
try
|
||||
{
|
||||
startindex = sourse.IndexOf(startstr);
|
||||
if (startindex == -1)
|
||||
return result;
|
||||
string tmpstr = sourse.Substring(startindex + startstr.Length);
|
||||
endindex = tmpstr.IndexOf(endstr);
|
||||
if (endindex == -1)
|
||||
return result;
|
||||
result = tmpstr.Remove(endindex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得字符串中开始和结束字符串中间的值
|
||||
/// </summary>
|
||||
/// <param name="t">字符串</param>
|
||||
/// <param name="k">开始</param>
|
||||
/// <param name="j">结束</param>
|
||||
/// <returns></returns>
|
||||
private static string GetMidString2(string sourse, string startstr, string endstr) //截取指定文本,和易语言的取文本中间差不多
|
||||
{
|
||||
try //异常捕捉
|
||||
{
|
||||
var kn = sourse.IndexOf(startstr, StringComparison.Ordinal) + startstr.Length;
|
||||
var jn = sourse.IndexOf(endstr, kn, StringComparison.Ordinal);
|
||||
return sourse.Substring(kn, jn - kn);
|
||||
}
|
||||
catch //如果发现未知的错误,比如上面的代码出错了,就执行下面这句代码
|
||||
{
|
||||
return ""; //返回空
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 布尔类型转换为整型
|
||||
public static int ToInt(this object obj)
|
||||
{
|
||||
if (Convert.ToBoolean(obj) == true)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 整型转换为布尔类型
|
||||
public static bool ToBool(this object obj)
|
||||
{
|
||||
if (Convert.ToInt32(obj) == 1)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public static object GetProperty(this object o, string member)
|
||||
{
|
||||
if (o == null) throw new ArgumentNullException("o");
|
||||
if (member == null) throw new ArgumentNullException("member");
|
||||
Type scope = o.GetType();
|
||||
IDynamicMetaObjectProvider provider = o as IDynamicMetaObjectProvider;
|
||||
if (provider != null)
|
||||
{
|
||||
ParameterExpression param = Expression.Parameter(typeof(object));
|
||||
DynamicMetaObject mobj = provider.GetMetaObject(param);
|
||||
GetMemberBinder binder = (GetMemberBinder)Microsoft.CSharp.RuntimeBinder.Binder.GetMember(0, member, scope, new CSharpArgumentInfo[] { CSharpArgumentInfo.Create(0, null) });
|
||||
DynamicMetaObject ret = mobj.BindGetMember(binder);
|
||||
BlockExpression final = Expression.Block(
|
||||
Expression.Label(CallSiteBinder.UpdateLabel),
|
||||
ret.Expression
|
||||
);
|
||||
LambdaExpression lambda = Expression.Lambda(final, param);
|
||||
Delegate del = lambda.Compile();
|
||||
return del.DynamicInvoke(o);
|
||||
}
|
||||
else
|
||||
{
|
||||
return o.GetType().GetProperty(member, BindingFlags.Public | BindingFlags.Instance).GetValue(o, null);
|
||||
}
|
||||
}
|
||||
|
||||
#region 检测文件状态及操作方式选择
|
||||
[DllImport("kernel32.dll")]
|
||||
private static extern IntPtr _lopen(string lpPathName, int iReadWrite);
|
||||
[DllImport("kernel32.dll")]
|
||||
private static extern bool CloseHandle(IntPtr hObject);
|
||||
private const int OF_READWRITE = 2;
|
||||
private const int OF_SHARE_DENY_NONE = 0x40;
|
||||
private static readonly IntPtr HFILE_ERROR = new IntPtr(-1);
|
||||
/// <summary>
|
||||
/// 检测文件是否只读或被使用
|
||||
/// </summary>
|
||||
/// <param name="FileNames">要检测的文件</param>
|
||||
/// <returns>true可用,false在用或只读</returns>
|
||||
public static bool CheckFilesCanUse(string fileName)
|
||||
{
|
||||
if (!File.Exists(fileName))
|
||||
return true;//文件不存在
|
||||
if ((File.GetAttributes(fileName) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
|
||||
return false; //文件只读
|
||||
IntPtr vHandle = _lopen(fileName, OF_READWRITE | OF_SHARE_DENY_NONE);
|
||||
if (vHandle == HFILE_ERROR)
|
||||
{
|
||||
CloseHandle(vHandle);
|
||||
return false; //文件被占用
|
||||
}
|
||||
|
||||
CloseHandle(vHandle); //文件没被占用
|
||||
return true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定文件夹下所有的文件名称
|
||||
/// </summary>
|
||||
/// <param name="folderName">指定文件夹名称,绝对路径</param>
|
||||
/// <param name="fileFilter">文件类型过滤,根据文件后缀名,如:*,*.txt,*.xls</param>
|
||||
/// <param name="isContainSubFolder">是否包含子文件夹</param>
|
||||
/// <returns>ArrayList数组,为所有需要的文件路径名称</returns>
|
||||
public static List<FileInfo> GetAllFilesByFolder(string folderName, string fileFilter, bool isContainSubFolder = false)
|
||||
{
|
||||
List<FileInfo> resList = new List<FileInfo>();
|
||||
try
|
||||
{
|
||||
DirectoryInfo currDir = new DirectoryInfo(folderName);//当前目录
|
||||
FileInfo[] currFiles = currDir.GetFiles(fileFilter);//当前目录文件
|
||||
foreach (FileInfo file in currFiles)
|
||||
{
|
||||
if (fileFilter.ToLower().IndexOf(file.Extension.ToLower()) >= 0)
|
||||
{
|
||||
resList.Add(file);
|
||||
}
|
||||
}
|
||||
if (isContainSubFolder)
|
||||
{
|
||||
string[] subFolders = Directory.GetDirectories(folderName);
|
||||
foreach (string subFolder in subFolders)
|
||||
{
|
||||
resList.AddRange(GetAllFilesByFolder(subFolder, fileFilter));//递归
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
return resList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定文件夹下所有的文件名称,不过滤文件类型
|
||||
/// </summary>
|
||||
/// <param name="folderName">指定文件夹名称,绝对路径</param>
|
||||
/// <param name="isContainSubFolder">是否包含子文件夹</param>
|
||||
/// <returns>ArrayList数组,为所有需要的文件路径名称</returns>
|
||||
public static List<FileInfo> GetAllFilesByFolder(string folderName, bool isContainSubFolder)
|
||||
{
|
||||
return GetAllFilesByFolder(folderName, "*", isContainSubFolder);
|
||||
}
|
||||
}
|
||||
|
||||
public class Compare<T, C> : IEqualityComparer<T>
|
||||
{
|
||||
private Func<T, C> _getField;
|
||||
public Compare(Func<T, C> getfield)
|
||||
{
|
||||
_getField = getfield;
|
||||
}
|
||||
public bool Equals(T x, T y)
|
||||
{
|
||||
return EqualityComparer<C>.Default.Equals(_getField(x), _getField(y));
|
||||
}
|
||||
public int GetHashCode(T obj)
|
||||
{
|
||||
return EqualityComparer<C>.Default.GetHashCode(_getField(obj));
|
||||
}
|
||||
}
|
||||
|
||||
public static class ObjectExtensions
|
||||
{
|
||||
public static IEnumerable<T> DistinctBy<T, C>(this IEnumerable<T> source, Func<T, C> getfield)
|
||||
{
|
||||
return source.Distinct(new Compare<T, C>(getfield));
|
||||
}
|
||||
|
||||
public static IQueryable<T> DistinctBy<T, C>(this IQueryable<T> source, Func<T, C> getfield)
|
||||
{
|
||||
return source.Distinct(new Compare<T, C>(getfield));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,109 +0,0 @@
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing.Design;
|
||||
|
||||
namespace DH.Commons.Enums
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 标准配置
|
||||
/// </summary>
|
||||
public class Spec
|
||||
{
|
||||
[Category("通用配置")]
|
||||
[Description("标准代码")]
|
||||
public virtual string Code { get; set; }
|
||||
|
||||
[Category("通用配置")]
|
||||
[Description("启用状态,true:启用;false:禁用")]
|
||||
[DisplayName("启用状态")]
|
||||
public bool IsEnabled { get; set; }
|
||||
|
||||
[Category("标准配置")]
|
||||
[Description("标准值")]
|
||||
[DisplayName("标准值")]
|
||||
public double StandardValue { get; set; }
|
||||
|
||||
[Category("标准配置")]
|
||||
[Description("正公差")]
|
||||
[DisplayName("正公差")]
|
||||
public double Tolrenance_Positive { get; set; }
|
||||
|
||||
[Category("标准配置")]
|
||||
[Description("负公差")]
|
||||
[DisplayName("负公差")]
|
||||
public double Tolrenance_Negative { get; set; }
|
||||
|
||||
protected double? actualValue = null;
|
||||
[Browsable(false)]
|
||||
|
||||
public virtual double? ActualValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return actualValue;
|
||||
}
|
||||
set
|
||||
{
|
||||
//if (actualValue != value && value != null)
|
||||
if (value != null)
|
||||
{
|
||||
if (value.Value >= (StandardValue - Tolrenance_Negative) && value.Value <= (StandardValue + Tolrenance_Positive))
|
||||
{
|
||||
MeasureResult = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
MeasureResult = false;
|
||||
}
|
||||
}
|
||||
|
||||
actualValue = value;
|
||||
}
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
|
||||
public bool? MeasureResult { get; set; } = null;
|
||||
|
||||
|
||||
public Spec Copy()
|
||||
{
|
||||
Spec spec = new Spec();
|
||||
|
||||
spec.Code = this.Code;
|
||||
spec.IsEnabled = this.IsEnabled;
|
||||
spec.StandardValue = this.StandardValue;
|
||||
spec.Tolrenance_Positive = this.Tolrenance_Positive;
|
||||
spec.Tolrenance_Negative = this.Tolrenance_Negative;
|
||||
|
||||
return spec;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class IndexedSpec : Spec
|
||||
{
|
||||
[Category("数据源配置")]
|
||||
[Description("数据源输出索引")]
|
||||
[DisplayName("数据源输出索引")]
|
||||
public int OutputIndex { get; set; }
|
||||
|
||||
public new IndexedSpec Copy()
|
||||
{
|
||||
IndexedSpec spec = new IndexedSpec();
|
||||
|
||||
spec.Code = this.Code;
|
||||
spec.IsEnabled = this.IsEnabled;
|
||||
spec.StandardValue = this.StandardValue;
|
||||
spec.Tolrenance_Positive = this.Tolrenance_Positive;
|
||||
spec.Tolrenance_Negative = this.Tolrenance_Negative;
|
||||
|
||||
spec.OutputIndex = this.OutputIndex;
|
||||
|
||||
return spec;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DH.Commons.Models
|
||||
{
|
||||
public class CameraSummary
|
||||
{
|
||||
public string CameraName { get; set; } // 相机名称
|
||||
public int TiggerCount { get; set; } //触发数
|
||||
public int OKCount { get; set; } // OK 数
|
||||
public int NGCount { get; set; } // NG 数
|
||||
public int TotalCount => OKCount + NGCount; // 总检测数量
|
||||
public string YieldStr => $"{Yield:f2} %"; // 良率(字符串形式)
|
||||
public double Yield => OKCount + NGCount > 0 ? (double)OKCount / (OKCount + NGCount) * 100 : 0;
|
||||
}
|
||||
|
||||
public class ProductSummary
|
||||
{
|
||||
public int ProductAmount { get; set; }
|
||||
public string ResultDesc { get; set; }
|
||||
public string PercentStr { get; set; }
|
||||
}
|
||||
}
|
@ -4,7 +4,6 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using DH.Commons.Base;
|
||||
using DH.Commons.Enums;
|
||||
|
||||
namespace DH.Commons.Models
|
||||
{
|
||||
@ -15,10 +14,7 @@ namespace DH.Commons.Models
|
||||
/// </summary>
|
||||
public static string CurrentScheme=string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 当前状态
|
||||
/// </summary>
|
||||
public static EnumStatus CurrentStatus =EnumStatus.未运行;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -29,6 +25,5 @@ namespace DH.Commons.Models
|
||||
public static List<CameraBase> CameraBaseList = new List<CameraBase>();
|
||||
public static List<PLCBase> PLCBaseList = new List<PLCBase>();
|
||||
public static List<DetectionConfig> DetectionList = new List<DetectionConfig>();
|
||||
public static List<GlobalConfig> GlobalList = new List<GlobalConfig>();
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +1,17 @@
|
||||
using System.Collections.Concurrent;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection.Metadata;
|
||||
using System.Xml.Linq;
|
||||
using DH.Commons.Base;
|
||||
using DH.Commons.Enums;
|
||||
using DH.Commons.Helper;
|
||||
using DVPCameraType;
|
||||
using OpenCvSharp;
|
||||
using OpenCvSharp.Extensions;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
using LogLevel = DH.Commons.Enums.EnumHelper.LogLevel;
|
||||
|
||||
|
||||
|
||||
namespace DH.Devices.Camera
|
||||
{
|
||||
|
||||
public class Do3ThinkCamera : CameraBase, ILogger
|
||||
public class Do3ThinkCamera : CameraBase
|
||||
{
|
||||
|
||||
private dvpCameraInfo stDevInfo = new dvpCameraInfo();
|
||||
@ -28,16 +24,8 @@ namespace DH.Devices.Camera
|
||||
public dvpStreamFormat dvpStreamFormat = dvpStreamFormat.S_RGB24;
|
||||
public int m_CamCount = 0;
|
||||
public Double m_dfDisplayCount = 0;
|
||||
|
||||
public LoggerHelper LoggerHelper { get; set; } = new LoggerHelper();
|
||||
public event Action<LogMsg> OnLog;
|
||||
public ConcurrentDictionary<string, MatSet> _imageSetList = new ConcurrentDictionary<string, MatSet>();
|
||||
|
||||
|
||||
public Do3ThinkCamera()
|
||||
{
|
||||
LoggerHelper.LogPath = "D://";
|
||||
LoggerHelper.LogPrefix = CameraName;
|
||||
|
||||
}
|
||||
|
||||
@ -142,38 +130,36 @@ namespace DH.Devices.Camera
|
||||
throw new Exception($"Start grabbing failed:{nRet:x8}");
|
||||
}
|
||||
//// 曝光
|
||||
if (Exposure != 0)
|
||||
{
|
||||
SetExposure(Exposure);
|
||||
}
|
||||
//if (IIConfig.DefaultExposure != 0)
|
||||
//{
|
||||
// SetExposure(IIConfig.DefaultExposure);
|
||||
//}
|
||||
//// 增益
|
||||
if (Gain >= 0)
|
||||
{
|
||||
SetGain(Gain);
|
||||
}
|
||||
//全画幅
|
||||
if(!IsAllPicEnabled)
|
||||
SetPictureRoi((int)ROIX, (int)ROIY, (int)ROIW, (int)ROIH);
|
||||
//if (IIConfig.Gain >= 0)
|
||||
//{
|
||||
// SetGain(IIConfig.Gain);
|
||||
//}
|
||||
//SetPictureRoi(IIConfig.VelocityPara.A_Pic_X, IIConfig.VelocityPara.A_Pic_Y, IIConfig.VelocityPara.Width, IIConfig.VelocityPara.Hight);
|
||||
|
||||
//// 设置 触发延迟
|
||||
if (TriggerDelay > 0)
|
||||
{
|
||||
nRet = DVPCamera.dvpSetTriggerDelay(m_handle, TriggerDelay);
|
||||
if (nRet != dvpStatus.DVP_STATUS_OK)
|
||||
{
|
||||
throw new Exception("Set TriggerDelay failed!");
|
||||
}
|
||||
}
|
||||
//if (IIConfig.TriggerDelay > 0)
|
||||
//{
|
||||
// nRet = DVPCamera.dvpSetTriggerDelay(m_handle, IIConfig.TriggerDelay);
|
||||
// if (nRet != dvpStatus.DVP_STATUS_OK)
|
||||
// {
|
||||
// throw new Exception("Set TriggerDelay failed!");
|
||||
// }
|
||||
//}
|
||||
|
||||
//// 信号消抖
|
||||
if (LineDebouncerTime > 0)
|
||||
{
|
||||
nRet = DVPCamera.dvpSetTriggerJitterFilter(m_handle, LineDebouncerTime);
|
||||
if (nRet != dvpStatus.DVP_STATUS_OK)
|
||||
{
|
||||
throw new Exception($"LineDebouncerTime set failed:{nRet}");
|
||||
}
|
||||
}
|
||||
//if (IIConfig.LineDebouncerTime > 0)
|
||||
//{
|
||||
// nRet = DVPCamera.dvpSetTriggerJitterFilter(m_handle, IIConfig.LineDebouncerTime);
|
||||
// if (nRet != dvpStatus.DVP_STATUS_OK)
|
||||
// {
|
||||
// throw new Exception($"LineDebouncerTime set failed:{nRet}");
|
||||
// }
|
||||
//}
|
||||
|
||||
//IIConfig.PropertyChanged -= IIConfig_PropertyChanged;
|
||||
//IIConfig.PropertyChanged += IIConfig_PropertyChanged;
|
||||
@ -365,17 +351,9 @@ namespace DH.Devices.Camera
|
||||
break;
|
||||
}
|
||||
Mat smat = cvImage.Clone();
|
||||
var imageSet = new MatSet
|
||||
{
|
||||
|
||||
_mat = smat,
|
||||
|
||||
};
|
||||
InitialImageSet(imageSet);
|
||||
OnHImageOutput?.Invoke(DateTime.Now, this, smat);
|
||||
|
||||
//存图
|
||||
DisplayAndSaveOriginImage(imageSet.Id,SnapshotCount);
|
||||
|
||||
|
||||
|
||||
|
||||
@ -391,86 +369,7 @@ namespace DH.Devices.Camera
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
public void InitialImageSet(MatSet set)
|
||||
{
|
||||
//if (saveOption != null)
|
||||
//{
|
||||
// set.ImageSaveOption = saveOption.Copy();
|
||||
//}
|
||||
|
||||
//set.IsOriginSaved = !set.ImageSaveOption.IsSaveOriginImage;
|
||||
//set.IsFitSaved = !set.ImageSaveOption.IsSaveFitImage;
|
||||
//set.IsAddtionalSaved = string.IsNullOrWhiteSpace(set.ImageSaveOption.AddtionalSaveType);
|
||||
set.CameraId = this.CameraName;
|
||||
|
||||
set.ImageTime = DateTime.Now;
|
||||
_imageSetList[set.Id] = set;
|
||||
}
|
||||
|
||||
public virtual async void DisplayAndSaveOriginImage(string imgSetId, int _counter)
|
||||
{
|
||||
MatSet set = _imageSetList.Values.FirstOrDefault(u => u.Id == imgSetId);
|
||||
|
||||
if (set != null && set._mat != null)
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
Bitmap showImage = set._mat.ToBitmap();
|
||||
// showImage.Save("D:/test333.bmp");
|
||||
// Marshal.Copy(pbyteImageBuffer, 0, (IntPtr)lAddrImage, (int)dwBufferSize);
|
||||
// Bitmap saveImage = showImage?.CopyBitmap();
|
||||
// saveImage.Save("d://TEST444.BMP");
|
||||
// OnShowImageUpdated?.Invoke(this, showImage, imgSetId);
|
||||
if (IsSavePicEnabled)
|
||||
{
|
||||
string fullname = Path.Combine(ImageSaveDirectory, $"{CameraName}_{_counter:D7}_{set.Id}.{set._imageFormat.ToString().ToLower()}");
|
||||
ImageSaveAsync(fullname, showImage);
|
||||
}
|
||||
|
||||
//释放 himage
|
||||
ClearImageSet(set);
|
||||
});
|
||||
}
|
||||
}
|
||||
static object _imageSetLock = new object();
|
||||
public void ClearImageSet(MatSet set)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool flag = false;
|
||||
lock (_imageSetLock)
|
||||
{
|
||||
flag = _imageSetList.TryRemove(set.Id, out set);
|
||||
if (flag)
|
||||
{
|
||||
set.Dispose();
|
||||
}
|
||||
//LogAsync(DateTime.Now, $"{Name}移除图片信息{(flag ? "成功" : "失败")},当前缓存数量:{_imageSetList.Count}", "");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogAsync(DateTime.Now, LogLevel.Exception, $"清理图片缓存异常,当前缓存数量{_imageSetList.Count},{ex.GetExceptionMessage()}");
|
||||
}
|
||||
}
|
||||
public ImageSaveHelper ImageSaveHelper { get; set; } = new ImageSaveHelper();
|
||||
public virtual void ImageSaveAsync(string fullName, Bitmap map)
|
||||
{
|
||||
if (!IsSavePicEnabled)
|
||||
{
|
||||
map?.Dispose();
|
||||
return;
|
||||
}
|
||||
|
||||
ImageSaveSet imageSaveSet = new ImageSaveSet()
|
||||
{
|
||||
FullName = fullName,
|
||||
SaveImage = map,
|
||||
|
||||
};
|
||||
|
||||
ImageSaveHelper.ImageSaveAsync(imageSaveSet);
|
||||
}
|
||||
public override bool CameraDisConnect()
|
||||
{
|
||||
try
|
||||
@ -512,22 +411,6 @@ namespace DH.Devices.Camera
|
||||
|
||||
}
|
||||
|
||||
public void LogAsync(LogMsg msg)
|
||||
{
|
||||
msg.MsgSource = CameraName;
|
||||
msg.ThreadId = Thread.CurrentThread.ManagedThreadId;
|
||||
|
||||
//OnLog?.BeginInvoke(msg, null, null);
|
||||
OnLog?.Invoke(msg);
|
||||
|
||||
//if (InitialConfig.IsEnableLog)
|
||||
{
|
||||
LoggerHelper.LogAsync(msg);
|
||||
}
|
||||
}
|
||||
public void LogAsync(DateTime dt, LogLevel logLevel, string msg)
|
||||
{
|
||||
LogAsync(new LogMsg(dt, logLevel, msg));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -11,14 +11,6 @@
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<Optimize>False</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Optimize>False</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -104,18 +104,18 @@ namespace DH.Devices.Vision
|
||||
// json = "{\"FastDetResult\":[{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.654843,\"rect\":[175,99,110,594]},{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.654589,\"rect\":[2608,19,104,661]},{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.654285,\"rect\":[1275,19,104,662]},{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.620762,\"rect\":[1510,95,107,600]},{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.617812,\"rect\":[2844,93,106,602]}]}";
|
||||
//
|
||||
Console.WriteLine("检测结果JSON:" + json);
|
||||
|
||||
#pragma warning disable CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型。
|
||||
HYoloResult detResult = JsonConvert.DeserializeObject<HYoloResult>(json);
|
||||
|
||||
#pragma warning restore CS8600 // 将 null 字面量或可能为 null 的值转换为非 null 类型。
|
||||
if (detResult == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int iNum = detResult.HYolo.Count;
|
||||
|
||||
#pragma warning disable CS0219 // 变量已被赋值,但从未使用过它的值
|
||||
int IokNum = 0;
|
||||
|
||||
#pragma warning restore CS0219 // 变量已被赋值,但从未使用过它的值
|
||||
for (int ix = 0; ix < iNum; ix++)
|
||||
{
|
||||
var det = detResult.HYolo[ix];
|
||||
@ -145,6 +145,7 @@ namespace DH.Devices.Vision
|
||||
Mat originMat = new Mat();
|
||||
Mat detectMat = new Mat();
|
||||
|
||||
#pragma warning disable CS0168 // 声明了变量,但从未使用过
|
||||
try
|
||||
{
|
||||
if (req.mImage == null)
|
||||
|
@ -281,7 +281,7 @@ namespace DH.Devices.Vision
|
||||
|
||||
// GC.Collect();
|
||||
}
|
||||
|
||||
#pragma warning restore CS0168 // 声明了变量,但从未使用过
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
using DH.Commons.Base;
|
||||
using DH.Commons.Enums;
|
||||
using DH.Commons.Helper;
|
||||
using DH.UI.Model.Winform;
|
||||
using HalconDotNet;
|
||||
using OpenCvSharp;
|
||||
@ -8,8 +7,6 @@ using OpenCvSharp.Extensions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.Eventing.Reader;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Linq;
|
||||
using System.Runtime.ExceptionServices;
|
||||
using System.Text;
|
||||
@ -18,7 +15,6 @@ using System.Windows.Forms;
|
||||
using System.Xml.Linq;
|
||||
using XKRS.UI.Model.Winform;
|
||||
using static DH.Commons.Enums.EnumHelper;
|
||||
using LogLevel = DH.Commons.Enums.EnumHelper.LogLevel;
|
||||
using ResultState = DH.Commons.Base.ResultState;
|
||||
|
||||
|
||||
@ -40,20 +36,7 @@ namespace DH.Devices.Vision
|
||||
// ImageSaveHelper.OnImageSaveExceptionRaised += ImageSaveHelper_OnImageSaveExceptionRaised;
|
||||
// base.Init();
|
||||
}
|
||||
public void Stop()
|
||||
{
|
||||
SimboStationMLEngineList.ToList().ForEach(sm =>
|
||||
{
|
||||
if (sm.IsUseGPU)
|
||||
{
|
||||
sm.StationMLEngine.Dispose();
|
||||
}
|
||||
else
|
||||
{
|
||||
sm.StationMLEngine.Dispose2();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//private void ImageSaveHelper_OnImageSaveExceptionRaised(DateTime dt, string msg)
|
||||
//{
|
||||
// LogAsync(new LogMsg(dt, LogLevel.Error, msg));
|
||||
@ -74,30 +57,16 @@ namespace DH.Devices.Vision
|
||||
|
||||
if (detectConfig == null)
|
||||
{
|
||||
LogAsync(DateTime.Now, LogLevel.Exception, $"异常:未能获取检测配置");
|
||||
|
||||
//未能获得检测配置
|
||||
return detectResult;
|
||||
}
|
||||
detectResult.DetectName = detectConfig.Name;
|
||||
detectResult.ImageSaveDirectory=detectConfig.ImageSaveDirectory;
|
||||
detectResult.SaveNGDetect=detectConfig.SaveNGDetect;
|
||||
detectResult.SaveNGOriginal=detectConfig.SaveNGOriginal;
|
||||
detectResult.SaveOKDetect=detectConfig.SaveOKDetect;
|
||||
detectResult.SaveOKOriginal=detectConfig.SaveOKOriginal;
|
||||
Mat OriginImage = originImgSet.Clone();
|
||||
detectResult.DetectionOriginImage = CopyBitmapWithLockBits(OriginImage.ToBitmap());
|
||||
//detectResult.DetectionOriginImage = originImgSet.Clone().ToBitmap();
|
||||
Stopwatch sw = new Stopwatch();
|
||||
#region 1.预处理
|
||||
sw.Start();
|
||||
|
||||
using (Mat PreTMat = originImgSet.Clone())
|
||||
{
|
||||
PreTreated(detectConfig, detectResult, PreTMat);
|
||||
PreTreated2(detectConfig, detectResult, PreTMat);
|
||||
}
|
||||
sw.Stop();
|
||||
LogAsync(DateTime.Now, LogLevel.Information, $"产品:{detectResult.Pid} {detectConfig.Name}预处理耗时:{sw.ElapsedMilliseconds}ms。SpecsResults:{string.Join(";", detectResult.realSpecs.Select(u => $"{u.Code} {u.ActualValue}"))}");
|
||||
// 工位2尺寸测量
|
||||
|
||||
|
||||
|
||||
@ -129,7 +98,7 @@ namespace DH.Devices.Vision
|
||||
}
|
||||
|
||||
#region 2.深度学习推理
|
||||
LogAsync(DateTime.Now, LogLevel.Information, $"{detectConfig.Name} 产品{detectResult.TempPid} 模型检测执行");
|
||||
//LogAsync(DateTime.Now, LogLevel.Information, $"{detectConfig.Name} 产品{detectResult.TempPid} 模型检测执行");
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(detectConfig.ModelPath))
|
||||
{
|
||||
@ -171,8 +140,8 @@ namespace DH.Devices.Vision
|
||||
// LogAsync(DateTime.Now, LogLevel.Information, $"{detectConfig.Name} 产品{detectResult.TempPid} RunInference BEGIN");
|
||||
mlWatch.Start();
|
||||
//20230802改成多线程推理 RunInferenceFixed
|
||||
// MLResult result = new MLResult();
|
||||
var result = mlSet.StationMLEngine.RunInference(req);
|
||||
|
||||
var result = mlSet.StationMLEngine.RunInference(req);
|
||||
// var result = mlSet.StationMLEngine.RunInferenceFixed(req);
|
||||
mlWatch.Stop();
|
||||
// LogAsync(DateTime.Now, LogLevel.Information, $"{detectConfig.Name} 产品{detectResult.TempPid} RunInference END");
|
||||
@ -211,8 +180,6 @@ namespace DH.Devices.Vision
|
||||
|
||||
if (result == null || (result != null && !result.IsSuccess))
|
||||
{
|
||||
LogAsync(DateTime.Now, LogLevel.Exception, $"CoreInx:{mlSet.GPUNo} 产品:{detectResult.Pid} {detectConfig.Name} 模型检测异常,{result?.ResultMessage}");
|
||||
|
||||
detectResult.IsMLDetectDone = false;
|
||||
}
|
||||
if (result != null && result.IsSuccess)
|
||||
@ -220,13 +187,9 @@ namespace DH.Devices.Vision
|
||||
detectResult.DetectDetails = result.ResultDetails;
|
||||
if (detectResult.DetectDetails != null)
|
||||
{
|
||||
LogAsync(DateTime.Now, LogLevel.Information, $"CoreInx:{mlSet.GPUNo} 产品:{detectResult.Pid} {detectResult.DetectName} 模型检测总耗时:{mlWatch.ElapsedMilliseconds} ms {result.ResultMessage},{string.Join(";", detectResult.DetectDetails.Select(u => $"{u.LabelName} X:{u.Rect.X} Y:{u.Rect.Y} Area:{u.Area.ToString("f2")} W:{u.Rect.Width} H:{u.Rect.Height}"))}");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
LogAsync(DateTime.Now, LogLevel.Exception, $"CoreInx:{mlSet.GPUNo} 产品:{detectResult.Pid} {detectConfig.Name} 模型检测异常返回 null");
|
||||
|
||||
detectResult.IsMLDetectDone = false;
|
||||
}
|
||||
}
|
||||
@ -268,22 +231,22 @@ namespace DH.Devices.Vision
|
||||
}
|
||||
|
||||
|
||||
//foreach (IGrouping<ResultState, DetectionFilter> group in conditionList)
|
||||
//{
|
||||
// bool b = group.ToList().Any(f =>
|
||||
// {
|
||||
// return f.FilterOperation(d);
|
||||
// });
|
||||
foreach (IGrouping<ResultState, DetectionFilter> group in conditionList)
|
||||
{
|
||||
bool b = group.ToList().Any(f =>
|
||||
{
|
||||
return f.FilterOperation(d);
|
||||
});
|
||||
|
||||
|
||||
// if (b)
|
||||
// {
|
||||
// d.FinalResult = group.Key;
|
||||
// break;
|
||||
// }
|
||||
if (b)
|
||||
{
|
||||
d.FinalResult = group.Key;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//}
|
||||
}
|
||||
});
|
||||
#endregion
|
||||
#region 5.统计缺陷过滤结果或预处理直接NG
|
||||
@ -304,7 +267,6 @@ namespace DH.Devices.Vision
|
||||
#endregion
|
||||
|
||||
|
||||
LogAsync(DateTime.Now, LogLevel.Information, $"{detectConfig.Name} 检测结果:{detectResult.ResultState.GetEnumDescription()}");
|
||||
|
||||
|
||||
|
||||
@ -455,14 +417,12 @@ namespace DH.Devices.Vision
|
||||
{
|
||||
// throw new ProcessException("异常:模型加载异常", null);
|
||||
}
|
||||
LogAsync(DateTime.Now, LogLevel.Information, $"模型加载成功;是否GPU:{isGPU} CoreInx:{coreInx} - {dc.Name}" + $" {dc.ModelType.GetEnumDescription()}:{dc.ModelPath}");
|
||||
//LogAsync(DateTime.Now, LogLevel.Information, $"模型加载成功;是否GPU:{isGPU} CoreInx:{coreInx} - {dc.Name}" + $" {dc.ModelType.GetEnumDescription()}:{dc.ModelPath}");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// LogAsync(DateTime.Now, LogLevel.Error, $"模型加载成功;是否GPU:{isGPU} CoreInx:{coreInx} - {dc.Name}" + $" {dc.ModelType.GetEnumDescription()}:{dc.ModelPath}");
|
||||
|
||||
throw new ProcessException($"异常:是否GPU:{isGPU} CoreInx:{coreInx} - {dc.Name}模型加载异常:{ex.GetExceptionMessage()}");
|
||||
//throw new ProcessException($"异常:是否GPU:{isGPU} CoreInx:{coreInx} - {dc.Name}模型加载异常:{ex.GetExceptionMessage()}");
|
||||
}
|
||||
return mLEngineSet;
|
||||
}
|
||||
@ -546,7 +506,7 @@ namespace DH.Devices.Vision
|
||||
if (!tool.RunProcedure(out string errorMsg, out _))
|
||||
{
|
||||
// detectResult.PreTreatedFlag = false;
|
||||
LogAsync(DateTime.Now, LogLevel.Exception, $"{detectConfig.Name}预处理异常,{errorMsg}");
|
||||
|
||||
detectResult.IsPreTreatDone = false;
|
||||
|
||||
|
||||
@ -561,86 +521,16 @@ namespace DH.Devices.Vision
|
||||
// detectResult.IsPreTreatDone = detectResult.VisionImageSet.PreTreatedFlag = preTreatRet == 1;
|
||||
//detectResult.IsPreTreatDone = detectResult.VisionImageSet.PreTreatedFlag = true;
|
||||
// detectResult.VisionImageSet.PreTreatedTime = DateTime.Now;
|
||||
switch (preTreatRet)
|
||||
|
||||
for (int i = 0; i < detectConfig.OUTPreTreatParams.Count; i++)
|
||||
{
|
||||
case 0: // 预处理算法无异常
|
||||
{
|
||||
|
||||
for (int i = 0; i < detectConfig.OUTPreTreatParams.Count; i++)
|
||||
{
|
||||
|
||||
var param = detectConfig.OUTPreTreatParams[i];
|
||||
|
||||
var Value = tool.GetResultTuple(param.Name);
|
||||
|
||||
// 显示结果
|
||||
IndexedSpec specRCricularity = new()
|
||||
{
|
||||
Code = param.Name,
|
||||
ActualValue = Value
|
||||
};
|
||||
detectResult.realSpecs.Add(specRCricularity);
|
||||
}
|
||||
detectResult.IsPreTreatNG = false;
|
||||
detectResult.IsPreTreatDone = true;
|
||||
}
|
||||
break;
|
||||
case -111: // 检测结果为NG
|
||||
{
|
||||
/// detectResult.VisionImageSet.DetectionResultImage =
|
||||
// tool.GetResultObject("OUTPUT_PreTreatedImage").ConvertHImageToBitmap();
|
||||
for (int i = 0; i < detectConfig.OUTPreTreatParams.Count; i++)
|
||||
{
|
||||
|
||||
var param = detectConfig.OUTPreTreatParams[i];
|
||||
|
||||
var Value = tool.GetResultTuple(param.Name);
|
||||
|
||||
// 显示结果
|
||||
IndexedSpec specRCricularity = new()
|
||||
{
|
||||
Code = param.Name,
|
||||
ActualValue = Value
|
||||
};
|
||||
detectResult.realSpecs.Add(specRCricularity);
|
||||
}
|
||||
// 结果为NG
|
||||
detectResult.ResultState = ResultState.DetectNG;
|
||||
detectResult.IsPreTreatNG = true;
|
||||
detectResult.IsPreTreatDone = true;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
case -999: // 算法异常
|
||||
{
|
||||
// 算法异常时,结果图
|
||||
// detectResult.VisionImageSet.DetectionResultImage =
|
||||
// tool.GetResultObject("OUTPUT_PreTreatedImage").ConvertHImageToBitmap();
|
||||
|
||||
for (int i = 0; i < detectConfig.OUTPreTreatParams.Count; i++)
|
||||
{
|
||||
|
||||
|
||||
var param = detectConfig.OUTPreTreatParams[i];
|
||||
// 显示结果
|
||||
IndexedSpec specRCricularity = new()
|
||||
{
|
||||
Code = param.Name,
|
||||
ActualValue = -1,
|
||||
};
|
||||
detectResult.realSpecs.Add(specRCricularity);
|
||||
}
|
||||
|
||||
// 结果保持TBD
|
||||
detectResult.IsPreTreatDone = true;
|
||||
break;
|
||||
}
|
||||
var param = detectConfig.OUTPreTreatParams[i];
|
||||
tool.InputTupleDic[param.Name] = double.Parse(param.Value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 2023/10/16 新增预处理结果反馈,如果预处理结果为NG,直接返回
|
||||
if (preTreatRet != 0)
|
||||
{
|
||||
@ -668,7 +558,7 @@ namespace DH.Devices.Vision
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogAsync(DateTime.Now, LogLevel.Exception, $"{detectConfig.Name}预处理异常:{ex.GetExceptionMessage()}");
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -679,266 +569,6 @@ namespace DH.Devices.Vision
|
||||
}
|
||||
|
||||
}
|
||||
public void PreTreated2(DetectionConfig detectConfig, DetectStationResult detectResult,Mat MhImage)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
if (detectConfig.SizeTreatParamList != null && detectConfig.SizeTreatParamList.Count > 0)
|
||||
{
|
||||
foreach (var preTreat in detectConfig.SizeTreatParamList)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(preTreat.PrePath))
|
||||
{
|
||||
string toolKey = preTreat.PrePath;
|
||||
if (!HalconToolDict.ContainsKey(toolKey))
|
||||
{
|
||||
LogAsync(DateTime.Now, LogLevel.Exception, $"{detectConfig.Name}未获取预处理{preTreat.PreName}算法");
|
||||
return;
|
||||
}
|
||||
//Mean_Thre Deviation_Thre Mean_standard Deviation_standard
|
||||
var tool = HalconToolDict[toolKey];
|
||||
|
||||
//tool.InputTupleDic["Mean_Thre"] = 123;
|
||||
List<PreTreatParam> PreParams = new List<PreTreatParam>();
|
||||
preoutparms(PreParams, preTreat.ResultShow);
|
||||
for (int i = 0; i < PreParams.Count(); i++)
|
||||
{
|
||||
var param = PreParams[i];
|
||||
if (param.Value.Contains(","))
|
||||
{
|
||||
string[] strings = param.Value.Split(",");
|
||||
float[] array = strings.Select(s => float.Parse(s)).ToArray();
|
||||
HTuple hTupleArray = new HTuple(array);
|
||||
|
||||
tool.InputTupleDic[param.Name] = hTupleArray;
|
||||
}
|
||||
else
|
||||
{
|
||||
tool.InputTupleDic[param.Name] = double.Parse(param.Value);// param.Value.ToInt();
|
||||
}
|
||||
|
||||
IndexedSpec spec1 = new IndexedSpec();
|
||||
|
||||
switch (preTreat.PreType)
|
||||
{
|
||||
case SizeEnum.线线测量:
|
||||
|
||||
break;
|
||||
case SizeEnum.线圆测量:
|
||||
|
||||
break;
|
||||
case SizeEnum.圆形测量:
|
||||
break;
|
||||
case SizeEnum.高度测量:
|
||||
spec1.Code = $"in-{param.Name}";
|
||||
spec1.ActualValue = double.Parse(param.Value);
|
||||
break;
|
||||
case SizeEnum.直线测量:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
detectResult.realSpecs.Add(spec1);
|
||||
}
|
||||
//// 指定保存路径
|
||||
//string filePath = @"D:\saved_image.jpg"; // 你可以根据需要更改路径和文件名
|
||||
|
||||
//// 使用WriteImage保存图像
|
||||
//detectResult.VisionImageSet.HImage.WriteImage("jpeg", 0, filePath); // "jpeg" 表示图像格式,0表示不使用压缩
|
||||
HObject obj = OpenCVHelper.MatToHImage(MhImage);
|
||||
HImage hImage = HalconHelper.ConvertHObjectToHImage(obj);
|
||||
tool.InputImageDic["INPUT_Image"] = hImage;
|
||||
if (!tool.RunProcedure(out string errorMsg, out _))
|
||||
{
|
||||
// detectResult.VisionImageSet.PreTreatedFlag = false;
|
||||
LogAsync(DateTime.Now, LogLevel.Exception, $"{detectConfig.Name}预处理异常,{errorMsg}");
|
||||
detectResult.IsPreTreatDone = false;
|
||||
|
||||
// HandleDetectDone(detectResult, detectConfig);
|
||||
return;
|
||||
}
|
||||
|
||||
var preTreatRet = tool.GetResultTuple("OUTPUT_Flag").I;
|
||||
//double MatchScore = 1;
|
||||
//MatchScore = tool.GetResultTuple("MatchScore");
|
||||
|
||||
|
||||
detectResult.IsPreTreatDone = preTreatRet == 1;
|
||||
// detectResult.IsPreTreatDone = detectResult.VisionImageSet.PreTreatedFlag = true;
|
||||
// detectResult.VisionImageSet.PreTreatedTime = DateTime.Now;
|
||||
|
||||
|
||||
//IndexedSpec spec1 = new IndexedSpec();
|
||||
//spec1.Code = "score";
|
||||
//spec1.ActualValue = MatchScore;
|
||||
|
||||
|
||||
//detectResult.realSpecs.Add(spec1);
|
||||
;
|
||||
|
||||
|
||||
// 2023/10/16 新增预处理结果反馈,如果预处理结果为NG,直接返回
|
||||
if (preTreatRet != 0)
|
||||
{
|
||||
detectResult.ResultState = ResultState.DetectNG;
|
||||
|
||||
detectResult.IsPreTreatNG = true;
|
||||
// detectResult.VisionImageSet.DetectionResultImage = detectResult.VisionImageSet.MLImage.ConvertHImageToBitmap();
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
switch (preTreat.PreType)
|
||||
{
|
||||
case SizeEnum.线线测量:
|
||||
isPreOutparams(ref detectResult, preTreat, tool, ref preTreatRet);
|
||||
break;
|
||||
case SizeEnum.线圆测量:
|
||||
isPreOutparams(ref detectResult, preTreat, tool, ref preTreatRet);
|
||||
break;
|
||||
case SizeEnum.圆形测量:
|
||||
break;
|
||||
case SizeEnum.高度测量:
|
||||
{
|
||||
|
||||
isPreOutparams(ref detectResult, preTreat, tool, ref preTreatRet);
|
||||
}
|
||||
break;
|
||||
case SizeEnum.直线测量:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogAsync(DateTime.Now, LogLevel.Exception, $"{detectConfig.Name}尺寸预处理异常:{ex.GetExceptionMessage()}");
|
||||
}
|
||||
finally
|
||||
{
|
||||
//detectResult.VisionImageSet.HImage?.Dispose();
|
||||
//detectResult.VisionImageSet.HImage = null;
|
||||
}
|
||||
}
|
||||
public void isPreOutparams(ref DetectStationResult detectResult, SizeTreatParam preTreat, HDevEngineTool tool, ref int preTreatRet)
|
||||
{
|
||||
List<PreTreatParam> PreParams = new List<PreTreatParam>();
|
||||
preoutparms(PreParams, preTreat.OutResultShow);
|
||||
|
||||
for (int i = 0; i < PreParams.Count; i++)
|
||||
{
|
||||
var param = PreParams[i];
|
||||
double dParam = double.Parse(param.Value);
|
||||
double heights = tool.GetResultTuple(param.Name).D;
|
||||
switch (preTreat.PreType)
|
||||
{
|
||||
case SizeEnum.高度测量:
|
||||
|
||||
|
||||
IndexedSpec spec2 = new IndexedSpec();
|
||||
spec2.Code = $"out-{param.Name}";
|
||||
spec2.ActualValue = Convert.ToDouble(param.Value);
|
||||
|
||||
|
||||
detectResult.realSpecs.Add(spec2);
|
||||
|
||||
|
||||
IndexedSpec spec1 = new IndexedSpec();
|
||||
spec1.Code = $"actual-{param.Name}";
|
||||
spec1.ActualValue = heights;
|
||||
|
||||
|
||||
detectResult.realSpecs.Add(spec1);
|
||||
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ((heights > dParam - preTreat.PrePix) && (heights < dParam + preTreat.PrePix))
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
preTreatRet = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (preTreatRet != 0)
|
||||
{
|
||||
detectResult.ResultState = ResultState.DetectNG;
|
||||
|
||||
detectResult.IsPreTreatNG = true;
|
||||
//detectResult.VisionImageSet.DetectionResultImage = detectResult.VisionImageSet.MLImage.ConvertHImageToBitmap();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// detectResult.VisionImageSet.DetectionResultImage = detectResult.VisionImageSet.MLImage.ConvertHImageToBitmap();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void preoutparms(List<PreTreatParam> preTreatParams, string defectRows)
|
||||
{
|
||||
// 解析 ReslutShow 字符串,构建 PreTreatParam 列表
|
||||
if (!string.IsNullOrEmpty(defectRows))
|
||||
{
|
||||
var keyValuePairs = defectRows.Split(';');
|
||||
|
||||
foreach (var pair in keyValuePairs)
|
||||
{
|
||||
var parts = pair.Split(':');
|
||||
if (parts.Length == 2)
|
||||
{
|
||||
PreTreatParam param;
|
||||
if (parts[1].Trim().Contains(","))
|
||||
{
|
||||
param = new PreTreatParam
|
||||
{
|
||||
Name = parts[0].Trim(), // 去除多余的空格
|
||||
Value = parts[1].Trim() // 转换为 double,失败则为0
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
double dvalue = double.TryParse(parts[1].Trim(), out double value) ? value : 0;
|
||||
|
||||
param = new PreTreatParam
|
||||
{
|
||||
Name = parts[0].Trim(), // 去除多余的空格
|
||||
Value = dvalue.ToString() // 转换为 double,失败则为0
|
||||
};
|
||||
}
|
||||
|
||||
preTreatParams.Add(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 显示检测结果
|
||||
@ -963,15 +593,15 @@ namespace DH.Devices.Vision
|
||||
});
|
||||
}
|
||||
|
||||
if (detectResult.realSpecs != null && detectResult.realSpecs?.Count > 0)
|
||||
{
|
||||
detectResult.realSpecs.ForEach(d =>
|
||||
{
|
||||
displayTxt +=
|
||||
$"{d.Code} :{d.ActualValue} \r\n";
|
||||
});
|
||||
}
|
||||
Bitmap resultMask =result.ToBitmap();
|
||||
//if (detectResult.realSpecs != null && detectResult.realSpecs?.Count > 0)
|
||||
//{
|
||||
// detectResult.realSpecs.ForEach(d =>
|
||||
// {
|
||||
// displayTxt +=
|
||||
// $"{d.Code} :{d.ActualValue} \r\n";
|
||||
// });
|
||||
//}
|
||||
Bitmap resultMask=result.ToBitmap();
|
||||
//if (detectResult.VisionImageSet.DetectionResultImage == null && detectResult.VisionImageSet.SizeResultImage == null)
|
||||
//{
|
||||
// return;
|
||||
@ -1005,14 +635,14 @@ namespace DH.Devices.Vision
|
||||
List<IShapeElement> detectionResultShapesClone = new List<IShapeElement>(detectionResultShapes);
|
||||
|
||||
DetectionDone(DetectionId, resultMask, detectionResultShapes);
|
||||
//detectResult.DetectionOriginImage = CopyBitmapWithLockBits(resultMask);
|
||||
SaveDetectResultImageAsync(detectResult);
|
||||
|
||||
//SaveDetectResultImageAsync(detectResult);
|
||||
// SaveDetectResultCSVAsync(detectResult);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//LogAsync(DateTime.Now, LogLevel.Exception,
|
||||
// $"{Name}显示{detectResult.DetectName}检测结果异常,{ex.GetExceptionMessage()}");
|
||||
// LogAsync(DateTime.Now, LogLevel.Exception,
|
||||
// $"{Name}显示{detectResult.DetectName}检测结果异常,{ex.GetExceptionMessage()}");
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -1021,343 +651,6 @@ namespace DH.Devices.Vision
|
||||
}
|
||||
});
|
||||
}
|
||||
public static Bitmap CopyBitmapWithLockBits(Bitmap original)
|
||||
{
|
||||
Bitmap copy = new Bitmap(original.Width, original.Height, original.PixelFormat);
|
||||
BitmapData originalData = original.LockBits(
|
||||
new Rectangle(0, 0, original.Width, original.Height),
|
||||
ImageLockMode.ReadOnly,
|
||||
original.PixelFormat
|
||||
);
|
||||
BitmapData copyData = copy.LockBits(
|
||||
new Rectangle(0, 0, copy.Width, copy.Height),
|
||||
ImageLockMode.WriteOnly,
|
||||
copy.PixelFormat
|
||||
);
|
||||
int bytesPerPixel = Image.GetPixelFormatSize(original.PixelFormat) / 8;
|
||||
int byteCount = originalData.Stride * original.Height;
|
||||
byte[] buffer = new byte[byteCount];
|
||||
System.Runtime.InteropServices.Marshal.Copy(originalData.Scan0, buffer, 0, byteCount);
|
||||
System.Runtime.InteropServices.Marshal.Copy(buffer, 0, copyData.Scan0, byteCount);
|
||||
original.UnlockBits(originalData);
|
||||
copy.UnlockBits(copyData);
|
||||
return copy;
|
||||
}
|
||||
/// <summary>
|
||||
///图片异步保存
|
||||
/// </summary>
|
||||
public void SaveDetectResultImageAsync1(DetectStationResult detectResult)
|
||||
{
|
||||
string format = detectResult.ImageFormat.ToString().ToLower();
|
||||
|
||||
if(detectResult.ImageSaveDirectory!=null)
|
||||
{
|
||||
if (!Directory.Exists(detectResult.ImageSaveDirectory))
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//根目录
|
||||
string rootPath = Path.Combine(detectResult.ImageSaveDirectory,
|
||||
DateTime.Now.ToString("yyyyMMdd"), detectResult.DetectName);
|
||||
|
||||
if (detectResult.ResultState != ResultState.OK)
|
||||
{
|
||||
|
||||
// NG原图
|
||||
if (detectResult.SaveNGOriginal && detectResult.DetectionOriginImage != null)
|
||||
{
|
||||
string prefix = Path.Combine(rootPath, "NGRawImages", detectResult.ResultLabel);
|
||||
string fullname = Path.Combine(prefix, $"{detectResult.Pid}_NGRawImage_{detectResult.DetectName}_{detectResult.Id}.{format}");
|
||||
SaveImageAsync(fullname, detectResult.DetectionOriginImage, detectResult.ImageFormat);
|
||||
}
|
||||
|
||||
|
||||
//NG结果图
|
||||
if (detectResult.SaveOKDetect && detectResult.DetectionOriginImage != null)
|
||||
{
|
||||
// 没有预处理,则保存原始图+检测结果图
|
||||
// if (detectResult.VisionImageSet.PreTreatedBitmap == null)
|
||||
{
|
||||
//string displayTxt = detectResult.ResultState.ToString() + "\r\n";
|
||||
string displayTxt = "";
|
||||
detectResult.DetectDetails.ForEach(d =>
|
||||
{
|
||||
displayTxt += $"{d.LabelName} score:{d.Score.ToString("f2")} area:{d.Area.ToString("f2")}\r\n";
|
||||
});
|
||||
if (detectResult.realSpecs != null && detectResult.realSpecs?.Count > 0)
|
||||
{
|
||||
detectResult.realSpecs.ForEach(d =>
|
||||
{
|
||||
displayTxt +=
|
||||
$"{d.Code} score:{d.ActualValue} \r\n";
|
||||
});
|
||||
}
|
||||
Bitmap resultMask = detectResult.DetectionOriginImage.CopyBitmap();
|
||||
|
||||
Bitmap preTreatedBitmap = detectResult.DetectionOriginImage.CopyBitmap();
|
||||
|
||||
//List<IShapeElement> detectionResultShapes = new List<IShapeElement>(detectResult.DetectionResultShapes);
|
||||
//DetectResultDisplay resultDisplay = new DetectResultDisplay(detectResult, resultMask, displayTxt);
|
||||
//detectionResultShapes.Add(resultDisplay);
|
||||
|
||||
Bitmap resultMap = GetResultImage(resultMask, detectResult.DetectionResultShapes);
|
||||
|
||||
|
||||
// resultDisplay.Dispose();
|
||||
//detectionResultShapes.Clear();
|
||||
|
||||
|
||||
Bitmap detectionFitImage = StaticHelper.HConnectBitmap(preTreatedBitmap, resultMap);
|
||||
|
||||
string prefix = Path.Combine(rootPath, "NGFitImages", detectResult.ResultLabel);
|
||||
Directory.CreateDirectory(prefix); // 自动创建所有缺失的目录
|
||||
string fullname = Path.Combine(prefix, $"{detectResult.Pid}_NGFitImage_{detectResult.DetectName}_{detectResult.Id}.{format}");
|
||||
|
||||
|
||||
|
||||
// SaveImageAsync(fullname, detectionFitImage, detectResult.ImageFormat);
|
||||
// 使用回调或 Task.ContinueWith 确保保存完成后再释放资源
|
||||
//SaveImageAsync(fullname, detectionFitImage, detectResult.ImageFormat)
|
||||
// .ContinueWith(t =>
|
||||
// {
|
||||
// resultMask?.Dispose();
|
||||
// preTreatedBitmap?.Dispose();
|
||||
// resultMap?.Dispose();
|
||||
// detectionFitImage?.Dispose();
|
||||
// }, TaskScheduler.Default);
|
||||
|
||||
resultMask?.Dispose();
|
||||
preTreatedBitmap?.Dispose();
|
||||
resultMap?.Dispose();
|
||||
detectionFitImage?.Dispose();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // OK原图
|
||||
if (detectResult.SaveOKOriginal && detectResult.DetectionOriginImage != null)
|
||||
{
|
||||
string prefix = Path.Combine(rootPath, "OKRawImages", detectResult.ResultLabel);
|
||||
string fullname = Path.Combine(prefix, $"{detectResult.Pid}_OKRawImage_{detectResult.DetectName}_{detectResult.Id}.{format}");
|
||||
SaveImageAsync(fullname, detectResult.DetectionOriginImage, detectResult.ImageFormat);
|
||||
}
|
||||
|
||||
//ok结果图
|
||||
if (detectResult.SaveOKDetect && detectResult.DetectionOriginImage != null)
|
||||
{
|
||||
// 没有预处理,则保存原始图+检测结果图
|
||||
// if (detectResult.VisionImageSet.PreTreatedBitmap == null)
|
||||
{
|
||||
//string displayTxt = detectResult.ResultState.ToString() + "\r\n";
|
||||
string displayTxt = "";
|
||||
detectResult.DetectDetails.ForEach(d =>
|
||||
{
|
||||
displayTxt += $"{d.LabelName} score:{d.Score.ToString("f2")} area:{d.Area.ToString("f2")}\r\n";
|
||||
});
|
||||
if (detectResult.realSpecs != null && detectResult.realSpecs?.Count > 0)
|
||||
{
|
||||
detectResult.realSpecs.ForEach(d =>
|
||||
{
|
||||
displayTxt +=
|
||||
$"{d.Code} score:{d.ActualValue} \r\n";
|
||||
});
|
||||
}
|
||||
Bitmap resultMask = detectResult.DetectionOriginImage.CopyBitmap();
|
||||
|
||||
Bitmap preTreatedBitmap = detectResult.DetectionOriginImage.CopyBitmap();
|
||||
|
||||
List<IShapeElement> detectionResultShapes = new List<IShapeElement>(detectResult.DetectionResultShapes);
|
||||
DetectResultDisplay resultDisplay = new DetectResultDisplay(detectResult, resultMask, displayTxt);
|
||||
detectionResultShapes.Add(resultDisplay);
|
||||
|
||||
Bitmap resultMap = GetResultImage(resultMask, detectionResultShapes);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Bitmap detectionFitImage = StaticHelper.HConnectBitmap(preTreatedBitmap, resultMap);
|
||||
|
||||
string prefix = Path.Combine(rootPath, "OKFitImages", detectResult.ResultLabel);
|
||||
string fullname = Path.Combine(prefix, $"{detectResult.Pid}_" +
|
||||
$"OKFitImage_{detectResult.DetectName}_{detectResult.Id}.{format}");
|
||||
|
||||
|
||||
|
||||
SaveImageAsync(fullname, detectionFitImage, detectResult.ImageFormat);
|
||||
|
||||
//resultDisplay.Dispose();
|
||||
//detectionResultShapes.Clear();
|
||||
//resultMask?.Dispose();
|
||||
//preTreatedBitmap?.Dispose();
|
||||
//resultMap?.Dispose();
|
||||
//detectionFitImage?.Dispose();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public virtual Bitmap GetResultImage(Bitmap baseImage, List<IShapeElement> eleList)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 重新生成画布 避免 无法从带有索引像素格式的图像创建graphics对象
|
||||
Bitmap image = new Bitmap(baseImage.Width, baseImage.Height);
|
||||
|
||||
using (Graphics g = Graphics.FromImage(image))
|
||||
{
|
||||
g.DrawImage(baseImage, 0, 0);
|
||||
|
||||
// 创建临时拷贝避免共享状态
|
||||
// var tempElements = eleList.Select(e => e.Clone()).Cast<IShapeElement>().ToList();
|
||||
|
||||
eleList.ForEach(e =>
|
||||
{
|
||||
e.State = ElementState.Normal;
|
||||
e.Draw(g);
|
||||
});
|
||||
}
|
||||
return image;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogAsync(DateTime.Now, LogLevel.Exception, $"获取叠加结果图片异常:{ex.GetExceptionMessage()}");
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void SaveDetectResultImageAsync(DetectStationResult detectResult)
|
||||
{
|
||||
if (detectResult.ImageSaveDirectory == null) return;
|
||||
|
||||
string format = detectResult.ImageFormat.ToString().ToLower();
|
||||
string rootPath = Path.Combine(detectResult.ImageSaveDirectory,
|
||||
DateTime.Now.ToString("yyyyMMdd"), detectResult.DetectName);
|
||||
|
||||
try
|
||||
{
|
||||
if (detectResult.ResultState != ResultState.OK)
|
||||
{
|
||||
SaveNGImages(detectResult, rootPath, format);
|
||||
}
|
||||
else
|
||||
{
|
||||
SaveOKImages(detectResult, rootPath, format);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Logger.Error($"保存检测结果失败: {ex.Message}");
|
||||
}
|
||||
finally {
|
||||
GC.Collect();
|
||||
GC.WaitForPendingFinalizers();
|
||||
}
|
||||
}
|
||||
private void SaveNGImages(DetectStationResult result, string rootPath, string format)
|
||||
{
|
||||
// NG 原图
|
||||
if (result.SaveNGOriginal && result.DetectionOriginImage != null)
|
||||
{
|
||||
string prefix = Path.Combine(rootPath, "NGRawImages", result.ResultLabel);
|
||||
Directory.CreateDirectory(prefix);
|
||||
string fullname = Path.Combine(prefix, $"{result.Pid}_NGRawImage_{result.DetectName}_{result.Id}.{format}");
|
||||
SaveImageAsync(fullname, result.DetectionOriginImage, result.ImageFormat);
|
||||
}
|
||||
|
||||
// NG 结果图
|
||||
if (result.SaveOKDetect && result.DetectionOriginImage != null)
|
||||
{
|
||||
string displayTxt = BuildDisplayText(result);
|
||||
using (Bitmap resultMask = result.DetectionOriginImage.CopyBitmap())
|
||||
using (Bitmap preTreatedBitmap = result.DetectionOriginImage.CopyBitmap())
|
||||
{
|
||||
var detectionResultShapes = new List<IShapeElement>()
|
||||
{
|
||||
new DetectResultDisplay(result, resultMask, displayTxt)
|
||||
};
|
||||
|
||||
using (Bitmap resultMap = GetResultImage(resultMask, detectionResultShapes))
|
||||
using (Bitmap detectionFitImage = StaticHelper.HConnectBitmap(preTreatedBitmap, resultMap))
|
||||
{
|
||||
string prefix = Path.Combine(rootPath, "NGFitImages", result.ResultLabel);
|
||||
Directory.CreateDirectory(prefix);
|
||||
string fullname = Path.Combine(prefix, $"{result.Pid}_NGFitImage_{result.DetectName}_{result.Id}.{format}");
|
||||
SaveImageAsync(fullname, detectionFitImage, result.ImageFormat);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void SaveOKImages(DetectStationResult result, string rootPath, string format)
|
||||
{
|
||||
// OK 原图
|
||||
if (result.SaveOKOriginal && result.DetectionOriginImage != null)
|
||||
{
|
||||
string prefix = Path.Combine(rootPath, "OKRawImages", result.ResultLabel);
|
||||
Directory.CreateDirectory(prefix);
|
||||
string fullname = Path.Combine(prefix, $"{result.Pid}_OKRawImage_{result.DetectName}_{result.Id}.{format}");
|
||||
SaveImageAsync(fullname, result.DetectionOriginImage, result.ImageFormat);
|
||||
}
|
||||
|
||||
// OK 结果图
|
||||
if (result.SaveOKDetect && result.DetectionOriginImage != null)
|
||||
{
|
||||
string displayTxt = BuildDisplayText(result);
|
||||
using (Bitmap resultMask = result.DetectionOriginImage.CopyBitmap())
|
||||
using (Bitmap preTreatedBitmap = result.DetectionOriginImage.CopyBitmap())
|
||||
{
|
||||
var detectionResultShapes = new List<IShapeElement>()
|
||||
{
|
||||
new DetectResultDisplay(result, resultMask, displayTxt)
|
||||
};
|
||||
|
||||
using (Bitmap resultMap = GetResultImage(resultMask, detectionResultShapes))
|
||||
using (Bitmap detectionFitImage = StaticHelper.HConnectBitmap(preTreatedBitmap, resultMap))
|
||||
{
|
||||
string prefix = Path.Combine(rootPath, "OKFitImages", result.ResultLabel);
|
||||
Directory.CreateDirectory(prefix);
|
||||
string fullname = Path.Combine(prefix, $"{result.Pid}_OKFitImage_{result.DetectName}_{result.Id}.{format}");
|
||||
SaveImageAsync(fullname, detectionFitImage, result.ImageFormat);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string BuildDisplayText(DetectStationResult result)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
result.DetectDetails.ForEach(d => sb.AppendLine($"{d.LabelName} score:{d.Score:f2} area:{d.Area:f2}"));
|
||||
if (result.realSpecs?.Count > 0)
|
||||
{
|
||||
result.realSpecs.ForEach(d => sb.AppendLine($"{d.Code} score:{d.ActualValue}"));
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,14 +10,6 @@
|
||||
<Platforms>AnyCPU;x64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<Optimize>False</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Optimize>False</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DH.Commons\DH.Commons.csproj" />
|
||||
</ItemGroup>
|
||||
|
@ -580,7 +580,7 @@ namespace DH.UI.Model.Winform
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
public Rectangle BaseRectangle { get; set; }
|
||||
|
||||
EnumHelper.ElementState IShapeElement.State { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
|
||||
|
||||
public abstract bool IsMouseHover(PointF p);
|
||||
|
||||
|
@ -13,6 +13,45 @@
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AntdUI" Version="1.8.9" />
|
||||
<PackageReference Include="SqlSugarCore" Version="5.1.4.185" />
|
||||
|
@ -9,32 +9,10 @@ namespace DHSoftware
|
||||
public LoginWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
// 关键设置:允许窗体优先接收按键事件
|
||||
this.KeyPreview = true;
|
||||
|
||||
// 绑定按键事件
|
||||
this.KeyDown += Login_KeyDown;
|
||||
button_ok.Click += Button_ok_Click;
|
||||
button_cancel.Click += Button_cancel_Click;
|
||||
}
|
||||
|
||||
private void Login_KeyDown(object? sender, KeyEventArgs e)
|
||||
{
|
||||
// 监听回车键
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
{
|
||||
button_ok.PerformClick(); // 触发确定按钮的点击事件
|
||||
e.Handled = true; // 阻止其他控件处理该按键
|
||||
}
|
||||
|
||||
// 监听 ESC 键
|
||||
if (e.KeyCode == Keys.Escape)
|
||||
{
|
||||
button_cancel.PerformClick(); // 触发取消按钮的点击事件
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 窗体对象实例
|
||||
/// </summary>
|
||||
|
556
DHSoftware/MainWindow.Designer.cs
generated
556
DHSoftware/MainWindow.Designer.cs
generated
@ -28,41 +28,29 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AntdUI.Tabs.StyleLine styleLine2 = new AntdUI.Tabs.StyleLine();
|
||||
AntdUI.Tabs.StyleCard styleCard2 = new AntdUI.Tabs.StyleCard();
|
||||
AntdUI.Tabs.StyleCard styleCard3 = new AntdUI.Tabs.StyleCard();
|
||||
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 segmentedItem7 = new AntdUI.SegmentedItem();
|
||||
AntdUI.SegmentedItem segmentedItem8 = new AntdUI.SegmentedItem();
|
||||
AntdUI.SegmentedItem segmentedItem9 = new AntdUI.SegmentedItem();
|
||||
AntdUI.SegmentedItem segmentedItem10 = new AntdUI.SegmentedItem();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainWindow));
|
||||
titlebar = new AntdUI.PageHeader();
|
||||
lbName = new AntdUI.Label();
|
||||
tabsStas = new AntdUI.Tabs();
|
||||
tabPage3 = new AntdUI.TabPage();
|
||||
panel7 = new Panel();
|
||||
tabMain = new AntdUI.TabPage();
|
||||
pageHeader1 = new AntdUI.PageHeader();
|
||||
labuph = new Label();
|
||||
divider2 = new AntdUI.Divider();
|
||||
panelmain = new AntdUI.Panel();
|
||||
splitter2 = new AntdUI.Splitter();
|
||||
tabImgDisplay = new AntdUI.Tabs();
|
||||
splitter1 = new AntdUI.Splitter();
|
||||
pnlLog = new AntdUI.Panel();
|
||||
panel6 = new AntdUI.Panel();
|
||||
tableLayoutstatistics = new TableLayoutPanel();
|
||||
dgvCamreaNums = new DataGridView();
|
||||
panelNums = new AntdUI.Panel();
|
||||
tableLayoutNums = new TableLayoutPanel();
|
||||
dgvProductNums = new DataGridView();
|
||||
tableLayoutPanel3 = new TableLayoutPanel();
|
||||
lblTotalTime = new Label();
|
||||
label1 = new Label();
|
||||
label12 = new Label();
|
||||
lblUPH = new Label();
|
||||
lblStartTime = new Label();
|
||||
lblOEE_Total = new Label();
|
||||
label10 = new Label();
|
||||
label7 = new Label();
|
||||
panel2 = new AntdUI.Panel();
|
||||
panel4 = new AntdUI.Panel();
|
||||
panel6 = new AntdUI.Panel();
|
||||
splitContainer1 = new SplitContainer();
|
||||
splitContainer2 = new SplitContainer();
|
||||
tabImgDisplay = new AntdUI.Tabs();
|
||||
richTextBox1 = new RichTextBox();
|
||||
tabsConfig = new AntdUI.Tabs();
|
||||
tabPage2 = new AntdUI.TabPage();
|
||||
panel1 = new AntdUI.Panel();
|
||||
panel3 = new AntdUI.Panel();
|
||||
btnDeleteProject = new AntdUI.Button();
|
||||
@ -71,24 +59,20 @@
|
||||
sltProjects = new AntdUI.Select();
|
||||
segmented1 = new AntdUI.Segmented();
|
||||
titlebar.SuspendLayout();
|
||||
tabsStas.SuspendLayout();
|
||||
tabPage3.SuspendLayout();
|
||||
pageHeader1.SuspendLayout();
|
||||
panelmain.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)splitter2).BeginInit();
|
||||
splitter2.Panel1.SuspendLayout();
|
||||
splitter2.Panel2.SuspendLayout();
|
||||
splitter2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)splitter1).BeginInit();
|
||||
splitter1.Panel1.SuspendLayout();
|
||||
splitter1.Panel2.SuspendLayout();
|
||||
splitter1.SuspendLayout();
|
||||
panel2.SuspendLayout();
|
||||
panel4.SuspendLayout();
|
||||
panel6.SuspendLayout();
|
||||
tableLayoutstatistics.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dgvCamreaNums).BeginInit();
|
||||
panelNums.SuspendLayout();
|
||||
tableLayoutNums.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dgvProductNums).BeginInit();
|
||||
tableLayoutPanel3.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)splitContainer1).BeginInit();
|
||||
splitContainer1.Panel1.SuspendLayout();
|
||||
splitContainer1.Panel2.SuspendLayout();
|
||||
splitContainer1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)splitContainer2).BeginInit();
|
||||
splitContainer2.Panel1.SuspendLayout();
|
||||
splitContainer2.Panel2.SuspendLayout();
|
||||
splitContainer2.SuspendLayout();
|
||||
tabsConfig.SuspendLayout();
|
||||
panel1.SuspendLayout();
|
||||
panel3.SuspendLayout();
|
||||
SuspendLayout();
|
||||
@ -123,325 +107,155 @@
|
||||
lbName.Text = "";
|
||||
lbName.TextAlign = ContentAlignment.MiddleRight;
|
||||
//
|
||||
// tabsStas
|
||||
// pageHeader1
|
||||
//
|
||||
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 = styleLine2;
|
||||
tabsStas.TabIndex = 3;
|
||||
tabsStas.Text = "tabs3";
|
||||
pageHeader1.Controls.Add(labuph);
|
||||
pageHeader1.Controls.Add(divider2);
|
||||
pageHeader1.DividerShow = true;
|
||||
pageHeader1.Dock = DockStyle.Bottom;
|
||||
pageHeader1.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
pageHeader1.Location = new Point(0, 608);
|
||||
pageHeader1.Name = "pageHeader1";
|
||||
pageHeader1.Size = new Size(1024, 40);
|
||||
pageHeader1.TabIndex = 7;
|
||||
pageHeader1.Text = "UPH";
|
||||
//
|
||||
// tabPage3
|
||||
// labuph
|
||||
//
|
||||
tabPage3.Controls.Add(panel7);
|
||||
tabPage3.Location = new Point(3, 3);
|
||||
tabPage3.Name = "tabPage3";
|
||||
tabPage3.Size = new Size(574, 170);
|
||||
tabPage3.TabIndex = 0;
|
||||
tabPage3.Text = "日志";
|
||||
labuph.AutoSize = true;
|
||||
labuph.Location = new Point(59, 10);
|
||||
labuph.Name = "labuph";
|
||||
labuph.Size = new Size(64, 21);
|
||||
labuph.TabIndex = 1;
|
||||
labuph.Text = "100000";
|
||||
//
|
||||
// panel7
|
||||
// divider2
|
||||
//
|
||||
panel7.Dock = DockStyle.Fill;
|
||||
panel7.Location = new Point(0, 0);
|
||||
panel7.Name = "panel7";
|
||||
panel7.Size = new Size(574, 170);
|
||||
panel7.TabIndex = 2;
|
||||
//
|
||||
// tabMain
|
||||
//
|
||||
tabMain.Location = new Point(3, 28);
|
||||
tabMain.Name = "tabMain";
|
||||
tabMain.Size = new Size(574, 289);
|
||||
tabMain.TabIndex = 0;
|
||||
tabMain.Text = "检测";
|
||||
divider2.Dock = DockStyle.Top;
|
||||
divider2.Location = new Point(0, 0);
|
||||
divider2.Name = "divider2";
|
||||
divider2.OrientationMargin = 0F;
|
||||
divider2.Size = new Size(1024, 10);
|
||||
divider2.TabIndex = 0;
|
||||
divider2.Text = "";
|
||||
//
|
||||
// panelmain
|
||||
//
|
||||
panelmain.Controls.Add(splitter2);
|
||||
panelmain.Controls.Add(panel2);
|
||||
panelmain.Controls.Add(panel1);
|
||||
panelmain.Dock = DockStyle.Fill;
|
||||
panelmain.Location = new Point(0, 40);
|
||||
panelmain.Margin = new Padding(0);
|
||||
panelmain.Name = "panelmain";
|
||||
panelmain.Size = new Size(1024, 631);
|
||||
panelmain.Size = new Size(1024, 568);
|
||||
panelmain.TabIndex = 8;
|
||||
//
|
||||
// splitter2
|
||||
// panel2
|
||||
//
|
||||
splitter2.Dock = DockStyle.Fill;
|
||||
splitter2.Location = new Point(0, 68);
|
||||
splitter2.Name = "splitter2";
|
||||
splitter2.Orientation = Orientation.Horizontal;
|
||||
panel2.Controls.Add(panel4);
|
||||
panel2.Dock = DockStyle.Fill;
|
||||
panel2.Location = new Point(0, 68);
|
||||
panel2.Name = "panel2";
|
||||
panel2.Size = new Size(1024, 500);
|
||||
panel2.TabIndex = 1;
|
||||
panel2.Text = "panel2";
|
||||
//
|
||||
// splitter2.Panel1
|
||||
// panel4
|
||||
//
|
||||
splitter2.Panel1.Controls.Add(tabImgDisplay);
|
||||
panel4.Controls.Add(panel6);
|
||||
panel4.Dock = DockStyle.Fill;
|
||||
panel4.Location = new Point(0, 0);
|
||||
panel4.Name = "panel4";
|
||||
panel4.Size = new Size(1024, 500);
|
||||
panel4.TabIndex = 1;
|
||||
panel4.Text = "panel4";
|
||||
//
|
||||
// splitter2.Panel2
|
||||
// panel6
|
||||
//
|
||||
splitter2.Panel2.Controls.Add(splitter1);
|
||||
splitter2.Size = new Size(1024, 563);
|
||||
splitter2.SplitterDistance = 442;
|
||||
splitter2.TabIndex = 4;
|
||||
panel6.Controls.Add(splitContainer1);
|
||||
panel6.Dock = DockStyle.Fill;
|
||||
panel6.Location = new Point(0, 0);
|
||||
panel6.Name = "panel6";
|
||||
panel6.Size = new Size(1024, 500);
|
||||
panel6.TabIndex = 1;
|
||||
panel6.Text = "panel6";
|
||||
//
|
||||
// splitContainer1
|
||||
//
|
||||
splitContainer1.BackColor = SystemColors.Control;
|
||||
splitContainer1.Dock = DockStyle.Fill;
|
||||
splitContainer1.Location = new Point(0, 0);
|
||||
splitContainer1.Name = "splitContainer1";
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
splitContainer1.Panel1.Controls.Add(splitContainer2);
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
splitContainer1.Panel2.BackColor = SystemColors.ButtonFace;
|
||||
splitContainer1.Panel2.Controls.Add(tabsConfig);
|
||||
splitContainer1.Size = new Size(1024, 500);
|
||||
splitContainer1.SplitterDistance = 606;
|
||||
splitContainer1.SplitterIncrement = 2;
|
||||
splitContainer1.SplitterWidth = 10;
|
||||
splitContainer1.TabIndex = 0;
|
||||
//
|
||||
// splitContainer2
|
||||
//
|
||||
splitContainer2.Dock = DockStyle.Fill;
|
||||
splitContainer2.Location = new Point(0, 0);
|
||||
splitContainer2.Name = "splitContainer2";
|
||||
splitContainer2.Orientation = Orientation.Horizontal;
|
||||
//
|
||||
// splitContainer2.Panel1
|
||||
//
|
||||
splitContainer2.Panel1.Controls.Add(tabImgDisplay);
|
||||
//
|
||||
// splitContainer2.Panel2
|
||||
//
|
||||
splitContainer2.Panel2.Controls.Add(richTextBox1);
|
||||
splitContainer2.Size = new Size(606, 500);
|
||||
splitContainer2.SplitterDistance = 320;
|
||||
splitContainer2.TabIndex = 0;
|
||||
//
|
||||
// tabImgDisplay
|
||||
//
|
||||
tabImgDisplay.Dock = DockStyle.Fill;
|
||||
tabImgDisplay.Location = new Point(0, 0);
|
||||
tabImgDisplay.Name = "tabImgDisplay";
|
||||
tabImgDisplay.Size = new Size(1024, 442);
|
||||
tabImgDisplay.Style = styleCard2;
|
||||
tabImgDisplay.TabIndex = 3;
|
||||
tabImgDisplay.Size = new Size(606, 320);
|
||||
tabImgDisplay.Style = styleCard3;
|
||||
tabImgDisplay.TabIndex = 1;
|
||||
tabImgDisplay.Text = "tabs1";
|
||||
//
|
||||
// splitter1
|
||||
// richTextBox1
|
||||
//
|
||||
splitter1.Dock = DockStyle.Fill;
|
||||
splitter1.Location = new Point(0, 0);
|
||||
splitter1.Name = "splitter1";
|
||||
richTextBox1.Dock = DockStyle.Fill;
|
||||
richTextBox1.Location = new Point(0, 0);
|
||||
richTextBox1.Name = "richTextBox1";
|
||||
richTextBox1.Size = new Size(606, 176);
|
||||
richTextBox1.TabIndex = 0;
|
||||
richTextBox1.Text = "";
|
||||
//
|
||||
// splitter1.Panel1
|
||||
// tabsConfig
|
||||
//
|
||||
splitter1.Panel1.Controls.Add(pnlLog);
|
||||
tabsConfig.Dock = DockStyle.Fill;
|
||||
tabsConfig.Location = new Point(0, 0);
|
||||
tabsConfig.Name = "tabsConfig";
|
||||
tabsConfig.Pages.Add(tabPage2);
|
||||
tabsConfig.Size = new Size(408, 500);
|
||||
tabsConfig.Style = styleCard4;
|
||||
tabsConfig.TabIndex = 2;
|
||||
tabsConfig.Text = "tabs2";
|
||||
//
|
||||
// splitter1.Panel2
|
||||
// tabPage2
|
||||
//
|
||||
splitter1.Panel2.Controls.Add(panel6);
|
||||
splitter1.Size = new Size(1024, 117);
|
||||
splitter1.SplitterDistance = 332;
|
||||
splitter1.TabIndex = 3;
|
||||
//
|
||||
// pnlLog
|
||||
//
|
||||
pnlLog.Dock = DockStyle.Fill;
|
||||
pnlLog.Location = new Point(0, 0);
|
||||
pnlLog.Name = "pnlLog";
|
||||
pnlLog.Size = new Size(332, 117);
|
||||
pnlLog.TabIndex = 2;
|
||||
pnlLog.Text = "panel8";
|
||||
//
|
||||
// panel6
|
||||
//
|
||||
panel6.Controls.Add(tableLayoutstatistics);
|
||||
panel6.Dock = DockStyle.Fill;
|
||||
panel6.Location = new Point(0, 0);
|
||||
panel6.Name = "panel6";
|
||||
panel6.Size = new Size(688, 117);
|
||||
panel6.TabIndex = 0;
|
||||
panel6.Text = "panel6";
|
||||
//
|
||||
// tableLayoutstatistics
|
||||
//
|
||||
tableLayoutstatistics.ColumnCount = 2;
|
||||
tableLayoutstatistics.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
|
||||
tableLayoutstatistics.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
|
||||
tableLayoutstatistics.Controls.Add(dgvCamreaNums, 0, 0);
|
||||
tableLayoutstatistics.Controls.Add(panelNums, 1, 0);
|
||||
tableLayoutstatistics.Dock = DockStyle.Fill;
|
||||
tableLayoutstatistics.Location = new Point(0, 0);
|
||||
tableLayoutstatistics.Name = "tableLayoutstatistics";
|
||||
tableLayoutstatistics.RowCount = 1;
|
||||
tableLayoutstatistics.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
|
||||
tableLayoutstatistics.Size = new Size(688, 117);
|
||||
tableLayoutstatistics.TabIndex = 9;
|
||||
//
|
||||
// dgvCamreaNums
|
||||
//
|
||||
dgvCamreaNums.AllowUserToAddRows = false;
|
||||
dgvCamreaNums.AllowUserToDeleteRows = false;
|
||||
dgvCamreaNums.AllowUserToResizeColumns = false;
|
||||
dgvCamreaNums.AllowUserToResizeRows = false;
|
||||
dgvCamreaNums.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dgvCamreaNums.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;
|
||||
dgvCamreaNums.BackgroundColor = SystemColors.Control;
|
||||
dgvCamreaNums.BorderStyle = BorderStyle.None;
|
||||
dgvCamreaNums.CellBorderStyle = DataGridViewCellBorderStyle.SunkenHorizontal;
|
||||
dgvCamreaNums.ColumnHeadersHeight = 4;
|
||||
dgvCamreaNums.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
|
||||
dgvCamreaNums.ColumnHeadersVisible = false;
|
||||
dgvCamreaNums.Dock = DockStyle.Fill;
|
||||
dgvCamreaNums.Location = new Point(3, 3);
|
||||
dgvCamreaNums.MultiSelect = false;
|
||||
dgvCamreaNums.Name = "dgvCamreaNums";
|
||||
dgvCamreaNums.ReadOnly = true;
|
||||
dgvCamreaNums.RowHeadersVisible = false;
|
||||
dgvCamreaNums.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dgvCamreaNums.Size = new Size(338, 111);
|
||||
dgvCamreaNums.TabIndex = 9;
|
||||
//
|
||||
// panelNums
|
||||
//
|
||||
panelNums.Controls.Add(tableLayoutNums);
|
||||
panelNums.Dock = DockStyle.Fill;
|
||||
panelNums.Location = new Point(347, 3);
|
||||
panelNums.Name = "panelNums";
|
||||
panelNums.Size = new Size(338, 111);
|
||||
panelNums.TabIndex = 8;
|
||||
panelNums.Text = "panel4";
|
||||
//
|
||||
// tableLayoutNums
|
||||
//
|
||||
tableLayoutNums.ColumnCount = 1;
|
||||
tableLayoutNums.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F));
|
||||
tableLayoutNums.Controls.Add(dgvProductNums, 0, 0);
|
||||
tableLayoutNums.Controls.Add(tableLayoutPanel3, 0, 1);
|
||||
tableLayoutNums.Dock = DockStyle.Fill;
|
||||
tableLayoutNums.Location = new Point(0, 0);
|
||||
tableLayoutNums.Name = "tableLayoutNums";
|
||||
tableLayoutNums.RowCount = 2;
|
||||
tableLayoutNums.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
|
||||
tableLayoutNums.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
|
||||
tableLayoutNums.Size = new Size(338, 111);
|
||||
tableLayoutNums.TabIndex = 8;
|
||||
//
|
||||
// dgvProductNums
|
||||
//
|
||||
dgvProductNums.AllowUserToAddRows = false;
|
||||
dgvProductNums.AllowUserToDeleteRows = false;
|
||||
dgvProductNums.AllowUserToResizeColumns = false;
|
||||
dgvProductNums.AllowUserToResizeRows = false;
|
||||
dgvProductNums.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dgvProductNums.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;
|
||||
dgvProductNums.BackgroundColor = SystemColors.Control;
|
||||
dgvProductNums.BorderStyle = BorderStyle.None;
|
||||
dgvProductNums.CellBorderStyle = DataGridViewCellBorderStyle.SunkenHorizontal;
|
||||
dgvProductNums.ColumnHeadersHeight = 4;
|
||||
dgvProductNums.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
|
||||
dgvProductNums.ColumnHeadersVisible = false;
|
||||
dgvProductNums.Dock = DockStyle.Fill;
|
||||
dgvProductNums.Location = new Point(3, 3);
|
||||
dgvProductNums.MultiSelect = false;
|
||||
dgvProductNums.Name = "dgvProductNums";
|
||||
dgvProductNums.ReadOnly = true;
|
||||
dgvProductNums.RowHeadersVisible = false;
|
||||
dgvProductNums.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dgvProductNums.Size = new Size(332, 49);
|
||||
dgvProductNums.TabIndex = 10;
|
||||
//
|
||||
// tableLayoutPanel3
|
||||
//
|
||||
tableLayoutPanel3.ColumnCount = 4;
|
||||
tableLayoutPanel3.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
|
||||
tableLayoutPanel3.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
|
||||
tableLayoutPanel3.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 81F));
|
||||
tableLayoutPanel3.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 75F));
|
||||
tableLayoutPanel3.Controls.Add(lblTotalTime, 1, 1);
|
||||
tableLayoutPanel3.Controls.Add(label1, 2, 1);
|
||||
tableLayoutPanel3.Controls.Add(label12, 0, 1);
|
||||
tableLayoutPanel3.Controls.Add(lblUPH, 3, 1);
|
||||
tableLayoutPanel3.Controls.Add(lblStartTime, 1, 0);
|
||||
tableLayoutPanel3.Controls.Add(lblOEE_Total, 3, 0);
|
||||
tableLayoutPanel3.Controls.Add(label10, 0, 0);
|
||||
tableLayoutPanel3.Controls.Add(label7, 2, 0);
|
||||
tableLayoutPanel3.Dock = DockStyle.Fill;
|
||||
tableLayoutPanel3.Location = new Point(3, 58);
|
||||
tableLayoutPanel3.Name = "tableLayoutPanel3";
|
||||
tableLayoutPanel3.RowCount = 2;
|
||||
tableLayoutPanel3.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
|
||||
tableLayoutPanel3.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
|
||||
tableLayoutPanel3.Size = new Size(332, 50);
|
||||
tableLayoutPanel3.TabIndex = 11;
|
||||
//
|
||||
// lblTotalTime
|
||||
//
|
||||
lblTotalTime.AutoSize = true;
|
||||
lblTotalTime.Dock = DockStyle.Fill;
|
||||
lblTotalTime.Location = new Point(91, 25);
|
||||
lblTotalTime.Name = "lblTotalTime";
|
||||
lblTotalTime.Size = new Size(82, 25);
|
||||
lblTotalTime.TabIndex = 15;
|
||||
lblTotalTime.Text = "0";
|
||||
lblTotalTime.TextAlign = ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Dock = DockStyle.Fill;
|
||||
label1.Location = new Point(179, 25);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(75, 25);
|
||||
label1.TabIndex = 8;
|
||||
label1.Text = "UPH";
|
||||
label1.TextAlign = ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// label12
|
||||
//
|
||||
label12.AutoSize = true;
|
||||
label12.Dock = DockStyle.Fill;
|
||||
label12.Location = new Point(3, 25);
|
||||
label12.Name = "label12";
|
||||
label12.Size = new Size(82, 25);
|
||||
label12.TabIndex = 14;
|
||||
label12.Text = "运行时间";
|
||||
label12.TextAlign = ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// lblUPH
|
||||
//
|
||||
lblUPH.AutoSize = true;
|
||||
lblUPH.Dock = DockStyle.Fill;
|
||||
lblUPH.Location = new Point(260, 25);
|
||||
lblUPH.Name = "lblUPH";
|
||||
lblUPH.Size = new Size(69, 25);
|
||||
lblUPH.TabIndex = 9;
|
||||
lblUPH.Text = "0";
|
||||
lblUPH.TextAlign = ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// lblStartTime
|
||||
//
|
||||
lblStartTime.AutoSize = true;
|
||||
lblStartTime.Dock = DockStyle.Fill;
|
||||
lblStartTime.Location = new Point(91, 0);
|
||||
lblStartTime.Name = "lblStartTime";
|
||||
lblStartTime.Size = new Size(82, 25);
|
||||
lblStartTime.TabIndex = 11;
|
||||
lblStartTime.Text = "0";
|
||||
lblStartTime.TextAlign = ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// lblOEE_Total
|
||||
//
|
||||
lblOEE_Total.AutoSize = true;
|
||||
lblOEE_Total.Dock = DockStyle.Fill;
|
||||
lblOEE_Total.Location = new Point(260, 0);
|
||||
lblOEE_Total.Name = "lblOEE_Total";
|
||||
lblOEE_Total.Size = new Size(69, 25);
|
||||
lblOEE_Total.TabIndex = 13;
|
||||
lblOEE_Total.Text = "0";
|
||||
lblOEE_Total.TextAlign = ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// label10
|
||||
//
|
||||
label10.AutoSize = true;
|
||||
label10.Dock = DockStyle.Fill;
|
||||
label10.Location = new Point(3, 0);
|
||||
label10.Name = "label10";
|
||||
label10.Size = new Size(82, 25);
|
||||
label10.TabIndex = 12;
|
||||
label10.Text = "开始时间";
|
||||
label10.TextAlign = ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// label7
|
||||
//
|
||||
label7.AutoSize = true;
|
||||
label7.Dock = DockStyle.Fill;
|
||||
label7.Location = new Point(179, 0);
|
||||
label7.Name = "label7";
|
||||
label7.Size = new Size(75, 25);
|
||||
label7.TabIndex = 10;
|
||||
label7.Text = "总计数";
|
||||
label7.TextAlign = ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
panel2.Location = new Point(511, 86);
|
||||
panel2.Name = "panel2";
|
||||
panel2.Size = new Size(814, 364);
|
||||
panel2.TabIndex = 3;
|
||||
panel2.Text = "panel2";
|
||||
tabPage2.Location = new Point(3, 28);
|
||||
tabPage2.Name = "tabPage2";
|
||||
tabPage2.Size = new Size(402, 469);
|
||||
tabPage2.TabIndex = 0;
|
||||
tabPage2.Text = "配置";
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
@ -528,6 +342,8 @@
|
||||
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;
|
||||
@ -537,6 +353,8 @@
|
||||
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;
|
||||
@ -546,6 +364,8 @@
|
||||
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;
|
||||
@ -555,6 +375,8 @@
|
||||
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;
|
||||
@ -564,6 +386,8 @@
|
||||
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);
|
||||
@ -579,9 +403,10 @@
|
||||
//
|
||||
// MainWindow
|
||||
//
|
||||
ClientSize = new Size(1024, 671);
|
||||
ClientSize = new Size(1024, 648);
|
||||
ControlBox = false;
|
||||
Controls.Add(panelmain);
|
||||
Controls.Add(pageHeader1);
|
||||
Controls.Add(titlebar);
|
||||
Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
Icon = (Icon)resources.GetObject("$this.Icon");
|
||||
@ -592,25 +417,21 @@
|
||||
FormClosing += MainWindow_FormClosing;
|
||||
Load += MainWindow_Load;
|
||||
titlebar.ResumeLayout(false);
|
||||
tabsStas.ResumeLayout(false);
|
||||
tabPage3.ResumeLayout(false);
|
||||
pageHeader1.ResumeLayout(false);
|
||||
pageHeader1.PerformLayout();
|
||||
panelmain.ResumeLayout(false);
|
||||
splitter2.Panel1.ResumeLayout(false);
|
||||
splitter2.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)splitter2).EndInit();
|
||||
splitter2.ResumeLayout(false);
|
||||
splitter1.Panel1.ResumeLayout(false);
|
||||
splitter1.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)splitter1).EndInit();
|
||||
splitter1.ResumeLayout(false);
|
||||
panel2.ResumeLayout(false);
|
||||
panel4.ResumeLayout(false);
|
||||
panel6.ResumeLayout(false);
|
||||
tableLayoutstatistics.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dgvCamreaNums).EndInit();
|
||||
panelNums.ResumeLayout(false);
|
||||
tableLayoutNums.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dgvProductNums).EndInit();
|
||||
tableLayoutPanel3.ResumeLayout(false);
|
||||
tableLayoutPanel3.PerformLayout();
|
||||
splitContainer1.Panel1.ResumeLayout(false);
|
||||
splitContainer1.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)splitContainer1).EndInit();
|
||||
splitContainer1.ResumeLayout(false);
|
||||
splitContainer2.Panel1.ResumeLayout(false);
|
||||
splitContainer2.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)splitContainer2).EndInit();
|
||||
splitContainer2.ResumeLayout(false);
|
||||
tabsConfig.ResumeLayout(false);
|
||||
panel1.ResumeLayout(false);
|
||||
panel3.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
@ -619,48 +440,27 @@
|
||||
#endregion
|
||||
|
||||
private AntdUI.PageHeader titlebar;
|
||||
private AntdUI.PageHeader pageHeader1;
|
||||
private AntdUI.Divider divider2;
|
||||
private AntdUI.Panel panelmain;
|
||||
private AntdUI.Panel panel1;
|
||||
private AntdUI.Segmented segmented1;
|
||||
private AntdUI.Panel panel2;
|
||||
private AntdUI.Panel panel4;
|
||||
private AntdUI.Panel panel6;
|
||||
private Label labuph;
|
||||
private AntdUI.Splitter splitter1;
|
||||
|
||||
private SplitContainer splitContainer1;
|
||||
private SplitContainer splitContainer2;
|
||||
private AntdUI.Tabs tabImgDisplay;
|
||||
private AntdUI.Tabs tabsConfig;
|
||||
private AntdUI.TabPage tabPage2;
|
||||
private AntdUI.Label lbName;
|
||||
private AntdUI.Panel panel3;
|
||||
private AntdUI.Button btnDeleteProject;
|
||||
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 AntdUI.TabPage tabPage3;
|
||||
private AntdUI.TabPage tabMain;
|
||||
private AntdUI.Tabs tabsStas;
|
||||
private AntdUI.Panel panel2;
|
||||
private AntdUI.Tabs tabImgDisplay;
|
||||
private AntdUI.Panel panel6;
|
||||
private AntdUI.Panel pnlLog;
|
||||
private AntdUI.Splitter splitter2;
|
||||
private TableLayoutPanel tableLayoutstatistics;
|
||||
private AntdUI.Panel panelNums;
|
||||
private DataGridView dgvCamreaNums;
|
||||
private TableLayoutPanel tableLayoutNums;
|
||||
private Label label1;
|
||||
private Label lblTotalTime;
|
||||
private Label lblUPH;
|
||||
private Label label12;
|
||||
private Label label7;
|
||||
private Label lblOEE_Total;
|
||||
private Label lblStartTime;
|
||||
private Label label10;
|
||||
private DataGridView dgvProductNums;
|
||||
private TableLayoutPanel tableLayoutPanel3;
|
||||
private RichTextBox richTextBox1;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -117,6 +117,36 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="segmentedItem6.IconActiveSvg" xml:space="preserve">
|
||||
<value><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><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"/><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"/></svg></value>
|
||||
</data>
|
||||
<data name="segmentedItem6.IconSvg" xml:space="preserve">
|
||||
<value><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><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"/><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"/></svg></value>
|
||||
</data>
|
||||
<data name="segmentedItem7.IconActiveSvg" xml:space="preserve">
|
||||
<value><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><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"/></svg></value>
|
||||
</data>
|
||||
<data name="segmentedItem7.IconSvg" xml:space="preserve">
|
||||
<value><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><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"/></svg></value>
|
||||
</data>
|
||||
<data name="segmentedItem8.IconActiveSvg" xml:space="preserve">
|
||||
<value><svg viewBox="0 0 1027 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><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"/><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"/></svg></value>
|
||||
</data>
|
||||
<data name="segmentedItem8.IconSvg" xml:space="preserve">
|
||||
<value><svg viewBox="0 0 1027 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><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"/><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"/></svg></value>
|
||||
</data>
|
||||
<data name="segmentedItem9.IconActiveSvg" xml:space="preserve">
|
||||
<value><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><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"/><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"/></svg></value>
|
||||
</data>
|
||||
<data name="segmentedItem9.IconSvg" xml:space="preserve">
|
||||
<value><svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><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"/><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"/></svg></value>
|
||||
</data>
|
||||
<data name="segmentedItem10.IconActiveSvg" xml:space="preserve">
|
||||
<value><svg viewBox="0 0 1027 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><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"/><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"/><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"/></svg></value>
|
||||
</data>
|
||||
<data name="segmentedItem10.IconSvg" xml:space="preserve">
|
||||
<value><svg viewBox="0 0 1027 1024" xmlns="http://www.w3.org/2000/svg" width="200" height="200"><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"/><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"/><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"/></svg></value>
|
||||
</data>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
|
@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using AntdUI;
|
||||
using DH.Commons.Enums;
|
||||
using DH.Commons.Helper;
|
||||
using DH.Commons.Models;
|
||||
using DHSoftware.Utils;
|
||||
@ -38,56 +36,15 @@ namespace DHSoftware
|
||||
WelcomeWindow.Instance.Show();
|
||||
UpdateStep(0, "正在初始化", true);
|
||||
UpdateStep(10, "正在加载数据库", true);
|
||||
try
|
||||
{
|
||||
DatabaseUtil.InitializeDatabase();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SystemModel.CurrentStatus = EnumStatus.异常;
|
||||
Modal.open(WelcomeWindow.Instance, "错误!", ex.ToString(), TType.Error);
|
||||
}
|
||||
|
||||
DatabaseUtil.InitializeDatabase();
|
||||
UpdateStep(30, "正在加载解决方案", true);
|
||||
try
|
||||
{
|
||||
MainWindow.Instance.LoadScheme();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SystemModel.CurrentStatus = EnumStatus.异常;
|
||||
Modal.open(WelcomeWindow.Instance, "错误!", ex.ToString(), TType.Error);
|
||||
}
|
||||
MainWindow.Instance.LoadScheme();
|
||||
UpdateStep(50, "正在连接相机", true);
|
||||
try
|
||||
{
|
||||
MainWindow.Instance.ConnectCamera();
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
SystemModel.CurrentStatus = EnumStatus.异常;
|
||||
Modal.open(WelcomeWindow.Instance, "错误!", ex.ToString(), TType.Error);
|
||||
}
|
||||
MainWindow.Instance.ConnectCamera();
|
||||
UpdateStep(70, "正在连接PLC", true);
|
||||
try
|
||||
{
|
||||
MainWindow.Instance.ConnectPLC();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SystemModel.CurrentStatus = EnumStatus.异常;
|
||||
Modal.open(WelcomeWindow.Instance, "错误!", ex.ToString(), TType.Error);
|
||||
}
|
||||
MainWindow.Instance.ConnectPLC();
|
||||
UpdateStep(80, "正在加载算法模型", true);
|
||||
try
|
||||
{
|
||||
MainWindow.Instance.InitModel();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SystemModel.CurrentStatus = EnumStatus.异常;
|
||||
Modal.open(WelcomeWindow.Instance, "错误!", ex.ToString(), TType.Error);
|
||||
}
|
||||
MainWindow.Instance.InitModel();
|
||||
UpdateStep(100, "程序初始化完成", true);
|
||||
Thread.Sleep(100);
|
||||
WelcomeWindow.Instance.Close();
|
||||
|
162
DHSoftware/Views/AddGlobalControl.Designer.cs
generated
162
DHSoftware/Views/AddGlobalControl.Designer.cs
generated
@ -1,162 +0,0 @@
|
||||
namespace DHSoftware.Views
|
||||
{
|
||||
partial class AddGlobalControl
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要修改
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
panel1 = new AntdUI.Panel();
|
||||
input_name = new AntdUI.Input();
|
||||
label3 = new AntdUI.Label();
|
||||
divider1 = new AntdUI.Divider();
|
||||
stackPanel1 = new AntdUI.StackPanel();
|
||||
button_cancel = new AntdUI.Button();
|
||||
button_ok = new AntdUI.Button();
|
||||
divider2 = new AntdUI.Divider();
|
||||
lbTitleName = new AntdUI.Label();
|
||||
panel1.SuspendLayout();
|
||||
stackPanel1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(input_name);
|
||||
panel1.Controls.Add(label3);
|
||||
panel1.Controls.Add(divider1);
|
||||
panel1.Controls.Add(stackPanel1);
|
||||
panel1.Controls.Add(divider2);
|
||||
panel1.Controls.Add(lbTitleName);
|
||||
panel1.Dock = DockStyle.Fill;
|
||||
panel1.Location = new Point(0, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Padding = new Padding(12);
|
||||
panel1.Shadow = 6;
|
||||
panel1.Size = new Size(500, 192);
|
||||
panel1.TabIndex = 0;
|
||||
panel1.Text = "panel1";
|
||||
//
|
||||
// input_name
|
||||
//
|
||||
input_name.Dock = DockStyle.Top;
|
||||
input_name.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
input_name.Location = new Point(18, 134);
|
||||
input_name.Name = "input_name";
|
||||
input_name.Radius = 3;
|
||||
input_name.Size = new Size(464, 38);
|
||||
input_name.TabIndex = 22;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.Dock = DockStyle.Top;
|
||||
label3.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
label3.Location = new Point(18, 110);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(464, 24);
|
||||
label3.TabIndex = 21;
|
||||
label3.Text = "全局配置名称";
|
||||
//
|
||||
// divider1
|
||||
//
|
||||
divider1.Dock = DockStyle.Top;
|
||||
divider1.Location = new Point(18, 98);
|
||||
divider1.Name = "divider1";
|
||||
divider1.Size = new Size(464, 12);
|
||||
divider1.TabIndex = 20;
|
||||
//
|
||||
// stackPanel1
|
||||
//
|
||||
stackPanel1.Controls.Add(button_cancel);
|
||||
stackPanel1.Controls.Add(button_ok);
|
||||
stackPanel1.Dock = DockStyle.Top;
|
||||
stackPanel1.Location = new Point(18, 54);
|
||||
stackPanel1.Name = "stackPanel1";
|
||||
stackPanel1.RightToLeft = RightToLeft.No;
|
||||
stackPanel1.Size = new Size(464, 44);
|
||||
stackPanel1.TabIndex = 19;
|
||||
stackPanel1.Text = "stackPanel1";
|
||||
//
|
||||
// button_cancel
|
||||
//
|
||||
button_cancel.BorderWidth = 1F;
|
||||
button_cancel.Font = new Font("Microsoft YaHei UI", 9F);
|
||||
button_cancel.Ghost = true;
|
||||
button_cancel.Location = new Point(84, 3);
|
||||
button_cancel.Name = "button_cancel";
|
||||
button_cancel.Size = new Size(75, 38);
|
||||
button_cancel.TabIndex = 1;
|
||||
button_cancel.Text = "取消";
|
||||
//
|
||||
// button_ok
|
||||
//
|
||||
button_ok.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
button_ok.Location = new Point(3, 3);
|
||||
button_ok.Name = "button_ok";
|
||||
button_ok.Size = new Size(75, 38);
|
||||
button_ok.TabIndex = 0;
|
||||
button_ok.Text = "确定";
|
||||
button_ok.Type = AntdUI.TTypeMini.Primary;
|
||||
//
|
||||
// divider2
|
||||
//
|
||||
divider2.Dock = DockStyle.Top;
|
||||
divider2.Location = new Point(18, 42);
|
||||
divider2.Name = "divider2";
|
||||
divider2.Size = new Size(464, 12);
|
||||
divider2.TabIndex = 18;
|
||||
//
|
||||
// lbTitleName
|
||||
//
|
||||
lbTitleName.Dock = DockStyle.Top;
|
||||
lbTitleName.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
lbTitleName.Location = new Point(18, 18);
|
||||
lbTitleName.Name = "lbTitleName";
|
||||
lbTitleName.Size = new Size(464, 24);
|
||||
lbTitleName.TabIndex = 17;
|
||||
lbTitleName.Text = "新增全局配置操作";
|
||||
//
|
||||
// AddGlobalControl
|
||||
//
|
||||
Controls.Add(panel1);
|
||||
Name = "AddGlobalControl";
|
||||
Size = new Size(500, 192);
|
||||
panel1.ResumeLayout(false);
|
||||
stackPanel1.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private AntdUI.Panel panel1;
|
||||
private AntdUI.Label lbTitleName;
|
||||
private AntdUI.Input input_name;
|
||||
private AntdUI.Label label3;
|
||||
private AntdUI.Divider divider1;
|
||||
private AntdUI.StackPanel stackPanel1;
|
||||
private AntdUI.Button button_cancel;
|
||||
private AntdUI.Button button_ok;
|
||||
private AntdUI.Divider divider2;
|
||||
}
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
|
||||
|
||||
namespace DHSoftware.Views
|
||||
{
|
||||
public partial class AddGlobalControl : UserControl
|
||||
{
|
||||
private AntdUI.Window window;
|
||||
public bool submit;
|
||||
public string GlobalName;
|
||||
public AddGlobalControl(AntdUI.Window _window,string TitleName)
|
||||
{
|
||||
this.window = _window;
|
||||
InitializeComponent();
|
||||
lbTitleName.Text = TitleName;
|
||||
// 绑定事件
|
||||
BindEventHandler();
|
||||
}
|
||||
|
||||
private void BindEventHandler()
|
||||
{
|
||||
button_ok.Click += Button_ok_Click;
|
||||
button_cancel.Click += Button_cancel_Click;
|
||||
}
|
||||
|
||||
private void Button_cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
submit = false;
|
||||
this.Dispose();
|
||||
}
|
||||
|
||||
private void Button_ok_Click(object sender, EventArgs e)
|
||||
{
|
||||
input_name.Status = AntdUI.TType.None;
|
||||
//检查输入内容
|
||||
if (String.IsNullOrEmpty(input_name.Text))
|
||||
{
|
||||
input_name.Status = AntdUI.TType.Error;
|
||||
AntdUI.Message.warn(window, "全局配置名称名称不能为空!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
GlobalName = input_name.Text;
|
||||
submit = true;
|
||||
this.Dispose();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -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>
|
148
DHSoftware/Views/FrmLog.Designer.cs
generated
148
DHSoftware/Views/FrmLog.Designer.cs
generated
@ -1,148 +0,0 @@
|
||||
namespace DHSoftware.Views
|
||||
{
|
||||
partial class FrmLog
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.tsmiClearLog = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.tsmiLogLevels = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsmiLogSources = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsmiClearLog2 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.lvLog = new System.Windows.Forms.ListView();
|
||||
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.contextMenuStrip1.SuspendLayout();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// contextMenuStrip1
|
||||
//
|
||||
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.tsmiClearLog});
|
||||
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||
this.contextMenuStrip1.Size = new System.Drawing.Size(125, 26);
|
||||
//
|
||||
// tsmiClearLog
|
||||
//
|
||||
this.tsmiClearLog.Name = "tsmiClearLog";
|
||||
this.tsmiClearLog.Size = new System.Drawing.Size(124, 22);
|
||||
this.tsmiClearLog.Text = "清空日志";
|
||||
this.tsmiClearLog.Click += new System.EventHandler(this.tsmiClearLog_Click);
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
this.menuStrip1.BackColor = System.Drawing.Color.Transparent;
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.tsmiLogLevels,
|
||||
this.tsmiLogSources,
|
||||
this.tsmiClearLog2});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Size = new System.Drawing.Size(800, 25);
|
||||
this.menuStrip1.TabIndex = 3;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// tsmiLogLevels
|
||||
//
|
||||
this.tsmiLogLevels.Name = "tsmiLogLevels";
|
||||
this.tsmiLogLevels.Size = new System.Drawing.Size(68, 21);
|
||||
this.tsmiLogLevels.Text = "日志级别";
|
||||
//
|
||||
// tsmiLogSources
|
||||
//
|
||||
this.tsmiLogSources.Name = "tsmiLogSources";
|
||||
this.tsmiLogSources.Size = new System.Drawing.Size(68, 21);
|
||||
this.tsmiLogSources.Text = "日志来源";
|
||||
//
|
||||
// tsmiClearLog2
|
||||
//
|
||||
this.tsmiClearLog2.Name = "tsmiClearLog2";
|
||||
this.tsmiClearLog2.Size = new System.Drawing.Size(68, 21);
|
||||
this.tsmiClearLog2.Text = "清空日志";
|
||||
this.tsmiClearLog2.Click += new System.EventHandler(this.tsmiClearLog2_Click);
|
||||
//
|
||||
// lvLog
|
||||
//
|
||||
this.lvLog.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.lvLog.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.lvLog.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.columnHeader1,
|
||||
this.columnHeader2,
|
||||
this.columnHeader3});
|
||||
this.lvLog.ContextMenuStrip = this.contextMenuStrip1;
|
||||
this.lvLog.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lvLog.FullRowSelect = true;
|
||||
this.lvLog.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
|
||||
this.lvLog.HideSelection = false;
|
||||
this.lvLog.Location = new System.Drawing.Point(0, 25);
|
||||
this.lvLog.MultiSelect = false;
|
||||
this.lvLog.Name = "lvLog";
|
||||
this.lvLog.Size = new System.Drawing.Size(800, 463);
|
||||
this.lvLog.TabIndex = 5;
|
||||
this.lvLog.UseCompatibleStateImageBehavior = false;
|
||||
this.lvLog.View = System.Windows.Forms.View.Details;
|
||||
this.lvLog.SizeChanged += new System.EventHandler(this.lvLog_SizeChanged);
|
||||
//
|
||||
// columnHeader1
|
||||
//
|
||||
this.columnHeader1.Width = 80;
|
||||
//
|
||||
// FrmLog
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
|
||||
this.ClientSize = new System.Drawing.Size(800, 488);
|
||||
this.Controls.Add(this.lvLog);
|
||||
this.Controls.Add(this.menuStrip1);
|
||||
//this.MainMenuStrip = this.menuStrip1;
|
||||
this.Name = "FrmLog";
|
||||
this.Text = "日志";
|
||||
this.contextMenuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem tsmiClearLog;
|
||||
private System.Windows.Forms.MenuStrip menuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem tsmiLogLevels;
|
||||
private System.Windows.Forms.ToolStripMenuItem tsmiLogSources;
|
||||
private System.Windows.Forms.ListView lvLog;
|
||||
private System.Windows.Forms.ColumnHeader columnHeader1;
|
||||
private System.Windows.Forms.ColumnHeader columnHeader2;
|
||||
private System.Windows.Forms.ColumnHeader columnHeader3;
|
||||
private System.Windows.Forms.ToolStripMenuItem tsmiClearLog2;
|
||||
//private System.Windows.Forms.ToolStripMenuItem testToolStripMenuItem;
|
||||
}
|
||||
}
|
@ -1,236 +0,0 @@
|
||||
|
||||
using XKRS.UI.Model.Winform;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using static DH.Commons.Enums.EnumHelper;
|
||||
using DH.Commons.Enums;
|
||||
|
||||
|
||||
namespace DHSoftware.Views
|
||||
{
|
||||
|
||||
public partial class FrmLog : UserControl
|
||||
{
|
||||
public FrmLog()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
lvLog.ShowItemToolTips = true;
|
||||
|
||||
this.Load += (s, e) =>
|
||||
{
|
||||
_showLevels.Clear();
|
||||
tsmiLogLevels.DropDownItems.Clear();
|
||||
JsonConvert.DeserializeObject<List<dynamic>>(JsonConvert.SerializeObject(EnumHelper.GetEnumListByType(typeof(LogLevel)))).ForEach(d =>
|
||||
{
|
||||
LogLevel lvl = (LogLevel)((int)d.Value);
|
||||
ToolStripMenuItem item = new ToolStripMenuItem(d.Desc.ToString());
|
||||
item.CheckOnClick = true;
|
||||
item.Checked = true;
|
||||
item.Tag = lvl;
|
||||
item.CheckedChanged += LevelItem_CheckedChanged;
|
||||
|
||||
item.BackColor = lvl.GetEnumSelectedColor();
|
||||
item.ForeColor = lvl.GetEnumSelectedFontColor();
|
||||
tsmiLogLevels.DropDownItems.Add(item);
|
||||
_showLevels.Add(lvl);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
//public override void OnProcessUpdated()
|
||||
//{
|
||||
|
||||
|
||||
// Invoke(new Action(() =>
|
||||
// {
|
||||
// _showDevice.Clear();
|
||||
// tsmiLogSources.DropDownItems.Clear();
|
||||
// ToolStripMenuItem processItem = new ToolStripMenuItem(SOURCE_PROCESS);
|
||||
// processItem.CheckOnClick = true;
|
||||
// processItem.Checked = true;
|
||||
// processItem.CheckedChanged += SourceItem_CheckedChanged;
|
||||
// tsmiLogSources.DropDownItems.Add(processItem);
|
||||
// _showDevice.Add(SOURCE_PROCESS);
|
||||
|
||||
// Process.DeviceCollection.ForEach(d =>
|
||||
// {
|
||||
// ToolStripMenuItem item = new ToolStripMenuItem(d.Name);
|
||||
// item.CheckOnClick = true;
|
||||
// item.Checked = true;
|
||||
// item.CheckedChanged += SourceItem_CheckedChanged;
|
||||
// tsmiLogSources.DropDownItems.Add(item);
|
||||
// _showDevice.Add(d.Name);
|
||||
// });
|
||||
// }));
|
||||
//}
|
||||
|
||||
private void LevelItem_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
_showLevels.Clear();
|
||||
foreach (ToolStripMenuItem item in tsmiLogLevels.DropDownItems)
|
||||
{
|
||||
if (item.Checked)
|
||||
{
|
||||
LogLevel lv = (LogLevel)Convert.ToInt32(item.Tag);
|
||||
_showLevels.Add(lv);
|
||||
}
|
||||
}
|
||||
|
||||
RefreshLogs();
|
||||
}
|
||||
|
||||
private void SourceItem_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
_showDevice.Clear();
|
||||
foreach (ToolStripMenuItem item in tsmiLogSources.DropDownItems)
|
||||
{
|
||||
if (item.Checked)
|
||||
{
|
||||
_showDevice.Add(item.Text);
|
||||
}
|
||||
}
|
||||
RefreshLogs();
|
||||
}
|
||||
//public TaskFactory _taskFactory = new TaskFactory(TaskCreationOptions.LongRunning, TaskContinuationOptions.LongRunning);
|
||||
readonly ConcurrentQueue<LogMsg> _logQueue = new ConcurrentQueue<LogMsg>();
|
||||
Task _logTask = null;
|
||||
static readonly object _logLock = new object();
|
||||
|
||||
List<LogMsg> _logBuffer = new List<LogMsg>();
|
||||
List<LogLevel> _showLevels = new List<LogLevel>();
|
||||
List<string> _showDevice = new List<string>();
|
||||
const string SOURCE_PROCESS = "流程";
|
||||
const int LOG_NUM_LIMIT = 20;
|
||||
|
||||
public void LogDisplay(LogMsg msg)
|
||||
{
|
||||
_logQueue.Enqueue(msg);
|
||||
|
||||
lock (_logLock)
|
||||
{
|
||||
if (_logTask == null)
|
||||
{
|
||||
_logTask = Task.Run(async () =>
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
try
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
bool isNeedScroll = false;
|
||||
while (_logQueue.TryDequeue(out LogMsg log))
|
||||
{
|
||||
_logBuffer.Add(log);
|
||||
|
||||
if (_showLevels.Contains(log.LogLevel) && (_showDevice.Count == 0 || (string.IsNullOrWhiteSpace(log.MsgSource) && _showDevice.Contains(SOURCE_PROCESS)) || _showDevice.Contains(log.MsgSource)))
|
||||
{
|
||||
isNeedScroll = true;
|
||||
|
||||
ListViewItem item = new ListViewItem($"{log.LogTime.ToString("HH:mm:ss.fff")}");
|
||||
item.SubItems.Add($"{log.MsgSource}[{log.ThreadId}]");
|
||||
item.SubItems.Add(log.Msg);
|
||||
|
||||
item.ToolTipText = log.Msg;
|
||||
item.ForeColor = log.LogLevel.GetEnumSelectedFontColor();
|
||||
item.BackColor = log.LogLevel.GetEnumSelectedColor();
|
||||
|
||||
lvLog.Items.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
if (_logBuffer.Count > LOG_NUM_LIMIT * 2)
|
||||
{
|
||||
_logBuffer = _logBuffer.Skip(_logBuffer.Count - LOG_NUM_LIMIT).ToList();
|
||||
RefreshLogs();
|
||||
isNeedScroll = true;
|
||||
}
|
||||
|
||||
if (isNeedScroll && lvLog.Items.Count > 0)
|
||||
{
|
||||
RefreshLvLayout();
|
||||
}
|
||||
}));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
|
||||
await Task.Delay(2000);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshLogs()
|
||||
{
|
||||
lvLog.Items.Clear();
|
||||
|
||||
_logBuffer.ForEach(log =>
|
||||
{
|
||||
if (_showLevels.Contains(log.LogLevel) && ((string.IsNullOrWhiteSpace(log.MsgSource) && _showDevice.Contains(SOURCE_PROCESS)) || _showDevice.Contains(log.MsgSource)))
|
||||
{
|
||||
ListViewItem item = new ListViewItem($"{log.LogTime.ToString("HH:mm:ss.fff")}");
|
||||
item.SubItems.Add($"{log.MsgSource}[{log.ThreadId}]");
|
||||
item.SubItems.Add(log.Msg);
|
||||
|
||||
item.ToolTipText = log.Msg;
|
||||
item.ForeColor = log.LogLevel.GetEnumSelectedFontColor();
|
||||
item.BackColor = log.LogLevel.GetEnumSelectedColor();
|
||||
|
||||
lvLog.Items.Add(item);
|
||||
}
|
||||
});
|
||||
|
||||
RefreshLvLayout();
|
||||
}
|
||||
|
||||
private void lvLog_SizeChanged(object sender, EventArgs e)
|
||||
{
|
||||
RefreshLvLayout();
|
||||
}
|
||||
|
||||
int width_1stCol = 80;
|
||||
|
||||
public event Action<LogMsg> OnLogMsgOutput;
|
||||
|
||||
private void RefreshLvLayout()
|
||||
{
|
||||
if (lvLog.Columns.Count <= 0)
|
||||
return;
|
||||
|
||||
lvLog.Columns[0].Width = width_1stCol;
|
||||
if (lvLog.Width <= lvLog.Height)
|
||||
{
|
||||
lvLog.Columns[1].Width = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
lvLog.Columns[1].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
|
||||
}
|
||||
lvLog.Columns[2].Width = lvLog.Width - width_1stCol - lvLog.Columns[1].Width - 10;
|
||||
|
||||
if (lvLog.Items.Count > 0)
|
||||
lvLog.EnsureVisible(lvLog.Items.Count - 1);
|
||||
}
|
||||
|
||||
private void tsmiClearLog_Click(object sender, EventArgs e)
|
||||
{
|
||||
lvLog.Items.Clear();
|
||||
}
|
||||
|
||||
private void tsmiClearLog2_Click(object sender, EventArgs e)
|
||||
{
|
||||
lvLog.Items.Clear();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,126 +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>
|
||||
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>182, 17</value>
|
||||
</metadata>
|
||||
</root>
|
425
DHSoftware/Views/GlobalControl.Designer.cs
generated
425
DHSoftware/Views/GlobalControl.Designer.cs
generated
@ -1,425 +0,0 @@
|
||||
namespace DHSoftware.Views
|
||||
{
|
||||
partial class GlobalControl
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要修改
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AntdUI.Tabs.StyleLine styleLine1 = new AntdUI.Tabs.StyleLine();
|
||||
tabs1 = new AntdUI.Tabs();
|
||||
tabPage6 = new AntdUI.TabPage();
|
||||
tabPage1 = new AntdUI.TabPage();
|
||||
TableInitProcess = new AntdUI.Table();
|
||||
panel1 = new AntdUI.Panel();
|
||||
btnAdd = new AntdUI.Button();
|
||||
btnDelete = new AntdUI.Button();
|
||||
tabPage2 = new AntdUI.TabPage();
|
||||
TableSartProcess = new AntdUI.Table();
|
||||
panel2 = new AntdUI.Panel();
|
||||
btnSartProcessDelete = new AntdUI.Button();
|
||||
btnSartProcessAdd = new AntdUI.Button();
|
||||
tabPage3 = new AntdUI.TabPage();
|
||||
TableStopProcess = new AntdUI.Table();
|
||||
panel3 = new AntdUI.Panel();
|
||||
btnStopProcessDelete = new AntdUI.Button();
|
||||
btnStopProcessAdd = new AntdUI.Button();
|
||||
tabPage4 = new AntdUI.TabPage();
|
||||
TableStartReset = new AntdUI.Table();
|
||||
panel4 = new AntdUI.Panel();
|
||||
btnStartResetDelete = new AntdUI.Button();
|
||||
btnStartResetAdd = new AntdUI.Button();
|
||||
tabPage5 = new AntdUI.TabPage();
|
||||
TableStopReset = new AntdUI.Table();
|
||||
panel5 = new AntdUI.Panel();
|
||||
btnStopResetDelete = new AntdUI.Button();
|
||||
btnStopResetAdd = new AntdUI.Button();
|
||||
tabs1.SuspendLayout();
|
||||
tabPage1.SuspendLayout();
|
||||
panel1.SuspendLayout();
|
||||
tabPage2.SuspendLayout();
|
||||
panel2.SuspendLayout();
|
||||
tabPage3.SuspendLayout();
|
||||
panel3.SuspendLayout();
|
||||
tabPage4.SuspendLayout();
|
||||
panel4.SuspendLayout();
|
||||
tabPage5.SuspendLayout();
|
||||
panel5.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// tabs1
|
||||
//
|
||||
tabs1.Dock = DockStyle.Fill;
|
||||
tabs1.Location = new Point(0, 0);
|
||||
tabs1.Name = "tabs1";
|
||||
tabs1.Pages.Add(tabPage6);
|
||||
tabs1.Pages.Add(tabPage1);
|
||||
tabs1.Pages.Add(tabPage2);
|
||||
tabs1.Pages.Add(tabPage3);
|
||||
tabs1.Pages.Add(tabPage4);
|
||||
tabs1.Pages.Add(tabPage5);
|
||||
tabs1.Size = new Size(898, 530);
|
||||
tabs1.Style = styleLine1;
|
||||
tabs1.TabIndex = 26;
|
||||
tabs1.Text = "tabs1";
|
||||
tabs1.SelectedIndex = 1;
|
||||
//
|
||||
// tabPage6
|
||||
//
|
||||
tabPage6.Location = new Point(3, 28);
|
||||
tabPage6.Name = "tabPage6";
|
||||
tabPage6.Size = new Size(892, 499);
|
||||
tabPage6.TabIndex = 5;
|
||||
tabPage6.Text = "全局配置";
|
||||
//
|
||||
// tabPage1
|
||||
//
|
||||
tabPage1.Controls.Add(TableInitProcess);
|
||||
tabPage1.Controls.Add(panel1);
|
||||
tabPage1.Location = new Point(-892, -499);
|
||||
tabPage1.Name = "tabPage1";
|
||||
tabPage1.Size = new Size(892, 499);
|
||||
tabPage1.TabIndex = 0;
|
||||
tabPage1.Text = "流程加载操作";
|
||||
//
|
||||
// TableInitProcess
|
||||
//
|
||||
TableInitProcess.Dock = DockStyle.Fill;
|
||||
TableInitProcess.EmptyHeader = true;
|
||||
TableInitProcess.Location = new Point(0, 45);
|
||||
TableInitProcess.Name = "TableInitProcess";
|
||||
TableInitProcess.Padding = new Padding(5);
|
||||
TableInitProcess.Size = new Size(892, 454);
|
||||
TableInitProcess.TabIndex = 36;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Back = Color.Transparent;
|
||||
panel1.BackColor = SystemColors.Window;
|
||||
panel1.Controls.Add(btnAdd);
|
||||
panel1.Controls.Add(btnDelete);
|
||||
panel1.Dock = DockStyle.Top;
|
||||
panel1.Location = new Point(0, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(892, 45);
|
||||
panel1.TabIndex = 35;
|
||||
//
|
||||
// btnAdd
|
||||
//
|
||||
btnAdd.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
btnAdd.Location = new Point(13, 10);
|
||||
btnAdd.Name = "btnAdd";
|
||||
btnAdd.Size = new Size(82, 32);
|
||||
btnAdd.TabIndex = 35;
|
||||
btnAdd.Text = "新增";
|
||||
btnAdd.Type = AntdUI.TTypeMini.Primary;
|
||||
btnAdd.WaveSize = 0;
|
||||
//
|
||||
// btnDelete
|
||||
//
|
||||
btnDelete.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
btnDelete.Location = new Point(110, 10);
|
||||
btnDelete.Name = "btnDelete";
|
||||
btnDelete.Size = new Size(74, 32);
|
||||
btnDelete.TabIndex = 36;
|
||||
btnDelete.Text = "删除";
|
||||
btnDelete.Type = AntdUI.TTypeMini.Error;
|
||||
btnDelete.WaveSize = 0;
|
||||
//
|
||||
// tabPage2
|
||||
//
|
||||
tabPage2.Controls.Add(TableSartProcess);
|
||||
tabPage2.Controls.Add(panel2);
|
||||
tabPage2.Location = new Point(-669, -499);
|
||||
tabPage2.Name = "tabPage2";
|
||||
tabPage2.Size = new Size(669, 499);
|
||||
tabPage2.TabIndex = 1;
|
||||
tabPage2.Text = "流程启动操作";
|
||||
//
|
||||
// TableSartProcess
|
||||
//
|
||||
TableSartProcess.Dock = DockStyle.Fill;
|
||||
TableSartProcess.EmptyHeader = true;
|
||||
TableSartProcess.Location = new Point(0, 45);
|
||||
TableSartProcess.Name = "TableSartProcess";
|
||||
TableSartProcess.Padding = new Padding(5);
|
||||
TableSartProcess.Size = new Size(669, 454);
|
||||
TableSartProcess.TabIndex = 38;
|
||||
TableSartProcess.Text = "table1";
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
panel2.Back = Color.Transparent;
|
||||
panel2.BackColor = SystemColors.Window;
|
||||
panel2.Controls.Add(btnSartProcessDelete);
|
||||
panel2.Controls.Add(btnSartProcessAdd);
|
||||
panel2.Dock = DockStyle.Top;
|
||||
panel2.Location = new Point(0, 0);
|
||||
panel2.Name = "panel2";
|
||||
panel2.Size = new Size(669, 45);
|
||||
panel2.TabIndex = 37;
|
||||
panel2.Text = "panel2";
|
||||
//
|
||||
// btnSartProcessDelete
|
||||
//
|
||||
btnSartProcessDelete.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
btnSartProcessDelete.Location = new Point(110, 10);
|
||||
btnSartProcessDelete.Name = "btnSartProcessDelete";
|
||||
btnSartProcessDelete.Size = new Size(74, 32);
|
||||
btnSartProcessDelete.TabIndex = 36;
|
||||
btnSartProcessDelete.Text = "删除";
|
||||
btnSartProcessDelete.Type = AntdUI.TTypeMini.Error;
|
||||
btnSartProcessDelete.WaveSize = 0;
|
||||
//
|
||||
// btnSartProcessAdd
|
||||
//
|
||||
btnSartProcessAdd.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
btnSartProcessAdd.Location = new Point(13, 10);
|
||||
btnSartProcessAdd.Name = "btnSartProcessAdd";
|
||||
btnSartProcessAdd.Size = new Size(82, 32);
|
||||
btnSartProcessAdd.TabIndex = 35;
|
||||
btnSartProcessAdd.Text = "新增";
|
||||
btnSartProcessAdd.Type = AntdUI.TTypeMini.Primary;
|
||||
btnSartProcessAdd.WaveSize = 0;
|
||||
//
|
||||
// tabPage3
|
||||
//
|
||||
tabPage3.Controls.Add(TableStopProcess);
|
||||
tabPage3.Controls.Add(panel3);
|
||||
tabPage3.Location = new Point(-669, -499);
|
||||
tabPage3.Name = "tabPage3";
|
||||
tabPage3.Size = new Size(669, 499);
|
||||
tabPage3.TabIndex = 2;
|
||||
tabPage3.Text = "流程结束操作";
|
||||
//
|
||||
// TableStopProcess
|
||||
//
|
||||
TableStopProcess.Dock = DockStyle.Fill;
|
||||
TableStopProcess.EmptyHeader = true;
|
||||
TableStopProcess.Location = new Point(0, 45);
|
||||
TableStopProcess.Name = "TableStopProcess";
|
||||
TableStopProcess.Padding = new Padding(5);
|
||||
TableStopProcess.Size = new Size(669, 454);
|
||||
TableStopProcess.TabIndex = 38;
|
||||
TableStopProcess.Text = "table1";
|
||||
//
|
||||
// panel3
|
||||
//
|
||||
panel3.Back = Color.Transparent;
|
||||
panel3.BackColor = SystemColors.Window;
|
||||
panel3.Controls.Add(btnStopProcessDelete);
|
||||
panel3.Controls.Add(btnStopProcessAdd);
|
||||
panel3.Dock = DockStyle.Top;
|
||||
panel3.Location = new Point(0, 0);
|
||||
panel3.Name = "panel3";
|
||||
panel3.Size = new Size(669, 45);
|
||||
panel3.TabIndex = 37;
|
||||
panel3.Text = "panel3";
|
||||
//
|
||||
// btnStopProcessDelete
|
||||
//
|
||||
btnStopProcessDelete.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
btnStopProcessDelete.Location = new Point(110, 10);
|
||||
btnStopProcessDelete.Name = "btnStopProcessDelete";
|
||||
btnStopProcessDelete.Size = new Size(74, 32);
|
||||
btnStopProcessDelete.TabIndex = 36;
|
||||
btnStopProcessDelete.Text = "删除";
|
||||
btnStopProcessDelete.Type = AntdUI.TTypeMini.Error;
|
||||
btnStopProcessDelete.WaveSize = 0;
|
||||
//
|
||||
// btnStopProcessAdd
|
||||
//
|
||||
btnStopProcessAdd.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
btnStopProcessAdd.Location = new Point(13, 10);
|
||||
btnStopProcessAdd.Name = "btnStopProcessAdd";
|
||||
btnStopProcessAdd.Size = new Size(82, 32);
|
||||
btnStopProcessAdd.TabIndex = 35;
|
||||
btnStopProcessAdd.Text = "新增";
|
||||
btnStopProcessAdd.Type = AntdUI.TTypeMini.Primary;
|
||||
btnStopProcessAdd.WaveSize = 0;
|
||||
//
|
||||
// tabPage4
|
||||
//
|
||||
tabPage4.Controls.Add(TableStartReset);
|
||||
tabPage4.Controls.Add(panel4);
|
||||
tabPage4.Location = new Point(-669, -499);
|
||||
tabPage4.Name = "tabPage4";
|
||||
tabPage4.Size = new Size(669, 499);
|
||||
tabPage4.TabIndex = 3;
|
||||
tabPage4.Text = "复位开始操作";
|
||||
//
|
||||
// TableStartReset
|
||||
//
|
||||
TableStartReset.Dock = DockStyle.Fill;
|
||||
TableStartReset.EmptyHeader = true;
|
||||
TableStartReset.Location = new Point(0, 45);
|
||||
TableStartReset.Name = "TableStartReset";
|
||||
TableStartReset.Padding = new Padding(5);
|
||||
TableStartReset.Size = new Size(669, 454);
|
||||
TableStartReset.TabIndex = 38;
|
||||
TableStartReset.Text = "table1";
|
||||
//
|
||||
// panel4
|
||||
//
|
||||
panel4.Back = Color.Transparent;
|
||||
panel4.BackColor = SystemColors.Window;
|
||||
panel4.Controls.Add(btnStartResetDelete);
|
||||
panel4.Controls.Add(btnStartResetAdd);
|
||||
panel4.Dock = DockStyle.Top;
|
||||
panel4.Location = new Point(0, 0);
|
||||
panel4.Name = "panel4";
|
||||
panel4.Size = new Size(669, 45);
|
||||
panel4.TabIndex = 37;
|
||||
panel4.Text = "panel4";
|
||||
//
|
||||
// btnStartResetDelete
|
||||
//
|
||||
btnStartResetDelete.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
btnStartResetDelete.Location = new Point(110, 10);
|
||||
btnStartResetDelete.Name = "btnStartResetDelete";
|
||||
btnStartResetDelete.Size = new Size(74, 32);
|
||||
btnStartResetDelete.TabIndex = 36;
|
||||
btnStartResetDelete.Text = "删除";
|
||||
btnStartResetDelete.Type = AntdUI.TTypeMini.Error;
|
||||
btnStartResetDelete.WaveSize = 0;
|
||||
//
|
||||
// btnStartResetAdd
|
||||
//
|
||||
btnStartResetAdd.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
btnStartResetAdd.Location = new Point(13, 10);
|
||||
btnStartResetAdd.Name = "btnStartResetAdd";
|
||||
btnStartResetAdd.Size = new Size(82, 32);
|
||||
btnStartResetAdd.TabIndex = 35;
|
||||
btnStartResetAdd.Text = "新增";
|
||||
btnStartResetAdd.Type = AntdUI.TTypeMini.Primary;
|
||||
btnStartResetAdd.WaveSize = 0;
|
||||
//
|
||||
// tabPage5
|
||||
//
|
||||
tabPage5.Controls.Add(TableStopReset);
|
||||
tabPage5.Controls.Add(panel5);
|
||||
tabPage5.Location = new Point(-669, -499);
|
||||
tabPage5.Name = "tabPage5";
|
||||
tabPage5.Size = new Size(669, 499);
|
||||
tabPage5.TabIndex = 4;
|
||||
tabPage5.Text = "复位结束操作";
|
||||
//
|
||||
// TableStopReset
|
||||
//
|
||||
TableStopReset.Dock = DockStyle.Fill;
|
||||
TableStopReset.EmptyHeader = true;
|
||||
TableStopReset.Location = new Point(0, 45);
|
||||
TableStopReset.Name = "TableStopReset";
|
||||
TableStopReset.Padding = new Padding(5);
|
||||
TableStopReset.Size = new Size(669, 454);
|
||||
TableStopReset.TabIndex = 38;
|
||||
TableStopReset.Text = "table1";
|
||||
//
|
||||
// panel5
|
||||
//
|
||||
panel5.Back = Color.Transparent;
|
||||
panel5.BackColor = SystemColors.Window;
|
||||
panel5.Controls.Add(btnStopResetDelete);
|
||||
panel5.Controls.Add(btnStopResetAdd);
|
||||
panel5.Dock = DockStyle.Top;
|
||||
panel5.Location = new Point(0, 0);
|
||||
panel5.Name = "panel5";
|
||||
panel5.Size = new Size(669, 45);
|
||||
panel5.TabIndex = 37;
|
||||
panel5.Text = "panel5";
|
||||
//
|
||||
// btnStopResetDelete
|
||||
//
|
||||
btnStopResetDelete.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
btnStopResetDelete.Location = new Point(110, 10);
|
||||
btnStopResetDelete.Name = "btnStopResetDelete";
|
||||
btnStopResetDelete.Size = new Size(74, 32);
|
||||
btnStopResetDelete.TabIndex = 36;
|
||||
btnStopResetDelete.Text = "删除";
|
||||
btnStopResetDelete.Type = AntdUI.TTypeMini.Error;
|
||||
btnStopResetDelete.WaveSize = 0;
|
||||
//
|
||||
// btnStopResetAdd
|
||||
//
|
||||
btnStopResetAdd.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
btnStopResetAdd.Location = new Point(13, 10);
|
||||
btnStopResetAdd.Name = "btnStopResetAdd";
|
||||
btnStopResetAdd.Size = new Size(82, 32);
|
||||
btnStopResetAdd.TabIndex = 35;
|
||||
btnStopResetAdd.Text = "新增";
|
||||
btnStopResetAdd.Type = AntdUI.TTypeMini.Primary;
|
||||
btnStopResetAdd.WaveSize = 0;
|
||||
//
|
||||
// GlobalControl
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 17F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
Controls.Add(tabs1);
|
||||
Name = "GlobalControl";
|
||||
Size = new Size(898, 530);
|
||||
tabs1.ResumeLayout(false);
|
||||
tabPage1.ResumeLayout(false);
|
||||
panel1.ResumeLayout(false);
|
||||
tabPage2.ResumeLayout(false);
|
||||
panel2.ResumeLayout(false);
|
||||
tabPage3.ResumeLayout(false);
|
||||
panel3.ResumeLayout(false);
|
||||
tabPage4.ResumeLayout(false);
|
||||
panel4.ResumeLayout(false);
|
||||
tabPage5.ResumeLayout(false);
|
||||
panel5.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
private AntdUI.Tabs tabs1;
|
||||
private AntdUI.TabPage tabPage2;
|
||||
private AntdUI.TabPage tabPage3;
|
||||
private AntdUI.TabPage tabPage4;
|
||||
private AntdUI.TabPage tabPage5;
|
||||
private AntdUI.Table TableSartProcess;
|
||||
private AntdUI.Panel panel2;
|
||||
private AntdUI.Button btnSartProcessDelete;
|
||||
private AntdUI.Button btnSartProcessAdd;
|
||||
private AntdUI.Table TableStopProcess;
|
||||
private AntdUI.Panel panel3;
|
||||
private AntdUI.Button btnStopProcessDelete;
|
||||
private AntdUI.Button btnStopProcessAdd;
|
||||
private AntdUI.Table TableStartReset;
|
||||
private AntdUI.Panel panel4;
|
||||
private AntdUI.Button btnStartResetDelete;
|
||||
private AntdUI.Button btnStartResetAdd;
|
||||
private AntdUI.Table TableStopReset;
|
||||
private AntdUI.Panel panel5;
|
||||
private AntdUI.Button btnStopResetDelete;
|
||||
private AntdUI.Button btnStopResetAdd;
|
||||
private AntdUI.TabPage tabPage1;
|
||||
private AntdUI.Table TableInitProcess;
|
||||
private AntdUI.Panel panel1;
|
||||
private AntdUI.Button btnAdd;
|
||||
private AntdUI.Button btnDelete;
|
||||
private AntdUI.TabPage tabPage6;
|
||||
}
|
||||
}
|
@ -1,819 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO.Ports;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using AntdUI;
|
||||
using DH.Commons.Base;
|
||||
using DH.Commons.Enums;
|
||||
using DH.Commons.Models;
|
||||
using XKRS.CanFly;
|
||||
|
||||
namespace DHSoftware.Views
|
||||
{
|
||||
public partial class GlobalControl : UserControl
|
||||
{
|
||||
private Window window;
|
||||
private GlobalConfig global;
|
||||
public GlobalControl(Window _window, GlobalConfig _global)
|
||||
{
|
||||
window = _window;
|
||||
global = _global;
|
||||
InitializeComponent();
|
||||
BindEventHandler();
|
||||
InitData();
|
||||
|
||||
}
|
||||
|
||||
private void BindEventHandler()
|
||||
{
|
||||
|
||||
btnAdd.Click += BtnAdd_Click;
|
||||
btnDelete.Click += BtnDelete_Click;
|
||||
TableInitProcess.CellButtonClick += ItemsTable_CellButtonClick;
|
||||
|
||||
btnSartProcessAdd.Click += BtnSartProcessAdd_Click;
|
||||
btnSartProcessDelete.Click += BtnSartProcessDelete_Click;
|
||||
TableSartProcess.CellButtonClick += TableSartProcess_CellButtonClick;
|
||||
|
||||
btnStopProcessAdd.Click += BtnStopProcessAdd_Click;
|
||||
btnStopProcessDelete.Click += BtnStopProcessDelete_Click;
|
||||
TableStopProcess.CellButtonClick += TableStopProcess_CellButtonClick;
|
||||
|
||||
btnStartResetAdd.Click += BtnStartResetAdd_Click;
|
||||
btnStartResetDelete.Click += BtnStartResetDelete_Click;
|
||||
TableStartReset.CellButtonClick += TableStartReset_CellButtonClick;
|
||||
|
||||
btnStopResetAdd.Click += BtnStopResetAdd_Click;
|
||||
btnStopResetDelete.Click += BtnStopResetDelete_Click;
|
||||
TableStopReset.CellButtonClick += TableStopReset_CellButtonClick;
|
||||
}
|
||||
|
||||
private void TableStopReset_CellButtonClick(object sender, TableButtonEventArgs e)
|
||||
{
|
||||
var buttontext = e.Btn.Text;
|
||||
|
||||
if (e.Record is PLCItem Item)
|
||||
{
|
||||
switch (buttontext)
|
||||
{
|
||||
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
|
||||
case "编辑":
|
||||
var form = new MotionProcessEdit(window, "复位结束表操作-编辑", Item, ConfigModel.PLCBaseList?.FirstOrDefault()?.PLCItemList) { Size = new Size(500, 300) };
|
||||
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
|
||||
{
|
||||
OnLoad = () =>
|
||||
{
|
||||
AntdUI.Message.info(window, "进入复位结束表编辑", autoClose: 1);
|
||||
},
|
||||
OnClose = () =>
|
||||
{
|
||||
AntdUI.Message.info(window, "退出复位结束表编辑", autoClose: 1);
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
||||
case "删除":
|
||||
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
global.StopResetList.Remove(Item);
|
||||
}
|
||||
break;
|
||||
|
||||
case "上移":
|
||||
if (e.RowIndex <= 1)
|
||||
{
|
||||
AntdUI.Message.warn(window, "已是第一条,无法上移!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
MoveItemUp(global.StopResetList, Item);
|
||||
break;
|
||||
|
||||
case "下移":
|
||||
if (e.RowIndex > global.StopResetList.Count - 1)
|
||||
{
|
||||
AntdUI.Message.warn(window, "已是最后一条,无法下移!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
MoveItemDown(global.StopResetList, Item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnStopResetDelete_Click(object? sender, EventArgs e)
|
||||
{
|
||||
if (global.StopResetList.Count == 0 || !global.StopResetList.Any(x => x.Selected))
|
||||
{
|
||||
AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
|
||||
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
// 使用反转for循环删除主列表中选中的项
|
||||
for (int i = global.StopResetList.Count - 1; i >= 0; i--)
|
||||
{
|
||||
// 删除选中的主列表项
|
||||
if (global.StopResetList[i].Selected)
|
||||
{
|
||||
global.StopResetList.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
// 提示删除完成
|
||||
AntdUI.Message.success(window, "删除成功!", autoClose: 3);
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnStopResetAdd_Click(object? sender, EventArgs e)
|
||||
{
|
||||
if (ConfigModel.PLCBaseList?.FirstOrDefault()?.PLCItemList.Count == 0)
|
||||
{
|
||||
AntdUI.Message.warn(window, "点位表无数据,不允许新增!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
|
||||
PLCItem Item = new PLCItem()
|
||||
{
|
||||
StartIndex = global.StopResetList.Count + 1,
|
||||
CellLinks = new CellLink[]
|
||||
{
|
||||
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
|
||||
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
|
||||
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary),
|
||||
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
|
||||
}
|
||||
};
|
||||
|
||||
var form = new MotionProcessEdit(window, "复位结束表操作-新增", Item, ConfigModel.PLCBaseList?.FirstOrDefault()?.PLCItemList) { Size = new Size(450, 550) };
|
||||
|
||||
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
|
||||
{
|
||||
OnLoad = () =>
|
||||
{
|
||||
AntdUI.Message.info(window, "进入复位结束表新增", autoClose: 1);
|
||||
},
|
||||
OnClose = () =>
|
||||
{
|
||||
if (form.submit)
|
||||
{
|
||||
global.StopResetList.Add(Item);
|
||||
}
|
||||
|
||||
AntdUI.Message.info(window, "退出复位结束表新增", autoClose: 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void TableStartReset_CellButtonClick(object sender, TableButtonEventArgs e)
|
||||
{
|
||||
var buttontext = e.Btn.Text;
|
||||
|
||||
if (e.Record is PLCItem Item)
|
||||
{
|
||||
switch (buttontext)
|
||||
{
|
||||
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
|
||||
case "编辑":
|
||||
var form = new MotionProcessEdit(window, "复位开始表操作-编辑", Item, ConfigModel.PLCBaseList?.FirstOrDefault()?.PLCItemList) { Size = new Size(500, 300) };
|
||||
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
|
||||
{
|
||||
OnLoad = () =>
|
||||
{
|
||||
AntdUI.Message.info(window, "进入复位开始表编辑", autoClose: 1);
|
||||
},
|
||||
OnClose = () =>
|
||||
{
|
||||
AntdUI.Message.info(window, "退出复位开始表编辑", autoClose: 1);
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
||||
case "删除":
|
||||
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
global.StartResetList.Remove(Item);
|
||||
}
|
||||
break;
|
||||
|
||||
case "上移":
|
||||
if (e.RowIndex <= 1)
|
||||
{
|
||||
AntdUI.Message.warn(window, "已是第一条,无法上移!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
MoveItemUp(global.StartResetList, Item);
|
||||
break;
|
||||
|
||||
case "下移":
|
||||
if (e.RowIndex > global.StartResetList.Count - 1)
|
||||
{
|
||||
AntdUI.Message.warn(window, "已是最后一条,无法下移!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
MoveItemDown(global.StartResetList, Item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnStartResetDelete_Click(object? sender, EventArgs e)
|
||||
{
|
||||
if (global.StartResetList.Count == 0 || !global.StartResetList.Any(x => x.Selected))
|
||||
{
|
||||
AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
|
||||
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
// 使用反转for循环删除主列表中选中的项
|
||||
for (int i = global.StartResetList.Count - 1; i >= 0; i--)
|
||||
{
|
||||
// 删除选中的主列表项
|
||||
if (global.StartResetList[i].Selected)
|
||||
{
|
||||
global.StartResetList.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
// 提示删除完成
|
||||
AntdUI.Message.success(window, "删除成功!", autoClose: 3);
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnStartResetAdd_Click(object? sender, EventArgs e)
|
||||
{
|
||||
if (ConfigModel.PLCBaseList?.FirstOrDefault()?.PLCItemList.Count == 0)
|
||||
{
|
||||
AntdUI.Message.warn(window, "点位表无数据,不允许新增!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
PLCItem Item = new PLCItem()
|
||||
{
|
||||
StartIndex = global.StartResetList.Count + 1,
|
||||
CellLinks = new CellLink[]
|
||||
{
|
||||
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
|
||||
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
|
||||
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary),
|
||||
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
|
||||
}
|
||||
};
|
||||
|
||||
var form = new MotionProcessEdit(window, "复位开始表操作-新增", Item, ConfigModel.PLCBaseList?.FirstOrDefault()?.PLCItemList) { Size = new Size(450, 550) };
|
||||
|
||||
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
|
||||
{
|
||||
OnLoad = () =>
|
||||
{
|
||||
AntdUI.Message.info(window, "进入复位开始表新增", autoClose: 1);
|
||||
},
|
||||
OnClose = () =>
|
||||
{
|
||||
if (form.submit)
|
||||
{
|
||||
global.StartResetList.Add(Item);
|
||||
}
|
||||
|
||||
AntdUI.Message.info(window, "退出复位开始表新增", autoClose: 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void TableStopProcess_CellButtonClick(object sender, TableButtonEventArgs e)
|
||||
{
|
||||
var buttontext = e.Btn.Text;
|
||||
|
||||
if (e.Record is PLCItem Item)
|
||||
{
|
||||
switch (buttontext)
|
||||
{
|
||||
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
|
||||
case "编辑":
|
||||
var form = new MotionProcessEdit(window, "流程结束表操作-编辑", Item, ConfigModel.PLCBaseList?.FirstOrDefault()?.PLCItemList) { Size = new Size(500, 300) };
|
||||
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
|
||||
{
|
||||
OnLoad = () =>
|
||||
{
|
||||
AntdUI.Message.info(window, "进入流程结束表编辑", autoClose: 1);
|
||||
},
|
||||
OnClose = () =>
|
||||
{
|
||||
AntdUI.Message.info(window, "退出流程结束表编辑", autoClose: 1);
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
||||
case "删除":
|
||||
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
global.StopProcessList.Remove(Item);
|
||||
}
|
||||
break;
|
||||
|
||||
case "上移":
|
||||
if (e.RowIndex <= 1)
|
||||
{
|
||||
AntdUI.Message.warn(window, "已是第一条,无法上移!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
MoveItemUp(global.StopProcessList, Item);
|
||||
break;
|
||||
|
||||
case "下移":
|
||||
if (e.RowIndex > global.StopProcessList.Count - 1)
|
||||
{
|
||||
AntdUI.Message.warn(window, "已是最后一条,无法下移!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
MoveItemDown(global.StopProcessList, Item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnStopProcessDelete_Click(object? sender, EventArgs e)
|
||||
{
|
||||
if (global.StopProcessList.Count == 0 || !global.StopProcessList.Any(x => x.Selected))
|
||||
{
|
||||
AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
|
||||
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
// 使用反转for循环删除主列表中选中的项
|
||||
for (int i = global.StopProcessList.Count - 1; i >= 0; i--)
|
||||
{
|
||||
// 删除选中的主列表项
|
||||
if (global.StopProcessList[i].Selected)
|
||||
{
|
||||
global.StopProcessList.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
// 提示删除完成
|
||||
AntdUI.Message.success(window, "删除成功!", autoClose: 3);
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnStopProcessAdd_Click(object? sender, EventArgs e)
|
||||
{
|
||||
if (ConfigModel.PLCBaseList?.FirstOrDefault()?.PLCItemList.Count == 0)
|
||||
{
|
||||
AntdUI.Message.warn(window, "点位表无数据,不允许新增!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
PLCItem Item = new PLCItem()
|
||||
{
|
||||
StartIndex = global.StopProcessList.Count + 1,
|
||||
CellLinks = new CellLink[]
|
||||
{
|
||||
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
|
||||
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
|
||||
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary),
|
||||
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
|
||||
}
|
||||
};
|
||||
|
||||
var form = new MotionProcessEdit(window, "流程结束表操作-新增", Item, ConfigModel.PLCBaseList?.FirstOrDefault()?.PLCItemList) { Size = new Size(450, 550) };
|
||||
|
||||
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
|
||||
{
|
||||
OnLoad = () =>
|
||||
{
|
||||
AntdUI.Message.info(window, "进入流程结束表新增", autoClose: 1);
|
||||
},
|
||||
OnClose = () =>
|
||||
{
|
||||
if (form.submit)
|
||||
{
|
||||
global.StopProcessList.Add(Item);
|
||||
}
|
||||
|
||||
AntdUI.Message.info(window, "退出流程结束表新增", autoClose: 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void TableSartProcess_CellButtonClick(object sender, TableButtonEventArgs e)
|
||||
{
|
||||
var buttontext = e.Btn.Text;
|
||||
|
||||
if (e.Record is PLCItem Item)
|
||||
{
|
||||
switch (buttontext)
|
||||
{
|
||||
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
|
||||
case "编辑":
|
||||
var form = new MotionProcessEdit(window, "流程开始表操作-编辑", Item, ConfigModel.PLCBaseList?.FirstOrDefault()?.PLCItemList) { Size = new Size(500, 300) };
|
||||
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
|
||||
{
|
||||
OnLoad = () =>
|
||||
{
|
||||
AntdUI.Message.info(window, "进入流程开始表编辑", autoClose: 1);
|
||||
},
|
||||
OnClose = () =>
|
||||
{
|
||||
AntdUI.Message.info(window, "退出流程开始表编辑", autoClose: 1);
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
||||
case "删除":
|
||||
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
global.StartProcessList.Remove(Item);
|
||||
}
|
||||
break;
|
||||
|
||||
case "上移":
|
||||
if (e.RowIndex <= 1)
|
||||
{
|
||||
AntdUI.Message.warn(window, "已是第一条,无法上移!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
MoveItemUp(global.StartProcessList, Item);
|
||||
break;
|
||||
|
||||
case "下移":
|
||||
if (e.RowIndex > global.StartProcessList.Count - 1)
|
||||
{
|
||||
AntdUI.Message.warn(window, "已是最后一条,无法下移!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
MoveItemDown(global.StartProcessList, Item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnSartProcessDelete_Click(object? sender, EventArgs e)
|
||||
{
|
||||
if (global.StartProcessList.Count == 0 || !global.StartProcessList.Any(x => x.Selected))
|
||||
{
|
||||
AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
|
||||
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
// 使用反转for循环删除主列表中选中的项
|
||||
for (int i = global.StartProcessList.Count - 1; i >= 0; i--)
|
||||
{
|
||||
// 删除选中的主列表项
|
||||
if (global.StartProcessList[i].Selected)
|
||||
{
|
||||
global.StartProcessList.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
// 提示删除完成
|
||||
AntdUI.Message.success(window, "删除成功!", autoClose: 3);
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnSartProcessAdd_Click(object? sender, EventArgs e)
|
||||
{
|
||||
if (ConfigModel.PLCBaseList?.FirstOrDefault()?.PLCItemList.Count == 0)
|
||||
{
|
||||
AntdUI.Message.warn(window, "点位表无数据,不允许新增!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
PLCItem Item = new PLCItem()
|
||||
{
|
||||
StartIndex = global.StartProcessList.Count + 1,
|
||||
CellLinks = new CellLink[]
|
||||
{
|
||||
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
|
||||
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
|
||||
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary),
|
||||
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
|
||||
}
|
||||
};
|
||||
|
||||
var form = new MotionProcessEdit(window, "流程开始表操作-新增", Item, ConfigModel.PLCBaseList?.FirstOrDefault()?.PLCItemList) { Size = new Size(450, 550) };
|
||||
|
||||
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
|
||||
{
|
||||
OnLoad = () =>
|
||||
{
|
||||
AntdUI.Message.info(window, "进入流程开始表新增", autoClose: 1);
|
||||
},
|
||||
OnClose = () =>
|
||||
{
|
||||
if (form.submit)
|
||||
{
|
||||
global.StartProcessList.Add(Item);
|
||||
}
|
||||
|
||||
AntdUI.Message.info(window, "退出流程开始表新增", autoClose: 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void ItemsTable_CellButtonClick(object sender, TableButtonEventArgs e)
|
||||
{
|
||||
var buttontext = e.Btn.Text;
|
||||
|
||||
if (e.Record is PLCItem Item)
|
||||
{
|
||||
switch (buttontext)
|
||||
{
|
||||
//暂不支持进入整行编辑,只支持指定单元格编辑,推荐使用弹窗或抽屉编辑整行数据
|
||||
case "编辑":
|
||||
var form = new MotionProcessEdit(window, "流程加载表操作-编辑", Item, ConfigModel.PLCBaseList?.FirstOrDefault()?.PLCItemList) { Size = new Size(500, 300) };
|
||||
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
|
||||
{
|
||||
OnLoad = () =>
|
||||
{
|
||||
AntdUI.Message.info(window, "进入流程加载表编辑", autoClose: 1);
|
||||
},
|
||||
OnClose = () =>
|
||||
{
|
||||
AntdUI.Message.info(window, "退出流程加载表编辑", autoClose: 1);
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
||||
case "删除":
|
||||
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
global.InitProcessList.Remove(Item);
|
||||
}
|
||||
break;
|
||||
|
||||
case "上移":
|
||||
if (e.RowIndex <= 1)
|
||||
{
|
||||
AntdUI.Message.warn(window, "已是第一条,无法上移!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
MoveItemUp(global.InitProcessList, Item);
|
||||
break;
|
||||
|
||||
case "下移":
|
||||
if (e.RowIndex > global.InitProcessList.Count - 1)
|
||||
{
|
||||
AntdUI.Message.warn(window, "已是最后一条,无法下移!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
MoveItemDown(global.InitProcessList, Item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 上移项
|
||||
public static void MoveItemUp(BindingList<PLCItem> list, PLCItem item)
|
||||
{
|
||||
int index = list.IndexOf(item);
|
||||
if (index > 0)
|
||||
{
|
||||
// 移除并插入到前一位
|
||||
list.RemoveAt(index);
|
||||
list.Insert(index - 1, item);
|
||||
UpdateStartIndexes(list); // 更新序号
|
||||
}
|
||||
}
|
||||
|
||||
// 下移项
|
||||
public static void MoveItemDown(BindingList<PLCItem> list, PLCItem item)
|
||||
{
|
||||
int index = list.IndexOf(item);
|
||||
if (index < list.Count - 1)
|
||||
{
|
||||
// 移除并插入到后一位
|
||||
list.RemoveAt(index);
|
||||
list.Insert(index + 1, item);
|
||||
UpdateStartIndexes(list); // 更新序号
|
||||
}
|
||||
}
|
||||
|
||||
// 更新所有项的序号
|
||||
public static void UpdateStartIndexes(BindingList<PLCItem> list)
|
||||
{
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
PLCItem item = list[i];
|
||||
if (item.StartIndex != i + 1)
|
||||
{
|
||||
item.StartIndex = i + 1; // 触发 PropertyChanged 事件
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnDelete_Click(object? sender, EventArgs e)
|
||||
{
|
||||
if (global.InitProcessList.Count == 0 || !global.InitProcessList.Any(x => x.Selected))
|
||||
{
|
||||
AntdUI.Message.warn(window, "请选择要删除的行!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
|
||||
var result = Modal.open(window, "删除警告!", "确认要删除选择的数据吗?", TType.Warn);
|
||||
if (result == DialogResult.OK)
|
||||
{
|
||||
// 使用反转for循环删除主列表中选中的项
|
||||
for (int i = global.InitProcessList.Count - 1; i >= 0; i--)
|
||||
{
|
||||
// 删除选中的主列表项
|
||||
if (global.InitProcessList[i].Selected)
|
||||
{
|
||||
global.InitProcessList.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
// 提示删除完成
|
||||
AntdUI.Message.success(window, "删除成功!", autoClose: 3);
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnAdd_Click(object? sender, EventArgs e)
|
||||
{
|
||||
if (ConfigModel.PLCBaseList?.FirstOrDefault()?.PLCItemList.Count == 0)
|
||||
{
|
||||
AntdUI.Message.warn(window, "点位表无数据,不允许新增!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
PLCItem Item = new PLCItem()
|
||||
{
|
||||
StartIndex = global.InitProcessList.Count + 1,
|
||||
CellLinks = new CellLink[]
|
||||
{ new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
|
||||
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
|
||||
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary),
|
||||
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
|
||||
}
|
||||
};
|
||||
|
||||
var form = new MotionProcessEdit(window, "流程加载表操作-新增", Item, ConfigModel.PLCBaseList?.FirstOrDefault()?.PLCItemList) { Size = new Size(450, 550) };
|
||||
|
||||
AntdUI.Drawer.open(new AntdUI.Drawer.Config(window, form)
|
||||
{
|
||||
OnLoad = () =>
|
||||
{
|
||||
AntdUI.Message.info(window, "进入流程加载表新增", autoClose: 1);
|
||||
},
|
||||
OnClose = () =>
|
||||
{
|
||||
if (form.submit)
|
||||
{
|
||||
global.InitProcessList.Add(Item);
|
||||
}
|
||||
|
||||
AntdUI.Message.info(window, "退出流程加载表新增", autoClose: 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void InitData()
|
||||
{
|
||||
|
||||
|
||||
|
||||
TableInitProcess.Columns = new ColumnCollection() {
|
||||
new ColumnCheck("Selected"){Fixed = true},
|
||||
new Column("StartIndex", "序号", ColumnAlign.Center),
|
||||
new ColumnSwitch("StartExecute", "启用", ColumnAlign.Center),
|
||||
new Column("Name", "名称", ColumnAlign.Center),
|
||||
new Column("Type", "类型",ColumnAlign.Center){Visible=false},
|
||||
new Column("Address", "地址",ColumnAlign.Center){Visible=false},
|
||||
new Column("Value", "值",ColumnAlign.Center),
|
||||
new Column("CellLinks", "操作", ColumnAlign.Center)
|
||||
};
|
||||
if (global.InitProcessList.Count > 0)
|
||||
{
|
||||
foreach (var item in global.InitProcessList)
|
||||
{
|
||||
item.CellLinks = new CellLink[] {
|
||||
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
|
||||
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
|
||||
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary) ,
|
||||
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
|
||||
};
|
||||
}
|
||||
}
|
||||
TableInitProcess.Binding(global.InitProcessList);
|
||||
|
||||
TableSartProcess.Columns = new ColumnCollection() {
|
||||
new ColumnCheck("Selected"){Fixed = true},
|
||||
new Column("StartIndex", "序号", ColumnAlign.Center),
|
||||
new ColumnSwitch("StartExecute", "启用", ColumnAlign.Center),
|
||||
new Column("Name", "名称", ColumnAlign.Center),
|
||||
new Column("Type", "类型",ColumnAlign.Center){Visible=false},
|
||||
new Column("Address", "地址",ColumnAlign.Center){Visible=false},
|
||||
new Column("Value", "值",ColumnAlign.Center),
|
||||
new Column("CellLinks", "操作", ColumnAlign.Center)
|
||||
};
|
||||
if (global.StartProcessList.Count > 0)
|
||||
{
|
||||
foreach (var item in global.StartProcessList)
|
||||
{
|
||||
item.CellLinks = new CellLink[] {
|
||||
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
|
||||
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
|
||||
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary) ,
|
||||
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
|
||||
};
|
||||
}
|
||||
}
|
||||
//TableSartProcess.Binding(global.StartProcessList);
|
||||
TableSartProcess.Binding(global.StartProcessList);
|
||||
TableStopProcess.Columns = new ColumnCollection() {
|
||||
new ColumnCheck("Selected"){Fixed = true},
|
||||
new Column("StartIndex", "序号", ColumnAlign.Center),
|
||||
new ColumnSwitch("StartExecute", "启用", ColumnAlign.Center),
|
||||
new Column("Name", "名称", ColumnAlign.Center),
|
||||
new Column("Type", "类型",ColumnAlign.Center){Visible=false},
|
||||
new Column("Address", "地址",ColumnAlign.Center){Visible=false},
|
||||
new Column("Value", "值",ColumnAlign.Center),
|
||||
new Column("CellLinks", "操作", ColumnAlign.Center)
|
||||
};
|
||||
if (global.StopProcessList.Count > 0)
|
||||
{
|
||||
foreach (var item in global.StopProcessList)
|
||||
{
|
||||
item.CellLinks = new CellLink[] {
|
||||
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
|
||||
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
|
||||
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary) ,
|
||||
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
|
||||
};
|
||||
}
|
||||
}
|
||||
TableStopProcess.Binding(global.StopProcessList);
|
||||
|
||||
TableStartReset.Columns = new ColumnCollection() {
|
||||
new ColumnCheck("Selected"){Fixed = true},
|
||||
new Column("StartIndex", "序号", ColumnAlign.Center),
|
||||
new ColumnSwitch("StartExecute", "启用", ColumnAlign.Center),
|
||||
new Column("Name", "名称", ColumnAlign.Center),
|
||||
new Column("Type", "类型",ColumnAlign.Center){Visible=false},
|
||||
new Column("Address", "地址",ColumnAlign.Center){Visible=false},
|
||||
new Column("Value", "值",ColumnAlign.Center),
|
||||
new Column("CellLinks", "操作", ColumnAlign.Center)
|
||||
};
|
||||
if (global.StartResetList.Count > 0)
|
||||
{
|
||||
foreach (var item in global.StartResetList)
|
||||
{
|
||||
item.CellLinks = new CellLink[] {
|
||||
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
|
||||
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
|
||||
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary) ,
|
||||
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
|
||||
};
|
||||
}
|
||||
}
|
||||
TableStartReset.Binding(global.StartResetList);
|
||||
|
||||
TableStopReset.Columns = new ColumnCollection() {
|
||||
new ColumnCheck("Selected"){Fixed = true},
|
||||
new Column("StartIndex", "序号", ColumnAlign.Center),
|
||||
new ColumnSwitch("StartExecute", "启用", ColumnAlign.Center),
|
||||
new Column("Name", "名称", ColumnAlign.Center),
|
||||
new Column("Type", "类型",ColumnAlign.Center){Visible=false},
|
||||
new Column("Address", "地址",ColumnAlign.Center){Visible=false},
|
||||
new Column("Value", "值",ColumnAlign.Center),
|
||||
new Column("CellLinks", "操作", ColumnAlign.Center)
|
||||
};
|
||||
if (global.StopResetList.Count > 0)
|
||||
{
|
||||
foreach (var item in global.StopResetList)
|
||||
{
|
||||
item.CellLinks = new CellLink[] {
|
||||
new CellButton(Guid.NewGuid().ToString(), "上移", TTypeMini.Default),
|
||||
new CellButton(Guid.NewGuid().ToString(), "下移", TTypeMini.Default),
|
||||
new CellButton(Guid.NewGuid().ToString(), "编辑", TTypeMini.Primary) ,
|
||||
new CellButton(Guid.NewGuid().ToString(), "删除", TTypeMini.Error)
|
||||
};
|
||||
}
|
||||
}
|
||||
TableStopReset.Binding(global.StopResetList);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -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>
|
76
DHSoftware/Views/MotionControl.Designer.cs
generated
76
DHSoftware/Views/MotionControl.Designer.cs
generated
@ -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,10 +56,7 @@
|
||||
stpBaud = new AntdUI.StackPanel();
|
||||
cmbBaudRate = new AntdUI.Select();
|
||||
label3 = new AntdUI.Label();
|
||||
tabs1 = new AntdUI.Tabs();
|
||||
tabPage1 = new AntdUI.TabPage();
|
||||
PLCItemsTable = new AntdUI.Table();
|
||||
panel1 = new AntdUI.Panel();
|
||||
btnDelete = new AntdUI.Button();
|
||||
btnAdd = new AntdUI.Button();
|
||||
stackPanel2.SuspendLayout();
|
||||
@ -73,9 +69,6 @@
|
||||
stpStop.SuspendLayout();
|
||||
stpData.SuspendLayout();
|
||||
stpBaud.SuspendLayout();
|
||||
tabs1.SuspendLayout();
|
||||
tabPage1.SuspendLayout();
|
||||
panel1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// stackPanel2
|
||||
@ -171,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;
|
||||
@ -339,58 +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.Size = new Size(675, 530);
|
||||
tabs1.Style = styleLine1;
|
||||
tabs1.TabIndex = 26;
|
||||
tabs1.Text = "tabs1";
|
||||
//
|
||||
// tabPage1
|
||||
//
|
||||
tabPage1.Controls.Add(PLCItemsTable);
|
||||
tabPage1.Controls.Add(panel1);
|
||||
tabPage1.Location = new Point(3, 28);
|
||||
tabPage1.Name = "tabPage1";
|
||||
tabPage1.Size = new Size(669, 499);
|
||||
tabPage1.TabIndex = 0;
|
||||
tabPage1.Text = "点位表";
|
||||
//
|
||||
// PLCItemsTable
|
||||
//
|
||||
PLCItemsTable.Dock = DockStyle.Fill;
|
||||
PLCItemsTable.EmptyHeader = true;
|
||||
PLCItemsTable.Location = new Point(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;
|
||||
@ -398,10 +354,10 @@
|
||||
// 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;
|
||||
@ -410,7 +366,9 @@
|
||||
//
|
||||
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);
|
||||
@ -424,9 +382,6 @@
|
||||
stpStop.ResumeLayout(false);
|
||||
stpData.ResumeLayout(false);
|
||||
stpBaud.ResumeLayout(false);
|
||||
tabs1.ResumeLayout(false);
|
||||
tabPage1.ResumeLayout(false);
|
||||
panel1.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
@ -460,10 +415,7 @@
|
||||
private AntdUI.StackPanel stpBaud;
|
||||
private AntdUI.Select cmbBaudRate;
|
||||
private AntdUI.Label label3;
|
||||
private AntdUI.Tabs tabs1;
|
||||
private AntdUI.TabPage tabPage1;
|
||||
private AntdUI.Table PLCItemsTable;
|
||||
private AntdUI.Panel panel1;
|
||||
private AntdUI.Button btnDelete;
|
||||
private AntdUI.Button btnAdd;
|
||||
}
|
||||
|
@ -2,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,29 +18,28 @@ namespace DHSoftware.Views
|
||||
{
|
||||
public partial class MotionControl : UserControl
|
||||
{
|
||||
private Window window;
|
||||
private PLCBase pLCBase;
|
||||
|
||||
public MotionControl(Window _window, PLCBase _pLCBase)
|
||||
Window window;
|
||||
PLCBase pLCBase;
|
||||
public MotionControl(Window _window,PLCBase _pLCBase)
|
||||
{
|
||||
window = _window;
|
||||
pLCBase = _pLCBase;
|
||||
window= _window;
|
||||
pLCBase= _pLCBase;
|
||||
InitializeComponent();
|
||||
BindEventHandler();
|
||||
InitData();
|
||||
SetupDataBindings();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void BindEventHandler()
|
||||
{
|
||||
sltTpye.TextChanged += SltTpye_TextChanged;
|
||||
btnAdd.Click += BtnAdd_Click;
|
||||
btnDelete.Click += BtnDelete_Click;
|
||||
PLCItemsTable.CellButtonClick += PLCItemsTable_CellButtonClick;
|
||||
|
||||
PLCItemsTable.CellButtonClick += PLCItemsTable_CellButtonClick; ;
|
||||
}
|
||||
|
||||
|
||||
private void PLCItemsTable_CellButtonClick(object sender, TableButtonEventArgs e)
|
||||
{
|
||||
var buttontext = e.Btn.Text;
|
||||
@ -52,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 = () =>
|
||||
@ -61,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)
|
||||
@ -74,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 事件
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -163,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)
|
||||
{
|
||||
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)
|
||||
@ -239,10 +193,17 @@ namespace DHSoftware.Views
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void InitData()
|
||||
{
|
||||
// 获取枚举字段名列表(原描述改为字段名)
|
||||
@ -281,29 +242,47 @@ 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)
|
||||
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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void SetupDataBindings()
|
||||
{
|
||||
// 添加双向类型转换
|
||||
@ -317,7 +296,9 @@ namespace DHSoftware.Views
|
||||
iptIP.DataBindings.Add(nameof(iptIP.Text), pLCBase, nameof(pLCBase.IP));
|
||||
iptPort.DataBindings.Add(nameof(iptPort.Text), pLCBase, nameof(pLCBase.Port));
|
||||
|
||||
swhEnable.DataBindings.Add(nameof(swhEnable.Checked), pLCBase, nameof(pLCBase.Enable));
|
||||
swhEnable.DataBindings.Add(nameof(swhEnable.Checked),pLCBase, nameof(pLCBase.Enable));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
202
DHSoftware/Views/MotionEdit.Designer.cs
generated
202
DHSoftware/Views/MotionEdit.Designer.cs
generated
@ -35,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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
284
DHSoftware/Views/MotionProcessEdit.Designer.cs
generated
284
DHSoftware/Views/MotionProcessEdit.Designer.cs
generated
@ -1,284 +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();
|
||||
sltValue = new AntdUI.Select();
|
||||
iptValue = new AntdUI.Input();
|
||||
label1 = new AntdUI.Label();
|
||||
iptAddress = new AntdUI.Input();
|
||||
label7 = new AntdUI.Label();
|
||||
sltDataType = new AntdUI.Select();
|
||||
label4 = new AntdUI.Label();
|
||||
sltEnable = new AntdUI.Select();
|
||||
label3 = new AntdUI.Label();
|
||||
stackPanel1.SuspendLayout();
|
||||
panel1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// button_cancel
|
||||
//
|
||||
button_cancel.BorderWidth = 1F;
|
||||
button_cancel.Font = new Font("Microsoft YaHei UI", 9F);
|
||||
button_cancel.Ghost = true;
|
||||
button_cancel.Location = new Point(84, 3);
|
||||
button_cancel.Name = "button_cancel";
|
||||
button_cancel.Size = new Size(75, 38);
|
||||
button_cancel.TabIndex = 1;
|
||||
button_cancel.Text = "取消";
|
||||
//
|
||||
// sltName
|
||||
//
|
||||
sltName.Dock = DockStyle.Top;
|
||||
sltName.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
sltName.Location = new Point(18, 134);
|
||||
sltName.MaxCount = 10;
|
||||
sltName.Name = "sltName";
|
||||
sltName.Radius = 3;
|
||||
sltName.Size = new Size(409, 38);
|
||||
sltName.TabIndex = 23;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.Dock = DockStyle.Top;
|
||||
label2.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
label2.Location = new Point(18, 110);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(409, 24);
|
||||
label2.TabIndex = 22;
|
||||
label2.Text = "名称";
|
||||
//
|
||||
// divider2
|
||||
//
|
||||
divider2.Dock = DockStyle.Top;
|
||||
divider2.Location = new Point(18, 98);
|
||||
divider2.Name = "divider2";
|
||||
divider2.Size = new Size(409, 12);
|
||||
divider2.TabIndex = 21;
|
||||
//
|
||||
// stackPanel1
|
||||
//
|
||||
stackPanel1.Controls.Add(button_cancel);
|
||||
stackPanel1.Controls.Add(button_ok);
|
||||
stackPanel1.Dock = DockStyle.Top;
|
||||
stackPanel1.Location = new Point(18, 54);
|
||||
stackPanel1.Name = "stackPanel1";
|
||||
stackPanel1.RightToLeft = RightToLeft.No;
|
||||
stackPanel1.Size = new Size(409, 44);
|
||||
stackPanel1.TabIndex = 20;
|
||||
stackPanel1.Text = "stackPanel1";
|
||||
//
|
||||
// button_ok
|
||||
//
|
||||
button_ok.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
button_ok.Location = new Point(3, 3);
|
||||
button_ok.Name = "button_ok";
|
||||
button_ok.Size = new Size(75, 38);
|
||||
button_ok.TabIndex = 0;
|
||||
button_ok.Text = "确定";
|
||||
button_ok.Type = AntdUI.TTypeMini.Primary;
|
||||
//
|
||||
// divider1
|
||||
//
|
||||
divider1.Dock = DockStyle.Top;
|
||||
divider1.Location = new Point(18, 42);
|
||||
divider1.Name = "divider1";
|
||||
divider1.Size = new Size(409, 12);
|
||||
divider1.TabIndex = 19;
|
||||
//
|
||||
// lbTitleName
|
||||
//
|
||||
lbTitleName.Dock = DockStyle.Top;
|
||||
lbTitleName.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
lbTitleName.Location = new Point(18, 18);
|
||||
lbTitleName.Name = "lbTitleName";
|
||||
lbTitleName.Size = new Size(409, 24);
|
||||
lbTitleName.TabIndex = 17;
|
||||
lbTitleName.Text = "PLC点位操作";
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(sltValue);
|
||||
panel1.Controls.Add(iptValue);
|
||||
panel1.Controls.Add(label1);
|
||||
panel1.Controls.Add(iptAddress);
|
||||
panel1.Controls.Add(label7);
|
||||
panel1.Controls.Add(sltDataType);
|
||||
panel1.Controls.Add(label4);
|
||||
panel1.Controls.Add(sltEnable);
|
||||
panel1.Controls.Add(label3);
|
||||
panel1.Controls.Add(sltName);
|
||||
panel1.Controls.Add(label2);
|
||||
panel1.Controls.Add(divider2);
|
||||
panel1.Controls.Add(stackPanel1);
|
||||
panel1.Controls.Add(divider1);
|
||||
panel1.Controls.Add(lbTitleName);
|
||||
panel1.Dock = DockStyle.Fill;
|
||||
panel1.Location = new Point(0, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Padding = new Padding(12);
|
||||
panel1.Shadow = 6;
|
||||
panel1.Size = new Size(445, 549);
|
||||
panel1.TabIndex = 1;
|
||||
panel1.Text = "panel1";
|
||||
panel1.Click += panel1_Click;
|
||||
//
|
||||
// sltValue
|
||||
//
|
||||
sltValue.Dock = DockStyle.Top;
|
||||
sltValue.List = true;
|
||||
sltValue.Location = new Point(18, 420);
|
||||
sltValue.Name = "sltValue";
|
||||
sltValue.Size = new Size(409, 38);
|
||||
sltValue.TabIndex = 63;
|
||||
sltValue.Visible = false;
|
||||
//
|
||||
// iptValue
|
||||
//
|
||||
iptValue.Dock = DockStyle.Top;
|
||||
iptValue.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
iptValue.Location = new Point(18, 382);
|
||||
iptValue.Name = "iptValue";
|
||||
iptValue.PlaceholderText = "";
|
||||
iptValue.Radius = 3;
|
||||
iptValue.Size = new Size(409, 38);
|
||||
iptValue.TabIndex = 62;
|
||||
iptValue.Visible = false;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.Dock = DockStyle.Top;
|
||||
label1.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
label1.Location = new Point(18, 358);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(409, 24);
|
||||
label1.TabIndex = 61;
|
||||
label1.Text = "值";
|
||||
//
|
||||
// iptAddress
|
||||
//
|
||||
iptAddress.Dock = DockStyle.Top;
|
||||
iptAddress.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
iptAddress.Location = new Point(18, 320);
|
||||
iptAddress.Name = "iptAddress";
|
||||
iptAddress.Radius = 3;
|
||||
iptAddress.ReadOnly = true;
|
||||
iptAddress.Size = new Size(409, 38);
|
||||
iptAddress.TabIndex = 60;
|
||||
//
|
||||
// label7
|
||||
//
|
||||
label7.Dock = DockStyle.Top;
|
||||
label7.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
label7.Location = new Point(18, 296);
|
||||
label7.Name = "label7";
|
||||
label7.Size = new Size(409, 24);
|
||||
label7.TabIndex = 59;
|
||||
label7.Text = "地址";
|
||||
//
|
||||
// sltDataType
|
||||
//
|
||||
sltDataType.Dock = DockStyle.Top;
|
||||
sltDataType.List = true;
|
||||
sltDataType.Location = new Point(18, 258);
|
||||
sltDataType.Name = "sltDataType";
|
||||
sltDataType.ReadOnly = true;
|
||||
sltDataType.Size = new Size(409, 38);
|
||||
sltDataType.TabIndex = 58;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
label4.Dock = DockStyle.Top;
|
||||
label4.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
label4.Location = new Point(18, 234);
|
||||
label4.Name = "label4";
|
||||
label4.Size = new Size(409, 24);
|
||||
label4.TabIndex = 57;
|
||||
label4.Text = "数据类型";
|
||||
//
|
||||
// sltEnable
|
||||
//
|
||||
sltEnable.Dock = DockStyle.Top;
|
||||
sltEnable.List = true;
|
||||
sltEnable.Location = new Point(18, 196);
|
||||
sltEnable.Name = "sltEnable";
|
||||
sltEnable.Size = new Size(409, 38);
|
||||
sltEnable.TabIndex = 45;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.Dock = DockStyle.Top;
|
||||
label3.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
label3.Location = new Point(18, 172);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(409, 24);
|
||||
label3.TabIndex = 44;
|
||||
label3.Text = "状态";
|
||||
//
|
||||
// MotionProcessEdit
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 17F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
Controls.Add(panel1);
|
||||
Name = "MotionProcessEdit";
|
||||
Size = new Size(445, 549);
|
||||
stackPanel1.ResumeLayout(false);
|
||||
panel1.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
private AntdUI.Button button_cancel;
|
||||
private AntdUI.Select sltName;
|
||||
private AntdUI.Label label2;
|
||||
private AntdUI.Divider divider2;
|
||||
private AntdUI.StackPanel stackPanel1;
|
||||
private AntdUI.Button button_ok;
|
||||
private AntdUI.Divider divider1;
|
||||
private AntdUI.Label lbTitleName;
|
||||
private AntdUI.Panel panel1;
|
||||
private AntdUI.Select sltEnable;
|
||||
private AntdUI.Label label3;
|
||||
private AntdUI.Input iptValue;
|
||||
private AntdUI.Label label1;
|
||||
private AntdUI.Input iptAddress;
|
||||
private AntdUI.Label label7;
|
||||
private AntdUI.Select sltDataType;
|
||||
private AntdUI.Label label4;
|
||||
private AntdUI.Select sltValue;
|
||||
}
|
||||
}
|
@ -1,134 +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;
|
||||
sltDataType.SelectedIndexChanged += SltDataType_SelectedIndexChanged;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void SltDataType_SelectedIndexChanged(object sender, IntEventArgs e)
|
||||
{
|
||||
iptValue.Visible = e.Value != 3;
|
||||
sltValue.Visible = e.Value == 3;
|
||||
}
|
||||
|
||||
private void SltName_SelectedIndexChanged(object sender, IntEventArgs e)
|
||||
{
|
||||
Select select = (Select)sender;
|
||||
var pLCItems=plcItemList.Where(it=>it.Name==select.Text).FirstOrDefault();
|
||||
if (pLCItems != null)
|
||||
{
|
||||
sltDataType.SelectedIndex =(int)pLCItems.Type;
|
||||
iptAddress.Text= pLCItems.Address;
|
||||
}
|
||||
}
|
||||
|
||||
private void Button_cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
submit = false;
|
||||
this.Dispose();
|
||||
}
|
||||
|
||||
private void Button_ok_Click(object sender, EventArgs e)
|
||||
{
|
||||
sltName.Status = AntdUI.TType.None;
|
||||
//检查输入内容
|
||||
if (String.IsNullOrEmpty(sltName.Text))
|
||||
{
|
||||
sltName.Status = AntdUI.TType.Error;
|
||||
AntdUI.Message.warn(window, "参数名称不能为空!", autoClose: 3);
|
||||
return;
|
||||
}
|
||||
plcItem.Name = sltName.Text;
|
||||
plcItem.Address = iptAddress.Text;
|
||||
plcItem.Type = (EnumPLCDataType)sltDataType.SelectedIndex;
|
||||
if (sltDataType.SelectedIndex != 3)
|
||||
{
|
||||
plcItem.Value = iptValue.Text;
|
||||
}
|
||||
else
|
||||
{
|
||||
plcItem.Value = sltValue.Text;
|
||||
}
|
||||
|
||||
plcItem.StartExecute = sltEnable.SelectedIndex != 0;
|
||||
submit = true;
|
||||
this.Dispose();
|
||||
}
|
||||
|
||||
private void InitData()
|
||||
{
|
||||
|
||||
foreach (var item in plcItemList)
|
||||
{
|
||||
sltName.Items.Add(item.Name);
|
||||
}
|
||||
|
||||
var PLCDataTypes = Enum.GetNames(typeof(EnumPLCDataType));
|
||||
foreach (var name in PLCDataTypes)
|
||||
{
|
||||
sltDataType.Items.Add(name);
|
||||
}
|
||||
|
||||
var boolNames = Enum.GetNames(typeof(EnumBool));
|
||||
foreach (var name in boolNames)
|
||||
{
|
||||
sltEnable.Items.Add(name);
|
||||
}
|
||||
var bool1Names = Enum.GetNames(typeof(EnumBool1));
|
||||
foreach (var name in bool1Names)
|
||||
{
|
||||
sltValue.Items.Add(name);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(plcItem.Name))
|
||||
{
|
||||
sltName.Text = plcItem.Name;
|
||||
iptAddress.Text = plcItem.Address;
|
||||
sltDataType.SelectedIndex = (int)plcItem.Type;
|
||||
sltEnable.SelectedIndex = plcItem.StartExecute ? 1 : 0;
|
||||
if (sltDataType.SelectedIndex != 3)
|
||||
{
|
||||
iptValue.Text = plcItem.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
sltValue.SelectedIndex=plcItem.Value=="True"?1:0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void panel1_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -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>
|
42
DHSoftware/Views/SettingWindow.Designer.cs
generated
42
DHSoftware/Views/SettingWindow.Designer.cs
generated
@ -28,12 +28,10 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AntdUI.MenuItem menuItem1 = new AntdUI.MenuItem();
|
||||
AntdUI.MenuItem menuItem2 = new AntdUI.MenuItem();
|
||||
AntdUI.MenuItem menuItem3 = new AntdUI.MenuItem();
|
||||
AntdUI.MenuItem menuItem4 = new AntdUI.MenuItem();
|
||||
AntdUI.MenuItem menuItem5 = new AntdUI.MenuItem();
|
||||
AntdUI.Tabs.StyleCard styleCard1 = new AntdUI.Tabs.StyleCard();
|
||||
AntdUI.MenuItem menuItem6 = new AntdUI.MenuItem();
|
||||
AntdUI.Tabs.StyleCard styleCard2 = new AntdUI.Tabs.StyleCard();
|
||||
pageHeader1 = new AntdUI.PageHeader();
|
||||
panel1 = new AntdUI.Panel();
|
||||
panel2 = new AntdUI.StackPanel();
|
||||
@ -118,25 +116,15 @@
|
||||
//
|
||||
menu1.BackColor = SystemColors.Window;
|
||||
menu1.Dock = DockStyle.Top;
|
||||
menuItem1.Expand = false;
|
||||
menuItem1.IconSvg = "VideoCameraOutlined";
|
||||
menuItem1.Text = "相机设置";
|
||||
menuItem2.Expand = false;
|
||||
menuItem2.IconSvg = "AppstoreOutlined";
|
||||
menuItem2.Text = "工位设置";
|
||||
menuItem3.Expand = false;
|
||||
menuItem3.IconSvg = "ControlOutlined";
|
||||
menuItem3.Text = "运控设置";
|
||||
menuItem4.Expand = false;
|
||||
menuItem4.IconSvg = "BarsOutlined";
|
||||
menuItem5.IconSvg = "BarsOutlined";
|
||||
menuItem5.Text = "全局设置";
|
||||
menuItem4.Sub.Add(menuItem5);
|
||||
menuItem4.Text = "其他设置";
|
||||
menu1.Items.Add(menuItem1);
|
||||
menu1.Items.Add(menuItem2);
|
||||
menu1.Items.Add(menuItem3);
|
||||
menuItem4.IconSvg = "VideoCameraOutlined";
|
||||
menuItem4.Text = "相机设置";
|
||||
menuItem5.IconSvg = "AppstoreOutlined";
|
||||
menuItem5.Text = "工位设置";
|
||||
menuItem6.IconSvg = "ControlOutlined";
|
||||
menuItem6.Text = "运控设置";
|
||||
menu1.Items.Add(menuItem4);
|
||||
menu1.Items.Add(menuItem5);
|
||||
menu1.Items.Add(menuItem6);
|
||||
menu1.Location = new Point(0, 0);
|
||||
menu1.Name = "menu1";
|
||||
menu1.Size = new Size(141, 632);
|
||||
@ -164,8 +152,8 @@
|
||||
tabs1.Location = new Point(151, 33);
|
||||
tabs1.Name = "tabs1";
|
||||
tabs1.Size = new Size(891, 666);
|
||||
styleCard1.Closable = true;
|
||||
tabs1.Style = styleCard1;
|
||||
styleCard2.Closable = true;
|
||||
tabs1.Style = styleCard2;
|
||||
tabs1.TabIndex = 5;
|
||||
tabs1.Text = "tabs1";
|
||||
tabs1.Type = AntdUI.TabType.Card;
|
||||
@ -182,13 +170,13 @@
|
||||
divider1.Text = "";
|
||||
divider1.Vertical = true;
|
||||
//
|
||||
// SettingWindow
|
||||
// SettingWindow1
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 17F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1042, 699);
|
||||
Controls.Add(panel3);
|
||||
Name = "SettingWindow";
|
||||
Name = "SettingWindow1";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "SettingWinform";
|
||||
panel1.ResumeLayout(false);
|
||||
@ -207,6 +195,6 @@
|
||||
private AntdUI.Tabs tabs1;
|
||||
private AntdUI.Divider divider1;
|
||||
private AntdUI.Dropdown btnAdd;
|
||||
private AntdUI.Dropdown btnSave;
|
||||
private AntdUI.Button btnSave;
|
||||
}
|
||||
}
|
@ -173,51 +173,6 @@ namespace DHSoftware.Views
|
||||
currControl = control;
|
||||
}
|
||||
break;
|
||||
case "其他设置":
|
||||
foreach (var tab in tabs1.Pages)
|
||||
{
|
||||
if (tab is AntdUI.TabPage existingTab && existingTab.Text == $"{clickedItem.PARENTITEM.Text}-{clickedItem.Text}")
|
||||
{
|
||||
isUpdatingTabs = true;
|
||||
tabs1.SelectedTab = existingTab; // 直接跳转到已存在的 TabPage
|
||||
isUpdatingTabs = false;
|
||||
currControl = existingTab.Controls.Count > 0 ? existingTab.Controls[0] as UserControl : null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (clickedItem.Text == "全局设置")
|
||||
{
|
||||
//先获取是否存在该名称的配置
|
||||
//如果没有新建项
|
||||
GlobalConfig? global = ConfigModel
|
||||
.GlobalList.FirstOrDefault() ;
|
||||
if (global == null)
|
||||
{
|
||||
global = new GlobalConfig();
|
||||
}
|
||||
|
||||
UserControl control3 = null;
|
||||
control = new GlobalControl(this, global);
|
||||
if (control != null)
|
||||
{
|
||||
//容器添加控件,需要调整dpi
|
||||
control.Dock = DockStyle.Fill;
|
||||
AutoDpi(control);
|
||||
AntdUI.TabPage tabPage = new AntdUI.TabPage()
|
||||
{
|
||||
Text = $"{clickedItem.PARENTITEM.Text}-{clickedItem.Text}",
|
||||
ReadOnly = false,
|
||||
};
|
||||
tabPage.Controls.Add(control);
|
||||
tabs1.Pages.Add(tabPage);
|
||||
isUpdatingTabs = true;
|
||||
tabs1.SelectedTab = tabPage;
|
||||
isUpdatingTabs = false;
|
||||
currControl = control;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -231,6 +186,7 @@ namespace DHSoftware.Views
|
||||
btnAdd.Items.Add("相机设置");
|
||||
btnAdd.Items.Add("工位设置");
|
||||
btnAdd.Items.Add("运控设置");
|
||||
|
||||
x = Width;
|
||||
y = Height;
|
||||
AdaptiveHelper.setTag(this);
|
||||
@ -281,12 +237,6 @@ namespace DHSoftware.Views
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ConfigModel.GlobalList?.Count <= 0)
|
||||
{
|
||||
GlobalConfig globalConfig = new GlobalConfig();
|
||||
ConfigModel.GlobalList.Add(globalConfig);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void BtnSave_Click(object? sender, EventArgs e)
|
||||
@ -702,8 +652,6 @@ namespace DHSoftware.Views
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -73,48 +73,32 @@ namespace DHSoftware
|
||||
public ProductData( string batchNO, uint pieceNumber, int inferenceLeft = -1) : this(pieceNumber)
|
||||
{
|
||||
InferenceLeft = inferenceLeft;
|
||||
//_countdownEvent = new CountdownEvent(inferenceLeft);
|
||||
_countdownEvent = new CountdownEvent(inferenceLeft);
|
||||
|
||||
BatchNO = batchNO;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//public void InferenceOne()
|
||||
//{
|
||||
// //lock (_inferenceLock)
|
||||
// //{
|
||||
// // Interlocked.Decrement(ref InferenceLeft);
|
||||
// //}
|
||||
|
||||
|
||||
// _countdownEvent.Signal();
|
||||
|
||||
//}
|
||||
|
||||
//public bool InferenceFinished()
|
||||
//{
|
||||
// //lock (_inferenceLock)
|
||||
// //{
|
||||
// // return 0 == InferenceLeft;
|
||||
// //}
|
||||
// return _countdownEvent.CurrentCount == 0; // 判断计数器是否为 0
|
||||
//}
|
||||
public void InferenceOne()
|
||||
{
|
||||
lock (_inferenceLock)
|
||||
{
|
||||
Interlocked.Decrement(ref InferenceLeft);
|
||||
//lock (_inferenceLock)
|
||||
//{
|
||||
// Interlocked.Decrement(ref InferenceLeft);
|
||||
//}
|
||||
|
||||
|
||||
_countdownEvent.Signal();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public bool InferenceFinished()
|
||||
{
|
||||
lock (_inferenceLock)
|
||||
{
|
||||
return 0 == InferenceLeft;
|
||||
}
|
||||
//lock (_inferenceLock)
|
||||
//{
|
||||
// return 0 == InferenceLeft;
|
||||
//}
|
||||
return _countdownEvent.CurrentCount == 0; // 判断计数器是否为 0
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user