1.三色灯提交

2.设置重命名时带出之前名称
This commit is contained in:
liyaobang 2025-04-27 09:26:18 +08:00
parent b749eb4266
commit ed53c8e5db
5 changed files with 36 additions and 130 deletions

View File

@ -760,6 +760,12 @@ namespace DH.Devices.PLC
//LogAsync(DateTime.Now, LogLevel.Information, $"停止转盘"); //LogAsync(DateTime.Now, LogLevel.Information, $"停止转盘");
//转盘使能 //转盘使能
TurnEnable(true); TurnEnable(true);
RedLight(false);
YellowLight(false);
//绿灯
GreenLight(true);
LogAsync(DateTime.Now, LogLevel.Information, $"启用心跳-状态复位-关闭定位-写入流程加载点位配置-计数清零-停止转盘-转盘使能"); LogAsync(DateTime.Now, LogLevel.Information, $"启用心跳-状态复位-关闭定位-写入流程加载点位配置-计数清零-停止转盘-转盘使能");
//开启入料监听 //开启入料监听
MonitorPieces(); MonitorPieces();
@ -847,8 +853,7 @@ namespace DH.Devices.PLC
//计数清零 //计数清零
CountToZero(); CountToZero();
Thread.Sleep(1000); Thread.Sleep(1000);
//绿灯
GreenLight(true);
LogAsync(DateTime.Now, LogLevel.Information, $"状态复位-关闭定位-写入流程加载点位配置-计数清零"); LogAsync(DateTime.Now, LogLevel.Information, $"状态复位-关闭定位-写入流程加载点位配置-计数清零");
Thread.Sleep(200); Thread.Sleep(200);
@ -898,6 +903,9 @@ namespace DH.Devices.PLC
StopProcessAction(); StopProcessAction();
TurnClear(false); TurnClear(false);
OpenHeartbeat(false); OpenHeartbeat(false);
GreenLight(false);
YellowLight(false);
RedLight(true);
PLCDisConnect(); PLCDisConnect();
// LogAsync(DateTime.Now, LogLevel.Information, $"PLC断开连接"); // LogAsync(DateTime.Now, LogLevel.Information, $"PLC断开连接");
} }

View File

@ -57,132 +57,9 @@ namespace DHSoftware
public event Action<DateTime, object, string> OnUpdateResult; public event Action<DateTime, object, string> OnUpdateResult;
public event Action<DateTime, object, string> OnUpdateCamResult; public event Action<DateTime, object, string> OnUpdateCamResult;
private string _loginName;
public string LoginName
{
get { return _loginName; }
set
{
_loginName = value;
UpdateLabel();
}
}
private bool _ShowConfig;
public bool ShowConfig
{
get { return _ShowConfig; }
set
{
_ShowConfig = value;
UpdateConfig();
}
}
private bool _addscheme;
public bool Addscheme
{
get { return _addscheme; }
set
{
_addscheme = value;
UpdateScheme();
}
}
private bool _deletescheme;
public bool Deleteschememe
{
get { return _deletescheme; }
set
{
_deletescheme = value;
UpdateScheme();
}
}
private bool _loadscheme;
public bool Loadscheme
{
get { return _loadscheme; }
set
{
_loadscheme = value;
UpdateScheme();
}
}
private void UpdateScheme()
{
if (this.InvokeRequired)
{
this.Invoke(new Action(UpdateScheme));
return;
}
if (Loadscheme)
{
btnDeleteProject.Visible = true;
}
else
{
btnDeleteProject.Visible = false;
}
if (Addscheme)
{
btnAddProject.Visible = true;
}
else
{
btnAddProject.Visible = false;
}
if (Deleteschememe)
{
btnLoadProject.Visible = true;
}
else
{
btnLoadProject.Visible = false;
}
}
private void UpdateLabel()
{
if (lbName.InvokeRequired)
{
lbName.Invoke(new Action(UpdateLabel));
return;
}
lbName.Text = _loginName;
}
private void UpdateConfig()
{
if (ShowConfig)
{
if (segmented1.InvokeRequired)
{
segmented1.Invoke(new Action(UpdateConfig));
return;
}
// 恢复显示时
segmented1.Items.Insert(4, itemToHide);
}
else
{
if (segmented1.InvokeRequired)
{
segmented1.Invoke(new Action(UpdateConfig));
return;
}
segmented1.Items.Remove(itemToHide);
}
}
public List<SysPermission> ButtonPermissionList public List<SysPermission> ButtonPermissionList
{ {
set set
@ -1178,11 +1055,13 @@ namespace DHSoftware
{ {
camera.CameraDisConnect(); camera.CameraDisConnect();
} }
StopMonitoring();
if (PLC != null) if (PLC != null)
{ {
PLC.CloseProcess(); PLC.CloseProcess();
} }
StopMonitoring();
_visionEngine.Stop();//释放模型 _visionEngine.Stop();//释放模型
CloseWindow.Instance.Close();// 关闭提示窗口 CloseWindow.Instance.Close();// 关闭提示窗口
//Application.Exit(); //Application.Exit();

View File

@ -13,6 +13,7 @@ namespace DHSoftware.Views
InitializeComponent(); InitializeComponent();
lbTitleName.Text = TitleName; lbTitleName.Text = TitleName;
// 绑定事件 // 绑定事件
BindEventHandler(); BindEventHandler();
} }
@ -21,6 +22,12 @@ namespace DHSoftware.Views
{ {
button_ok.Click += Button_ok_Click; button_ok.Click += Button_ok_Click;
button_cancel.Click += Button_cancel_Click; button_cancel.Click += Button_cancel_Click;
Load += AddCameraControl_Load;
}
private void AddCameraControl_Load(object? sender, EventArgs e)
{
input_name.Text = CubicleName;
} }
private void Button_cancel_Click(object sender, EventArgs e) private void Button_cancel_Click(object sender, EventArgs e)

