提交bug
This commit is contained in:
parent
77b75050b2
commit
6973d39cad
@ -11,6 +11,9 @@ namespace DH.Commons.Base
|
||||
{
|
||||
public class GlobalConfig : NotifyProperty
|
||||
{
|
||||
bool _EnableVibrator=false;
|
||||
bool _EnableBelt = false;
|
||||
int _ClearTime=0;
|
||||
string _name;
|
||||
private BindingList<PLCItem> _InitProcessList = new BindingList<PLCItem>();
|
||||
private BindingList<PLCItem> _StartProcessList = new BindingList<PLCItem>();
|
||||
@ -29,7 +32,42 @@ namespace DH.Commons.Base
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool EnableBelt
|
||||
{
|
||||
get => _EnableBelt;
|
||||
set
|
||||
{
|
||||
if (_EnableBelt != value)
|
||||
{
|
||||
_EnableBelt = value;
|
||||
OnPropertyChanged(nameof(EnableBelt));
|
||||
}
|
||||
}
|
||||
}
|
||||
public bool EnableVibrator
|
||||
{
|
||||
get => _EnableVibrator;
|
||||
set
|
||||
{
|
||||
if (_EnableVibrator != value)
|
||||
{
|
||||
_EnableVibrator = value;
|
||||
OnPropertyChanged(nameof(EnableVibrator));
|
||||
}
|
||||
}
|
||||
}
|
||||
public int ClearTime
|
||||
{
|
||||
get => _ClearTime;
|
||||
set
|
||||
{
|
||||
if (_ClearTime != value)
|
||||
{
|
||||
_ClearTime = value;
|
||||
OnPropertyChanged(nameof(ClearTime));
|
||||
}
|
||||
}
|
||||
}
|
||||
public BindingList<PLCItem> InitProcessList
|
||||
{
|
||||
get => _InitProcessList;
|
||||
|
@ -156,7 +156,10 @@ namespace DH.Devices.Camera
|
||||
}
|
||||
//全画幅
|
||||
if (!IsAllPicEnabled)
|
||||
{
|
||||
SetPictureRoi((int)ROIX, (int)ROIY, (int)ROIW, (int)ROIH);
|
||||
}
|
||||
|
||||
|
||||
//// 设置 触发延迟
|
||||
if (TriggerDelay > 0)
|
||||
|
@ -822,25 +822,73 @@ namespace DH.Devices.PLC
|
||||
//流程开启操作配置
|
||||
// ProcessInitialAction();
|
||||
// if (_PLC?Enabled == true)
|
||||
//皮带
|
||||
// _PLC.Belt(true);
|
||||
|
||||
|
||||
|
||||
// LogAsync(DateTime.Now, LogLevel.Information, $"写入流程加载点位配置");
|
||||
|
||||
bool? enableBelt = ConfigModel.GlobalList?.FirstOrDefault()?.EnableBelt;
|
||||
if (enableBelt == true)
|
||||
{
|
||||
Belt(true);
|
||||
}
|
||||
Thread.Sleep(1000);
|
||||
bool? enableVibrator = ConfigModel.GlobalList?.FirstOrDefault()?.EnableVibrator;
|
||||
if (enableVibrator == true)
|
||||
{
|
||||
Vibrator(true);
|
||||
}
|
||||
Thread.Sleep(1000);
|
||||
//转盘使能
|
||||
TurnEnable(true);
|
||||
//转盘启动
|
||||
TurnStart(true);
|
||||
Thread.Sleep(1000);
|
||||
//计数清零
|
||||
CountToZero();
|
||||
LogAsync(DateTime.Now, LogLevel.Information, $"状态复位-关闭定位-写入流程加载点位配置-计数清零");
|
||||
//转盘启动
|
||||
TurnStart(true);
|
||||
|
||||
Thread.Sleep(200);
|
||||
}
|
||||
|
||||
public void StopProcess()
|
||||
{
|
||||
StatusReset();
|
||||
VisionPos(false);
|
||||
CountToZero();
|
||||
bool? enableVibrator = ConfigModel.GlobalList?.FirstOrDefault()?.EnableVibrator;
|
||||
if (enableVibrator == true)
|
||||
{
|
||||
Vibrator(true);
|
||||
}
|
||||
Thread.Sleep(1000);
|
||||
bool? enableBelt = ConfigModel.GlobalList?.FirstOrDefault()?.EnableBelt;
|
||||
if (enableBelt == true)
|
||||
{
|
||||
Belt(false);
|
||||
}
|
||||
Thread.Sleep(1000);
|
||||
StopProcessAction();
|
||||
TurnStart(false);
|
||||
// LogAsync(DateTime.Now, LogLevel.Information, $"PLC断开连接");
|
||||
LogAsync(DateTime.Now, LogLevel.Action, $"流程停止");
|
||||
Task.Run(async () => {
|
||||
|
||||
await ExecuteClearDelayAsync();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public async Task ExecuteClearDelayAsync()
|
||||
{
|
||||
int? clearTime = ConfigModel.GlobalList?.FirstOrDefault()?.ClearTime;
|
||||
if (clearTime != null)
|
||||
{
|
||||
LogAsync(DateTime.Now, LogLevel.Action, $"转盘清料开始");
|
||||
TurnClear(true);
|
||||
await Task.Delay(clearTime.Value * 1000);
|
||||
LogAsync(DateTime.Now, LogLevel.Action, $"转盘清料完成");
|
||||
TurnClear(false);
|
||||
}
|
||||
}
|
||||
public void CloseProcess()
|
||||
{
|
||||
@ -850,6 +898,7 @@ namespace DH.Devices.PLC
|
||||
TurnStart(false);
|
||||
TurnEnable(false);
|
||||
StopProcessAction();
|
||||
TurnClear(false);
|
||||
OpenHeartbeat(false);
|
||||
PLCDisConnect();
|
||||
// LogAsync(DateTime.Now, LogLevel.Information, $"PLC断开连接");
|
||||
@ -1014,6 +1063,25 @@ namespace DH.Devices.PLC
|
||||
WriteBool(pLCItem.Address, b);
|
||||
Thread.Sleep(30);
|
||||
}
|
||||
|
||||
public void Belt(bool b)
|
||||
{
|
||||
PLCItem? pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "皮带");
|
||||
if (pLCItem == null)
|
||||
return;
|
||||
WriteBool(pLCItem.Address, b);
|
||||
Thread.Sleep(30);
|
||||
|
||||
}
|
||||
public void Vibrator(bool b)
|
||||
{
|
||||
PLCItem? pLCItem = PLCItemList.FirstOrDefault(u => u.Name == "振动盘");
|
||||
if (pLCItem == null)
|
||||
return;
|
||||
WriteBool(pLCItem.Address, b);
|
||||
Thread.Sleep(30);
|
||||
|
||||
}
|
||||
public void Motor(bool direction, int speed, int pos)
|
||||
{
|
||||
|
||||
@ -1143,7 +1211,13 @@ namespace DH.Devices.PLC
|
||||
elapsedTime += checkInterval;
|
||||
}
|
||||
|
||||
|
||||
BarrierToZero(false);
|
||||
Thread.Sleep(300);
|
||||
// 检查是否不在原点,如果不在,则回原点
|
||||
BarrierClockwise(false);
|
||||
Thread.Sleep(300);
|
||||
BarrierCounterclockwise(false);
|
||||
Thread.Sleep(300);
|
||||
// 无论是刚回到原点还是已经在原点,执行目标位置、速度和方向设置
|
||||
BarrierSpeed(speed);
|
||||
Thread.Sleep(300);
|
||||
|
@ -93,10 +93,12 @@
|
||||
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="db\db.sqlite">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="db\db.sqlite">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<!-- 仅在首次生成时复制 -->
|
||||
<Condition>!Exists('$(OutputPath)\db\db.sqlite')</Condition>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -656,6 +656,7 @@ namespace DHSoftware
|
||||
cam.Exposure = cameraBase.Exposure;
|
||||
cam.Gain = cameraBase.Gain;
|
||||
cam.RotateImage = cameraBase.RotateImage;
|
||||
cam.IsAllPicEnabled=cameraBase.IsAllPicEnabled;
|
||||
cam.ROIX= cameraBase.ROIX;
|
||||
cam.ROIH= cameraBase.ROIH;
|
||||
cam.ROIW= cameraBase.ROIW;
|
||||
@ -1083,6 +1084,8 @@ namespace DHSoftware
|
||||
{
|
||||
if (_monitorThread == null || !_monitorThread.IsAlive)
|
||||
{
|
||||
//关闭按钮自身功能(比如按按钮转盘自己启动等)
|
||||
PLC.WriteBool("M40", true);
|
||||
_isRunning = true;
|
||||
_monitorThread = new Thread(MonitorPlcButtons);
|
||||
_monitorThread.IsBackground = true; // 后台线程
|
||||
@ -1144,6 +1147,7 @@ namespace DHSoftware
|
||||
{
|
||||
_monitorThread.Join(1000); // 等待线程退出
|
||||
}
|
||||
PLC.WriteBool("M40", false);
|
||||
}
|
||||
private bool _isClosing = false; // 状态标志
|
||||
|
||||
@ -1269,6 +1273,7 @@ namespace DHSoftware
|
||||
LogAsync(DateTime.Now, LogLevel.Information, "流程启动中,请稍候...");
|
||||
ResetAllCameraCounts();
|
||||
//开始流程
|
||||
|
||||
StartProcess();
|
||||
LogAsync(DateTime.Now, LogLevel.Action, "流程启动完成!");
|
||||
}
|
||||
@ -1371,9 +1376,8 @@ namespace DHSoftware
|
||||
//mOfflineImageTimer.Start();
|
||||
|
||||
#endregion 虚拟相机
|
||||
//流程执行时PLC
|
||||
PLC.StartProcess();
|
||||
LogAsync(DateTime.Now, LogLevel.Action, "流程启动11111111111完成!");
|
||||
|
||||
|
||||
///这里会执行完成后,会造成后台线程断断续续,会造成界面UI卡顿
|
||||
//var settings = ConfigModel.DetectionList.Where(u => u.IsEnabled && u.IsAddStation).ToList();
|
||||
//if (settings != null)
|
||||
@ -1417,7 +1421,8 @@ namespace DHSoftware
|
||||
|
||||
|
||||
InitialOEEStatistic();
|
||||
|
||||
//流程执行时PLC
|
||||
PLC.StartProcess();
|
||||
CurrentMachine = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -1863,6 +1868,7 @@ namespace DHSoftware
|
||||
// Add the code for the "停止" button click here
|
||||
PLC.StopProcess();
|
||||
CurrentMachine = false;
|
||||
|
||||
//sLDMotion.Stop();
|
||||
}
|
||||
|
||||
|
107
DHSoftware/Views/GlobalControl.Designer.cs
generated
107
DHSoftware/Views/GlobalControl.Designer.cs
generated
@ -28,7 +28,7 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AntdUI.Tabs.StyleLine styleLine1 = new AntdUI.Tabs.StyleLine();
|
||||
AntdUI.Tabs.StyleLine styleLine2 = new AntdUI.Tabs.StyleLine();
|
||||
tabs1 = new AntdUI.Tabs();
|
||||
tabPage6 = new AntdUI.TabPage();
|
||||
tabPage1 = new AntdUI.TabPage();
|
||||
@ -56,7 +56,16 @@
|
||||
panel5 = new AntdUI.Panel();
|
||||
btnStopResetDelete = new AntdUI.Button();
|
||||
btnStopResetAdd = new AntdUI.Button();
|
||||
panel6 = new AntdUI.Panel();
|
||||
panel7 = new AntdUI.Panel();
|
||||
uiLabel1 = new Sunny.UI.UILabel();
|
||||
swhEnableVibrator = new AntdUI.Switch();
|
||||
swhEnableBelt = new AntdUI.Switch();
|
||||
uiLabel2 = new Sunny.UI.UILabel();
|
||||
uiLabel3 = new Sunny.UI.UILabel();
|
||||
iptClearTime = new AntdUI.Input();
|
||||
tabs1.SuspendLayout();
|
||||
tabPage6.SuspendLayout();
|
||||
tabPage1.SuspendLayout();
|
||||
panel1.SuspendLayout();
|
||||
tabPage2.SuspendLayout();
|
||||
@ -67,6 +76,7 @@
|
||||
panel4.SuspendLayout();
|
||||
tabPage5.SuspendLayout();
|
||||
panel5.SuspendLayout();
|
||||
panel6.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
// tabs1
|
||||
@ -81,13 +91,14 @@
|
||||
tabs1.Pages.Add(tabPage4);
|
||||
tabs1.Pages.Add(tabPage5);
|
||||
tabs1.Size = new Size(898, 530);
|
||||
tabs1.Style = styleLine1;
|
||||
tabs1.Style = styleLine2;
|
||||
tabs1.TabIndex = 26;
|
||||
tabs1.Text = "tabs1";
|
||||
tabs1.SelectedIndex = 1;
|
||||
//
|
||||
// tabPage6
|
||||
//
|
||||
tabPage6.Controls.Add(panel7);
|
||||
tabPage6.Controls.Add(panel6);
|
||||
tabPage6.Location = new Point(3, 28);
|
||||
tabPage6.Name = "tabPage6";
|
||||
tabPage6.Size = new Size(892, 499);
|
||||
@ -372,6 +383,86 @@
|
||||
btnStopResetAdd.Type = AntdUI.TTypeMini.Primary;
|
||||
btnStopResetAdd.WaveSize = 0;
|
||||
//
|
||||
// panel6
|
||||
//
|
||||
panel6.Controls.Add(iptClearTime);
|
||||
panel6.Controls.Add(uiLabel3);
|
||||
panel6.Controls.Add(swhEnableBelt);
|
||||
panel6.Controls.Add(uiLabel2);
|
||||
panel6.Controls.Add(swhEnableVibrator);
|
||||
panel6.Controls.Add(uiLabel1);
|
||||
panel6.Dock = DockStyle.Left;
|
||||
panel6.Location = new Point(0, 0);
|
||||
panel6.Name = "panel6";
|
||||
panel6.Size = new Size(427, 499);
|
||||
panel6.TabIndex = 0;
|
||||
panel6.Text = "panel6";
|
||||
//
|
||||
// panel7
|
||||
//
|
||||
panel7.Dock = DockStyle.Fill;
|
||||
panel7.Location = new Point(427, 0);
|
||||
panel7.Name = "panel7";
|
||||
panel7.Size = new Size(465, 499);
|
||||
panel7.TabIndex = 1;
|
||||
panel7.Text = "panel7";
|
||||
//
|
||||
// uiLabel1
|
||||
//
|
||||
uiLabel1.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
uiLabel1.ForeColor = Color.FromArgb(48, 48, 48);
|
||||
uiLabel1.Location = new Point(28, 36);
|
||||
uiLabel1.Name = "uiLabel1";
|
||||
uiLabel1.Size = new Size(63, 23);
|
||||
uiLabel1.TabIndex = 0;
|
||||
uiLabel1.Text = "振动盘";
|
||||
//
|
||||
// swhEnableVibrator
|
||||
//
|
||||
swhEnableVibrator.CheckedText = "启用";
|
||||
swhEnableVibrator.Location = new Point(97, 26);
|
||||
swhEnableVibrator.Name = "swhEnableVibrator";
|
||||
swhEnableVibrator.Size = new Size(94, 33);
|
||||
swhEnableVibrator.TabIndex = 50;
|
||||
swhEnableVibrator.UnCheckedText = "关闭";
|
||||
//
|
||||
// swhEnableBelt
|
||||
//
|
||||
swhEnableBelt.CheckedText = "启用";
|
||||
swhEnableBelt.Location = new Point(97, 82);
|
||||
swhEnableBelt.Name = "swhEnableBelt";
|
||||
swhEnableBelt.Size = new Size(94, 33);
|
||||
swhEnableBelt.TabIndex = 52;
|
||||
swhEnableBelt.UnCheckedText = "关闭";
|
||||
//
|
||||
// uiLabel2
|
||||
//
|
||||
uiLabel2.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
uiLabel2.ForeColor = Color.FromArgb(48, 48, 48);
|
||||
uiLabel2.Location = new Point(28, 92);
|
||||
uiLabel2.Name = "uiLabel2";
|
||||
uiLabel2.Size = new Size(63, 23);
|
||||
uiLabel2.TabIndex = 51;
|
||||
uiLabel2.Text = "皮带";
|
||||
//
|
||||
// uiLabel3
|
||||
//
|
||||
uiLabel3.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point, 134);
|
||||
uiLabel3.ForeColor = Color.FromArgb(48, 48, 48);
|
||||
uiLabel3.Location = new Point(17, 142);
|
||||
uiLabel3.Name = "uiLabel3";
|
||||
uiLabel3.Size = new Size(74, 23);
|
||||
uiLabel3.TabIndex = 53;
|
||||
uiLabel3.Text = "清料时间";
|
||||
//
|
||||
// iptClearTime
|
||||
//
|
||||
iptClearTime.Location = new Point(97, 131);
|
||||
iptClearTime.Name = "iptClearTime";
|
||||
iptClearTime.Size = new Size(94, 43);
|
||||
iptClearTime.TabIndex = 54;
|
||||
iptClearTime.Text = "0";
|
||||
//
|
||||
// GlobalControl
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 17F);
|
||||
@ -380,6 +471,7 @@
|
||||
Name = "GlobalControl";
|
||||
Size = new Size(898, 530);
|
||||
tabs1.ResumeLayout(false);
|
||||
tabPage6.ResumeLayout(false);
|
||||
tabPage1.ResumeLayout(false);
|
||||
panel1.ResumeLayout(false);
|
||||
tabPage2.ResumeLayout(false);
|
||||
@ -390,6 +482,7 @@
|
||||
panel4.ResumeLayout(false);
|
||||
tabPage5.ResumeLayout(false);
|
||||
panel5.ResumeLayout(false);
|
||||
panel6.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
@ -421,5 +514,13 @@
|
||||
private AntdUI.Button btnAdd;
|
||||
private AntdUI.Button btnDelete;
|
||||
private AntdUI.TabPage tabPage6;
|
||||
private AntdUI.Panel panel7;
|
||||
private AntdUI.Panel panel6;
|
||||
private Sunny.UI.UILabel uiLabel1;
|
||||
private AntdUI.Switch swhEnableBelt;
|
||||
private Sunny.UI.UILabel uiLabel2;
|
||||
private AntdUI.Switch swhEnableVibrator;
|
||||
private Sunny.UI.UILabel uiLabel3;
|
||||
private AntdUI.Input iptClearTime;
|
||||
}
|
||||
}
|
||||
|
@ -690,8 +690,11 @@ namespace DHSoftware.Views
|
||||
|
||||
private void InitData()
|
||||
{
|
||||
|
||||
|
||||
|
||||
// 启用状态绑定
|
||||
swhEnableVibrator.DataBindings.Add("Checked", global, "EnableVibrator", true, DataSourceUpdateMode.OnPropertyChanged);
|
||||
swhEnableBelt.DataBindings.Add("Checked", global, "EnableBelt", true, DataSourceUpdateMode.OnPropertyChanged);
|
||||
iptClearTime.DataBindings.Add("Text", global, "ClearTime", true, DataSourceUpdateMode.OnPropertyChanged);
|
||||
|
||||
TableInitProcess.Columns = new ColumnCollection() {
|
||||
new ColumnCheck("Selected"){Fixed = true},
|
||||
|
@ -59,6 +59,19 @@ namespace DHSoftware.Views
|
||||
switch (clickedItem.PARENTITEM.Text)
|
||||
{
|
||||
case "相机设置":
|
||||
bool b = false;
|
||||
if (ButtonPermissionList.Count > 0)
|
||||
{
|
||||
foreach (var item in ButtonPermissionList)
|
||||
{
|
||||
if (item.EnCode == "sys-cameraset")
|
||||
{
|
||||
b = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!b) { AntdUI.Message.warn(this, $"对不起,无权限访问相机设置!", autoClose: 3); return; }
|
||||
foreach (var tab in tabs1.Pages)
|
||||
{
|
||||
if (tab is AntdUI.TabPage existingTab && existingTab.Text == $"{clickedItem.PARENTITEM.Text}-{clickedItem.Text}")
|
||||
@ -99,6 +112,19 @@ namespace DHSoftware.Views
|
||||
break;
|
||||
|
||||
case "工位设置":
|
||||
bool b1 = false;
|
||||
if (ButtonPermissionList.Count > 0)
|
||||
{
|
||||
foreach (var item in ButtonPermissionList)
|
||||
{
|
||||
if (item.EnCode == "sys-stationset")
|
||||
{
|
||||
b1 = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!b1) { AntdUI.Message.warn(this, $"对不起,无权限访问工位设置!", autoClose: 3); return; }
|
||||
// 检查是否已存在同名 TabPage
|
||||
foreach (var tab in tabs1.Pages)
|
||||
{
|
||||
@ -146,6 +172,19 @@ namespace DHSoftware.Views
|
||||
break;
|
||||
|
||||
case "运控设置":
|
||||
bool b2 = false;
|
||||
if (ButtonPermissionList.Count > 0)
|
||||
{
|
||||
foreach (var item in ButtonPermissionList)
|
||||
{
|
||||
if (item.EnCode == "sys-motionset")
|
||||
{
|
||||
b2 = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!b2) { AntdUI.Message.warn(this, $"对不起,无权限访问运控设置!", autoClose: 3); return; }
|
||||
foreach (var tab in tabs1.Pages)
|
||||
{
|
||||
if (tab is AntdUI.TabPage existingTab && existingTab.Text == $"{clickedItem.PARENTITEM.Text}-{clickedItem.Text}")
|
||||
@ -185,6 +224,19 @@ namespace DHSoftware.Views
|
||||
}
|
||||
break;
|
||||
case "其他设置":
|
||||
bool b3 = false;
|
||||
if (ButtonPermissionList.Count > 0)
|
||||
{
|
||||
foreach (var item in ButtonPermissionList)
|
||||
{
|
||||
if (item.EnCode == "sys-globalset")
|
||||
{
|
||||
b3 = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!b3) { AntdUI.Message.warn(this, $"对不起,无权限访问其他设置!", autoClose: 3); return; }
|
||||
foreach (var tab in tabs1.Pages)
|
||||
{
|
||||
if (tab is AntdUI.TabPage existingTab && existingTab.Text == $"{clickedItem.PARENTITEM.Text}-{clickedItem.Text}")
|
||||
@ -329,15 +381,30 @@ namespace DHSoftware.Views
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private List<SysPermission> _buttonPermissionList = new List<SysPermission>();
|
||||
private readonly object _permissionLock = new object();
|
||||
|
||||
/// <summary>
|
||||
/// 按钮权限列表(线程安全)
|
||||
/// </summary>
|
||||
public List<SysPermission> ButtonPermissionList
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (_permissionLock)
|
||||
{
|
||||
return new List<SysPermission>(_buttonPermissionList); // 返回副本避免外部修改
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
List<SysPermission> list = value;
|
||||
SetPermission(list, this.Controls);
|
||||
lock (_permissionLock)
|
||||
{
|
||||
_buttonPermissionList = value ?? new List<SysPermission>();
|
||||
SetPermission(_buttonPermissionList, this.Controls); // 应用权限到控件
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetPermission(List<SysPermission> list, Control.ControlCollection controls)
|
||||
{
|
||||
foreach (Control control in controls)
|
||||
@ -453,7 +520,19 @@ namespace DHSoftware.Views
|
||||
{
|
||||
if (e.Button == MouseButtons.Right)
|
||||
{
|
||||
|
||||
bool b = false;
|
||||
if (ButtonPermissionList.Count > 0)
|
||||
{
|
||||
foreach(var item in ButtonPermissionList)
|
||||
{
|
||||
if (item.EnCode == "sys-setright")
|
||||
{
|
||||
b= true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!b) { return; }
|
||||
var menu = sender as Menu;
|
||||
if (menu == null) return;
|
||||
|
||||
|
@ -462,7 +462,6 @@
|
||||
//
|
||||
iptBarrierPos.Location = new Point(284, 0);
|
||||
iptBarrierPos.Name = "iptBarrierPos";
|
||||
iptBarrierPos.ReadOnly = true;
|
||||
iptBarrierPos.Size = new Size(175, 43);
|
||||
iptBarrierPos.TabIndex = 20;
|
||||
iptBarrierPos.Text = "0";
|
||||
|
@ -175,7 +175,7 @@ namespace DHSoftware.Views
|
||||
AntdUI.Message.warn(this, "挡料电机速度值无效");
|
||||
return;
|
||||
}
|
||||
if (!int.TryParse(iptBarrierPos.Text, out int barrierPos) || speed == 0)
|
||||
if (!int.TryParse(iptBarrierPos.Text, out int barrierPos) || barrierPos == 0)
|
||||
{
|
||||
AntdUI.Message.warn(this, "挡料电机位置值无效");
|
||||
return;
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user