Commit d731fd6c LN

增加新安全门禁

1 个父辈 5cee8200
...@@ -105,6 +105,7 @@ ...@@ -105,6 +105,7 @@
this.toolStripSeparator15 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator15 = new System.Windows.Forms.ToolStripSeparator();
this.启用蜂鸣器ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.启用蜂鸣器ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator25 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator25 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator17 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator17 = new System.Windows.Forms.ToolStripSeparator();
this.自动保存托盘信息ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.自动保存托盘信息ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.contextMenuStrip_control = new System.Windows.Forms.ContextMenuStrip(this.components); this.contextMenuStrip_control = new System.Windows.Forms.ContextMenuStrip(this.components);
...@@ -796,6 +797,7 @@ ...@@ -796,6 +797,7 @@
this.toolStripSeparator15, this.toolStripSeparator15,
this.启用蜂鸣器ToolStripMenuItem, this.启用蜂鸣器ToolStripMenuItem,
this.toolStripSeparator25, this.toolStripSeparator25,
this.toolStripMenuItem4,
this.toolStripSeparator17, this.toolStripSeparator17,
this.自动保存托盘信息ToolStripMenuItem}); this.自动保存托盘信息ToolStripMenuItem});
this.运行参数ToolStripMenuItem.Name = "运行参数ToolStripMenuItem"; this.运行参数ToolStripMenuItem.Name = "运行参数ToolStripMenuItem";
...@@ -826,11 +828,17 @@ ...@@ -826,11 +828,17 @@
this.toolStripSeparator25.Name = "toolStripSeparator25"; this.toolStripSeparator25.Name = "toolStripSeparator25";
this.toolStripSeparator25.Size = new System.Drawing.Size(177, 6); this.toolStripSeparator25.Size = new System.Drawing.Size(177, 6);
// //
// toolStripMenuItem4
//
this.toolStripMenuItem4.Name = "toolStripMenuItem4";
this.toolStripMenuItem4.Size = new System.Drawing.Size(180, 26);
this.toolStripMenuItem4.Text = "启用安全门禁";
this.toolStripMenuItem4.Click += new System.EventHandler(this.toolStripMenuItem4_Click);
//
// toolStripSeparator17 // toolStripSeparator17
// //
this.toolStripSeparator17.Name = "toolStripSeparator17"; this.toolStripSeparator17.Name = "toolStripSeparator17";
this.toolStripSeparator17.Size = new System.Drawing.Size(177, 6); this.toolStripSeparator17.Size = new System.Drawing.Size(177, 6);
this.toolStripSeparator17.Visible = false;
// //
// 自动保存托盘信息ToolStripMenuItem // 自动保存托盘信息ToolStripMenuItem
// //
...@@ -1057,6 +1065,7 @@ ...@@ -1057,6 +1065,7 @@
private System.Windows.Forms.CheckBox chbDisGetWare; private System.Windows.Forms.CheckBox chbDisGetWare;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem3; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem3;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator16; private System.Windows.Forms.ToolStripSeparator toolStripSeparator16;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem4;
} }
} }
...@@ -111,6 +111,14 @@ namespace OnlineStore.AssemblyLine ...@@ -111,6 +111,14 @@ namespace OnlineStore.AssemblyLine
{ {
自动保存托盘信息ToolStripMenuItem.Text = gouStr + "自动保存托盘信息"; 自动保存托盘信息ToolStripMenuItem.Text = gouStr + "自动保存托盘信息";
} }
if (LineManager.UseSecurityAccess)
{
toolStripMenuItem4.Text = gouStr + "启用安全门禁";
}
else
{
toolStripMenuItem4.Text = "启用安全门禁";
}
cmbBoxIndex.Items.Clear(); cmbBoxIndex.Items.Clear();
foreach (int key in lineBean.MoveEquipMap.Keys) foreach (int key in lineBean.MoveEquipMap.Keys)
{ {
...@@ -1115,5 +1123,30 @@ namespace OnlineStore.AssemblyLine ...@@ -1115,5 +1123,30 @@ namespace OnlineStore.AssemblyLine
LogUtil.error("FrmCrispTray 出错:" + ex.ToString()); LogUtil.error("FrmCrispTray 出错:" + ex.ToString());
} }
} }
private void toolStripMenuItem4_Click(object sender, EventArgs e)
{
if (!LoadOk)
{
return;
}
bool result = !toolStripMenuItem4.Text.Contains(gouStr);
if (result.Equals(LineManager.UseSecurityAccess))
{
return;
}
LineManager.UseSecurityAccess = result;
ConfigAppSettings.SaveValue(Setting_Init.UseSecurityAccess, (LineManager.UseSecurityAccess ? 1 : 0));
if (result)
{
toolStripMenuItem4.Text = gouStr + " 启用安全门禁";
}
else
{
toolStripMenuItem4.Text = "启用安全门禁";
}
LogUtil.info(Name + " 点击:" + toolStripMenuItem4.Text);
}
} }
} }
...@@ -52,5 +52,9 @@ todesk 874075053 Acc123 ...@@ -52,5 +52,9 @@ todesk 874075053 Acc123
D7处无检测信号,如何判断出料口是否有料 D7处无检测信号,如何判断出料口是否有料
20210702 夹爪修改
修改内容:1.复位时清除报警同时调用停止的方法。2.夹爪夹料时必须到位后才能继续
20210705
增加新安全门禁 ,增加菜单可启用禁用安全门禁。
...@@ -105,5 +105,7 @@ namespace OnlineStore.Common ...@@ -105,5 +105,7 @@ namespace OnlineStore.Common
public static string TrayHeightList = "TrayHeightList"; public static string TrayHeightList = "TrayHeightList";
public static string PNList = "PNList"; public static string PNList = "PNList";
public static string UseSecurityAccess = "UseSecurityAccess";
} }
} }
...@@ -256,3 +256,9 @@ DO,101,T1托盘定位气缸后退,SL_TrayLocation_After,97,HC,Y97,,,,,,,,,,,, ...@@ -256,3 +256,9 @@ DO,101,T1托盘定位气缸后退,SL_TrayLocation_After,97,HC,Y97,,,,,,,,,,,,
,,,,109,HC,Y109,,,,,,,,,,,, ,,,,109,HC,Y109,,,,,,,,,,,,
,,,,110,HC,Y110,,,,,,,,,,,, ,,,,110,HC,Y110,,,,,,,,,,,,
,,,,111,HC,Y111,,,,,,,,,,,, ,,,,111,HC,Y111,,,,,,,,,,,,
DI,7,安全门禁1(D7),SecurityAccess,67,HC,X67,,,,,,,,,,,,
DI,101,安全门禁1(T1),SecurityAccess,68,HC,X68,,,,,,,,,,,,
DI,2,安全门禁1(D2-D3),SecurityAccess,69,HC,X69,,,,,,,,,,,,
DI,3,安全门禁1(D2-D3),SecurityAccess,69,HC,X69,,,,,,,,,,,,
DI,4,安全门禁1(D4-D5),SecurityAccess,70,HC,X70,,,,,,,,,,,,
DI,5,安全门禁1(D4-D5),SecurityAccess,70,HC,X70,,,,,,,,,,,,
...@@ -114,6 +114,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -114,6 +114,7 @@ namespace OnlineStore.DeviceLibrary
{ {
TimerMaxSeconds = 3; TimerMaxSeconds = 3;
} }
SecurityAccessProcess();
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -839,5 +840,121 @@ namespace OnlineStore.DeviceLibrary ...@@ -839,5 +840,121 @@ namespace OnlineStore.DeviceLibrary
return false; return false;
} }
//光栅状态:0正常。1=安全门禁打开,已停止运动
private int CurrSecurityAccess = 0;
protected void SecurityAccessProcess()
{
try
{
if (!baseConfig.DIList.ContainsKey(IO_Type.SecurityAccess))
{
return;
}
if (CurrSecurityAccess.Equals(0) && LineManager.UseSecurityAccess)
{
if (IOValue(IO_Type.SecurityAccess).Equals(IO_VALUE.LOW))
{
SecurityAccessStop();
}
}
else if (CurrSecurityAccess.Equals(1))
{
if (IOValue(IO_Type.SecurityAccess).Equals(IO_VALUE.HIGH))
{
SecurityAccessReset();
}
}
}
catch(Exception ex)
{
LogUtil.error(Name + " 出错 :" + ex.ToString());
}
}
private void SecurityAccessStop()
{
if (!baseConfig.DIList.ContainsKey(IO_Type.SecurityAccess))
{
return;
}
CurrSecurityAccess = 1;
if (alarmType > (LineAlarmType.IoSingleTimeOut))
{
return;
}
ConfigIO di = baseConfig.DIList[IO_Type.SecurityAccess];
if (baseConfig.DType.Equals(DeviceType.FeedingEquip))
{
LogUtil.info($"{Name }安全门禁 { di.Explain} 被打开,停止当前运动{MoveInfo.MoveType},MoveStop={MoveStop},报警急停");
SetWarnMsg("安全门禁被打开,报警急停");
Alarm(LineAlarmType.SuddenStop);
}
else
{
if (MoveInfo.MoveType.Equals(LineMoveType.None))
{
LogUtil.info($"{Name }安全门禁 { di.Explain} 被打开,停止当前运动{MoveInfo.MoveType},MoveStop={MoveStop},报警急停");
SetWarnMsg("安全门禁被打开,报警急停");
Alarm(LineAlarmType.SuddenStop);
}
else
{
MoveStop = true;
LogUtil.info($"{Name }安全门禁 { di.Explain} 被打开,停止当前运动{MoveInfo.MoveType},MoveStop={MoveStop},稍后复位");
SetWarnMsg("安全门禁被打开,暂停当前运动");
string msg = "";
Dictionary<string, IO_VALUE> values = MoveInfo.WriteDoMap;
foreach (string key in values.Keys)
{
msg += $"写DO{key}={IO_VALUE.LOW};";
IOMove(key, IO_VALUE.LOW);
}
if (UseAxis)
{
UpdownAxis.SuddenStop();
msg += $"停止轴{UpdownAxis.Config.Explain};";
}
LogUtil.info($"{Name }安全门禁 { di.Explain} 被打开,停止当前运动{MoveInfo.MoveType},{MoveInfo.MoveStep},{msg},稍后复位");
}
}
}
private void SecurityAccessReset()
{
if (!baseConfig.DIList.ContainsKey(IO_Type.SecurityAccess))
{
return;
}
CurrSecurityAccess = 0;
MoveStop = false;
ConfigIO di = baseConfig.DIList[IO_Type.SecurityAccess];
if (alarmType > (LineAlarmType.IoSingleTimeOut))
{
return;
}
if (baseConfig.DType.Equals(DeviceType.MoveEquip))
{
LogUtil.info($"{Name }安全门禁 { di.Explain} 已关闭,恢复当前运动{MoveInfo.MoveType},MoveStop={MoveStop}");
if (MoveInfo.MoveType.Equals(LineMoveType.InStore) || MoveInfo.MoveType.Equals(LineMoveType.OutStore))
{
string msg = "";
Dictionary<string, IO_VALUE> values = MoveInfo.WriteDoMap;
foreach (string key in values.Keys)
{
IO_VALUE v = values[key];
msg += $"写DO{key}={v};";
IOMove(key, v);
}
MoveInfo.LastSetpTime = DateTime.Now;
LogUtil.info($"{Name }安全门禁 { di.Explain} 已关闭,恢复当前运动{MoveInfo.MoveType},{MoveInfo.MoveStep},{msg}");
}
}
}
} }
} }
...@@ -20,6 +20,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -20,6 +20,7 @@ namespace OnlineStore.DeviceLibrary
public static bool DisGetWare = false; public static bool DisGetWare = false;
public static bool UseBuzzer = ConfigAppSettings.GetIntValue(Setting_Init.UseBuzzer).Equals(1); public static bool UseBuzzer = ConfigAppSettings.GetIntValue(Setting_Init.UseBuzzer).Equals(1);
public static bool UseSecurityAccess = ConfigAppSettings.GetIntValue(Setting_Init.UseSecurityAccess).Equals(1);
private static bool isInit = false; private static bool isInit = false;
public static bool IsConnectServer = !ConfigAppSettings.GetValue(Setting_Init.http_server).Equals(""); public static bool IsConnectServer = !ConfigAppSettings.GetValue(Setting_Init.http_server).Equals("");
......
...@@ -419,6 +419,15 @@ namespace OnlineStore.DeviceLibrary ...@@ -419,6 +419,15 @@ namespace OnlineStore.DeviceLibrary
} }
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IoLowType, IO_VALUE.LOW)); moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IoLowType, IO_VALUE.LOW));
moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IoHighType, IO_VALUE.HIGH)); moveInfo.WaitList.Add(WaitResultInfo.WaitIO(IoHighType, IO_VALUE.HIGH));
try
{
moveInfo.WriteDoMap.Add(IoLowType, IO_VALUE.LOW);
moveInfo.WriteDoMap.Add(IoHighType, IO_VALUE.HIGH);
}
catch (Exception ex)
{
LogUtil.error(" CylinderMove add WriteDoMap 出错:" + ex.ToString());
}
} }
if (isCheckMove) if (isCheckMove)
{ {
......
...@@ -32,6 +32,9 @@ namespace OnlineStore.DeviceLibrary ...@@ -32,6 +32,9 @@ namespace OnlineStore.DeviceLibrary
MoveNum = 0; MoveNum = 0;
} }
public Dictionary<string, IO_VALUE> WriteDoMap = new Dictionary<string, IO_VALUE>();
public int MoveNum { get; set; } public int MoveNum { get; set; }
public DateTime LastSetpTime { get; set; } public DateTime LastSetpTime { get; set; }
...@@ -111,6 +114,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -111,6 +114,7 @@ namespace OnlineStore.DeviceLibrary
moveStep = step; moveStep = step;
LastSetpTime = DateTime.Now; LastSetpTime = DateTime.Now;
IsInWait = true; IsInWait = true;
WriteDoMap = new Dictionary<string, IO_VALUE>();
WaitList = new List<WaitResultInfo>(); WaitList = new List<WaitResultInfo>();
WriteIoList = new List<WriteIOInfo>(); WriteIoList = new List<WriteIOInfo>();
OneWaitCanEndStep = false; OneWaitCanEndStep = false;
...@@ -122,6 +126,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -122,6 +126,7 @@ namespace OnlineStore.DeviceLibrary
public void EndStepWait() public void EndStepWait()
{ {
IsInWait = false; IsInWait = false;
WriteDoMap = new Dictionary<string, IO_VALUE>();
WaitList = new List<WaitResultInfo>(); WaitList = new List<WaitResultInfo>();
WriteIoList = new List<WriteIOInfo>(); WriteIoList = new List<WriteIOInfo>();
} }
...@@ -131,6 +136,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -131,6 +136,7 @@ namespace OnlineStore.DeviceLibrary
moveStep = LineMoveStep.Wait; moveStep = LineMoveStep.Wait;
this.moveType = type; this.moveType = type;
LastSetpTime = DateTime.Now; LastSetpTime = DateTime.Now;
WriteDoMap = new Dictionary<string, IO_VALUE>();
WaitList = new List<WaitResultInfo>(); WaitList = new List<WaitResultInfo>();
WriteIoList = new List<WriteIOInfo>(); WriteIoList = new List<WriteIOInfo>();
MoveNum++; MoveNum++;
...@@ -142,6 +148,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -142,6 +148,7 @@ namespace OnlineStore.DeviceLibrary
this.moveType = type; this.moveType = type;
this.MoveParam = param; this.MoveParam = param;
LastSetpTime = DateTime.Now; LastSetpTime = DateTime.Now;
WriteDoMap = new Dictionary<string, IO_VALUE>();
WaitList = new List<WaitResultInfo>(); WaitList = new List<WaitResultInfo>();
WriteIoList = new List<WriteIOInfo>(); WriteIoList = new List<WriteIOInfo>();
} }
...@@ -152,6 +159,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -152,6 +159,7 @@ namespace OnlineStore.DeviceLibrary
moveStep = LineMoveStep.Wait; moveStep = LineMoveStep.Wait;
LastSetpTime = DateTime.Now; LastSetpTime = DateTime.Now;
IsInWait = false; IsInWait = false;
WriteDoMap = new Dictionary<string, IO_VALUE>();
WaitList = new List<WaitResultInfo>(); WaitList = new List<WaitResultInfo>();
WriteIoList = new List<WriteIOInfo>(); WriteIoList = new List<WriteIOInfo>();
CanWhileCount = 0; CanWhileCount = 0;
......
...@@ -338,6 +338,23 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -338,6 +338,23 @@ namespace OnlineStore.LoadCSVLibrary
public static string HY_TrayCheck3 = "HY_TrayCheck3"; public static string HY_TrayCheck3 = "HY_TrayCheck3";
public static string HY_TrayCheck4 = "HY_TrayCheck4"; public static string HY_TrayCheck4 = "HY_TrayCheck4";
/// <summary>
/// DI,0,安全门禁1(D7),SecurityAccess1_D7,67,HC,X67,,,,,,,,,,,,
/// </summary>
public static string SecurityAccess1_D7 = "SecurityAccess1_D7";
/// <summary>
/// DI,0,安全门禁1(T1),SecurityAccess1_T1,68,HC,X68,,,,,,,,,,,,
/// </summary>
public static string SecurityAccess1_T1 = "SecurityAccess1_T1";
/// <summary>
/// DI,0,安全门禁1(D2-D3),SecurityAccess1_D2D3,69,HC,X69,,,,,,,,,,,,
/// </summary>
public static string SecurityAccess1_D2D3 = "SecurityAccess1_D2D3";
/// <summary>
/// DI,0,安全门禁1(D4-D5),SecurityAccess1_D4D5,70,HC,X70,,,,,,,,,,,,
/// </summary>
public static string SecurityAccess1_D4D5 = "SecurityAccess1_D4D5";
public static string SecurityAccess = "SecurityAccess";
} }
public enum IO_VALUE public enum IO_VALUE
{ {
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!