Commit 10db8698 张东亮

添加逐鹿agv

1 个父辈 dea7d1f1
......@@ -758,6 +758,10 @@ namespace AGVControl
/// </summary>
public string charge6 = "";
/// <summary>
/// 1号充电桩的AGV名称
/// </summary>
public string charge7 = "";
/// <summary>
/// 充电等待时间(s)
/// </summary>
public int chargeWait = 0;
......
......@@ -94,14 +94,14 @@ namespace BLL
if (stateText.Equals("Error") || stateText.Equals("EmergencyStop") || stateText.Equals("Pause"))
{
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信号与负载信号不匹配"));
msglist.Add(new AlarmMsg(Common.agvInfo[i].Name, "agv." + Common.agvInfo[i].Name + ".IsExistShelf", "agv负载:" + "IO信号与负载信号不匹配"));
}
}
......@@ -157,8 +157,8 @@ namespace BLL
if (!Common.agvInfo[i].IsCon) continue; //AGV网络连接
if (!Common.agvInfo[i].IsUse) continue; //AGV是否可用
//Ready,Pause,Executing
if (Common.agvInfo[i].StateID != 3 && Common.agvInfo[i].StateID != 4 && Common.agvInfo[i].StateID != 5)
//Ready,Pause,Executing,Error
if (Common.agvInfo[i].StateID != 3 && Common.agvInfo[i].StateID != 4 && Common.agvInfo[i].StateID != 5 && Common.agvInfo[i].StateID != 12)
{
Common.LogInfo(string.Format("{0}不能调用 StateID={1}, StateText={2}", Common.agvInfo[i].Name, Common.agvInfo[i].StateID, Common.agvInfo[i].StateText));
continue;
......@@ -304,10 +304,12 @@ namespace BLL
//检查是否需要充电
if (CheckIsNeedCharge(agv))
return;
if (CheckEmptyShelf(agv, agv.Place, true))//先出空料架
return;
if (CheckA6State(agv))
return;
CheckEmptyShelf(agv, agv.Place, true);//先出空料架
AgvChanged?.Invoke(idx);
#region 出空料架,带节点状态-不用
//ClientLevel clientLevel = Common.linePlace.Values.Max<ClientLevel>();
......@@ -379,6 +381,7 @@ namespace BLL
if (StatusCharge(agv))
return true;
}
return false;
}
return false;
......@@ -595,8 +598,32 @@ namespace BLL
}
return rtn;
}
//else if (Common.chargeStatus.charge7 == "")
//{
// rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["AutoCharge7"]);
// if (rtn)
// {
// agv.TaskSend = "AutoCharge7";
// Common.chargeStatus.charge3 = agv.Name;
// Common.chargeStatus.chargeInterval = DateTime.Now.Ticks;
// log = string.Format("{0} AutoCharge7", agv.Name);
// Common.LogInfo(log);
// Common.mir.State_Ready(agv);
// }
// else
// {
// agv.TaskSend = "";
// log = string.Format("{0} AutoCharge7 失败", agv.Name);
// //防止上一个任务已执行但返回失败时,删除任务
// //Common.mir.Del_Mission(agv);
// Common.LogInfo(log);
// }
// return rtn;
//}
else
{
MoveStandby(agv);
return false;
}
#endregion
......@@ -633,6 +660,11 @@ namespace BLL
rtn = FindA6Leave(out string nextNode);
if (rtn && !agv.IsExistShelf)
{
int ii = Common.missionManager.missionList.FindIndex(s=>s.NodeName.Equals(nextNode));
if(ii>-1)//出满料节点有空架子任务
{
return false;
}
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["CheckShelf"]);
if (!rtn)
return false;
......@@ -807,13 +839,13 @@ namespace BLL
/// </summary>
/// <param name="idx"></param>
private void StateMoveFinish(int idx)
{
{
bool rtn;
Agv_Info agv = Common.agvInfo[idx];
if (!agv.TaskSend.Equals(""))
return;
int index = FindNode(agv.Place);
if(agv.Place.StartsWith("F"))
if (agv.Place.StartsWith("F"))
{
ProcessDoor(agv);
return;
......@@ -904,6 +936,15 @@ namespace BLL
case "E4":
case "E5":
case "E6":
case "E7":
case "E8":
case "E9":
case "E10":
case "E11":
case "E12":
case "E14":
case "E15":
case "E16":
if (node.Action == ClientAction.MayEnter)
{
if (agv.TaskSend == "Leave") return;
......@@ -1002,15 +1043,6 @@ namespace BLL
}
break;
case "E7":
case "E8":
case "E9":
case "E10":
case "E11":
case "E12":
case "E14":
case "E15":
case "E16":
case "G1":
case "G2":
case "G3":
......@@ -1102,7 +1134,7 @@ namespace BLL
case "J5":
case "J6":
case "J7":
case "J8":
case "J8":
CheckA5A6State_SmallShelf(agv);
break;
}
......@@ -1120,7 +1152,7 @@ namespace BLL
case "F7":
case "F8":
//ResetNodeState(node, agv);
Common.log.Debug(string.Format("{0} MoveDoor {1}[RFID={2}] Finish.",agv.Name,agv.Place,agv.RFID));
Common.log.Debug(string.Format("{0} MoveDoor {1}[RFID={2}] Finish.", agv.Name, agv.Place, agv.RFID));
break;
}
}
......@@ -1425,7 +1457,7 @@ namespace BLL
/// <param name="agv"></param>
private void CheckA5A6State_SmallShelf(Agv_Info agv)
{
if (!agv.TaskSend.Equals("") )
if (!agv.TaskSend.Equals(""))
return;
bool rtn = false;
int tarIdx = Common.nodeInfo.FindIndex(s => s.Name == "A5"
......@@ -1747,7 +1779,7 @@ namespace BLL
private bool MoveStandby(Agv_Info agv)
{
string log;
if (!agv.TaskSend.Equals("") )
if (!agv.TaskSend.Equals(""))
return false;
//清除当前任务点
if (!agv.Place.Equals(""))
......@@ -1808,9 +1840,9 @@ namespace BLL
Thread.Sleep(1000);
Common.mir.State_Ready(Common.agvInfo[idx]);
Thread.Sleep(1000);
bool rtn = Common.mir.Add_Mission(Common.agvInfo[idx], Common.agvMission[agv.TaskSend]);
if (!rtn)
return false;
//bool rtn = Common.mir.Add_Mission(Common.agvInfo[idx], Common.agvMission[agv.TaskSend]);
//if (!rtn)
// return false;
Common.LogInfo(string.Format("{0}清除错误,继续任务", agv.Name, agv.TaskSend, agv.MissionText));
return true;
}
......@@ -1928,7 +1960,7 @@ namespace BLL
}
#endregion
if (Common.nodeInfo[i].Name.StartsWith("G") && Common.nodeInfo[i].AgvName.Equals("").Equals(false))//有小车在目标任务点(限制4C车间),等待结束后再接任务
if (Common.nodeInfo[i].AgvName.Equals("").Equals(false))//有小车在目标任务点(限制4C车间),等待结束后再接任务
{
Common.LogInfo("节点[" + loc + "]当前有任务,延迟A6出满料架任务[" + rfid + "]", false);
return false;
......
......@@ -96,6 +96,10 @@
this.BtnMissionReady = new System.Windows.Forms.Button();
this.LstAgvPlace = new System.Windows.Forms.ListBox();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.label5 = new System.Windows.Forms.Label();
this.TxtCharge7 = new System.Windows.Forms.TextBox();
this.BtnWriteCharge7 = new System.Windows.Forms.Button();
this.BtnReadCharge7 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.DgvAgv)).BeginInit();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
......@@ -571,6 +575,10 @@
//
// groupBox2
//
this.groupBox2.Controls.Add(this.label5);
this.groupBox2.Controls.Add(this.TxtCharge7);
this.groupBox2.Controls.Add(this.BtnWriteCharge7);
this.groupBox2.Controls.Add(this.BtnReadCharge7);
this.groupBox2.Controls.Add(this.cmbBoxAGVName);
this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Controls.Add(this.TxtCharge5);
......@@ -589,9 +597,9 @@
this.groupBox2.Controls.Add(this.TxtCharge4);
this.groupBox2.Controls.Add(this.BtnWriteCharge4);
this.groupBox2.Controls.Add(this.BtnReadCharge4);
this.groupBox2.Location = new System.Drawing.Point(1310, 33);
this.groupBox2.Location = new System.Drawing.Point(969, 34);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(338, 445);
this.groupBox2.Size = new System.Drawing.Size(730, 309);
this.groupBox2.TabIndex = 32;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "充电";
......@@ -609,7 +617,7 @@
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(30, 295);
this.label3.Location = new System.Drawing.Point(301, 127);
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(60, 15);
......@@ -618,7 +626,7 @@
//
// TxtCharge5
//
this.TxtCharge5.Location = new System.Drawing.Point(26, 314);
this.TxtCharge5.Location = new System.Drawing.Point(297, 146);
this.TxtCharge5.Margin = new System.Windows.Forms.Padding(4);
this.TxtCharge5.Name = "TxtCharge5";
this.TxtCharge5.Size = new System.Drawing.Size(127, 25);
......@@ -626,7 +634,7 @@
//
// BtnReadCharge5
//
this.BtnReadCharge5.Location = new System.Drawing.Point(26, 347);
this.BtnReadCharge5.Location = new System.Drawing.Point(297, 179);
this.BtnReadCharge5.Margin = new System.Windows.Forms.Padding(4);
this.BtnReadCharge5.Name = "BtnReadCharge5";
this.BtnReadCharge5.Size = new System.Drawing.Size(128, 38);
......@@ -650,7 +658,7 @@
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(166, 295);
this.label4.Location = new System.Drawing.Point(437, 127);
this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(60, 15);
......@@ -659,7 +667,7 @@
//
// BtnWriteCharge5
//
this.BtnWriteCharge5.Location = new System.Drawing.Point(26, 393);
this.BtnWriteCharge5.Location = new System.Drawing.Point(297, 225);
this.BtnWriteCharge5.Margin = new System.Windows.Forms.Padding(4);
this.BtnWriteCharge5.Name = "BtnWriteCharge5";
this.BtnWriteCharge5.Size = new System.Drawing.Size(128, 38);
......@@ -670,7 +678,7 @@
//
// TxtCharge6
//
this.TxtCharge6.Location = new System.Drawing.Point(162, 314);
this.TxtCharge6.Location = new System.Drawing.Point(433, 146);
this.TxtCharge6.Margin = new System.Windows.Forms.Padding(4);
this.TxtCharge6.Name = "TxtCharge6";
this.TxtCharge6.Size = new System.Drawing.Size(127, 25);
......@@ -678,7 +686,7 @@
//
// BtnWriteCharge6
//
this.BtnWriteCharge6.Location = new System.Drawing.Point(162, 393);
this.BtnWriteCharge6.Location = new System.Drawing.Point(433, 225);
this.BtnWriteCharge6.Margin = new System.Windows.Forms.Padding(4);
this.BtnWriteCharge6.Name = "BtnWriteCharge6";
this.BtnWriteCharge6.Size = new System.Drawing.Size(128, 38);
......@@ -689,7 +697,7 @@
//
// BtnReadCharge6
//
this.BtnReadCharge6.Location = new System.Drawing.Point(162, 347);
this.BtnReadCharge6.Location = new System.Drawing.Point(433, 179);
this.BtnReadCharge6.Margin = new System.Windows.Forms.Padding(4);
this.BtnReadCharge6.Name = "BtnReadCharge6";
this.BtnReadCharge6.Size = new System.Drawing.Size(128, 38);
......@@ -850,6 +858,46 @@
this.tableLayoutPanel3.Size = new System.Drawing.Size(1746, 776);
this.tableLayoutPanel3.TabIndex = 7;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(595, 127);
this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(60, 15);
this.label5.TabIndex = 31;
this.label5.Text = "充电桩7";
//
// TxtCharge7
//
this.TxtCharge7.Location = new System.Drawing.Point(591, 146);
this.TxtCharge7.Margin = new System.Windows.Forms.Padding(4);
this.TxtCharge7.Name = "TxtCharge7";
this.TxtCharge7.Size = new System.Drawing.Size(127, 25);
this.TxtCharge7.TabIndex = 28;
//
// BtnWriteCharge7
//
this.BtnWriteCharge7.Location = new System.Drawing.Point(591, 225);
this.BtnWriteCharge7.Margin = new System.Windows.Forms.Padding(4);
this.BtnWriteCharge7.Name = "BtnWriteCharge7";
this.BtnWriteCharge7.Size = new System.Drawing.Size(128, 38);
this.BtnWriteCharge7.TabIndex = 30;
this.BtnWriteCharge7.Text = "写";
this.BtnWriteCharge7.UseVisualStyleBackColor = true;
this.BtnWriteCharge7.Click += new System.EventHandler(this.BtnReadWriteCharge_Click);
//
// BtnReadCharge7
//
this.BtnReadCharge7.Location = new System.Drawing.Point(591, 179);
this.BtnReadCharge7.Margin = new System.Windows.Forms.Padding(4);
this.BtnReadCharge7.Name = "BtnReadCharge7";
this.BtnReadCharge7.Size = new System.Drawing.Size(128, 38);
this.BtnReadCharge7.TabIndex = 29;
this.BtnReadCharge7.Text = "读";
this.BtnReadCharge7.UseVisualStyleBackColor = true;
this.BtnReadCharge7.Click += new System.EventHandler(this.BtnReadWriteCharge_Click);
//
// FrmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
......@@ -950,6 +998,10 @@
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3;
private System.Windows.Forms.Button btnAddMission;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox TxtCharge7;
private System.Windows.Forms.Button BtnWriteCharge7;
private System.Windows.Forms.Button BtnReadCharge7;
}
}
......@@ -387,6 +387,8 @@ namespace AGVControl
TxtCharge5.Text = Common.chargeStatus.charge5;
else if (num == 6)
TxtCharge6.Text = Common.chargeStatus.charge6;
else if (num == 7)
TxtCharge7.Text = Common.chargeStatus.charge7;
}
else if (name.IndexOf("Write") > 0)
{
......@@ -405,7 +407,8 @@ namespace AGVControl
Common.chargeStatus.charge5 = TxtCharge5.Text;
else if (num == 6)
Common.chargeStatus.charge6 = TxtCharge6.Text;
else if (num == 7)
Common.chargeStatus.charge7 = TxtCharge7.Text;
if (Common.agvInfo[idx].IsCon)
{
bool rtn = Common.mir.Add_Mission(Common.agvInfo[idx], Common.agvMission["AutoCharge" + num.ToString()]);
......@@ -431,10 +434,10 @@ namespace AGVControl
switch (cmbBoxAGVName.SelectedIndex)
{
case 0:
TxtCharge4.Text = "MiR_R1763";
TxtCharge3.Text = "MiR_R1763";
break;
case 1:
TxtCharge3.Text = "MiR_R1764";
TxtCharge4.Text = "MiR_R1764";
break;
case 2:
TxtCharge5.Text = "MiR_R1767";
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!