Commit 75c17094 张东亮

1

1 个父辈 686076d6
正在显示 29 个修改的文件 包含 911 行增加436 行删除
......@@ -116,7 +116,7 @@ namespace BLL
json = json.Replace("\r", "");
json = json.Replace("\n", "");
json = json.Replace(" ", "");
Common.LogInfo("ITS URL: " + url + " Return: " + json, false);
Common.log.Debug("ITS URL: " + url + " Return: " + json);
if (string.IsNullOrWhiteSpace(json)) return false;
List<BoxDestInfo> res = JsonHelper.DeserializeJsonToList<BoxDestInfo>(json);
......@@ -166,8 +166,9 @@ namespace BLL
#endregion
res[0].location = loc;
dest = res[0];
A6_Target = res[0].ShowInfo() + "[" + loc + "]";
Common.log.Debug("查找满料架任务[RFID=" + rfid + "]:目的地为 " + loc + " [产线名 " + tempLocation + "]");
Common.GetLineNameByNodeName(loc,out string line);
A6_Target = res[0].ShowInfo(line);
Common.log.Debug("查找满料架任务[RFID=" + rfid + "]:目的地为 " + loc + " [产线名 " + line + "]");
return true;
}
else
......@@ -179,6 +180,7 @@ namespace BLL
}
}
//[{"msg":"0料车已解绑或未发新料"}]
A6_Target = json;
return false;
}
catch (Exception ex)
......@@ -198,9 +200,9 @@ namespace BLL
public string SO { get; set; }
public string location { get; set; }
public string ShowInfo()
public string ShowInfo(string loc)
{
return string.Format("RFID={0},SO={1},location={2}", id, SO, location);
return string.Format("RFID={0},SO={1},location={2}[{3}]", id, SO, loc,location);
}
}
......@@ -279,7 +281,7 @@ namespace BLL
int.TryParse(msgs[0].msg.Substring(0, 1), out int resCode);
string resStr = msgs[0].msg.Substring(1, 2);
lineName = msgs[0].msg.Substring(3);
Common.LogInfo(string.Format("[{0}] [{1}]", addr, result), false);
Common.log.Debug(string.Format("[{0}] [{1}]", addr, result));
if (lineName.Equals("").Equals(true))
return false;
if (resStr.Equals("OK") || resCode.Equals(1))
......@@ -502,6 +504,8 @@ namespace BLL
public string msgKey = "";
//>>>msgValue : 异常信息
public string msgValue = "";
//0:异常;1:正常显示
public int type = 0;
/// <summary>
/// 异常信息
......@@ -509,11 +513,12 @@ namespace BLL
/// <param name="name">异常位置名称</param>
/// <param name="key">异常信息唯一标识</param>
/// <param name="value">异常信息</param>
public AlarmMsg(string name, string key, string value)
public AlarmMsg(string name, string key, string value,int type=0)
{
this.name = name;
this.msgKey = key;
this.msgValue = value;
this.type = type;
}
}
public class RfidData
......
......@@ -510,7 +510,7 @@ namespace BLL
Common.nodeInfo[idx].UpdateNodeStatus(node.GetState());
Common.nodeInfo[idx].ClientLevel = node.ClientLevel;
Common.nodeInfo[idx].RFID = node.RFID;
Common.LogInfo("节点更新 " + node.StatetText()+" "+ node.ClientLevel.ToString());
Common.LogInfo("节点更新 " + node.StatetText());
NodeChanged?.Invoke(idx);
}
}
......
......@@ -536,6 +536,118 @@ namespace AGVControl
}
/// <summary>
/// 查看A6料架的状况(A6主要用于Feeder)
/// </summary>
/// <param name="agv"></param>
/// <param name="node"></param>
public static bool CheckA6State(Agv_Info agv, eShelfType shelfType, out string nodeName)
{
bool rtn = false;
string place = agv.Place;
nodeName = "";
if (shelfType.Equals(eShelfType.SmallShelf))
{
//int tarIdx = Common.nodeInfo.FindIndex(s => s.Name == SettingString.A5 && s.ClientLevel.Equals(ClientLevel.High)
// && (s.StateEquals(eNodeStatus.NeedD) || s.StateEquals(eNodeStatus.NeedEnter)) && s.IsUse);
//if (tarIdx == -1)
//{
// Common.log.Debug(string.Format("{0} {1}不需要小料架", agv.Name, SettingString.A5));
//}
//else
//{
// nodeName = SettingString.A5;
// Common.log.Debug(string.Format("{0} {1}需要小料架", agv.Name, SettingString.A5));
// return true;
//}
int tarIdx = Common.nodeInfo.FindIndex(s => s.Name == SettingString.A6 &&
(s.StateEquals(eNodeStatus.NeedEnter) || s.StateEquals(eNodeStatus.NeedEnterLeave)) && s.IsUse);
if (tarIdx == -1)
{
Common.log.Debug(string.Format("{0} {1}不需要小料架", agv.Name, SettingString.A6));
//rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission[SettingString.MoveStandby]);
//if (rtn)
//{
// agv.NextPlace = "";
// agv.TaskSend = rtn ? SettingString.MoveStandby : "";
// agv.Msg = string.Format("{0} 在{1}已装载小料架,送往{2}", agv.Name, place, SettingString.MoveStandby);
// Common.LogInfo(string.Format("{0} 在{1}已装载小料架,送往{2}", agv.Name, place, SettingString.MoveStandby));
//}
}
else
{
nodeName = SettingString.A6;
Common.log.Debug(string.Format("{0} {1}需要小料架", agv.Name, SettingString.A6));
return true;
//rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission[SettingString.Move + SettingString.A6]);
//if (rtn)
//{
// agv.NextPlace = "";
// tarNodeName = SettingString.A6;
// Common.nodeInfo[tarIdx].AgvName = agv.Name;
// agv.TaskSend = rtn ? SettingString.Move + SettingString.A6 : "";
// agv.Msg = string.Format("{0} 在{1}已装载小料架,送往{2}", agv.Name, place, SettingString.A6);
// Common.LogInfo(string.Format("{0} 在{1}已装载小料架,送往{2}", agv.Name, place, SettingString.A6));
// return true;
//}
}
}
else if (shelfType.Equals(eShelfType.BigShelf))
{
//int tarIdx = Common.nodeInfo.FindIndex(s => s.Name == SettingString.A5
// && (s.StateEquals(eNodeStatus.NeedC) || s.StateEquals(eNodeStatus.NeedEnter)) && s.IsUse);
//if (tarIdx == -1)
//{
// Common.log.Debug(string.Format("{0} {1}不需要大料架", agv.Name, SettingString.A5));
//}
//else
//{
// nodeName = SettingString.A5;
// Common.log.Debug(string.Format("{0} {1}需要大料架", agv.Name, SettingString.A5));
// return true;
//}
int tarIdx = Common.nodeInfo.FindIndex(s => s.Name == SettingString.A6 &&
(s.StateEquals(eNodeStatus.NeedEnter) || s.StateEquals(eNodeStatus.NeedEnterLeave)) && s.IsUse);
if (tarIdx == -1)
{
Common.log.Debug(string.Format("{0} {1}不需要大料架", agv.Name, SettingString.A6));
//rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission[SettingString.MoveStandby]);
//if (rtn)
//{
// agv.NextPlace = "";
// agv.TaskSend = rtn ? SettingString.MoveStandby : "";
// agv.Msg = string.Format("{0} 在{1}已装载大料架,送往{2}", agv.Name, place, SettingString.MoveStandby);
// Common.LogInfo(string.Format("{0} 在{1}已装载大料架,送往{2}", agv.Name, place, SettingString.MoveStandby));
//}
}
else
{
nodeName = SettingString.A6;
Common.log.Debug(string.Format("{0} {1}需要大料架", agv.Name, SettingString.A6));
return true;
//rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission[SettingString.Move + SettingString.A6]);
//if (rtn)
//{
// agv.NextPlace = "";
// tarNodeName = SettingString.A6;
// Common.nodeInfo[tarIdx].AgvName = agv.Name;
// agv.TaskSend = rtn ? SettingString.Move + SettingString.A6 : "";
// agv.Msg = string.Format("{0} 在{1}已装载大料架,送往{2}", agv.Name, place, SettingString.A6);
// Common.LogInfo(string.Format("{0} 在{1}已装载大料架,送往{2}", agv.Name, place, SettingString.A6));
// return true;
//}
}
}
return false;
}
/// <summary>
/// 检查AGV是否有负载
/// </summary>
/// <returns></returns>
......@@ -569,8 +681,14 @@ namespace AGVControl
{
return taskName.Contains(SettingString.AutoCharge) && agv.CurTaskState.Equals(SettingString.Executing);
}
public static bool CheckEnterOrLeaveFinished(Agv_Info agv, string actionName, string taskGUID)
{
log.Debug(agv.Name + " 检查进出料是否结束: " + actionName + " " + agv.CurTaskState + " " + taskGUID);
return Common.agvMission[actionName].Equals(taskGUID) && agv.CurTaskState.Equals(SettingString.Done);
}
//双层线工单信息
public static string doubleLine_WO = "[hSerial={0},line={1}[{3}],so={2}]";
public static string doubleLine_WO = "";
/// <summary>
/// 查找空架任务
/// </summary>
......@@ -596,13 +714,15 @@ namespace AGVControl
if (FullShelfDestInfo.location.StartsWith("G") && SettingString.C4_AGV_IPs.Contains(agv.IP))
{
nodeName = FullShelfDestInfo.location;
Common.LogInfo("A6出满料架的产线有空料架,优先处理 " + FullShelfDestInfo.ShowInfo());
Common.GetLineNameByNodeName(nodeName, out string line);
Common.LogInfo("A6出满料架的产线有空料架,优先处理 " + FullShelfDestInfo.ShowInfo(line));
return true;
}
else if (FullShelfDestInfo.location.StartsWith("E") && !SettingString.C4_AGV_IPs.Contains(agv.IP))
{
nodeName = FullShelfDestInfo.location;
Common.LogInfo("A6出满料架的产线有空料架,优先处理 " + FullShelfDestInfo.ShowInfo());
Common.GetLineNameByNodeName(nodeName, out string line);
Common.LogInfo("A6出满料架的产线有空料架,优先处理 " + FullShelfDestInfo.ShowInfo(line));
return true;
}
......@@ -610,9 +730,9 @@ namespace AGVControl
}
else
{
if (!FullShelfDestInfo.Equals(null))
if (FullShelfDestInfo !=null)
{
Common.LogInfo("A6的出料信息不正确,请检查:" + FullShelfDestInfo.ShowInfo());
Common.LogInfo("A6的出料信息不正确,请检查:" + FullShelfDestInfo.ShowInfo("ERROR"));
return false;
}
}
......@@ -633,13 +753,13 @@ namespace AGVControl
if (loc.StartsWith("G") && SettingString.C4_AGV_IPs.Contains(agv.IP))
{
nodeName = loc;
Common.LogInfo("双层线正在出的工单目标产线有空料架,优先处" + loc);
Common.LogInfo("双层线正在出的工单目标产线有空料架,优先处4C-" + loc);
return true;
}
else if (loc.StartsWith("E") && !SettingString.C4_AGV_IPs.Contains(agv.IP))
{
nodeName = loc;
Common.LogInfo("双层线正在出的工单目标产线有空料架,优先处理 " + loc);
Common.LogInfo("双层线正在出的工单目标产线有空料架,优先处理4D-" + loc);
return true;
}
}
......@@ -655,6 +775,7 @@ namespace AGVControl
{
//if (curPlace.Equals(""))//待机位
// {
//4C车间寻找
if (SettingString.C4_AGV_IPs.Contains(agv.IP))
{
......@@ -664,7 +785,7 @@ namespace AGVControl
return false;
}
nodeName = nearNodeName;
Common.LogInfo(agv.Name + " 双层线需要小料架,去4C-" + nearNodeName);
Common.log.Debug(agv.Name + " 双层线需要小料架,准备去4C-" + nearNodeName);
return true;
}
......@@ -677,18 +798,46 @@ namespace AGVControl
return false;
}
nodeName = nearNodeName;
Common.LogInfo(agv.Name + " 双层线需要小料架,去4D-" + nearNodeName);
Common.log.Debug(agv.Name + " 双层线需要小料架,准备去4D-" + nearNodeName);
return true;
}
}
}
else//主动拉料架
{
if (CheckA6State(agv, eShelfType.SmallShelf, out string lineNodeName1))
{
//4C车间寻找
if (SettingString.C4_AGV_IPs.Contains(agv.IP))
{
idx = nodeInfo.FindIndex(s => s.EmptyShelfCnt > 0 && s.Name.Equals("G22") && s.IsUse);
if (idx == -1)
{
return false;
}
nodeName = nodeInfo[idx].Name;
Common.log.Debug(agv.Name + " 双层线需要小料架,准备去4C-" + nodeName);
return true;
}
//4D车间寻找
if (!SettingString.C4_AGV_IPs.Contains(agv.IP))
{
idx = nodeInfo.FindIndex(s => s.EmptyShelfCnt > 0 && s.Name.Equals("E22") && s.IsUse);
if (idx == -1)
{
return false;
}
nodeName = nodeInfo[idx].Name;
Common.log.Debug(agv.Name + " 双层线需要小料架,准备去4D-" + nodeName);
return true;
}
}
//双层线是否需要小料架
if (CheckA5State(agv, eShelfType.SmallShelf, out string lineNodeName))
else if (CheckA5State(agv, eShelfType.SmallShelf, out string lineNodeName2))
{
//if (curPlace.Equals(""))//待机位
// {
......@@ -701,7 +850,7 @@ namespace AGVControl
return false;
}
nodeName = nearNodeName;
Common.LogInfo(agv.Name + " 双层线需要小料架,去4C-" + nearNodeName);
Common.log.Debug(agv.Name + " 双层线需要小料架,准备去4C-" + nearNodeName);
return true;
}
......@@ -714,7 +863,7 @@ namespace AGVControl
return false;
}
nodeName = nearNodeName;
Common.LogInfo(agv.Name + " 双层线需要小料架,去4D-" + nearNodeName);
Common.log.Debug(agv.Name + " 双层线需要小料架,准备去4D-" + nearNodeName);
return true;
}
}
......@@ -747,15 +896,15 @@ namespace AGVControl
else if (FullShelfDestInfo.location.StartsWith("E") && !SettingString.C4_AGV_IPs.Contains(agv.IP))
{
int i = Common.agvInfo.FindIndex(s => s.CurJob is GoFullShelfStationJob && !s.IP.Equals(agv.IP));
if (i ==-1)
if (i == -1)
return true;
}
}
else
{
if (!FullShelfDestInfo.Equals(null))
if (FullShelfDestInfo != null)
{
Common.LogInfo("A6的出料信息不正确,请检查:" + FullShelfDestInfo.ShowInfo());
Common.log.Error("A6的出料信息不正确,请检查:" + FullShelfDestInfo.ShowInfo("ERROR"));
}
}
}
......@@ -780,15 +929,16 @@ namespace AGVControl
if (idx > -1)
{
nodeName = FullShelfDestInfo.location;
Common.LogInfo("A6出满料架的产线有空料架,优先处理 " + FullShelfDestInfo.ShowInfo());
Common.GetLineNameByNodeName(nodeName, out string line);
Common.log.Debug("A6出满料架的产线有空料架,优先处理 " + FullShelfDestInfo.ShowInfo(line));
return true;
}
}
else
{
if (!FullShelfDestInfo.Equals(null))
if (FullShelfDestInfo != null)
{
Common.LogInfo("A6的出料信息不正确,请检查:" + FullShelfDestInfo.ShowInfo());
Common.log.Error("A6的出料信息不正确,请检查:" + FullShelfDestInfo.ShowInfo("ERROR"));
}
}
}
......@@ -974,7 +1124,7 @@ namespace AGVControl
{
//agv.TaskSend = "AutoCharge6";
agv.TaskSend = "AutoCharge";
Common.chargeStatus.charge4 = agv.Name;
Common.chargeStatus.charge6 = agv.Name;
Common.chargeStatus.chargeInterval = DateTime.Now.Ticks;
log = string.Format("{0} AutoCharge6", agv.Name);
agv.Msg = log;
......@@ -1079,7 +1229,7 @@ namespace AGVControl
{
if (agv.Battery <= Common.chargeStatus.chargeMin)
{
Common.LogInfo(agv.Name + " 电量小于20%,不执行任务", false);
Common.log.Debug(agv.Name + " 电量小于20%,不执行任务");
return false;
}
......@@ -1114,7 +1264,7 @@ namespace AGVControl
if (preLog.Equals(text))//连续重复的日志只打印一次
return;
preLog = text;
if (msg.Count > 25)
if (msg.Count > 255)
{
msg.RemoveRange(0, 10);
}
......@@ -1125,6 +1275,8 @@ namespace AGVControl
msg.Add(string.Format("[{0}] {1}\r\n", DateTime.Now.ToString("HH:mm:ss"), text));
msg.ForEach(s => tmpStr += s);
logTextBox.Text = tmpStr;
//logTextBox.AppendText(string.Format("[{0}] {1}\r\n", DateTime.Now.ToString("HH:mm:ss"), text));
//logTextBox.ScrollToCaret();
}
}
public static void ReadLinePlace()
......@@ -1191,7 +1343,7 @@ namespace AGVControl
idx = Common.missionManager.missionList.FindIndex(s => s.NodeName == nodeName);
if (idx > -1)
{
LogInfo("删除一个空料架任务:"+nodeName);
LogInfo("删除一个空料架任务:" + nodeName);
Common.missionManager.missionList.RemoveAt(idx);
using (System.IO.StreamWriter file = new System.IO.StreamWriter(CONFIG_PATH + "LinePlace.txt"))
{
......
......@@ -24,7 +24,6 @@ namespace BLL
public delegate void AgvMissionEvent();
public event AgvChangedEvent AgvChanged;
public event AgvChangedEvent AgvOnline;
public event AgvMissionEvent AgvMissionChanged;
public Control()
{
......@@ -38,7 +37,7 @@ namespace BLL
AgvStateTimer = new System.Timers.Timer
{
Interval = 500,
Interval = 1500,
AutoReset = true,
Enabled = false
};
......@@ -78,104 +77,87 @@ namespace BLL
if (!Common.nodeInfo[j].Online)
{
isAlarm = true;
msglist.Add(new AlarmMsg(Common.nodeInfo[j].AliceName, "agv." + Common.nodeInfo[j].Name + ".OnLine", "接驳台状态:离线"));
msglist.Add(new AlarmMsg(Common.nodeInfo[j].AliceName, "lineAgv." + Common.nodeInfo[j].Name + ".OffLine", "接驳台状态:离线"));
}
}
for (int i = 0; i < Common.agvInfo.Count; i++)
{
if (!CheckOnline(i)) continue;
//获取AGV状态
rtn = Common.mir.Get_State(Common.agvInfo[i], out eAGVState stateID, out string stateText, out int battery, out string mission_text, out Agv_Info.clsPosition position);
if (!rtn)
continue;
Common.log.Debug("获取AGV状态");
Thread.Sleep(50);
rtn = Common.mir.Get_Task_State(Common.agvInfo[i], out string stateStr);
Thread.Sleep(50);
rtn = Common.mir.Get_IO_Status(Common.agvInfo[i], out bool[] input, out bool[] output);
if (!rtn)
continue;
Common.log.Debug("获取IO状态");
bool change = false;
if (rtn) change = Common.agvInfo[i].SetState(stateID, stateStr, battery, mission_text, position);
if (Common.agvInfo[i].StateID.Equals(eAGVState.Docking))
try
{
if (!Common.agvInfo[i].StateID.Equals(preAGVState))
if (!CheckOnline(i)) continue;
bool change = false;
//获取AGV状态
rtn = Common.mir.Get_State(Common.agvInfo[i], out eAGVState stateID, out string stateText, out int battery, out string mission_text, out Agv_Info.clsPosition position);
Thread.Sleep(50);
Common.mir.Get_Task_State(Common.agvInfo[i], out string stateStr);
Thread.Sleep(50);
if (rtn) change = Common.agvInfo[i].SetState(stateID, stateStr, battery, mission_text, position);
Common.log.Debug("获取AGV状态");
//获取地点任务状态
Thread.Sleep(50);
rtn = Common.mir.Get_Register(Common.agvInfo[i], REG_STATUS, out int regValue);
if (rtn) Common.agvInfo[i].GetPlace(regValue);
Thread.Sleep(50);
rtn = Common.mir.Get_IO_Status(Common.agvInfo[i], out bool[] input, out bool[] output);
Common.log.Debug("获取IO状态");
//if (Common.agvInfo[i].StateID.Equals(eAGVState.Docking))
//{
// if (!Common.agvInfo[i].StateID.Equals(preAGVState))
// {
// Common.agvInfo[i].DockingStartTime = DateTime.Now;
// }
// else
// {
// if ((DateTime.Now - Common.agvInfo[i].DockingStartTime).TotalMinutes >= 1)
// {
// isAlarm = true;
// msglist.Add(new AlarmMsg(Common.agvInfo[i].Name, "lineAgv." + Common.agvInfo[i].Name + ".Docking", "停靠超时:" + (DateTime.Now - Common.agvInfo[i].DockingStartTime).TotalSeconds + "秒"));
// }
// }
//}
preAGVState = Common.agvInfo[i].StateID;
if (battery <= 10)
{
Common.agvInfo[i].DockingStartTime = DateTime.Now;
isAlarm = true;
msglist.Add(new AlarmMsg(Common.agvInfo[i].Name, "lineAgv." + Common.agvInfo[i].Name + ".battery", "电量 " + battery.ToString() + "%"));
}
else
if (stateText.Equals("Error") || stateText.Equals("EmergencyStop") || stateText.Equals("Pause"))
{
if ((DateTime.Now - Common.agvInfo[i].DockingStartTime).TotalMinutes >= 1)
isAlarm = true;
msglist.Add(new AlarmMsg(Common.agvInfo[i].Name, "lineAgv." + 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 + ".Docking", "停靠超时:" + (DateTime.Now - Common.agvInfo[i].DockingStartTime).TotalSeconds + "秒"));
msglist.Add(new AlarmMsg(Common.agvInfo[i].Name, "lineAgv." + Common.agvInfo[i].Name + ".IsExistShelf", "agv负载:" + "IO信号与负载信号不匹配"));
}
}
}
preAGVState = Common.agvInfo[i].StateID;
}
if (battery <= 10)
{
isAlarm = true;
msglist.Add(new AlarmMsg(Common.agvInfo[i].Name, "agv." + Common.agvInfo[i].Name + ".battery", "电量 " + battery.ToString() + "%"));
}
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));
}
if (input != null && input.Length == 4)
{
if (!Common.agvInfo[i].IsExistShelf.Equals(input[3]))
//更新状态stateID.Equals(eAGVState.Executing)
if (change)
{
isAlarm = true;
msglist.Add(new AlarmMsg(Common.agvInfo[i].Name, "agv." + Common.agvInfo[i].Name + ".IsExistShelf", "agv负载:" + "IO信号与负载信号不匹配"));
AgvChanged?.Invoke(i);
}
}
//获取地点任务状态
Thread.Sleep(50);
rtn = Common.mir.Get_Register(Common.agvInfo[i], REG_STATUS, out int regValue);
if (rtn) Common.agvInfo[i].GetPlace(regValue);
//if (change)
//{
// Common.log.Debug(string.Format("{0} Get_State StateID={1}, StateText={2}, Battery={3}, Mission_text={4},IsExistShelf={5}", Common.agvInfo[i].Name, stateID, stateText, battery, mission_text, Common.agvInfo[i].IsExistShelf));
//}
//执行任务更新状态
if (stateID.Equals(eAGVState.Executing) || change)
catch(Exception ex)
{
//Common.log.Debug(string.Format("{0} Get_Register PLC{1}={2}", Common.agvInfo[i].Name, REG_STATUS, regValue));
AgvChanged?.Invoke(i);
Common.log.Error("AgvStateTimer_"+Common.agvInfo[i].Name + ex.Message+ex.StackTrace);
}
//获取任务队列
//rtn = Common.mir.Get_Mission_Queue(Common.agvInfo[i], out List<string> mission);
//if (rtn)
//{
// string[] arr = new string[mission.Count];
// for (int j = 0; j < mission.Count; j++)
// arr[j] = Common.agvMission.FirstOrDefault(q => q.Value == mission[j]).Key;
// string missionKey = string.Join(",", arr);
// if (Common.agvInfo[i].MissionQueue != missionKey)
// {
// Common.agvInfo[i].MissionQueue = missionKey;
// AgvChanged?.Invoke(i);
// }
//}
}
if (isAlarm)
BLL.AGVManager.updateDeviceAlarmMsg(msglist);
AgvStateInProcess = false;
}
......
......@@ -405,13 +405,14 @@ namespace BLL
if (dic == null) return false;
//state_id不存在:{"args":{},"error_code":"service_unavailable","error_human":"\u670d\u52a1\u4e0d\u53ef\u7528\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5"}
Common.log.Debug("Get_State URL:"+url +" Return"+ json);
try
{
stateText = dic["state_text"].ToString();
stateID = (eAGVState)(Convert.ToInt32(dic["state_id"].ToString()));
}
catch
{
Common.log.Error("获取状态失败:" + json);
Common.log.Error("获取状态失败:" +info.IP+" "+ json);
return false;
}
stateID = (eAGVState)(Convert.ToInt32(dic["state_id"].ToString()));
......
......@@ -28,6 +28,9 @@
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain));
this.DgvAgv = new System.Windows.Forms.DataGridView();
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
......@@ -60,14 +63,23 @@
this.lblDestInfo = new System.Windows.Forms.Label();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.lblWO = new System.Windows.Forms.Label();
this.tableLayoutPanel7 = new System.Windows.Forms.TableLayoutPanel();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.button5 = new System.Windows.Forms.Button();
this.btnWO = new System.Windows.Forms.Button();
this.dgvLineMission = new System.Windows.Forms.DataGridView();
this.Column24 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.groupBox8 = new System.Windows.Forms.GroupBox();
this.lblCharge4 = new System.Windows.Forms.Label();
this.lblCharge3 = new System.Windows.Forms.Label();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.TxtLog = new System.Windows.Forms.TextBox();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.button5 = new System.Windows.Forms.Button();
this.btnWO = new System.Windows.Forms.Button();
this.groupBox7 = new System.Windows.Forms.GroupBox();
this.btnUpdateStatus = new System.Windows.Forms.Button();
this.txtBoxRFID = new System.Windows.Forms.TextBox();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.btnDeleteMission = new System.Windows.Forms.Button();
this.btnAddMission = new System.Windows.Forms.Button();
......@@ -89,11 +101,6 @@
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.groupBox7 = new System.Windows.Forms.GroupBox();
this.txtBoxRFID = new System.Windows.Forms.TextBox();
this.btnUpdateStatus = new System.Windows.Forms.Button();
this.Column24 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.DgvAgv)).BeginInit();
this.tableLayoutPanel3.SuspendLayout();
this.tabControl1.SuspendLayout();
......@@ -104,16 +111,18 @@
this.tableLayoutPanel5.SuspendLayout();
this.groupBox5.SuspendLayout();
this.groupBox3.SuspendLayout();
this.tableLayoutPanel7.SuspendLayout();
this.groupBox4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvLineMission)).BeginInit();
this.groupBox8.SuspendLayout();
this.tabPage2.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.tabPage3.SuspendLayout();
this.groupBox7.SuspendLayout();
this.groupBox6.SuspendLayout();
this.groupBox2.SuspendLayout();
this.tableLayoutPanel4.SuspendLayout();
this.tableLayoutPanel6.SuspendLayout();
this.groupBox7.SuspendLayout();
this.SuspendLayout();
//
// DgvAgv
......@@ -148,7 +157,7 @@
this.DgvAgv.RowHeadersVisible = false;
this.DgvAgv.RowHeadersWidth = 51;
this.DgvAgv.RowTemplate.Height = 23;
this.DgvAgv.Size = new System.Drawing.Size(1415, 164);
this.DgvAgv.Size = new System.Drawing.Size(1415, 156);
this.DgvAgv.TabIndex = 3;
this.DgvAgv.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.DgvAgv_CellClick);
//
......@@ -247,9 +256,9 @@
this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
this.tableLayoutPanel3.RowCount = 3;
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 21.05263F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 26.31579F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 52.63158F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 30F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel3.Size = new System.Drawing.Size(1423, 820);
this.tableLayoutPanel3.TabIndex = 7;
//
......@@ -259,11 +268,11 @@
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(4, 391);
this.tabControl1.Location = new System.Drawing.Point(4, 414);
this.tabControl1.Margin = new System.Windows.Forms.Padding(4);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(1415, 425);
this.tabControl1.Size = new System.Drawing.Size(1415, 402);
this.tabControl1.TabIndex = 7;
//
// tabPage1
......@@ -273,7 +282,7 @@
this.tabPage1.Margin = new System.Windows.Forms.Padding(4);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(4);
this.tabPage1.Size = new System.Drawing.Size(1407, 396);
this.tabPage1.Size = new System.Drawing.Size(1407, 373);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "节点状态&产线任务";
this.tabPage1.UseVisualStyleBackColor = true;
......@@ -291,7 +300,7 @@
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 1;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(1399, 388);
this.tableLayoutPanel2.Size = new System.Drawing.Size(1399, 365);
this.tableLayoutPanel2.TabIndex = 34;
//
// DgvNode
......@@ -324,7 +333,7 @@
this.DgvNode.RowHeadersVisible = false;
this.DgvNode.RowHeadersWidth = 50;
this.DgvNode.RowTemplate.Height = 23;
this.DgvNode.Size = new System.Drawing.Size(781, 380);
this.DgvNode.Size = new System.Drawing.Size(781, 357);
this.DgvNode.TabIndex = 1;
this.DgvNode.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.DgvNode_CellClick);
//
......@@ -407,7 +416,7 @@
this.groupBox1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.groupBox1.Size = new System.Drawing.Size(604, 384);
this.groupBox1.Size = new System.Drawing.Size(604, 361);
this.groupBox1.TabIndex = 33;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "任务信息";
......@@ -418,7 +427,7 @@
this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel5.Controls.Add(this.groupBox5, 0, 1);
this.tableLayoutPanel5.Controls.Add(this.groupBox3, 0, 0);
this.tableLayoutPanel5.Controls.Add(this.groupBox4, 0, 2);
this.tableLayoutPanel5.Controls.Add(this.tableLayoutPanel7, 0, 2);
this.tableLayoutPanel5.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel5.Location = new System.Drawing.Point(3, 23);
this.tableLayoutPanel5.Name = "tableLayoutPanel5";
......@@ -426,16 +435,16 @@
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 15F));
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 15F));
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 70F));
this.tableLayoutPanel5.Size = new System.Drawing.Size(598, 359);
this.tableLayoutPanel5.Size = new System.Drawing.Size(598, 336);
this.tableLayoutPanel5.TabIndex = 2;
//
// groupBox5
//
this.groupBox5.Controls.Add(this.lblDestInfo);
this.groupBox5.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox5.Location = new System.Drawing.Point(3, 56);
this.groupBox5.Location = new System.Drawing.Point(3, 53);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(592, 47);
this.groupBox5.Size = new System.Drawing.Size(592, 44);
this.groupBox5.TabIndex = 2;
this.groupBox5.TabStop = false;
this.groupBox5.Text = "出料信息信息";
......@@ -446,7 +455,7 @@
this.lblDestInfo.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblDestInfo.Location = new System.Drawing.Point(3, 24);
this.lblDestInfo.Name = "lblDestInfo";
this.lblDestInfo.Size = new System.Drawing.Size(586, 20);
this.lblDestInfo.Size = new System.Drawing.Size(586, 17);
this.lblDestInfo.TabIndex = 40;
this.lblDestInfo.Text = "lblDestInfo";
//
......@@ -456,7 +465,7 @@
this.groupBox3.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox3.Location = new System.Drawing.Point(3, 3);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(592, 47);
this.groupBox3.Size = new System.Drawing.Size(592, 44);
this.groupBox3.TabIndex = 0;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "双层线工单信息";
......@@ -467,62 +476,125 @@
this.lblWO.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblWO.Location = new System.Drawing.Point(3, 24);
this.lblWO.Name = "lblWO";
this.lblWO.Size = new System.Drawing.Size(586, 20);
this.lblWO.Size = new System.Drawing.Size(586, 17);
this.lblWO.TabIndex = 40;
this.lblWO.Text = "lblWO";
//
// tableLayoutPanel7
//
this.tableLayoutPanel7.ColumnCount = 2;
this.tableLayoutPanel7.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 56.58784F));
this.tableLayoutPanel7.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 43.41216F));
this.tableLayoutPanel7.Controls.Add(this.groupBox4, 0, 0);
this.tableLayoutPanel7.Controls.Add(this.groupBox8, 1, 0);
this.tableLayoutPanel7.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel7.Location = new System.Drawing.Point(3, 103);
this.tableLayoutPanel7.Name = "tableLayoutPanel7";
this.tableLayoutPanel7.RowCount = 1;
this.tableLayoutPanel7.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel7.Size = new System.Drawing.Size(592, 230);
this.tableLayoutPanel7.TabIndex = 3;
//
// groupBox4
//
this.groupBox4.Controls.Add(this.button5);
this.groupBox4.Controls.Add(this.btnWO);
this.groupBox4.Controls.Add(this.dgvLineMission);
this.groupBox4.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox4.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox4.Location = new System.Drawing.Point(3, 109);
this.groupBox4.Location = new System.Drawing.Point(3, 3);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(592, 247);
this.groupBox4.TabIndex = 1;
this.groupBox4.Size = new System.Drawing.Size(329, 224);
this.groupBox4.TabIndex = 2;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "产线解绑信息";
//
// button5
//
this.button5.Location = new System.Drawing.Point(456, 105);
this.button5.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(100, 65);
this.button5.TabIndex = 41;
this.button5.Text = "出料查询";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// btnWO
//
this.btnWO.Location = new System.Drawing.Point(456, 23);
this.btnWO.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnWO.Name = "btnWO";
this.btnWO.Size = new System.Drawing.Size(100, 65);
this.btnWO.TabIndex = 40;
this.btnWO.Text = "工单查询";
this.btnWO.UseVisualStyleBackColor = true;
this.btnWO.Click += new System.EventHandler(this.btnWO_Click);
//
// dgvLineMission
//
this.dgvLineMission.AllowUserToAddRows = false;
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dgvLineMission.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
this.dgvLineMission.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvLineMission.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Column24,
this.Column8});
this.dgvLineMission.Dock = System.Windows.Forms.DockStyle.Left;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvLineMission.DefaultCellStyle = dataGridViewCellStyle2;
this.dgvLineMission.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvLineMission.Location = new System.Drawing.Point(3, 21);
this.dgvLineMission.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.dgvLineMission.Name = "dgvLineMission";
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dgvLineMission.RowHeadersDefaultCellStyle = dataGridViewCellStyle3;
this.dgvLineMission.RowHeadersVisible = false;
this.dgvLineMission.RowHeadersWidth = 51;
this.dgvLineMission.RowTemplate.Height = 27;
this.dgvLineMission.Size = new System.Drawing.Size(367, 223);
this.dgvLineMission.Size = new System.Drawing.Size(323, 200);
this.dgvLineMission.TabIndex = 28;
this.dgvLineMission.Click += new System.EventHandler(this.dgvLineMission_Click);
//
// Column24
//
this.Column24.HeaderText = "时间";
this.Column24.MinimumWidth = 6;
this.Column24.Name = "Column24";
this.Column24.Width = 150;
//
// Column8
//
this.Column8.HeaderText = "任务";
this.Column8.MinimumWidth = 6;
this.Column8.Name = "Column8";
this.Column8.Width = 150;
//
// groupBox8
//
this.groupBox8.Controls.Add(this.lblCharge4);
this.groupBox8.Controls.Add(this.lblCharge3);
this.groupBox8.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox8.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox8.Location = new System.Drawing.Point(338, 3);
this.groupBox8.Name = "groupBox8";
this.groupBox8.Size = new System.Drawing.Size(251, 224);
this.groupBox8.TabIndex = 3;
this.groupBox8.TabStop = false;
this.groupBox8.Text = "充电位";
//
// lblCharge4
//
this.lblCharge4.AutoSize = true;
this.lblCharge4.Dock = System.Windows.Forms.DockStyle.Top;
this.lblCharge4.Location = new System.Drawing.Point(3, 36);
this.lblCharge4.Name = "lblCharge4";
this.lblCharge4.Size = new System.Drawing.Size(87, 15);
this.lblCharge4.TabIndex = 1;
this.lblCharge4.Text = "lblCharge4";
//
// lblCharge3
//
this.lblCharge3.AutoSize = true;
this.lblCharge3.Dock = System.Windows.Forms.DockStyle.Top;
this.lblCharge3.Location = new System.Drawing.Point(3, 21);
this.lblCharge3.Name = "lblCharge3";
this.lblCharge3.Size = new System.Drawing.Size(87, 15);
this.lblCharge3.TabIndex = 0;
this.lblCharge3.Text = "lblCharge3";
//
// tabPage2
//
......@@ -564,6 +636,8 @@
//
// tabPage3
//
this.tabPage3.Controls.Add(this.button5);
this.tabPage3.Controls.Add(this.btnWO);
this.tabPage3.Controls.Add(this.groupBox7);
this.tabPage3.Controls.Add(this.groupBox6);
this.tabPage3.Controls.Add(this.btnSetRFID);
......@@ -583,6 +657,57 @@
this.tabPage3.Text = "agv手动";
this.tabPage3.UseVisualStyleBackColor = true;
//
// button5
//
this.button5.Location = new System.Drawing.Point(551, 207);
this.button5.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(100, 65);
this.button5.TabIndex = 43;
this.button5.Text = "出料查询";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// btnWO
//
this.btnWO.Location = new System.Drawing.Point(402, 207);
this.btnWO.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnWO.Name = "btnWO";
this.btnWO.Size = new System.Drawing.Size(100, 65);
this.btnWO.TabIndex = 42;
this.btnWO.Text = "工单查询";
this.btnWO.UseVisualStyleBackColor = true;
this.btnWO.Click += new System.EventHandler(this.btnWO_Click);
//
// groupBox7
//
this.groupBox7.Controls.Add(this.btnUpdateStatus);
this.groupBox7.Controls.Add(this.txtBoxRFID);
this.groupBox7.Location = new System.Drawing.Point(691, 30);
this.groupBox7.Name = "groupBox7";
this.groupBox7.Size = new System.Drawing.Size(204, 151);
this.groupBox7.TabIndex = 36;
this.groupBox7.TabStop = false;
this.groupBox7.Text = "物料状态上报";
//
// btnUpdateStatus
//
this.btnUpdateStatus.Location = new System.Drawing.Point(45, 67);
this.btnUpdateStatus.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnUpdateStatus.Name = "btnUpdateStatus";
this.btnUpdateStatus.Size = new System.Drawing.Size(100, 65);
this.btnUpdateStatus.TabIndex = 41;
this.btnUpdateStatus.Text = "上报";
this.btnUpdateStatus.UseVisualStyleBackColor = true;
this.btnUpdateStatus.Click += new System.EventHandler(this.btnUpdateStatus_Click);
//
// txtBoxRFID
//
this.txtBoxRFID.Location = new System.Drawing.Point(24, 27);
this.txtBoxRFID.Name = "txtBoxRFID";
this.txtBoxRFID.Size = new System.Drawing.Size(139, 25);
this.txtBoxRFID.TabIndex = 0;
//
// groupBox6
//
this.groupBox6.Controls.Add(this.btnDeleteMission);
......@@ -731,13 +856,13 @@
this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel4.Controls.Add(this.tableLayoutPanel6, 0, 0);
this.tableLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel4.Location = new System.Drawing.Point(3, 174);
this.tableLayoutPanel4.Location = new System.Drawing.Point(3, 166);
this.tableLayoutPanel4.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tableLayoutPanel4.Name = "tableLayoutPanel4";
this.tableLayoutPanel4.RowCount = 1;
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 211F));
this.tableLayoutPanel4.Size = new System.Drawing.Size(1417, 211);
this.tableLayoutPanel4.Size = new System.Drawing.Size(1417, 242);
this.tableLayoutPanel4.TabIndex = 8;
//
// tableLayoutPanel6
......@@ -760,7 +885,7 @@
this.tableLayoutPanel6.RowCount = 2;
this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel6.Size = new System.Drawing.Size(1411, 205);
this.tableLayoutPanel6.Size = new System.Drawing.Size(1411, 236);
this.tableLayoutPanel6.TabIndex = 0;
//
// label6
......@@ -829,49 +954,6 @@
this.label1.TabIndex = 0;
this.label1.Text = "label1";
//
// groupBox7
//
this.groupBox7.Controls.Add(this.btnUpdateStatus);
this.groupBox7.Controls.Add(this.txtBoxRFID);
this.groupBox7.Location = new System.Drawing.Point(691, 30);
this.groupBox7.Name = "groupBox7";
this.groupBox7.Size = new System.Drawing.Size(204, 151);
this.groupBox7.TabIndex = 36;
this.groupBox7.TabStop = false;
this.groupBox7.Text = "物料状态上报";
//
// txtBoxRFID
//
this.txtBoxRFID.Location = new System.Drawing.Point(24, 27);
this.txtBoxRFID.Name = "txtBoxRFID";
this.txtBoxRFID.Size = new System.Drawing.Size(139, 25);
this.txtBoxRFID.TabIndex = 0;
//
// btnUpdateStatus
//
this.btnUpdateStatus.Location = new System.Drawing.Point(45, 67);
this.btnUpdateStatus.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnUpdateStatus.Name = "btnUpdateStatus";
this.btnUpdateStatus.Size = new System.Drawing.Size(100, 65);
this.btnUpdateStatus.TabIndex = 41;
this.btnUpdateStatus.Text = "上报";
this.btnUpdateStatus.UseVisualStyleBackColor = true;
this.btnUpdateStatus.Click += new System.EventHandler(this.btnUpdateStatus_Click);
//
// Column24
//
this.Column24.HeaderText = "时间";
this.Column24.MinimumWidth = 6;
this.Column24.Name = "Column24";
this.Column24.Width = 150;
//
// Column8
//
this.Column8.HeaderText = "任务";
this.Column8.MinimumWidth = 6;
this.Column8.Name = "Column8";
this.Column8.Width = 150;
//
// FrmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
......@@ -895,21 +977,24 @@
this.tableLayoutPanel5.ResumeLayout(false);
this.groupBox5.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.tableLayoutPanel7.ResumeLayout(false);
this.groupBox4.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgvLineMission)).EndInit();
this.groupBox8.ResumeLayout(false);
this.groupBox8.PerformLayout();
this.tabPage2.ResumeLayout(false);
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.tabPage3.ResumeLayout(false);
this.tabPage3.PerformLayout();
this.groupBox7.ResumeLayout(false);
this.groupBox7.PerformLayout();
this.groupBox6.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.tableLayoutPanel4.ResumeLayout(false);
this.tableLayoutPanel6.ResumeLayout(false);
this.tableLayoutPanel6.PerformLayout();
this.groupBox7.ResumeLayout(false);
this.groupBox7.PerformLayout();
this.ResumeLayout(false);
}
......@@ -922,7 +1007,6 @@
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.DataGridView DgvNode;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.DataGridView dgvLineMission;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.TextBox TxtLog;
......@@ -939,9 +1023,6 @@
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel4;
private System.Windows.Forms.Label lblWO;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.Button btnWO;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.DataGridViewTextBoxColumn Column6;
private System.Windows.Forms.DataGridViewTextBoxColumn Column12;
private System.Windows.Forms.DataGridViewTextBoxColumn Column22;
......@@ -978,8 +1059,16 @@
private System.Windows.Forms.GroupBox groupBox7;
private System.Windows.Forms.Button btnUpdateStatus;
private System.Windows.Forms.TextBox txtBoxRFID;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Button btnWO;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel7;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.DataGridView dgvLineMission;
private System.Windows.Forms.DataGridViewTextBoxColumn Column24;
private System.Windows.Forms.DataGridViewTextBoxColumn Column8;
private System.Windows.Forms.GroupBox groupBox8;
private System.Windows.Forms.Label lblCharge4;
private System.Windows.Forms.Label lblCharge3;
}
}
......@@ -21,6 +21,7 @@ namespace AGVControl
private ContextMenuStrip notifyMenu;
private System.Timers.Timer showTimer;
private Label[] agvRunInfo;
//private string[] agvRunStep;
public FrmMain()
{
InitializeComponent();
......@@ -31,13 +32,13 @@ namespace AGVControl
showTimer.Elapsed += ShowTimer_Elapsed;
showTimer.Start();
Common.logTextBox = TxtLog;
agvRunInfo = new Label[] {label1,label2,label3,label4,label5,label6};
agvRunInfo = new Label[] { label1, label2, label3, label4, label5, label6 };
}
private void ShowConfig()
{
int n;
//agvRunStep = new string[Common.agvInfo.Count];
for (int i = 0; i < Common.agvInfo.Count; i++)
{
Common.mir.Get_IO_Status(Common.agvInfo[i], out bool[] input, out bool[] output);
......@@ -49,6 +50,8 @@ namespace AGVControl
DgvAgv.Rows[n].DefaultCellStyle.BackColor = Color.LightBlue;
if (!Common.agvInfo[i].IsCon)
DgvAgv.Rows[n].DefaultCellStyle.ForeColor = Color.Red;
//agvRunStep[i] = Common.agvInfo[i].Msg;
//if (i % 2 == 0)
// agvRunInfo[i].BackColor = Color.LightBlue;
//else
......@@ -85,7 +88,6 @@ namespace AGVControl
DgvNode.Rows[nodeIndex].DefaultCellStyle.ForeColor = Common.nodeInfo[nodeIndex].Online && Common.nodeInfo[nodeIndex].IsUse ? Color.Black : Color.Red;
DgvNode.Rows[nodeIndex].SetValues(Common.nodeInfo[nodeIndex].ToRow());
}));
ShowEmptyTask();
System.GC.Collect();
}
......@@ -101,29 +103,24 @@ 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(eAGVState.Error) ? Color.Red : Color.Black; }));
Invoke(new Action(() =>
{
DgvAgv.Rows[agvIndex].SetValues(Common.agvInfo[agvIndex].ToRow());
}));
try
{
Invoke(new Action(() =>
{
for (int i = 0; i < Common.nodeInfo.Count; i++)
{
DgvNode.Rows[i].SetValues(Common.nodeInfo[i].ToRow());
}
}));
}
catch { };
ShowEmptyTask();
System.GC.Collect();
}
private void Control_AgvOnline(int agvIndex)
{
Invoke(new Action(() => { DgvAgv.Rows[agvIndex].DefaultCellStyle.ForeColor = Common.agvInfo[agvIndex].IsCon ? Color.Black : Color.Red; }));
Invoke(new Action(() =>
{
DgvAgv.Rows[agvIndex].SetValues(Common.agvInfo[agvIndex].ToRow());
}));
GC.Collect();
}
......@@ -151,7 +148,7 @@ namespace AGVControl
if (WindowState == FormWindowState.Minimized)
WindowState = FormWindowState.Normal;
}
private void Control_AgvMissionChanged()
private void AgvMissionChanged()
{
if (!Common.missionManager.AGV_Name_EmptyTask.Equals(""))
Invoke(new Action(() =>
......@@ -183,7 +180,6 @@ namespace AGVControl
change = false;
Common.control.AgvChanged += Control_AgvChanged;
Common.control.AgvOnline += Control_AgvOnline;
Common.control.AgvMissionChanged += Control_AgvMissionChanged;
Common.server.NodeChanged += Server_NodeChanged;
Common.server.NodeOnline += Server_NodeOnline;
//foreach (var item in Common.agvInfo)
......@@ -220,13 +216,14 @@ namespace AGVControl
if (e.ColumnIndex == 10) //调用
{
if(Common.agvInfo[e.RowIndex].IsUse.Equals(true))
if (Common.agvInfo[e.RowIndex].IsUse.Equals(true))
{
if (MessageBox.Show("是否关闭当前小车的自动模式?", Common.agvInfo[e.RowIndex].Name+"_警告", MessageBoxButtons.YesNo).Equals(DialogResult.Yes))
if (MessageBox.Show("是否关闭当前小车的自动模式?", Common.agvInfo[e.RowIndex].Name + "_警告", MessageBoxButtons.YesNo).Equals(DialogResult.Yes))
{
Common.agvInfo[e.RowIndex].IsUse = false;
Common.agvInfo[e.RowIndex].CurJob = null;
Common.agvInfo[e.RowIndex].RFID = "";
Common.LogInfo(string.Format("手动关闭小车自动模式,{0} {1}", Common.agvInfo[e.RowIndex].Name, Common.agvInfo[e.RowIndex].RunInfo()));
}
}
else
......@@ -348,13 +345,13 @@ namespace AGVControl
if (idx < 0) return;
if (Common.agvInfo[idx].IsCon)
{
if(Common.agvInfo[idx].IsUse)
if (Common.agvInfo[idx].IsUse)
{
if (MessageBox.Show("确定在自动模式下对小车手动分配任务?", Common.agvInfo[idx].Name, MessageBoxButtons.YesNo) == DialogResult.No)
return;
}
bool rtn = Common.mir.Add_Mission_Fleet(Common.agvInfo[idx], Common.agvMission[Common.showNameMissionName[LstAgvPlace.Text]]);
bool rtn = Common.mir.Add_Mission_Fleet(Common.agvInfo[idx], Common.agvMission[Common.showNameMissionName[LstAgvPlace.Text]]);
if (!rtn)
return;
//Common.agvInfo[idx].TaskSend = LstAgvPlace.Text;
......@@ -384,16 +381,33 @@ namespace AGVControl
Invoke(new Action(() =>
{
List<AlarmMsg> msglist = new List<AlarmMsg>();
//bool change = false;
for (int i = 0; i < Common.agvInfo.Count; i++)
{
agvRunInfo[i].Text = Common.agvInfo[i].RunInfo();
try
{
agvRunInfo[i].Text = Common.agvInfo[i].RunInfo();
if (!Common.agvInfo[i].Msg.Equals(""))
msglist.Add(new AlarmMsg(Common.agvInfo[i].Name, "lineAgv." + Common.agvInfo[i].Name + ".Msg", Common.agvInfo[i].Msg, 1));
}
catch (Exception ex)
{
Common.log.Error("上报小车运行步骤失败" + ex.Message + ex.StackTrace);
}
}
//if (change)
BLL.AGVManager.updateDeviceAlarmMsg(msglist);
lblWO.Text = Common.doubleLine_WO;
lblDestInfo.Text = AGVManager.A6_Target;
lblCharge3.Text = "充电桩3:" + Common.chargeStatus.charge3;
lblCharge4.Text = "充电桩4:" + Common.chargeStatus.charge4;
}));
InShhow = false;
}
......@@ -487,7 +501,7 @@ namespace AGVControl
ShowEmptyTask();
return;
}
if (MessageBox.Show("确定删除产线任务[" + cmbBoxLineName.SelectedItem.ToString() + "]","手动删除解绑任务",MessageBoxButtons.YesNo) == DialogResult.No)
if (MessageBox.Show("确定删除产线任务[" + cmbBoxLineName.SelectedItem.ToString() + "]", "手动删除解绑任务", MessageBoxButtons.YesNo) == DialogResult.No)
return;
//int idx=Common.missionList.FindIndex(s => s.NodeName == Common.agvProductionLine[txtBoxMission.Text]);
......@@ -539,7 +553,7 @@ namespace AGVControl
}
if (cmbBoxLineName.SelectedItem.ToString().StartsWith("A"))
return;
if (MessageBox.Show("确定添加产线任务[" + cmbBoxLineName.SelectedItem.ToString() + "]","手动1添加解绑",MessageBoxButtons.YesNo) == DialogResult.No)
if (MessageBox.Show("确定添加产线任务[" + cmbBoxLineName.SelectedItem.ToString() + "]", "手动1添加解绑", MessageBoxButtons.YesNo) == DialogResult.No)
return;
int idx = Common.nodeInfo.FindIndex(s => s.AliceName.Equals(cmbBoxLineName.SelectedItem.ToString()));
if (idx > -1)
......@@ -658,7 +672,7 @@ namespace AGVControl
if (idx < 0) return;
if (Common.agvInfo[idx].IsCon)
{
Common.agvInfo[idx].CurJob =null;
Common.agvInfo[idx].CurJob = null;
}
}
......@@ -668,7 +682,7 @@ namespace AGVControl
if (DgvAgv.SelectedCells.Count == 0) return;
int idx = DgvAgv.SelectedCells[0].RowIndex;
if (idx < 0) return;
Common.CalculateNearNode(Common.agvInfo[idx],"E");
Common.CalculateNearNode(Common.agvInfo[idx], "E");
}
private void btnUpdateStatus_Click(object sender, EventArgs e)
......@@ -680,7 +694,7 @@ namespace AGVControl
if (idx < 0) return;
Task.Factory.StartNew(() =>
{
idx = Common.nodeInfo.FindIndex(s => s.Name.Equals(SettingString.A6));
idx = Common.nodeInfo.FindIndex(s => s.Name.Equals(SettingString.A6));
if (idx > -1)
{
AGVManager.UpdateStatus(txtBoxRFID.Text.ToUpper(), Common.agvInfo[idx].Place);
......@@ -693,5 +707,10 @@ namespace AGVControl
MessageBox.Show("手动上报状态失败:" + ex.Message + "\r\n" + ex.StackTrace);
}
}
private void dgvLineMission_Click(object sender, EventArgs e)
{
ShowEmptyTask();
}
}
}
......@@ -54,7 +54,7 @@ namespace AGVControl
// Common.CheckAGVMissionState();
//获取节点位置
//Common.GetNodesPosition();
Common.GetNodesPosition();
Common.control.Start();
Common.server = new AgvServer();
Common.server.Start();
......
......@@ -118,7 +118,11 @@ namespace AGVControl
/// <summary>
/// 任务内容
/// </summary>
public string Msg { get; set; }
public string Msg
{
get;
set;
} = "";
/// <summary>
/// 当前任务
/// </summary>
......@@ -165,19 +169,19 @@ namespace AGVControl
tmpJob = (SendFullShelfToLineJob)CurJob;
if (RFID.StartsWith("C"))
{
return string.Format("Name:{1}{0}RFID:{2}{0}CurJob:{3}{0}CurTaskName:{4}{0}RunStep:{5}{0}BoxDestInfo:{6}{0}GetRack:{7}{0}RunInfo:{8}", "\r\n", Name, RFID,CurJob.ToString(), CurTaskName,Msg, BoxDestInfo, BLL.AGVManager.GetRackBy(RFID),MissionText);
return string.Format("Name:{1}{0}RFID:{2}{0}CurJob:{3}{0}CurTaskName:{4}{0}RunInfo:{5}{0}BoxDestInfo:{6}{0}GetRack:{7}{0}MissionText:{8}", "\r\n", Name, RFID, CurJob.ToString(), CurTaskName, Msg, BoxDestInfo, BLL.AGVManager.GetRackBy(RFID), MissionText);
}
else if (!RFID.Equals(""))
{
return string.Format("Name:{1}{0}RFID:{2}{0}CurJob:{3}{0}CurTaskName:{4}{0}RunStep:{5}{0}BoxDestInfo:{6}{0}RunInfo:{7}", "\r\n", Name, RFID, CurJob.ToString(), CurTaskName, Msg, BoxDestInfo,MissionText);
return string.Format("Name:{1}{0}RFID:{2}{0}CurJob:{3}{0}CurTaskName:{4}{0}RunInfo:{5}{0}BoxDestInfo:{6}{0}MissionText:{7}", "\r\n", Name, RFID, CurJob.ToString(), CurTaskName, Msg, BoxDestInfo, MissionText);
}
else
return string.Format("Name:{1}{0}RFID:{2}{0}CurJob:{3}{0}CurTaskName:{4}{0}RunStep:{5}{0}RunInfo:{6}", "\r\n", Name, RFID, CurJob.ToString(), CurTaskName, Msg,MissionText);
return string.Format("Name:{1}{0}RFID:{2}{0}CurJob:{3}{0}CurTaskName:{4}{0}RunInfo:{5}{0}MissionText:{6}", "\r\n", Name, RFID, CurJob.ToString(), CurTaskName, Msg, MissionText);
}
else
return string.Format("Name:{1}{0}RFID:{2}{0}CurTaskName:{3}{0}RunInfo:{4}", "\r\n", Name, RFID, CurTaskName,MissionText);
return string.Format("Name:{1}{0}RFID:{2}{0}CurTaskName:{3}{0}MissionText:{4}", "\r\n", Name, RFID, CurTaskName, MissionText);
}
public Agv_Info(string id, string name, string ip, string authorization, string ioID, bool isUse, string rfid)
{
......@@ -232,7 +236,7 @@ namespace AGVControl
IsExistShelf = input[3];
}
}
if (!StateID.Equals(stateID) || !CurTaskState.Equals(stateText)
if (!StateID.Equals(stateID) || !CurTaskState.Equals(stateText) || !Battery.Equals(battery)
|| !MissionText.Equals(missionText) || !IsExistShelf.Equals(preShelfState))
isChange = true;
StateID = stateID;
......@@ -245,7 +249,7 @@ namespace AGVControl
public void GetPlace(int value)
{
// Common.log.Debug(Name + " PLC20=" + value);
// Common.log.Debug(Name + " PLC20=" + value);
if (value == 0)
{
Place = "";
......@@ -289,7 +293,7 @@ namespace AGVControl
s.Add(CurTaskState);
s.Add(RFID);
//s.Add(Msg);
// s.Add(MissionText);
// s.Add(MissionText);
s.Add(PlaceAliceName);
//s.Add(Place);
s.Add(PlaceState.ToString());
......
......@@ -13,11 +13,9 @@ namespace AGVControl
/// <summary>
/// 任务是否结束
/// 运行信息
/// </summary>
/// <returns></returns>
public abstract bool IsEnd { get; }
public abstract string RunInfo { get; }
/// <summary>
/// 根据任务状态继续执行任务
/// </summary>
......
......@@ -30,7 +30,14 @@ namespace AGVControl
/// </summary>
private string agvPlace { get; set; }
public override bool IsEnd { get { return ChargeStep.IsStep(CHARGE_STEP.END); } }
private string runInfo = "";
/// <summary>
/// 运行信息
/// </summary>
public override string RunInfo
{
get { return runInfo; }
}
private JobStep<CHARGE_STEP> ChargeStep = new JobStep<CHARGE_STEP>(CHARGE_STEP.NONE);
......@@ -42,7 +49,8 @@ namespace AGVControl
{
string msg = agv.Name + " ";
bool rtn = false;
agv.Msg = ChargeStep.Msg;
runInfo = "";
agv.Msg = runInfo;
if (ChargeStep.IsStep(CHARGE_STEP.NONE))
{
if (agv.Battery > Common.chargeStatus.chargeMax)
......@@ -50,23 +58,27 @@ namespace AGVControl
if (agv.Place.StartsWith(SettingString.Standby_Name_Prefix))//在待机位不操作
{
ChargeStep.ToNextStep(CHARGE_STEP.END);
msg += "在待机位,电量充足[" + agv.Battery + "%],等待任务";
runInfo = "在待机位,电量充足[" + agv.Battery + "%],等待任务";
msg += runInfo;
ChargeStep.Msg = msg;
}
else if (agvPlace.StartsWith("G"))
{
ChargeStep.ToNextStep(CHARGE_STEP.WAIT_AGV_REACH_4D_DOOR);
msg += "电量充足["+ agv.Battery + "%],从当前位置4C-" + agvPlace + "回到待机位,先到4D门";
runInfo = "电量充足[" + agv.Battery + "%],从当前位置4C-" + agvPlace + "回到待机位,先到4D门";
msg += runInfo;
ChargeStep.Msg = msg;
Common.DoorMission(agv, SettingString.DoorCToD);
}
else
{
ChargeStep.ToNextStep(CHARGE_STEP.WAIT_REACH_STANDBY);
msg += "电量充足[" + agv.Battery + "%],从当前位置" + agvPlace + "回到待机位";
runInfo = "电量充足[" + agv.Battery + "%],从当前位置" + agvPlace + "回到待机位";
msg += runInfo;
ChargeStep.Msg = msg;
//Common.StatusCharge(agv);
Common.MoveToNode(agv, SettingString.Standby);
}
}
......@@ -75,25 +87,30 @@ namespace AGVControl
if (agvPlace.StartsWith("G"))
{
ChargeStep.ToNextStep(CHARGE_STEP.WAIT_AGV_REACH_4D_DOOR);
msg += "电量[" + agv.Battery + "%]小于最大电量["+ Common.chargeStatus.chargeMax + "%],从当前位置" + agvPlace + "回到充电位,先到4D门";
runInfo = "电量[" + agv.Battery + "%]小于最大电量[" + Common.chargeStatus.chargeMax + "%],从当前位置" + agvPlace + "回到充电位,先到4D门";
msg += runInfo;
ChargeStep.Msg = msg;
Common.DoorMission(agv, SettingString.DoorCToD);
}
else
{
if(!Common.StatusCharge(agv))
if (!Common.StatusCharge(agv))
{
ChargeStep.ToNextStep(CHARGE_STEP.WAIT_REACH_STANDBY);
msg += "电量[" + agv.Battery + "%]小于最大电量[" + Common.chargeStatus.chargeMax + "%],充电桩有小车,从当前位置" + agvPlace + "回到待机位";
runInfo = "电量[" + agv.Battery + "%]小于最大电量[" + Common.chargeStatus.chargeMax + "%],充电桩有小车,从当前位置" + agvPlace + "回到待机位";
msg += runInfo;
ChargeStep.Msg = msg;
Common.MoveToNode(agv, SettingString.Standby);
}
else
{
ChargeStep.ToNextStep(CHARGE_STEP.WAIT_REACH_CHARGE_STATION);
msg += "电量[" + agv.Battery + "%]小于最大电量[" + Common.chargeStatus.chargeMax + "%],从当前位置" + agvPlace + "回到充电位";
runInfo = "电量[" + agv.Battery + " %]小于最大电量[" + Common.chargeStatus.chargeMax + " %],从当前位置" + agvPlace + "回到充电位";
msg += runInfo;
ChargeStep.Msg = msg;
}
}
}
......@@ -107,7 +124,8 @@ namespace AGVControl
if (agv.Battery > Common.chargeStatus.chargeMax)
{
ChargeStep.ToNextStep(CHARGE_STEP.WAIT_REACH_STANDBY);
msg += "电量充足[" + agv.Battery + "%],从当前位置" + agvPlace + "回到待机位";
runInfo = "电量充足[" + agv.Battery + "%],从当前位置" + agvPlace + "回到待机位";
msg += runInfo;
ChargeStep.Msg = msg;
Common.MoveToNode(agv, SettingString.Standby);
}
......@@ -116,14 +134,17 @@ namespace AGVControl
if (!Common.StatusCharge(agv))
{
ChargeStep.ToNextStep(CHARGE_STEP.WAIT_REACH_STANDBY);
msg += "电量[" + agv.Battery + "%]小于最大电量[" + Common.chargeStatus.chargeMax + "%],充电桩有小车,从当前位置" + agvPlace + "回到待机位";
runInfo = "电量[" + agv.Battery + "%]小于最大电量[" + Common.chargeStatus.chargeMax + "%],充电桩有小车,从当前位置" + agvPlace + "回到待机位";
msg += runInfo;
ChargeStep.Msg = msg;
Common.MoveToNode(agv, SettingString.Standby);
}
else
{
ChargeStep.ToNextStep(CHARGE_STEP.WAIT_REACH_CHARGE_STATION);
msg += "电量[" + agv.Battery + "%]小于最大电量[" + Common.chargeStatus.chargeMax + "%],从当前位置" + agvPlace + "回到充电位";
runInfo = "电量[" + agv.Battery + "%]小于最大电量[" + Common.chargeStatus.chargeMax + "%],从当前位置" + agvPlace + "回到充电位";
msg += runInfo;
ChargeStep.Msg = msg;
}
}
......@@ -135,7 +156,8 @@ namespace AGVControl
if (Common.CheckTaskFinished(agv, agv.CurTaskName))
{
ChargeStep.ToNextStep(CHARGE_STEP.WAIT_REACH_CHARGE_OK);
msg += "充电任务分配完成,去充电且等待任务";
runInfo = "充电任务分配完成,去充电且等待任务";
msg += runInfo;
ChargeStep.Msg = msg;
}
}
......@@ -146,7 +168,8 @@ namespace AGVControl
if (agv.Battery >= Common.chargeStatus.chargeMax)
{
ChargeStep.ToNextStep(CHARGE_STEP.WAIT_REACH_STANDBY);
msg += "电量充足,回待机位";
runInfo = "电量充足,回待机位";
msg += runInfo;
ChargeStep.Msg = msg;
if (Common.chargeStatus.charge3.Equals(agv.Name))
{
......@@ -171,27 +194,21 @@ namespace AGVControl
{
Common.chargeStatus.charge4 = "";
}
msg += "充电过程检测到任务,电量["+agv.Battery+"]大于最小电量["+Common.chargeStatus.chargeMin+"],中断充电执行任务";
runInfo = "充电过程检测到任务,电量[" + agv.Battery + "]大于最小电量[" + Common.chargeStatus.chargeMin + "],中断充电执行任务";
msg += runInfo;
ChargeStep.Msg = msg;
if (Common.chargeStatus.charge3.Equals(agv.Name))
{
Common.chargeStatus.charge3 = "";
}
if (Common.chargeStatus.charge4.Equals(agv.Name))
{
Common.chargeStatus.charge4 = "";
}
return job;
}
}
}
else
else//固定充电桩
{
if (agv.Battery >= Common.chargeStatus.chargeMax)
{
ChargeStep.ToNextStep(CHARGE_STEP.END);
msg += "充电完成";
runInfo = "充电完成";
msg += runInfo;
ChargeStep.Msg = msg;
}
else if (agv.Battery >= Common.chargeStatus.chargeMin)
......@@ -199,7 +216,8 @@ namespace AGVControl
Job job = Common.control.GetJob(agv);
if (job != null && !(job is ChargeJob))
{
msg += "充电过程检测到任务,电量[" + agv.Battery + "]大于最小电量[" + Common.chargeStatus.chargeMin + "],中断充电执行任务";
runInfo = "充电过程检测到任务,电量[" + agv.Battery + "]大于最小电量[" + Common.chargeStatus.chargeMin + "],中断充电执行任务";
msg += runInfo;
ChargeStep.Msg = msg;
if (Common.chargeStatus.charge3.Equals(agv.Name))
{
......@@ -211,6 +229,21 @@ namespace AGVControl
}
return job;
}
else if (job == null && agv.Battery < Common.chargeStatus.chargeMax / 2)
{
ChargeStep.ToNextStep(CHARGE_STEP.NONE);
runInfo = "在待机位暂无任务,且当前电量小于" + Common.chargeStatus.chargeMax / 2 + ",去充电位";
msg += runInfo;
ChargeStep.Msg = msg;
if (Common.chargeStatus.charge3.Equals(agv.Name))
{
Common.chargeStatus.charge3 = "";
}
if (Common.chargeStatus.charge4.Equals(agv.Name))
{
Common.chargeStatus.charge4 = "";
}
}
}
}
......@@ -221,16 +254,19 @@ namespace AGVControl
if (Common.CheckTaskFinished(agv, SettingString.Standby, agv.CurTaskGUID))
{
ChargeStep.ToNextStep(CHARGE_STEP.END);
msg += "充电完成,到达待机位";
runInfo= "充电完成,到达待机位";
msg += runInfo;
ChargeStep.Msg = msg;
}
}
else if (ChargeStep.IsStep(CHARGE_STEP.END))
{
Job job = Common.control.GetJob(agv);
if (job != null && !(job is ChargeJob))
{
msg += "在待机位检测到任务,执行任务";
runInfo= "在待机位检测到任务,执行任务";
msg += runInfo;
ChargeStep.Msg = msg;
if (Common.chargeStatus.charge3.Equals(agv.Name))
{
......@@ -242,6 +278,21 @@ namespace AGVControl
}
return job;
}
else if (job == null && agv.Battery < Common.chargeStatus.chargeMax / 2)
{
ChargeStep.ToNextStep(CHARGE_STEP.NONE);
runInfo= "在待机位暂无任务,且当前电量小于" + Common.chargeStatus.chargeMax / 2 + ",去充电位";
msg += runInfo;
ChargeStep.Msg = msg;
if (Common.chargeStatus.charge3.Equals(agv.Name))
{
Common.chargeStatus.charge3 = "";
}
if (Common.chargeStatus.charge4.Equals(agv.Name))
{
Common.chargeStatus.charge4 = "";
}
}
}
return this;
}
......
......@@ -31,10 +31,15 @@ namespace AGVControl
/// </summary>
private string agvPlace { get; set; }
private string runInfo = "";
/// <summary>
/// 到达待机位
/// 运行信息
/// </summary>
public override bool IsEnd { get { return EmptyAGVBackStep.IsStep(EMPTY_AGV_BACK_STEP.END); } }
public override string RunInfo
{
get { return runInfo; }
}
private JobStep<EMPTY_AGV_BACK_STEP> EmptyAGVBackStep = new JobStep<EMPTY_AGV_BACK_STEP>(EMPTY_AGV_BACK_STEP.NONE);
......@@ -44,31 +49,61 @@ namespace AGVControl
/// <param name="agv"></param>
public override Job Execute(Agv_Info agv)
{
string msg = agv.Name+" ";
string msg = agv.Name + " ";
bool rtn = false;
agv.Msg = EmptyAGVBackStep.Msg;
agv.Msg = runInfo;
if (EmptyAGVBackStep.IsStep(EMPTY_AGV_BACK_STEP.NONE))
{
if (Common.FindEmptyShelfNode(agv, out string nodeName,true))
if (Common.FindEmptyShelfNode(agv, out string nodeName, true))
{
int i = Common.agvInfo.FindIndex(s => s.CurJob is GoEmptyShelfLineJob && ((GoEmptyShelfLineJob)s.CurJob).EmptyShelfPlace.Equals(nodeName));
if(i==-1)
{
runInfo= "小车在产线 " + agvPlace + " 准备返回时检测到 " + nodeName + " 有空料架";
msg += runInfo;
EmptyAGVBackStep.Msg = msg;
return new GoEmptyShelfLineJob(agvPlace, nodeName);
}
else
{
if (agvPlace.StartsWith("G"))
{
EmptyAGVBackStep.ToNextStep(EMPTY_AGV_BACK_STEP.WAIT_AGV_REACH_4D_DOOR);
runInfo= "从产线" + agvPlace + "回待机位,先到4D门";
msg += runInfo;
EmptyAGVBackStep.Msg = msg;
Common.DoorMission(agv, SettingString.DoorCToD);
}
else
{
EmptyAGVBackStep.ToNextStep(EMPTY_AGV_BACK_STEP.WAIT_REACH_STANDBY);
runInfo= "从产线" + agvPlace + "回待机位";
msg += runInfo;
EmptyAGVBackStep.Msg = msg;
Common.MoveToNode(agv, SettingString.Standby);
}
}
//EmptyAGVBackStep.ToNextStep(EMPTY_AGV_BACK_STEP.END);
msg = "小车在产线 " + agvPlace + " 准备返回时检测到 " + nodeName + " 有空料架";
EmptyAGVBackStep.Msg = msg;
return new GoEmptyShelfLineJob(agvPlace, nodeName);
}
else
{
if (agvPlace.StartsWith("G"))
{
EmptyAGVBackStep.ToNextStep(EMPTY_AGV_BACK_STEP.WAIT_AGV_REACH_4D_DOOR);
msg = "从产线" + agvPlace + "回待机位,先到4D门";
runInfo= "从产线" + agvPlace + "回待机位,先到4D门";
msg += runInfo;
EmptyAGVBackStep.Msg = msg;
Common.DoorMission(agv, SettingString.DoorCToD);
}
else
{
EmptyAGVBackStep.ToNextStep(EMPTY_AGV_BACK_STEP.WAIT_REACH_STANDBY);
msg = "从产线" + agvPlace + "回待机位";
runInfo= "从产线" + agvPlace + "回待机位";
msg += runInfo;
EmptyAGVBackStep.Msg = msg;
Common.MoveToNode(agv, SettingString.Standby);
}
......@@ -81,13 +116,15 @@ namespace AGVControl
Job job = Common.control.GetJob(agv);
if (job == null && agv.Battery < Common.chargeStatus.chargeMax)
{
msg = "到达待机位,电量[" + agv.Battery + "]小于最大电量[" + Common.chargeStatus.chargeMax + "],暂无任务,去充电";
runInfo= "到达待机位,电量[" + agv.Battery + "]小于最大电量[" + Common.chargeStatus.chargeMax + "],暂无任务,去充电";
msg += runInfo;
EmptyAGVBackStep.Msg = msg;
return new ChargeJob("");
}
else
{
msg = "到达待机位,检测到新任务,执行任务";
runInfo= "到达待机位,检测到新任务,执行任务";
msg += runInfo;
EmptyAGVBackStep.Msg = msg;
return job;
}
......@@ -97,7 +134,8 @@ namespace AGVControl
{
if (Common.FindFullShelfTask(agv))
{
msg = "从产线" + agvPlace + "回待机位过程中,检测到A6出满料,去A6";
runInfo= "从产线" + agvPlace + "回待机位过程中,检测到A6出满料,去A6";
msg += runInfo;
EmptyAGVBackStep.Msg = msg;
return new GoFullShelfStationJob(SettingString.Standby);
}
......@@ -116,13 +154,15 @@ namespace AGVControl
{
if (Common.FindFullShelfTask(agv))
{
msg = "从产线" + agvPlace + "到达4D门,检测到A6出满料,去A6";
runInfo= "从产线" + agvPlace + "到达4D门,检测到A6出满料,去A6";
msg += runInfo;
EmptyAGVBackStep.Msg = msg;
return new GoFullShelfStationJob(SettingString.D4_DOOR_Name);
}
else
{
msg = "从产线" + agvPlace + "到达4D门,暂无任务,去充电位";
runInfo= "从产线" + agvPlace + "到达4D门,暂无任务,去充电位";
msg += runInfo;
EmptyAGVBackStep.Msg = msg;
return new ChargeJob(SettingString.D4_DOOR_Name);
}
......
......@@ -42,7 +42,15 @@ namespace AGVControl
private eShelfType shelfType;
public override bool IsEnd { get { return EmptyBackStep.IsStep(EMPTY_SHELF_BACK_STEP.END); } }
private string runInfo = "";
/// <summary>
/// 运行信息
/// </summary>
public override string RunInfo
{
get { return runInfo; }
}
private JobStep<EMPTY_SHELF_BACK_STEP> EmptyBackStep = new JobStep<EMPTY_SHELF_BACK_STEP>(EMPTY_SHELF_BACK_STEP.NONE);
......@@ -52,15 +60,16 @@ namespace AGVControl
/// <param name="agv"></param>
public override Job Execute(Agv_Info agv)
{
string msg = "";
string msg = agv.Name+ " ";
bool rtn = false;
agv.Msg = EmptyBackStep.Msg;
agv.Msg = runInfo;
if (EmptyBackStep.IsStep(EMPTY_SHELF_BACK_STEP.NONE))
{
if (EmptyShelfPlace.StartsWith("G"))//4车间
{
EmptyBackStep.ToNextStep(EMPTY_SHELF_BACK_STEP.WAIT_AGV_REACH_DOOR);
msg = "空料架从产线" + EmptyShelfPlace + "前往4D门";
runInfo= "空料架从产线" + EmptyShelfPlace + "前往4D门";
msg += runInfo;
EmptyBackStep.Msg = msg;
Common.DoorMission(agv, SettingString.DoorCToD);
}
......@@ -70,7 +79,8 @@ namespace AGVControl
{
EmptyShelfTargetPlace = nodeName;
EmptyBackStep.ToNextStep(EMPTY_SHELF_BACK_STEP.WAIT_AGV_REACH_A5A6);
msg = "空料架从产线 [" + EmptyShelfPlace + "] 送往双层线" + EmptyShelfTargetPlace;
runInfo= "空料架从产线 [" + EmptyShelfPlace + "] 送往双层线" + EmptyShelfTargetPlace;
msg += runInfo;
EmptyBackStep.Msg = msg;
if (!EmptyShelfTargetPlace.Equals(""))
Common.MoveToNode(agv, EmptyShelfTargetPlace);
......@@ -78,7 +88,8 @@ namespace AGVControl
else
{
EmptyBackStep.ToNextStep(EMPTY_SHELF_BACK_STEP.WAIT_AGV_REACH_STANDBY);
msg = "双层线暂不需要空料架,从产线[" + EmptyShelfPlace + "]到待机位";
runInfo= "双层线暂不需要空料架,从产线[" + EmptyShelfPlace + "]到待机位";
msg += runInfo;
EmptyBackStep.Msg = msg;
Common.MoveToNode(agv, SettingString.Standby);
}
......@@ -92,14 +103,16 @@ namespace AGVControl
{
EmptyShelfTargetPlace = nodeName;
EmptyBackStep.ToNextStep(EMPTY_SHELF_BACK_STEP.WAIT_AGV_REACH_A5A6);
msg = "空料架从产线 [" + EmptyShelfPlace + "] 送往双层线" + EmptyShelfTargetPlace;
runInfo= "空料架从产线 [" + EmptyShelfPlace + "] 送往双层线" + EmptyShelfTargetPlace;
msg += runInfo;
EmptyBackStep.Msg = msg;
Common.MoveToNode(agv, EmptyShelfTargetPlace);
}
else
{
EmptyBackStep.ToNextStep(EMPTY_SHELF_BACK_STEP.WAIT_AGV_REACH_STANDBY);
msg = "双层线暂不需要空料架,从产线[" + EmptyShelfPlace + "]到待机位";
runInfo= "双层线暂不需要空料架,从产线[" + EmptyShelfPlace + "]到待机位";
msg += runInfo;
EmptyBackStep.Msg = msg;
Common.MoveToNode(agv, SettingString.Standby);
}
......@@ -111,7 +124,8 @@ namespace AGVControl
{
EmptyShelfTargetPlace = nodeName;
EmptyBackStep.ToNextStep(EMPTY_SHELF_BACK_STEP.WAIT_AGV_REACH_A5A6);
msg = "待机位检测到双层线需要料架,送往双层线 " + EmptyShelfTargetPlace;
runInfo= "待机位检测到双层线需要料架,送往双层线 " + EmptyShelfTargetPlace;
msg += runInfo;
EmptyBackStep.Msg = msg;
Common.MoveToNode(agv, EmptyShelfTargetPlace);
}
......@@ -124,7 +138,8 @@ namespace AGVControl
//EmptyBackStep.Msg = msg;
//return new EnterLeaveShelfJob(EmptyShelfTargetPlace,eEnterLeaveType.Leave,shelfType);
EmptyBackStep.ToNextStep(EMPTY_SHELF_BACK_STEP.WAIT_DOUBLE_LINE_RESPONSE);
msg = "AGV到达 " + EmptyShelfTargetPlace + ",并发送入料架请求[ReadyEnter]";
runInfo= "AGV到达 " + EmptyShelfTargetPlace + ",并发送入料架请求[ReadyEnter]";
msg += runInfo;
EmptyBackStep.Msg = msg;
Common.server.ReadyEnter(EmptyShelfTargetPlace);
}
......@@ -138,7 +153,8 @@ namespace AGVControl
if(!agv.CurTaskName.Equals("Leave"))
{
EmptyBackStep.ToNextStep(EMPTY_SHELF_BACK_STEP.WAIT__EMPTY_SHELF_IN_DOUBLE_LINE);
msg = "收到双层线入料架请求[ReadyEnter]的响应 " + EmptyShelfTargetPlace + "入料架,小车链条运行";
runInfo = "收到双层线入料架请求[ReadyEnter]的响应 " + EmptyShelfTargetPlace + "入料架,小车链条运行";
msg += runInfo;
EmptyBackStep.Msg = msg;
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["Leave"]);
agv.TaskSend = rtn ? "Leave" : "";
......@@ -148,13 +164,14 @@ namespace AGVControl
else if (EmptyBackStep.IsTimeOut(15000, out double timeOutValue))
{
EmptyBackStep.ToNextStep(EMPTY_SHELF_BACK_STEP.WAIT_AGV_REACH_A5A6);
msg = "AGV到达 " + EmptyShelfTargetPlace + ",15秒后重新向双层线发送入料架请求[ReadyEnter]";
runInfo= "AGV到达 " + EmptyShelfTargetPlace + ",15秒后重新向双层线发送入料架请求[ReadyEnter]";
msg += runInfo;
EmptyBackStep.Msg = msg;
}
}
else if (EmptyBackStep.IsStep(EMPTY_SHELF_BACK_STEP.WAIT__EMPTY_SHELF_IN_DOUBLE_LINE))
{
if (agv.Place.Equals(EmptyShelfTargetPlace) && agv.PlaceState.Equals(ePlaceState.LeaveFinish))
if (Common.CheckEnterOrLeaveFinished(agv,"Leave",agv.CurTaskGUID))
{
//EmptyBackStep.ToNextStep(EMPTY_SHELF_BACK_STEP.END);
......@@ -162,13 +179,15 @@ namespace AGVControl
Job job = Common.control.GetJob(agv);
if (job != null)
{
msg += "在双层线检测到任务,执行任务";
runInfo= "在双层线检测到任务,执行任务";
msg += runInfo;
EmptyBackStep.Msg = msg;
return job;
}
else
{
msg = "空料架进入" + EmptyShelfTargetPlace + "完成,暂无任务,回充电位";
runInfo= "空料架进入" + EmptyShelfTargetPlace + "完成,暂无任务,回充电位";
msg += runInfo;
EmptyBackStep.Msg = msg;
return new ChargeJob(SettingString.DoubleLine_Name_Prefix);
}
......@@ -177,7 +196,8 @@ namespace AGVControl
else if (EmptyBackStep.IsTimeOut(60000, out double timeOutValue))
{
//链条停止
msg = "空料架在[" + EmptyShelfTargetPlace + "]离开小车超时[" + timeOutValue.ToString("f1") + "秒],请检查料架离开小车的情况";
runInfo= "空料架在[" + EmptyShelfTargetPlace + "]离开小车超时[" + timeOutValue.ToString("f1") + "秒],请检查料架离开小车的情况";
msg += runInfo;
EmptyBackStep.Msg = msg;
}
......
......@@ -53,15 +53,23 @@ namespace AGVControl
public eEnterLeaveType ActionType { get; set; }
private eShelfType shelfType;
public override bool IsEnd { get { return EnterLeaveShelfStep.IsStep(ENTER_LEAVE_SHELF_STEP.END); } }
private string runInfo = "";
/// <summary>
/// 运行信息
/// </summary>
public override string RunInfo
{
get { return runInfo; }
}
private JobStep<ENTER_LEAVE_SHELF_STEP> EnterLeaveShelfStep = new JobStep<ENTER_LEAVE_SHELF_STEP>(ENTER_LEAVE_SHELF_STEP.NONE);
public override Job Execute(Agv_Info agv)
{
string msg = "";
string msg = agv.Name+ " ";
bool rtn = false;
agv.Msg = EnterLeaveShelfStep.Msg;
agv.Msg = runInfo;
if (EnterLeaveShelfStep.IsStep(ENTER_LEAVE_SHELF_STEP.NONE))
{
if (ActionType.Equals(eEnterLeaveType.Leave))
......@@ -71,7 +79,8 @@ namespace AGVControl
//EnterLeaveShelfStep.Msg = msg;
//Common.server.ReadyEnter(LineName);
EnterLeaveShelfStep.ToNextStep(ENTER_LEAVE_SHELF_STEP.WAIT__SHELF_IN_LINE);
msg = LineName + "入料架,小车链条运行";
runInfo = LineName + "入料架,小车链条运行";
msg += runInfo;
EnterLeaveShelfStep.Msg = msg;
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["Leave"]);
agv.TaskSend = rtn ? "Leave" : "";
......@@ -83,7 +92,8 @@ namespace AGVControl
//EnterLeaveShelfStep.Msg = msg;
//Common.server.ReadyLeave(LineName);
EnterLeaveShelfStep.ToNextStep(ENTER_LEAVE_SHELF_STEP.WAIT__SHELF_OUT_LINE);
msg = LineName + "出料架,小车链条运行";
runInfo = LineName + "出料架,小车链条运行";
msg += runInfo;
EnterLeaveShelfStep.Msg = msg;
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["Enter"]);
agv.TaskSend = rtn ? "Enter" : "";
......@@ -96,7 +106,8 @@ namespace AGVControl
if (node.StateEquals(eNodeStatus.MayEnter))
{
EnterLeaveShelfStep.ToNextStep(ENTER_LEAVE_SHELF_STEP.WAIT__SHELF_IN_LINE);
msg = "收到产线入料架请求[ReadyEnter]的响应, " + LineName + "入料架,小车链条运行";
runInfo= "收到产线入料架请求[ReadyEnter]的响应, " + LineName + "入料架,小车链条运行";
msg += runInfo;
EnterLeaveShelfStep.Msg = msg;
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["Leave"]);
agv.TaskSend = rtn ? "Leave" : "";
......@@ -104,7 +115,8 @@ namespace AGVControl
else if (EnterLeaveShelfStep.IsTimeOut(15000, out double timeOutValue))
{
EnterLeaveShelfStep.ToNextStep(ENTER_LEAVE_SHELF_STEP.NONE);
msg = "AGV到达 " + LineName + ",15秒后重新向产线发送入料架请求[ReadyEnter]";
runInfo = "AGV到达 " + LineName + ",15秒后重新向产线发送入料架请求[ReadyEnter]";
msg += runInfo;
EnterLeaveShelfStep.Msg = msg;
}
}
......@@ -115,7 +127,8 @@ namespace AGVControl
if (node.StateEquals(eNodeStatus.MayLeave))
{
EnterLeaveShelfStep.ToNextStep(ENTER_LEAVE_SHELF_STEP.WAIT__SHELF_OUT_LINE);
msg = "收到产线出料架请求[ReadyLeave]的响应, " + LineName + "出料架,小车链条运行";
runInfo= "收到产线出料架请求[ReadyLeave]的响应, " + LineName + "出料架,小车链条运行";
msg += runInfo;
EnterLeaveShelfStep.Msg = msg;
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["Enter"]);
agv.TaskSend = rtn ? "Enter" : "";
......@@ -123,17 +136,19 @@ namespace AGVControl
else if (EnterLeaveShelfStep.IsTimeOut(15000, out double timeOutValue))
{
EnterLeaveShelfStep.ToNextStep(ENTER_LEAVE_SHELF_STEP.NONE);
msg = "AGV到达 " + LineName + ",15秒后重新向产线发送入料架请求[ReadyLeave]";
runInfo= "AGV到达 " + LineName + ",15秒后重新向产线发送入料架请求[ReadyLeave]";
msg += runInfo;
EnterLeaveShelfStep.Msg = msg;
}
}
else if (EnterLeaveShelfStep.IsStep(ENTER_LEAVE_SHELF_STEP.WAIT__SHELF_IN_LINE))
{
if (agv.Place.Equals(LineName) && agv.PlaceState.Equals(ePlaceState.LeaveFinish))
if (Common.CheckEnterOrLeaveFinished(agv, "Leave", agv.CurTaskGUID))
{
//EnterLeaveShelfStep.ToNextStep(ENTER_LEAVE_SHELF_STEP.END);
msg = "料架进入" + LineName + "完成 ["+RFID+"]";
runInfo= "料架进入" + LineName + "完成 [" + RFID + "]";
msg += runInfo;
EnterLeaveShelfStep.Msg = msg;
agv.RFID = "";
return new EmptyAGVBackJob(LineName);
......@@ -142,26 +157,29 @@ namespace AGVControl
else if (EnterLeaveShelfStep.IsTimeOut(60000, out double timeOutValue))
{
//链条停止
msg = "料架在[" + LineName + "]离开小车超时[" + timeOutValue.ToString("f1") + "秒],请检查料架离开小车的情况";
runInfo= "料架在[" + LineName + "]离开小车超时[" + timeOutValue.ToString("f1") + "秒],请检查料架离开小车的情况";
msg += runInfo;
EnterLeaveShelfStep.Msg = msg;
}
}
else if (EnterLeaveShelfStep.IsStep(ENTER_LEAVE_SHELF_STEP.WAIT__SHELF_OUT_LINE))
{
if (agv.Place.Equals(LineName) && agv.PlaceState.Equals(ePlaceState.EnterFinish))
if (Common.CheckEnterOrLeaveFinished(agv, "Enter", agv.CurTaskGUID))
{
//EnterLeaveShelfStep.ToNextStep(ENTER_LEAVE_SHELF_STEP.END);
msg = "料架在" + LineName + "出去完成 [" + RFID + "]";
runInfo = "料架在" + LineName + "出去完成 [" + RFID + "]";
msg += runInfo;
EnterLeaveShelfStep.Msg = msg;
Common.DelEmptyShelfTask(LineName);
return new EmptyShelfBackJob(LineName,shelfType);
return new EmptyShelfBackJob(LineName,eShelfType.BigShelf);
}
else if (EnterLeaveShelfStep.IsTimeOut(60000, out double timeOutValue))
{
//链条停止
msg = "料架在[" + LineName + "]进入小车超时[" + timeOutValue.ToString("f1") + "秒],请检查料架进入小车的情况";
runInfo= "料架在[" + LineName + "]进入小车超时[" + timeOutValue.ToString("f1") + "秒],请检查料架进入小车的情况";
msg += runInfo;
EnterLeaveShelfStep.Msg = msg;
}
......
......@@ -36,7 +36,15 @@ namespace AGVControl
private string agvPlae { get; set; }
public override bool IsEnd { get { return TakeEmptyStep.IsStep(TAKE_EMPTY_STEP.END); } }
private string runInfo = "";
/// <summary>
/// 运行信息
/// </summary>
public override string RunInfo
{
get { return runInfo; }
}
private JobStep<TAKE_EMPTY_STEP> TakeEmptyStep = new JobStep<TAKE_EMPTY_STEP>(TAKE_EMPTY_STEP.NONE);
......@@ -46,9 +54,9 @@ namespace AGVControl
/// <param name="agv"></param>
public override Job Execute(Agv_Info agv)
{
string msg = agv.Name+" ";
string msg = agv.Name + " ";
bool rtn = false;
agv.Msg = TakeEmptyStep.Msg;
agv.Msg = runInfo;
int nodeIdx = Common.FindNode(EmptyShelfPlace);
if (TakeEmptyStep.IsStep(TAKE_EMPTY_STEP.NONE))
......@@ -56,22 +64,25 @@ namespace AGVControl
if (agvPlae.StartsWith("G") && EmptyShelfPlace.StartsWith("E"))//4C->4D
{
TakeEmptyStep.ToNextStep(TAKE_EMPTY_STEP.WAIT_AGV_REACH_4D_DOOR);
msg += "去空料架产线" + EmptyShelfPlace + ",先前往4D门[" + agvPlae + "->" + EmptyShelfPlace + "]";
runInfo = "去空料架产线" + EmptyShelfPlace + ",先前往4D门[" + agvPlae + "->" + EmptyShelfPlace + "]";
msg += runInfo;
TakeEmptyStep.Msg = msg;
Common.DoorMission(agv, SettingString.DoorCToD);
}
else if ((agvPlae.StartsWith("E") || agvPlae.StartsWith("A"))
else if ((agvPlae.StartsWith("E") || agvPlae.StartsWith("A") || agvPlae.StartsWith("I") || agvPlae.StartsWith("H"))
&& EmptyShelfPlace.StartsWith("G"))//4D->4C
{
TakeEmptyStep.ToNextStep(TAKE_EMPTY_STEP.WAIT_AGV_REACH_4C_DOOR);
msg += "去空料架产线" + EmptyShelfPlace + ",先前往4C门[" + agvPlae + "->" + EmptyShelfPlace + "]";
runInfo= "去空料架产线" + EmptyShelfPlace + ",先前往4C门[" + agvPlae + "->" + EmptyShelfPlace + "]";
msg += runInfo;
TakeEmptyStep.Msg = msg;
Common.DoorMission(agv, SettingString.DoorDToC);
}
else
{
TakeEmptyStep.ToNextStep(TAKE_EMPTY_STEP.ASSIGN_AGV_TASK);
msg += "开始执行回收空料架任务[" + agvPlae + "->" + EmptyShelfPlace + "]";
runInfo= "开始执行回收空料架任务[" + agvPlae + "->" + EmptyShelfPlace + "]";
msg += runInfo;
TakeEmptyStep.Msg = msg;
}
}
......@@ -80,7 +91,8 @@ namespace AGVControl
if (Common.CheckTaskFinished(agv, SettingString.DoorDToC, agv.CurTaskGUID))
{
TakeEmptyStep.ToNextStep(TAKE_EMPTY_STEP.ASSIGN_AGV_TASK);
msg += "开始执行回收空料架任务[" + agvPlae + "->" + EmptyShelfPlace + "]";
runInfo= "开始执行回收空料架任务[" + agvPlae + "->" + EmptyShelfPlace + "]";
msg += runInfo;
TakeEmptyStep.Msg = msg;
}
}
......@@ -89,7 +101,8 @@ namespace AGVControl
if (Common.CheckTaskFinished(agv, SettingString.DoorCToD, agv.CurTaskGUID))
{
TakeEmptyStep.ToNextStep(TAKE_EMPTY_STEP.ASSIGN_AGV_TASK);
msg += "开始执行回收空料架任务[" + agvPlae + "->" + EmptyShelfPlace + "]";
runInfo = "开始执行回收空料架任务[" + agvPlae + "->" + EmptyShelfPlace + "]";
msg += runInfo;
TakeEmptyStep.Msg = msg;
}
}
......@@ -99,14 +112,16 @@ namespace AGVControl
if (nodeIdx > -1)
{
TakeEmptyStep.ToNextStep(TAKE_EMPTY_STEP.WAIT_AGV_START_TASK);
msg += "AGV 添加任务:移动到" + EmptyShelfPlace;
runInfo= "AGV 添加任务:移动到" + EmptyShelfPlace;
msg += runInfo;
TakeEmptyStep.Msg = msg;
Common.MoveToNode(agv, EmptyShelfPlace);
}
else
{
TakeEmptyStep.ToNextStep(TAKE_EMPTY_STEP.ASSIGN_AGV_TASK);
msg += EmptyShelfPlace + " 不存在或未开启调用";
runInfo= EmptyShelfPlace + " 不存在或未开启调用";
msg += runInfo;
TakeEmptyStep.Msg = msg;
}
}
......@@ -115,7 +130,8 @@ namespace AGVControl
if (agv.CurTaskState.Equals(SettingString.Executing))
{
TakeEmptyStep.ToNextStep(TAKE_EMPTY_STEP.WAIT_REACH_PLACE);
msg += "AGV开始向目的地[" + EmptyShelfPlace + "]移动";
runInfo= "AGV开始向目的地[" + EmptyShelfPlace + "]移动";
msg += runInfo;
TakeEmptyStep.Msg = msg;
}
}
......@@ -125,14 +141,16 @@ namespace AGVControl
{
if (EmptyShelfPlace.Equals("G22"))
{
msg += "AGV到达 " + EmptyShelfPlace;
runInfo = "AGV到达 " + EmptyShelfPlace;
msg += runInfo;
TakeEmptyStep.Msg = msg;
return new EnterLeaveShelfJob(EmptyShelfPlace, eEnterLeaveType.Enter);
}
else
{
TakeEmptyStep.ToNextStep(TAKE_EMPTY_STEP.WAIT_LINE_RESPONSE);
msg += "AGV到达 " + EmptyShelfPlace + " 向产线发送出料架请求[ReadyLeave]";
runInfo= "AGV到达 " + EmptyShelfPlace + " 向产线发送出料架请求[ReadyLeave]";
msg += runInfo;
TakeEmptyStep.Msg = msg;
Common.server.ReadyLeave(EmptyShelfPlace);
}
......@@ -141,13 +159,20 @@ namespace AGVControl
}
else if (TakeEmptyStep.IsStep(TAKE_EMPTY_STEP.WAIT_LINE_RESPONSE))
{
if(nodeIdx==-1)
{
runInfo= EmptyShelfPlace + " 未开启调用";
msg += runInfo;
TakeEmptyStep.Msg = msg;
}
ClientNode node = Common.nodeInfo[nodeIdx];
if (node.StateEquals(eNodeStatus.MayLeave))
{
if(!agv.CurTaskName.Equals("Enter"))
if (!agv.CurTaskName.Equals("Enter"))
{
TakeEmptyStep.ToNextStep(TAKE_EMPTY_STEP.WAIT_TAKE_EMPTY_SHELF);
msg += "收到产线出料请求[ReadyLeave]的响应 " + EmptyShelfPlace + "出料架,小车链条运行";
runInfo = "收到产线出料请求[ReadyLeave]的响应 " + EmptyShelfPlace + "出料架,小车链条运行";
msg += runInfo;
TakeEmptyStep.Msg = msg;
agv.RFID = node.RFID;
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["Enter"]);
......@@ -158,13 +183,14 @@ namespace AGVControl
else if (TakeEmptyStep.IsTimeOut(15000, out double timeOutValue))
{
TakeEmptyStep.ToNextStep(TAKE_EMPTY_STEP.WAIT_REACH_PLACE);
msg += "AGV到达 " + EmptyShelfPlace + ",15秒后重新向产线发送出料架请求[ReadyLeave]";
runInfo = "AGV到达 " + EmptyShelfPlace + ",15秒后重新向产线发送出料架请求[ReadyLeave]";
msg += runInfo;
TakeEmptyStep.Msg = msg;
}
}
else if (TakeEmptyStep.IsStep(TAKE_EMPTY_STEP.WAIT_TAKE_EMPTY_SHELF))
{
if (agv.PlaceState.Equals(ePlaceState.EnterFinish))
if (Common.CheckEnterOrLeaveFinished(agv, "Enter", agv.CurTaskGUID))
{
ClientNode node = Common.nodeInfo[nodeIdx];
node.AgvName = "";
......@@ -173,11 +199,14 @@ namespace AGVControl
//TakeEmptyStep.ToNextStep(TAKE_EMPTY_STEP.END);
//if (shelfType.Equals(eShelfType.SmallShelf))
Common.DelEmptyShelfTask(EmptyShelfPlace);
msg += "空料架在[" + EmptyShelfPlace + "]进入小车完成";
runInfo= "空料架在[" + EmptyShelfPlace + "]进入小车完成";
msg += runInfo;
TakeEmptyStep.Msg = msg;
if(agv.RFID.StartsWith("D"))
return new EmptyShelfBackJob(EmptyShelfPlace, eShelfType.SmallShelf);
else if(agv.RFID.StartsWith("C"))
if (agv.Place.Equals("E22"))
return new EmptyShelfBackJob(EmptyShelfPlace, eShelfType.BigShelf);
else if (agv.RFID.StartsWith("D"))
return new EmptyShelfBackJob(EmptyShelfPlace, eShelfType.SmallShelf);
else if (agv.RFID.StartsWith("C"))
{
return new EmptyShelfBackJob(EmptyShelfPlace, eShelfType.BigShelf);
}
......@@ -187,7 +216,8 @@ namespace AGVControl
else if (TakeEmptyStep.IsTimeOut(60000, out double timeOutValue))
{
//链条停止
msg += "空料架在[" + EmptyShelfPlace + "]进入小车超时[" + timeOutValue.ToString("f1") + "秒],请检查料架进入小车的情况";
runInfo = "空料架在[" + EmptyShelfPlace + "]进入小车超时[" + timeOutValue.ToString("f1") + "秒],请检查料架进入小车的情况";
msg += runInfo;
TakeEmptyStep.Msg = msg;
}
......
......@@ -34,7 +34,15 @@ namespace AGVControl
/// 接到任务时,AGV的位置
/// </summary>
public string agvPlace { get; set; }
public override bool IsEnd { get { return GoFullShelfStationStep.IsStep(GO_FULL_SHELF_STATION_STEP.END); } }
private string runInfo = "";
/// <summary>
/// 运行信息
/// </summary>
public override string RunInfo
{
get { return runInfo; }
}
/// <summary>
/// AGV上是否有负载
/// </summary>
......@@ -46,53 +54,58 @@ namespace AGVControl
public override Job Execute(Agv_Info agv)
{
string msg = "";
string msg = agv.Name + " ";
bool rtn = false;
agv.Msg = GoFullShelfStationStep.Msg;
agv.Msg = runInfo;
if (GoFullShelfStationStep.IsStep(GO_FULL_SHELF_STATION_STEP.NONE))
{
GoFullShelfStationStep.ToNextStep(GO_FULL_SHELF_STATION_STEP.WAIT_CHECK_RESULT);
msg = agv.Name + " 检查AGV负载情况";
runInfo = "检查AGV负载情况";
msg += runInfo;
GoFullShelfStationStep.Msg = msg;
Common.CheckLoad(agv);
}
else if (GoFullShelfStationStep.IsStep(GO_FULL_SHELF_STATION_STEP.WAIT_CHECK_RESULT))
{
//Common.log.Debug("WAIT_CHECK_RESULT " + Common.agvMission["CheckShelf"].Equals(agv.CurTaskGUID).ToString() + " " + agv.CurTaskGUID + " " + Common.agvMission["CheckShelf"]);
//Common.log.Debug("WAIT_CHECK_RESULT " + Common.agvMission["CheckShelf"].Equals(agv.CurTaskGUID).ToString() + " " + agv.CurTaskGUID + " " + Common.agvMission["CheckShelf"]);
if (Common.agvMission["CheckShelf"].Equals(agv.CurTaskGUID) && agv.CurTaskState.Equals(SettingString.Done))
{
rtn = Common.mir.Get_IO_Status(agv, out bool[] input, out bool[] output);
if(rtn)
if (rtn)
{
Common.log.Debug("WAIT_CHECK_RESULT: "+agv.Name+" 获取IO状态成功:满载信号="+input[3].ToString());
if (input !=null && input[3])
Common.log.Debug("WAIT_CHECK_RESULT: " + agv.Name + " 获取IO状态成功:满载信号=" + input[3].ToString());
if (input != null && input[3])
{
GoFullShelfStationStep.ToNextStep(GO_FULL_SHELF_STATION_STEP.END);
msg = agv.Name + " 车上有料架,无法去入料口出料";
runInfo = "车上有料架,无法去入料口出料";
msg += runInfo;
GoFullShelfStationStep.Msg = msg;
agv.IsExistShelf = true;
IsLoadOnAGV = true;
}
else if (input !=null && !input[3])
else if (input != null && !input[3])
{
if (agvPlace.StartsWith(SettingString.Charge_Name_Prefix) || agvPlace.StartsWith(SettingString.Standby_Name_Prefix))//待机位/充电位接到任务
{
GoFullShelfStationStep.ToNextStep(GO_FULL_SHELF_STATION_STEP.WAIT_AGV_REACH_A6);
msg = agv.Name + " 无负载,准备运动到入料口"+ FullShelfStationPlace;
runInfo = "无负载,准备运动到入料口" + FullShelfStationPlace;
msg += runInfo;
GoFullShelfStationStep.Msg = msg;
Common.MoveToNode(agv, FullShelfStationPlace);
}
else if (agvPlace.StartsWith("G"))//4C车间
{
GoFullShelfStationStep.ToNextStep(GO_FULL_SHELF_STATION_STEP.WAIT_AGV_REACH_DOOR);
msg = agv.Name + " 在4C车间,向4D门运行,再到双层线入料口";
runInfo = "在4C车间,向4D门运行,再到双层线入料口";
msg += runInfo;
GoFullShelfStationStep.Msg = msg;
Common.DoorMission(agv, SettingString.DoorCToD);
}
else
{
GoFullShelfStationStep.ToNextStep(GO_FULL_SHELF_STATION_STEP.WAIT_AGV_REACH_A6);
msg = agv.Name + " 无负载,准备运动到入料口" + FullShelfStationPlace;
runInfo = "无负载,准备运动到入料口" + FullShelfStationPlace;
msg += runInfo;
GoFullShelfStationStep.Msg = msg;
Common.MoveToNode(agv, FullShelfStationPlace);
}
......@@ -106,14 +119,16 @@ namespace AGVControl
if (agvPlace.Equals(""))//待机位接到任务
{
GoFullShelfStationStep.ToNextStep(GO_FULL_SHELF_STATION_STEP.WAIT_AGV_REACH_A6);
msg = agv.Name + " 无负载,准备运动到入料口" + FullShelfStationPlace;
runInfo = "无负载,准备运动到入料口" + FullShelfStationPlace;
msg = runInfo;
GoFullShelfStationStep.Msg = msg;
Common.MoveToNode(agv, FullShelfStationPlace);
}
else if (agvPlace.StartsWith("G"))//4C车间
{
GoFullShelfStationStep.ToNextStep(GO_FULL_SHELF_STATION_STEP.WAIT_AGV_REACH_DOOR);
msg = agv.Name + " 在4C车间,向4D门运行,再到双层线入料口";
runInfo = "在4C车间,向4D门运行,再到双层线入料口";
msg += runInfo;
GoFullShelfStationStep.Msg = msg;
Common.DoorMission(agv, SettingString.DoorCToD);
}
......@@ -128,7 +143,8 @@ namespace AGVControl
if (Common.CheckTaskFinished(agv, SettingString.DoorCToD, agv.CurTaskGUID))
{
GoFullShelfStationStep.ToNextStep(GO_FULL_SHELF_STATION_STEP.WAIT_AGV_REACH_A6);
msg = agv.Name + " 到达4D门,准备运动到双层线入料口" + FullShelfStationPlace;
runInfo = "到达4D门,准备运动到双层线入料口" + FullShelfStationPlace;
msg += runInfo;
GoFullShelfStationStep.Msg = msg;
Common.MoveToNode(agv, FullShelfStationPlace);
}
......@@ -143,26 +159,33 @@ namespace AGVControl
if (node != null && node.Name.Equals(SettingString.A6))
{
if (AGVManager.FindFullShelfTarget(node.RFID, out FullShelfDestInfo))
{
{
GoFullShelfStationStep.ToNextStep(GO_FULL_SHELF_STATION_STEP.WAIT_DOUBLE_LINE_RESPONSE);
if (!FullShelfDestInfo.Equals(null))
agv.BoxDestInfo = FullShelfDestInfo.ShowInfo();
msg = "AGV到达 " + FullShelfStationPlace + ",并发送出料架请求[ReadyLeave]";
if (FullShelfDestInfo!=null)
{
Common.GetLineNameByNodeName(FullShelfDestInfo.location,out string line);
agv.BoxDestInfo = FullShelfDestInfo.ShowInfo(line);
}
runInfo = "AGV到达 " + FullShelfStationPlace + ",并发送出料架请求[ReadyLeave]";
msg += runInfo;
GoFullShelfStationStep.Msg = msg;
Common.server.ReadyLeave(FullShelfStationPlace);
}
else
{
if (!FullShelfDestInfo.Equals(null))
if (FullShelfDestInfo !=null)
{
msg = "AGV到达 " + FullShelfStationPlace + ",查询满料架目的地:" + FullShelfDestInfo.ShowInfo();
Common.GetLineNameByNodeName(FullShelfDestInfo.location, out string line);
runInfo = "AGV到达 " + FullShelfStationPlace + ",查询满料架目的地:" + FullShelfDestInfo.ShowInfo(line);
msg += runInfo; ;
GoFullShelfStationStep.Msg = msg;
}
else
{
//[{"msg":"0料车已解绑或未发新料"}]
GoFullShelfStationStep.ToNextStep(GO_FULL_SHELF_STATION_STEP.WAIT_REACH_STANDBY);
msg = "从产线" + agvPlace + "回到待机位";
runInfo = "从产线" + agvPlace + "回到待机位";
msg += runInfo;
GoFullShelfStationStep.Msg = msg;
Common.MoveToNode(agv, SettingString.Standby);
}
......@@ -182,7 +205,8 @@ namespace AGVControl
if (Common.CheckTaskFinished(agv, SettingString.Standby, agv.CurTaskGUID))
{
GoFullShelfStationStep.ToNextStep(GO_FULL_SHELF_STATION_STEP.END);
msg = "到达待机位";
runInfo = "到达待机位";
msg += runInfo;
GoFullShelfStationStep.Msg = msg;
}
}
......@@ -191,17 +215,19 @@ namespace AGVControl
int id = Common.FindNode(FullShelfStationPlace);
if (id == -1)
{
msg = "未找到节点:" + FullShelfStationPlace;
runInfo = "未找到节点:" + FullShelfStationPlace;
msg += runInfo;
GoFullShelfStationStep.Msg = msg;
return this;
}
ClientNode node = Common.nodeInfo[id];
if (node.StateEquals(eNodeStatus.MayLeave))
{
if(!agv.CurTaskName.Equals("Enter"))
if (!agv.CurTaskName.Equals("Enter"))
{
GoFullShelfStationStep.ToNextStep(GO_FULL_SHELF_STATION_STEP.WAIT__FULL_SHELF_IN_AGV);
msg = "收到双层线出料架请求[ReadyLeave]的响应 " + FullShelfStationPlace + "出料架,小车链条运行";
runInfo = "收到双层线出料架请求[ReadyLeave]的响应 " + FullShelfStationPlace + "出料架,小车链条运行";
msg += runInfo;
GoFullShelfStationStep.Msg = msg;
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["Enter"]);
agv.TaskSend = rtn ? "Enter" : "";
......@@ -211,7 +237,8 @@ namespace AGVControl
else if (GoFullShelfStationStep.IsTimeOut(15000, out double timeOutValue))
{
GoFullShelfStationStep.ToNextStep(GO_FULL_SHELF_STATION_STEP.WAIT_AGV_REACH_A6);
msg = "AGV到达 " + FullShelfStationPlace + ",15秒后重新向双层线发送出料架请求[ReadyLeave]";
runInfo = "AGV到达 " + FullShelfStationPlace + ",15秒后重新向双层线发送出料架请求[ReadyLeave]";
msg += runInfo;
GoFullShelfStationStep.Msg = msg;
}
......@@ -219,11 +246,12 @@ namespace AGVControl
}
else if (GoFullShelfStationStep.IsStep(GO_FULL_SHELF_STATION_STEP.WAIT__FULL_SHELF_IN_AGV))
{
if (agv.Place.Equals(FullShelfStationPlace) && agv.PlaceState.Equals(ePlaceState.EnterFinish))
if (Common.CheckEnterOrLeaveFinished(agv, "Enter", agv.CurTaskGUID))
{
//GoFullShelfStationStep.ToNextStep(GO_FULL_SHELF_STATION_STEP.END);
msg = FullShelfStationPlace + "满料架进入小车完成";
runInfo = FullShelfStationPlace + "满料架进入小车完成";
msg += runInfo;
GoFullShelfStationStep.Msg = msg;
//if (FullShelfDestInfo.location.StartsWith("G"))
//{
......@@ -235,7 +263,8 @@ namespace AGVControl
else if (GoFullShelfStationStep.IsTimeOut(60000, out double timeOutValue))
{
//链条停止
msg = "满料架在[" + FullShelfStationPlace + "]进入小车超时[" + timeOutValue.ToString("f1") + "秒],请检查料架进入小车的情况";
runInfo= "满料架在[" + FullShelfStationPlace + "]进入小车超时[" + timeOutValue.ToString("f1") + "秒],请检查料架进入小车的情况";
msg +=runInfo;
GoFullShelfStationStep.Msg = msg;
}
......
......@@ -43,30 +43,40 @@ namespace AGVControl
public bool IsIgnoreBigShelf { get; private set; }
public override bool IsEnd { get { return SendFullShelfStep.IsStep(SEND_FULL_SHELF_STEP.END); } }
private string runInfo = "";
/// <summary>
/// 运行信息
/// </summary>
public override string RunInfo
{
get { return runInfo; }
}
private JobStep<SEND_FULL_SHELF_STEP> SendFullShelfStep = new JobStep<SEND_FULL_SHELF_STEP>(SEND_FULL_SHELF_STEP.NONE);
public override Job Execute(Agv_Info agv)
{
string msg = "";
string msg = agv.Name+" ";
bool rtn = false;
agv.RFID = RFID;
agv.Msg = SendFullShelfStep.Msg;
agv.Msg = runInfo;
if (SendFullShelfStep.IsStep(SEND_FULL_SHELF_STEP.NONE))
{
if(FullShelfPlace.StartsWith("G"))
{
SendFullShelfStep.ToNextStep(SEND_FULL_SHELF_STEP.WAIT_AGV_REACH_DOOR);
msg = "满料架前往4C门,从双层线A6送往[" + FullShelfPlace + "][" + RFID + "]"+ BoxDestInfo.ShowInfo();
runInfo = "满料架前往4C门,从双层线A6送往[" + FullShelfPlace + "][" + RFID + "]";
msg += runInfo;
SendFullShelfStep.Msg = msg;
Common.DoorMission(agv, SettingString.DoorDToC);
}
else
{
SendFullShelfStep.ToNextStep(SEND_FULL_SHELF_STEP.WAIT_AGV_REACH_LINE);
msg = "满料架从双层线A6送往[" + FullShelfPlace + "][" + RFID + "]" + BoxDestInfo.ShowInfo();
runInfo= "满料架从双层线A6送往[" + FullShelfPlace + "][" + RFID + "]";
msg += runInfo;
SendFullShelfStep.Msg = msg;
Common.MoveToNode(agv, FullShelfPlace);
}
......@@ -78,7 +88,8 @@ namespace AGVControl
if (Common.CheckTaskFinished(agv,SettingString.DoorDToC,agv.CurTaskGUID))
{
SendFullShelfStep.ToNextStep(SEND_FULL_SHELF_STEP.WAIT_AGV_REACH_LINE);
msg = "满料架从双层线A6送往[" + FullShelfPlace + "][" + RFID + "]" + BoxDestInfo.ShowInfo();
runInfo= "满料架从双层线A6送往[" + FullShelfPlace + "][" + RFID + "]";
msg += runInfo;
SendFullShelfStep.Msg = msg;
Common.MoveToNode(agv, FullShelfPlace);
}
......@@ -89,14 +100,16 @@ namespace AGVControl
{
if(FullShelfPlace.Equals("G21"))
{
msg = "AGV到达 " + FullShelfPlace + "完成" + BoxDestInfo.ShowInfo();
runInfo= "AGV到达 " + FullShelfPlace + "完成";
msg += runInfo;
SendFullShelfStep.Msg = msg;
return new EnterLeaveShelfJob(FullShelfPlace, eEnterLeaveType.Leave);
}
if (IsIgnoreBigShelf)
{
SendFullShelfStep.ToNextStep(SEND_FULL_SHELF_STEP.WAIT_LINE_RESPONSE);
msg = "AGV到达 " + FullShelfPlace + ",并发送入料架请求[ReadyEnter]" + BoxDestInfo.ShowInfo();
runInfo = "AGV到达 " + FullShelfPlace + ",并发送入料架请求[ReadyEnter]";
msg += runInfo;
SendFullShelfStep.Msg = msg;
Common.server.ReadyEnter(FullShelfPlace);
}
......@@ -105,13 +118,15 @@ namespace AGVControl
if (RFID.StartsWith("C") && !agv.Place.Equals("E21"))
{
SendFullShelfStep.ToNextStep(SEND_FULL_SHELF_STEP.WAIT_BIG_SHELF_UNLOCK);
msg = "AGV到达 " + FullShelfPlace + ",并等待大料架[" + RFID + "]解绑" + BoxDestInfo.ShowInfo();
runInfo= "AGV到达 " + FullShelfPlace + ",并等待大料架[" + RFID + "]解绑";
msg += runInfo;
SendFullShelfStep.Msg = msg;
}
else
{
SendFullShelfStep.ToNextStep(SEND_FULL_SHELF_STEP.WAIT_LINE_RESPONSE);
msg = "AGV到达 " + FullShelfPlace + ",并发送入料架请求[ReadyEnter]" + BoxDestInfo.ShowInfo();
runInfo= "AGV到达 " + FullShelfPlace + ",并发送入料架请求[ReadyEnter]";
msg += runInfo;
SendFullShelfStep.Msg = msg;
Common.server.ReadyEnter(FullShelfPlace);
}
......@@ -122,9 +137,11 @@ namespace AGVControl
else if (SendFullShelfStep.IsStep(SEND_FULL_SHELF_STEP.WAIT_BIG_SHELF_UNLOCK))
{
Common.mir.Get_IO_Status(agv, out bool[] input, out bool[] output);
if (AGVManager.GetRackBy(RFID, out string lineName) || input[0])
System.Threading.Thread.Sleep(50);
if (AGVManager.GetRackBy(RFID, out string lineName) || (input!=null && input[0]))
{
msg = "大料架在" + FullShelfPlace + "解绑完成 [" + RFID + "]" + BoxDestInfo.ShowInfo();
runInfo= "大料架在" + FullShelfPlace + "解绑完成 [" + RFID + "]";
msg += runInfo;
SendFullShelfStep.Msg = msg;
return new EmptyShelfBackJob(FullShelfPlace,eShelfType.BigShelf);
}
......@@ -138,7 +155,8 @@ namespace AGVControl
if(!agv.CurTaskName.Equals("Leave"))
{
SendFullShelfStep.ToNextStep(SEND_FULL_SHELF_STEP.WAIT__SHELF_IN_LINE);
msg = "收到产线入料架请求[ReadyEnter]的响应 " + FullShelfPlace + "入料架,小车链条运行" + BoxDestInfo.ShowInfo();
runInfo= "收到产线入料架请求[ReadyEnter]的响应 " + FullShelfPlace + "入料架,小车链条运行";
msg += runInfo;
SendFullShelfStep.Msg = msg;
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["Leave"]);
agv.TaskSend = rtn ? "Leave" : "";
......@@ -148,15 +166,17 @@ namespace AGVControl
else if (SendFullShelfStep.IsTimeOut(15000, out double timeOutValue))
{
SendFullShelfStep.ToNextStep(SEND_FULL_SHELF_STEP.WAIT_AGV_REACH_LINE);
msg = "AGV到达 " + FullShelfPlace + ",15秒后重新向产线发送入料架请求[ReadyEnter]" + BoxDestInfo.ShowInfo();
runInfo= "AGV到达 " + FullShelfPlace + ",15秒后重新向产线发送入料架请求[ReadyEnter]";
msg += runInfo;
SendFullShelfStep.Msg = msg;
}
}
else if (SendFullShelfStep.IsStep(SEND_FULL_SHELF_STEP.WAIT__SHELF_IN_LINE))
{
if (agv.Place.Equals(FullShelfPlace) && agv.PlaceState.Equals(ePlaceState.LeaveFinish))
if (Common.CheckEnterOrLeaveFinished(agv, "Leave", agv.CurTaskGUID))
{
msg = "满料架进入" + FullShelfPlace + "完成 [" + RFID + "]" + BoxDestInfo.ShowInfo();
runInfo= "满料架进入" + FullShelfPlace + "完成 [" + RFID + "]";
msg += runInfo;
SendFullShelfStep.Msg = msg;
agv.RFID = "";
AGVManager.UpdateStatus(RFID, FullShelfPlace);
......@@ -165,7 +185,8 @@ namespace AGVControl
else if (SendFullShelfStep.IsTimeOut(60000, out double timeOutValue))
{
//链条停止
msg = "满料架在[" + FullShelfPlace + "]离开小车超时[" + timeOutValue.ToString("f1") + "秒],请检查料架离开小车的情况";
runInfo= "满料架在[" + FullShelfPlace + "]离开小车超时[" + timeOutValue.ToString("f1") + "秒],请检查料架离开小车的情况";
msg += runInfo;
SendFullShelfStep.Msg = msg;
}
......
......@@ -39,7 +39,7 @@ namespace AGVControl
emptyJobCnt++;
}
}
if ((SettingString.AGVCNT - emptyJobCnt).Equals(1))//保留一辆小车出满料架
if ((SettingString.AGVCNT - emptyJobCnt).Equals(2))//保留2辆小车出满料架
{
return null;
}
......@@ -74,31 +74,40 @@ namespace AGVControl
int i = Common.agvInfo.FindIndex(s => s.CurJob is GoFullShelfStationJob && !s.IP.Equals(currentAgv.IP));
if (i > -1)
return null;
}
//foreach (Agv_Info agv in Common.agvInfo)
//{
// if (agv.CurJob is GoFullShelfStationJob)
// {
// return null;
// }
//}
return new GoFullShelfStationJob(currentAgv.Place);
//foreach (Agv_Info agv in Common.agvInfo)
//{
// if (agv.CurJob is GoFullShelfStationJob)
// {
// return null;
// }
//}
return new GoFullShelfStationJob(currentAgv.Place);
}
}
//回收空料架
if (Common.FindEmptyShelfNode(currentAgv, out string emptyNodeName))
{
foreach (Agv_Info agv in Common.agvInfo)
if (SettingString.C4_AGV_IPs.Contains(currentAgv.IP))
{
if (!SettingString.C4_AGV_IPs.Contains(agv.IP))
continue;
if (agv.CurJob is GoEmptyShelfLineJob && ((GoEmptyShelfLineJob)agv.CurJob).EmptyShelfPlace.Equals(emptyNodeName))
{
int i = Common.agvInfo.FindIndex(s => s.CurJob is GoEmptyShelfLineJob && ((GoEmptyShelfLineJob)s.CurJob).EmptyShelfPlace.Equals(emptyNodeName));
if (i > -1)
return null;
}
//foreach (Agv_Info agv in Common.agvInfo)
//{
// if (!SettingString.C4_AGV_IPs.Contains(agv.IP))
// continue;
// if (agv.CurJob is GoEmptyShelfLineJob && ((GoEmptyShelfLineJob)agv.CurJob).EmptyShelfPlace.Equals(emptyNodeName))
// {
// return null;
// }
//}
return new GoEmptyShelfLineJob(currentAgv.Place, emptyNodeName);
}
return new GoEmptyShelfLineJob(currentAgv.Place, emptyNodeName);
}
return null;
}
......
......@@ -41,14 +41,14 @@ namespace AGVControl
emptyJobCnt++;
}
}
if ((SettingString.AGVCNT / 2 - emptyJobCnt).Equals(1))//保留一辆小车出满料架
if ((SettingString.AGVCNT / 2 - emptyJobCnt).Equals(2))//保留两辆小车出满料架
{
return null;
}
//出工单料的目的地是否有空料架
if (Common.FindEmptyShelfBeforeSendFullShelf(out string nodeName))
{
if (nodeName.StartsWith("E") && !SettingString.C4_AGV_IPs.Contains(currentAgv.IP))
if (nodeName.StartsWith("E") && !SettingString.C4_AGV_IPs.Contains(currentAgv.IP))
{
ClientNode clientNode = Common.nodeInfo.Find(s => s.Name.Equals(nodeName));
int cnt = 0;
......@@ -74,27 +74,35 @@ namespace AGVControl
{
if (!SettingString.C4_AGV_IPs.Contains(currentAgv.IP))
{
int i = Common.agvInfo.FindIndex(s=>s.CurJob is GoFullShelfStationJob && !s.IP.Equals(currentAgv.IP));
if(i>-1)
int i = Common.agvInfo.FindIndex(s => s.CurJob is GoFullShelfStationJob && !s.IP.Equals(currentAgv.IP));
if (i > -1)
return null;
}
return new GoFullShelfStationJob(currentAgv.Place);
return new GoFullShelfStationJob(currentAgv.Place);
}
}
//回收空料架
if (Common.FindEmptyShelfNode(currentAgv, out string emptyNodeName))
{
foreach (Agv_Info agv in Common.agvInfo)
if (!SettingString.C4_AGV_IPs.Contains(currentAgv.IP))
{
if (SettingString.C4_AGV_IPs.Contains(agv.IP))
continue;
if (agv.CurJob is GoEmptyShelfLineJob && ((GoEmptyShelfLineJob)agv.CurJob).EmptyShelfPlace.Equals(emptyNodeName))
{
int i = Common.agvInfo.FindIndex(s => s.CurJob is GoEmptyShelfLineJob && ((GoEmptyShelfLineJob)s.CurJob).EmptyShelfPlace.Equals(emptyNodeName));
if (i > -1)
return null;
}
//foreach (Agv_Info agv in Common.agvInfo)
//{
// if (SettingString.C4_AGV_IPs.Contains(agv.IP))
// continue;
// if (agv.CurJob is GoEmptyShelfLineJob && ((GoEmptyShelfLineJob)agv.CurJob).EmptyShelfPlace.Equals(emptyNodeName))
// {
// return null;
// }
//}
return new GoEmptyShelfLineJob(currentAgv.Place, emptyNodeName);
}
return new GoEmptyShelfLineJob(currentAgv.Place, emptyNodeName);
}
return null;
}
......
......@@ -54,4 +54,3 @@ D:\OneDrive - 上海挚锦科技有限公司\SMD\AGVControl-Qisda-ProductionLine
D:\OneDrive - 上海挚锦科技有限公司\SMD\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\bin\Debug\Newtonsoft.Json.dll
D:\OneDrive - 上海挚锦科技有限公司\SMD\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\bin\Debug\AsaPL.AgvClient.pdb
D:\OneDrive - 上海挚锦科技有限公司\SMD\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl-ProductionLine.csprojAssemblyReference.cache
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl-ProductionLine.csprojAssemblyReference.cache
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!