Commit 4f2ed27e 张东亮

添加与4C对接

1 个父辈 0f1ba7f9
正在显示 51 个修改的文件 包含 467 行增加203 行删除
...@@ -125,6 +125,7 @@ namespace BLL ...@@ -125,6 +125,7 @@ namespace BLL
{ {
while (_loop) while (_loop)
{ {
Thread.Sleep(30000);
foreach (ClientNode clientNode in Common.nodeInfo) foreach (ClientNode clientNode in Common.nodeInfo)
{ {
Thread.Sleep(3000); Thread.Sleep(3000);
...@@ -203,7 +204,7 @@ namespace BLL ...@@ -203,7 +204,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(name + " Ping " + ip + " 请求没有响应", false); Common.log.Debug(name + " Ping " + ip + " 请求没有响应");
return false; return false;
} }
return true; return true;
...@@ -455,7 +456,8 @@ namespace BLL ...@@ -455,7 +456,8 @@ namespace BLL
private int FindClient(string ip) private int FindClient(string ip)
{ {
int index = -1; int index = -1;
try
{
foreach (Client item in _client) foreach (Client item in _client)
{ {
if (item.IsConn) if (item.IsConn)
...@@ -474,22 +476,8 @@ namespace BLL ...@@ -474,22 +476,8 @@ namespace BLL
//} //}
} }
} }
}
//for (int i = 0; i < _client.Count; i++) catch { };
//{
// 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;
// }
// }
//}
return index; return index;
} }
......
...@@ -22,10 +22,6 @@ namespace AGVControl ...@@ -22,10 +22,6 @@ namespace AGVControl
/// 小车信息 /// 小车信息
/// </summary> /// </summary>
public static List<Agv_Info> agvInfo; 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.TextBox logTextBox;
public static System.Windows.Forms.DataGridView missionView; public static System.Windows.Forms.DataGridView missionView;
public static BLL.AgvServer server; public static BLL.AgvServer server;
...@@ -36,28 +32,19 @@ namespace AGVControl ...@@ -36,28 +32,19 @@ namespace AGVControl
public static string itsHttp; public static string itsHttp;
public static log4net.ILog log; public static log4net.ILog log;
public static Dictionary<string, string> agvMission; public static Dictionary<string, string> agvMission;
public static Dictionary<string, string> showNameMissionName;
public static Dictionary<string, string> agvProductionLine; public static Dictionary<string, string> agvProductionLine;
public static System.Configuration.Configuration appConfig; public static System.Configuration.Configuration appConfig;
public static MissionManager missionManager;
public static readonly string CONFIG_PATH = AppDomain.CurrentDomain.BaseDirectory + "Config\\"; public static readonly string CONFIG_PATH = AppDomain.CurrentDomain.BaseDirectory + "Config\\";
private static string msg = "";
private static string preLog = "";
private static int logCnt = 0;
public struct MissionStru
{
public string NodeName;
public string CreateTime;
/// <summary> /// <summary>
/// 任务结构 /// E21 E22 是否允许离开/进入
/// </summary> /// </summary>
/// <param name="dateTime">创建时间</param> public static bool IsAllowLeaveOrEnter = false;
/// <param name="name">节点名称</param> private static List<string> msg = new List<string>();
public MissionStru(string dateTime, string name) private static string preLog = "";
{
NodeName = name;
CreateTime = dateTime;
}
}
public static void LogInfo(string text, bool isShow = true) public static void LogInfo(string text, bool isShow = true)
{ {
if (logTextBox.InvokeRequired) if (logTextBox.InvokeRequired)
...@@ -69,22 +56,21 @@ namespace AGVControl ...@@ -69,22 +56,21 @@ namespace AGVControl
if (preLog.Equals(text))//连续重复的日志只打印一次 if (preLog.Equals(text))//连续重复的日志只打印一次
return; return;
preLog = text; preLog = text;
logCnt++; if (msg.Count > 25)
if (logCnt > 200)
{ {
logCnt = 0; msg.RemoveRange(0,10);
msg = "";
} }
log.Info(text); log.Info(text);
string tmpStr="";
if (isShow) if (isShow)
{ {
msg += string.Format("[{0}] {1}\r\n", DateTime.Now.ToString("HH:mm:ss"), text); msg.Add(string.Format("[{0}] {1}\r\n", DateTime.Now.ToString("HH:mm:ss"), text));
logTextBox.Text = msg; msg.ForEach(s=> tmpStr+= s);
logTextBox.Text = tmpStr;
} }
} }
public static void ReadLinePlace() public static void ReadLinePlace()
{ {
missionList = new List<MissionStru>();
if (!System.IO.File.Exists(CONFIG_PATH + "LinePlace.txt")) if (!System.IO.File.Exists(CONFIG_PATH + "LinePlace.txt"))
{ {
File.Create(CONFIG_PATH + "LinePlace.txt"); File.Create(CONFIG_PATH + "LinePlace.txt");
...@@ -97,7 +83,7 @@ namespace AGVControl ...@@ -97,7 +83,7 @@ namespace AGVControl
string[] mission = s[i].Split(','); string[] mission = s[i].Split(',');
if (mission.Length != 2) if (mission.Length != 2)
continue; continue;
missionList.Add(new MissionStru(mission[0], mission[1])); missionManager.missionList.Add(new MissionStru(mission[0], mission[1]));
} }
...@@ -109,10 +95,10 @@ namespace AGVControl ...@@ -109,10 +95,10 @@ namespace AGVControl
int idx = Common.nodeInfo.FindIndex(s => s.Name == nodeName); int idx = Common.nodeInfo.FindIndex(s => s.Name == nodeName);
if (idx > -1) 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")) 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)); file.WriteLine(string.Format("{0},{1}",item.CreateTime, item.NodeName));
} }
...@@ -134,13 +120,13 @@ namespace AGVControl ...@@ -134,13 +120,13 @@ namespace AGVControl
int idx = Common.nodeInfo.FindIndex(s => s.Name == nodeName); int idx = Common.nodeInfo.FindIndex(s => s.Name == nodeName);
if (idx > -1) if (idx > -1)
{ {
idx = Common.missionList.FindIndex(s => s.NodeName == nodeName); idx = Common.missionManager.missionList.FindIndex(s => s.NodeName == nodeName);
if(idx>-1) 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")) 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)); file.WriteLine(string.Format("{0},{1}", item.CreateTime, item.NodeName));
} }
...@@ -182,7 +168,7 @@ namespace AGVControl ...@@ -182,7 +168,7 @@ namespace AGVControl
} }
else else
{ {
Common.log.Error("CheckAGVMissionState 获取PLC20失败"); Common.log.Debug("CheckAGVMissionState 获取PLC20失败");
} }
} }
} }
...@@ -201,7 +187,7 @@ namespace AGVControl ...@@ -201,7 +187,7 @@ namespace AGVControl
} }
else else
{ {
Common.log.Error("GetNodesPosition 获取节点位置失败"); Common.log.Debug("GetNodesPosition 获取节点位置失败");
} }
} }
} }
...@@ -312,16 +298,19 @@ namespace AGVControl ...@@ -312,16 +298,19 @@ namespace AGVControl
/// 节点位置坐标 /// 节点位置坐标
/// </summary> /// </summary>
public PositionStru position; public PositionStru position;
public string AliceName { get; set; }
/// <summary> /// <summary>
/// 客户端节点 /// 客户端节点
/// </summary> /// </summary>
/// <param name="name"></param> /// <param name="name"></param>
/// <param name="ip"></param> /// <param name="ip"></param>
/// <param name="isUse"></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; Name = name;
IP = ip; IP = ip;
AliceName = aliceName;
RFID = rfid; RFID = rfid;
Action = ClientAction.None; Action = ClientAction.None;
AgvName = ""; AgvName = "";
...@@ -362,7 +351,7 @@ namespace AGVControl ...@@ -362,7 +351,7 @@ namespace AGVControl
{ {
//节点,IP,动作,RFID,AGV名称,在线,调用,清除AGV //节点,IP,动作,RFID,AGV名称,在线,调用,清除AGV
string[] s = new string[9]; string[] s = new string[9];
s[0] = Name; s[0] = AliceName;
s[1] = IP; s[1] = IP;
if (Online) if (Online)
{ {
...@@ -428,6 +417,10 @@ namespace AGVControl ...@@ -428,6 +417,10 @@ namespace AGVControl
/// 地点 /// 地点
/// </summary> /// </summary>
public string Place { set; get; } public string Place { set; get; }
/// <summary>
/// 地点
/// </summary>
public string PlaceAliceName { set; get; } = "";
/// <summary> /// <summary>
/// 地点的状态 /// 地点的状态
...@@ -459,7 +452,10 @@ namespace AGVControl ...@@ -459,7 +452,10 @@ namespace AGVControl
/// 下一个地点 /// 下一个地点
/// </summary> /// </summary>
public string NextPlace { set; get; } public string NextPlace { set; get; }
/// <summary>
/// 下一个地点
/// </summary>
public string NextPlaceAliceName { set; get; } = "";
/// <summary> /// <summary>
/// 关门,用于执行一次 /// 关门,用于执行一次
...@@ -547,9 +543,18 @@ namespace AGVControl ...@@ -547,9 +543,18 @@ namespace AGVControl
int a = value / 1000; int a = value / 1000;
int b = (value - a * 1000) / 10; int b = (value - a * 1000) / 10;
int c = value - a * 1000 - b * 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 = ""; TaskSend = "";
Place = (char)(64 + a) + b.ToString(); 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; PlaceState = (PlaceState)c;
} }
} }
...@@ -565,9 +570,17 @@ namespace AGVControl ...@@ -565,9 +570,17 @@ namespace AGVControl
s.Add(StateText); s.Add(StateText);
s.Add(RFID); s.Add(RFID);
s.Add(MissionText); s.Add(MissionText);
s.Add(Place); s.Add(PlaceAliceName);
s.Add(PlaceState.ToString()); 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 else
{ {
...@@ -751,5 +764,42 @@ namespace AGVControl ...@@ -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 \ No newline at end of file
...@@ -157,30 +157,30 @@ namespace BLL ...@@ -157,30 +157,30 @@ namespace BLL
return result; return result;
} }
//public static string Get(string url) public static string Get(string url)
//{ {
// return Get(url, Encoding.UTF8); return Get(url, Encoding.UTF8);
//} }
//public static string Get(string url, Encoding encoding) public static string Get(string url, Encoding encoding)
//{ {
// try try
// { {
// LogUtil.info("HTTP GET FROM: " + url); Common.log.Debug("HTTP GET FROM: " + url);
// var wc = new WebClient { Encoding = encoding }; var wc = new WebClient { Encoding = encoding };
// var readStream = wc.OpenRead(url); var readStream = wc.OpenRead(url);
// using (var sr = new StreamReader(readStream, encoding)) using (var sr = new StreamReader(readStream, encoding))
// { {
// var result = sr.ReadToEnd(); var result = sr.ReadToEnd();
// LogUtil.info("receive << " + result); Common.log.Debug("receive << " + result);
// return result; return result;
// } }
// } }
// catch (Exception e) catch (Exception e)
// { {
// LogUtil.error("HTTP GET ERROR:" + e.Message, 2); Common.log.Error("HTTP GET ERROR:" + e.Message);
// } }
// return ""; return "";
//} }
} }
} }
\ No newline at end of file \ No newline at end of file
...@@ -373,7 +373,7 @@ namespace BLL ...@@ -373,7 +373,7 @@ namespace BLL
} }
catch (Exception ex) catch (Exception ex)
{ {
Common.log.Error("Get_State", ex); //Common.log.Error("Get_State", ex);
return false; return false;
} }
} }
...@@ -442,7 +442,7 @@ namespace BLL ...@@ -442,7 +442,7 @@ namespace BLL
} }
catch (Exception ex) catch (Exception ex)
{ {
Common.log.Error("State_Ready", ex); //Common.log.Error("State_Ready", ex);
return false; return false;
} }
} }
...@@ -525,7 +525,7 @@ namespace BLL ...@@ -525,7 +525,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 + " 请求没有响应", false); Common.LogInfo("Ping " + ip + " 请求没有响应");
return false; return false;
} }
return true; return true;
......
...@@ -65,7 +65,7 @@ namespace BLL ...@@ -65,7 +65,7 @@ namespace BLL
if (AGVControl.Common.agvProductionLine.TryGetValue(emptyStation, out string value)) if (AGVControl.Common.agvProductionLine.TryGetValue(emptyStation, out string value))
{ {
res = new Result() { Succeed = true, ResultData = null, ErrorMessage = "" }; 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); //int idx = AGVControl.Common.nodeInfo.FindIndex(s => s.Name == value);
...@@ -101,6 +101,10 @@ namespace BLL ...@@ -101,6 +101,10 @@ namespace BLL
{ {
line = "FeederOut"; line = "FeederOut";
} }
else if (line.Equals("4CFeeder"))
{
line = "4CFeederOut";
}
AGVControl.Common.LogInfo("WebService Request emptyStation=" + line,false); AGVControl.Common.LogInfo("WebService Request emptyStation=" + line,false);
//if (line == null) //if (line == null)
// res = new Result() { Succeed = "false", ResultData = null, ErrorMessage = "line =null " }; // res = new Result() { Succeed = "false", ResultData = null, ErrorMessage = "line =null " };
......
...@@ -6,6 +6,7 @@ using System.Data; ...@@ -6,6 +6,7 @@ using System.Data;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
...@@ -23,9 +24,9 @@ namespace AGVControl ...@@ -23,9 +24,9 @@ namespace AGVControl
InitializeComponent(); InitializeComponent();
showTimer = new System.Timers.Timer(); showTimer = new System.Timers.Timer();
showTimer.Interval = 3000; showTimer.Interval = 3000;
showTimer.Enabled = true; //showTimer.Enabled = true;
showTimer.Elapsed += ShowTimer_Elapsed; showTimer.Elapsed += ShowTimer_Elapsed;
showTimer.Start(); // showTimer.Start();
Common.logTextBox = TxtLog; Common.logTextBox = TxtLog;
} }
...@@ -41,6 +42,12 @@ namespace AGVControl ...@@ -41,6 +42,12 @@ namespace AGVControl
DgvAgv.Rows[n].DefaultCellStyle.ForeColor = Color.Red; 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++) for (int i = 0; i < Common.nodeInfo.Count; i++)
{ {
n = DgvNode.Rows.Add(Common.nodeInfo[i].ToRow()); n = DgvNode.Rows.Add(Common.nodeInfo[i].ToRow());
...@@ -50,7 +57,7 @@ namespace AGVControl ...@@ -50,7 +57,7 @@ namespace AGVControl
} }
LstAgvPlace.Items.Clear(); LstAgvPlace.Items.Clear();
LstAgvPlace.Items.AddRange(Common.agvMission.Keys.ToArray()); LstAgvPlace.Items.AddRange(Common.showNameMissionName.Keys.ToArray());
LstAgvPlace.SelectedIndex = 0; LstAgvPlace.SelectedIndex = 0;
} }
...@@ -60,12 +67,14 @@ namespace AGVControl ...@@ -60,12 +67,14 @@ namespace AGVControl
{ {
DgvNode.Rows[nodeIndex].SetValues(Common.nodeInfo[nodeIndex].ToRow()); DgvNode.Rows[nodeIndex].SetValues(Common.nodeInfo[nodeIndex].ToRow());
})); }));
ShowEmptyTask();
System.GC.Collect(); System.GC.Collect();
} }
private void Server_NodeOnline(int nodeIndex) private void Server_NodeOnline(int nodeIndex)
{ {
Invoke(new Action(() => { DgvNode.Rows[nodeIndex].DefaultCellStyle.ForeColor = Common.nodeInfo[nodeIndex].Online ? Color.Black : Color.Red; })); Invoke(new Action(() => { DgvNode.Rows[nodeIndex].DefaultCellStyle.ForeColor = Common.nodeInfo[nodeIndex].Online ? Color.Black : Color.Red; }));
ShowEmptyTask();
System.GC.Collect(); System.GC.Collect();
} }
...@@ -75,7 +84,23 @@ namespace AGVControl ...@@ -75,7 +84,23 @@ namespace AGVControl
{ {
DgvAgv.Rows[agvIndex].SetValues(Common.agvInfo[agvIndex].ToRow()); 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(); System.GC.Collect();
} }
...@@ -169,9 +194,14 @@ namespace AGVControl ...@@ -169,9 +194,14 @@ 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].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].TaskSend = ""; 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()); DgvAgv.Rows[e.RowIndex].SetValues(Common.agvInfo[e.RowIndex].ToRow());
//清除节点缓存 //清除节点缓存
...@@ -207,9 +237,9 @@ namespace AGVControl ...@@ -207,9 +237,9 @@ namespace AGVControl
Common.LogInfo(string.Format("手动清除缓存,{0} {1}", Common.nodeInfo[e.RowIndex].AgvName, Common.nodeInfo[e.RowIndex].Name)); Common.LogInfo(string.Format("手动清除缓存,{0} {1}", Common.nodeInfo[e.RowIndex].AgvName, Common.nodeInfo[e.RowIndex].Name));
//string name = Common.nodeInfo[e.RowIndex].AgvName; //string name = Common.nodeInfo[e.RowIndex].AgvName;
Common.nodeInfo[e.RowIndex].AgvName = ""; Common.nodeInfo[e.RowIndex].AgvName = "";
DgvNode.Rows[e.RowIndex].Cells[5].Value = "";
Common.nodeInfo[e.RowIndex].RFID = ""; Common.nodeInfo[e.RowIndex].RFID = "";
DgvNode.Rows[e.RowIndex].Cells[4].Value = ""; DgvNode.Rows[e.RowIndex].Cells[4].Value = "";
//清除小车缓存 //清除小车缓存
//int idx = Common.agvInfo.FindIndex(s => s.Name == name); //int idx = Common.agvInfo.FindIndex(s => s.Name == name);
//if (idx > -1) //if (idx > -1)
...@@ -252,10 +282,10 @@ namespace AGVControl ...@@ -252,10 +282,10 @@ namespace AGVControl
if (idx < 0) return; if (idx < 0) return;
if (Common.agvInfo[idx].IsCon) 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) if (!rtn)
return; return;
Common.agvInfo[idx].TaskSend = LstAgvPlace.Text; //Common.agvInfo[idx].TaskSend = LstAgvPlace.Text;
} }
} }
...@@ -285,13 +315,13 @@ namespace AGVControl ...@@ -285,13 +315,13 @@ namespace AGVControl
{ {
if (dgvLineMission.Rows.Count != 0) if (dgvLineMission.Rows.Count != 0)
dgvLineMission.Rows.Clear(); 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); var key = Common.agvProductionLine.Where(q => q.Value == item.NodeName).Select(q => q.Key);
dgvLineMission.Rows.Add(item.CreateTime, key.ToList()[0]); dgvLineMission.Rows.Add(item.CreateTime, key.ToList()[0]);
} }
} }
catch(Exception ex) catch (Exception ex)
{ {
Common.log.Error(ex); Common.log.Error(ex);
} }
...@@ -337,7 +367,7 @@ namespace AGVControl ...@@ -337,7 +367,7 @@ namespace AGVControl
if (Common.agvInfo[idx].IsCon) 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) if (!rtn)
return; return;
Common.agvInfo[idx].TaskSend = "AutoCharge" + num.ToString(); Common.agvInfo[idx].TaskSend = "AutoCharge" + num.ToString();
...@@ -355,9 +385,9 @@ namespace AGVControl ...@@ -355,9 +385,9 @@ namespace AGVControl
private void cmbBoxAGVName_SelectedIndexChanged(object sender, EventArgs e) private void cmbBoxAGVName_SelectedIndexChanged(object sender, EventArgs e)
{ {
if(cmbBoxAGVName.SelectedItem!=null) if (cmbBoxAGVName.SelectedItem != null)
{ {
switch(cmbBoxAGVName.SelectedIndex) switch (cmbBoxAGVName.SelectedIndex)
{ {
case 0: case 0:
TxtCharge4.Text = "MiR_R1763"; TxtCharge4.Text = "MiR_R1763";
...@@ -406,45 +436,60 @@ namespace AGVControl ...@@ -406,45 +436,60 @@ namespace AGVControl
private void btnDeleteMission_Click(object sender, EventArgs e) private void btnDeleteMission_Click(object sender, EventArgs e)
{ {
if (txtBoxMission.Text == "")
return;
try 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]); //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));
// }
//} ShowEmptyTask();
txtBoxMission.Text = ""; Common.LogInfo("手动删除任务成功:" + cmbBoxLineName.SelectedItem.ToString());
} }
else else
{ {
Common.log.Error("手动删除任务失败"); ShowEmptyTask();
txtBoxMission.Text = ""; Common.LogInfo("手动删除任务失败");
} }
} }
catch(Exception ex) catch (Exception ex)
{ {
Common.log.Error("手动删除任务失败:"+ex.Message); ShowEmptyTask();
txtBoxMission.Text = ""; Common.log.Error("手动删除任务失败:" + ex.Message);
} }
} }
private void button1_Click(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e)
{ {
Common.MissionStru k = Common.missionList[0]; Task.Factory.StartNew(new Action(() =>
Common.missionList.Remove(k); {
Common.LogInfo("剩余需要出空料架的节点:"); Common.IsAllowLeaveOrEnter = true;
Common.missionList.ForEach(s =>Common.LogInfo(string.Format("创建时间:{0},任务节点{1}",s.CreateTime,s.NodeName))); 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; ...@@ -4,6 +4,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
...@@ -40,6 +41,7 @@ namespace AGVControl ...@@ -40,6 +41,7 @@ namespace AGVControl
} }
Common.logTextBox = new TextBox(); Common.logTextBox = new TextBox();
Common.missionView = new DataGridView(); Common.missionView = new DataGridView();
Common.missionManager = new MissionManager();
Common.log = log4net.LogManager.GetLogger("AgvServer"); Common.log = log4net.LogManager.GetLogger("AgvServer");
Common.LogInfo("=====程序开始====="); Common.LogInfo("=====程序开始=====");
ReadConfig(); ReadConfig();
...@@ -76,7 +78,7 @@ namespace AGVControl ...@@ -76,7 +78,7 @@ namespace AGVControl
Common.agvInfo = new List<Agv_Info>(); Common.agvInfo = new List<Agv_Info>();
path = Common.CONFIG_PATH + "AgvName.csv"; 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++) for (int i = 1; i < line.Length; i++)
{ {
temp = line[i].Split(','); temp = line[i].Split(',');
...@@ -86,27 +88,29 @@ namespace AGVControl ...@@ -86,27 +88,29 @@ namespace AGVControl
} }
Common.agvMission = new Dictionary<string, string>(); Common.agvMission = new Dictionary<string, string>();
Common.showNameMissionName = new Dictionary<string, string>();
path = Common.CONFIG_PATH + "AgvMission.csv"; path = Common.CONFIG_PATH + "AgvMission.csv";
line = System.IO.File.ReadAllLines(path); line = System.IO.File.ReadAllLines(path, Encoding.UTF8);
for (int i = 0; i < line.Length; i++) for (int i = 1; i < line.Length; i++)
{ {
temp = line[i].Split(','); temp = line[i].Split(',');
if (temp.Length != 2) continue; if (temp.Length != 3) continue;
Common.agvMission.Add(temp[0], temp[1]); Common.agvMission.Add(temp[1], temp[2]);
Common.showNameMissionName.Add(temp[0], temp[1]);
} }
Common.nodeInfo = new List<ClientNode>(); Common.nodeInfo = new List<ClientNode>();
Common.chargeStatus = new ChargeStatus(); Common.chargeStatus = new ChargeStatus();
Common.agvProductionLine = new Dictionary<string, string>(); Common.agvProductionLine = new Dictionary<string, string>();
path = Common.CONFIG_PATH + "AgvProductionLine.csv"; 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++) for (int i = 1; i < line.Length; i++)
{ {
temp = line[i].Split(','); temp = line[i].Split(',');
if (temp.Length != 5) continue; if (temp.Length != 6) continue;
Common.agvProductionLine.Add(temp[0], temp[1]); Common.agvProductionLine.Add(temp[0], temp[1]);
bool isUse = Convert.ToBoolean(Common.appConfig.AppSettings.Settings[temp[1]].Value); 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 产线任务名称,任务名称,任务GUID
MoveA6,7e5e9dc2-b521-11ea-b6ad-00012998f5a0 下料区(A5),MoveA5,679f2ca1-b520-11ea-b6ad-00012998f5a0
MoveE1,73bcddb3-b513-11ea-b6ad-00012998f5a0 上料区(A6),MoveA6,7e5e9dc2-b521-11ea-b6ad-00012998f5a0
MoveE2,9bacf16b-b515-11ea-b6ad-00012998f5a0 4D-1线,MoveE1,73bcddb3-b513-11ea-b6ad-00012998f5a0
MoveE3,f84313b5-b515-11ea-b6ad-00012998f5a0 4D-2线,MoveE2,9bacf16b-b515-11ea-b6ad-00012998f5a0
MoveE4,5683db0e-b516-11ea-b6ad-00012998f5a0 4D-3线,MoveE3,f84313b5-b515-11ea-b6ad-00012998f5a0
MoveE5,9c04b71b-b516-11ea-b6ad-00012998f5a0 4D-4线,MoveE4,5683db0e-b516-11ea-b6ad-00012998f5a0
MoveE6,f46be62a-b516-11ea-b6ad-00012998f5a0 4D-5线,MoveE5,9c04b71b-b516-11ea-b6ad-00012998f5a0
MoveE7, 4D-6线,MoveE6,f46be62a-b516-11ea-b6ad-00012998f5a0
MoveE8,41dccfcf-b517-11ea-b6ad-00012998f5a0 4D-8线,MoveE8,41dccfcf-b517-11ea-b6ad-00012998f5a0
MoveE9,7fc3ec2f-b517-11ea-b6ad-00012998f5a0 4D-9线,MoveE9,7fc3ec2f-b517-11ea-b6ad-00012998f5a0
MoveE10,e7c0ad9c-b517-11ea-b6ad-00012998f5a0 4D-10线,MoveE10,e7c0ad9c-b517-11ea-b6ad-00012998f5a0
MoveE11,2e23a510-b518-11ea-b6ad-00012998f5a0 4D-11线,MoveE11,2e23a510-b518-11ea-b6ad-00012998f5a0
MoveE12,6efb37bc-b519-11ea-b6ad-00012998f5a0 4D-12线,MoveE12,6efb37bc-b519-11ea-b6ad-00012998f5a0
MoveE13, 4D-14线,MoveE14,b03043fd-b519-11ea-b6ad-00012998f5a0
MoveE14,b03043fd-b519-11ea-b6ad-00012998f5a0 4D-15线,MoveE15,f3f9a668-b519-11ea-b6ad-00012998f5a0
MoveE15,f3f9a668-b519-11ea-b6ad-00012998f5a0 4D-16线,MoveE16,5ec0f64a-b51a-11ea-b6ad-00012998f5a0
MoveE16,5ec0f64a-b51a-11ea-b6ad-00012998f5a0 4D-FeedeerIn,MoveE21,37401585-b51b-11ea-b6ad-00012998f5a0
MoveE21,37401585-b51b-11ea-b6ad-00012998f5a0 4D-FeederOut,MoveE22,a4846723-b51b-11ea-b6ad-00012998f5a0
MoveE22,a4846723-b51b-11ea-b6ad-00012998f5a0 4C-4D门,MoveDoorCToD,d67f31c8-ca7e-11ea-9a66-94c691a7387d
Init,adcb7a04-b525-11ea-b6ad-00012998f5a0 4D-4C门,MoveDoorDToC,fd6e26ac-c1bf-11ea-9a66-94c691a7387d
Enter,51233d8c-c044-11ea-9a66-94c691a7387d 4C-10线,MoveG10,c0b75c41-ca7d-11ea-9a66-94c691a7387d
Leave,2e433130-c045-11ea-9a66-94c691a7387d 4C-FeedeerIn,MoveG21,0a657afd-ca9d-11ea-9a66-94c691a7387d
MoveStandby,ae6e4f12-c050-11ea-9a66-94c691a7387d 4C-FeedeerOut,MoveG22,0a657afd-ca9d-11ea-9a66-94c691a7387d
AutoCharge3,b7371c5f-c045-11ea-9a66-94c691a7387d 小车初始化,Init,adcb7a04-b525-11ea-b6ad-00012998f5a0
AutoCharge4,1296084c-c046-11ea-9a66-94c691a7387d 小车进料,Enter,51233d8c-c044-11ea-9a66-94c691a7387d
AutoCharge5,40c8f44e-c046-11ea-9a66-94c691a7387d 小车出料,Leave,2e433130-c045-11ea-9a66-94c691a7387d
AutoCharge6,56cca0a3-c046-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 产线名,节点名,IP,产线别名,位置名称,位置guid
A5,A5,,PA5,7ed952c3-b520-11ea-b6ad-00012998f5a0 A5,A5,10.85.199.20,下料区(A5),PA5,7ed952c3-b520-11ea-b6ad-00012998f5a0
A6,A6,,PA6,929eb1c2-b520-11ea-b6ad-00012998f5a0 A6,A6,10.85.199.20,上料区(A6),PA6,929eb1c2-b520-11ea-b6ad-00012998f5a0
D1,E1,10.85.199.42,DL1,3b823fe4-b368-11ea-a1a5-00012999830e D1,E1,10.85.199.1,4D-1线,DL1,3b823fe4-b368-11ea-a1a5-00012999830e
D2,E2,10.85.199.90,DL2,ede15fcb-b367-11ea-a1a5-00012999830e D2,E2,10.85.199.1,4D-2线,DL2,ede15fcb-b367-11ea-a1a5-00012999830e
D3,E3,10.85.199.91,DL3,43855a9b-b365-11ea-a1a5-00012999830e D3,E3,10.85.199.1,4D-3线,DL3,43855a9b-b365-11ea-a1a5-00012999830e
D4,E4,10.85.199.92,DL4,73c8b98c-b368-11ea-a1a5-00012999830e D4,E4,10.85.199.1,4D-4线,DL4,73c8b98c-b368-11ea-a1a5-00012999830e
D5,E5,10.85.199.93,DL5,5436efd7-b432-11ea-a1a5-00012999830e D5,E5,10.85.199.1,4D-5线,DL5,5436efd7-b432-11ea-a1a5-00012999830e
D6,E6,10.85.199.94,DL6,6b7710c1-b432-11ea-a1a5-00012999830e D6,E6,10.85.199.1,4D-6线,DL6,6b7710c1-b432-11ea-a1a5-00012999830e
D8,E8,10.85.199.95,DL8,8f039d2e-b432-11ea-a1a5-00012999830e D8,E8,10.85.199.1,4D-8线,DL8,8f039d2e-b432-11ea-a1a5-00012999830e
D9,E9,10.85.199.180,DL9,9e0b64ab-b432-11ea-a1a5-00012999830e D9,E9,10.85.199.1,4D-9线,DL9,9e0b64ab-b432-11ea-a1a5-00012999830e
D10,E10,10.85.199.181,DL10,aec7da80-b432-11ea-a1a5-00012999830e D10,E10,10.85.199.1,4D-10线,DL10,aec7da80-b432-11ea-a1a5-00012999830e
D11,E11,10.85.199.182,DL11,c10984c9-b432-11ea-a1a5-00012999830e D11,E11,10.85.199.1,4D-11线,DL11,c10984c9-b432-11ea-a1a5-00012999830e
D12,E12,10.85.199.183,DL12,d6e0b92a-b432-11ea-a1a5-00012999830e D12,E12,10.85.199.1,4D-12线,DL12,d6e0b92a-b432-11ea-a1a5-00012999830e
D14,E14,10.85.199.184,DL14,efb04c55-b432-11ea-a1a5-00012999830e D14,E14,10.85.199.1,4D-14线,DL14,efb04c55-b432-11ea-a1a5-00012999830e
D15,E15,10.85.199.185,DL15,fd6b1f95-b432-11ea-a1a5-00012999830e D15,E15,10.85.199.1,4D-15线,DL15,fd6b1f95-b432-11ea-a1a5-00012999830e
D16,E16,10.85.199.96,line_16,ac6c413e-895e-11ea-9374-000129922ca6 D16,E16,10.85.199.1,4D-16线,line_16,ac6c413e-895e-11ea-9374-000129922ca6
FeederIn,E21,,PA21, FeederIn,E21,10.85.199.1,4D-FeedeerIn,FI,1e546c3a-8abe-11ea-ab63-000129922ca6
FeederOut,E22,,PA22, FeederOut,E22,10.85.199.1,4D-FeederOut,FO,431649a4-8abe-11ea-ab63-000129922ca6
C1,G1,,PA23, C10,G10,10.85.199.1,4C-10线,G10,604b1c3c-ca4e-11ea-810b-00012999830e
C2,G2,,PA24, 4CFeederIn,G21,10.85.199.1,4C-FeederIn,tyty,cb7f117b-ca88-11ea-9b28-0001299981d4
C3,G3,,PA25, 4CFeederOut,G22,10.85.199.1,4C-FeederOut,tyty,cb7f117b-ca88-11ea-9b28-0001299981d4
C4,G4,,PA26, C1,G1,10.85.199.1,4C-1线,PA23,
C5,G5,,PA27, C2,G2,10.85.199.1,4C-2线,PA24,
C6,G6,,PA28, C3,G3,10.85.199.1,4C-3线,PA25,
C7,G7,,PA29, C4,G4,10.85.199.1,4C-4线,PA26,
C8,G8,,PA30, C5,G5,10.85.199.1,4C-5线,PA27,
C9,G9,,PA31, C6,G6,10.85.199.1,4C-6线,PA28,
C10,G10,,PA32, C7,G7,10.85.199.1,4C-7线,PA29,
C11,G11,,PA33, C8,G8,10.85.199.1,4C-8线,PA30,
C12,G12,,PA34, C9,G9,10.85.199.1,4C-9线,PA31,
C13,G13,,PA35, C11,G11,10.85.199.1,4C-11线,PA33,
C14,G14,,PA36, C12,G12,10.85.199.1,4C-12线,PA34,
C15,G15,,PA37, C13,G13,10.85.199.1,4C-13线,PA35,
C16,G16,,PA38, 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 ...@@ -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\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\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.csproj.CoreCompileInputs.cache
C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl-ProductionLine.csprojAssemblyReference.cache
此文件类型无法预览
...@@ -47,6 +47,9 @@ namespace AgvClientTest ...@@ -47,6 +47,9 @@ namespace AgvClientTest
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("G10", "", AsaPL.ClientAction.None);
client.SetStatus("G21", "", AsaPL.ClientAction.None);
client.SetStatus("G22", "", AsaPL.ClientAction.None);
client.Connect(); 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 ...@@ -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.exe
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
...@@ -78,6 +78,84 @@ namespace BLL ...@@ -78,6 +78,84 @@ namespace BLL
} }
return rb; 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 public class Result
......
...@@ -36,6 +36,8 @@ ...@@ -36,6 +36,8 @@
this.textBox2 = new System.Windows.Forms.TextBox(); this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox(); this.textBox3 = new System.Windows.Forms.TextBox();
this.button4 = new System.Windows.Forms.Button(); this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.button6 = new System.Windows.Forms.Button();
this.SuspendLayout(); this.SuspendLayout();
// //
// button1 // button1
...@@ -112,11 +114,33 @@ ...@@ -112,11 +114,33 @@
this.button4.UseVisualStyleBackColor = true; this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click); 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 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 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.button4);
this.Controls.Add(this.textBox3); this.Controls.Add(this.textBox3);
this.Controls.Add(this.textBox2); this.Controls.Add(this.textBox2);
...@@ -142,6 +166,8 @@ ...@@ -142,6 +166,8 @@
private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox textBox3; private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Button button4; private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Button button6;
} }
} }
...@@ -113,5 +113,16 @@ namespace WebServiceTest ...@@ -113,5 +113,16 @@ namespace WebServiceTest
{ {
AGVManager.GetWebservice(textBox1.Text, textBox2.Text); 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!