View File

@ -28,6 +28,13 @@ namespace DHSoftware.Views
{ {
button_ok.Click += Button_ok_Click; button_ok.Click += Button_ok_Click;
button_cancel.Click += Button_cancel_Click; button_cancel.Click += Button_cancel_Click;
Load += AddCubicleControl_Load;
}
private void AddCubicleControl_Load(object? sender, EventArgs e)
{
input_name.Text = CubicleName;
sltdetectionType.SelectedIndex =(int)DetectionType;
} }
private void Button_cancel_Click(object sender, EventArgs e) private void Button_cancel_Click(object sender, EventArgs e)

View File

@ -7,6 +7,7 @@ using DH.Commons.Base;
using DH.RBAC.Model.Sys; using DH.RBAC.Model.Sys;
using System.Reflection; using System.Reflection;
using ScrollBar = AntdUI.ScrollBar; using ScrollBar = AntdUI.ScrollBar;
using DH.Commons.Enums;
namespace DHSoftware.Views namespace DHSoftware.Views
{ {
@ -594,7 +595,8 @@ namespace DHSoftware.Views
{ {
Size = new Size(300, 200), Size = new Size(300, 200),
// 传递当前名称到表单 // 传递当前名称到表单
CubicleName = originalName CubicleName = originalName,
}; };
AntdUI.Modal.open(new AntdUI.Modal.Config(this, "", form, TType.None) AntdUI.Modal.open(new AntdUI.Modal.Config(this, "", form, TType.None)
@ -674,12 +676,14 @@ namespace DHSoftware.Views
case "重命名": case "重命名":
// 保存原始名称用于查找 // 保存原始名称用于查找
string originalName = clickedItem.Text; string originalName = clickedItem.Text;
EnumDetectionType enumDetectionType= ConfigModel.DetectionList.FirstOrDefault(c =>
c.Name.Equals(originalName, StringComparison.OrdinalIgnoreCase)).DetectionType;
var form = new AddCubicleControl(this, "重命名工位操作") var form = new AddCubicleControl(this, "重命名工位操作")
{ {
Size = new Size(300, 500), Size = new Size(300, 500),
// 传递当前名称到表单 // 传递当前名称到表单
CubicleName = originalName CubicleName = originalName,
DetectionType = enumDetectionType
}; };
AntdUI.Modal.open(new AntdUI.Modal.Config(this, "", form, TType.None) AntdUI.Modal.open(new AntdUI.Modal.Config(this, "", form, TType.None)
@ -703,6 +707,7 @@ namespace DHSoftware.Views
var detection = ConfigModel.DetectionList.FirstOrDefault(c => var detection = ConfigModel.DetectionList.FirstOrDefault(c =>
c.Name.Equals(originalName, StringComparison.OrdinalIgnoreCase)); c.Name.Equals(originalName, StringComparison.OrdinalIgnoreCase));
detection.Name = newName; detection.Name = newName;
detection.DetectionType = form.DetectionType;
foreach (var tab in tabs1.Pages) foreach (var tab in tabs1.Pages)
{ {
if (tab is AntdUI.TabPage existingTab && existingTab.Text == $"{clickedItem.PARENTITEM.Text}-{originalName}") if (tab is AntdUI.TabPage existingTab && existingTab.Text == $"{clickedItem.PARENTITEM.Text}-{originalName}")