Commit 4f2ed27e 张东亮

添加与4C对接

1 个父辈 0f1ba7f9
正在显示 51 个修改的文件 包含 1459 行增加608 行删除
......@@ -125,6 +125,7 @@ namespace BLL
{
while (_loop)
{
Thread.Sleep(30000);
foreach (ClientNode clientNode in Common.nodeInfo)
{
Thread.Sleep(3000);
......@@ -203,7 +204,7 @@ namespace BLL
ping.Dispose();
if (result.Status != System.Net.NetworkInformation.IPStatus.Success)
{
Common.LogInfo(name + " Ping " + ip + " 请求没有响应", false);
Common.log.Debug(name + " Ping " + ip + " 请求没有响应");
return false;
}
return true;
......@@ -455,41 +456,28 @@ namespace BLL
private int FindClient(string ip)
{
int index = -1;
foreach (Client item in _client)
try
{
if (item.IsConn)
foreach (Client item in _client)
{
//Common.log.Info("已连接客户端:" + string.Join("#", item.IP));
if (item.IP.Contains(ip))
if (item.IsConn)
{
index = _client.IndexOf(item);
break;
//Common.log.Info("已连接客户端:" + string.Join("#", item.IP));
if (item.IP.Contains(ip))
{
index = _client.IndexOf(item);
break;
}
//int idx = item.nodeName.FindIndex(a => a == name);
//if (idx != -1)
//{
// index = _client.IndexOf(item);
// break;
//}
}
//int idx = item.nodeName.FindIndex(a => a == name);
//if (idx != -1)
//{
// index = _client.IndexOf(item);
// break;
//}
}
}
//for (int i = 0; i < _client.Count; i++)
//{
// if (_client[i].IsConn)
// {
// Common.log.Info("已连接客户端:" + _client[i].nodeName[i]);
// int idx = _client[i].nodeName.FindIndex(a => a == name);
// if (idx != -1)
// {
// index = i;
// break;
// }
// }
//}
catch { };
return index;
}
......
......@@ -22,10 +22,6 @@ namespace AGVControl
/// 小车信息
/// </summary>
public static List<Agv_Info> agvInfo;
/// <summary>
/// 任务列表
/// </summary>
public static List<MissionStru> missionList;
public static System.Windows.Forms.TextBox logTextBox;
public static System.Windows.Forms.DataGridView missionView;
public static BLL.AgvServer server;
......@@ -36,28 +32,19 @@ namespace AGVControl
public static string itsHttp;
public static log4net.ILog log;
public static Dictionary<string, string> agvMission;
public static Dictionary<string, string> showNameMissionName;
public static Dictionary<string, string> agvProductionLine;
public static System.Configuration.Configuration appConfig;
public static MissionManager missionManager;
public static readonly string CONFIG_PATH = AppDomain.CurrentDomain.BaseDirectory + "Config\\";
private static string msg = "";
/// <summary>
/// E21 E22 是否允许离开/进入
/// </summary>
public static bool IsAllowLeaveOrEnter = false;
private static List<string> msg = new List<string>();
private static string preLog = "";
private static int logCnt = 0;
public struct MissionStru
{
public string NodeName;
public string CreateTime;
/// <summary>
/// 任务结构
/// </summary>
/// <param name="dateTime">创建时间</param>
/// <param name="name">节点名称</param>
public MissionStru(string dateTime, string name)
{
NodeName = name;
CreateTime = dateTime;
}
}
public static void LogInfo(string text, bool isShow = true)
{
if (logTextBox.InvokeRequired)
......@@ -69,22 +56,21 @@ namespace AGVControl
if (preLog.Equals(text))//连续重复的日志只打印一次
return;
preLog = text;
logCnt++;
if (logCnt > 200)
if (msg.Count > 25)
{
logCnt = 0;
msg = "";
msg.RemoveRange(0,10);
}
log.Info(text);
string tmpStr="";
if (isShow)
{
msg += string.Format("[{0}] {1}\r\n", DateTime.Now.ToString("HH:mm:ss"), text);
logTextBox.Text = msg;
msg.Add(string.Format("[{0}] {1}\r\n", DateTime.Now.ToString("HH:mm:ss"), text));
msg.ForEach(s=> tmpStr+= s);
logTextBox.Text = tmpStr;
}
}
public static void ReadLinePlace()
{
missionList = new List<MissionStru>();
if (!System.IO.File.Exists(CONFIG_PATH + "LinePlace.txt"))
{
File.Create(CONFIG_PATH + "LinePlace.txt");
......@@ -97,7 +83,7 @@ namespace AGVControl
string[] mission = s[i].Split(',');
if (mission.Length != 2)
continue;
missionList.Add(new MissionStru(mission[0], mission[1]));
missionManager.missionList.Add(new MissionStru(mission[0], mission[1]));
}
......@@ -109,10 +95,10 @@ namespace AGVControl
int idx = Common.nodeInfo.FindIndex(s => s.Name == nodeName);
if (idx > -1)
{
Common.missionList.Add(new MissionStru(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),nodeName));
Common.missionManager.missionList.Add(new MissionStru(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),nodeName));
using (System.IO.StreamWriter file = new System.IO.StreamWriter(CONFIG_PATH + "LinePlace.txt"))
{
foreach (var item in Common.missionList)
foreach (var item in Common.missionManager.missionList)
{
file.WriteLine(string.Format("{0},{1}",item.CreateTime, item.NodeName));
}
......@@ -134,13 +120,13 @@ namespace AGVControl
int idx = Common.nodeInfo.FindIndex(s => s.Name == nodeName);
if (idx > -1)
{
idx = Common.missionList.FindIndex(s => s.NodeName == nodeName);
idx = Common.missionManager.missionList.FindIndex(s => s.NodeName == nodeName);
if(idx>-1)
{
Common.missionList.RemoveAt(idx);
Common.missionManager.missionList.RemoveAt(idx);
using (System.IO.StreamWriter file = new System.IO.StreamWriter(CONFIG_PATH + "LinePlace.txt"))
{
foreach (var item in Common.missionList)
foreach (var item in Common.missionManager.missionList)
{
file.WriteLine(string.Format("{0},{1}", item.CreateTime, item.NodeName));
}
......@@ -182,7 +168,7 @@ namespace AGVControl
}
else
{
Common.log.Error("CheckAGVMissionState 获取PLC20失败");
Common.log.Debug("CheckAGVMissionState 获取PLC20失败");
}
}
}
......@@ -201,7 +187,7 @@ namespace AGVControl
}
else
{
Common.log.Error("GetNodesPosition 获取节点位置失败");
Common.log.Debug("GetNodesPosition 获取节点位置失败");
}
}
}
......@@ -312,16 +298,19 @@ namespace AGVControl
/// 节点位置坐标
/// </summary>
public PositionStru position;
public string AliceName { get; set; }
/// <summary>
/// 客户端节点
/// </summary>
/// <param name="name"></param>
/// <param name="ip"></param>
/// <param name="isUse"></param>
public ClientNode(string name, string ip, bool isUse, string pos_name, string pos_guid)
public ClientNode(string name, string ip, string aliceName, string pos_name, string pos_guid, bool isUse)
{
Name = name;
IP = ip;
AliceName = aliceName;
RFID = rfid;
Action = ClientAction.None;
AgvName = "";
......@@ -362,7 +351,7 @@ namespace AGVControl
{
//节点,IP,动作,RFID,AGV名称,在线,调用,清除AGV
string[] s = new string[9];
s[0] = Name;
s[0] = AliceName;
s[1] = IP;
if (Online)
{
......@@ -428,6 +417,10 @@ namespace AGVControl
/// 地点
/// </summary>
public string Place { set; get; }
/// <summary>
/// 地点
/// </summary>
public string PlaceAliceName { set; get; } = "";
/// <summary>
/// 地点的状态
......@@ -459,7 +452,10 @@ namespace AGVControl
/// 下一个地点
/// </summary>
public string NextPlace { set; get; }
/// <summary>
/// 下一个地点
/// </summary>
public string NextPlaceAliceName { set; get; } = "";
/// <summary>
/// 关门,用于执行一次
......@@ -547,9 +543,18 @@ namespace AGVControl
int a = value / 1000;
int b = (value - a * 1000) / 10;
int c = value - a * 1000 - b * 10;
if (c.Equals(1) || c.Equals(3) || c.Equals(5))
if (c.Equals(1) || c.Equals(3) || c.Equals(5))//Move,Enter,Leave
TaskSend = "";
Place = (char)(64 + a) + b.ToString();
if(Common.nodeInfo !=null && Common.nodeInfo.Count !=0)
{
ClientNode node = Common.nodeInfo.Find(s => s.Name == Place);
if (node != null)
PlaceAliceName = node.AliceName;
else
PlaceAliceName = "";
}
PlaceState = (PlaceState)c;
}
}
......@@ -565,9 +570,17 @@ namespace AGVControl
s.Add(StateText);
s.Add(RFID);
s.Add(MissionText);
s.Add(Place);
s.Add(PlaceAliceName);
s.Add(PlaceState.ToString());
s.Add(NextPlace);
if (Common.nodeInfo != null && Common.nodeInfo.Count != 0)
{
ClientNode node = Common.nodeInfo.Find(q => q.Name == NextPlace);
if (node != null)
NextPlaceAliceName = node.AliceName;
else
NextPlaceAliceName = "";
}
s.Add(NextPlaceAliceName);
}
else
{
......@@ -751,5 +764,42 @@ namespace AGVControl
}
/// <summary>
/// 任务信息结构
/// </summary>
public struct MissionStru
{
public string NodeName;
public string CreateTime;
/// <summary>
/// 任务结构
/// </summary>
/// <param name="dateTime">创建时间</param>
/// <param name="name">节点名称</param>
public MissionStru(string dateTime, string name)
{
NodeName = name;
CreateTime = dateTime;
}
}
/// <summary>
/// 任务管理
/// </summary>
public class MissionManager
{
/// <summary>
/// 任务列表
/// </summary>
public List<MissionStru> missionList;
/// <summary>
/// 主动执行空架任务的小车名称
/// </summary>
public string AGV_Name_EmptyTask { get; set; } = "";
public MissionManager()
{
missionList = new List<MissionStru>();
}
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Drawing.Text;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Web.Script.Serialization;
using AGVControl;
using log4net.Util;
using RestSharp;
namespace BLL
......@@ -57,15 +60,15 @@ namespace BLL
//获取AGV状态
rtn = Common.mir.Get_State(Common.agvInfo[i], out int stateID, out string stateText, out int battery, out string mission_text, out Agv_Info.clsPosition position);
Common.mir.Get_IO_Status(Common.agvInfo[i], out bool[] input, out bool[] output);
Common.mir.Get_IO_Status(Common.agvInfo[i], out bool[] input, out bool[] output);
bool change = false;
if (rtn) change = Common.agvInfo[i].SetState(stateID, stateText, battery, mission_text, position,input,output);
if (rtn) change = Common.agvInfo[i].SetState(stateID, stateText, battery, mission_text, position, input, output);
//上报异常
if (Common.agvInfo[i].MissionText != mission_text)
{
Common.agvInfo[i].MissionText = mission_text;
if (mission_text.Equals("停靠") || mission_text.ToLower().Equals("DOCKING"))
if (mission_text.Equals("正在停靠") || mission_text.ToUpper().Equals("DOCKING"))
{
Common.agvInfo[i].DockingInfo.startTime = DateTime.Now;
Common.agvInfo[i].DockingInfo.IsDocking = true;
......@@ -100,7 +103,7 @@ namespace BLL
if (change)
{
Common.LogInfo(string.Format("{0} Get_State StateID={1}, StateText={2}, Battery={3}, Mission_text={4}", Common.agvInfo[i].Name, stateID, stateText, battery, mission_text), false);
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 == 5 || change)
......@@ -130,51 +133,56 @@ namespace BLL
private void AgvCall()
{
while (loop)
try
{
Thread.Sleep(1000);
for (int i = 0; i < Common.agvInfo.Count; i++)
while (loop)
{
if (!loop) break;
if (!Common.agvInfo[i].IsCon) continue; //AGV网络连接
if (!Common.agvInfo[i].IsUse) continue; //AGV是否可用
//Ready,Pause,Executing
if (Common.agvInfo[i].StateID != 3 && Common.agvInfo[i].StateID != 4 && Common.agvInfo[i].StateID != 5)
Thread.Sleep(1000);
for (int i = 0; i < Common.agvInfo.Count; i++)
{
Common.LogInfo(string.Format("{0}不能调用 StateID={1}, StateText={2}", Common.agvInfo[i].Name, Common.agvInfo[i].StateID, Common.agvInfo[i].StateText));
continue;
}
if (!loop) break;
if (!Common.agvInfo[i].IsCon) continue; //AGV网络连接
if (!Common.agvInfo[i].IsUse) continue; //AGV是否可用
switch (Common.agvInfo[i].PlaceState)
{
case PlaceState.None:
StateNone(i);
break;
case PlaceState.Move:
StateMove(i);
break;
case PlaceState.MoveFinish:
StateMoveFinish(i);
break;
case PlaceState.Enter:
StateEnter(i);
break;
case PlaceState.EnterFinish:
StateEnterFinish(i);
break;
case PlaceState.Leave:
StateLeave(i);
break;
case PlaceState.LeaveFinish:
StateLeaveFinish(i);
break;
case PlaceState.Error:
StateError(i);
break;
//Ready,Pause,Executing
if (Common.agvInfo[i].StateID != 3 && Common.agvInfo[i].StateID != 4 && Common.agvInfo[i].StateID != 5)
{
Common.LogInfo(string.Format("{0}不能调用 StateID={1}, StateText={2}", Common.agvInfo[i].Name, Common.agvInfo[i].StateID, Common.agvInfo[i].StateText));
continue;
}
switch (Common.agvInfo[i].PlaceState)
{
case PlaceState.None:
StateNone(i);
break;
case PlaceState.Move:
StateMove(i);
break;
case PlaceState.MoveFinish:
StateMoveFinish(i);
break;
case PlaceState.Enter:
StateEnter(i);
break;
case PlaceState.EnterFinish:
StateEnterFinish(i);
break;
case PlaceState.Leave:
StateLeave(i);
break;
case PlaceState.LeaveFinish:
StateLeaveFinish(i);
break;
case PlaceState.Error:
StateError(i);
break;
}
}
}
}
catch (Exception ex) { Common.log.Error("AgvCall " + ex.Message); }
}
/// <summary>
......@@ -182,21 +190,21 @@ namespace BLL
/// </summary>
/// <param name="agv"></param>
/// <returns>节点名称</returns>
private Common.MissionStru CalculateNearNode(Agv_Info agv)
private MissionStru CalculateNearNode(Agv_Info agv)
{
Common.MissionStru missionNode = new Common.MissionStru("","");
MissionStru missionNode = new MissionStru("", "");
double minDis = Double.MaxValue;
try
{
if (Common.missionList.Count == 0)
if (Common.missionManager.missionList.Count == 0)
return missionNode;
foreach (var item in Common.missionList)
foreach (var item in Common.missionManager.missionList)
{
int index = Common.nodeInfo.FindIndex(s => s.Name == item.NodeName);
if (index > -1)
{
double dis = Math.Sqrt(Math.Pow((agv.Position.x - Common.nodeInfo[index].position.X), 2) + Math.Pow((agv.Position.y - Common.nodeInfo[index].position.Y), 2));
Common.LogInfo(string.Format("{0} 距离{1}={2}", agv.Name, Common.nodeInfo[index].Name, dis.ToString("f2")), false);
Common.log.Debug(string.Format("{0} 距离{1}={2}", agv.Name, Common.nodeInfo[index].Name, dis.ToString("f2")));
if (dis < minDis)
{
minDis = dis;
......@@ -204,12 +212,12 @@ namespace BLL
}
}
}
Common.LogInfo(string.Format("{0} 运动到产线 {1}", agv.Name, missionNode), false);
Common.log.Debug(string.Format("{0} 运动到产线 {1}", agv.Name, missionNode.NodeName));
return missionNode;
}
catch (Exception e)
{
Common.log.Error("CalculateNearNode + " + e.ToString());
Common.log.Error("CalculateNearNode " + e.ToString());
}
return missionNode;
}
......@@ -248,15 +256,36 @@ namespace BLL
Agv_Info agv = Common.agvInfo[idx];
if (agv.TaskSend != "") return;
agv.PlaceAliceName = "";
//空闲状态下,清空空架任务agv名字
Common.missionManager.AGV_Name_EmptyTask = "";
//空闲状态下清除节点上的agv名称
for (int i = 0; i < Common.nodeInfo.Count; i++)
{
if (Common.nodeInfo[i].AgvName.Equals(agv.Name))
Common.nodeInfo[i].AgvName = "";
}
if (agv.IsExistShelf)//满载则先将架子清空
{
if (agv.RFID.StartsWith("C"))
{
CheckA5A6State_BigShelf(agv);
}
else
{
CheckA5A6State_SmallShelf(agv);
}
return;
}
//检查是否需要充电
if (CheckIsNeedCharge(agv))
return;
if (CheckEmptyShelf(agv, agv.Place, true))//先出空料架
return;
if (CheckA6State(agv))
return;
CheckEmptyShelf(agv);
#region 出空料架,带节点状态-不用
//ClientLevel clientLevel = Common.linePlace.Values.Max<ClientLevel>();
////出空料架
......@@ -447,7 +476,7 @@ namespace BLL
#region 指定充电位置
if (agv.IP == "10.85.199.72")//1764
{
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["AutoCharge3"]);
rtn = Common.mir.Add_Mission(agv, Common.agvMission["AutoCharge3"]);
if (rtn)
{
//agv.TaskSend = "AutoCharge3";
......@@ -470,7 +499,7 @@ namespace BLL
}
else if (agv.IP == "10.85.199.71")//1763
{
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["AutoCharge4"]);
rtn = Common.mir.Add_Mission(agv, Common.agvMission["AutoCharge4"]);
if (rtn)
{
//agv.TaskSend = "AutoCharge4";
......@@ -493,7 +522,7 @@ namespace BLL
}
else if (agv.IP == "10.85.199.73")//1767
{
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["AutoCharge5"]);
rtn = Common.mir.Add_Mission(agv, Common.agvMission["AutoCharge5"]);
if (rtn)
{
//agv.TaskSend = "AutoCharge5";
......@@ -516,7 +545,7 @@ namespace BLL
}
else if (agv.IP == "10.85.199.74")//1768
{
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["AutoCharge6"]);
rtn = Common.mir.Add_Mission(agv, Common.agvMission["AutoCharge6"]);
if (rtn)
{
//agv.TaskSend = "AutoCharge6";
......@@ -553,12 +582,13 @@ namespace BLL
bool rtn;
int index;
string RFID = "";
if (agv.TaskSend != "")
return false;
//A6出满料
rtn = FindA6Leave(out string nextNode);
if (rtn)
{
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["MoveA6"]);
rtn = Common.mir.Add_Mission(agv, Common.agvMission["MoveA6"]);
if (rtn)
{
agv.NextPlace = nextNode;
......@@ -569,76 +599,89 @@ namespace BLL
index = FindNode(nextNode);
Common.nodeInfo[index].AgvName = agv.Name;
}
Common.LogInfo(string.Format("A6有满料架[{0}]要出,目的地为{1}", RFID, nextNode));
Common.LogInfo(string.Format("{0} A6有满料架[{1}]要出,目的地为{2}", agv.Name, RFID, nextNode));
agv.TaskSend = rtn ? "MoveA6" : "";
return true;
}
return false;
}
/// <summary>
/// 查看是否有空料架出,有则根据距离分配任务
/// 查看是否有空料架出。根据距离分配任务;分产线接任务与待机位接任务
/// </summary>
/// <param name="agv"></param>
/// <returns>true:有空料架要出</returns>
private bool CheckEmptyShelf(Agv_Info agv)
/// <param name="isAgvAtStandy">待机位接任务;默认false,即从产线接任务</param>
/// <returns>有空料架要出</returns>
private bool CheckEmptyShelf(Agv_Info agv, string agvPlace, bool isAgvAtStandy = false)
{
//if (Common.linePlace.Count == 0)
//{
// //Common.LogInfo("当前无空料架要出");
// return false;
//}
bool rtn = false;
//int index = -1;
//foreach (var nodeName in Common.linePlace)
//{
// index = Common.nodeInfo.FindIndex(s => s.Name.Equals(nodeName) && s.IsUse);
// if (index > -1)
// {
// rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["Move" + nodeName]);
// if (rtn)
// {
// Common.nodeInfo[index].AgvName = agv.Name;
// Common.LogInfo(string.Format("[{0}] 出空料架.", nodeName));
// Common.linePlace.Remove(nodeName);
// System.IO.File.WriteAllLines(Common.CONFIG_PATH + "LinePlace.txt", Common.linePlace);
// }
// agv.TaskSend = rtn ? "Move" + nodeName : "";
// }
// if (Common.linePlace.Count.Equals(0).Equals(false))
// Common.LogInfo("剩余需要出空料架的节点:" + string.Join(",", Common.linePlace.ToArray()));
// if (rtn) return true;
//}
//有空架任务
//限制待机位车辆只有一台执行空架任务
if (isAgvAtStandy)
{
if (Common.missionManager.AGV_Name_EmptyTask.Equals("").Equals(false))//已有一辆车执行空料架任务
{
Common.LogInfo(Common.missionManager.AGV_Name_EmptyTask + " 正在执行空料架任务,不允许分配该小车 " + agv.Name, false);
return false;
}
}
Common.MissionStru missionNode = CalculateNearNode(agv);
bool rtn = false;
MissionStru missionNode = CalculateNearNode(agv);
if (missionNode.NodeName.Equals(""))
{
return false;
}
int index = Common.nodeInfo.FindIndex(s => s.Name.Equals(missionNode.NodeName) && s.AgvName == "" && s.IsUse);
int index = -1;
index = Common.nodeInfo.FindIndex(s => s.Name.Equals(missionNode.NodeName) && s.AgvName == "" && s.IsUse);
if (index == -1)
return false;
if (missionNode.NodeName.StartsWith("G")) //4C
{
if (!agvPlace.StartsWith("G"))//4D->4C
{
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["MoveDoorDToC"]);
if (!rtn)
return false;
}
}
else//目标地点4D
{
if (agvPlace.StartsWith("G"))//4C->4D
{
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["MoveDoorCToD"]);
if (!rtn)
return false;
}
}
if (index > -1)
{
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["Move" + missionNode.NodeName]);
if (rtn)
{
agv.TaskSend = "Move" + missionNode.NodeName;
Common.nodeInfo[index].AgvName = agv.Name;
Common.LogInfo(string.Format("[{0}] 出空料架.", missionNode.NodeName));
Common.missionList.Remove(missionNode);
Common.LogInfo(string.Format("{0} [{1}] 出空料架.", agv.Name, missionNode.NodeName));
Common.missionManager.missionList.Remove(missionNode);
if (isAgvAtStandy)
Common.missionManager.AGV_Name_EmptyTask = agv.Name;
using (System.IO.StreamWriter file = new System.IO.StreamWriter(Common.CONFIG_PATH + "LinePlace.txt"))
{
foreach (var item in Common.missionList)
foreach (var item in Common.missionManager.missionList)
{
file.WriteLine(string.Format("{0},{1}", item.CreateTime,item.NodeName));
file.WriteLine(string.Format("{0},{1}", item.CreateTime, item.NodeName));
}
}
}
agv.TaskSend = rtn ? "Move" + missionNode.NodeName : "";
}
if (Common.missionList.Count.Equals(0).Equals(false))
if (Common.missionManager.missionList.Count.Equals(0).Equals(false))
{
AgvChanged?.Invoke(0);
Common.LogInfo("剩余需要出空料架的节点:");
Common.missionList.ForEach(s => Common.LogInfo(string.Format("创建时间:{0},任务节点{1}", s.CreateTime, s.NodeName)));
Common.LogInfo("剩余需要出空料架的节点:", false);
Common.missionManager.missionList.ForEach(s => Common.LogInfo(string.Format("创建时间:{0},任务节点{1}", s.CreateTime, s.NodeName), false));
}
if (rtn) return true;
......@@ -725,7 +768,7 @@ namespace BLL
}
else if (node.Action == ClientAction.NeedEnterLeave)
{
if(agv.IsExistShelf)//车上有料架
if (agv.IsExistShelf)//车上有料架
{
rtn = Common.server.ReadyEnter(agv.Place);
if (!rtn) return;
......@@ -740,6 +783,88 @@ namespace BLL
}
break;
case "E1":
//C是大料架,D是小料架
//大料架
if (agv.RFID.StartsWith("C"))
{
//获取大料架解绑状态
bool state = GetRackBy(agv.RFID, out string linename);
if (state)//解绑了
{
if (AGVControl.Common.agvProductionLine.TryGetValue(linename, out string nodeName))
{
int nodeIdx = Common.nodeInfo.FindIndex(s => s.Name == "A5" && (s.Action == ClientAction.NeedC || s.Action == ClientAction.NeedEnter) && s.AgvName == "" && s.IsUse);
if (nodeIdx > -1)
{
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["Move" + Common.nodeInfo[nodeIdx].Name]);
if (rtn)
{
agv.TaskSend = rtn ? "Move" + Common.nodeInfo[nodeIdx].Name : "";
Common.nodeInfo[nodeIdx].AgvName = agv.Name;
Common.LogInfo(string.Format("{0} 大料架[RFID={1}]解绑 运往[{2}],", agv.Name, agv.RFID, Common.nodeInfo[nodeIdx].Name));
return;
}
}
nodeIdx = Common.nodeInfo.FindIndex(s => s.Name == "A6" && (s.Action == ClientAction.NeedEnter || s.Action == ClientAction.NeedEnterLeave) && s.AgvName == "" && s.IsUse);
if (nodeIdx > -1)
{
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["Move" + Common.nodeInfo[nodeIdx].Name]);
if (rtn)
{
agv.TaskSend = rtn ? "Move" + Common.nodeInfo[nodeIdx].Name : "";
Common.nodeInfo[nodeIdx].AgvName = agv.Name;
Common.LogInfo(string.Format("{0} 大料架[RFID={1}]解绑 运往[{2}],", agv.Name, agv.RFID, Common.nodeInfo[nodeIdx].Name));
return;
}
}
}
}
else
{
Common.LogInfo(string.Format("{0}载大料架到达{1}[RFID={2}],等待料架解绑。。。", agv.Name, agv.Place, agv.RFID));
return;
}
}
else if (agv.RFID.StartsWith("D"))//小料架
{
rtn = Common.server.ReadyEnter(agv.Place);
if (!rtn) return;
Common.LogInfo(string.Format("{0}载小料架到达{1}[RFID={2}],服务器发送ReadyEnter信号", agv.Name, agv.Place, agv.RFID));
}
else if (agv.IsExistShelf)//有负载,可能软件重启导致RFID丢失
{
//rtn = Common.server.ReadyEnter(agv.Place);
//if (!rtn) return;
//Common.LogInfo(string.Format("{0}载小料架到达{1}[RFID={2}],服务器发送ReadyEnter信号", agv.Name, agv.Place, agv.RFID));
}
else//其他地方到E区域,则是空车
{
rtn = Common.server.ReadyLeave(agv.Place);
if (!rtn) return;
Common.LogInfo(string.Format("{0}到达{1},服务器发送ReadyLeave信号", agv.Name, agv.Place));
}
if (node.Action == ClientAction.MayEnter)
{
if (agv.TaskSend == "Leave") return;
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["Leave"]);
agv.TaskSend = rtn ? "Leave" : "";
if (rtn)
Common.LogInfo(string.Format("{0}到达{1},可以进入料架", agv.Name, agv.Place));
}
else if (node.Action == ClientAction.MayLeave)
{
if (agv.TaskSend == "Enter") return;
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["Enter"]);
agv.TaskSend = rtn ? "Enter" : "";
if (rtn)
Common.LogInfo(string.Format("{0}到达{1},可以出去料架", agv.Name, agv.Place));
}
break;
case "E2":
case "E3":
case "E4":
......@@ -754,55 +879,8 @@ namespace BLL
case "E14":
case "E15":
case "E16":
case "E21":
case "E22":
//C是大料架,D是小料架
//大料架
//if (agv.RFID.StartsWith("C"))
//{
// if (Common.linePlace.Contains(node.Name))
// {
// int nodeIdx = Common.nodeInfo.FindIndex(s => s.Name == "A5" && (s.Action == ClientAction.NeedC || s.Action == ClientAction.NeedEnter) && s.AgvName == "" && s.IsUse);
// if (nodeIdx > -1)
// {
// rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["Move" + Common.nodeInfo[nodeIdx].Name]);
// if (rtn)
// {
// agv.TaskSend = rtn ? "Move" + Common.nodeInfo[nodeIdx].Name : "";
// Common.nodeInfo[nodeIdx].AgvName = agv.Name;
// Common.linePlace.Remove(node.Name);
// Common.LogInfo(string.Format("{0}载大料架运往{1}[RFID={2}][{3}],", agv.Name, Common.nodeInfo[nodeIdx].Name, agv.RFID, Common.nodeInfo[nodeIdx].Action));
// return;
// }
// }
// nodeIdx = Common.nodeInfo.FindIndex(s => s.Name == "A6" && (s.Action == ClientAction.NeedEnter || s.Action == ClientAction.NeedEnterLeave) && s.AgvName == "" && s.IsUse);
// if (nodeIdx > -1)
// {
// rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["Move" + Common.nodeInfo[nodeIdx].Name]);
// if (rtn)
// {
// agv.TaskSend = rtn ? "Move" + Common.nodeInfo[nodeIdx].Name : "";
// Common.nodeInfo[nodeIdx].AgvName = agv.Name;
// Common.linePlace.Remove(node.Name);
// Common.LogInfo(string.Format("{0}载大料架运往{1}[RFID={2}][{3}],", agv.Name, Common.nodeInfo[nodeIdx].Name, agv.RFID, Common.nodeInfo[nodeIdx].Action));
// return;
// }
// }
case "G10":
// }
// else
// {
// Common.LogInfo(string.Format("{0}载大料架到达{1}[RFID={2}],等待料架清空。。。", agv.Name, agv.Place, agv.RFID));
// return;
// }
//}
//else if (agv.RFID.StartsWith("D"))//小料架
//{
// rtn = Common.server.ReadyEnter(agv.Place);
// if (!rtn) return;
// Common.LogInfo(string.Format("{0}载小料架到达{1}[RFID={2}],服务器发送ReadyEnter信号", agv.Name, agv.Place, agv.RFID));
//}
if (agv.RFID.StartsWith("D") || agv.RFID.StartsWith("C"))//不分大小料架
{
rtn = Common.server.ReadyEnter(agv.Place);
......@@ -832,24 +910,120 @@ namespace BLL
if (rtn)
Common.LogInfo(string.Format("{0}到达{1},可以出去料架", agv.Name, agv.Place));
}
//else if (node.Action == ClientAction.NeedEnter)
//{
// rtn = Common.server.ReadyEnter(agv.Place);
// if (!rtn) return;
// Common.LogInfo(string.Format("{0}到达{1},服务器发送ReadyEnter信号", agv.Name, agv.Place));
break;
case "E21":
case "G21":
//Feeder区,入料
//if (!Common.IsAllowLeaveOrEnter)
// return;
if (agv.TaskSend == "Leave") return;
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["Leave"]);
agv.TaskSend = rtn ? "Leave" : "";
if (rtn)
{
Common.IsAllowLeaveOrEnter = false;
Common.LogInfo(string.Format("{0}到达{1},可以进入料架", agv.Name, agv.Place));
}
break;
case "E22":
case "G22":
//Feeder区,出料
//if (!Common.IsAllowLeaveOrEnter)
// return;
if (agv.TaskSend == "Enter") return;
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["Enter"]);
agv.TaskSend = rtn ? "Enter" : "";
if (rtn)
{
Common.IsAllowLeaveOrEnter = false;
Common.LogInfo(string.Format("{0}到达{1},可以出去料架", agv.Name, agv.Place));
}
//}
//else if (node.Action == ClientAction.NeedLeave)
//{
// rtn = Common.server.ReadyLeave(agv.Place);
// if (!rtn) return;
// Common.LogInfo(string.Format("{0}到达{1},服务器发送ReadyLeave信号", agv.Name, agv.Place));
//}
break;
}
}
/// <summary>
/// 获取大料架解绑情况
/// </summary>
/// <param name="rfid"></param>
/// <param name="lineName"></param>
/// <returns></returns>
private bool GetRackBy(string rfid, out string lineName)
{
lineName = "";
//GET /ESMTCommonInterface/CommonService.asmx/GetRackBy?id=string HTTP/1.1
//Host: 10.85.17.233
string addr = "http://10.85.17.233/ESMTCommonInterface/CommonService.asmx/GetRackBy?id=" + rfid;
//[{"msg":"1OKD1"}]
//[{"msg":"0NGFeeder"}]
try
{
string result = HttpHelper.Get(addr);
if (!result.Equals(""))
{
List<Msg> msgs = JsonHelper.DeserializeJsonToList<Msg>(result);
if (msgs == null || msgs.Count == 0)
return false;
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("resCode={0},resStr={1},lineName={2}", resCode, resStr, lineName));
if (lineName.Equals("").Equals(true))
return false;
if (resStr.Equals("OK") || resCode.Equals(1))
return true;
else
return false;
}
}
catch { return false; }
return false;
}
/// <summary>
/// 物料状态上报
/// </summary>
/// <param name="rfid"></param>
/// <param name="lineName"></param>
/// <returns></returns>
private bool UpdateStatus(string rfid, string lineName)
{
//GET /ESMTCommonInterface/CommonService.asmx/UpdateStatusBy?id=string&location=string HTTP/1.1
//Host: 10.85.17.233
string addr = "http://10.85.17.233/ESMTCommonInterface/CommonService.asmx/UpdateStatusBy?id=" + rfid + "&location=" + lineName;
//[{"msg":"1更新成功"}]
try
{
string result = HttpHelper.Get(addr);
if (!result.Equals(""))
{
List<Msg> msgs = JsonHelper.DeserializeJsonToList<Msg>(result);
if (msgs == null || msgs.Count == 0)
return false;
bool resRtn = int.TryParse(msgs[0].msg.Substring(0, 1), out int resCode);
if (resRtn)
{
if (resCode.Equals(1))
{
Common.LogInfo(string.Format("{0}物料状态更新成功[{1}]", lineName, rfid));
return true;
}
else
return false;
}
return false;
}
}
catch { return false; }
return false;
}
/// <summary>
/// 料架进入小车
/// </summary>
......@@ -873,21 +1047,28 @@ namespace BLL
switch (agv.Place)
{
case "A6":
if (node.Action == ClientAction.FinishLeave)
// if (node.Action == ClientAction.FinishLeave)
// {
string nextPlace = agv.NextPlace;
if (nextPlace.Equals(""))
return;
if (nextPlace.StartsWith("G")) //4D->4C
{
string nextPlace = agv.NextPlace;
if (nextPlace.Equals(""))
return;
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["Move" + nextPlace]);
if (rtn)
{
agv.NextPlace = "";
node.AgvName = "";
agv.TaskSend = rtn ? "Move" + nextPlace : "";
Common.LogInfo(string.Format("{0}装载满料架,运往{1}", "A6", agv.Name,nextPlace));
}
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["MoveDoorDToC"]);
if (!rtn)
break;
}
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["Move" + nextPlace]);
if (rtn)
{
agv.NextPlace = "";
node.AgvName = "";
agv.TaskSend = rtn ? "Move" + nextPlace : "";
Common.LogInfo(string.Format("{0}装载满料架,运往{1}", agv.Name, nextPlace));
}
//}
break;
case "E1":
case "E2":
......@@ -906,55 +1087,216 @@ namespace BLL
case "E16":
case "E21":
case "E22":
//产线客户端不发FinishLeave
//产线空料架进入小车
//node.AgvName = "";
//node.Action = ClientAction.None;
ResetNodeState(node);
//目前条件:根据需求运料架,需要就运行【后续需要更改为从产线进入小车的料架均为小料架】 s.Action == ClientAction.NeedD || s.Action == ClientAction.NeedEnter
int tarIdx = Common.nodeInfo.FindIndex(s => s.Name == "A5"
&& (s.Action == ClientAction.NeedD || s.Action == ClientAction.NeedEnter || s.Action == ClientAction.NeedC) && s.IsUse);
if (tarIdx == -1)
{
Common.LogInfo(string.Format("{0} 已装载料架,A5不需要料架", agv.Name));//小
}
else
{
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["MoveA5"]);
if (rtn)
{
agv.NextPlace = "";
node.AgvName = "";
agv.TaskSend = rtn ? "MoveA5" : "";
Common.LogInfo(string.Format("{0} 已装载料架,送往A5", agv.Name));//小
}
ResetNodeState(node, agv);
CheckA5A6State_SmallShelf(agv, node);
break;
case "G10":
case "G21":
case "G22":
//产线客户端不发FinishLeave
//产线空料架进入小车
//node.AgvName = "";
//node.Action = ClientAction.None;
ResetNodeState(node, agv);
//检查A5、A6需要小料架的状况
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["MoveDoorCToD"]);
if (!rtn)
break;
}
CheckA5A6State_SmallShelf(agv, node);
//int tarIdx = Common.nodeInfo.FindIndex(s => s.Name == "A5"
//&& (s.Action == ClientAction.NeedD || s.Action == ClientAction.NeedEnter) && s.IsUse);
//if (tarIdx == -1)
//{
// Common.LogInfo(string.Format("{0} 已装载小料架,A5不需要料架", agv.Name));//小
//}
//else
//{
// rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["MoveA5"]);
// if (rtn)
// {
// agv.NextPlace = "";
// node.AgvName = "";
// agv.TaskSend = rtn ? "MoveA5" : "";
// Common.LogInfo(string.Format("{0} 已装载小料架,送往A5", agv.Name));//小
// }
// break;
//}
tarIdx = Common.nodeInfo.FindIndex(s => s.Name == "A6" &&
(s.Action == ClientAction.NeedEnter || s.Action == ClientAction.NeedEnterLeave) && s.IsUse);
//tarIdx = Common.nodeInfo.FindIndex(s => s.Name == "A6" &&
//(s.Action == ClientAction.NeedEnter || s.Action == ClientAction.NeedEnterLeave) && s.IsUse);
if (tarIdx == -1)
{
Common.LogInfo(string.Format("{0} 已装载料架,A6不需要料架", agv.Name));//小
}
else
{
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["MoveA6"]);
if (rtn)
{
agv.NextPlace = "";
node.AgvName = "";
agv.TaskSend = rtn ? "MoveA6" : "";
Common.LogInfo(string.Format("{0} 已装载料架,送往A6", agv.Name));//小
}
//if (tarIdx == -1)
//{
// Common.LogInfo(string.Format("{0} 已装载小料架,A6不需要料架", agv.Name));//小
//}
//else
//{
// rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["MoveA6"]);
// if (rtn)
// {
// agv.NextPlace = "";
// node.AgvName = "";
// agv.TaskSend = rtn ? "MoveA6" : "";
// Common.LogInfo(string.Format("{0} 已装载小料架,送往A6", agv.Name));//小
// }
}
//}
break;
}
}
/// <summary>
/// 查看A5、A6需要小料架的状况
/// </summary>
/// <param name="agv"></param>
/// <param name="node"></param>
private void CheckA5A6State_SmallShelf(Agv_Info agv, ClientNode node)
{
bool rtn = false;
int tarIdx = Common.nodeInfo.FindIndex(s => s.Name == "A5"
&& (s.Action == ClientAction.NeedD || s.Action == ClientAction.NeedEnter) && s.AgvName == "" && s.IsUse);
if (tarIdx == -1)
{
Common.LogInfo(string.Format("{0} 已装载小料架,A5不需要料架", agv.Name), false);//小
}
else
{
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["MoveA5"]);
if (rtn)
{
agv.NextPlace = "";
node.AgvName = "";
Common.nodeInfo[tarIdx].AgvName = agv.Name;
agv.TaskSend = rtn ? "MoveA5" : "";
Common.LogInfo(string.Format("{0} 已装载小料架,送往A5", agv.Name));//小
}
return;
}
tarIdx = Common.nodeInfo.FindIndex(s => s.Name == "A6" &&
(s.Action == ClientAction.NeedEnter || s.Action == ClientAction.NeedEnterLeave) && s.AgvName == "" && s.IsUse);
if (tarIdx == -1)
{
StatusCharge(agv);
Common.LogInfo(string.Format("{0} 已装载小料架,A6不需要料架,到待机位等待", agv.Name), false);//小
}
else
{
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["MoveA6"]);
if (rtn)
{
agv.NextPlace = "";
node.AgvName = "";
Common.nodeInfo[tarIdx].AgvName = agv.Name;
agv.TaskSend = rtn ? "MoveA6" : "";
Common.LogInfo(string.Format("{0} 已装载小料架,送往A6", agv.Name));//小
}
}
}
/// <summary>
/// 空闲状态查看A5、A6需要小料架的状况
/// </summary>
/// <param name="agv"></param>
private void CheckA5A6State_SmallShelf(Agv_Info agv)
{
if (agv.TaskSend != "")
return;
bool rtn = false;
int tarIdx = Common.nodeInfo.FindIndex(s => s.Name == "A5"
&& (s.Action == ClientAction.NeedD || s.Action == ClientAction.NeedEnter) && s.AgvName == "" && s.IsUse);
if (tarIdx == -1)
{
Common.log.Debug(string.Format("{0} 已装载料架 {1},A5不需要料架", agv.Name, agv.RFID));//小
}
else
{
rtn = Common.mir.Add_Mission(agv, Common.agvMission["MoveA5"]);
if (rtn)
{
agv.NextPlace = "";
agv.TaskSend = rtn ? "MoveA5" : "";
Common.nodeInfo[tarIdx].AgvName = agv.Name;
Common.LogInfo(string.Format("{0} 已装载料架 {1},送往A5", agv.Name, agv.RFID));//小
}
return;
}
tarIdx = Common.nodeInfo.FindIndex(s => s.Name == "A6" &&
(s.Action == ClientAction.NeedEnter || s.Action == ClientAction.NeedEnterLeave) && s.AgvName == "" && s.IsUse);
if (tarIdx == -1)
{
Common.log.Debug(string.Format("{0} 已装载料架 {1},A6不需要料架", agv.Name, agv.RFID));//小
}
else
{
rtn = Common.mir.Add_Mission(agv, Common.agvMission["MoveA6"]);
if (rtn)
{
agv.NextPlace = "";
agv.TaskSend = rtn ? "MoveA6" : "";
Common.nodeInfo[tarIdx].AgvName = agv.Name;
Common.LogInfo(string.Format("{0} 已装载料架 {1},送往A6", agv.Name, agv.RFID));//小
}
}
}
/// <summary>
/// 空闲 查看A5、A6需要大料架的状况
/// </summary>
/// <param name="agv"></param>
private void CheckA5A6State_BigShelf(Agv_Info agv)
{
bool rtn = false;
int tarIdx = Common.nodeInfo.FindIndex(s => s.Name == "A5"
&& (s.Action == ClientAction.NeedC || s.Action == ClientAction.NeedEnter) && s.IsUse);
if (tarIdx == -1)
{
Common.log.Debug(string.Format("{0} 已装载料架 {1},A5不需要料架", agv.Name, agv.RFID));//小
}
else
{
rtn = Common.mir.Add_Mission(agv, Common.agvMission["MoveA5"]);
if (rtn)
{
agv.NextPlace = "";
agv.TaskSend = rtn ? "MoveA5" : "";
Common.nodeInfo[tarIdx].AgvName = agv.Name;
Common.LogInfo(string.Format("{0} 已装载料架 {1},送往A5", agv.Name, agv.RFID));//小
}
return;
}
tarIdx = Common.nodeInfo.FindIndex(s => s.Name == "A6" &&
(s.Action == ClientAction.NeedEnter || s.Action == ClientAction.NeedEnterLeave) && s.IsUse);
if (tarIdx == -1)
{
Common.log.Debug(string.Format("{0} 已装载料架 {1},A6不需要料架", agv.Name, agv.RFID));//小
}
else
{
rtn = Common.mir.Add_Mission(agv, Common.agvMission["MoveA6"]);
if (rtn)
{
agv.NextPlace = "";
Common.nodeInfo[tarIdx].AgvName = agv.Name;
agv.TaskSend = rtn ? "MoveA6" : "";
Common.LogInfo(string.Format("{0} 已装载料架 {1},送往A6", agv.Name, agv.RFID));//小
}
}
}
/// <summary>
/// 料架离开小车
/// </summary>
/// <param name="idx">agv索引</param>
......@@ -968,7 +1310,7 @@ namespace BLL
/// <param name="idx"></param>
private void StateLeaveFinish(int idx)
{
bool rtn;
Agv_Info agv = Common.agvInfo[idx];
if (agv.TaskSend != "") return;
int index = FindNode(agv.Place);
......@@ -984,16 +1326,19 @@ namespace BLL
//}
//break;
case "A6":
if (node.Action == ClientAction.FinishEnter)
{
Common.LogInfo(string.Format("{0}在{1}完成进入料架", agv.Name, agv.Place));
//agv.RFID = "";
ResetAGVState(agv, true);
ResetNodeState(node);
//查询附近是否有空料架要出,没有则去待机位
if (!CheckEmptyShelf(agv))
MoveStandby(agv);
}
//if (node.Action == ClientAction.FinishEnter)
//{
Common.LogInfo(string.Format("{0}在{1}完成进入料架", agv.Name, agv.Place));
//agv.RFID = "";
//清除执行空架任务的小车
Common.missionManager.AGV_Name_EmptyTask = "";
ResetAGVState(agv, true);
ResetNodeState(node, agv);
//查询附近是否有空料架要出,没有则去待机位
// if (!CheckEmptyShelf(agv, agv.Place))
StatusCharge(agv);
//MoveStandby(agv);
// }
break;
case "E1":
case "E2":
......@@ -1015,11 +1360,78 @@ namespace BLL
/// agv.RFID = "";
// node.AgvName = "";
//node.Action = ClientAction.None;
//上报物料状态
try
{
var key = Common.agvProductionLine.Where(q => q.Value == agv.Place).Select(q => q.Key);
string lineName = key.ToList()[0];
UpdateStatus(agv.RFID, lineName);
}
catch (Exception ex) { Common.log.Error("UpdateStatus " + ex.Message); }
ResetAGVState(agv, true);
ResetNodeState(node, agv);
int tarIdx = Common.nodeInfo.FindIndex(s => s.Name == "A5" && (s.Action == ClientAction.NeedD || s.Action == ClientAction.NeedEnter) && s.IsUse);
if (tarIdx == -1)
{
tarIdx = Common.nodeInfo.FindIndex(s => s.Name == "A6" && (s.Action == ClientAction.NeedEnter || s.Action == ClientAction.NeedEnterLeave) && s.IsUse);
if (tarIdx == -1)
{
Common.LogInfo("A5,A6不需要料架,小车不载空架,直接返回待机位");
StatusCharge(agv);
return;
}
}
//查询附近是否有空料架要出,没有则去待机位
if (!CheckEmptyShelf(agv, agv.Place))
StatusCharge(agv);
//MoveStandby(agv);
break;
case "G10":
case "G21":
case "G22":
/// agv.RFID = "";
// node.AgvName = "";
//node.Action = ClientAction.None;
//上报物料状态
try
{
var key = Common.agvProductionLine.Where(q => q.Value == agv.Place).Select(q => q.Key);
string lineName = key.ToList()[0];
UpdateStatus(agv.RFID, lineName);
}
catch (Exception ex) { Common.log.Error("UpdateStatus " + ex.Message); }
ResetAGVState(agv, true);
ResetNodeState(node);
ResetNodeState(node, agv);
bool rtn = false;
int tarIdx1 = Common.nodeInfo.FindIndex(s => s.Name == "A5" && (s.Action == ClientAction.NeedD || s.Action == ClientAction.NeedEnter) && s.IsUse);
if (tarIdx1 == -1)
{
tarIdx = Common.nodeInfo.FindIndex(s => s.Name == "A6" && (s.Action == ClientAction.NeedEnter || s.Action == ClientAction.NeedEnterLeave) && s.IsUse);
if (tarIdx == -1)
{
Common.LogInfo("A5,A6不需要料架,小车不载空架,直接返回待机位");
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["MoveDoorCToD"]);
if (!rtn)
break;
StatusCharge(agv);
return;
}
}
//查询附近是否有空料架要出,没有则去待机位
if (!CheckEmptyShelf(agv))
MoveStandby(agv);
if (!CheckEmptyShelf(agv, agv.Place))
{
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission["MoveDoorCToD"]);
if (!rtn)
break;
StatusCharge(agv);
}
//MoveStandby(agv);
break;
}
}
......@@ -1028,10 +1440,11 @@ namespace BLL
/// 重置节点状态
/// </summary>
/// <param name="clientNode"></param>
private void ResetNodeState(ClientNode clientNode)
private void ResetNodeState(ClientNode clientNode, Agv_Info agv)
{
clientNode.Action = ClientAction.None;
clientNode.AgvName = "";
if (agv.Name == clientNode.AgvName)
clientNode.AgvName = "";
clientNode.RFID = "";
}
......@@ -1040,7 +1453,7 @@ namespace BLL
/// </summary>
/// <param name="agv"></param>
/// <param name="IsNextPlace">是否清除下一目的地</param>
private void ResetAGVState(Agv_Info agv,bool IsNextPlace=false)
private void ResetAGVState(Agv_Info agv, bool IsNextPlace = false)
{
agv.RFID = "";
if (IsNextPlace)
......@@ -1049,7 +1462,8 @@ namespace BLL
private bool MoveStandby(Agv_Info agv)
{
string log;
if (agv.TaskSend != "")
return false;
//清除当前任务点
if (!agv.Place.Equals(""))
{
......@@ -1091,14 +1505,59 @@ namespace BLL
}
Task<bool> continueTask;
/// <summary>
/// 清空错误并继续任务
/// </summary>
/// <param name="idx"></param>
private bool ClearErrorAndContinueTask(int idx)
{
continueTask = Task.Run<bool>(() =>
{
Agv_Info agv = Common.agvInfo[idx];
Common.LogInfo(string.Format("{0}在执行任务[{1}]出现错误:{2}", agv.Name, agv.TaskSend, agv.MissionText));
if (Common.agvInfo[idx].IsCon)
{
Common.mir.Clear_Error(Common.agvInfo[idx]);
Thread.Sleep(1000);
Common.mir.State_Ready(Common.agvInfo[idx]);
Thread.Sleep(1000);
bool rtn = Common.mir.Add_Mission(Common.agvInfo[idx], Common.agvMission[agv.TaskSend]);
if (!rtn)
return false;
Common.LogInfo(string.Format("{0}清除错误,继续任务", agv.Name, agv.TaskSend, agv.MissionText));
return true;
}
return false;
});
continueTask.Start();
return continueTask.Result;
}
/// <summary>
/// 小车重试次数
/// </summary>
static int[] reTryTimes = new int[Common.agvInfo.Count];
/// <summary>
/// 错误状态
/// </summary>
/// <param name="idx"></param>
private void StateError(int idx)
{
Agv_Info agv = Common.agvInfo[idx];
Common.LogInfo(string.Format("{0}在执行任务[{1}]出现错误:{2}", agv.Name, agv.TaskSend, agv.MissionText));
if (continueTask != null && !continueTask.IsCompleted)
return;
if (reTryTimes[idx] > 5)//重试5次
{
Common.LogInfo(string.Format("{0} 发生错误,重试5次失败,需要手动清除错误!", Common.agvInfo[idx]));
reTryTimes[idx] = 0;
return;
}
if (!ClearErrorAndContinueTask(idx))
reTryTimes[idx]++;
else
reTryTimes[idx] = 0;
}
/// <summary>
/// 查找节点是否存在以及是否调用
......@@ -1139,6 +1598,8 @@ namespace BLL
dest = "";
try
{
if (rfid.Equals("") || rfid.Equals("00"))
return false;
string url = Common.itsHttp + rfid;
var client = new RestClient(url) { Timeout = -1 };
var request = new RestRequest(Method.GET);
......@@ -1148,12 +1609,12 @@ namespace BLL
json = json.Replace("\r", "");
json = json.Replace("\n", "");
json = json.Replace(" ", "");
Common.LogInfo("ITS URL: " + url + " Return: " + json);
Common.LogInfo("ITS URL: " + url + " Return: " + json, false);
if (string.IsNullOrWhiteSpace(json)) return false;
List<BoxDestInfo> res = JsonHelper.DeserializeJsonToList<BoxDestInfo>(json);
//JavaScriptSerializer serializer = new JavaScriptSerializer();
if (res == null || res.Count==0)
if (res == null || res.Count == 0)
return false;
if (res[0].id == rfid)
......@@ -1162,11 +1623,40 @@ namespace BLL
{
res[0].location = "FeederIn";
}
else if (res[0].location.Equals("4CFeeder"))
{
res[0].location = "4CFeederIn";
}
if (Common.agvProductionLine.TryGetValue(res[0].location, out string loc))
{
dest = loc;
Common.LogInfo("出满料架任务:目的地为 "+ loc+" [产线名 "+ res[0].location + "]");
return true;
int i = FindNode(loc);
if (i > -1)
{
#region 检查是否有空料架要出,有则先出空料架
foreach (var item in Common.missionManager.missionList)
{
if (loc.Equals(item.NodeName))
{
Common.LogInfo("节点[" + loc + "]当前有空架任务,延迟A6出满料架任务", false);
return false;
}
}
#endregion
//if (Common.nodeInfo[i].AgvName.Equals("").Equals(false))//有小车在目标任务点,等待结束后再接任务
//{
// Common.LogInfo("节点[" + loc + "]当前有任务,延迟A6出满料架任务");
// return false;
//}
dest = loc;
Common.LogInfo("出满料架任务:目的地为 " + loc + " [产线名 " + res[0].location + "]");
return true;
}
else
{
Common.LogInfo("节点[" + loc + "]不存在或者未开启调用");
return false;
}
}
}
//Dictionary<string, object> dic = (Dictionary<string, object>)serializer.DeserializeObject(json);
......@@ -1205,6 +1695,13 @@ namespace BLL
public string location { get; set; }
}
/// <summary>
/// 大料架接口回复
/// </summary>
public class Msg
{
public string msg { get; set; }
}
}
}
\ No newline at end of file
......@@ -157,30 +157,30 @@ namespace BLL
return result;
}
//public static string Get(string url)
//{
// return Get(url, Encoding.UTF8);
//}
public static string Get(string url)
{
return Get(url, Encoding.UTF8);
}
//public static string Get(string url, Encoding encoding)
//{
// try
// {
// LogUtil.info("HTTP GET FROM: " + url);
// var wc = new WebClient { Encoding = encoding };
// var readStream = wc.OpenRead(url);
// using (var sr = new StreamReader(readStream, encoding))
// {
// var result = sr.ReadToEnd();
// LogUtil.info("receive << " + result);
// return result;
// }
// }
// catch (Exception e)
// {
// LogUtil.error("HTTP GET ERROR:" + e.Message, 2);
// }
// return "";
//}
public static string Get(string url, Encoding encoding)
{
try
{
Common.log.Debug("HTTP GET FROM: " + url);
var wc = new WebClient { Encoding = encoding };
var readStream = wc.OpenRead(url);
using (var sr = new StreamReader(readStream, encoding))
{
var result = sr.ReadToEnd();
Common.log.Debug("receive << " + result);
return result;
}
}
catch (Exception e)
{
Common.log.Error("HTTP GET ERROR:" + e.Message);
}
return "";
}
}
}
\ No newline at end of file
......@@ -358,7 +358,7 @@ namespace BLL
Dictionary<string, object> dic = (Dictionary<string, object>)serializer.DeserializeObject(json);
if (dic == null) return false;
stateID = Convert.ToInt32(dic["state_id"].ToString());
stateID = Convert.ToInt32(dic["state_id"].ToString());
stateText = dic["state_text"].ToString();
mission_text = dic["mission_text"].ToString();
string s = dic["battery_percentage"].ToString();
......@@ -373,7 +373,7 @@ namespace BLL
}
catch (Exception ex)
{
Common.log.Error("Get_State", ex);
//Common.log.Error("Get_State", ex);
return false;
}
}
......@@ -442,7 +442,7 @@ namespace BLL
}
catch (Exception ex)
{
Common.log.Error("State_Ready", ex);
//Common.log.Error("State_Ready", ex);
return false;
}
}
......@@ -525,7 +525,7 @@ namespace BLL
ping.Dispose();
if (result.Status != System.Net.NetworkInformation.IPStatus.Success)
{
Common.LogInfo("Ping " + ip + " 请求没有响应", false);
Common.LogInfo("Ping " + ip + " 请求没有响应");
return false;
}
return true;
......
......@@ -65,7 +65,7 @@ namespace BLL
if (AGVControl.Common.agvProductionLine.TryGetValue(emptyStation, out string value))
{
res = new Result() { Succeed = true, ResultData = null, ErrorMessage = "" };
AGVControl.Common.LogInfo("WebService Response OK");
AGVControl.Common.log.Debug("WebService Response OK");
//加到任务
//int idx = AGVControl.Common.nodeInfo.FindIndex(s => s.Name == value);
......@@ -101,6 +101,10 @@ namespace BLL
{
line = "FeederOut";
}
else if (line.Equals("4CFeeder"))
{
line = "4CFeederOut";
}
AGVControl.Common.LogInfo("WebService Request emptyStation=" + line,false);
//if (line == null)
// res = new Result() { Succeed = "false", ResultData = null, ErrorMessage = "line =null " };
......
......@@ -43,8 +43,6 @@
this.Column16 = new System.Windows.Forms.DataGridViewButtonColumn();
this.Column15 = new System.Windows.Forms.DataGridViewButtonColumn();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.txtBoxMission = new System.Windows.Forms.TextBox();
this.btnDeleteMission = new System.Windows.Forms.Button();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.cmbBoxAGVName = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
......@@ -64,17 +62,22 @@
this.TxtCharge4 = new System.Windows.Forms.TextBox();
this.BtnWriteCharge4 = new System.Windows.Forms.Button();
this.BtnReadCharge4 = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.dgvLineMission = new System.Windows.Forms.DataGridView();
this.BtnClearError = new System.Windows.Forms.Button();
this.BtnMissionAdd = new System.Windows.Forms.Button();
this.BtnMissionPause = new System.Windows.Forms.Button();
this.BtnMissionReady = new System.Windows.Forms.Button();
this.LstAgvPlace = new System.Windows.Forms.ListBox();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.TxtLog = new System.Windows.Forms.TextBox();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.cmbBoxLineName = new System.Windows.Forms.ComboBox();
this.button1 = new System.Windows.Forms.Button();
this.btnDeleteMission = 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.TxtLog = new System.Windows.Forms.TextBox();
this.txtBoxAGV_EmptyTask = new System.Windows.Forms.TextBox();
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
......@@ -88,15 +91,18 @@
this.Column19 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column11 = new System.Windows.Forms.DataGridViewButtonColumn();
this.Column17 = new System.Windows.Forms.DataGridViewButtonColumn();
this.txtAgvRFID = new System.Windows.Forms.TextBox();
this.btnSetRFID = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.DgvAgv)).BeginInit();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.DgvNode)).BeginInit();
this.tabPage3.SuspendLayout();
this.groupBox2.SuspendLayout();
this.tabPage2.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvLineMission)).BeginInit();
this.tabPage2.SuspendLayout();
this.SuspendLayout();
//
// DgvAgv
......@@ -105,8 +111,6 @@
this.DgvAgv.AllowUserToDeleteRows = false;
this.DgvAgv.AllowUserToResizeColumns = false;
this.DgvAgv.AllowUserToResizeRows = false;
this.DgvAgv.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.DgvAgv.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.DgvAgv.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Column1,
......@@ -122,30 +126,29 @@
this.Column19,
this.Column11,
this.Column17});
this.DgvAgv.Location = new System.Drawing.Point(16, 15);
this.DgvAgv.Dock = System.Windows.Forms.DockStyle.Top;
this.DgvAgv.Location = new System.Drawing.Point(0, 0);
this.DgvAgv.Margin = new System.Windows.Forms.Padding(4);
this.DgvAgv.Name = "DgvAgv";
this.DgvAgv.ReadOnly = true;
this.DgvAgv.RowHeadersVisible = false;
this.DgvAgv.RowHeadersWidth = 51;
this.DgvAgv.RowTemplate.Height = 23;
this.DgvAgv.Size = new System.Drawing.Size(1470, 196);
this.DgvAgv.Size = new System.Drawing.Size(1531, 171);
this.DgvAgv.TabIndex = 3;
this.DgvAgv.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.DgvAgv_CellClick);
//
// tabControl1
//
this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Location = new System.Drawing.Point(16, 219);
this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Top;
this.tabControl1.Location = new System.Drawing.Point(0, 171);
this.tabControl1.Margin = new System.Windows.Forms.Padding(4);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(1470, 492);
this.tabControl1.Size = new System.Drawing.Size(1531, 601);
this.tabControl1.TabIndex = 6;
//
// tabPage1
......@@ -155,7 +158,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(1462, 463);
this.tabPage1.Size = new System.Drawing.Size(1523, 572);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "节点";
this.tabPage1.UseVisualStyleBackColor = true;
......@@ -185,7 +188,7 @@
this.DgvNode.RowHeadersVisible = false;
this.DgvNode.RowHeadersWidth = 50;
this.DgvNode.RowTemplate.Height = 23;
this.DgvNode.Size = new System.Drawing.Size(1454, 455);
this.DgvNode.Size = new System.Drawing.Size(1515, 564);
this.DgvNode.TabIndex = 1;
this.DgvNode.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.DgvNode_CellClick);
//
......@@ -196,7 +199,7 @@
this.Column6.Name = "Column6";
this.Column6.ReadOnly = true;
this.Column6.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
this.Column6.Width = 70;
this.Column6.Width = 125;
//
// Column12
//
......@@ -269,10 +272,9 @@
//
// tabPage3
//
this.tabPage3.Controls.Add(this.txtBoxMission);
this.tabPage3.Controls.Add(this.btnDeleteMission);
this.tabPage3.Controls.Add(this.btnSetRFID);
this.tabPage3.Controls.Add(this.txtAgvRFID);
this.tabPage3.Controls.Add(this.groupBox2);
this.tabPage3.Controls.Add(this.groupBox1);
this.tabPage3.Controls.Add(this.BtnClearError);
this.tabPage3.Controls.Add(this.BtnMissionAdd);
this.tabPage3.Controls.Add(this.BtnMissionPause);
......@@ -282,28 +284,11 @@
this.tabPage3.Margin = new System.Windows.Forms.Padding(4);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Padding = new System.Windows.Forms.Padding(4);
this.tabPage3.Size = new System.Drawing.Size(1462, 463);
this.tabPage3.Size = new System.Drawing.Size(1523, 572);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "任务";
this.tabPage3.Text = "agv手动";
this.tabPage3.UseVisualStyleBackColor = true;
//
// txtBoxMission
//
this.txtBoxMission.Location = new System.Drawing.Point(1143, 82);
this.txtBoxMission.Name = "txtBoxMission";
this.txtBoxMission.Size = new System.Drawing.Size(100, 25);
this.txtBoxMission.TabIndex = 34;
//
// btnDeleteMission
//
this.btnDeleteMission.Location = new System.Drawing.Point(1143, 140);
this.btnDeleteMission.Name = "btnDeleteMission";
this.btnDeleteMission.Size = new System.Drawing.Size(100, 48);
this.btnDeleteMission.TabIndex = 33;
this.btnDeleteMission.Text = "删除任务";
this.btnDeleteMission.UseVisualStyleBackColor = true;
this.btnDeleteMission.Click += new System.EventHandler(this.btnDeleteMission_Click);
//
// groupBox2
//
this.groupBox2.Controls.Add(this.cmbBoxAGVName);
......@@ -512,36 +497,9 @@
this.BtnReadCharge4.UseVisualStyleBackColor = true;
this.BtnReadCharge4.Click += new System.EventHandler(this.BtnReadWriteCharge_Click);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.dgvLineMission);
this.groupBox1.Location = new System.Drawing.Point(716, 19);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(392, 434);
this.groupBox1.TabIndex = 31;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "产线任务";
//
// dgvLineMission
//
this.dgvLineMission.AllowUserToAddRows = false;
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.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";
this.dgvLineMission.RowHeadersVisible = false;
this.dgvLineMission.RowHeadersWidth = 51;
this.dgvLineMission.RowTemplate.Height = 27;
this.dgvLineMission.Size = new System.Drawing.Size(386, 410);
this.dgvLineMission.TabIndex = 28;
//
// BtnClearError
//
this.BtnClearError.Location = new System.Drawing.Point(216, 227);
this.BtnClearError.Location = new System.Drawing.Point(1038, 15);
this.BtnClearError.Margin = new System.Windows.Forms.Padding(4);
this.BtnClearError.Name = "BtnClearError";
this.BtnClearError.Size = new System.Drawing.Size(128, 44);
......@@ -552,10 +510,10 @@
//
// BtnMissionAdd
//
this.BtnMissionAdd.Location = new System.Drawing.Point(216, 151);
this.BtnMissionAdd.Location = new System.Drawing.Point(226, 72);
this.BtnMissionAdd.Margin = new System.Windows.Forms.Padding(4);
this.BtnMissionAdd.Name = "BtnMissionAdd";
this.BtnMissionAdd.Size = new System.Drawing.Size(128, 44);
this.BtnMissionAdd.Size = new System.Drawing.Size(128, 78);
this.BtnMissionAdd.TabIndex = 3;
this.BtnMissionAdd.Text = "添加任务";
this.BtnMissionAdd.UseVisualStyleBackColor = true;
......@@ -563,7 +521,7 @@
//
// BtnMissionPause
//
this.BtnMissionPause.Location = new System.Drawing.Point(216, 82);
this.BtnMissionPause.Location = new System.Drawing.Point(882, 15);
this.BtnMissionPause.Margin = new System.Windows.Forms.Padding(4);
this.BtnMissionPause.Name = "BtnMissionPause";
this.BtnMissionPause.Size = new System.Drawing.Size(128, 44);
......@@ -574,7 +532,7 @@
//
// BtnMissionReady
//
this.BtnMissionReady.Location = new System.Drawing.Point(216, 8);
this.BtnMissionReady.Location = new System.Drawing.Point(717, 15);
this.BtnMissionReady.Margin = new System.Windows.Forms.Padding(4);
this.BtnMissionReady.Name = "BtnMissionReady";
this.BtnMissionReady.Size = new System.Drawing.Size(128, 44);
......@@ -593,31 +551,96 @@
this.LstAgvPlace.Location = new System.Drawing.Point(8, 8);
this.LstAgvPlace.Margin = new System.Windows.Forms.Padding(4);
this.LstAgvPlace.Name = "LstAgvPlace";
this.LstAgvPlace.Size = new System.Drawing.Size(199, 447);
this.LstAgvPlace.Size = new System.Drawing.Size(199, 556);
this.LstAgvPlace.TabIndex = 0;
//
// tabPage2
//
this.tabPage2.Controls.Add(this.TxtLog);
this.tabPage2.Controls.Add(this.tableLayoutPanel1);
this.tabPage2.Location = new System.Drawing.Point(4, 25);
this.tabPage2.Margin = new System.Windows.Forms.Padding(4);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(4);
this.tabPage2.Size = new System.Drawing.Size(1462, 463);
this.tabPage2.Size = new System.Drawing.Size(1523, 572);
this.tabPage2.TabIndex = 3;
this.tabPage2.Text = "日志";
this.tabPage2.Text = "日志&产线任务";
this.tabPage2.UseVisualStyleBackColor = true;
//
// TxtLog
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 2;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 45.27163F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 54.72837F));
this.tableLayoutPanel1.Controls.Add(this.groupBox1, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.TxtLog, 0, 0);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(4, 4);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 1;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 480F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(1515, 564);
this.tableLayoutPanel1.TabIndex = 6;
//
this.TxtLog.Dock = System.Windows.Forms.DockStyle.Fill;
this.TxtLog.Location = new System.Drawing.Point(4, 4);
this.TxtLog.Margin = new System.Windows.Forms.Padding(4);
this.TxtLog.Multiline = true;
this.TxtLog.Name = "TxtLog";
this.TxtLog.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.TxtLog.Size = new System.Drawing.Size(1454, 455);
this.TxtLog.TabIndex = 5;
// groupBox1
//
this.groupBox1.Controls.Add(this.txtBoxAGV_EmptyTask);
this.groupBox1.Controls.Add(this.cmbBoxLineName);
this.groupBox1.Controls.Add(this.button1);
this.groupBox1.Controls.Add(this.btnDeleteMission);
this.groupBox1.Controls.Add(this.dgvLineMission);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox1.Location = new System.Drawing.Point(688, 3);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(824, 558);
this.groupBox1.TabIndex = 32;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "产线任务";
//
// cmbBoxLineName
//
this.cmbBoxLineName.FormattingEnabled = true;
this.cmbBoxLineName.Location = new System.Drawing.Point(461, 104);
this.cmbBoxLineName.Name = "cmbBoxLineName";
this.cmbBoxLineName.Size = new System.Drawing.Size(96, 23);
this.cmbBoxLineName.TabIndex = 38;
//
// button1
//
this.button1.Location = new System.Drawing.Point(448, 244);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(138, 65);
this.button1.TabIndex = 37;
this.button1.Text = "Feeder允许进出料";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// btnDeleteMission
//
this.btnDeleteMission.Location = new System.Drawing.Point(457, 152);
this.btnDeleteMission.Name = "btnDeleteMission";
this.btnDeleteMission.Size = new System.Drawing.Size(100, 48);
this.btnDeleteMission.TabIndex = 35;
this.btnDeleteMission.Text = "删除任务";
this.btnDeleteMission.UseVisualStyleBackColor = true;
this.btnDeleteMission.Click += new System.EventHandler(this.btnDeleteMission_Click);
//
// dgvLineMission
//
this.dgvLineMission.AllowUserToAddRows = false;
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;
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";
this.dgvLineMission.RowHeadersVisible = false;
this.dgvLineMission.RowHeadersWidth = 51;
this.dgvLineMission.RowTemplate.Height = 27;
this.dgvLineMission.Size = new System.Drawing.Size(386, 534);
this.dgvLineMission.TabIndex = 28;
//
// Column24
//
......@@ -633,6 +656,24 @@
this.Column8.Name = "Column8";
this.Column8.Width = 80;
//
// TxtLog
//
this.TxtLog.Dock = System.Windows.Forms.DockStyle.Fill;
this.TxtLog.Location = new System.Drawing.Point(4, 4);
this.TxtLog.Margin = new System.Windows.Forms.Padding(4);
this.TxtLog.Multiline = true;
this.TxtLog.Name = "TxtLog";
this.TxtLog.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.TxtLog.Size = new System.Drawing.Size(677, 556);
this.TxtLog.TabIndex = 5;
//
// txtBoxAGV_EmptyTask
//
this.txtBoxAGV_EmptyTask.Location = new System.Drawing.Point(411, 21);
this.txtBoxAGV_EmptyTask.Name = "txtBoxAGV_EmptyTask";
this.txtBoxAGV_EmptyTask.Size = new System.Drawing.Size(100, 25);
this.txtBoxAGV_EmptyTask.TabIndex = 39;
//
// Column1
//
this.Column1.HeaderText = "名称";
......@@ -666,7 +707,7 @@
this.Column21.MinimumWidth = 6;
this.Column21.Name = "Column21";
this.Column21.ReadOnly = true;
this.Column21.Width = 40;
this.Column21.Width = 50;
//
// Column14
//
......@@ -684,7 +725,7 @@
this.Column18.Name = "Column18";
this.Column18.ReadOnly = true;
this.Column18.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
this.Column18.Width = 60;
this.Column18.Width = 80;
//
// Column20
//
......@@ -701,7 +742,7 @@
this.Column4.Name = "Column4";
this.Column4.ReadOnly = true;
this.Column4.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
this.Column4.Width = 50;
this.Column4.Width = 80;
//
// Column23
//
......@@ -744,15 +785,34 @@
this.Column17.ReadOnly = true;
this.Column17.Width = 60;
//
// txtAgvRFID
//
this.txtAgvRFID.Location = new System.Drawing.Point(734, 103);
this.txtAgvRFID.Name = "txtAgvRFID";
this.txtAgvRFID.Size = new System.Drawing.Size(100, 25);
this.txtAgvRFID.TabIndex = 33;
//
// btnSetRFID
//
this.btnSetRFID.Location = new System.Drawing.Point(734, 154);
this.btnSetRFID.Margin = new System.Windows.Forms.Padding(4);
this.btnSetRFID.Name = "btnSetRFID";
this.btnSetRFID.Size = new System.Drawing.Size(100, 44);
this.btnSetRFID.TabIndex = 34;
this.btnSetRFID.Text = "设置RFID";
this.btnSetRFID.UseVisualStyleBackColor = true;
this.btnSetRFID.Click += new System.EventHandler(this.btnSetRFID_Click);
//
// FrmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1502, 726);
this.ClientSize = new System.Drawing.Size(1531, 776);
this.Controls.Add(this.tabControl1);
this.Controls.Add(this.DgvAgv);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(4);
this.MaximizeBox = false;
this.Name = "FrmMain";
this.Text = "AGV产线调度";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmMain_FormClosing);
......@@ -765,10 +825,12 @@
this.tabPage3.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.tabPage2.ResumeLayout(false);
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvLineMission)).EndInit();
this.tabPage2.ResumeLayout(false);
this.tabPage2.PerformLayout();
this.ResumeLayout(false);
}
......@@ -794,17 +856,6 @@
private System.Windows.Forms.Button BtnMissionReady;
private System.Windows.Forms.ListBox LstAgvPlace;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.DataGridView dgvLineMission;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.DataGridViewTextBoxColumn Column6;
private System.Windows.Forms.DataGridViewTextBoxColumn Column12;
private System.Windows.Forms.DataGridViewTextBoxColumn Column22;
private System.Windows.Forms.DataGridViewTextBoxColumn Column7;
private System.Windows.Forms.DataGridViewTextBoxColumn Column9;
private System.Windows.Forms.DataGridViewTextBoxColumn Column10;
private System.Windows.Forms.DataGridViewTextBoxColumn Column5;
private System.Windows.Forms.DataGridViewButtonColumn Column16;
private System.Windows.Forms.DataGridViewButtonColumn Column15;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox TxtCharge5;
......@@ -816,10 +867,24 @@
private System.Windows.Forms.Button BtnReadCharge6;
private System.Windows.Forms.TextBox TxtLog;
private System.Windows.Forms.ComboBox cmbBoxAGVName;
private System.Windows.Forms.DataGridViewTextBoxColumn Column6;
private System.Windows.Forms.DataGridViewTextBoxColumn Column12;
private System.Windows.Forms.DataGridViewTextBoxColumn Column22;
private System.Windows.Forms.DataGridViewTextBoxColumn Column7;
private System.Windows.Forms.DataGridViewTextBoxColumn Column9;
private System.Windows.Forms.DataGridViewTextBoxColumn Column10;
private System.Windows.Forms.DataGridViewTextBoxColumn Column5;
private System.Windows.Forms.DataGridViewButtonColumn Column16;
private System.Windows.Forms.DataGridViewButtonColumn Column15;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button btnDeleteMission;
private System.Windows.Forms.TextBox txtBoxMission;
private System.Windows.Forms.DataGridView dgvLineMission;
private System.Windows.Forms.DataGridViewTextBoxColumn Column24;
private System.Windows.Forms.DataGridViewTextBoxColumn Column8;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.ComboBox cmbBoxLineName;
private System.Windows.Forms.TextBox txtBoxAGV_EmptyTask;
private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
private System.Windows.Forms.DataGridViewTextBoxColumn Column2;
private System.Windows.Forms.DataGridViewTextBoxColumn Column3;
......@@ -833,6 +898,8 @@
private System.Windows.Forms.DataGridViewTextBoxColumn Column19;
private System.Windows.Forms.DataGridViewButtonColumn Column11;
private System.Windows.Forms.DataGridViewButtonColumn Column17;
private System.Windows.Forms.Button btnSetRFID;
private System.Windows.Forms.TextBox txtAgvRFID;
}
}
......@@ -6,6 +6,7 @@ using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
......@@ -23,9 +24,9 @@ namespace AGVControl
InitializeComponent();
showTimer = new System.Timers.Timer();
showTimer.Interval = 3000;
showTimer.Enabled = true;
//showTimer.Enabled = true;
showTimer.Elapsed += ShowTimer_Elapsed;
showTimer.Start();
// showTimer.Start();
Common.logTextBox = TxtLog;
}
......@@ -41,6 +42,12 @@ namespace AGVControl
DgvAgv.Rows[n].DefaultCellStyle.ForeColor = Color.Red;
}
cmbBoxLineName.Items.Add("产线名称");
foreach (var item in Common.agvProductionLine.Keys)
{
cmbBoxLineName.Items.Add(item);
}
cmbBoxLineName.SelectedIndex = 0;
for (int i = 0; i < Common.nodeInfo.Count; i++)
{
n = DgvNode.Rows.Add(Common.nodeInfo[i].ToRow());
......@@ -50,7 +57,7 @@ namespace AGVControl
}
LstAgvPlace.Items.Clear();
LstAgvPlace.Items.AddRange(Common.agvMission.Keys.ToArray());
LstAgvPlace.Items.AddRange(Common.showNameMissionName.Keys.ToArray());
LstAgvPlace.SelectedIndex = 0;
}
......@@ -60,12 +67,14 @@ namespace AGVControl
{
DgvNode.Rows[nodeIndex].SetValues(Common.nodeInfo[nodeIndex].ToRow());
}));
ShowEmptyTask();
System.GC.Collect();
}
private void Server_NodeOnline(int nodeIndex)
{
Invoke(new Action(() => { DgvNode.Rows[nodeIndex].DefaultCellStyle.ForeColor = Common.nodeInfo[nodeIndex].Online ? Color.Black : Color.Red; }));
ShowEmptyTask();
System.GC.Collect();
}
......@@ -75,7 +84,23 @@ namespace AGVControl
{
DgvAgv.Rows[agvIndex].SetValues(Common.agvInfo[agvIndex].ToRow());
}));
if (!Common.missionManager.AGV_Name_EmptyTask.Equals(""))
Invoke(new Action(() =>
{
txtBoxAGV_EmptyTask.Text = Common.missionManager.AGV_Name_EmptyTask;
}));
ShowEmptyTask();
try
{
Invoke(new Action(() =>
{
for (int i = 0; i < Common.nodeInfo.Count; i++)
{
DgvNode.Rows[i].SetValues(Common.nodeInfo[i].ToRow());
}
}));
}
catch { };
System.GC.Collect();
}
......@@ -169,9 +194,14 @@ namespace AGVControl
Common.LogInfo(string.Format("手动清除agv缓存,{0} {1}", Common.agvInfo[e.RowIndex].Name, Common.agvInfo[e.RowIndex].Place));
string place = Common.agvInfo[e.RowIndex].Place;
Common.agvInfo[e.RowIndex].Place = "";
Common.agvInfo[e.RowIndex].PlaceAliceName = "";
Common.agvInfo[e.RowIndex].RFID = "";
Common.agvInfo[e.RowIndex].NextPlace = "";
Common.agvInfo[e.RowIndex].NextPlaceAliceName = "";
Common.agvInfo[e.RowIndex].TaskSend = "";
//清除执行空架任务的小车
if (Common.missionManager.AGV_Name_EmptyTask == Common.agvInfo[e.RowIndex].Name)
Common.missionManager.AGV_Name_EmptyTask = "";
DgvAgv.Rows[e.RowIndex].SetValues(Common.agvInfo[e.RowIndex].ToRow());
//清除节点缓存
......@@ -207,9 +237,9 @@ namespace AGVControl
Common.LogInfo(string.Format("手动清除缓存,{0} {1}", Common.nodeInfo[e.RowIndex].AgvName, Common.nodeInfo[e.RowIndex].Name));
//string name = Common.nodeInfo[e.RowIndex].AgvName;
Common.nodeInfo[e.RowIndex].AgvName = "";
DgvNode.Rows[e.RowIndex].Cells[5].Value = "";
Common.nodeInfo[e.RowIndex].RFID = "";
DgvNode.Rows[e.RowIndex].Cells[4].Value = "";
//清除小车缓存
//int idx = Common.agvInfo.FindIndex(s => s.Name == name);
//if (idx > -1)
......@@ -252,10 +282,10 @@ namespace AGVControl
if (idx < 0) return;
if (Common.agvInfo[idx].IsCon)
{
bool rtn = Common.mir.Add_Mission(Common.agvInfo[idx], Common.agvMission[LstAgvPlace.Text]);
bool rtn = Common.mir.Add_Mission(Common.agvInfo[idx], Common.agvMission[Common.showNameMissionName[LstAgvPlace.Text]]);
if (!rtn)
return;
Common.agvInfo[idx].TaskSend = LstAgvPlace.Text;
//Common.agvInfo[idx].TaskSend = LstAgvPlace.Text;
}
}
......@@ -285,13 +315,13 @@ namespace AGVControl
{
if (dgvLineMission.Rows.Count != 0)
dgvLineMission.Rows.Clear();
foreach (var item in Common.missionList)
foreach (var item in Common.missionManager.missionList)
{
var key = Common.agvProductionLine.Where(q => q.Value == item.NodeName).Select(q => q.Key);
dgvLineMission.Rows.Add(item.CreateTime, key.ToList()[0]);
}
}
catch(Exception ex)
catch (Exception ex)
{
Common.log.Error(ex);
}
......@@ -311,11 +341,11 @@ namespace AGVControl
if (num == 3)
TxtCharge3.Text = Common.chargeStatus.charge3;
else if (num == 4)
TxtCharge4.Text = Common.chargeStatus.charge4;
TxtCharge4.Text = Common.chargeStatus.charge4;
else if (num == 5)
TxtCharge5.Text = Common.chargeStatus.charge5;
else if (num == 6)
TxtCharge6.Text = Common.chargeStatus.charge6;
TxtCharge6.Text = Common.chargeStatus.charge6;
}
else if (name.IndexOf("Write") > 0)
{
......@@ -327,7 +357,7 @@ namespace AGVControl
//}
Common.chargeStatus.charge3 = TxtCharge3.Text;
}
else if (num == 4)
Common.chargeStatus.charge4 = TxtCharge4.Text;
else if (num == 5)
......@@ -337,7 +367,7 @@ namespace AGVControl
if (Common.agvInfo[idx].IsCon)
{
bool rtn = Common.mir.Add_Mission(Common.agvInfo[idx], Common.agvMission["AutoCharge"+num.ToString()]);
bool rtn = Common.mir.Add_Mission(Common.agvInfo[idx], Common.agvMission["AutoCharge" + num.ToString()]);
if (!rtn)
return;
Common.agvInfo[idx].TaskSend = "AutoCharge" + num.ToString();
......@@ -355,9 +385,9 @@ namespace AGVControl
private void cmbBoxAGVName_SelectedIndexChanged(object sender, EventArgs e)
{
if(cmbBoxAGVName.SelectedItem!=null)
if (cmbBoxAGVName.SelectedItem != null)
{
switch(cmbBoxAGVName.SelectedIndex)
switch (cmbBoxAGVName.SelectedIndex)
{
case 0:
TxtCharge4.Text = "MiR_R1763";
......@@ -406,45 +436,60 @@ namespace AGVControl
private void btnDeleteMission_Click(object sender, EventArgs e)
{
if (txtBoxMission.Text == "")
return;
try
{
if (cmbBoxLineName.SelectedItem == null || cmbBoxLineName.SelectedIndex == 0)
{
ShowEmptyTask();
return;
}
if (MessageBox.Show("确定删除产线任务[" + cmbBoxLineName.SelectedItem.ToString() + "]") == DialogResult.Cancel)
return;
//int idx=Common.missionList.FindIndex(s => s.NodeName == Common.agvProductionLine[txtBoxMission.Text]);
if(Common.DelLinePlace(Common.agvProductionLine[txtBoxMission.Text]))
if (Common.DelLinePlace(Common.agvProductionLine[cmbBoxLineName.SelectedItem.ToString()]))
{
//Common.missionList.RemoveAt(idx);
//using (System.IO.StreamWriter file = new System.IO.StreamWriter(Common.CONFIG_PATH + "LinePlace.txt"))
//{
// foreach (var item in Common.missionList)
// {
// file.WriteLine(string.Format("{0},{1}", item.CreateTime, item.NodeName));
// }
//}
txtBoxMission.Text = "";
ShowEmptyTask();
Common.LogInfo("手动删除任务成功:" + cmbBoxLineName.SelectedItem.ToString());
}
else
{
Common.log.Error("手动删除任务失败");
txtBoxMission.Text = "";
ShowEmptyTask();
Common.LogInfo("手动删除任务失败");
}
}
catch(Exception ex)
catch (Exception ex)
{
Common.log.Error("手动删除任务失败:"+ex.Message);
txtBoxMission.Text = "";
ShowEmptyTask();
Common.log.Error("手动删除任务失败:" + ex.Message);
}
}
private void button1_Click(object sender, EventArgs e)
{
Common.MissionStru k = Common.missionList[0];
Common.missionList.Remove(k);
Common.LogInfo("剩余需要出空料架的节点:");
Common.missionList.ForEach(s =>Common.LogInfo(string.Format("创建时间:{0},任务节点{1}",s.CreateTime,s.NodeName)));
Task.Factory.StartNew(new Action(() =>
{
Common.IsAllowLeaveOrEnter = true;
Common.LogInfo("IsAllowLeaveOrEnter="+ Common.IsAllowLeaveOrEnter);
Thread.Sleep(20000);
Common.IsAllowLeaveOrEnter = false;
Common.LogInfo("IsAllowLeaveOrEnter=" + Common.IsAllowLeaveOrEnter);
}
));
}
private void btnSetRFID_Click(object sender, EventArgs e)
{
if (DgvAgv.SelectedCells.Count == 0) return;
int idx = DgvAgv.SelectedCells[0].RowIndex;
if (idx < 0) return;
if (Common.agvInfo[idx].IsCon)
{
Common.agvInfo[idx].RFID = txtAgvRFID.Text.ToUpper();
Common.LogInfo("设置 " + Common.agvInfo[idx].Name +" RFID="+ txtAgvRFID.Text);
}
}
}
}
......@@ -4,6 +4,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
......@@ -40,6 +41,7 @@ namespace AGVControl
}
Common.logTextBox = new TextBox();
Common.missionView = new DataGridView();
Common.missionManager = new MissionManager();
Common.log = log4net.LogManager.GetLogger("AgvServer");
Common.LogInfo("=====程序开始=====");
ReadConfig();
......@@ -76,7 +78,7 @@ namespace AGVControl
Common.agvInfo = new List<Agv_Info>();
path = Common.CONFIG_PATH + "AgvName.csv";
line = System.IO.File.ReadAllLines(path);
line = System.IO.File.ReadAllLines(path,Encoding.UTF8);
for (int i = 1; i < line.Length; i++)
{
temp = line[i].Split(',');
......@@ -86,27 +88,29 @@ namespace AGVControl
}
Common.agvMission = new Dictionary<string, string>();
Common.showNameMissionName = new Dictionary<string, string>();
path = Common.CONFIG_PATH + "AgvMission.csv";
line = System.IO.File.ReadAllLines(path);
for (int i = 0; i < line.Length; i++)
line = System.IO.File.ReadAllLines(path, Encoding.UTF8);
for (int i = 1; i < line.Length; i++)
{
temp = line[i].Split(',');
if (temp.Length != 2) continue;
Common.agvMission.Add(temp[0], temp[1]);
if (temp.Length != 3) continue;
Common.agvMission.Add(temp[1], temp[2]);
Common.showNameMissionName.Add(temp[0], temp[1]);
}
Common.nodeInfo = new List<ClientNode>();
Common.chargeStatus = new ChargeStatus();
Common.agvProductionLine = new Dictionary<string, string>();
path = Common.CONFIG_PATH + "AgvProductionLine.csv";
line = System.IO.File.ReadAllLines(path);
line = System.IO.File.ReadAllLines(path, Encoding.GetEncoding("gb2312"));
for (int i = 1; i < line.Length; i++)
{
temp = line[i].Split(',');
if (temp.Length != 5) continue;
if (temp.Length != 6) continue;
Common.agvProductionLine.Add(temp[0], temp[1]);
bool isUse = Convert.ToBoolean(Common.appConfig.AppSettings.Settings[temp[1]].Value);
Common.nodeInfo.Add(new ClientNode(temp[1], temp[2], isUse,temp[3],temp[4]));
Common.nodeInfo.Add(new ClientNode(temp[1], temp[2],temp[3],temp[4],temp[5], isUse));
}
......
MoveA5,679f2ca1-b520-11ea-b6ad-00012998f5a0
MoveA6,7e5e9dc2-b521-11ea-b6ad-00012998f5a0
MoveE1,73bcddb3-b513-11ea-b6ad-00012998f5a0
MoveE2,9bacf16b-b515-11ea-b6ad-00012998f5a0
MoveE3,f84313b5-b515-11ea-b6ad-00012998f5a0
MoveE4,5683db0e-b516-11ea-b6ad-00012998f5a0
MoveE5,9c04b71b-b516-11ea-b6ad-00012998f5a0
MoveE6,f46be62a-b516-11ea-b6ad-00012998f5a0
MoveE7,
MoveE8,41dccfcf-b517-11ea-b6ad-00012998f5a0
MoveE9,7fc3ec2f-b517-11ea-b6ad-00012998f5a0
MoveE10,e7c0ad9c-b517-11ea-b6ad-00012998f5a0
MoveE11,2e23a510-b518-11ea-b6ad-00012998f5a0
MoveE12,6efb37bc-b519-11ea-b6ad-00012998f5a0
MoveE13,
MoveE14,b03043fd-b519-11ea-b6ad-00012998f5a0
MoveE15,f3f9a668-b519-11ea-b6ad-00012998f5a0
MoveE16,5ec0f64a-b51a-11ea-b6ad-00012998f5a0
MoveE21,37401585-b51b-11ea-b6ad-00012998f5a0
MoveE22,a4846723-b51b-11ea-b6ad-00012998f5a0
Init,adcb7a04-b525-11ea-b6ad-00012998f5a0
Enter,51233d8c-c044-11ea-9a66-94c691a7387d
Leave,2e433130-c045-11ea-9a66-94c691a7387d
MoveStandby,ae6e4f12-c050-11ea-9a66-94c691a7387d
AutoCharge3,b7371c5f-c045-11ea-9a66-94c691a7387d
AutoCharge4,1296084c-c046-11ea-9a66-94c691a7387d
AutoCharge5,40c8f44e-c046-11ea-9a66-94c691a7387d
AutoCharge6,56cca0a3-c046-11ea-9a66-94c691a7387d
产线任务名称,任务名称,任务GUID
下料区(A5),MoveA5,679f2ca1-b520-11ea-b6ad-00012998f5a0
上料区(A6),MoveA6,7e5e9dc2-b521-11ea-b6ad-00012998f5a0
4D-1线,MoveE1,73bcddb3-b513-11ea-b6ad-00012998f5a0
4D-2线,MoveE2,9bacf16b-b515-11ea-b6ad-00012998f5a0
4D-3线,MoveE3,f84313b5-b515-11ea-b6ad-00012998f5a0
4D-4线,MoveE4,5683db0e-b516-11ea-b6ad-00012998f5a0
4D-5线,MoveE5,9c04b71b-b516-11ea-b6ad-00012998f5a0
4D-6线,MoveE6,f46be62a-b516-11ea-b6ad-00012998f5a0
4D-8线,MoveE8,41dccfcf-b517-11ea-b6ad-00012998f5a0
4D-9线,MoveE9,7fc3ec2f-b517-11ea-b6ad-00012998f5a0
4D-10线,MoveE10,e7c0ad9c-b517-11ea-b6ad-00012998f5a0
4D-11线,MoveE11,2e23a510-b518-11ea-b6ad-00012998f5a0
4D-12线,MoveE12,6efb37bc-b519-11ea-b6ad-00012998f5a0
4D-14线,MoveE14,b03043fd-b519-11ea-b6ad-00012998f5a0
4D-15线,MoveE15,f3f9a668-b519-11ea-b6ad-00012998f5a0
4D-16线,MoveE16,5ec0f64a-b51a-11ea-b6ad-00012998f5a0
4D-FeedeerIn,MoveE21,37401585-b51b-11ea-b6ad-00012998f5a0
4D-FeederOut,MoveE22,a4846723-b51b-11ea-b6ad-00012998f5a0
4C-4D门,MoveDoorCToD,d67f31c8-ca7e-11ea-9a66-94c691a7387d
4D-4C门,MoveDoorDToC,fd6e26ac-c1bf-11ea-9a66-94c691a7387d
4C-10线,MoveG10,c0b75c41-ca7d-11ea-9a66-94c691a7387d
4C-FeedeerIn,MoveG21,0a657afd-ca9d-11ea-9a66-94c691a7387d
4C-FeedeerOut,MoveG22,0a657afd-ca9d-11ea-9a66-94c691a7387d
小车初始化,Init,adcb7a04-b525-11ea-b6ad-00012998f5a0
小车进料,Enter,51233d8c-c044-11ea-9a66-94c691a7387d
小车出料,Leave,2e433130-c045-11ea-9a66-94c691a7387d
待机位,MoveStandby,ae6e4f12-c050-11ea-9a66-94c691a7387d
1764充电桩,AutoCharge3,b7371c5f-c045-11ea-9a66-94c691a7387d
1763充电桩,AutoCharge4,1296084c-c046-11ea-9a66-94c691a7387d
1767充电桩,AutoCharge5,40c8f44e-c046-11ea-9a66-94c691a7387d
1768充电桩,AutoCharge6,56cca0a3-c046-11ea-9a66-94c691a7387d
²úÏßÃû,½ÚµãÃû,IP,λÖÃÃû³Æ,λÖÃguid
A5,A5,10.85.199.20,PA5,7ed952c3-b520-11ea-b6ad-00012998f5a0
A6,A6,10.85.199.20,PA6,929eb1c2-b520-11ea-b6ad-00012998f5a0
D1,E1,10.85.199.42,DL1,3b823fe4-b368-11ea-a1a5-00012999830e
D2,E2,10.85.199.90,DL2,ede15fcb-b367-11ea-a1a5-00012999830e
D3,E3,10.85.199.91,DL3,43855a9b-b365-11ea-a1a5-00012999830e
D4,E4,10.85.199.92,DL4,73c8b98c-b368-11ea-a1a5-00012999830e
D5,E5,10.85.199.93,DL5,5436efd7-b432-11ea-a1a5-00012999830e
D6,E6,10.85.199.94,DL6,6b7710c1-b432-11ea-a1a5-00012999830e
D8,E8,10.85.199.95,DL8,8f039d2e-b432-11ea-a1a5-00012999830e
D9,E9,10.85.199.180,DL9,9e0b64ab-b432-11ea-a1a5-00012999830e
D10,E10,10.85.199.181,DL10,aec7da80-b432-11ea-a1a5-00012999830e
D11,E11,10.85.199.182,DL11,c10984c9-b432-11ea-a1a5-00012999830e
D12,E12,10.85.199.183,DL12,d6e0b92a-b432-11ea-a1a5-00012999830e
D14,E14,10.85.199.184,DL14,efb04c55-b432-11ea-a1a5-00012999830e
D15,E15,10.85.199.185,DL15,fd6b1f95-b432-11ea-a1a5-00012999830e
D16,E16,10.85.199.96,line_16,ac6c413e-895e-11ea-9374-000129922ca6
Feeder,E21,,PA21,
FeederOut,E22,,PA22,
C1,G1,,PA23,
C2,G2,,PA24,
C3,G3,,PA25,
C4,G4,,PA26,
C5,G5,,PA27,
C6,G6,,PA28,
C7,G7,,PA29,
C8,G8,,PA30,
C9,G9,,PA31,
C10,G10,,PA32,
C11,G11,,PA33,
C12,G12,,PA34,
C13,G13,,PA35,
C14,G14,,PA36,
C15,G15,,PA37,
C16,G16,,PA38,
²úÏßÃû,½ÚµãÃû,IP,λÖÃÃû³Æ,λÖÃguid
A5,A5,,PA5,7ed952c3-b520-11ea-b6ad-00012998f5a0
A6,A6,,PA6,929eb1c2-b520-11ea-b6ad-00012998f5a0
D1,E1,10.85.199.42,DL1,3b823fe4-b368-11ea-a1a5-00012999830e
D2,E2,10.85.199.90,DL2,ede15fcb-b367-11ea-a1a5-00012999830e
D3,E3,10.85.199.91,DL3,43855a9b-b365-11ea-a1a5-00012999830e
D4,E4,10.85.199.92,DL4,73c8b98c-b368-11ea-a1a5-00012999830e
D5,E5,10.85.199.93,DL5,5436efd7-b432-11ea-a1a5-00012999830e
D6,E6,10.85.199.94,DL6,6b7710c1-b432-11ea-a1a5-00012999830e
D8,E8,10.85.199.95,DL8,8f039d2e-b432-11ea-a1a5-00012999830e
D9,E9,10.85.199.180,DL9,9e0b64ab-b432-11ea-a1a5-00012999830e
D10,E10,10.85.199.181,DL10,aec7da80-b432-11ea-a1a5-00012999830e
D11,E11,10.85.199.182,DL11,c10984c9-b432-11ea-a1a5-00012999830e
D12,E12,10.85.199.183,DL12,d6e0b92a-b432-11ea-a1a5-00012999830e
D14,E14,10.85.199.184,DL14,efb04c55-b432-11ea-a1a5-00012999830e
D15,E15,10.85.199.185,DL15,fd6b1f95-b432-11ea-a1a5-00012999830e
D16,E16,10.85.199.96,line_16,ac6c413e-895e-11ea-9374-000129922ca6
FeederIn,E21,,PA21,
FeederOut,E22,,PA22,
C1,G1,,PA23,
C2,G2,,PA24,
C3,G3,,PA25,
C4,G4,,PA26,
C5,G5,,PA27,
C6,G6,,PA28,
C7,G7,,PA29,
C8,G8,,PA30,
C9,G9,,PA31,
C10,G10,,PA32,
C11,G11,,PA33,
C12,G12,,PA34,
C13,G13,,PA35,
C14,G14,,PA36,
C15,G15,,PA37,
C16,G16,,PA38,
产线名,节点名,IP,产线别名,位置名称,位置guid
A5,A5,10.85.199.20,下料区(A5),PA5,7ed952c3-b520-11ea-b6ad-00012998f5a0
A6,A6,10.85.199.20,上料区(A6),PA6,929eb1c2-b520-11ea-b6ad-00012998f5a0
D1,E1,10.85.199.1,4D-1线,DL1,3b823fe4-b368-11ea-a1a5-00012999830e
D2,E2,10.85.199.1,4D-2线,DL2,ede15fcb-b367-11ea-a1a5-00012999830e
D3,E3,10.85.199.1,4D-3线,DL3,43855a9b-b365-11ea-a1a5-00012999830e
D4,E4,10.85.199.1,4D-4线,DL4,73c8b98c-b368-11ea-a1a5-00012999830e
D5,E5,10.85.199.1,4D-5线,DL5,5436efd7-b432-11ea-a1a5-00012999830e
D6,E6,10.85.199.1,4D-6线,DL6,6b7710c1-b432-11ea-a1a5-00012999830e
D8,E8,10.85.199.1,4D-8线,DL8,8f039d2e-b432-11ea-a1a5-00012999830e
D9,E9,10.85.199.1,4D-9线,DL9,9e0b64ab-b432-11ea-a1a5-00012999830e
D10,E10,10.85.199.1,4D-10线,DL10,aec7da80-b432-11ea-a1a5-00012999830e
D11,E11,10.85.199.1,4D-11线,DL11,c10984c9-b432-11ea-a1a5-00012999830e
D12,E12,10.85.199.1,4D-12线,DL12,d6e0b92a-b432-11ea-a1a5-00012999830e
D14,E14,10.85.199.1,4D-14线,DL14,efb04c55-b432-11ea-a1a5-00012999830e
D15,E15,10.85.199.1,4D-15线,DL15,fd6b1f95-b432-11ea-a1a5-00012999830e
D16,E16,10.85.199.1,4D-16线,line_16,ac6c413e-895e-11ea-9374-000129922ca6
FeederIn,E21,10.85.199.1,4D-FeedeerIn,FI,1e546c3a-8abe-11ea-ab63-000129922ca6
FeederOut,E22,10.85.199.1,4D-FeederOut,FO,431649a4-8abe-11ea-ab63-000129922ca6
C10,G10,10.85.199.1,4C-10线,G10,604b1c3c-ca4e-11ea-810b-00012999830e
4CFeederIn,G21,10.85.199.1,4C-FeederIn,tyty,cb7f117b-ca88-11ea-9b28-0001299981d4
4CFeederOut,G22,10.85.199.1,4C-FeederOut,tyty,cb7f117b-ca88-11ea-9b28-0001299981d4
C1,G1,10.85.199.1,4C-1线,PA23,
C2,G2,10.85.199.1,4C-2线,PA24,
C3,G3,10.85.199.1,4C-3线,PA25,
C4,G4,10.85.199.1,4C-4线,PA26,
C5,G5,10.85.199.1,4C-5线,PA27,
C6,G6,10.85.199.1,4C-6线,PA28,
C7,G7,10.85.199.1,4C-7线,PA29,
C8,G8,10.85.199.1,4C-8线,PA30,
C9,G9,10.85.199.1,4C-9线,PA31,
C11,G11,10.85.199.1,4C-11线,PA33,
C12,G12,10.85.199.1,4C-12线,PA34,
C13,G13,10.85.199.1,4C-13线,PA35,
C14,G14,10.85.199.1,4C-14线,PA36,
C15,G15,10.85.199.1,4C-15线,PA37,
C16,G16,10.85.199.1,4C-16线,PA38,
2020-07-15 21:20:59,E22
2020-07-15 21:21:01,E22
2020-07-15 21:21:02,E22
2020-07-15 21:21:03,E22
2020-07-15 21:21:03,E22
2020-07-15 21:21:07,E22
2020-07-15 21:21:17,E22
2020-07-15 21:21:17,E22
2020-07-15 21:21:19,E22
2020-07-15 21:21:19,E22
......@@ -33,3 +33,4 @@ C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl-ProductionLine.pdb
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\bin\Debug\Newtonsoft.Json.dll
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl-ProductionLine.csproj.CoreCompileInputs.cache
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl-ProductionLine.csprojAssemblyReference.cache
此文件类型无法预览
......@@ -53,6 +53,7 @@
this.button19 = new System.Windows.Forms.Button();
this.button20 = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.button18 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.checkBox1 = new System.Windows.Forms.CheckBox();
......@@ -63,13 +64,14 @@
//
// button1
//
this.button1.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button1.Location = new System.Drawing.Point(316, 54);
this.button1.Location = new System.Drawing.Point(455, 49);
this.button1.Margin = new System.Windows.Forms.Padding(4);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(115, 72);
this.button1.Size = new System.Drawing.Size(115, 37);
this.button1.TabIndex = 0;
this.button1.Text = "改变状态";
this.button1.Text = "设置";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
......@@ -78,10 +80,10 @@
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(81, 94);
this.comboBox1.Location = new System.Drawing.Point(285, 54);
this.comboBox1.Margin = new System.Windows.Forms.Padding(4);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(227, 32);
this.comboBox1.Size = new System.Drawing.Size(153, 32);
this.comboBox1.TabIndex = 2;
//
// comboBox2
......@@ -127,12 +129,12 @@
this.comboBox2.Location = new System.Drawing.Point(81, 54);
this.comboBox2.Margin = new System.Windows.Forms.Padding(4);
this.comboBox2.Name = "comboBox2";
this.comboBox2.Size = new System.Drawing.Size(227, 32);
this.comboBox2.Size = new System.Drawing.Size(153, 32);
this.comboBox2.TabIndex = 3;
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(208, 22);
this.textBox1.Location = new System.Drawing.Point(105, 22);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(100, 25);
this.textBox1.TabIndex = 4;
......@@ -140,7 +142,7 @@
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(120, 25);
this.label1.Location = new System.Drawing.Point(17, 25);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(71, 15);
this.label1.TabIndex = 5;
......@@ -158,7 +160,7 @@
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(8, 111);
this.label3.Location = new System.Drawing.Point(241, 71);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(37, 15);
this.label3.TabIndex = 7;
......@@ -167,7 +169,7 @@
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(479, 64);
this.label4.Location = new System.Drawing.Point(239, 22);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(55, 15);
this.label4.TabIndex = 8;
......@@ -176,10 +178,10 @@
// button3
//
this.button3.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button3.Location = new System.Drawing.Point(13, 166);
this.button3.Location = new System.Drawing.Point(372, 108);
this.button3.Margin = new System.Windows.Forms.Padding(4);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(115, 47);
this.button3.Size = new System.Drawing.Size(63, 47);
this.button3.TabIndex = 10;
this.button3.Text = "E6";
this.button3.UseVisualStyleBackColor = true;
......@@ -188,10 +190,10 @@
// button4
//
this.button4.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button4.Location = new System.Drawing.Point(146, 108);
this.button4.Location = new System.Drawing.Point(84, 108);
this.button4.Margin = new System.Windows.Forms.Padding(4);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(115, 47);
this.button4.Size = new System.Drawing.Size(63, 47);
this.button4.TabIndex = 11;
this.button4.Text = "E2";
this.button4.UseVisualStyleBackColor = true;
......@@ -200,22 +202,22 @@
// button6
//
this.button6.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button6.Location = new System.Drawing.Point(269, 218);
this.button6.Location = new System.Drawing.Point(443, 47);
this.button6.Margin = new System.Windows.Forms.Padding(4);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(115, 47);
this.button6.Size = new System.Drawing.Size(63, 47);
this.button6.TabIndex = 13;
this.button6.Text = "E13";
this.button6.Text = "G10";
this.button6.UseVisualStyleBackColor = true;
this.button6.Click += new System.EventHandler(this.SetLineState);
//
// button7
//
this.button7.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button7.Location = new System.Drawing.Point(402, 163);
this.button7.Location = new System.Drawing.Point(585, 108);
this.button7.Margin = new System.Windows.Forms.Padding(4);
this.button7.Name = "button7";
this.button7.Size = new System.Drawing.Size(115, 47);
this.button7.Size = new System.Drawing.Size(63, 47);
this.button7.TabIndex = 14;
this.button7.Text = "E9";
this.button7.UseVisualStyleBackColor = true;
......@@ -224,10 +226,10 @@
// button8
//
this.button8.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button8.Location = new System.Drawing.Point(536, 108);
this.button8.Location = new System.Drawing.Point(301, 108);
this.button8.Margin = new System.Windows.Forms.Padding(4);
this.button8.Name = "button8";
this.button8.Size = new System.Drawing.Size(115, 47);
this.button8.Size = new System.Drawing.Size(63, 47);
this.button8.TabIndex = 15;
this.button8.Text = "E5";
this.button8.UseVisualStyleBackColor = true;
......@@ -235,11 +237,12 @@
//
// button9
//
this.button9.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button9.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button9.Location = new System.Drawing.Point(13, 111);
this.button9.Location = new System.Drawing.Point(13, 108);
this.button9.Margin = new System.Windows.Forms.Padding(4);
this.button9.Name = "button9";
this.button9.Size = new System.Drawing.Size(115, 47);
this.button9.Size = new System.Drawing.Size(63, 47);
this.button9.TabIndex = 16;
this.button9.Text = "E1";
this.button9.UseVisualStyleBackColor = true;
......@@ -248,10 +251,10 @@
// button10
//
this.button10.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button10.Location = new System.Drawing.Point(536, 163);
this.button10.Location = new System.Drawing.Point(13, 163);
this.button10.Margin = new System.Windows.Forms.Padding(4);
this.button10.Name = "button10";
this.button10.Size = new System.Drawing.Size(115, 47);
this.button10.Size = new System.Drawing.Size(63, 47);
this.button10.TabIndex = 17;
this.button10.Text = "E10";
this.button10.UseVisualStyleBackColor = true;
......@@ -260,10 +263,10 @@
// button11
//
this.button11.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button11.Location = new System.Drawing.Point(402, 218);
this.button11.Location = new System.Drawing.Point(301, 163);
this.button11.Margin = new System.Windows.Forms.Padding(4);
this.button11.Name = "button11";
this.button11.Size = new System.Drawing.Size(115, 47);
this.button11.Size = new System.Drawing.Size(63, 47);
this.button11.TabIndex = 18;
this.button11.Text = "E14";
this.button11.UseVisualStyleBackColor = true;
......@@ -272,10 +275,10 @@
// button12
//
this.button12.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button12.Location = new System.Drawing.Point(655, 218);
this.button12.Location = new System.Drawing.Point(443, 163);
this.button12.Margin = new System.Windows.Forms.Padding(4);
this.button12.Name = "button12";
this.button12.Size = new System.Drawing.Size(115, 47);
this.button12.Size = new System.Drawing.Size(63, 47);
this.button12.TabIndex = 28;
this.button12.Text = "E16";
this.button12.UseVisualStyleBackColor = true;
......@@ -284,10 +287,10 @@
// button13
//
this.button13.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button13.Location = new System.Drawing.Point(146, 218);
this.button13.Location = new System.Drawing.Point(155, 163);
this.button13.Margin = new System.Windows.Forms.Padding(4);
this.button13.Name = "button13";
this.button13.Size = new System.Drawing.Size(115, 47);
this.button13.Size = new System.Drawing.Size(63, 47);
this.button13.TabIndex = 27;
this.button13.Text = "E12";
this.button13.UseVisualStyleBackColor = true;
......@@ -296,10 +299,10 @@
// button14
//
this.button14.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button14.Location = new System.Drawing.Point(269, 111);
this.button14.Location = new System.Drawing.Point(159, 108);
this.button14.Margin = new System.Windows.Forms.Padding(4);
this.button14.Name = "button14";
this.button14.Size = new System.Drawing.Size(115, 47);
this.button14.Size = new System.Drawing.Size(63, 47);
this.button14.TabIndex = 26;
this.button14.Text = "E3";
this.button14.UseVisualStyleBackColor = true;
......@@ -308,22 +311,22 @@
// button15
//
this.button15.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button15.Location = new System.Drawing.Point(146, 166);
this.button15.Location = new System.Drawing.Point(514, 47);
this.button15.Margin = new System.Windows.Forms.Padding(4);
this.button15.Name = "button15";
this.button15.Size = new System.Drawing.Size(115, 47);
this.button15.Size = new System.Drawing.Size(63, 47);
this.button15.TabIndex = 25;
this.button15.Text = "E7";
this.button15.Text = "G21";
this.button15.UseVisualStyleBackColor = true;
this.button15.Click += new System.EventHandler(this.SetLineState);
//
// button16
//
this.button16.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button16.Location = new System.Drawing.Point(11, 218);
this.button16.Location = new System.Drawing.Point(84, 163);
this.button16.Margin = new System.Windows.Forms.Padding(4);
this.button16.Name = "button16";
this.button16.Size = new System.Drawing.Size(115, 47);
this.button16.Size = new System.Drawing.Size(63, 47);
this.button16.TabIndex = 24;
this.button16.Text = "E11";
this.button16.UseVisualStyleBackColor = true;
......@@ -332,10 +335,10 @@
// button17
//
this.button17.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button17.Location = new System.Drawing.Point(536, 218);
this.button17.Location = new System.Drawing.Point(372, 163);
this.button17.Margin = new System.Windows.Forms.Padding(4);
this.button17.Name = "button17";
this.button17.Size = new System.Drawing.Size(115, 47);
this.button17.Size = new System.Drawing.Size(63, 47);
this.button17.TabIndex = 23;
this.button17.Text = "E15";
this.button17.UseVisualStyleBackColor = true;
......@@ -344,10 +347,10 @@
// button19
//
this.button19.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button19.Location = new System.Drawing.Point(402, 108);
this.button19.Location = new System.Drawing.Point(230, 108);
this.button19.Margin = new System.Windows.Forms.Padding(4);
this.button19.Name = "button19";
this.button19.Size = new System.Drawing.Size(115, 47);
this.button19.Size = new System.Drawing.Size(63, 47);
this.button19.TabIndex = 21;
this.button19.Text = "E4";
this.button19.UseVisualStyleBackColor = true;
......@@ -356,10 +359,10 @@
// button20
//
this.button20.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button20.Location = new System.Drawing.Point(269, 166);
this.button20.Location = new System.Drawing.Point(514, 108);
this.button20.Margin = new System.Windows.Forms.Padding(4);
this.button20.Name = "button20";
this.button20.Size = new System.Drawing.Size(115, 47);
this.button20.Size = new System.Drawing.Size(63, 47);
this.button20.TabIndex = 20;
this.button20.Text = "E8";
this.button20.UseVisualStyleBackColor = true;
......@@ -367,6 +370,7 @@
//
// groupBox1
//
this.groupBox1.Controls.Add(this.button18);
this.groupBox1.Controls.Add(this.button5);
this.groupBox1.Controls.Add(this.button2);
this.groupBox1.Controls.Add(this.checkBox1);
......@@ -388,20 +392,32 @@
this.groupBox1.Controls.Add(this.button19);
this.groupBox1.Controls.Add(this.button11);
this.groupBox1.Controls.Add(this.button20);
this.groupBox1.Location = new System.Drawing.Point(12, 145);
this.groupBox1.Location = new System.Drawing.Point(11, 109);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(796, 311);
this.groupBox1.Size = new System.Drawing.Size(692, 260);
this.groupBox1.TabIndex = 29;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "产线";
//
// button18
//
this.button18.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button18.Location = new System.Drawing.Point(585, 47);
this.button18.Margin = new System.Windows.Forms.Padding(4);
this.button18.Name = "button18";
this.button18.Size = new System.Drawing.Size(63, 47);
this.button18.TabIndex = 34;
this.button18.Text = "G22";
this.button18.UseVisualStyleBackColor = true;
this.button18.Click += new System.EventHandler(this.SetLineState);
//
// button5
//
this.button5.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button5.Location = new System.Drawing.Point(659, 166);
this.button5.Location = new System.Drawing.Point(585, 163);
this.button5.Margin = new System.Windows.Forms.Padding(4);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(115, 47);
this.button5.Size = new System.Drawing.Size(63, 47);
this.button5.TabIndex = 33;
this.button5.Text = "E22";
this.button5.UseVisualStyleBackColor = true;
......@@ -410,10 +426,10 @@
// button2
//
this.button2.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.button2.Location = new System.Drawing.Point(659, 108);
this.button2.Location = new System.Drawing.Point(514, 163);
this.button2.Margin = new System.Windows.Forms.Padding(4);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(115, 47);
this.button2.Size = new System.Drawing.Size(63, 47);
this.button2.TabIndex = 32;
this.button2.Text = "E21";
this.button2.UseVisualStyleBackColor = true;
......@@ -422,7 +438,9 @@
// checkBox1
//
this.checkBox1.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(13, 33);
this.checkBox1.Checked = true;
this.checkBox1.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBox1.Location = new System.Drawing.Point(13, 24);
this.checkBox1.Name = "checkBox1";
this.checkBox1.Size = new System.Drawing.Size(89, 19);
this.checkBox1.TabIndex = 31;
......@@ -432,7 +450,7 @@
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(342, 79);
this.label5.Location = new System.Drawing.Point(206, 24);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(55, 15);
this.label5.TabIndex = 30;
......@@ -443,7 +461,7 @@
this.comboBox3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox3.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.comboBox3.FormattingEnabled = true;
this.comboBox3.Location = new System.Drawing.Point(13, 68);
this.comboBox3.Location = new System.Drawing.Point(8, 62);
this.comboBox3.Margin = new System.Windows.Forms.Padding(4);
this.comboBox3.Name = "comboBox3";
this.comboBox3.Size = new System.Drawing.Size(166, 32);
......@@ -453,7 +471,8 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(820, 490);
this.ClientSize = new System.Drawing.Size(723, 388);
this.ControlBox = false;
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
......@@ -464,8 +483,11 @@
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.button1);
this.Margin = new System.Windows.Forms.Padding(4);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Form1";
this.Text = "agv对接客户端";
this.ShowIcon = false;
this.Text = "agv对接模拟客户端";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
this.Load += new System.EventHandler(this.Form1_Load);
this.groupBox1.ResumeLayout(false);
......@@ -507,6 +529,7 @@
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button18;
}
}
......@@ -47,6 +47,9 @@ namespace AgvClientTest
client.SetStatus("E16", "", AsaPL.ClientAction.None);
client.SetStatus("E21", "", AsaPL.ClientAction.None);
client.SetStatus("E22", "", AsaPL.ClientAction.None);
client.SetStatus("G10", "", AsaPL.ClientAction.None);
client.SetStatus("G21", "", AsaPL.ClientAction.None);
client.SetStatus("G22", "", AsaPL.ClientAction.None);
client.Connect();
}
......
此文件的差异太大,无法显示。
[2020-07-16 16:30:07,101][1]INFO SetStatus Name=E1, Action=None, Level=Low
[2020-07-16 16:30:07,108][1]INFO SetStatus Name=E2, Action=None, Level=Low
[2020-07-16 16:30:07,108][1]INFO SetStatus Name=E3, Action=None, Level=Low
[2020-07-16 16:30:07,108][1]INFO SetStatus Name=E4, Action=None, Level=Low
[2020-07-16 16:30:07,108][1]INFO SetStatus Name=E5, Action=None, Level=Low
[2020-07-16 16:30:07,108][1]INFO SetStatus Name=E6, Action=None, Level=Low
[2020-07-16 16:30:07,108][1]INFO SetStatus Name=E8, Action=None, Level=Low
[2020-07-16 16:30:07,108][1]INFO SetStatus Name=E9, Action=None, Level=Low
[2020-07-16 16:30:07,108][1]INFO SetStatus Name=E10, Action=None, Level=Low
[2020-07-16 16:30:07,108][1]INFO SetStatus Name=E11, Action=None, Level=Low
[2020-07-16 16:30:07,108][1]INFO SetStatus Name=E12, Action=None, Level=Low
[2020-07-16 16:30:07,108][1]INFO SetStatus Name=E14, Action=None, Level=Low
[2020-07-16 16:30:07,108][1]INFO SetStatus Name=E15, Action=None, Level=Low
[2020-07-16 16:30:07,108][1]INFO SetStatus Name=E16, Action=None, Level=Low
[2020-07-16 16:30:07,108][1]INFO SetStatus Name=E21, Action=None, Level=Low
[2020-07-16 16:30:07,108][1]INFO SetStatus Name=E22, Action=None, Level=Low
[2020-07-16 16:30:07,135][1]INFO Connect
[2020-07-16 16:30:07,136][3]INFO Connect 10.85.199.1:9501
[2020-07-16 16:30:07,159][3]INFO Connect OK
[2020-07-16 16:30:07,159][3]INFO Server connection successful
[2020-07-16 16:30:09,967][1]INFO Close
[2020-07-16 16:30:09,968][5]INFO 服务器没有连接
......@@ -24,3 +24,4 @@ C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\obj\Debug\AgvClientTe
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\obj\Debug\AgvClientTest.exe
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\obj\Debug\AgvClientTest.pdb
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\obj\Debug\AgvClientTest.csproj.CoreCompileInputs.cache
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\obj\Debug\AgvClientTest.csprojAssemblyReference.cache
......@@ -78,6 +78,84 @@ namespace BLL
}
return rb;
}
/// <summary>
/// 获取大料架解绑情况
/// </summary>
/// <param name="rfid"></param>
/// <param name="lineName"></param>
/// <returns></returns>
public static bool GetRackBy(string rfid, out string lineName)
{
lineName = "";
//GET /ESMTCommonInterface/CommonService.asmx/GetRackBy?id=string HTTP/1.1
//Host: 10.85.17.233
string addr = "http://10.85.17.233/ESMTCommonInterface/CommonService.asmx/GetRackBy?id=" + rfid;
//[{"msg":"1OKD1"}]
//[{"msg":"0NGFeeder"}]
try
{
string result = HttpUtil.Get(addr);
if (!result.Equals(""))
{
List<Msg> msgs = JsonHelper.DeserializeJsonToList<Msg>(result);
if (msgs == null || msgs.Count == 0)
return false;
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.log.Debug(string.Format("resCode={0},resStr={1},lineName={2}", resCode, resStr, lineName));
if (lineName.Equals("").Equals(true))
return false;
return true;
}
}
catch { return false; }
return false;
}
/// <summary>
/// 物料状态上报
/// </summary>
/// <param name="rfid"></param>
/// <param name="lineName"></param>
/// <returns></returns>
public static bool UpdateStatus(string rfid, string lineName)
{
//GET /ESMTCommonInterface/CommonService.asmx/UpdateStatusBy?id=string&location=string HTTP/1.1
//Host: 10.85.17.233
string addr = "http://10.85.17.233/ESMTCommonInterface/CommonService.asmx/UpdateStatusBy?id=" + rfid + "&location=" + lineName;
//[{"msg":"1更新成功"}]
try
{
string result = HttpUtil.Get(addr);
if (!result.Equals(""))
{
List<Msg> msgs = JsonHelper.DeserializeJsonToList<Msg>(result);
if (msgs == null || msgs.Count == 0)
return false;
bool resRtn = int.TryParse(msgs[0].msg.Substring(0, 1), out int resCode);
if (resRtn)
{
if (resCode.Equals(1))
{
System.Windows.Forms.MessageBox.Show(string.Format("{0}物料状态更新成功[{1}]", lineName, rfid));
return true;
}
else
return false;
}
return false;
}
}
catch { return false; }
return false;
}
private class Msg
{
public string msg { get; set; }
}
}
public class Result
......
......@@ -36,6 +36,8 @@
this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.button6 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
......@@ -112,11 +114,33 @@
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// button5
//
this.button5.Location = new System.Drawing.Point(592, 90);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(132, 54);
this.button5.TabIndex = 8;
this.button5.Text = "大料架回收访问";
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// button6
//
this.button6.Location = new System.Drawing.Point(676, 167);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(132, 54);
this.button6.TabIndex = 9;
this.button6.Text = "物料状态上报";
this.button6.UseVisualStyleBackColor = true;
this.button6.Click += new System.EventHandler(this.button6_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(678, 368);
this.ClientSize = new System.Drawing.Size(879, 368);
this.Controls.Add(this.button6);
this.Controls.Add(this.button5);
this.Controls.Add(this.button4);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.textBox2);
......@@ -142,6 +166,8 @@
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Button button6;
}
}
......@@ -113,5 +113,16 @@ namespace WebServiceTest
{
AGVManager.GetWebservice(textBox1.Text, textBox2.Text);
}
private void button5_Click(object sender, EventArgs e)
{
bool qq = AGVManager.GetRackBy(textBox1.Text, out string kk);
textBox2.Text = qq.ToString() +" "+kk;
}
private void button6_Click(object sender, EventArgs e)
{
AGVManager.UpdateStatus("C6", "D8");
}
}
}
此文件类型无法预览
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!