Commit dd584799 张东亮

分盘线

1 个父辈 ca463496
...@@ -35,32 +35,10 @@ namespace BLL ...@@ -35,32 +35,10 @@ namespace BLL
return true; return true;
} }
if (serverResult.code != 0) return true; if (serverResult.code != 0) return true;
agv.LeftTaskCnt = serverResult.data.taskCount;
if (serverResult.data.taskCount == 0) //该料架出库完成 if (serverResult.data.taskCount == 0) //该料架出库完成
{ {
//清除mark Common.log.OutInfo(agv.Name + " 料架【" + agv.RFID + "】 无剩余出库任务,serverResult.shelfTaskData.taskCount=" + serverResult.data.taskCount.ToString());
List<string> markLst = new List<string>();
foreach (var mark in Common.control.Marks)
{
int count = 0;
foreach (var node in Common.nodeInfo)
{
if (mark.Equals(node.Mark))
count++;
}
if (count == 0)//mark存在标记,但节点任务没有,删除该mark
{
markLst.Add(mark);
}
}
if (markLst.Count != 0)
{
for (int i = 0; i < markLst.Count; i++)
{
Common.control.Marks.Remove(markLst[i]);
}
}
Common.log.OutInfo(agv.Name+" 料架【" + agv.RFID + "】 无剩余出库任务,serverResult.shelfTaskData.taskCount=" + serverResult.data.taskCount.ToString());
return true; return true;
} }
else //该料架的出库任务未完成 else //该料架的出库任务未完成
......
...@@ -94,7 +94,7 @@ namespace BLL ...@@ -94,7 +94,7 @@ namespace BLL
continue; continue;
} }
Common.log.OutInfo("AgvCall " + Common.agvInfo[i].Name + " " + Common.agvInfo[i].MissionStatus); //Common.log.OutInfo("AgvCall " + Common.agvInfo[i].Name + " " + Common.agvInfo[i].MissionStatus);
switch (Common.agvInfo[i].MissionStatus) switch (Common.agvInfo[i].MissionStatus)
{ {
case Mission_Status.None: //有空闲车辆 case Mission_Status.None: //有空闲车辆
...@@ -404,84 +404,136 @@ namespace BLL ...@@ -404,84 +404,136 @@ namespace BLL
{ {
try try
{ {
string log;
int nodeIdx = -1;
bool rtn; bool rtn;
string log;
Agv_Info agv = Common.agvInfo[agvIdx]; Agv_Info agv = Common.agvInfo[agvIdx];
int high = 0, middle = 0, low = 0; //检测IO信号
List<int> node = new List<int>(); rtn = Common.mir.Get_IO_Status(agv, out bool[] input, out bool[] output);
//清除节点AGV的名称 if (rtn)
foreach (var item in Common.nodeInfo)
{ {
if (item.AgvName.Equals(agv.Name)) if (input[3])
{ {
item.AgvName = ""; agv.IsUse = false;
Common.log.OutInfo("清除节点的AGV名称: 节点名:" + item.Name + ";AGV名称:" + agv.Name); AgvChanged?.Invoke(agvIdx);
System.Windows.Forms.MessageBox.Show("关闭小车调用,因检测到车上有料架/料串,不执行任务!请将料架移除再打开调用。");
return;
} }
int nodeIdx = -1;
} int high = 0, middle = 0, low = 0;
//B区域,需要出料,先拿料架 List<int> node = new List<int>();
//Mark.Length>1防止Mark为0的情况,Mark=0是VMI的进料 //清除节点AGV的名称
nodeIdx = Common.nodeInfo.FindIndex(s => s.Action == ClientAction.NeedEnter && s.AgvName.Equals("") && s.Mark.Length > 1 && s.IsUse); foreach (var item in Common.nodeInfo)
if (nodeIdx == -1)
{
Common.log.OutInfo("B区没有找到NeedEnter的节点");
}
else//B区域需要出料
{
//Mark没有被缓存
int n = Marks.FindIndex(t => t == Common.nodeInfo[nodeIdx].Mark);
if (n == -1)//
{ {
n = Common.nodeInfo.FindIndex(s => s.Name == "A7" && s.Action == ClientAction.NeedLeave && if (item.AgvName.Equals(agv.Name))
s.RFID.StartsWith("A") && s.AgvName.Equals("") && s.IsUse);
if (n > -1)
{ {
agv.Place = Common.nodeInfo[n].Name; item.AgvName = "";
agv.Mark = Common.nodeInfo[nodeIdx].Mark; Common.log.OutInfo("清除节点的AGV名称: 节点名:" + item.Name + ";AGV名称:" + agv.Name);
//agv.CloseDoor = false; }
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["Move" + agv.Place]); }
if (rtn) //B区域,需要出料,先拿料架
//Mark.Length>1防止Mark为0的情况,Mark=0是VMI的进料
nodeIdx = Common.nodeInfo.FindIndex(s => s.Action == ClientAction.NeedEnter && s.AgvName.Equals("") && s.Mark.Length > 1 && s.IsUse);
if (nodeIdx == -1)
{
Common.log.OutInfo("B区没有找到NeedEnter的节点");
}
else//B区域需要出料
{
//Mark没有被缓存
int n = Marks.FindIndex(t => t == Common.nodeInfo[nodeIdx].Mark);
if (n == -1)//
{
n = Common.nodeInfo.FindIndex(s => s.Name == "A7" && s.Action == ClientAction.NeedLeave &&
s.RFID.StartsWith("A") && s.AgvName.Equals("") && s.IsUse);
if (n > -1)
{ {
agv.CloseDoor = false; agv.Place = Common.nodeInfo[n].Name;
Common.nodeInfo[n].AgvName = agv.Name; agv.Mark = Common.nodeInfo[nodeIdx].Mark;
agv.TaskSend = true; //agv.CloseDoor = false;
//_mark.Add(Common.nodeInfo[nodeIdx].Mark);
MarkAdd(Common.nodeInfo[nodeIdx].Mark);
Common.log.OutString("Mark缓存 " + string.Join(",", Marks.ToArray()));
log = string.Format("{0} Move To {1}[{2}] [{3}]", agv.Name, agv.Place, rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["Move" + agv.Place]);
Common.nodeInfo[nodeIdx].Action.ToString(), Common.nodeInfo[nodeIdx].Mark); if (rtn)
Common.log.OutInfo(log); {
Common.log.OutTextBox(log); agv.CloseDoor = false;
Common.mir.State_Ready(agv); Common.nodeInfo[n].AgvName = agv.Name;
Common.server.NodeRefresh(n); agv.TaskSend = true;
//_mark.Add(Common.nodeInfo[nodeIdx].Mark);
MarkAdd(Common.nodeInfo[nodeIdx].Mark);
Common.log.OutString("Mark缓存 " + string.Join(",", Marks.ToArray()));
log = string.Format("{0} Move To {1}[{2}] [{3}]", agv.Name, agv.Place,
Common.nodeInfo[nodeIdx].Action.ToString(), Common.nodeInfo[nodeIdx].Mark);
Common.log.OutInfo(log);
Common.log.OutTextBox(log);
Common.mir.State_Ready(agv);
Common.server.NodeRefresh(n);
}
else
{
agv.TaskSend = false;
log = string.Format("{0} Move To {1} 失败", agv.Name, agv.Place);
//防止上一个任务已执行但返回失败时,删除任务
//Common.mir.Del_Mission(agv);
Common.log.OutInfo(log);
Common.log.OutTextBox(log);
}
} }
else else
{ {
agv.TaskSend = false; //A4没有被占用
log = string.Format("{0} Move To {1} 失败", agv.Name, agv.Place); n = Common.nodeInfo.FindIndex(s => s.Name == "A4" && s.Action == ClientAction.NeedLeave && s.AgvName.Equals("") && s.IsUse);
//防止上一个任务已执行但返回失败时,删除任务
//Common.mir.Del_Mission(agv);
Common.log.OutInfo(log);
Common.log.OutTextBox(log);
}
}
else
{
//A4没有被占用
n = Common.nodeInfo.FindIndex(s => s.Name == "A4" && s.Action == ClientAction.NeedLeave && s.AgvName.Equals("") && s.IsUse);
if (n == -1)
{
//nodeIdx = -1;
Common.log.OutInfo("A4不是NeedLeave或被占用");
Common.log.OutTextBox("A4没有架子或被占用");
n = Common.nodeInfo.FindIndex(s => s.Name == "A8" && s.Action == ClientAction.NeedEnter && s.AgvName.Equals("") && s.IsUse);
if (n == -1) if (n == -1)
{ {
Common.log.OutInfo("A8不是NeedEnter或被占用"); nodeIdx = -1;
Common.log.OutTextBox("A4、A7无空架子用与包装仓出库"); Common.log.OutInfo("A7,A4不是NeedLeave或被占用");
Common.log.OutTextBox("A7,A4没有架子或被占用");
#region 有出库任务,但A7,A4无空架子
//n = Common.nodeInfo.FindIndex(s => s.Name == "A8" && s.Action == ClientAction.NeedEnter && s.AgvName.Equals("") && s.IsUse);
//if (n == -1)
//{
// ClientNode a8Node = Common.nodeInfo.Find(s => s.Name.Equals("A8"));
// log = string.Format("A4、A7均无空架用于包装仓出库,且{0}已满,不可将A7架子放到{0}。需要人工干预 [ClientAction={1}]", a8Node.Name, a8Node.Action.ToString());
// Common.log.OutInfo(log);
// Common.log.OutTextBox(log);
//}
////A7,A4均无空架子,可将A7的架子移动到A8
//else
//{
// agv.Place = "A7";
// //agv.Mark = Common.nodeInfo[nodeIdx].Mark;
// //agv.CloseDoor = false;
// rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["Move" + agv.Place]);
// if (rtn)
// {
// agv.CloseDoor = false;
// Common.nodeInfo[n].AgvName = agv.Name;
// agv.TaskSend = true;
// //_mark.Add(Common.nodeInfo[nodeIdx].Mark);
// //MarkAdd(Common.nodeInfo[nodeIdx].Mark);
// log = string.Format("{0} Move To {1}[{2}] ", agv.Name, agv.Place,
// "A7,A4无料架用于包装仓");
// Common.log.OutInfo(log);
// Common.log.OutTextBox(log);
// Common.mir.State_Ready(agv);
// Common.server.NodeRefresh(n);
// AgvChanged?.Invoke(agvIdx);
// }
// else
// {
// agv.TaskSend = false;
// log = string.Format("{0} Move To {1}失败[{2}] ", agv.Name, agv.Place,
// "A7,A4无料架用于包装仓");
// //防止上一个任务已执行但返回失败时,删除任务
// //Common.mir.Del_Mission(agv);
// Common.log.OutInfo(log);
// Common.log.OutTextBox(log);
// }
//}
#endregion
} }
else else
{ {
...@@ -515,245 +567,232 @@ namespace BLL ...@@ -515,245 +567,232 @@ namespace BLL
Common.log.OutInfo(log); Common.log.OutInfo(log);
Common.log.OutTextBox(log); Common.log.OutTextBox(log);
} }
}
}
else
{
agv.Place = Common.nodeInfo[n].Name;
agv.Mark = Common.nodeInfo[nodeIdx].Mark;
//agv.CloseDoor = false;
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["Move" + agv.Place]);
if (rtn)
{
agv.CloseDoor = false;
Common.nodeInfo[n].AgvName = agv.Name;
agv.TaskSend = true;
//_mark.Add(Common.nodeInfo[nodeIdx].Mark);
MarkAdd(Common.nodeInfo[nodeIdx].Mark);
Common.log.OutString("Mark缓存 " + string.Join(",", Marks.ToArray()));
log = string.Format("{0} Move To {1}[{2}] [{3}]", agv.Name, agv.Place,
Common.nodeInfo[nodeIdx].Action.ToString(), Common.nodeInfo[nodeIdx].Mark);
Common.log.OutInfo(log);
Common.log.OutTextBox(log);
Common.mir.State_Ready(agv);
Common.server.NodeRefresh(n);
}
else
{
agv.TaskSend = false;
log = string.Format("{0} Move To {1} 失败", agv.Name, agv.Place);
//防止上一个任务已执行但返回失败时,删除任务
//Common.mir.Del_Mission(agv);
Common.log.OutInfo(log);
Common.log.OutTextBox(log);
}
//_mark.Add(Common.nodeInfo[nodeIdx].Mark); //_mark.Add(Common.nodeInfo[nodeIdx].Mark);
//Common.log.OutString("Mark缓存 " + string.Join(",", _mark.ToArray())); //Common.log.OutString("Mark缓存 " + string.Join(",", _mark.ToArray()));
//Common.nodeInfo[n].AgvName = agv.Name; //Common.nodeInfo[n].AgvName = agv.Name;
//agv.Place = Common.nodeInfo[n].Name; //agv.Place = Common.nodeInfo[n].Name;
//agv.Mark = Common.nodeInfo[nodeIdx].Mark; //agv.Mark = Common.nodeInfo[nodeIdx].Mark;
//rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["Move" + agv.Place]); //rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["Move" + agv.Place]);
//log = string.Format("{0} Move {1} {2} {3}", agv.Name, agv.Place, Common.nodeInfo[nodeIdx].Action.ToString(), Common.nodeInfo[nodeIdx].Mark); //log = string.Format("{0} Move {1} {2} {3}", agv.Name, agv.Place, Common.nodeInfo[nodeIdx].Action.ToString(), Common.nodeInfo[nodeIdx].Mark);
//Common.log.OutInfo(log); //Common.log.OutInfo(log);
//Common.log.OutTextBox(log); //Common.log.OutTextBox(log);
//rtn = Common.mir.State_Ready(agv); //rtn = Common.mir.State_Ready(agv);
//Common.server.NodeRefresh(n); //Common.server.NodeRefresh(n);
AgvChanged?.Invoke(agvIdx); AgvChanged?.Invoke(agvIdx);
return; return;
}
} }
}
}
else
{
Common.log.OutInfo("缓存中已存在 " + Common.nodeInfo[nodeIdx].Mark);
nodeIdx = -1;
}
} }
else
{
Common.log.OutInfo("缓存中已存在 " + Common.nodeInfo[nodeIdx].Mark);
nodeIdx = -1;
}
}
//需要出料架,且没有被标记 //需要出料架,且没有被标记
//A4是包装料仓的进料,不包含在内 //A4是包装料仓的进料,不包含在内
//根据优先级调用 //根据优先级调用
for (int i = 0; i < Common.nodeInfo.Count; i++) for (int i = 0; i < Common.nodeInfo.Count; i++)
{
if (Common.nodeInfo[i].Action == ClientAction.NeedLeave && Common.nodeInfo[i].Name != "A4" &&
Common.nodeInfo[i].Name != "A7" && Common.nodeInfo[i].AgvName == "" && Common.nodeInfo[i].IsUse)
{ {
switch (Common.nodeInfo[i].Level) if (Common.nodeInfo[i].Action == ClientAction.NeedLeave && Common.nodeInfo[i].Name != "A4" &&
Common.nodeInfo[i].AgvName == "" && Common.nodeInfo[i].IsUse)
{ {
case ClientLevel.High: switch (Common.nodeInfo[i].Level)
node.Insert(high++, i); {
middle++; case ClientLevel.High:
low++; node.Insert(high++, i);
break; middle++;
case ClientLevel.Middle: low++;
node.Insert(middle++, i); break;
low++; case ClientLevel.Middle:
break; node.Insert(middle++, i);
case ClientLevel.Low: low++;
node.Insert(low++, i); break;
break; case ClientLevel.Low:
node.Insert(low++, i);
break;
}
} }
} }
}
//测试,临时的 //测试,临时的
//for (int i = 0; i < node.Count; i++) //for (int i = 0; i < node.Count; i++)
//{ //{
// Common.log.OutString("Test " + node[i] + " Name=" + Common.nodeInfo[node[i]].Name + " Mark=" + Common.nodeInfo[node[i]].Mark); // Common.log.OutString("Test " + node[i] + " Name=" + Common.nodeInfo[node[i]].Name + " Mark=" + Common.nodeInfo[node[i]].Mark);
//} //}
if (node.Count == 0) if (node.Count == 0)
{ {
nodeIdx = -1; nodeIdx = -1;
Common.log.OutInfo("没有找到新的NeedLeave的节点"); Common.log.OutInfo("没有找到新的NeedLeave的节点");
} }
else else
{
//按顺序取符合要求的
for (int i = 0; i < node.Count; i++)
{ {
//B区域出料架 //按顺序取符合要求的
if (Common.nodeInfo[node[i]].Name.StartsWith("B")) for (int i = 0; i < node.Count; i++)
{ {
if (Common.nodeInfo[node[i]].Mark == "0" && Common.nodeInfo[node[i]].RFID.StartsWith("A"))//料仓读取到RFID的才获取锁定信息 //B区域出料架
if (Common.nodeInfo[node[i]].Name.StartsWith("B"))
{ {
//获取料架锁定信息 if (Common.nodeInfo[node[i]].Mark == "0" && Common.nodeInfo[node[i]].RFID.StartsWith("A"))//料仓读取到RFID的才获取锁定信息
AGVManager.GetShelfLockInfo(Common.nodeInfo[node[i]].Name, Common.nodeInfo[node[i]].RFID, shelfLockedNodeNames); {
nodeIdx = node[i]; //获取料架锁定信息
break; AGVManager.GetShelfLockInfo(Common.nodeInfo[node[i]].Name, Common.nodeInfo[node[i]].RFID, shelfLockedNodeNames);
nodeIdx = node[i];
break;
}
else
{
//在Mark缓存中,按照先后顺序出料,只有第一个出完才能出第二个
int idx = Marks.FindIndex(s => s == Common.nodeInfo[node[i]].Mark);
if (idx == 0)
{
nodeIdx = node[i];
break;
}
else if (idx == -1) //缓存中没有这个mark,可能是软件重启了
{
//_mark.Add(Common.nodeInfo[node[i]].Mark);
MarkAdd(Common.nodeInfo[node[i]].Mark);
nodeIdx = node[i];
break;
}
}
} }
else else if (Common.nodeInfo[node[i]].Name == "A1" && Common.nodeInfo[node[i]].RFID.StartsWith("B"))//A1出料串,检查C1,3,5是否需要
{ {
//在Mark缓存中,按照先后顺序出料,只有第一个出完才能出第二个 int n = Common.nodeInfo.FindIndex(s => s.Name == "C1" && s.Action == ClientAction.NeedEnter && s.AgvName == "" && s.IsUse);
int idx = Marks.FindIndex(s => s == Common.nodeInfo[node[i]].Mark); if (n == -1) n = Common.nodeInfo.FindIndex(s => s.Name == "C3" && s.Action == ClientAction.NeedEnter && s.AgvName == "" && s.IsUse);
if (idx == 0) if (n == -1) n = Common.nodeInfo.FindIndex(s => s.Name == "C5" && s.Action == ClientAction.NeedEnter && s.AgvName == "" && s.IsUse);
//入料口有一个没有占用
if (n > -1)
{ {
nodeIdx = node[i]; nodeIdx = node[i];
break; break;
} }
else if (idx == -1) //缓存中没有这个mark,可能是软件重启了 }
else if (Common.nodeInfo[node[i]].Name == "A1" && Common.nodeInfo[node[i]].RFID.StartsWith("A"))//B区域入料
{
if (FindAreaBEnter() > -1)
{ {
//_mark.Add(Common.nodeInfo[node[i]].Mark);
MarkAdd(Common.nodeInfo[node[i]].Mark);
nodeIdx = node[i]; nodeIdx = node[i];
break; break;
} }
} }
} else if (Common.nodeInfo[node[i]].Name == "A7" && Common.nodeInfo[node[i]].RFID.StartsWith("B"))//C7入料
else if (Common.nodeInfo[node[i]].Name == "A1" && Common.nodeInfo[node[i]].RFID.StartsWith("B"))//A1出料串,检查C1,3,5是否需要
{
int n = Common.nodeInfo.FindIndex(s => s.Name == "C1" && s.Action == ClientAction.NeedEnter && s.AgvName == "" && s.IsUse);
if (n == -1) n = Common.nodeInfo.FindIndex(s => s.Name == "C3" && s.Action == ClientAction.NeedEnter && s.AgvName == "" && s.IsUse);
if (n == -1) n = Common.nodeInfo.FindIndex(s => s.Name == "C5" && s.Action == ClientAction.NeedEnter && s.AgvName == "" && s.IsUse);
//入料口有一个没有占用
if (n > -1)
{ {
nodeIdx = node[i]; int n = Common.nodeInfo.FindIndex(s => s.Name == "C7" && s.Action == ClientAction.NeedEnter && s.AgvName == "" && s.IsUse);
break; //入料口有一个没有占用
if (n > -1)
{
nodeIdx = node[i];
break;
}
} }
} else if (Common.nodeInfo[node[i]].Name == "A7" && Common.nodeInfo[node[i]].RFID.StartsWith("A"))//A7有空料架
else if (Common.nodeInfo[node[i]].Name == "A1" && Common.nodeInfo[node[i]].RFID.StartsWith("A"))//B区域入料
{
if (FindAreaBEnter() > -1)
{ {
nodeIdx = node[i]; int n = Common.nodeInfo.FindIndex(s => s.Name == "A4" && s.Action == ClientAction.None && s.IsUse);
break; if (n > -1)//B区域无出库任务,A4无料架,往A3送一个空架子,便于出料串
{
n = Common.nodeInfo.FindIndex(s => s.Name == "A3" && s.Action == ClientAction.NeedEnter && s.AgvName == "" && s.IsUse);
//入料口有一个没有占用
if (n > -1)
{
nodeIdx = node[i];
break;
}
}
n = Common.nodeInfo.FindIndex(s => s.Name == "C7" && s.Action == ClientAction.NeedEnter && s.AgvName == "" && s.IsUse);
//入料口有一个没有占用
if (n > -1)
{
nodeIdx = node[i];
break;
}
} }
} else if (Common.nodeInfo[node[i]].Name == "C2" || Common.nodeInfo[node[i]].Name == "C4" || Common.nodeInfo[node[i]].Name == "C6")//C2,4,6准备出空架子,A2需要料
else if (Common.nodeInfo[node[i]].Name == "A7" && Common.nodeInfo[node[i]].RFID.StartsWith("B"))//C7入料
{
int n = Common.nodeInfo.FindIndex(s => s.Name == "C7" && s.Action == ClientAction.NeedEnter && s.AgvName == "" && s.IsUse);
//入料口有一个没有占用
if (n > -1)
{ {
nodeIdx = node[i]; int n = Common.nodeInfo.FindIndex(s => s.Name == "C7" && s.Action == ClientAction.NeedEnter && s.AgvName == "" && s.IsUse);
break; if (n == -1) n = Common.nodeInfo.FindIndex(s => s.Name == "A2" && s.Action == ClientAction.NeedEnter && s.AgvName == "" && s.IsUse);
//入料口有一个没有占用
if (n > -1)
{
nodeIdx = node[i];
break;
}
} }
} else if (Common.nodeInfo[node[i]].Name == "C8")//C8出往A8
else if (Common.nodeInfo[node[i]].Name == "C2" || Common.nodeInfo[node[i]].Name == "C4" || Common.nodeInfo[node[i]].Name == "C6")//C2,4,6准备出空架子,A2需要料
{
int n = Common.nodeInfo.FindIndex(s => s.Name == "C7" && s.Action == ClientAction.NeedEnter && s.AgvName == "" && s.IsUse);
if (n == -1) n = Common.nodeInfo.FindIndex(s => s.Name == "A2" && s.Action == ClientAction.NeedEnter && s.AgvName == "" && s.IsUse);
//入料口有一个没有占用
if (n > -1)
{ {
nodeIdx = node[i]; int n = Common.nodeInfo.FindIndex(s => s.Name == "A8" && s.Action == ClientAction.NeedEnter && s.AgvName == "" && s.IsUse);
break; //入料口没有占用
if (n > -1)
{
nodeIdx = node[i];
break;
}
} }
} else
else if (Common.nodeInfo[node[i]].Name == "C8")//C8出往A8
{
int n = Common.nodeInfo.FindIndex(s => s.Name == "A8" && s.Action == ClientAction.NeedEnter && s.AgvName == "" && s.IsUse);
//入料口没有占用
if (n > -1)
{ {
nodeIdx = node[i]; nodeIdx = node[i];
break; break;
} }
} }
else
{
nodeIdx = node[i];
break;
}
}
if (nodeIdx > -1) if (nodeIdx > -1)
{
if (Common.nodeInfo[nodeIdx].Name == "A1")
{ {
if (Common.nodeInfo[nodeIdx].RFID.Length == 0 || Common.nodeInfo[nodeIdx].RFID == "00") if (Common.nodeInfo[nodeIdx].Name == "A1")
{ {
Common.log.OutInfo("A1 RFID 错误"); if (Common.nodeInfo[nodeIdx].RFID.Length == 0 || Common.nodeInfo[nodeIdx].RFID == "00")
Common.log.OutTextBox("A1 RFID 错误"); {
return; Common.log.OutInfo("A1 RFID 错误");
Common.log.OutTextBox("A1 RFID 错误");
return;
}
else
{
Common.log.OutInfo("[StatusNone Assign Mission A1] " + agv.Name + " " + Common.nodeInfo[nodeIdx].Name);
MoveNode(agv, nodeIdx);
return;
}
} }
else else
{ {
Common.log.OutInfo("[StatusNone Assign Mission A1] " + agv.Name + " " + Common.nodeInfo[nodeIdx].Name); Common.log.OutInfo("[StatusNone Assign Mission other] " + agv.Name + " " + Common.nodeInfo[nodeIdx].Name);
MoveNode(agv, nodeIdx); MoveNode(agv, nodeIdx);
return; return;
} }
} }
else
{
Common.log.OutInfo("[StatusNone Assign Mission other] " + agv.Name + " " + Common.nodeInfo[nodeIdx].Name);
MoveNode(agv, nodeIdx);
return;
}
}
//Common.nodeInfo[nodeIdx].AgvName = agv.Name; //Common.nodeInfo[nodeIdx].AgvName = agv.Name;
//agv.Place = Common.nodeInfo[nodeIdx].Name; //agv.Place = Common.nodeInfo[nodeIdx].Name;
//agv.Mark = Common.nodeInfo[nodeIdx].Mark; //agv.Mark = Common.nodeInfo[nodeIdx].Mark;
//rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["Move" + agv.Place]); //rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["Move" + agv.Place]);
//log = string.Format("{0} Move {1} {2}", agv.Name, agv.Place, Common.nodeInfo[nodeIdx].Action.ToString()); //log = string.Format("{0} Move {1} {2}", agv.Name, agv.Place, Common.nodeInfo[nodeIdx].Action.ToString());
//Common.log.OutInfo(log); //Common.log.OutInfo(log);
//Common.log.OutTextBox(log); //Common.log.OutTextBox(log);
//rtn = Common.mir.State_Ready(agv); //rtn = Common.mir.State_Ready(agv);
//AgvChanged?.Invoke(agvIdx);
//Common.server.NodeRefresh(nodeIdx);
//return;
} //AgvChanged?.Invoke(agvIdx);
//Common.server.NodeRefresh(nodeIdx);
//return;
}
}
} }
catch (Exception ex) catch (Exception ex)
...@@ -1447,7 +1486,7 @@ namespace BLL ...@@ -1447,7 +1486,7 @@ namespace BLL
else else
{ {
int idx = Common.agvInfo.FindIndex(s => s.Name.Equals(agv.Name)); int idx = Common.agvInfo.FindIndex(s => s.Name.Equals(agv.Name));
rtn = FindAreaBOutStore(idx, out ResultType resultType,false); rtn = FindAreaBOutStore(idx, out ResultType resultType, false);
if (!rtn && resultType.Equals(ResultType.NoEmptyShelf)) if (!rtn && resultType.Equals(ResultType.NoEmptyShelf))
{ {
rtn = FindNeedEnter(agv, "A8"); rtn = FindNeedEnter(agv, "A8");
...@@ -1524,15 +1563,34 @@ namespace BLL ...@@ -1524,15 +1563,34 @@ namespace BLL
Common.log.OutInfo(agv.Name + " 在A8送完料架,检测到B区有出库任务,开始执行"); Common.log.OutInfo(agv.Name + " 在A8送完料架,检测到B区有出库任务,开始执行");
if (!rtn && resultType.Equals(ResultType.NoEmptyShelf)) if (!rtn && resultType.Equals(ResultType.NoEmptyShelf))
{ {
rtn = FindNeedEnter(agv, "A7"); rtn = FindNeedLeave(agv, "A7");
if (rtn) if (rtn)
Common.log.OutInfo(agv.Name + " 在A8送完料架,检测到B区有出库任务,去A7"); Common.log.OutInfo(agv.Name + " 在A8送完料架,检测到B区有出库任务,去A7");
} }
if (!rtn) if (!rtn)
{ {
int nodeIdx = Common.nodeInfo.FindIndex(s => s.Name.Equals("A7") && s.Action == ClientAction.NeedLeave && s.AgvName.Equals("") && s.RFID.StartsWith("B") && s.IsUse);
if (nodeIdx > -1)
{
Common.log.OutInfo(agv.Name + " 在A8送完料架,检测到A7出料串[" + agv.RFID + "],去A7");
rtn = MoveNode(agv, nodeIdx);
if (rtn)
{
agv.NextMission = "";
}
else
{
agv.NextMission = "A7";
//Common.mir.Add_Mission_Fleet(agv, "Common.agvMission["MoveStandbyTemp"]");
}
}
}
if (!rtn)
{
rtn = FindNeedLeave(agv, "A1"); rtn = FindNeedLeave(agv, "A1");
if (rtn) if (rtn)
Common.log.OutInfo(agv.Name + " 在A8送完料架,检测到A1有出料架/任务,开始执行"); Common.log.OutInfo(agv.Name + " 在A8送完料架,检测到A1有出料架/料串任务,开始执行");
} }
if (!rtn) if (!rtn)
...@@ -2786,7 +2844,7 @@ namespace BLL ...@@ -2786,7 +2844,7 @@ namespace BLL
if (nodeIdx == -1) if (nodeIdx == -1)
{ {
nodeIdx = Common.nodeInfo.FindIndex(s => s.Name == "A3" && s.Action == ClientAction.NeedEnter && s.AgvName == "" && s.IsUse); nodeIdx = Common.nodeInfo.FindIndex(s => s.Name == "A3" && s.Action == ClientAction.NeedEnter && s.AgvName == "" && s.IsUse);
if (nodeIdx == -1) if (nodeIdx > -1)
{ {
ClearMarkByNodeMark(); ClearMarkByNodeMark();
string log = agv.Name + " A4 FindNeedEnterWithMark 节点mark没有找到[Mark=" + agv.Mark + "],去A3"; string log = agv.Name + " A4 FindNeedEnterWithMark 节点mark没有找到[Mark=" + agv.Mark + "],去A3";
...@@ -2821,7 +2879,7 @@ namespace BLL ...@@ -2821,7 +2879,7 @@ namespace BLL
if (!agv.Mark.Split(',')[1].Equals("pack")) if (!agv.Mark.Split(',')[1].Equals("pack"))
{ {
ClearMarkByNodeMark(); ClearMarkByNodeMark();
string log = agv.Name + " [Mark=" + agv.Mark + "] 出库任务完成"; string log = agv.Name + " 工单料[Mark=" + agv.Mark + "] 出库任务完成";
Common.log.OutInfo(log); Common.log.OutInfo(log);
Common.log.OutTextBox(log); Common.log.OutTextBox(log);
return false; return false;
......
...@@ -345,10 +345,6 @@ namespace AGVControl ...@@ -345,10 +345,6 @@ namespace AGVControl
/// </summary> /// </summary>
public bool StandbyTemp { set; get; } public bool StandbyTemp { set; get; }
/// <summary>
/// 是否清除任务缓存
/// </summary>
public bool IsClearRunInfo = false;
public string CurTaskName { get; set; } public string CurTaskName { get; set; }
......
...@@ -168,14 +168,14 @@ namespace AGVControl ...@@ -168,14 +168,14 @@ namespace AGVControl
{ {
if (Common.agvInfo[e.RowIndex].Mark.Length>1) if (Common.agvInfo[e.RowIndex].Mark.Length>1)
{ {
if(MessageBox.Show(Common.agvInfo[e.RowIndex].Name + " 正在执行包装仓出库任务,确定清除当前任务?","警告",MessageBoxButtons.YesNo) == DialogResult.No) if(MessageBox.Show(Common.agvInfo[e.RowIndex].Name + " 正在执行出库任务,确定清除当前任务?","警告",MessageBoxButtons.YesNo) == DialogResult.No)
{ {
return; return;
} }
} }
Common.agvInfo[e.RowIndex].IsUse = false; Common.agvInfo[e.RowIndex].IsUse = false;
//清除小车缓存 //清除小车缓存
Common.log.OutInfo(string.Format("手动清除缓存:{0}[CurTaskName={1}]", Common.agvInfo[e.RowIndex].ToRow(), Common.agvInfo[e.RowIndex].CurTaskName)); Common.log.OutInfo(string.Format("手动清除小车缓存:{0}[CurTaskName={1}]", Common.agvInfo[e.RowIndex].ToRow(), Common.agvInfo[e.RowIndex].CurTaskName));
string place = Common.agvInfo[e.RowIndex].Place; string place = Common.agvInfo[e.RowIndex].Place;
Common.agvInfo[e.RowIndex].Mark = ""; Common.agvInfo[e.RowIndex].Mark = "";
Common.agvInfo[e.RowIndex].Place = ""; Common.agvInfo[e.RowIndex].Place = "";
...@@ -183,7 +183,6 @@ namespace AGVControl ...@@ -183,7 +183,6 @@ namespace AGVControl
Common.agvInfo[e.RowIndex].NextMission = ""; Common.agvInfo[e.RowIndex].NextMission = "";
Common.agvInfo[e.RowIndex].LeftTaskCnt = 0; Common.agvInfo[e.RowIndex].LeftTaskCnt = 0;
Common.agvInfo[e.RowIndex].CurTaskName = ""; Common.agvInfo[e.RowIndex].CurTaskName = "";
Common.agvInfo[e.RowIndex].IsClearRunInfo = true;
//清除节点缓存 //清除节点缓存
int idx = Common.nodeInfo.FindIndex(s => s.Name == place); int idx = Common.nodeInfo.FindIndex(s => s.Name == place);
...@@ -214,7 +213,6 @@ namespace AGVControl ...@@ -214,7 +213,6 @@ namespace AGVControl
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.State_Ready(Common.agvInfo[e.RowIndex]); Common.mir.State_Ready(Common.agvInfo[e.RowIndex]);
DgvAgv.Rows[e.RowIndex].SetValues(Common.agvInfo[e.RowIndex].ToRow()); DgvAgv.Rows[e.RowIndex].SetValues(Common.agvInfo[e.RowIndex].ToRow());
Common.agvInfo[e.RowIndex].IsUse = true;
} }
} }
...@@ -231,7 +229,7 @@ namespace AGVControl ...@@ -231,7 +229,7 @@ namespace AGVControl
else if (e.ColumnIndex == 8) else if (e.ColumnIndex == 8)
{ {
//清除节点缓存 //清除节点缓存
Common.log.OutInfo(string.Format("手动清除缓存,{0} {1}", Common.nodeInfo[e.RowIndex].AgvName, Common.nodeInfo[e.RowIndex].Name)); Common.log.OutInfo(string.Format("手动清除节点缓存,{0} {1}", Common.nodeInfo[e.RowIndex].AgvName, Common.nodeInfo[e.RowIndex].Name));
string name = Common.nodeInfo[e.RowIndex].AgvName; string name = Common.nodeInfo[e.RowIndex].AgvName;
Common.nodeInfo[e.RowIndex].AgvName = ""; Common.nodeInfo[e.RowIndex].AgvName = "";
DgvNode.Rows[e.RowIndex].Cells[5].Value = ""; DgvNode.Rows[e.RowIndex].Cells[5].Value = "";
...@@ -240,10 +238,13 @@ namespace AGVControl ...@@ -240,10 +238,13 @@ namespace AGVControl
int idx = Common.agvInfo.FindIndex(s => s.Name == name); int idx = Common.agvInfo.FindIndex(s => s.Name == name);
if (idx > -1) if (idx > -1)
{ {
Common.agvInfo[idx].Mark = "";
Common.agvInfo[idx].Place = "";
Common.agvInfo[idx].RFID = "";
Common.agvInfo[idx].NextMission = ""; Common.agvInfo[idx].NextMission = "";
Common.agvInfo[e.RowIndex].Mark = "";
Common.agvInfo[e.RowIndex].Place = "";
Common.agvInfo[e.RowIndex].RFID = "";
Common.agvInfo[e.RowIndex].NextMission = "";
Common.agvInfo[e.RowIndex].LeftTaskCnt = 0;
Common.agvInfo[e.RowIndex].CurTaskName = "";
DgvAgv.Rows[idx].SetValues(Common.agvInfo[idx].ToRow()); DgvAgv.Rows[idx].SetValues(Common.agvInfo[idx].ToRow());
//添加Init任务 //添加Init任务
Common.mir.Add_Mission_Fleet(Common.agvInfo[idx], Common.agvMission["Init"]); Common.mir.Add_Mission_Fleet(Common.agvInfo[idx], Common.agvMission["Init"]);
...@@ -262,16 +263,11 @@ namespace AGVControl ...@@ -262,16 +263,11 @@ namespace AGVControl
if (idx < 0) return; if (idx < 0) return;
if (Common.agvInfo[idx].IsCon) if (Common.agvInfo[idx].IsCon)
{ {
if(!Common.agvInfo[idx].IsClearRunInfo)
{
MessageBox.Show("请先清除当前小车的任务缓存!");
return;
}
bool rtn = Common.mir.Add_Mission(Common.agvInfo[idx], Common.agvMission[LstAgvPlace.Text]); bool rtn = Common.mir.Add_Mission(Common.agvInfo[idx], Common.agvMission[LstAgvPlace.Text]);
if (!rtn) if (!rtn)
return; return;
Common.agvInfo[idx].Place = ""; Common.agvInfo[idx].Place = "";
Common.agvInfo[idx].IsClearRunInfo = false;
Common.log.OutInfo("手动添加任务: " + LstAgvPlace.Text); Common.log.OutInfo("手动添加任务: " + LstAgvPlace.Text);
Common.log.OutTextBox("手动添加任务: " + LstAgvPlace.Text); Common.log.OutTextBox("手动添加任务: " + LstAgvPlace.Text);
DgvAgv.Rows[idx].SetValues(Common.agvInfo[idx].ToRow()); DgvAgv.Rows[idx].SetValues(Common.agvInfo[idx].ToRow());
......
...@@ -106,6 +106,8 @@ namespace AGVControl ...@@ -106,6 +106,8 @@ namespace AGVControl
new ClientNode("A2", Convert.ToBoolean(Common.appConfig.AppSettings.Settings["A2"].Value)), new ClientNode("A2", Convert.ToBoolean(Common.appConfig.AppSettings.Settings["A2"].Value)),
new ClientNode("A3", Convert.ToBoolean(Common.appConfig.AppSettings.Settings["A3"].Value)), new ClientNode("A3", Convert.ToBoolean(Common.appConfig.AppSettings.Settings["A3"].Value)),
new ClientNode("A4", Convert.ToBoolean(Common.appConfig.AppSettings.Settings["A4"].Value)), new ClientNode("A4", Convert.ToBoolean(Common.appConfig.AppSettings.Settings["A4"].Value)),
new ClientNode("A7", Convert.ToBoolean(Common.appConfig.AppSettings.Settings["A7"].Value)),
new ClientNode("A8", Convert.ToBoolean(Common.appConfig.AppSettings.Settings["A8"].Value)),
new ClientNode("B1", Convert.ToBoolean(Common.appConfig.AppSettings.Settings["B1"].Value)), new ClientNode("B1", Convert.ToBoolean(Common.appConfig.AppSettings.Settings["B1"].Value)),
new ClientNode("B2", Convert.ToBoolean(Common.appConfig.AppSettings.Settings["B2"].Value)), new ClientNode("B2", Convert.ToBoolean(Common.appConfig.AppSettings.Settings["B2"].Value)),
new ClientNode("B3", Convert.ToBoolean(Common.appConfig.AppSettings.Settings["B3"].Value)), new ClientNode("B3", Convert.ToBoolean(Common.appConfig.AppSettings.Settings["B3"].Value)),
......
...@@ -91,4 +91,3 @@ C:\ZDL\Gitee\AGVControl\AGVControl\obj\Debug\AGVControl.csproj.CopyComplete ...@@ -91,4 +91,3 @@ C:\ZDL\Gitee\AGVControl\AGVControl\obj\Debug\AGVControl.csproj.CopyComplete
C:\ZDL\Gitee\AGVControl\AGVControl\obj\Debug\AGVControl.exe C:\ZDL\Gitee\AGVControl\AGVControl\obj\Debug\AGVControl.exe
C:\ZDL\Gitee\AGVControl\AGVControl\obj\Debug\AGVControl.pdb C:\ZDL\Gitee\AGVControl\AGVControl\obj\Debug\AGVControl.pdb
C:\ZDL\Gitee\AGVControl\AGVControl\obj\Debug\AGVControl.csproj.CoreCompileInputs.cache C:\ZDL\Gitee\AGVControl\AGVControl\obj\Debug\AGVControl.csproj.CoreCompileInputs.cache
C:\ZDL\Gitee\AGVControl\AGVControl\obj\Debug\AGVControl.csprojAssemblyReference.cache
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!