Commit 8df24709 张东亮

0804

1 个父辈 ac0f8736
...@@ -84,6 +84,8 @@ namespace BLL ...@@ -84,6 +84,8 @@ namespace BLL
Common.LogInfo("Server Stop"); Common.LogInfo("Server Stop");
} }
public Dictionary<string, DateTime> readyEnterTime = new Dictionary<string, DateTime>();
public Dictionary<string, DateTime> readyLeaveTime = new Dictionary<string, DateTime>();
public bool ReadyEnter(string nodeName, string rfid = "") public bool ReadyEnter(string nodeName, string rfid = "")
{ {
int nodeIdx = Common.nodeInfo.FindIndex(s => s.Name == nodeName); int nodeIdx = Common.nodeInfo.FindIndex(s => s.Name == nodeName);
...@@ -96,6 +98,28 @@ namespace BLL ...@@ -96,6 +98,28 @@ namespace BLL
} }
else else
{ {
try
{
if (!readyEnterTime.ContainsKey(nodeName))
{
readyEnterTime.Add(nodeName, DateTime.Now);
}
else
{
TimeSpan timeSpan = DateTime.Now - readyEnterTime[nodeName];
if (timeSpan.TotalSeconds < 45)
{
Common.log.Debug(nodeName + " " + ip + " ReadyEnter 45秒内不重复发送");
return false;
}
else if (timeSpan.TotalMinutes > 2)
{
readyEnterTime[nodeName] = DateTime.Now;
}
}
}
catch(Exception ex) { Common.log.Debug(ex.Message +";"+ex.StackTrace); }
ClientNode node = new ClientNode(nodeName, rfid, ClientAction.ReadyEnter); ClientNode node = new ClientNode(nodeName, rfid, ClientAction.ReadyEnter);
byte[] buff = Encode(node); byte[] buff = Encode(node);
return Send(idx, buff); return Send(idx, buff);
...@@ -114,6 +138,28 @@ namespace BLL ...@@ -114,6 +138,28 @@ namespace BLL
} }
else else
{ {
try
{
if (!readyLeaveTime.ContainsKey(nodeName))
{
readyLeaveTime.Add(nodeName, DateTime.Now);
}
else
{
TimeSpan timeSpan = DateTime.Now - readyLeaveTime[nodeName];
if (timeSpan.TotalSeconds < 45)
{
Common.log.Debug(nodeName + " " + ip + " ReadyLeave 45秒内不重复发送");
return false;
}
else if (timeSpan.TotalMinutes > 3)
{
readyLeaveTime[nodeName] = DateTime.Now;
}
}
}
catch (Exception ex) { Common.log.Debug(ex.Message + ";" + ex.StackTrace); }
ClientNode node = new ClientNode(nodeName, rfid, ClientAction.ReadyLeave); ClientNode node = new ClientNode(nodeName, rfid, ClientAction.ReadyLeave);
byte[] buff = Encode(node); byte[] buff = Encode(node);
return Send(idx, buff); return Send(idx, buff);
...@@ -292,7 +338,7 @@ namespace BLL ...@@ -292,7 +338,7 @@ namespace BLL
_client.Add(client); _client.Add(client);
listen.Start(_client.Count - 1); listen.Start(_client.Count - 1);
Common.LogInfo(string.Format("[{0}] 已连接", client.IP), false); Common.log.Debug(string.Format("[{0}] 已连接", client.IP));
} }
catch (SocketException) catch (SocketException)
{ {
...@@ -347,10 +393,10 @@ namespace BLL ...@@ -347,10 +393,10 @@ namespace BLL
else else
{ {
time += sleep; time += sleep;
if (time > 60000) if (time > 120000)
{ {
Offline(client); Offline(client);
Common.LogInfo("[" + client.IP + "] 超过60s没有收到数据,关闭连接", false); Common.log.Debug("[" + client.IP + "] 超过2分钟没有收到数据,关闭连接");
} }
} }
} }
......
...@@ -464,7 +464,7 @@ namespace AGVControl ...@@ -464,7 +464,7 @@ namespace AGVControl
/// <summary> /// <summary>
/// 任务发送 /// 任务发送
/// </summary> /// </summary>
public string TaskSend { set; get; } public string TaskSend { set; get; } = "";
/// <summary> /// <summary>
/// 闲置等待时间,用于充电 /// 闲置等待时间,用于充电
/// </summary> /// </summary>
...@@ -566,11 +566,12 @@ namespace AGVControl ...@@ -566,11 +566,12 @@ namespace AGVControl
public void GetPlace(int value) public void GetPlace(int value)
{ {
if (value < 1000) if (value>=0 && value < 1000)
{ {
Place = ""; Place = "";
PlaceState = PlaceState.None; PlaceState = PlaceState.None;
TaskSend = ""; //TaskSend = "";
Common.log.Debug(Name+ " 获取小车PLC20值,PLC=" + value);
} }
else else
{ {
......
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Web.Script.Serialization; using System.Web.Script.Serialization;
using AGVControl; using AGVControl;
using RestSharp; using RestSharp;
...@@ -188,7 +189,17 @@ namespace BLL ...@@ -188,7 +189,17 @@ namespace BLL
string s = dic["mission_id"].ToString(); string s = dic["mission_id"].ToString();
if (s == mission_id) if (s == mission_id)
{
try
{
var key = Common.agvMission.Where(qq => qq.Value == mission_id).Select(qq => qq.Key);
Common.LogInfo(string.Format("{0} Add_Mission [{1}]", info.Name, key.ToList()[0]));
}
catch { Common.LogInfo(string.Format("{0} Add_Mission [{1}]", info.Name, mission_id)); }
return true; return true;
}
else else
return false; return false;
} }
...@@ -225,7 +236,16 @@ namespace BLL ...@@ -225,7 +236,16 @@ namespace BLL
string s = dic["mission_id"].ToString(); string s = dic["mission_id"].ToString();
if (s == mission_id) if (s == mission_id)
{
try
{
var key = Common.agvMission.Where(qq => qq.Value == mission_id).Select(qq => qq.Key);
Common.LogInfo(string.Format("{0} Add_Mission_Fleet [{1}]", info.Name, key.ToList()[0]));
}
catch { Common.LogInfo(string.Format("{0} Add_Mission_Fleet [{1}]", info.Name, mission_id)); }
return true; return true;
}
else else
return false; return false;
} }
...@@ -527,7 +547,7 @@ namespace BLL ...@@ -527,7 +547,7 @@ namespace BLL
ping.Dispose(); ping.Dispose();
if (result.Status != System.Net.NetworkInformation.IPStatus.Success) if (result.Status != System.Net.NetworkInformation.IPStatus.Success)
{ {
Common.LogInfo("Ping " + ip + " 请求没有响应"); Common.log.Debug("Ping " + ip + " 请求没有响应");
return false; return false;
} }
return true; return true;
......
...@@ -213,9 +213,9 @@ namespace AGVControl ...@@ -213,9 +213,9 @@ namespace AGVControl
//清除小车缓存 //清除小车缓存
Common.LogInfo(string.Format("手动清除agv缓存,{0} {1}", Common.agvInfo[e.RowIndex].Name, Common.agvInfo[e.RowIndex].Place)); Common.LogInfo(string.Format("手动清除agv缓存,{0} {1}", Common.agvInfo[e.RowIndex].Name, Common.agvInfo[e.RowIndex].Place));
string place = Common.agvInfo[e.RowIndex].Place; string place = Common.agvInfo[e.RowIndex].Place;
Common.agvInfo[e.RowIndex].Place = ""; //Common.agvInfo[e.RowIndex].Place = "";
Common.agvInfo[e.RowIndex].PlaceAliceName = ""; Common.agvInfo[e.RowIndex].PlaceAliceName = "";
Common.agvInfo[e.RowIndex].RFID = ""; //Common.agvInfo[e.RowIndex].RFID = "";
Common.agvInfo[e.RowIndex].NextPlace = ""; Common.agvInfo[e.RowIndex].NextPlace = "";
Common.agvInfo[e.RowIndex].NextPlaceAliceName = ""; Common.agvInfo[e.RowIndex].NextPlaceAliceName = "";
Common.agvInfo[e.RowIndex].TaskSend = ""; Common.agvInfo[e.RowIndex].TaskSend = "";
......
...@@ -31,20 +31,20 @@ namespace AgvClientTest ...@@ -31,20 +31,20 @@ namespace AgvClientTest
client = new AsaPL.AgvClient("10.85.199.1"); client = new AsaPL.AgvClient("10.85.199.1");
client.ReadyEnter += AGV_ReadyEnter; client.ReadyEnter += AGV_ReadyEnter;
client.ReadyLeave += AGV_ReadyLeave; client.ReadyLeave += AGV_ReadyLeave;
client.SetStatus("E1", "", AsaPL.ClientAction.None); //client.SetStatus("E1", "", AsaPL.ClientAction.None);
client.SetStatus("E2", "", AsaPL.ClientAction.None); //client.SetStatus("E2", "", AsaPL.ClientAction.None);
client.SetStatus("E3", "", AsaPL.ClientAction.None); //client.SetStatus("E3", "", AsaPL.ClientAction.None);
client.SetStatus("E4", "", AsaPL.ClientAction.None); //client.SetStatus("E4", "", AsaPL.ClientAction.None);
client.SetStatus("E5", "", AsaPL.ClientAction.None); //client.SetStatus("E5", "", AsaPL.ClientAction.None);
client.SetStatus("E6", "", AsaPL.ClientAction.None); //client.SetStatus("E6", "", AsaPL.ClientAction.None);
client.SetStatus("E8", "", AsaPL.ClientAction.None); //client.SetStatus("E8", "", AsaPL.ClientAction.None);
client.SetStatus("E9", "", AsaPL.ClientAction.None); //client.SetStatus("E9", "", AsaPL.ClientAction.None);
client.SetStatus("E10", "", AsaPL.ClientAction.None); //client.SetStatus("E10", "", AsaPL.ClientAction.None);
client.SetStatus("E11", "", AsaPL.ClientAction.None); //client.SetStatus("E11", "", AsaPL.ClientAction.None);
client.SetStatus("E12", "", AsaPL.ClientAction.None); //client.SetStatus("E12", "", AsaPL.ClientAction.None);
client.SetStatus("E14", "", AsaPL.ClientAction.None); //client.SetStatus("E14", "", AsaPL.ClientAction.None);
client.SetStatus("E15", "", AsaPL.ClientAction.None); //client.SetStatus("E15", "", AsaPL.ClientAction.None);
client.SetStatus("E16", "", AsaPL.ClientAction.None); //client.SetStatus("E16", "", AsaPL.ClientAction.None);
client.SetStatus("E21", "", AsaPL.ClientAction.None); client.SetStatus("E21", "", AsaPL.ClientAction.None);
client.SetStatus("E22", "", AsaPL.ClientAction.None); client.SetStatus("E22", "", AsaPL.ClientAction.None);
client.SetStatus("G21", "", AsaPL.ClientAction.None); client.SetStatus("G21", "", AsaPL.ClientAction.None);
......
bdcb49d390ac20e7bf0fe235fb5519caf9b8a06d f44608ffba7baac1680d1c1ae2f3221543f70aa3
...@@ -25,3 +25,16 @@ C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\obj\Debug\AgvClientTe ...@@ -25,3 +25,16 @@ C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\obj\Debug\AgvClientTe
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\obj\Debug\AgvClientTest.pdb 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.csproj.CoreCompileInputs.cache
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\obj\Debug\AgvClientTest.csprojAssemblyReference.cache C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\obj\Debug\AgvClientTest.csprojAssemblyReference.cache
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\bin\Debug\AgvClientTest.exe.config
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\bin\Debug\AgvClientTest.exe
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\bin\Debug\AgvClientTest.pdb
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\bin\Debug\AsaPL.AgvClient.dll
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\bin\Debug\AsaPL.AgvClient.pdb
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\obj\Debug\AgvClientTest.csprojAssemblyReference.cache
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\obj\Debug\AgvClientTest.Form1.resources
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\obj\Debug\AgvClientTest.Properties.Resources.resources
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\obj\Debug\AgvClientTest.csproj.GenerateResource.cache
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\obj\Debug\AgvClientTest.csproj.CoreCompileInputs.cache
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\obj\Debug\AgvClientTest.csproj.CopyComplete
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\obj\Debug\AgvClientTest.exe
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AgvClientTest\obj\Debug\AgvClientTest.pdb
...@@ -122,7 +122,7 @@ namespace WebServiceTest ...@@ -122,7 +122,7 @@ namespace WebServiceTest
private void button6_Click(object sender, EventArgs e) private void button6_Click(object sender, EventArgs e)
{ {
AGVManager.UpdateStatus("C6", "D8"); AGVManager.UpdateStatus("D17", "D1");
} }
} }
} }
9599955bfee8b9af8a27f3d3c4dd600c8ef9738f 905fd6870c9e3c585da2737659f8708e765037fb
...@@ -12,3 +12,17 @@ C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\WebServiceTest\bin\Debug\WebService ...@@ -12,3 +12,17 @@ C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\WebServiceTest\bin\Debug\WebService
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\WebServiceTest\bin\Debug\WebService.dll.config C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\WebServiceTest\bin\Debug\WebService.dll.config
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\WebServiceTest\obj\Debug\WebServiceHost.csproj.CopyComplete C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\WebServiceTest\obj\Debug\WebServiceHost.csproj.CopyComplete
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\WebServiceTest\obj\Debug\WebServiceHost.csprojAssemblyReference.cache C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\WebServiceTest\obj\Debug\WebServiceHost.csprojAssemblyReference.cache
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\WebServiceTest\bin\Debug\WebServiceTest.exe.config
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\WebServiceTest\bin\Debug\WebServiceTest.exe
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\WebServiceTest\bin\Debug\WebServiceTest.pdb
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\WebServiceTest\bin\Debug\WebService.dll
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\WebServiceTest\bin\Debug\WebService.pdb
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\WebServiceTest\bin\Debug\WebService.dll.config
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\WebServiceTest\obj\Debug\WebServiceHost.csprojAssemblyReference.cache
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\WebServiceTest\obj\Debug\WebServiceTest.Form1.resources
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\WebServiceTest\obj\Debug\WebServiceTest.Properties.Resources.resources
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\WebServiceTest\obj\Debug\WebServiceHost.csproj.GenerateResource.cache
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\WebServiceTest\obj\Debug\WebServiceHost.csproj.CoreCompileInputs.cache
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\WebServiceTest\obj\Debug\WebServiceHost.csproj.CopyComplete
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\WebServiceTest\obj\Debug\WebServiceTest.exe
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\WebServiceTest\obj\Debug\WebServiceTest.pdb
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!