Commit fd896a82 张东亮

运行版

1 个父辈 aed2a716
......@@ -117,7 +117,7 @@
// lblTask
//
this.lblTask.Dock = System.Windows.Forms.DockStyle.Left;
this.lblTask.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblTask.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblTask.Image = global::AGV_UI.Properties.Resources.task;
this.lblTask.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.lblTask.Location = new System.Drawing.Point(0, 0);
......
[]
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<agvs>
<agv id="12" ip="10.85.199.81">
<agv id="49" ip="10.85.199.81">
<name>10号车</name>
<!--负责区域:D,C,Air_C-->
<ResponsAreas>
<Area>D</Area>
</ResponsAreas>
<!--是否调用-->
<IsUse>false</IsUse>
<IsUse>False</IsUse>
<UseFleet>true</UseFleet>
<Authorization>Basic ZGlzdHJpYnV0b3I6NjJmMmYwZjFlZmYxMGQzMTUyYzk1ZjZmMDU5NjU3NmU0ODJiYjhlNDQ4MDY0MzNmNGNmOTI5NzkyODM0YjAxNA==</Authorization>
<IO_GUID>007615a5-2220-11ea-99f2-94c691a73b53</IO_GUID>
<IO_GUIDs>
<IO_GUID index="0">6ad07e3a-e0e9-11eb-a184-0001299981d4</IO_GUID>
<IO_GUID index="1">3b5c0497-e2f2-11eb-95df-000129922ca6</IO_GUID>
<IO_GUID index="2">4e49e4c8-e2f2-11eb-95df-000129922ca6</IO_GUID>
</IO_GUIDs>
</agv>
</agvs>
\ No newline at end of file
......@@ -382,11 +382,11 @@
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>storage</name>
<name>治具智能仓储</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>立库</alicename>
<alicename>治具智能仓储</alicename>
<!--节点类型:Standby,AutoCharge,Node-->
<type>Node</type>
<!--所属区域:D,C,Air_C-->
......
......@@ -3,224 +3,231 @@
<task id ="0">
<name>Init</name>
<alicename>初始化</alicename>
<guid>219cd91a-61da-11eb-96a9-0001297a1dca</guid>
<guid>2bcd29b8-e2f2-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>None</type>
</task>
<task id ="1">
<name>Standby</name>
<alicename>待机位</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<guid>501522b3-e2f2-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>None</type>
</task>
<task id ="2">
<name>AutoCharge</name>
<alicename>充电位</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<guid>40c17cb4-e2f2-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>None</type>
</task>
<task id ="3">
<name>Enter</name>
<alicename>进料</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<guid>31a3a69e-e310-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>InOut</type>
</task>
<task id ="4">
<name>Leave</name>
<alicename>出料</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<guid>ba68ea32-e310-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>InOut</type>
</task>
<task id ="5">
<name>CheckShelf</name>
<alicename>负载检查</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<guid>7f6edf46-e316-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>None</type>
</task>
<task id ="6">
<name>D1</name>
<alicename>移动到D1线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<guid>03925a62-e2fa-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="7">
<name>D2</name>
<alicename>移动到D2线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<guid>17419a7e-e2fa-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="8">
<name>D3</name>
<alicename>移动到D3线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<guid>39052eb5-e2fa-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="9">
<name>D4</name>
<alicename>移动到D4线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<guid>4cbec837-e2fa-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="10">
<name>D5</name>
<alicename>移动到D5线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<guid>63241a92-e2fa-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="11">
<name>D6</name>
<alicename>移动到D6线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<guid>d264a9c2-e2fb-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="12">
<name>D7</name>
<alicename>移动到D7线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<guid>e2d00611-e2fb-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="13">
<name>D8</name>
<alicename>移动到D8线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<guid>f636e5a8-e2fb-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="14">
<name>D9</name>
<alicename>移动到D9线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<guid>164a436d-e2fc-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="15">
<name>D10</name>
<alicename>移动到D10线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<guid>663d8278-e2fc-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="16">
<name>D11</name>
<alicename>移动到D11线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<guid>7e0996dd-e2fc-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="17">
<name>D12</name>
<alicename>移动到D12线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<guid>93bc0500-e2fc-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="18">
<name>D13</name>
<alicename>移动到D13线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<guid>b2e5d20e-e2fc-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="19">
<name>D14</name>
<alicename>移动到D14线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<guid>dd1da0b8-e2fc-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="20">
<name>D15</name>
<alicename>移动到D15线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<guid>f1109e49-e2fc-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="21">
<name>D1</name>
<name>D16</name>
<alicename>移动到D16线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<guid>6e984dd1-e30a-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="22">
<name>T01</name>
<alicename>移动到T1线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<guid>532c7cda-e2f4-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="23">
<name>T02</name>
<alicename>移动到T2线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<guid>27dc2449-e2f9-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="24">
<name>T03</name>
<alicename>移动到T3线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<guid>576a579b-e2f9-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="25">
<name>T04</name>
<alicename>移动到T4线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<guid>7c474d94-e2f9-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="26">
<name>T05</name>
<alicename>移动到T5线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<guid>9779e5bb-e2f9-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="27">
<name>T06</name>
<alicename>移动到T6线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<guid>a6a092a2-e2f9-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="28">
<name>T07</name>
<alicename>移动到T7线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<guid>ba68467a-e2f9-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="29">
<name>T08</name>
<alicename>移动到T8线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<guid>d4e59d24-e2f9-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="30">
<name>T09</name>
<alicename>移动到T9线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<guid>ed9b0352-e2f9-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="31">
<name>Adjust</name>
<alicename>调宽</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<guid>45f417f6-e316-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>None</type>
</task>
<task id ="32">
<name>治具智能仓储</name>
<alicename>治具智能仓储</alicename>
<guid>111486eb-e3b4-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>None</type>
</task>
......
......@@ -30,7 +30,7 @@ namespace DeviceLibrary
{
AgvCallTimer = new System.Timers.Timer
{
Interval = 300,
Interval = 500,
AutoReset = true,
Enabled = false
};
......@@ -96,6 +96,7 @@ namespace DeviceLibrary
bool change = false;
MiR_API.Get_Task_State(AGVManager.agvInfo[i]);
Thread.Sleep(50);
MiR_API.Get_IO_Status(AGVManager.agvInfo[i]);
//获取AGV状态
rtn = MiR_API.Get_State(AGVManager.agvInfo[i], out eAGVState stateID, out string stateText, out int battery, out string mission_text, out Agv_Info.MirPosition position);
Thread.Sleep(50);
......
......@@ -28,7 +28,7 @@ namespace DeviceLibrary
/// <summary>
/// IO模块GUID
/// </summary>
public string IOID { set; get; }
/// <summary>
/// 授权码
/// </summary>
......@@ -133,8 +133,7 @@ namespace DeviceLibrary
/// </summary>
public string ErrorMsg { get; set; } = "";
public string ErrorLastTime { get; set; } = "";
public bool[] Input;
public bool[] Output;
public List<IOInfo> IOStatus;
/// <summary>
/// Agv是否空闲
/// </summary>
......@@ -201,13 +200,12 @@ namespace DeviceLibrary
/// </summary>
public bool StandTimeOut { get; set; } = false;
public AGV_UI.Status StateKanban;
public Agv_Info(string id, string name, string ip, string authorization, string ioID, bool isUse)
public Agv_Info(string id, string name, string ip, string authorization, bool isUse)
{
ID = id;
Name = name;
IP = ip;
Authorization = authorization;
IOID = ioID;
IsCon = false;
_IsUse = isUse;
Place = new Node();
......@@ -223,6 +221,7 @@ namespace DeviceLibrary
Position = new MirPosition();
RunInfos = new List<string>() { "状态", "目的地", "RFID", "负载", "运行模式", "任务信息", "AGV运行信息" };
StateKanban = new AGV_UI.Status(RunInfos);
IOStatus = new List<IOInfo>();
TaskRunState = new TaskRunState();
}
public List<string> RunInfos;
......@@ -234,10 +233,7 @@ namespace DeviceLibrary
{
bool isChange = false;
bool preShelfState = IsExistShelf;
MiR_API.Get_IO_Status(this, out Input, out Output);
if (Input != null && Input.Length == 4)
{
bool reachIoValue = Input[3].Equals(true);
bool reachIoValue = GetInput(0, 3).Equals(true);
if (reachIoValue)
{
//满足给定的IO值,计算持续时间
......@@ -264,7 +260,7 @@ namespace DeviceLibrary
IoStartTime = DateTime.MinValue;
IsExistShelf = false;
}
}
if (!StateID.Equals(stateID) || !Battery.Equals(battery)
|| !MissionText.Equals(missionText) || !IsExistShelf.Equals(preShelfState))
isChange = true;
......@@ -290,7 +286,7 @@ namespace DeviceLibrary
if (!MissionText.Equals(missionText))
{
MissionText = missionText;
StateKanban.ShowInfo("AGV行信息", missionText);
StateKanban.ShowInfo("AGV行信息", missionText);
}
CheckErrorState();
CheckOfflineTimeOut();
......@@ -366,6 +362,40 @@ namespace DeviceLibrary
offlineStartTime = DateTime.Now;
}
}
/// <summary>
/// 获取IO输入状态
/// </summary>
/// <param name="ioidx">IO序号</param>
/// <param name="port">IO端口</param>
/// <returns></returns>
public bool GetInput(int ioidx, int port)
{
if (ioidx >= IOStatus.Count)
return false;
if (IOStatus[ioidx] == null || IOStatus[ioidx].Inputs == null)
return false;
if (port >= IOStatus[ioidx].Inputs.Length)
return false;
return IOStatus[ioidx].Inputs[port];
}
/// <summary>
/// 获取IO输出状态
/// </summary>
/// <param name="ioidx">IO序号</param>
/// <param name="port">IO端口</param>
/// <returns></returns>
public bool GetOutput(int ioidx, int port)
{
if (ioidx >= IOStatus.Count)
return false;
if (IOStatus[ioidx] == null || IOStatus[ioidx].Outputs == null)
return false;
if (port >= IOStatus[ioidx].Outputs.Length)
return false;
return IOStatus[ioidx].Outputs[port];
}
/// <summary>
/// 检查小车是否在原地停留超时
/// </summary>
......@@ -465,4 +495,11 @@ namespace DeviceLibrary
}
}
}
public class IOInfo
{
public string IOID { set; get; }
public bool[] Inputs;
public bool[] Outputs;
}
}
......@@ -60,42 +60,41 @@ namespace DeviceLibrary
/// <param name="input"></param>
/// <param name="output"></param>
/// <returns></returns>
public static bool Get_IO_Status(Agv_Info info, out bool[] input, out bool[] output)
public static void Get_IO_Status(Agv_Info info)
{
foreach (IOInfo io in info.IOStatus)
{
try
{
input = null;
output = null;
string url = "http://" + info.IP + "/api/v2.0.0/io_modules/" + info.IOID + "/status";
io.Inputs = null;
io.Outputs = null;
string url = "http://" + info.IP + "/api/v2.0.0/io_modules/" + io.IOID + "/status";
string json = HttpGet(url, info.IP, info.Authorization);
if (string.IsNullOrWhiteSpace(json)) return false;
if (string.IsNullOrWhiteSpace(json)) continue;
JavaScriptSerializer serializer = new JavaScriptSerializer();
Dictionary<string, object> dic = (Dictionary<string, object>)serializer.DeserializeObject(json);
if (dic == null)
{
log.Error("URL: " + url + "\n" + "Return: " + json);
return false;
}
object[] objInput = (object[])dic["input_state"];
input = new bool[objInput.Length];
for (int i = 0; i < input.Length; i++)
input[i] = Convert.ToBoolean(objInput[i]);
io.Inputs = new bool[objInput.Length];
for (int i = 0; i < io.Inputs.Length; i++)
io.Inputs[i] = Convert.ToBoolean(objInput[i]);
object[] objOutput = (object[])dic["output_state"];
output = new bool[objOutput.Length];
for (int i = 0; i < output.Length; i++)
output[i] = Convert.ToBoolean(objOutput[i]);
return true;
io.Outputs = new bool[objOutput.Length];
for (int i = 0; i < io.Outputs.Length; i++)
io.Outputs[i] = Convert.ToBoolean(objOutput[i]);
}
catch (Exception ex)
{
input = null;
output = null;
io.Inputs = null;
io.Outputs = null;
//log.Error("Get_IO_Status", ex);
return false;
}
}
}
......@@ -247,10 +246,9 @@ namespace DeviceLibrary
Dictionary<string, object> dic = (Dictionary<string, object>)serializer.DeserializeObject(json);
if (dic == null)
{
log.Error($"{info.Name} Add_Mission_Fleet Fail URL: " + url + "\n" + "Return: " + json);
return false;
}
log.Debug("URL: " + url + "\n" + "Return: " + json);
string s = dic["mission_id"].ToString();
string id = dic["id"].ToString();
if (s == info.TaskRunState.Task.Guid && !string.IsNullOrEmpty(id))
......@@ -424,7 +422,7 @@ namespace DeviceLibrary
{
string url = "http://" + agv.IP + "/api/v2.0.0/mission_queue/" + agv.TaskRunState.TaskID;
string json = HttpGet(url, agv.IP, agv.Authorization);
log.Debug("URL: " + url + "\n" + "Return: " + json);
//log.Debug("URL: " + url + "\n" + "Return: " + json);
if (string.IsNullOrWhiteSpace(json)) return false;
JavaScriptSerializer serializer = new JavaScriptSerializer();
......@@ -477,7 +475,7 @@ namespace DeviceLibrary
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"}
log.Debug("Get_State URL:" + url + " Return" + json);
//log.Debug("Get_State URL:" + url + " Return" + json);
try
{
stateID = (eAGVState)(Convert.ToInt32(dic["state_id"].ToString()));
......@@ -616,7 +614,7 @@ namespace DeviceLibrary
ping.Dispose();
if (result.Status != System.Net.NetworkInformation.IPStatus.Success)
{
log.Debug("Ping " + ip + " 请求没有响应");
// log.Debug("Ping " + ip + " 请求没有响应");
return false;
}
return true;
......@@ -652,7 +650,7 @@ namespace DeviceLibrary
{
var client = new RestClient(url) { Timeout = httpTimeout };
var request = new RestRequest(Method.POST);
request.Timeout =10000;
request.AddHeader("Host", ip);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Accept-Language", "zh_CN");
......@@ -663,7 +661,7 @@ namespace DeviceLibrary
string s = response.Content;
s = s.Replace("\n", "");
s = s.Replace(" ", "");
log.Debug(string.Format("HttpPost URL: {0}; Body: {1} Return: {2}", url, body, s));
log.Debug(string.Format("HttpPost URL: {0}; Body: {1} Return: {2} [StatusCode={3},ResponseStatus={4},]", url, body, s, response.StatusCode, response.ResponseStatus));
return s;
}
......
......@@ -68,6 +68,8 @@ namespace DeviceLibrary
PropertyInfo[] info2 = task.GetType().GetProperties();
for (int i = 0; i < info1.Length; i++)
{
if (info1[i].Name.Equals("Id"))
continue;
info2[i].SetValue(task, info1[i].GetValue(this));
}
return task;
......
......@@ -89,6 +89,10 @@ namespace DeviceLibrary
{
return $" [{Task.AliceName}] [{TaskID}] ";
}
public string ToTaskShowInfo()
{
return $" [{Task.AliceName}]\r\n[{TaskID}] ";
}
public string ToTaskState()
{
return $"[{Task.AliceName}] [{TaskID}] [{TaskState}]";
......
......@@ -147,7 +147,7 @@ namespace DeviceLibrary
JobRunStep.ToNextStep(RunStep.ADJUST_WIDTH);
runInfo = JobParam.TargetNode + " 有出库任务,开始调宽";
JobRunStep.Msg = runInfo;
AdjustWidth(agv, JobParam.FixMissionInfo.Type);
AdjustWidth(agv, WarehouseSigManager.OutStore.Type);
}
else if (OpManager.Info.GetTransfer(out string target))
{
......@@ -205,8 +205,9 @@ namespace DeviceLibrary
if(!target.Equals(SettingString.Cancel))
{
agv.HasError = false;
runInfo = $"收到离开信号,开始运送出库治具";
runInfo = $"收到离开信号,开始运送出库治具到"+ target;
JobRunStep.Msg = runInfo;
JobRunStep.EndJob();
return new SendFixToLineJob(new JobParam(JobParam.TargetNode, NodeManager.GetNodeByName(target)),true);
}
else
......
......@@ -30,11 +30,11 @@ namespace DeviceLibrary
JobRunStep.ToNextStep(RunStep.ADJUST_WIDTH);
runInfo = "准备去" + JobParam.TargetNode + ",先调宽";
JobRunStep.Msg = runInfo;
AdjustWidth(agv,JobParam.FixMissionInfo.Type);
AdjustWidth(agv, JobParam.FixMissionInfo.Type);
}
else if(JobRunStep.IsStep(RunStep.ADJUST_WIDTH))
else if (JobRunStep.IsStep(RunStep.ADJUST_WIDTH))
{
if(agv.TaskRunState.CheckTaskFinished(agv.Name))
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
if (JobParam.SrcNode.Area.Equals(Area.Air_C) && !JobParam.TargetNode.Area.Equals(Area.Air_C))//4C风淋门内->风淋门外
{
......@@ -285,22 +285,19 @@ namespace DeviceLibrary
{
if (JobParam.OpType.Equals(OpType.Mannual))
{
if (agv.Input != null && agv.Input.Length == 4)
{
if (agv.Input[0].Equals(true))
if (agv.GetInput(2, 0))
{
runInfo = "人员在" + JobParam.TargetNode + "操作完成";
JobRunStep.Msg = runInfo;
JobRunStep.EndJob();
return new FixToInStoreJob(new JobParam(JobParam.TargetNode, null, JobParam.Shelf.ToCopy()));
}
return new FixToInStoreJob(new JobParam(JobParam.TargetNode, null, JobParam.Shelf==null?null:JobParam.Shelf.ToCopy()));
}
}
else if (JobParam.OpType.Equals(OpType.RequestAPI))
{
if (OpManager.Info.GetTransfer(out string target))
{
if(target.Equals(SettingString.Cancel))
if (target.Equals(SettingString.Cancel))
{
JobRunStep.ToNextStep(RunStep.END);
runInfo = "到达" + JobParam.TargetNode + ",该任务被取消";
......@@ -311,22 +308,19 @@ namespace DeviceLibrary
runInfo = "人员在" + JobParam.TargetNode + "操作完成";
JobRunStep.Msg = runInfo;
JobRunStep.EndJob();
return new FixToInStoreJob(new JobParam(JobParam.TargetNode, NodeManager.GetNodeByName(target), JobParam.Shelf.ToCopy()));
return new FixToInStoreJob(new JobParam(JobParam.TargetNode, NodeManager.GetNodeByName(target), JobParam.Shelf==null?null:JobParam.Shelf.ToCopy()));
}
}
}
else if (JobParam.OpType.Equals(OpType.MaulAndAPI))
{
if (agv.Input != null && agv.Input.Length == 4)
{
if (agv.Input[0].Equals(true) || OpManager.Info.GetUnlock(JobParam.Shelf.RFID))
if (agv.GetInput(2,0) || OpManager.Info.GetUnlock(JobParam.Shelf.RFID))
{
runInfo = "人员在" + JobParam.TargetNode + "操作完成";
JobRunStep.Msg = runInfo;
JobRunStep.EndJob();
return new FixToInStoreJob(new JobParam(JobParam.TargetNode, null, JobParam.Shelf.ToCopy()));
}
return new FixToInStoreJob(new JobParam(JobParam.TargetNode, null, JobParam.Shelf==null?null:JobParam.Shelf.ToCopy()));
}
}
}
......
......@@ -26,7 +26,7 @@ namespace DeviceLibrary
{
if (adjustWidth)
{
OpManager.ClientToSMDServer.RemoveRfidBufInfo(JobParam.Shelf.RFID);
OpManager.ClientToSMDServer.RemoveRfidBufInfo(JobParam.Shelf==null?"":JobParam.Shelf.RFID);
if (JobParam.TargetNode.Area.Equals(Area.C) || JobParam.TargetNode.Area.Equals(Area.Air_C))
{
JobRunStep.ToNextStep(RunStep.WAIT_IN_ROOM_C);
......@@ -162,15 +162,12 @@ namespace DeviceLibrary
{
if (JobParam.OpType.Equals(OpType.Mannual))
{
if (agv.Input != null && agv.Input.Length == 4)
{
if (agv.Input[0].Equals(true))
if (agv.GetInput(2, 0).Equals(true))
{
runInfo = "人员在" + JobParam.TargetNode + "操作完成";
JobRunStep.Msg = runInfo;
JobRunStep.EndJob();
return new EmptyAGVBackJob(new JobParam(JobParam.TargetNode, null, JobParam.Shelf.ToCopy()));
}
return new EmptyAGVBackJob(new JobParam(JobParam.TargetNode, null, JobParam.Shelf==null?null:JobParam.Shelf.ToCopy()));
}
}
else if (JobParam.OpType.Equals(OpType.RequestAPI))
......@@ -180,14 +177,12 @@ namespace DeviceLibrary
runInfo = "人员在" + JobParam.TargetNode + "操作完成";
JobRunStep.Msg = runInfo;
JobRunStep.EndJob();
return new FixToInStoreJob(new JobParam(JobParam.TargetNode, null, JobParam.Shelf.ToCopy()));
return new FixToInStoreJob(new JobParam(JobParam.TargetNode, null, JobParam.Shelf==null?null:JobParam.Shelf.ToCopy()));
}
}
else if (JobParam.OpType.Equals(OpType.MaulAndAPI))
{
if (agv.Input != null && agv.Input.Length == 4)
{
if (agv.Input[0].Equals(true) || OpManager.Info.GetUnlock(JobParam.Shelf.RFID))
if (agv.GetInput(2,0) || OpManager.Info.GetUnlock(JobParam.Shelf.RFID))
{
runInfo = "人员在" + JobParam.TargetNode + "操作完成";
JobRunStep.Msg = runInfo;
......@@ -196,7 +191,6 @@ namespace DeviceLibrary
}
}
}
}
else if (JobRunStep.IsStep(RunStep.SF_WAIT_LINE_RESPONSE))
{
Node node = NodeManager.GetNodeByName(JobParam.TargetNode.Name);
......
......@@ -76,11 +76,11 @@ namespace DeviceLibrary
}
else if (JobRunStep.IsStep(RunStep.STANDBY_WAIT_REACH_STANDBY))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
//if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.END);
runInfo = "到达待机位";
JobRunStep.Msg = runInfo;
// runInfo = "到达待机位";
//JobRunStep.Msg = runInfo;
}
}
else if (JobRunStep.IsStep(RunStep.END))
......
......@@ -66,7 +66,7 @@ namespace DeviceLibrary
{
AgvTask task = AgvTasks.Find(s => s.Name.Equals(name));
if (task != null)
return task;
return task.ToCopy();
else
LogUtil.error(string.Format("任务名{0}不存在,请检查配置文件!", name));
return new AgvTask();
......@@ -127,7 +127,7 @@ namespace DeviceLibrary
LogUtil.info(string.Format("{0} Add_Mission {1} Fail", agv.Name, agv.TaskRunState.ToTaskInfo()));
}
}
agv.StateKanban.SetCurTask(agv.TaskRunState.ToTaskInfo());
agv.StateKanban.SetCurTask(agv.TaskRunState.ToTaskShowInfo());
if (!rtn)
agv.TaskRunState.EnWaitTaskQueue(task);
}
......
......@@ -54,6 +54,7 @@ namespace DeviceLibrary
public static bool GetTransfer(out string target)
{
target = "";
Common.LogUtil.debug($"GetTransfer [name={manager.WarehouseSigManager.TargetWithFix.Name},target={manager.WarehouseSigManager.TargetWithFix.Target}]");
if (!string.IsNullOrEmpty(manager.WarehouseSigManager.TargetWithFix.Target))
{
target= manager.WarehouseSigManager.TargetWithFix.Target;
......
......@@ -46,7 +46,14 @@ namespace DeviceLibrary.manager
agv_Info.IsUse = bool.Parse(xnl0.Item(2).InnerText);
agv_Info.UseFleet = bool.Parse(xnl0.Item(3).InnerText);
agv_Info.Authorization = xnl0.Item(4).InnerText;
agv_Info.IOID = xnl0.Item(5).InnerText;
XmlNode xnIO = xe.SelectSingleNode("IO_GUIDs");
XmlNodeList xnlios = xnIO.ChildNodes;
foreach (XmlNode item in xnlios)
{
IOInfo iOInfo = new IOInfo();
iOInfo.IOID = item.InnerText;
agv_Info.IOStatus.Add(iOInfo);
}
agv_Infos.Add(agv_Info);
}
xmlReader.Close();
......
......@@ -351,6 +351,11 @@ namespace DeviceLibrary
WarehouseSigManager.TargetWithFix.Set(name, target);
Log.Info($"运送接口调用成功[GET]: name={name},target={target}");
}
else if(!NodeManager.HasNode(target))
{
result1 = new Result1() { Succeed = false, Data = "", Msg = $"target={target} do not exist" };
Log.Info($"运送接口调用失败[GET]: : 目的地不存在, name={name},target={target},curplace={WarehouseSigManager.TargetWithFix.CurPlace}");
}
else
{
result1 = new Result1() { Succeed = false, Data = "", Msg = $" AGV is in {WarehouseSigManager.TargetWithFix.CurPlace}, line {name} is not allowed to call this interface TransferByGet at this time." };
......@@ -384,6 +389,11 @@ namespace DeviceLibrary
WarehouseSigManager.TargetWithFix.Set(name, target);
Log.Info($"运送接口调用成功[GET]: name={name},target={target}");
}
else if (!NodeManager.HasNode(target))
{
result1 = new Result1() { Succeed = false, Data = "", Msg = $"target={target} do not exist" };
Log.Info($"运送接口调用失败[POST]: : 目的地不存在, name={name},target={target},curplace={WarehouseSigManager.TargetWithFix.CurPlace}");
}
else
{
result1 = new Result1() { Succeed = false, Data = "", Msg = $" AGV is in {WarehouseSigManager.TargetWithFix.CurPlace}, line {name} is not allowed to call this interface TransferByGet at this time." };
......
......@@ -81,7 +81,18 @@ namespace DeviceLibrary.manager
public enum FixType
{
None
None = 0,
FCT = 1,
ICT = 2,
/// <summary>
/// 烧录治具
/// </summary>
BRUN = 3,
/// <summary>
/// 抓手治具
/// </summary>
HandFix = 4,
}
public enum MissionType
{
......
......@@ -40,9 +40,8 @@ namespace AGVControl
//agvRunStep = new string[Common.agvInfo.Count];
for (int i = 0; i < AGVManager.agvInfo.Count; i++)
{
MiR_API.Get_IO_Status(AGVManager.agvInfo[i], out bool[] input, out bool[] output);
if (input != null && input.Length == 4)
AGVManager.agvInfo[i].IsExistShelf = input[3];
MiR_API.Get_IO_Status(AGVManager.agvInfo[i]);
AGVManager.agvInfo[i].IsExistShelf = AGVManager.agvInfo[i].GetInput(0,3);
flowLayoutPanel1.Controls.Add(AGVManager.agvInfo[i].StateKanban);
AddForm(AGVManager.agvInfo[i].Name, new Manual(AGVManager.agvInfo[i]));
AGVManager.agvInfo[i].StateKanban.Init(AGVManager.agvInfo[i].Name);
......@@ -55,7 +54,9 @@ namespace AGVControl
private void FixMissionManager_MissionChangedEvent()
{
this.Invoke(new Action(()=> {
DeviceLibrary.manager.FixMissionManager.UpdateDataSource(dgvInfos);
}));
}
private void Server_NodeChanged(Node node)
......@@ -144,7 +145,7 @@ namespace AGVControl
if (e.ColumnIndex == 6) //调用
{
DataGridView dgv = sender as DataGridView;
if(dgv != null)
if (dgv != null)
{
}
......@@ -218,7 +219,7 @@ namespace AGVControl
private void dgvInfos_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if(e.ColumnIndex==4)
if (e.ColumnIndex == 4)
{
if (e.RowIndex == -1)
return;
......
......@@ -39,14 +39,15 @@ namespace AGVControl
{
if (!IsHandleCreated)
return;
this.Invoke(new Action(() => {
this.Invoke(new Action(() =>
{
try
{
if (Agv.Input != null && Agv.Input.Length == 4)
if (Agv.IOStatus[0] != null && Agv.IOStatus[0].Inputs !=null)
{
for (int i = 0; i < Agv.Input.Length; i++)
for (int i = 0; i < Agv.IOStatus[0].Inputs.Length; i++)
{
if (Agv.Input[i])
if (Agv.GetInput(0,i))
{
InState[i].Image = AGVControl_Fixture.Properties.Resources.green1;
}
......@@ -56,11 +57,11 @@ namespace AGVControl
}
}
}
if (Agv.Output != null && Agv.Output.Length == 4)
if(Agv.IOStatus[2]!=null && Agv.IOStatus[2].Inputs!=null)
{
for (int i = 0; i < Agv.Output.Length; i++)
for (int i = 0; i < Agv.IOStatus[2].Inputs.Length; i++)
{
if (Agv.Output[i])
if (Agv.GetInput(2, i))
{
OutState[i].Image = AGVControl_Fixture.Properties.Resources.green1;
}
......@@ -70,6 +71,7 @@ namespace AGVControl
}
}
}
}
catch { }
}));
......@@ -84,14 +86,15 @@ namespace AGVControl
cmbBxMission.Enabled = !chkBxAuto.Checked;
if (!chkBxAuto.Checked)
{
Agv.IsUse = false;
ChargePileManager.StopCharge(Agv);
if (Agv.IsCon)
{
LogUtil.info($"取消自动任务,当前任务信息是:{Agv.Msg}");
Agv.CurJob = null;
MiR_API.Del_Mission(Agv);
//MiR_API.Del_Mission(Agv);
//添加Init任务
AgvTaskManager.AssignMission(Agv,SettingString.Init);
AgvTaskManager.AssignMission(Agv, SettingString.Init);
}
}
......@@ -100,17 +103,12 @@ namespace AGVControl
if (Agv.IsExistShelf)
{
chkBxAuto.Checked = false;
MessageBox.Show(this,string.Format("{0} 车上有负载,无法开启自动模式,请先清空小车负载!", Agv.Name), "警告");
MessageBox.Show(this, string.Format("{0} 车上有负载,无法开启自动模式,请先清空小车负载!", Agv.Name), "警告");
LogUtil.error(string.Format("{0} 车上有负载,无法开启自动模式,请先清空小车负载!", Agv.Name));
return;
}
//if (Agv.Place.Equals(SettingString.Standby) || Agv.Place.Equals(SettingString.AutoCharge))
// Agv.Place = new Node();
if (Agv.IsCon)
MiR_API.Del_Mission(Agv);
Agv.IsUse = true;
}
Agv.IsUse = chkBxAuto.Checked;
}));
}
......@@ -174,7 +172,8 @@ namespace AGVControl
if (MessageBox.Show("确定对小车发送进/出任务?", Agv.Name, MessageBoxButtons.YesNo) == DialogResult.No)
return;
AgvTaskManager.AssignMission(Agv, task.Name);
LogUtil.info(string.Format("{0} 手动发任务 [{1}]", Agv.Name, cmbBxMission.SelectedItem.ToString()));
AgvTask agvTask = cmbBxMission.SelectedItem as AgvTask;
LogUtil.info(string.Format("{0} 手动发任务 [{1}]", Agv.Name, agvTask.Name));
}
}
catch (Exception ex)
......
......@@ -64,6 +64,21 @@
<conversionPattern value="%m%n"/>
</layout>
</appender>
<appender name="MiR_API" type="log4net.Appender.RollingFileAppender">
<file value="logs/MiR_API/MiR_API.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<param name="MaxSizeRollBackups" value="30" />
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%m%n"/>
</layout>
</appender>
<logger name="MiR_API">
<level value="MiR_API"/>
<appender-ref ref="MiR_API"/>
</logger>
<logger name="RunLog">
<level value="Info"/>
<appender-ref ref="RunLog"/>
......@@ -81,7 +96,7 @@
<appender-ref ref="HttpManager"/>
</logger>
<root name="AGV_3D_Line">
<level value="Info"/>
<level value="debug"/>
<appender-ref ref="AGV_3D_Line"/>
</root>
</log4net>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!