Commit 7671eff8 张东亮

0729

1 个父辈 2e3bc5cc
正在显示 30 个修改的文件 包含 118 行增加27 行删除
...@@ -120,6 +120,42 @@ namespace BLL ...@@ -120,6 +120,42 @@ namespace BLL
} }
} }
public bool FinishEnter(string nodeName, string rfid = "")
{
int nodeIdx = Common.nodeInfo.FindIndex(s => s.Name == nodeName);
string ip = Common.nodeInfo[nodeIdx].IP;
int idx = FindClient(ip);
if (idx == -1)
{
Common.LogInfo("FinishEnter 没有找到" + nodeName + " " + ip);
return false;
}
else
{
ClientNode node = new ClientNode(nodeName, rfid, ClientAction.FinishEnter);
byte[] buff = Encode(node);
return Send(idx, buff);
}
}
public bool FinishLeave(string nodeName, string rfid = "")
{
int nodeIdx = Common.nodeInfo.FindIndex(s => s.Name == nodeName);
string ip = Common.nodeInfo[nodeIdx].IP;
int idx = FindClient(ip);
if (idx == -1)
{
Common.LogInfo("FinishLeave 没有找到" + nodeName + " " + ip);
return false;
}
else
{
ClientNode node = new ClientNode(nodeName, rfid, ClientAction.FinishLeave);
byte[] buff = Encode(node);
return Send(idx, buff);
}
}
private void KeepLiveClient() private void KeepLiveClient()
{ {
......
...@@ -360,9 +360,9 @@ namespace AGVControl ...@@ -360,9 +360,9 @@ namespace AGVControl
s[4] = RFID; s[4] = RFID;
s[5] = AgvName; s[5] = AgvName;
} }
s[6] = Online.ToString(); s[6] = Online?"在线":"离线";
s[7] = IsUse.ToString(); s[7] = IsUse?"是":"否";
s[8] = "Clear"; s[8] = "清除";
return s; return s;
} }
...@@ -493,19 +493,25 @@ namespace AGVControl ...@@ -493,19 +493,25 @@ namespace AGVControl
/// 当前位置 /// 当前位置
/// </summary> /// </summary>
public clsPosition Position; public clsPosition Position;
public Agv_Info(string id, string name, string ip, string authorization, string ioID, bool isUse)
/// <summary>
/// 任务内容
/// </summary>
public string Msg { get; set; }
public Agv_Info(string id, string name, string ip, string authorization, string ioID, bool isUse,string rfid)
{ {
ID = id; ID = id;
Name = name; Name = name;
IP = ip; IP = ip;
Authorization = authorization; Authorization = authorization;
IOID = ioID; IOID = ioID;
RFID = ""; RFID = rfid;
IsCon = false; IsCon = false;
IsUse = isUse; IsUse = isUse;
Place = ""; Place = "";
TaskSend = ""; TaskSend = "";
NextPlace = ""; NextPlace = "";
Msg = "";
DockingInfo.IsDocking = false; DockingInfo.IsDocking = false;
DockingInfo.startTime = DateTime.Now; DockingInfo.startTime = DateTime.Now;
Position = new Agv_Info.clsPosition(); Position = new Agv_Info.clsPosition();
...@@ -597,6 +603,7 @@ namespace AGVControl ...@@ -597,6 +603,7 @@ namespace AGVControl
{ {
s.Add(StateText); s.Add(StateText);
s.Add(RFID); s.Add(RFID);
s.Add(Msg);
s.Add(MissionText); s.Add(MissionText);
s.Add(PlaceAliceName); s.Add(PlaceAliceName);
s.Add(PlaceState.ToString()); s.Add(PlaceState.ToString());
...@@ -612,13 +619,13 @@ namespace AGVControl ...@@ -612,13 +619,13 @@ namespace AGVControl
} }
else else
{ {
s.AddRange(new List<string> { "", "", "", "", "", "" }); s.AddRange(new List<string> { "", "","", "", "", "", "" });
} }
s.Add(IsExistShelf ? "满载" : "空载"); s.Add(IsExistShelf ? "满载" : "空载");
s.Add(IsCon.ToString()); s.Add(IsCon?"在线":"离线");
s.Add(Battery + "%"); s.Add(Battery + "%");
s.Add(IsUse.ToString()); s.Add(IsUse?"是":"否");
s.Add("Clear"); s.Add("清空");
return s.ToArray(); return s.ToArray();
} }
......
...@@ -169,11 +169,12 @@ namespace BLL ...@@ -169,11 +169,12 @@ namespace BLL
/// <param name="info"></param> /// <param name="info"></param>
/// <param name="mission_id"></param> /// <param name="mission_id"></param>
/// <returns></returns> /// <returns></returns>
public bool Add_Mission(Agv_Info info, string mission_id) public bool Add_Mission(Agv_Info info, string mission_id, bool isRemovePreMission = true)
{ {
try try
{ {
//防止上一个任务已执行但返回失败时,删除任务 //防止上一个任务已执行但返回失败时,删除任务
// if (isRemovePreMission)
Del_Mission(info); Del_Mission(info);
string url = "http://" + info.IP + "/api/v2.0.0/mission_queue"; string url = "http://" + info.IP + "/api/v2.0.0/mission_queue";
...@@ -204,11 +205,12 @@ namespace BLL ...@@ -204,11 +205,12 @@ namespace BLL
/// <param name="info"></param> /// <param name="info"></param>
/// <param name="mission_id"></param> /// <param name="mission_id"></param>
/// <returns></returns> /// <returns></returns>
public bool Add_Mission_Fleet(Agv_Info info, string mission_id) public bool Add_Mission_Fleet(Agv_Info info, string mission_id, bool isRemovePreMission = true)
{ {
try try
{ {
//防止上一个任务已执行但返回失败时,删除任务 //防止上一个任务已执行但返回失败时,删除任务
//if (isRemovePreMission)
Del_Mission(info); Del_Mission(info);
string ip = Common.appConfig.AppSettings.Settings["FLEET"].Value; string ip = Common.appConfig.AppSettings.Settings["FLEET"].Value;
......
...@@ -38,6 +38,8 @@ namespace AGVControl ...@@ -38,6 +38,8 @@ namespace AGVControl
{ {
n = DgvAgv.Rows.Add(Common.agvInfo[i].ToRow()); n = DgvAgv.Rows.Add(Common.agvInfo[i].ToRow());
DgvAgv.Rows[n].HeaderCell.Value = (n + 1).ToString(); DgvAgv.Rows[n].HeaderCell.Value = (n + 1).ToString();
if (i % 2 == 0)
DgvAgv.Rows[n].DefaultCellStyle.BackColor = Color.LightBlue;
if (!Common.agvInfo[i].IsCon) if (!Common.agvInfo[i].IsCon)
DgvAgv.Rows[n].DefaultCellStyle.ForeColor = Color.Red; DgvAgv.Rows[n].DefaultCellStyle.ForeColor = Color.Red;
} }
...@@ -52,6 +54,8 @@ namespace AGVControl ...@@ -52,6 +54,8 @@ namespace AGVControl
{ {
n = DgvNode.Rows.Add(Common.nodeInfo[i].ToRow()); n = DgvNode.Rows.Add(Common.nodeInfo[i].ToRow());
DgvNode.Rows[n].HeaderCell.Value = (n + 1).ToString(); DgvNode.Rows[n].HeaderCell.Value = (n + 1).ToString();
if (i % 2 == 0)
DgvNode.Rows[n].DefaultCellStyle.BackColor = Color.LightBlue;
if (!Common.nodeInfo[i].Online) if (!Common.nodeInfo[i].Online)
DgvNode.Rows[n].DefaultCellStyle.ForeColor = Color.Red; DgvNode.Rows[n].DefaultCellStyle.ForeColor = Color.Red;
} }
...@@ -84,12 +88,6 @@ namespace AGVControl ...@@ -84,12 +88,6 @@ 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 try
{ {
Invoke(new Action(() => Invoke(new Action(() =>
...@@ -119,6 +117,11 @@ namespace AGVControl ...@@ -119,6 +117,11 @@ namespace AGVControl
private void ItemExit_Click(object sender, EventArgs e) private void ItemExit_Click(object sender, EventArgs e)
{ {
foreach (var item in Common.agvInfo)
{
Common.appConfig.AppSettings.Settings[item.Name].Value = item.IsUse.ToString() + "," + item.RFID;
Common.appConfig.Save();
}
notify.Dispose(); notify.Dispose();
exit = true; exit = true;
Close(); Close();
...@@ -130,6 +133,16 @@ namespace AGVControl ...@@ -130,6 +133,16 @@ namespace AGVControl
if (WindowState == FormWindowState.Minimized) if (WindowState == FormWindowState.Minimized)
WindowState = FormWindowState.Normal; WindowState = FormWindowState.Normal;
} }
private void Control_AgvMissionChanged()
{
if (!Common.missionManager.AGV_Name_EmptyTask.Equals(""))
Invoke(new Action(() =>
{
//txtBoxAGV_EmptyTask.Text = Common.missionManager.AGV_Name_EmptyTask;
groupBox1.Text = "产线任务[" + Common.missionManager.AGV_Name_EmptyTask + "]";
}));
ShowEmptyTask();
}
private void FrmMain_Load(object sender, EventArgs e) private void FrmMain_Load(object sender, EventArgs e)
{ {
...@@ -152,6 +165,7 @@ namespace AGVControl ...@@ -152,6 +165,7 @@ namespace AGVControl
change = false; change = false;
Common.control.AgvChanged += Control_AgvChanged; Common.control.AgvChanged += Control_AgvChanged;
Common.control.AgvOnline += Control_AgvOnline; Common.control.AgvOnline += Control_AgvOnline;
Common.control.AgvMissionChanged += Control_AgvMissionChanged;
Common.server.NodeChanged += Server_NodeChanged; Common.server.NodeChanged += Server_NodeChanged;
Common.server.NodeOnline += Server_NodeOnline; Common.server.NodeOnline += Server_NodeOnline;
foreach (var item in Common.agvInfo) foreach (var item in Common.agvInfo)
...@@ -169,6 +183,12 @@ namespace AGVControl ...@@ -169,6 +183,12 @@ namespace AGVControl
e.Cancel = true; e.Cancel = true;
Hide(); Hide();
} }
foreach (var item in Common.agvInfo)
{
Common.appConfig.AppSettings.Settings[item.Name].Value = item.IsUse.ToString() + "," + item.RFID;
Common.appConfig.Save();
}
showTimer.Enabled = false; showTimer.Enabled = false;
showTimer.Stop(); showTimer.Stop();
Common.control.AgvChanged -= Control_AgvChanged; Common.control.AgvChanged -= Control_AgvChanged;
...@@ -181,14 +201,14 @@ namespace AGVControl ...@@ -181,14 +201,14 @@ namespace AGVControl
{ {
if (e.RowIndex == -1) return; if (e.RowIndex == -1) return;
if (e.ColumnIndex == 11) //调用 if (e.ColumnIndex == 12) //调用
{ {
Common.agvInfo[e.RowIndex].IsUse = !Common.agvInfo[e.RowIndex].IsUse; Common.agvInfo[e.RowIndex].IsUse = !Common.agvInfo[e.RowIndex].IsUse;
DgvAgv.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = Common.agvInfo[e.RowIndex].IsUse.ToString(); DgvAgv.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = Common.agvInfo[e.RowIndex].IsUse.ToString();
Common.appConfig.AppSettings.Settings[Common.agvInfo[e.RowIndex].Name].Value = Common.agvInfo[e.RowIndex].IsUse.ToString(); Common.appConfig.AppSettings.Settings[Common.agvInfo[e.RowIndex].Name].Value = Common.agvInfo[e.RowIndex].IsUse.ToString()+","+ Common.agvInfo[e.RowIndex].RFID;
Common.appConfig.Save(); Common.appConfig.Save();
} }
else if (e.ColumnIndex == 12) //清除缓存 else if (e.ColumnIndex == 13) //清除缓存
{ {
//清除小车缓存 //清除小车缓存
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));
...@@ -199,6 +219,7 @@ namespace AGVControl ...@@ -199,6 +219,7 @@ namespace AGVControl
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 = "";
Common.agvInfo[e.RowIndex].Msg = "";
//清除执行空架任务的小车 //清除执行空架任务的小车
if (Common.missionManager.AGV_Name_EmptyTask == Common.agvInfo[e.RowIndex].Name) if (Common.missionManager.AGV_Name_EmptyTask == Common.agvInfo[e.RowIndex].Name)
Common.missionManager.AGV_Name_EmptyTask = ""; Common.missionManager.AGV_Name_EmptyTask = "";
...@@ -273,6 +294,7 @@ namespace AGVControl ...@@ -273,6 +294,7 @@ namespace AGVControl
if (idx < 0) return; if (idx < 0) return;
if (Common.agvInfo[idx].IsCon) if (Common.agvInfo[idx].IsCon)
Common.mir.State_Pause(Common.agvInfo[idx]); Common.mir.State_Pause(Common.agvInfo[idx]);
Common.LogInfo("手动暂停:[" + Common.agvInfo[idx].Name + "]");
} }
private void BtnMissionAdd_Click(object sender, EventArgs e) private void BtnMissionAdd_Click(object sender, EventArgs e)
...@@ -286,6 +308,7 @@ namespace AGVControl ...@@ -286,6 +308,7 @@ namespace AGVControl
if (!rtn) if (!rtn)
return; return;
//Common.agvInfo[idx].TaskSend = LstAgvPlace.Text; //Common.agvInfo[idx].TaskSend = LstAgvPlace.Text;
Common.LogInfo("手动添加任务:[" + Common.agvInfo[idx].Name + "][" + Common.showNameMissionName[LstAgvPlace.Text] + "]");
} }
} }
...@@ -297,6 +320,7 @@ namespace AGVControl ...@@ -297,6 +320,7 @@ namespace AGVControl
if (idx < 0) return; if (idx < 0) return;
if (Common.agvInfo[idx].IsCon) if (Common.agvInfo[idx].IsCon)
Common.mir.Clear_Error(Common.agvInfo[idx]); Common.mir.Clear_Error(Common.agvInfo[idx]);
Common.LogInfo("手动清除错误:[" + Common.agvInfo[idx].Name + "]");
} }
private void ShowTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) private void ShowTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
...@@ -488,8 +512,9 @@ namespace AGVControl ...@@ -488,8 +512,9 @@ namespace AGVControl
if (Common.agvInfo[idx].IsCon) if (Common.agvInfo[idx].IsCon)
{ {
Common.agvInfo[idx].RFID = txtAgvRFID.Text.ToUpper(); Common.agvInfo[idx].RFID = txtAgvRFID.Text.ToUpper();
Common.LogInfo("设置 " + Common.agvInfo[idx].Name +" RFID="+ txtAgvRFID.Text); Common.LogInfo("手动设置 " + Common.agvInfo[idx].Name +" RFID="+ txtAgvRFID.Text);
} }
} }
} }
} }
...@@ -129,6 +129,9 @@ ...@@ -129,6 +129,9 @@
<metadata name="Column21.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="Column21.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="Column25.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column14.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="Column14.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
......
using BLL; using BLL;
using log4net.Config; using log4net.Config;
using log4net.Util.TypeConverters;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
...@@ -73,7 +74,7 @@ namespace AGVControl ...@@ -73,7 +74,7 @@ namespace AGVControl
string[] line; string[] line;
string[] temp; string[] temp;
bool isuse; bool isuse;
string rfid = "";
Common.appConfig = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None); Common.appConfig = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None);
Common.agvInfo = new List<Agv_Info>(); Common.agvInfo = new List<Agv_Info>();
...@@ -83,8 +84,10 @@ namespace AGVControl ...@@ -83,8 +84,10 @@ namespace AGVControl
{ {
temp = line[i].Split(','); temp = line[i].Split(',');
if (temp.Length != 5) continue; if (temp.Length != 5) continue;
isuse = Convert.ToBoolean(Common.appConfig.AppSettings.Settings[temp[1]].Value); string val = Common.appConfig.AppSettings.Settings[temp[1]].Value;
Common.agvInfo.Add(new Agv_Info(temp[0], temp[1], temp[2], temp[3], temp[4], isuse)); isuse = Convert.ToBoolean(val.Split(',')[0]);
rfid = val.Split(',')[1];
Common.agvInfo.Add(new Agv_Info(temp[0], temp[1], temp[2], temp[3], temp[4], isuse,rfid));
} }
Common.agvMission = new Dictionary<string, string>(); Common.agvMission = new Dictionary<string, string>();
......
[2020-07-21 10:14:31,645][1]INFO =====程序开始=====
2938b01b9d0da9b4db34a54b73f7f95a0ffd690c 703b23de66e95abf710a9ef1ba85365aa3755d48
...@@ -34,3 +34,17 @@ C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug ...@@ -34,3 +34,17 @@ C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug
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 C:\ZDL\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl-ProductionLine.csprojAssemblyReference.cache
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\bin\Debug\AGVControl-ProductionLine.exe.config
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\bin\Debug\AGVControl-ProductionLine.exe
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\bin\Debug\AGVControl-ProductionLine.pdb
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\bin\Debug\Newtonsoft.Json.dll
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\bin\Debug\RestSharp.dll
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\bin\Debug\RestSharp.xml
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl.FrmMain.resources
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl.Properties.Resources.resources
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl-ProductionLine.csproj.GenerateResource.cache
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl-ProductionLine.csproj.CoreCompileInputs.cache
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl-ProductionLine.csproj.CopyComplete
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl-ProductionLine.exe
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl-ProductionLine.pdb
C:\myproject\Gitee\AGVControl-Qisda-ProductionLine\AGVControl-ProductionLine\obj\Debug\AGVControl-ProductionLine.csprojAssemblyReference.cache
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
this.button3.Name = "button3"; this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(132, 54); this.button3.Size = new System.Drawing.Size(132, 54);
this.button3.TabIndex = 3; this.button3.TabIndex = 3;
this.button3.Text = "访问"; this.button3.Text = "POST访问";
this.button3.UseVisualStyleBackColor = true; this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click); this.button3.Click += new System.EventHandler(this.button3_Click);
// //
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
this.textBox1.Name = "textBox1"; this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(497, 72); this.textBox1.Size = new System.Drawing.Size(497, 72);
this.textBox1.TabIndex = 4; this.textBox1.TabIndex = 4;
this.textBox1.Text = "http://127.0.0.1/BenQMIR/Webservice/AGVService.asmx/CreateEmptyRecycleTask"; this.textBox1.Text = "http://10.85.199.1/BenQMIR/Webservice/AGVService.asmx/CreateEmptyRecycleTask";
// //
// textBox2 // textBox2
// //
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!