Commit 810d0935 张东亮

新增任务日志

1 个父辈 e7703a5b
...@@ -53,6 +53,21 @@ ...@@ -53,6 +53,21 @@
<conversionPattern value="[%date]%-5p %m%n"/> <conversionPattern value="[%date]%-5p %m%n"/>
</layout> </layout>
</appender> </appender>
<appender name="RunLog" type="log4net.Appender.RollingFileAppender">
<file value="logs/runLog/RunLog.json"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<param name="MaxSizeRollBackups" value="10" />
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%m%n"/>
</layout>
</appender>
<logger name="RunLog">
<level value="Info"/>
<appender-ref ref="RunLog"/>
</logger>
<logger name="LineWebService"> <logger name="LineWebService">
<level value="Info"/> <level value="Info"/>
<appender-ref ref="LineWebService"/> <appender-ref ref="LineWebService"/>
......
文件属性发生变化
...@@ -65,8 +65,12 @@ namespace AGVControl ...@@ -65,8 +65,12 @@ namespace AGVControl
{ {
Invoke(new Action(() => Invoke(new Action(() =>
{ {
DgvNode.Rows[nodeIndex].DefaultCellStyle.ForeColor = AGVManager.nodeInfo[nodeIndex].Online && AGVManager.nodeInfo[nodeIndex].IsUse ? Color.Black : Color.Red; for (int i = 0; i < AGVManager.nodeInfo.Count; i++)
DgvNode.Rows[nodeIndex].SetValues(AGVManager.nodeInfo[nodeIndex].ToRow()); {
DgvNode.Rows[i].DefaultCellStyle.ForeColor = AGVManager.nodeInfo[i].Online && AGVManager.nodeInfo[i].IsUse ? Color.Black : Color.Red;
DgvNode.Rows[i].SetValues(AGVManager.nodeInfo[i].ToRow());
}
})); }));
System.GC.Collect(); System.GC.Collect();
} }
...@@ -75,8 +79,11 @@ namespace AGVControl ...@@ -75,8 +79,11 @@ namespace AGVControl
{ {
Invoke(new Action(() => Invoke(new Action(() =>
{ {
DgvNode.Rows[nodeIndex].DefaultCellStyle.ForeColor = AGVManager.nodeInfo[nodeIndex].Online ? Color.Black : Color.Red; for (int i = 0; i < AGVManager.nodeInfo.Count; i++)
DgvNode.Rows[nodeIndex].SetValues(AGVManager.nodeInfo[nodeIndex].ToRow()); {
DgvNode.Rows[i].DefaultCellStyle.ForeColor = AGVManager.nodeInfo[i].Online && AGVManager.nodeInfo[i].IsUse ? Color.Black : Color.Red;
DgvNode.Rows[i].SetValues(AGVManager.nodeInfo[i].ToRow());
}
})); }));
System.GC.Collect(); System.GC.Collect();
} }
......
文件属性发生变化
文件属性发生变化
文件属性发生变化
文件属性发生变化
文件属性发生变化
文件属性发生变化
文件属性发生变化
...@@ -4,11 +4,13 @@ using System.Net; ...@@ -4,11 +4,13 @@ using System.Net;
using System.Net.Sockets; using System.Net.Sockets;
using Common; using Common;
using System.Threading; using System.Threading;
using System.Collections.Concurrent;
using System.Linq;
namespace DeviceLibrary namespace DeviceLibrary
{ {
/// <summary> /// <summary>
/// AGV服务端 /// AGV服务端,要求每个线体拥有不用的IP,根据IP来查找客户端
/// </summary> /// </summary>
public class AgvServer public class AgvServer
{ {
...@@ -17,7 +19,7 @@ namespace DeviceLibrary ...@@ -17,7 +19,7 @@ namespace DeviceLibrary
private Socket _server; //服务端 private Socket _server; //服务端
private List<Client> _client; //所有客户端 private List<Client> _client; //所有客户端
private Thread tListenClient; //监听客户端连接 private Thread tListenClient; //监听客户端连接
public const int PORT = 9501; //端口 private static int PORT = 9501; //端口
private Thread tPingClient; //ping private Thread tPingClient; //ping
/// <summary> /// <summary>
/// 节点改变事件 /// 节点改变事件
...@@ -36,8 +38,9 @@ namespace DeviceLibrary ...@@ -36,8 +38,9 @@ namespace DeviceLibrary
/// <summary> /// <summary>
/// AGV服务端 /// AGV服务端
/// </summary> /// </summary>
public AgvServer() public AgvServer(int port=9501)
{ {
PORT = port;
_client = new List<Client>(); _client = new List<Client>();
} }
...@@ -57,7 +60,7 @@ namespace DeviceLibrary ...@@ -57,7 +60,7 @@ namespace DeviceLibrary
_client = new List<Client>(); _client = new List<Client>();
tListenClient = new Thread(new ThreadStart(ListenClient)); tListenClient = new Thread(new ThreadStart(ListenClient));
tListenClient.Start(); tListenClient.Start();
tPingClient = new Thread(new ThreadStart(KeepLiveClient)); tPingClient = new Thread(new ThreadStart(KeepLiveClient));
tPingClient.Start(); tPingClient.Start();
} }
catch (Exception ex) catch (Exception ex)
...@@ -107,12 +110,12 @@ namespace DeviceLibrary ...@@ -107,12 +110,12 @@ namespace DeviceLibrary
else else
{ {
TimeSpan timeSpan = DateTime.Now - readyEnterTime[nodeName]; TimeSpan timeSpan = DateTime.Now - readyEnterTime[nodeName];
if (timeSpan.TotalSeconds < 45) if (timeSpan.TotalSeconds < 15)
{ {
log.Debug(nodeName + " " + ip + " ReadyEnter 45秒内不重复发送"); log.Debug(nodeName + " " + ip + " ReadyEnter 15秒内不重复发送");
return false; return false;
} }
else if (timeSpan.TotalMinutes > 2) else if (timeSpan.TotalSeconds > 30)
{ {
readyEnterTime[nodeName] = DateTime.Now; readyEnterTime[nodeName] = DateTime.Now;
} }
...@@ -152,7 +155,7 @@ namespace DeviceLibrary ...@@ -152,7 +155,7 @@ namespace DeviceLibrary
log.Debug(nodeName + " " + ip + " ReadyLeave 45秒内不重复发送"); log.Debug(nodeName + " " + ip + " ReadyLeave 45秒内不重复发送");
return false; return false;
} }
else if (timeSpan.TotalMinutes > 3) else if (timeSpan.TotalMinutes > 1)
{ {
readyLeaveTime[nodeName] = DateTime.Now; readyLeaveTime[nodeName] = DateTime.Now;
} }
...@@ -217,65 +220,23 @@ namespace DeviceLibrary ...@@ -217,65 +220,23 @@ namespace DeviceLibrary
if (!_loop) return; if (!_loop) return;
} }
foreach (ClientNode clientNode in AGVManager.nodeInfo) for (int i = 0; i < AGVManager.nodeInfo.Count; i++)
{ {
n = 0; try
while (n < 300) //每条产线间隔
{ {
Thread.Sleep(50); if (!_loop)
n += 50; break;
if (!_loop) return; Thread.Sleep(1000);
if (!AGVManager.nodeInfo[i].IP.Equals(""))
AGVManager.nodeInfo[i].Online = CheckIP(AGVManager.nodeInfo[i].Name, AGVManager.nodeInfo[i].IP);
NodeOnline?.Invoke(i);
} }
catch (Exception e)
int idx = FindClient(clientNode.IP);
if (idx == -1)
{ {
log.Debug("KeepLive 没有找到" + clientNode.Name); log.Error("PingClient", e);
int index = AGVManager.nodeInfo.IndexOf(clientNode);
AGVManager.nodeInfo[index].Online = false;
continue;
} }
else
{
if (clientNode.StateEquals(eNodeStatus.None))
{
byte[] buff = new byte[] { 0X00, 0X00 };
int index = AGVManager.nodeInfo.IndexOf(clientNode);
if (!Send(idx, buff))
{
AGVManager.nodeInfo[index].Online = false;
log.Debug(clientNode.Name + " KeepLive 发送失败");
}
else
{
AGVManager.nodeInfo[index].Online = true;
log.Debug(clientNode.Name + " KeepLive 发送成功");
}
}
}
NodeOnline?.Invoke(AGVManager.nodeInfo.IndexOf(clientNode));
NodeChanged?.Invoke(AGVManager.nodeInfo.IndexOf(clientNode));
} }
//for (int i = 0; i < Common.nodeInfo.Count; i++)
//{
// try
// {
// if (!_loop)
// break;
// if (!Common.nodeInfo[i].IP.Equals(""))
// Common.nodeInfo[i].Online = CheckIP(Common.nodeInfo[i].Name, Common.nodeInfo[i].IP);
// NodeOnline?.Invoke(i);
// NodeChanged?.Invoke(i);
// }
// catch (Exception e)
// {
// Common.log.Error("PingClient", e);
// }
//}
} }
} }
...@@ -322,14 +283,12 @@ namespace DeviceLibrary ...@@ -322,14 +283,12 @@ namespace DeviceLibrary
Socket socket = _server.Accept(); //这边会暂停,不需要sleep Socket socket = _server.Accept(); //这边会暂停,不需要sleep
IPEndPoint ep = (IPEndPoint)socket.RemoteEndPoint; IPEndPoint ep = (IPEndPoint)socket.RemoteEndPoint;
Thread listen = new Thread(new ParameterizedThreadStart(ListenNet)); Thread listen = new Thread(new ParameterizedThreadStart(ListenNet));
//string ip = ep.Address.ToString(); string ip = ep.Address.ToString();
//if (ip == System.Configuration.ConfigurationManager.AppSettings["LocalIP"])
// ip += ":" + ep.Port;
//新的客户端 //新的客户端
Client client = new Client Client client = new Client
{ {
IP = ep.Address.ToString() + ":" + ep.Port, IP = ip,
Loop = true, Loop = true,
IsConn = true, IsConn = true,
Socket = socket, Socket = socket,
...@@ -338,19 +297,19 @@ namespace DeviceLibrary ...@@ -338,19 +297,19 @@ namespace DeviceLibrary
}; };
//重连后关闭旧连接 //重连后关闭旧连接
//int idx = _client.FindIndex(s => s.IP.Equals(ip)); int idx = _client.FindIndex(s => s.IP.Equals(ip));
//if (idx > -1) if (idx > -1)
//{ {
// _client[idx].IsConn = false; _client[idx].IsConn = false;
// _client[idx].nodeName.Clear(); _client[idx].nodeName.Clear();
// _client[idx].Loop = false; _client[idx].Loop = false;
// _client[idx].Socket.Close(); _client[idx].Socket.Close();
// _client.RemoveAt(idx); _client.RemoveAt(idx);
//} }
_client.Add(client); _client.Add(client);
listen.Start(_client.Count - 1); listen.Start(_client.Count - 1);
log.Debug(string.Format("[{0}] 已连接", client.IP)); log.Info(string.Format("[{0}] 已连接", client.IP));
} }
catch (SocketException) catch (SocketException)
{ {
...@@ -364,6 +323,9 @@ namespace DeviceLibrary ...@@ -364,6 +323,9 @@ namespace DeviceLibrary
} }
} }
//临时缓存
//线程安全的字典
ConcurrentDictionary<string, byte[]> dic = new ConcurrentDictionary<string, byte[]>();
/// <summary> /// <summary>
/// 客户端数据接收 /// 客户端数据接收
/// </summary> /// </summary>
...@@ -372,7 +334,7 @@ namespace DeviceLibrary ...@@ -372,7 +334,7 @@ namespace DeviceLibrary
{ {
int sleep = 50; int sleep = 50;
Client client = _client[(int)obj]; Client client = _client[(int)obj];
byte[] temp = new byte[200]; byte[] temp = new byte[127];
int time = 0; int time = 0;
while (client.Loop) while (client.Loop)
...@@ -384,31 +346,98 @@ namespace DeviceLibrary ...@@ -384,31 +346,98 @@ namespace DeviceLibrary
if (client.Socket.Available > 0) if (client.Socket.Available > 0)
{ {
time = 0; time = 0;
byte[] supBuff = null;
int count = client.Socket.Receive(temp); int count = client.Socket.Receive(temp);
byte[] buff = new byte[count]; if (!dic.TryGetValue(client.IP, out supBuff)) //第一次收到开头必须是0xAD开头的字节
Array.Copy(temp, 0, buff, 0, count);
ClientNode node = Decode(client, buff);
if (node == null)
{ {
log.Debug(client.IP + " 解码失败:" + HexBuff(buff)); if (temp[0].Equals(0xAD))
{
supBuff = new byte[count];
Array.Copy(temp, 0, supBuff, 0, count);
//log.Info(string.Format("start with AB receive:{0}", HexBuff(supBuff)));
}
else
{
//log.Info(string.Format("start without AB receive:{0}", HexBuff(temp)));
for (int i = 0; i < count; i++)
{
if (!temp[i].Equals(0xAD))
continue;
supBuff = new byte[count - i];
Array.Copy(temp, i, supBuff, 0, count - i);
//log.Info(string.Format("start without AB receive after filter:{0}", HexBuff(supBuff)));
break;
}
}
dic.TryAdd(client.IP, supBuff);
} }
else else
{ {
log.Debug(client.IP + " 解码内容:" + HexBuff(buff)); byte[] tmp = new byte[count];
log.Debug("Receive[" + client.IP + "] " + node.StatetText()); Array.Copy(temp, 0, tmp, 0, count);
int idx = client.nodeName.FindIndex(s => s == node.Name); byte[] curBuff = supBuff.Concat(tmp).ToArray();
if (idx == -1) client.nodeName.Add(node.Name); dic.TryUpdate(client.IP, curBuff, supBuff);
UpdateNode(node); supBuff = curBuff;
//log.Info(string.Format("receive:{0}",HexBuff(tmp)));
//log.Info(string.Format("buff:{0}",HexBuff(supBuff)));
//log.Info(string.Format("curBuf:{0}",HexBuff(curBuff)));
//log.Info(string.Format("dic[0]:{0}", HexBuff(dic[client.IP])));
}
List<byte> buf = new List<byte>();
for (int i = 0; i < supBuff.Length; i++)
{
if (supBuff[i].Equals(0XAD))
{
if (buf.Count > 0)
buf.Clear();
buf.Add(supBuff[i]);
}
else if (supBuff[i].Equals(0XDA))
{
buf.Add(supBuff[i]);
byte[] buff = buf.ToArray();
//Array.Copy(temp, 0, buff, 0, count);
ClientNode node = Decode(client, buff);
if (node == null)
{
log.Debug(client.IP + " 解码失败:" + HexBuff(buff));
}
else
{
if (!node.Name.StartsWith("A") && !node.Name.Equals("S21")&& !node.Name.Equals("S22"))
{
log.Info("Receive[" + client.IP + "]:[" + HexBuff(buff) + "],解码内容:" + node.StatetText());
}
log.Debug("Receive[" + client.IP + "]:[" + HexBuff(buff) + "],解码内容:" + node.StatetText());
int idx = client.nodeName.FindIndex(s => s == node.Name);
if (idx == -1) client.nodeName.Add(node.Name);
UpdateNode(node);
}
if (buf.Count > 0)
buf.Clear();
}
else
{
buf.Add(supBuff[i]);
}
}
if (buf.Count > 0)//存在部分包
{
dic.TryUpdate(client.IP, buf.ToArray(), supBuff);
} }
else
dic.TryRemove(client.IP, out byte[] bb);
} }
else else
{ {
time += sleep; time += sleep;
if (time > 120000) if (time > 1000 * 60 * 60 * 1)
{ {
Offline(client); Offline(client);
log.Debug("[" + client.IP + "] 超过2分钟没有收到数据,关闭连接"); log.Debug("[" + client.IP + "] 超过1H没有收到数据,关闭连接");
} }
} }
} }
...@@ -421,7 +450,7 @@ namespace DeviceLibrary ...@@ -421,7 +450,7 @@ namespace DeviceLibrary
} }
/// <summary> /// <summary>
/// 编码 /// 编码-定长12字节
/// </summary> /// </summary>
/// <param name="node"></param> /// <param name="node"></param>
/// <returns></returns> /// <returns></returns>
...@@ -445,7 +474,7 @@ namespace DeviceLibrary ...@@ -445,7 +474,7 @@ namespace DeviceLibrary
} }
/// <summary> /// <summary>
/// 解码 /// 解码-定长12字节
/// </summary> /// </summary>
/// <param name="buff"></param> /// <param name="buff"></param>
/// <returns></returns> /// <returns></returns>
...@@ -457,7 +486,7 @@ namespace DeviceLibrary ...@@ -457,7 +486,7 @@ namespace DeviceLibrary
if (buff[idx++] != 0xAD) return null; if (buff[idx++] != 0xAD) return null;
if (buff[idx] == 0x00 && buff[idx + 1] == 0x00)//收到产线 if (buff[idx] == 0x00 && buff[idx + 1] == 0x00)//收到产线
{ {
int k = AGVManager.nodeInfo.FindIndex(s => client.IP.Contains(s.IP) && !s.Name.StartsWith("A")); int k = AGVManager.nodeInfo.FindIndex(s => client.IP.Equals(s.IP) && !s.Name.StartsWith("A"));
if (k > -1) if (k > -1)
{ {
name = AGVManager.nodeInfo[k].Name; name = AGVManager.nodeInfo[k].Name;
...@@ -562,7 +591,7 @@ namespace DeviceLibrary ...@@ -562,7 +591,7 @@ namespace DeviceLibrary
if (item.IsConn) if (item.IsConn)
{ {
//Common.log.Info("已连接客户端:" + string.Join("#", item.IP)); //Common.log.Info("已连接客户端:" + string.Join("#", item.IP));
if (item.IP.Contains(ip)) if (item.IP.Equals(ip))
{ {
index = _client.IndexOf(item); index = _client.IndexOf(item);
break; break;
...@@ -600,7 +629,8 @@ namespace DeviceLibrary ...@@ -600,7 +629,8 @@ namespace DeviceLibrary
{ {
if (_client[idx].IsConn) if (_client[idx].IsConn)
_client[idx].Socket.Send(buff); _client[idx].Socket.Send(buff);
log.Debug("SendTo" + ip + ": " + HexBuff(buff)); if (buff.Length > 2)
log.Info("SendTo" + ip + ": " + HexBuff(buff));
return true; return true;
} }
catch (Exception ex) catch (Exception ex)
......
文件属性发生变化
...@@ -14,6 +14,9 @@ namespace DeviceLibrary ...@@ -14,6 +14,9 @@ namespace DeviceLibrary
public class Control public class Control
{ {
private static log4net.ILog log = log4net.LogManager.GetLogger("Control"); private static log4net.ILog log = log4net.LogManager.GetLogger("Control");
static log4net.ILog runLog = log4net.LogManager.GetLogger("RunLog");
static Dictionary<string, RunInfo> runInfoMap = new Dictionary<string, RunInfo>();
private System.Timers.Timer AgvCallTimer; private System.Timers.Timer AgvCallTimer;
private System.Timers.Timer AgvStateTimer; private System.Timers.Timer AgvStateTimer;
private System.Timers.Timer NodeStateTimer; private System.Timers.Timer NodeStateTimer;
...@@ -160,7 +163,11 @@ namespace DeviceLibrary ...@@ -160,7 +163,11 @@ namespace DeviceLibrary
try try
{ {
if (!AGVManager.agvInfo[i].Msg.Equals("")) if (!AGVManager.agvInfo[i].Msg.Equals(""))
{
RunLogInfo(new RunInfo(AGVManager.agvInfo[i].Name, AGVManager.agvInfo[i].Msg));
msglist.Add(new AlarmMsg(AGVManager.agvInfo[i].Name, "lineAgv." + AGVManager.agvInfo[i].Name + ".Msg", AGVManager.agvInfo[i].Msg, 1)); msglist.Add(new AlarmMsg(AGVManager.agvInfo[i].Name, "lineAgv." + AGVManager.agvInfo[i].Name + ".Msg", AGVManager.agvInfo[i].Msg, 1));
}
else else
{ {
if ((AGVManager.agvInfo[i].Place.Contains(SettingString.AutoCharge) || AGVManager.agvInfo[i].Place.Contains(SettingString.Standby))) if ((AGVManager.agvInfo[i].Place.Contains(SettingString.AutoCharge) || AGVManager.agvInfo[i].Place.Contains(SettingString.Standby)))
...@@ -184,7 +191,23 @@ namespace DeviceLibrary ...@@ -184,7 +191,23 @@ namespace DeviceLibrary
AgvStateInProcess = false; AgvStateInProcess = false;
} }
public static void RunLogInfo(RunInfo info)
{
if (runInfoMap == null)
return;
if (runInfoMap.Keys.Contains(info.AGVNum))
{
if (!runInfoMap[info.AGVNum].Equals(info))
{
runLog.Info(info.ToString());
}
}
else
{
runInfoMap.Add(info.AGVNum, info);
runLog.Info(info.ToString());
}
}
/// <summary> /// <summary>
/// 从节点获取任务 /// 从节点获取任务
/// </summary> /// </summary>
...@@ -294,4 +317,42 @@ namespace DeviceLibrary ...@@ -294,4 +317,42 @@ namespace DeviceLibrary
} }
} }
}
public class RunInfo
{
/// <summary>
/// AGV编号
/// </summary>
public string AGVNum { get; set; } = "";
/// <summary>
/// 时间
/// </summary>
public string DateTime { get; set; } = "";
/// <summary>
/// 任务信息
/// </summary>
public string MissionInfo { get; set; } = "";
public RunInfo(string AGVNum, string missionInfo)
{
//2006-01-02 15:04:05
DateTime = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
this.AGVNum = AGVNum;
MissionInfo = missionInfo;
}
public RunInfo() { }
public override bool Equals(object obj)
{
if (obj is RunInfo)
{
RunInfo info = (RunInfo)obj;
if (this.MissionInfo.Equals(info.MissionInfo))
return true;
this.MissionInfo = info.MissionInfo;
}
return false;
}
public override string ToString()
{
return JsonHelper.SerializeObject(this);
}
} }
\ No newline at end of file \ No newline at end of file
文件属性发生变化
文件属性发生变化
...@@ -397,9 +397,9 @@ namespace DeviceLibrary ...@@ -397,9 +397,9 @@ namespace DeviceLibrary
msg += string.Format("[{0}] {1}", jobStep.CurStep(), runInfo); msg += string.Format("[{0}] {1}", jobStep.CurStep(), runInfo);
jobStep.Msg = msg; jobStep.Msg = msg;
//4DfeederOut默认大料架 //4DfeederOut默认大料架
if (agv.Place.Equals(SettingString.RoomDFeederOut)) // if (agv.Place.Equals(SettingString.RoomDFeederOut))
return new EmptyShelfBackJob(EmptyShelfPlace, eShelfType.BigShelf); // return new EmptyShelfBackJob(EmptyShelfPlace, eShelfType.BigShelf);
else if (agv.RFID.StartsWith("D")) if (agv.RFID.StartsWith("D"))
return new EmptyShelfBackJob(EmptyShelfPlace, eShelfType.SmallShelf); return new EmptyShelfBackJob(EmptyShelfPlace, eShelfType.SmallShelf);
else if (agv.RFID.StartsWith("C")) else if (agv.RFID.StartsWith("C"))
......
...@@ -178,7 +178,7 @@ namespace DeviceLibrary ...@@ -178,7 +178,7 @@ namespace DeviceLibrary
if (RFID.StartsWith(SettingString.BigShelf_Prefix) && !FullShelfPlace.Equals(SettingString.RoomDFeederIn) && !FullShelfPlace.Equals(SettingString.RoomCFeederIn)) if (RFID.StartsWith(SettingString.BigShelf_Prefix) && !FullShelfPlace.Equals(SettingString.RoomDFeederIn) && !FullShelfPlace.Equals(SettingString.RoomCFeederIn))
{ {
jobStep.ToNextStep(SEND_FULL_SHELF_STEP.WAIT_BIG_SHELF_UNLOCK); jobStep.ToNextStep(SEND_FULL_SHELF_STEP.WAIT_BIG_SHELF_UNLOCK);
runInfo = "AGV到达 " + FullShelfPlace + ",并等待大料架解绑"; runInfo = "AGV到达 " + FullShelfPlace + ",并等待大料架移库操作";
msg += string.Format("[{0}] {1}", jobStep.CurStep(),runInfo); msg += string.Format("[{0}] {1}", jobStep.CurStep(),runInfo);
jobStep.Msg = msg; jobStep.Msg = msg;
} }
...@@ -200,7 +200,7 @@ namespace DeviceLibrary ...@@ -200,7 +200,7 @@ namespace DeviceLibrary
System.Threading.Thread.Sleep(50); System.Threading.Thread.Sleep(50);
if (HttpManager.GetRackBy(RFID, out string lineName) || (input != null && input[0])) if (HttpManager.GetRackBy(RFID, out string lineName) || (input != null && input[0]))
{ {
runInfo = "大料架在" + FullShelfPlace + "解绑完成[" + agv.BoxDestInfo + "]"; runInfo = "大料架在" + FullShelfPlace + "移库完成[" + agv.BoxDestInfo + "]";
agv.BoxDestInfo = ""; agv.BoxDestInfo = "";
msg += string.Format("[{0}] {1}", jobStep.CurStep(),runInfo); msg += string.Format("[{0}] {1}", jobStep.CurStep(),runInfo);
jobStep.Msg = msg; jobStep.Msg = msg;
......
...@@ -57,8 +57,8 @@ namespace DeviceLibrary ...@@ -57,8 +57,8 @@ namespace DeviceLibrary
} }
if (cnt < clientNode.EmptyShelfCnt) if (cnt < clientNode.EmptyShelfCnt)
{ {
int i = AGVManager.agvInfo.FindIndex(s => s.CurJob is GoEmptyShelfLineJob && ((GoEmptyShelfLineJob)s.CurJob).EmptyShelfPlace.Equals(nodeName));
if (AGVManager.CheckStationState(clientNode, out rfid) && CanEmptyTask(emptyJobCnt)) if (i == -1 && AGVManager.CheckStationState(clientNode, out rfid) && CanEmptyTask(emptyJobCnt))
return new GoEmptyShelfLineJob(currentAgv.Place, nodeName, rfid); return new GoEmptyShelfLineJob(currentAgv.Place, nodeName, rfid);
} }
return null; return null;
......
...@@ -473,7 +473,7 @@ namespace DeviceLibrary ...@@ -473,7 +473,7 @@ namespace DeviceLibrary
if (idx > -1) if (idx > -1)
{ {
nodeName = nodeInfo[idx].Name; nodeName = nodeInfo[idx].Name;
log.Debug(agv.Name + " 双层线右侧需要料架,准备去4C-" + nodeName); log.Debug(agv.Name + " 双层线右侧需要料架,准备去3C-" + nodeName);
return true; return true;
} }
} }
...@@ -484,7 +484,7 @@ namespace DeviceLibrary ...@@ -484,7 +484,7 @@ namespace DeviceLibrary
if (idx > -1) if (idx > -1)
{ {
nodeName = nodeInfo[idx].Name; nodeName = nodeInfo[idx].Name;
log.Debug(agv.Name + " 双层线右侧需要料架,准备去4D-" + nodeName); log.Debug(agv.Name + " 双层线右侧需要料架,准备去3D-" + nodeName);
return true; return true;
} }
...@@ -496,7 +496,7 @@ namespace DeviceLibrary ...@@ -496,7 +496,7 @@ namespace DeviceLibrary
if (!nearNodeName.Equals("")) if (!nearNodeName.Equals(""))
{ {
nodeName = nearNodeName; nodeName = nearNodeName;
log.Debug(agv.Name + " 双层线需要小料架,准备去4C-" + nearNodeName); log.Debug(agv.Name + " 双层线需要小料架,准备去3C-" + nearNodeName);
return true; return true;
} }
...@@ -509,7 +509,7 @@ namespace DeviceLibrary ...@@ -509,7 +509,7 @@ namespace DeviceLibrary
if (!nearNodeName.Equals("")) if (!nearNodeName.Equals(""))
{ {
nodeName = nearNodeName; nodeName = nearNodeName;
log.Debug(agv.Name + " 双层线需要小料架,准备去4D-" + nearNodeName); log.Debug(agv.Name + " 双层线需要小料架,准备去3D-" + nearNodeName);
return true; return true;
} }
......
...@@ -82,12 +82,12 @@ namespace DeviceLibrary ...@@ -82,12 +82,12 @@ namespace DeviceLibrary
if(rfid.Equals("")) if(rfid.Equals(""))
{ {
Log.Error(string.Format("添加空架任务失败 节点[{0}] RFID=null", value)); Log.Error(string.Format("添加空架任务失败 节点[{0}] RFID=null", value));
res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "CreateEmptyRecycleTask failed: emptyStation=" + emptyStation + " rfid=" + rfid }; res = new Result() { Succeed = false, ResultData = "true", ErrorMessage = "CreateEmptyRecycleTask failed: emptyStation=" + emptyStation + " rfid=" + rfid };
} }
else else
{ {
Log.Error(string.Format("添加空架任务失败 节点[{0}]RFID={1} 重复", value,rfid.ToUpper())); Log.Error(string.Format("添加空架任务失败 节点[{0}]RFID={1} 重复", value,rfid.ToUpper()));
res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "CreateEmptyRecycleTask failed due it has been created: emptyStation=" + emptyStation + " rfid=" + rfid}; res = new Result() { Succeed = false, ResultData = "true", ErrorMessage = "CreateEmptyRecycleTask failed due it has been created: emptyStation=" + emptyStation + " rfid=" + rfid};
} }
} }
else else
...@@ -97,7 +97,7 @@ namespace DeviceLibrary ...@@ -97,7 +97,7 @@ namespace DeviceLibrary
} }
else else
{ {
res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "Not find " + emptyStation }; res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "Not find linename=" + emptyStation };
Log.Error("Unlock POST Response false:" + "Not find " + emptyStation); Log.Error("Unlock POST Response false:" + "Not find " + emptyStation);
} }
} }
...@@ -120,8 +120,8 @@ namespace DeviceLibrary ...@@ -120,8 +120,8 @@ namespace DeviceLibrary
Log.Debug(string.Format("Unlock Request(GET) [emptyStation={0},rfid={1}]", line, RFID.ToUpper())); Log.Debug(string.Format("Unlock Request(GET) [emptyStation={0},rfid={1}]", line, RFID.ToUpper()));
if (!AGVManager.unlockManager.AddMission(value,RFID.ToUpper())) if (!AGVManager.unlockManager.AddMission(value,RFID.ToUpper()))
{ {
Log.Error(string.Format("添加空架任务失败 节点[{0}]RFID={1} 重复", value, RFID.ToUpper())); Log.Error(string.Format("添加空架任务失败 节点[{0}]RFID={1} 重复/RFID为空", value, RFID.ToUpper()));
res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "CreateEmptyRecycleTask failed due it has been created: emptyStation=" + line + " rfid=" + RFID }; res = new Result() { Succeed = false, ResultData = "true", ErrorMessage = "CreateEmptyRecycleTask failed due it has been created or rfid=null: emptyStation=" + line + " rfid=" + RFID };
} }
else else
{ {
...@@ -131,10 +131,9 @@ namespace DeviceLibrary ...@@ -131,10 +131,9 @@ namespace DeviceLibrary
} }
else else
{ {
res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "Not find " + line }; res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "Not find line=" + line };
Log.Error("Unlock GET Response false " + "Not find " + line); Log.Error("Unlock GET Response false " + "Not find " + line);
} }
//Log.Info(string.Format("WebService GET Request emptyStation={0},rfid={1}", line, RFID));
return JsonHelper.SerializeObject(res); return JsonHelper.SerializeObject(res);
} }
} }
......
文件属性发生变化
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!