Commit dea7d1f1 张东亮

发任务前,检查agv满载信号与IO的是否匹配,不匹配则不分配任务,取消小车调用,手动清除缓存,更新负载状态

1 个父辈 6881db5f
...@@ -566,7 +566,7 @@ namespace AGVControl ...@@ -566,7 +566,7 @@ namespace AGVControl
public void GetPlace(int value) public void GetPlace(int value)
{ {
Common.log.Debug(Name + "获取PLC20值 " + value); Common.log.Debug(Name + " PLC20=" + value);
if (value == 0) if (value == 0)
{ {
Place = ""; Place = "";
...@@ -592,7 +592,7 @@ namespace AGVControl ...@@ -592,7 +592,7 @@ namespace AGVControl
if (node != null) if (node != null)
PlaceAliceName = node.AliceName; PlaceAliceName = node.AliceName;
else else
PlaceAliceName = ""; PlaceAliceName = Place;
} }
PlaceState = (PlaceState)c; PlaceState = (PlaceState)c;
} }
...@@ -610,8 +610,8 @@ namespace AGVControl ...@@ -610,8 +610,8 @@ namespace AGVControl
s.Add(RFID); s.Add(RFID);
s.Add(Msg); s.Add(Msg);
s.Add(MissionText); s.Add(MissionText);
//s.Add(PlaceAliceName); s.Add(PlaceAliceName);
s.Add(Place); //s.Add(Place);
s.Add(PlaceState.ToString()); s.Add(PlaceState.ToString());
if (Common.nodeInfo != null && Common.nodeInfo.Count != 0) if (Common.nodeInfo != null && Common.nodeInfo.Count != 0)
{ {
...@@ -619,7 +619,7 @@ namespace AGVControl ...@@ -619,7 +619,7 @@ namespace AGVControl
if (node != null) if (node != null)
NextPlaceAliceName = node.AliceName; NextPlaceAliceName = node.AliceName;
else else
NextPlaceAliceName = ""; NextPlaceAliceName = NextPlace;
} }
s.Add(NextPlaceAliceName); s.Add(NextPlaceAliceName);
} }
......
...@@ -63,7 +63,8 @@ namespace BLL ...@@ -63,7 +63,8 @@ namespace BLL
//获取AGV状态 //获取AGV状态
rtn = Common.mir.Get_State(Common.agvInfo[i], out int stateID, out string stateText, out int battery, out string mission_text, out Agv_Info.clsPosition position); rtn = Common.mir.Get_State(Common.agvInfo[i], out int stateID, out string stateText, out int battery, out string mission_text, out Agv_Info.clsPosition position);
Thread.Sleep(50); Thread.Sleep(50);
//Common.mir.Get_IO_Status(Common.agvInfo[i], out bool[] input, out bool[] output);
Common.mir.Get_IO_Status(Common.agvInfo[i], out bool[] input, out bool[] output);
bool change = false; bool change = false;
if (rtn) change = Common.agvInfo[i].SetState(stateID, stateText, battery, mission_text, position); if (rtn) change = Common.agvInfo[i].SetState(stateID, stateText, battery, mission_text, position);
...@@ -95,6 +96,15 @@ namespace BLL ...@@ -95,6 +96,15 @@ namespace BLL
isAlarm = true; isAlarm = true;
msglist.Add(new AlarmMsg(Common.agvInfo[i].Name, "agv." + Common.agvInfo[i].Name + ".Error.EmergencyStop", "agv状态:" + stateText +";"+ mission_text)); msglist.Add(new AlarmMsg(Common.agvInfo[i].Name, "agv." + Common.agvInfo[i].Name + ".Error.EmergencyStop", "agv状态:" + stateText +";"+ mission_text));
} }
if (input != null && input.Length == 4)
{
if (!Common.agvInfo[i].IsExistShelf.Equals(input[3]))
{
isAlarm = true;
msglist.Add(new AlarmMsg(Common.agvInfo[i].Name, "agv." + Common.agvInfo[i].Name + ".IsExistShelf", "agv负载:"+"IO信号与负载信号不匹配"));
}
}
if (isAlarm) if (isAlarm)
BLL.AGVManager.updateDeviceAlarmMsg(msglist); BLL.AGVManager.updateDeviceAlarmMsg(msglist);
...@@ -265,7 +275,7 @@ namespace BLL ...@@ -265,7 +275,7 @@ namespace BLL
Agv_Info agv = Common.agvInfo[idx]; Agv_Info agv = Common.agvInfo[idx];
Common.log.Info(agv.Name + " TaskSend=" + agv.TaskSend); Common.log.Info(agv.Name + " TaskSend=" + agv.TaskSend);
if (!agv.TaskSend.Equals("") && !agv.TaskSend.Equals("AutoCharge")) return; if (!agv.TaskSend.Equals("")) return;
agv.PlaceAliceName = ""; agv.PlaceAliceName = "";
agv.Msg = ""; agv.Msg = "";
//空闲状态下,清空空架任务agv名字 //空闲状态下,清空空架任务agv名字
...@@ -298,7 +308,7 @@ namespace BLL ...@@ -298,7 +308,7 @@ namespace BLL
return; return;
if (CheckA6State(agv)) if (CheckA6State(agv))
return; return;
AgvChanged?.Invoke(idx);
#region 出空料架,带节点状态-不用 #region 出空料架,带节点状态-不用
//ClientLevel clientLevel = Common.linePlace.Values.Max<ClientLevel>(); //ClientLevel clientLevel = Common.linePlace.Values.Max<ClientLevel>();
////出空料架 ////出空料架
...@@ -489,7 +499,7 @@ namespace BLL ...@@ -489,7 +499,7 @@ namespace BLL
#endregion #endregion
#region 指定充电位置 #region 指定充电位置
if (agv.IP == "10.85.199.72")//1764 if (agv.IP == "10.85.199.71")//1763
{ {
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["AutoCharge3"], isRemovePreMission); rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["AutoCharge3"], isRemovePreMission);
if (rtn) if (rtn)
...@@ -513,7 +523,7 @@ namespace BLL ...@@ -513,7 +523,7 @@ namespace BLL
} }
return rtn; return rtn;
} }
else if (agv.IP == "10.85.199.71")//1763 else if (agv.IP == "10.85.199.72")//1764
{ {
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["AutoCharge4"], isRemovePreMission); rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["AutoCharge4"], isRemovePreMission);
if (rtn) if (rtn)
...@@ -602,8 +612,23 @@ namespace BLL ...@@ -602,8 +612,23 @@ namespace BLL
int index; int index;
string RFID = ""; string RFID = "";
Thread.Sleep(3000); Thread.Sleep(3000);
if (!agv.TaskSend.Equals("") && !agv.TaskSend.Equals("AutoCharge")) if (!agv.TaskSend.Equals(""))
return false; return false;
//判断小车负载与实际是否匹配
Common.mir.Get_IO_Status(agv, out bool[] input, out bool[] output);
if (input != null && input.Length == 4)
{
if (!agv.IsExistShelf.Equals(input[3]))
{
agv.IsUse = false;
agv.Msg = "IO信号与负载不匹配,不分配任务并关闭调用";
int i = Common.agvInfo.FindIndex(s => s.Name.Equals(agv.Name));
AgvChanged?.Invoke(i);
return false;
}
}
//A6出满料 //A6出满料
rtn = FindA6Leave(out string nextNode); rtn = FindA6Leave(out string nextNode);
if (rtn && !agv.IsExistShelf) if (rtn && !agv.IsExistShelf)
...@@ -640,8 +665,22 @@ namespace BLL ...@@ -640,8 +665,22 @@ namespace BLL
private bool CheckEmptyShelf(Agv_Info agv, string agvPlace, bool isAgvAtStandy = false) private bool CheckEmptyShelf(Agv_Info agv, string agvPlace, bool isAgvAtStandy = false)
{ {
if (!agv.TaskSend.Equals("") && !agv.TaskSend.Equals("AutoCharge")) if (!agv.TaskSend.Equals(""))
return false; return false;
//判断小车负载与实际是否匹配
Common.mir.Get_IO_Status(agv, out bool[] input, out bool[] output);
if (input != null && input.Length == 4)
{
if (!agv.IsExistShelf.Equals(input[3]))
{
agv.IsUse = false;
agv.Msg = "IO信号与负载不匹配,不分配任务并关闭调用";
int i = Common.agvInfo.FindIndex(s => s.Name.Equals(agv.Name));
AgvChanged?.Invoke(i);
return false;
}
}
//有空架任务 //有空架任务
//限制待机位车辆只有一台执行空架任务 //限制待机位车辆只有一台执行空架任务
if (isAgvAtStandy) if (isAgvAtStandy)
...@@ -768,10 +807,17 @@ namespace BLL ...@@ -768,10 +807,17 @@ namespace BLL
/// </summary> /// </summary>
/// <param name="idx"></param> /// <param name="idx"></param>
private void StateMoveFinish(int idx) private void StateMoveFinish(int idx)
{ {
bool rtn; bool rtn;
Agv_Info agv = Common.agvInfo[idx]; Agv_Info agv = Common.agvInfo[idx];
if (!agv.TaskSend.Equals(""))
return;
int index = FindNode(agv.Place); int index = FindNode(agv.Place);
if(agv.Place.StartsWith("F"))
{
ProcessDoor(agv);
return;
}
if (agv.Place.StartsWith("J")) if (agv.Place.StartsWith("J"))
{ {
ProcessStandyTemp(agv); ProcessStandyTemp(agv);
...@@ -782,18 +828,6 @@ namespace BLL ...@@ -782,18 +828,6 @@ namespace BLL
switch (agv.Place) switch (agv.Place)
{ {
case "J1":
case "J2":
case "J3":
case "J4":
case "J5":
case "J6":
case "J7":
case "J8":
Common.log.Debug(agv.Place +"MoveFinish");
//ResetNodeState(node, agv);
CheckA5A6State_SmallShelf(agv);
break;
case "A5": case "A5":
if (node.Action == ClientAction.MayEnter) if (node.Action == ClientAction.MayEnter)
{ {
...@@ -1054,7 +1088,7 @@ namespace BLL ...@@ -1054,7 +1088,7 @@ namespace BLL
break; break;
} }
AgvChanged?.Invoke(idx);
} }
private void ProcessStandyTemp(Agv_Info agv) private void ProcessStandyTemp(Agv_Info agv)
...@@ -1068,12 +1102,28 @@ namespace BLL ...@@ -1068,12 +1102,28 @@ namespace BLL
case "J5": case "J5":
case "J6": case "J6":
case "J7": case "J7":
case "J8": case "J8":
//ResetNodeState(node, agv);
CheckA5A6State_SmallShelf(agv); CheckA5A6State_SmallShelf(agv);
break; break;
} }
} }
private void ProcessDoor(Agv_Info agv)
{
switch (agv.Place)
{
case "F1":
case "F2":
case "F3":
case "F4":
case "F5":
case "F6":
case "F7":
case "F8":
//ResetNodeState(node, agv);
Common.log.Debug(string.Format("{0} MoveDoor {1}[RFID={2}] Finish.",agv.Name,agv.Place,agv.RFID));
break;
}
}
/// <summary> /// <summary>
/// 获取大料架解绑情况 /// 获取大料架解绑情况
/// </summary> /// </summary>
...@@ -1179,7 +1229,7 @@ namespace BLL ...@@ -1179,7 +1229,7 @@ namespace BLL
{ {
bool rtn; bool rtn;
Agv_Info agv = Common.agvInfo[idx]; Agv_Info agv = Common.agvInfo[idx];
if (!agv.TaskSend.Equals("") && !agv.TaskSend.Equals("AutoCharge")) return; if (!agv.TaskSend.Equals("")) return;
int index = FindNode(agv.Place); int index = FindNode(agv.Place);
if (index == -1) return; if (index == -1) return;
ClientNode node = Common.nodeInfo[index]; ClientNode node = Common.nodeInfo[index];
...@@ -1304,7 +1354,7 @@ namespace BLL ...@@ -1304,7 +1354,7 @@ namespace BLL
break; break;
} }
AgvChanged?.Invoke(idx);
} }
/// <summary> /// <summary>
/// 查看A5、A6需要小料架的状况 /// 查看A5、A6需要小料架的状况
...@@ -1375,7 +1425,7 @@ namespace BLL ...@@ -1375,7 +1425,7 @@ namespace BLL
/// <param name="agv"></param> /// <param name="agv"></param>
private void CheckA5A6State_SmallShelf(Agv_Info agv) private void CheckA5A6State_SmallShelf(Agv_Info agv)
{ {
if (!agv.TaskSend.Equals("") && !agv.TaskSend.Equals("AutoCharge")) if (!agv.TaskSend.Equals("") )
return; return;
bool rtn = false; bool rtn = false;
int tarIdx = Common.nodeInfo.FindIndex(s => s.Name == "A5" int tarIdx = Common.nodeInfo.FindIndex(s => s.Name == "A5"
...@@ -1428,7 +1478,7 @@ namespace BLL ...@@ -1428,7 +1478,7 @@ namespace BLL
/// <param name="agv"></param> /// <param name="agv"></param>
private void CheckA5A6State_BigShelf(Agv_Info agv) private void CheckA5A6State_BigShelf(Agv_Info agv)
{ {
if (!agv.TaskSend.Equals("") && !agv.TaskSend.Equals("AutoCharge")) if (!agv.TaskSend.Equals(""))
return; return;
bool rtn = false; bool rtn = false;
int tarIdx = Common.nodeInfo.FindIndex(s => s.Name == "A5" int tarIdx = Common.nodeInfo.FindIndex(s => s.Name == "A5"
...@@ -1488,7 +1538,7 @@ namespace BLL ...@@ -1488,7 +1538,7 @@ namespace BLL
private void StateLeaveFinish(int idx) private void StateLeaveFinish(int idx)
{ {
Agv_Info agv = Common.agvInfo[idx]; Agv_Info agv = Common.agvInfo[idx];
if (!agv.TaskSend.Equals("") && !agv.TaskSend.Equals("AutoCharge")) return; if (!agv.TaskSend.Equals("")) return;
int index = FindNode(agv.Place); int index = FindNode(agv.Place);
if (index == -1) return; if (index == -1) return;
ClientNode node = Common.nodeInfo[index]; ClientNode node = Common.nodeInfo[index];
...@@ -1668,6 +1718,7 @@ namespace BLL ...@@ -1668,6 +1718,7 @@ namespace BLL
} }
break; break;
} }
AgvChanged?.Invoke(idx);
} }
/// <summary> /// <summary>
...@@ -1696,7 +1747,7 @@ namespace BLL ...@@ -1696,7 +1747,7 @@ namespace BLL
private bool MoveStandby(Agv_Info agv) private bool MoveStandby(Agv_Info agv)
{ {
string log; string log;
if (!agv.TaskSend.Equals("") && !agv.TaskSend.Equals("AutoCharge")) if (!agv.TaskSend.Equals("") )
return false; return false;
//清除当前任务点 //清除当前任务点
if (!agv.Place.Equals("")) if (!agv.Place.Equals(""))
......
...@@ -68,6 +68,7 @@ ...@@ -68,6 +68,7 @@
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.TxtLog = new System.Windows.Forms.TextBox(); this.TxtLog = new System.Windows.Forms.TextBox();
this.tabPage3 = new System.Windows.Forms.TabPage(); this.tabPage3 = new System.Windows.Forms.TabPage();
this.button1 = new System.Windows.Forms.Button();
this.btnSetRFID = new System.Windows.Forms.Button(); this.btnSetRFID = new System.Windows.Forms.Button();
this.txtAgvRFID = new System.Windows.Forms.TextBox(); this.txtAgvRFID = new System.Windows.Forms.TextBox();
this.groupBox2 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox();
...@@ -95,7 +96,6 @@ ...@@ -95,7 +96,6 @@
this.BtnMissionReady = new System.Windows.Forms.Button(); this.BtnMissionReady = new System.Windows.Forms.Button();
this.LstAgvPlace = new System.Windows.Forms.ListBox(); this.LstAgvPlace = new System.Windows.Forms.ListBox();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.button1 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.DgvAgv)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.DgvAgv)).BeginInit();
this.tabControl1.SuspendLayout(); this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout(); this.tabPage1.SuspendLayout();
...@@ -541,6 +541,16 @@ ...@@ -541,6 +541,16 @@
this.tabPage3.Text = "agv手动"; this.tabPage3.Text = "agv手动";
this.tabPage3.UseVisualStyleBackColor = true; this.tabPage3.UseVisualStyleBackColor = true;
// //
// button1
//
this.button1.Location = new System.Drawing.Point(632, 85);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(109, 44);
this.button1.TabIndex = 35;
this.button1.Text = "设置负载信号";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click_1);
//
// btnSetRFID // btnSetRFID
// //
this.btnSetRFID.Location = new System.Drawing.Point(448, 85); this.btnSetRFID.Location = new System.Drawing.Point(448, 85);
...@@ -585,6 +595,7 @@ ...@@ -585,6 +595,7 @@
this.groupBox2.TabIndex = 32; this.groupBox2.TabIndex = 32;
this.groupBox2.TabStop = false; this.groupBox2.TabStop = false;
this.groupBox2.Text = "充电"; this.groupBox2.Text = "充电";
this.groupBox2.Visible = false;
// //
// cmbBoxAGVName // cmbBoxAGVName
// //
...@@ -839,16 +850,6 @@ ...@@ -839,16 +850,6 @@
this.tableLayoutPanel3.Size = new System.Drawing.Size(1746, 776); this.tableLayoutPanel3.Size = new System.Drawing.Size(1746, 776);
this.tableLayoutPanel3.TabIndex = 7; this.tableLayoutPanel3.TabIndex = 7;
// //
// button1
//
this.button1.Location = new System.Drawing.Point(632, 85);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(109, 44);
this.button1.TabIndex = 35;
this.button1.Text = "设置负载信号";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click_1);
//
// FrmMain // FrmMain
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
......
...@@ -36,6 +36,9 @@ namespace AGVControl ...@@ -36,6 +36,9 @@ namespace AGVControl
for (int i = 0; i < Common.agvInfo.Count; i++) for (int i = 0; i < Common.agvInfo.Count; i++)
{ {
Common.mir.Get_IO_Status(Common.agvInfo[i], out bool[] input, out bool[] output);
if (input != null && input.Length == 4)
Common.agvInfo[i].IsExistShelf = input[3];
n = DgvAgv.Rows.Add(Common.agvInfo[i].ToRow()); n = DgvAgv.Rows.Add(Common.agvInfo[i].ToRow());
DgvAgv.Rows[n].HeaderCell.Value = (n + 1).ToString(); DgvAgv.Rows[n].HeaderCell.Value = (n + 1).ToString();
if (i % 2 == 0) if (i % 2 == 0)
...@@ -84,7 +87,7 @@ namespace AGVControl ...@@ -84,7 +87,7 @@ namespace AGVControl
private void Control_AgvChanged(int agvIndex) private void Control_AgvChanged(int agvIndex)
{ {
Invoke(new Action(() => { DgvAgv.Rows[agvIndex].DefaultCellStyle.ForeColor = Common.agvInfo[agvIndex].StateID.Equals(12) ?Color.Red: Color.Black; })); Invoke(new Action(() => { DgvAgv.Rows[agvIndex].DefaultCellStyle.ForeColor = Common.agvInfo[agvIndex].StateID.Equals(12) ? Color.Red : Color.Black; }));
Invoke(new Action(() => Invoke(new Action(() =>
{ {
DgvAgv.Rows[agvIndex].SetValues(Common.agvInfo[agvIndex].ToRow()); DgvAgv.Rows[agvIndex].SetValues(Common.agvInfo[agvIndex].ToRow());
...@@ -228,18 +231,30 @@ namespace AGVControl ...@@ -228,18 +231,30 @@ namespace AGVControl
DgvAgv.Rows[e.RowIndex].SetValues(Common.agvInfo[e.RowIndex].ToRow()); DgvAgv.Rows[e.RowIndex].SetValues(Common.agvInfo[e.RowIndex].ToRow());
//清除节点缓存 //清除节点缓存
//int idx = Common.nodeInfo.FindIndex(s => s.Name == place); int idx = Common.nodeInfo.FindIndex(s => s.Name == place);
//if (idx > -1) if (idx > -1)
//{ {
// Common.nodeInfo[idx].AgvName = ""; Common.nodeInfo[idx].AgvName = "";
// DgvNode.Rows[idx].Cells[5].Value = ""; DgvNode.Rows[idx].Cells[5].Value = "";
//} }
////添加Init任务 ////添加Init任务
//Common.mir.Add_Mission_Fleet(Common.agvInfo[e.RowIndex], Common.agvMission["Init"]); //Common.mir.Add_Mission_Fleet(Common.agvInfo[e.RowIndex], Common.agvMission["Init"]);
Common.mir.Add_Mission(Common.agvInfo[e.RowIndex], Common.agvMission["Init"]); Common.mir.Add_Mission(Common.agvInfo[e.RowIndex], Common.agvMission["Init"]);
Common.mir.State_Ready(Common.agvInfo[e.RowIndex]); Common.mir.State_Ready(Common.agvInfo[e.RowIndex]);
//判断小车负载与实际是否匹配
Common.mir.Get_IO_Status(Common.agvInfo[e.RowIndex], out bool[] input, out bool[] output);
if (input != null && input.Length == 4)
{
if (!Common.agvInfo[e.RowIndex].IsExistShelf.Equals(input[3]))
{
if (MessageBox.Show("满载IO信号与当前负载信号不一致,是否同步?","警告",MessageBoxButtons.YesNo).Equals(DialogResult.Yes))
Common.agvInfo[e.RowIndex].IsExistShelf = input[3];
DgvAgv.Rows[e.RowIndex].SetValues(Common.agvInfo[e.RowIndex].ToRow());
}
}
} }
} }
......
...@@ -51,4 +51,3 @@ D:\OneDrive - 上海挚锦科技有限公司\SMD\AGVControl-Qisda-ProductionLine ...@@ -51,4 +51,3 @@ D:\OneDrive - 上海挚锦科技有限公司\SMD\AGVControl-Qisda-ProductionLine
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\bin\Debug\AsaPL.AgvClient.dll C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\bin\Debug\AsaPL.AgvClient.dll
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\bin\Debug\log4net.dll C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\bin\Debug\log4net.dll
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\bin\Debug\AsaPL.AgvClient.pdb C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\bin\Debug\AsaPL.AgvClient.pdb
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl-ProductionLine.csprojAssemblyReference.cache
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!