Commit 75c17094 张东亮

1

1 个父辈 686076d6
正在显示 29 个修改的文件 包含 402 行增加248 行删除
......@@ -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);
}
}
......
......@@ -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()));
......
......@@ -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>
......
......@@ -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;
}
......
......@@ -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!