Commit dea7d1f1 张东亮

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

1 个父辈 6881db5f
......@@ -566,7 +566,7 @@ namespace AGVControl
public void GetPlace(int value)
{
Common.log.Debug(Name + "获取PLC20值 " + value);
Common.log.Debug(Name + " PLC20=" + value);
if (value == 0)
{
Place = "";
......@@ -592,7 +592,7 @@ namespace AGVControl
if (node != null)
PlaceAliceName = node.AliceName;
else
PlaceAliceName = "";
PlaceAliceName = Place;
}
PlaceState = (PlaceState)c;
}
......@@ -610,8 +610,8 @@ namespace AGVControl
s.Add(RFID);
s.Add(Msg);
s.Add(MissionText);
//s.Add(PlaceAliceName);
s.Add(Place);
s.Add(PlaceAliceName);
//s.Add(Place);
s.Add(PlaceState.ToString());
if (Common.nodeInfo != null && Common.nodeInfo.Count != 0)
{
......@@ -619,7 +619,7 @@ namespace AGVControl
if (node != null)
NextPlaceAliceName = node.AliceName;
else
NextPlaceAliceName = "";
NextPlaceAliceName = NextPlace;
}
s.Add(NextPlaceAliceName);
}
......
......@@ -63,7 +63,8 @@ namespace BLL
//获取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);
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;
if (rtn) change = Common.agvInfo[i].SetState(stateID, stateText, battery, mission_text, position);
......@@ -95,6 +96,15 @@ namespace BLL
isAlarm = true;
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)
BLL.AGVManager.updateDeviceAlarmMsg(msglist);
......@@ -265,7 +275,7 @@ namespace BLL
Agv_Info agv = Common.agvInfo[idx];
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.Msg = "";
//空闲状态下,清空空架任务agv名字
......@@ -298,7 +308,7 @@ namespace BLL
return;
if (CheckA6State(agv))
return;
AgvChanged?.Invoke(idx);
#region 出空料架,带节点状态-不用
//ClientLevel clientLevel = Common.linePlace.Values.Max<ClientLevel>();
////出空料架
......@@ -489,7 +499,7 @@ namespace BLL
#endregion
#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);
if (rtn)
......@@ -513,7 +523,7 @@ namespace BLL
}
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);
if (rtn)
......@@ -602,8 +612,23 @@ namespace BLL
int index;
string RFID = "";
Thread.Sleep(3000);
if (!agv.TaskSend.Equals("") && !agv.TaskSend.Equals("AutoCharge"))
if (!agv.TaskSend.Equals(""))
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出满料
rtn = FindA6Leave(out string nextNode);
if (rtn && !agv.IsExistShelf)
......@@ -640,8 +665,22 @@ namespace BLL
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;
//判断小车负载与实际是否匹配
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)
......@@ -771,7 +810,14 @@ namespace BLL
{
bool rtn;
Agv_Info agv = Common.agvInfo[idx];
if (!agv.TaskSend.Equals(""))
return;
int index = FindNode(agv.Place);
if(agv.Place.StartsWith("F"))
{
ProcessDoor(agv);
return;
}
if (agv.Place.StartsWith("J"))
{
ProcessStandyTemp(agv);
......@@ -782,18 +828,6 @@ namespace BLL
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":
if (node.Action == ClientAction.MayEnter)
{
......@@ -1054,7 +1088,7 @@ namespace BLL
break;
}
AgvChanged?.Invoke(idx);
}
private void ProcessStandyTemp(Agv_Info agv)
......@@ -1069,11 +1103,27 @@ namespace BLL
case "J6":
case "J7":
case "J8":
//ResetNodeState(node, agv);
CheckA5A6State_SmallShelf(agv);
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>
......@@ -1179,7 +1229,7 @@ namespace BLL
{
bool rtn;
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);
if (index == -1) return;
ClientNode node = Common.nodeInfo[index];
......@@ -1304,7 +1354,7 @@ namespace BLL
break;
}
AgvChanged?.Invoke(idx);
}
/// <summary>
/// 查看A5、A6需要小料架的状况
......@@ -1375,7 +1425,7 @@ namespace BLL
/// <param name="agv"></param>
private void CheckA5A6State_SmallShelf(Agv_Info agv)
{
if (!agv.TaskSend.Equals("") && !agv.TaskSend.Equals("AutoCharge"))
if (!agv.TaskSend.Equals("") )
return;
bool rtn = false;
int tarIdx = Common.nodeInfo.FindIndex(s => s.Name == "A5"
......@@ -1428,7 +1478,7 @@ namespace BLL
/// <param name="agv"></param>
private void CheckA5A6State_BigShelf(Agv_Info agv)
{
if (!agv.TaskSend.Equals("") && !agv.TaskSend.Equals("AutoCharge"))
if (!agv.TaskSend.Equals(""))
return;
bool rtn = false;
int tarIdx = Common.nodeInfo.FindIndex(s => s.Name == "A5"
......@@ -1488,7 +1538,7 @@ namespace BLL
private void StateLeaveFinish(int 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);
if (index == -1) return;
ClientNode node = Common.nodeInfo[index];
......@@ -1668,6 +1718,7 @@ namespace BLL
}
break;
}
AgvChanged?.Invoke(idx);
}
/// <summary>
......@@ -1696,7 +1747,7 @@ namespace BLL
private bool MoveStandby(Agv_Info agv)
{
string log;
if (!agv.TaskSend.Equals("") && !agv.TaskSend.Equals("AutoCharge"))
if (!agv.TaskSend.Equals("") )
return false;
//清除当前任务点
if (!agv.Place.Equals(""))
......
......@@ -68,6 +68,7 @@
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.TxtLog = new System.Windows.Forms.TextBox();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.button1 = new System.Windows.Forms.Button();
this.btnSetRFID = new System.Windows.Forms.Button();
this.txtAgvRFID = new System.Windows.Forms.TextBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
......@@ -95,7 +96,6 @@
this.BtnMissionReady = new System.Windows.Forms.Button();
this.LstAgvPlace = new System.Windows.Forms.ListBox();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.button1 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.DgvAgv)).BeginInit();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
......@@ -541,6 +541,16 @@
this.tabPage3.Text = "agv手动";
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
//
this.btnSetRFID.Location = new System.Drawing.Point(448, 85);
......@@ -585,6 +595,7 @@
this.groupBox2.TabIndex = 32;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "充电";
this.groupBox2.Visible = false;
//
// cmbBoxAGVName
//
......@@ -839,16 +850,6 @@
this.tableLayoutPanel3.Size = new System.Drawing.Size(1746, 776);
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
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
......
......@@ -36,6 +36,9 @@ namespace AGVControl
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());
DgvAgv.Rows[n].HeaderCell.Value = (n + 1).ToString();
if (i % 2 == 0)
......@@ -84,7 +87,7 @@ namespace AGVControl
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(() =>
{
DgvAgv.Rows[agvIndex].SetValues(Common.agvInfo[agvIndex].ToRow());
......@@ -228,18 +231,30 @@ namespace AGVControl
DgvAgv.Rows[e.RowIndex].SetValues(Common.agvInfo[e.RowIndex].ToRow());
//清除节点缓存
//int idx = Common.nodeInfo.FindIndex(s => s.Name == place);
//if (idx > -1)
//{
// Common.nodeInfo[idx].AgvName = "";
// DgvNode.Rows[idx].Cells[5].Value = "";
//}
int idx = Common.nodeInfo.FindIndex(s => s.Name == place);
if (idx > -1)
{
Common.nodeInfo[idx].AgvName = "";
DgvNode.Rows[idx].Cells[5].Value = "";
}
////添加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.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
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\AsaPL.AgvClient.pdb
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl-ProductionLine.csprojAssemblyReference.cache
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!