Commit 8e3f0ffb LN

工位报警分开处理

1 个父辈 3220004e
......@@ -162,6 +162,7 @@ namespace OnlineStore.DeviceLibrary
RFIDManager.Open();
//RFIDManager.Open(new string[] { Config.RFID_IP1, Config.RFID_IP2, Config.RFID_IP3 });
lineConn.StartConnect();
WarnMsg = "";
ReturnHome();
StartTime = DateTime.Now;
......@@ -996,7 +997,7 @@ namespace OnlineStore.DeviceLibrary
}
public string GetMoveStr()
{
string msg = LineConnect.DoorPosInfo?.ToStr() + "\r\n";
string msg = LineConnect.DoorPosInfo?.ToStr() + "\r\n" + "料架信息:" + CurrTray?.ToStr()+"\r\n";
foreach (WorkStation shelf in StationMap.Values)
{
......@@ -1058,18 +1059,22 @@ namespace OnlineStore.DeviceLibrary
lastConTime = DateTime.Now;
try
{
if (lineConn.IsConnect())
if (IsDebug)
{ }
else
{
int hasTray = (int)IOValue(IO_Type.TrayCheck_Door);
int ss = (int)storeStatus;
if (IsDebug)
if (lineConn.IsConnect())
{
ss = (int)StoreStatus.Debugging;
int hasTray = (int)IOValue(IO_Type.TrayCheck_Door);
int ss = (int)storeStatus;
if (IsDebug)
{
ss = (int)StoreStatus.Debugging;
}
StoreSendBean store = lineConn.GetBean((int)ss, (int)storeRunStatus, hasTray, (int)alarmType);
lineConn.SendHeart(store);
}
StoreSendBean store = lineConn.GetBean((int)ss, (int)storeRunStatus, hasTray, (int)alarmType);
lineConn.SendHeart(store);
}
}
catch (Exception ex)
{
......@@ -1128,6 +1133,13 @@ namespace OnlineStore.DeviceLibrary
{
isNeedAlarmLed = true;
}
foreach(WorkStation station in StationMap.Values)
{
if (station.alarmType.Equals(StoreAlarmType.None).Equals(false))
{
isNeedAlarmLed = true;
}
}
}
//黄灯
......
......@@ -21,6 +21,8 @@ namespace OnlineStore.DeviceLibrary
private string rfidIp = "";
public ShelfInfo CurrShelf = new ShelfInfo();
public int StationId = 0;
public string WarnMsg = "";
public StoreAlarmType alarmType = StoreAlarmType.None;
public WorkStation(int id,string name,string agvName,string rfidip)
{
this.rfidIp = rfidip;
......@@ -47,6 +49,10 @@ namespace OnlineStore.DeviceLibrary
{
return false;
}
if (!alarmType.Equals(StoreAlarmType.None))
{
return false;
}
if (CheckShelf(IO_VALUE.HIGH))
{
if (!CurrShelf.IsNeedLeave && (!String.IsNullOrEmpty(CurrShelf.RealShelf)) && LocationIsUp())
......@@ -88,15 +94,15 @@ namespace OnlineStore.DeviceLibrary
CurrShelf = new ShelfInfo(rfid);
return CurrShelf.RealShelf;
}
private void ClearShelfId()
{
CurrShelf = new ShelfInfo();
}
public void Reset()
{
if (IsDis())
{
alarmType = StoreAlarmType.None;
WarnMsg = "";
MoveInfo.EndMove();
return;
}
if (CurrShelf.IsBusy)
......@@ -104,7 +110,8 @@ namespace OnlineStore.DeviceLibrary
LogUtil.error(Name + "复位失败,料架忙碌中");
return ;
}
alarmType = StoreAlarmType.None;
WarnMsg = "";
MoveInfo.EndMove();
MoveInfo.NewMove(StoreMoveType.StoreReset);
MoveInfo.NextMoveStep(MoveStep.SR_01_LocationDown);
......@@ -116,7 +123,7 @@ namespace OnlineStore.DeviceLibrary
{
if (MoveInfo.IsInWait)
{
EquipManager.Equip.CheckWait(MoveInfo);
CheckWait(MoveInfo);
}
if (MoveInfo.IsInWait)
{
......@@ -154,7 +161,7 @@ namespace OnlineStore.DeviceLibrary
}
else if (CheckShelf(IO_VALUE.LOW))
{
ClearShelfId();
CurrShelf = new ShelfInfo();
LogUtil.info(Name + "复位完成,当前无料架");
MoveInfo.EndMove();
}
......@@ -172,7 +179,7 @@ namespace OnlineStore.DeviceLibrary
}
else if (CheckShelf(IO_VALUE.LOW))
{
ClearShelfId();
CurrShelf = new ShelfInfo();
LogUtil.info(Name + "复位完成,当前无料架");
MoveInfo.EndMove();
}
......@@ -297,6 +304,124 @@ namespace OnlineStore.DeviceLibrary
return false;
}
#region 出料结果验证
private DateTime preRWTime = DateTime.Now;
public void CheckWait(StoreMoveInfo checkmove)
{
List<WaitResultInfo> list = checkmove.WaitList;
//当等待超过一分钟时,需要打印提示
TimeSpan span = DateTime.Now - checkmove.LastSetpTime;
string NotOkMsg = "";
if (list.Count <= 0)
{
checkmove.EndStepWait();
return;
}
bool isOk = true;
if (checkmove.OneWaitCanEndStep)
{
isOk = false;
}
foreach (WaitResultInfo wait in list)
{
if (wait.IsEnd)
{
continue;
}
NotOkMsg = wait.ToStr();
if (wait.WaitType == 1)
{
}
else if (wait.WaitType == 2)
{
wait.IsEnd = EquipManager.Equip.IOValue(wait.IoType).Equals(wait.IoValue);
int timeOutMs = EquipManager.Equip.Config.IOSingle_TimerOut;
if ((!wait.IsEnd) && span.TotalMilliseconds > timeOutMs)
{
ConfigIO io = EquipManager.Equip.Config.getWaitIO(wait.IoType);
WarnMsg = Name + "[" + checkmove.MoveType + "][" + checkmove.MoveStep + "] 等待" + io.DisplayStr + "=" + wait.IoValue + "超时 ";
if (WarnMsg.Contains("Check_Pos") || WarnMsg.Contains("X03_点检"))
{
WarnMsg = "";
break;
}
alarmType = StoreAlarmType.IoSingleTimeOut;
LogUtil.error(Name + wait.IoType + "等待信号(" + io.DisplayStr + "=" + wait.IoValue + ") 超时", 14);
isOk = false;
break;
}
TimeSpan rwSpan = DateTime.Now - preRWTime;
if (!wait.IsEnd && rwSpan.TotalSeconds > 5 && span.TotalSeconds > 6)
{
preRWTime = DateTime.Now;
string msg = Name + " " + NotOkMsg + "已等待 " + Math.Abs(span.TotalSeconds) + "秒,重写DO:";
bool isLog = false;
foreach (WaitResultInfo ww in list)
{
if (ww != null && ww.WaitType.Equals(2) && EquipManager.Equip.Config.DOList.ContainsKey(ww.IoType))
{
isLog = true;
EquipManager.Equip.IOMove(ww.IoType, ww.IoValue);
msg += ww.ToStr() + ",";
}
}
if (isLog)
{
LogUtil.error(msg);
}
isOk = false;
break;
}
}
else if (wait.WaitType == 3)
{
wait.IsEnd = (span.TotalMilliseconds >= wait.TimeMSeconds);
}
if (wait.IsEnd)
{
if (checkmove.OneWaitCanEndStep)
{
isOk = true;
break;
}
}
else
{
if (!checkmove.OneWaitCanEndStep)
{
isOk = false;
break;
}
}
}
if (isOk)
{
checkmove.EndStepWait();
}
else if (span.TotalSeconds > checkmove.TimeOutSeconds)
{
WarnMsg = Name + "[" + checkmove.MoveType + "][" + checkmove.MoveStep + "] 等待超时 [" + NotOkMsg
+ "]已等待[" + Math.Round(span.TotalSeconds, 1) + "]秒";
if (WarnMsg.Contains("Check_Pos") || WarnMsg.Contains("X03_点检"))
{
WarnMsg = "";
return;
}
LogUtil.error(WarnMsg, 100);
alarmType = StoreAlarmType.IoSingleTimeOut;
}
}
private static DateTime lastComRHomeTime = DateTime.Now;
#endregion
#region AGV
......@@ -445,7 +570,7 @@ namespace OnlineStore.DeviceLibrary
ProcessShelfOut = false;
LogUtil.info(logName + ",停止转动,清空"+CurrShelf.ToStr()+", 结束");
ClearShelfId();
CurrShelf = new ShelfInfo();
}
catch (TimeoutException te)
......@@ -470,7 +595,7 @@ namespace OnlineStore.DeviceLibrary
string logName = Name + "AGV料架进入 [" + AgvName + "] ";
try
{
ClearShelfId();
CurrShelf = new ShelfInfo();
LogUtil.info(logName + " 开始,设置状态=MayEnter");
AgvClient.SetStatus(AgvName, "", ClientAction.MayEnter, ClientLevel.High, true);
ProcessShelfEnter = true;
......
......@@ -176,6 +176,7 @@
//
// tabPage2
//
this.tabPage2.Controls.Add(this.lblWarnMsg);
this.tabPage2.Controls.Add(this.chbMoveStop);
this.tabPage2.Controls.Add(this.checkBox3);
this.tabPage2.Controls.Add(this.checkBox2);
......@@ -190,7 +191,6 @@
this.tabPage2.Controls.Add(this.groupBox2);
this.tabPage2.Controls.Add(this.lblThisSta);
this.tabPage2.Controls.Add(this.chbDebug);
this.tabPage2.Controls.Add(this.lblWarnMsg);
this.tabPage2.Location = new System.Drawing.Point(4, 29);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Size = new System.Drawing.Size(988, 594);
......@@ -254,7 +254,7 @@
this.btnS3Reset.BackColor = System.Drawing.Color.White;
this.btnS3Reset.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnS3Reset.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnS3Reset.Location = new System.Drawing.Point(549, 150);
this.btnS3Reset.Location = new System.Drawing.Point(549, 185);
this.btnS3Reset.Name = "btnS3Reset";
this.btnS3Reset.Size = new System.Drawing.Size(132, 39);
this.btnS3Reset.TabIndex = 282;
......@@ -267,7 +267,7 @@
this.btnS2Reset.BackColor = System.Drawing.Color.White;
this.btnS2Reset.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnS2Reset.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnS2Reset.Location = new System.Drawing.Point(411, 150);
this.btnS2Reset.Location = new System.Drawing.Point(411, 185);
this.btnS2Reset.Name = "btnS2Reset";
this.btnS2Reset.Size = new System.Drawing.Size(132, 39);
this.btnS2Reset.TabIndex = 281;
......@@ -280,7 +280,7 @@
this.btnS1Reset.BackColor = System.Drawing.Color.White;
this.btnS1Reset.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnS1Reset.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnS1Reset.Location = new System.Drawing.Point(273, 150);
this.btnS1Reset.Location = new System.Drawing.Point(273, 185);
this.btnS1Reset.Name = "btnS1Reset";
this.btnS1Reset.Size = new System.Drawing.Size(132, 39);
this.btnS1Reset.TabIndex = 280;
......@@ -293,7 +293,7 @@
this.btnClearDoor.BackColor = System.Drawing.Color.White;
this.btnClearDoor.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnClearDoor.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnClearDoor.Location = new System.Drawing.Point(135, 150);
this.btnClearDoor.Location = new System.Drawing.Point(135, 185);
this.btnClearDoor.Name = "btnClearDoor";
this.btnClearDoor.Size = new System.Drawing.Size(132, 39);
this.btnClearDoor.TabIndex = 279;
......@@ -307,9 +307,9 @@
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.logBox.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.logBox.Location = new System.Drawing.Point(4, 195);
this.logBox.Location = new System.Drawing.Point(4, 232);
this.logBox.Name = "logBox";
this.logBox.Size = new System.Drawing.Size(978, 380);
this.logBox.Size = new System.Drawing.Size(978, 356);
this.logBox.TabIndex = 278;
this.logBox.Text = "";
this.logBox.VisibleChanged += new System.EventHandler(this.logBox_VisibleChanged);
......@@ -433,9 +433,9 @@
| System.Windows.Forms.AnchorStyles.Right)));
this.lblWarnMsg.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblWarnMsg.ForeColor = System.Drawing.Color.Red;
this.lblWarnMsg.Location = new System.Drawing.Point(356, 46);
this.lblWarnMsg.Location = new System.Drawing.Point(343, 48);
this.lblWarnMsg.Name = "lblWarnMsg";
this.lblWarnMsg.Size = new System.Drawing.Size(534, 92);
this.lblWarnMsg.Size = new System.Drawing.Size(534, 125);
this.lblWarnMsg.TabIndex = 224;
this.lblWarnMsg.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
......@@ -447,9 +447,9 @@
this.tabPage3.Controls.Add(this.btnUpdown);
this.tabPage3.Controls.Add(this.btnAxisOn);
this.tabPage3.Controls.Add(this.btnAxisOff);
this.tabPage3.Location = new System.Drawing.Point(4, 26);
this.tabPage3.Location = new System.Drawing.Point(4, 29);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(988, 597);
this.tabPage3.Size = new System.Drawing.Size(988, 594);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = " 库位调试 ";
this.tabPage3.UseVisualStyleBackColor = true;
......@@ -1512,7 +1512,7 @@
//
this.chbMoveStop.AutoSize = true;
this.chbMoveStop.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.chbMoveStop.Location = new System.Drawing.Point(29, 157);
this.chbMoveStop.Location = new System.Drawing.Point(29, 192);
this.chbMoveStop.Name = "chbMoveStop";
this.chbMoveStop.Size = new System.Drawing.Size(84, 24);
this.chbMoveStop.TabIndex = 288;
......
......@@ -173,23 +173,35 @@ namespace OnlineStore.ACSingleStore
lblMoveStr.Text = equip.GetMoveStr();
//ReadPosistion();
if (equip.storeRunStatus > StoreRunStatus.Wait)
{
lblWarnMsg.Text = equip.WarnMsg;
//如果不在出料中,且叉子上有信号,需要提示检查叉子
if (equip.storeRunStatus.Equals(StoreRunStatus.Runing) && equip.IOValue(IO_Type.TrayCheck_Fixture).Equals(IO_VALUE.HIGH))
{
string wmsg = "";
//lblWarnMsg.Text = equip.WarnMsg;
if (!String.IsNullOrEmpty(equip.WarnMsg))
{
lblWarnMsg.Text = lblWarnMsg.Text + " 叉子料盘检测有料,请检查";
wmsg += equip.WarnMsg+"\r\n";
}
if (lblWarnMsg.Text.Equals(""))
foreach (WorkStation s in equip.StationMap.Values)
{
if (LineConnect.DoorPosInfo != null)
if (!string.IsNullOrEmpty(s.WarnMsg))
{
string msg = "出料口物料:" + LineConnect.DoorPosInfo?.ToStr()+"\r\n"+"料架信息:"+equip.CurrTray?.ToStr();
lblWarnMsg.Text = msg;
wmsg += s.WarnMsg + "\r\n";
}
}
}
//如果不在出料中,且叉子上有信号,需要提示检查叉子
if (equip.storeRunStatus.Equals(StoreRunStatus.Runing) && equip.IOValue(IO_Type.TrayCheck_Fixture).Equals(IO_VALUE.HIGH))
{
wmsg += "叉子料盘检测有料,请检查" + "\r\n";
}
lblWarnMsg.Text = wmsg;
//if (lblWarnMsg.Text.Equals(""))
//{
// if (LineConnect.DoorPosInfo != null)
// {
// string msg = "出料口物料:" + LineConnect.DoorPosInfo?.ToStr()+"\r\n"+"料架信息:"+equip.CurrTray?.ToStr();
// lblWarnMsg.Text = msg;
// }
//}
if (equip.autoNext)
{
string msg = equip.autoMsg;
......@@ -1142,38 +1154,29 @@ namespace OnlineStore.ACSingleStore
LineConnect.DoorPosInfo = null;
}
}
private void btnS1Reset_Click(object sender, EventArgs e)
private void SReset(int num)
{
LogUtil.info(equip.Name + "点击:S1复位");
LogUtil.info(equip.Name + "点击:S"+ num + "复位");
if (equip.storeRunStatus.Equals(StoreRunStatus.Wait))
{
MessageBox.Show(equip.Name + "设备未启动,无法复位");
return;
}
equip.StationMap[1].Reset();
equip.StationMap[num].Reset();
}
private void btnS1Reset_Click(object sender, EventArgs e)
{
SReset(1);
}
private void btnS2Reset_Click(object sender, EventArgs e)
{
LogUtil.info(equip.Name + "点击:S2复位");
if (equip.storeRunStatus.Equals(StoreRunStatus.Wait))
{
MessageBox.Show(equip.Name + "设备未启动,无法复位");
return;
}
equip.StationMap[2].Reset();
SReset(2);
}
private void btnS3Reset_Click(object sender, EventArgs e)
{
LogUtil.info(equip.Name + "点击:S3复位");
if (equip.storeRunStatus.Equals(StoreRunStatus.Wait))
{
MessageBox.Show(equip.Name + "设备未启动,无法复位");
return;
}
equip.StationMap[3].Reset();
SReset(3);
}
private void DisS(int num,CheckBox chebox)
{
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!