Commit 411cfaab 张东亮

在待机位挺时间长以及在A4不动逻辑修改

1 个父辈 81316f3e
......@@ -35,31 +35,9 @@ namespace BLL
return true;
}
if (serverResult.code != 0) return true;
agv.LeftTaskCnt = serverResult.data.taskCount;
if (serverResult.data.taskCount == 0) //该料架出库完成
{
//清除mark
List<string> markLst = new List<string>();
foreach (var mark in Common.control.Marks)
{
int count = 0;
foreach (var node in Common.nodeInfo)
{
if (mark.Equals(node.Mark))
count++;
}
if (count == 0)//mark存在标记,但节点任务没有,删除该mark
{
markLst.Add(mark);
}
}
if (markLst.Count != 0)
{
for (int i = 0; i < markLst.Count; i++)
{
Common.control.Marks.Remove(markLst[i]);
}
}
Common.log.OutInfo(agv.Name+" 料架【" + agv.RFID + "】 无剩余出库任务,serverResult.shelfTaskData.taskCount=" + serverResult.data.taskCount.ToString());
return true;
}
......
......@@ -287,7 +287,7 @@ namespace BLL
if (change)
AgvChanged?.Invoke(i);
Common.log.OutInfo(log);
//Common.log.OutInfo(log);
}
catch (Exception ex)
{
......@@ -1301,6 +1301,39 @@ namespace BLL
return FindNeedEnterWithMark(agv);
}
private readonly object clearMarkObj = new object();
/// <summary>
/// 清除节点上无mark,但任务里还有mark的情况
/// </summary>
private void ClearMarkByNodeMark()
{
lock (clearMarkObj)
{
//清除mark
List<string> markLst = new List<string>();
foreach (var mark in Common.control.Marks)
{
int count = 0;
foreach (var node in Common.nodeInfo)
{
if (mark.Equals(node.Mark))
count++;
}
if (count == 0)//mark存在标记,但节点任务没有,删除该mark
{
markLst.Add(mark);
}
}
if (markLst.Count != 0)
{
for (int i = 0; i < markLst.Count; i++)
{
Common.control.Marks.Remove(markLst[i]);
}
}
}
}
private bool B123456Enter(Agv_Info agv)
{
int nodeIdx;
......@@ -1972,7 +2005,10 @@ namespace BLL
}
else
{
//在Mark缓存中,按照先后顺序出料,只有第一个出完才能出第二个
//在Mark缓存中,如果所有节点只有一mark,那么直接出。多个的按照先后顺序出料,只有第一个出完才能出第二个
List<ClientNode> lst = Common.nodeInfo.FindAll(s => s.Mark == Common.nodeInfo[node[i]].Mark);
if (lst != null && lst.Count > 1)//出库涉及多个仓,按顺序执行
{
int idx = Marks.FindIndex(s => s == Common.nodeInfo[node[i]].Mark);
if (idx == 0)
{
......@@ -1980,6 +2016,12 @@ namespace BLL
break;
}
}
else if (lst != null && lst.Count == 1)//只有一个仓出库,则直接出库
{
nodeIdx = node[i];
break;
}
}
}
......@@ -2028,10 +2070,50 @@ namespace BLL
if (!BAreaLeaveCheck)
{
nodeIdx = Common.nodeInfo.FindIndex(s =>s.Mark == agv.Mark);
if(nodeIdx==-1)
{
nodeIdx = Common.nodeInfo.FindIndex(s => s.Name=="A3" && s.Action == ClientAction.NeedEnter && s.AgvName == "" && s.IsUse);
if(nodeIdx==-1)
{
ClearMarkByNodeMark();
string log = agv.Name + " A4 FindNeedEnterWithMark 节点mark没有找到[Mark=" + agv.Mark + "],去A3";
Common.log.OutInfo(log);
return MoveNode(agv, nodeIdx);
}
else
{
if (!agv.StandbyTemp)
{
agv.StandbyTemp = true;
foreach (var item in Common.nodeInfo)
{
if (item.AgvName.Equals(agv.Name))
item.AgvName = "";
}
string log = agv.Name + " A4 FindNeedEnterWithMark 节点mark没有找到[Mark=" + agv.Mark + "],移动到MoveStandbyTemp";
Common.log.OutInfo(log);
Common.mir.Add_Mission_Fleet(agv, Common.agvMission["MoveStandbyTemp"]);
}
return true;
}
}
else
{
string log = agv.Name + " A4 FindNeedEnterWithMark [Mark=" + agv.Mark + "]";
Common.log.OutInfo(log);
return true;
}
}
if(!agv.Mark.Split(',')[1].Equals("pack"))
{
ClearMarkByNodeMark();
string log = agv.Name + " [Mark=" + agv.Mark + "] 出库任务完成";
Common.log.OutInfo(log);
Common.log.OutTextBox(log);
return false;
}
bool rtn = AGVManager.LeaveCheck(agv, out int taskCount);
Thread.Sleep(3000);
if (!rtn)//出库任务还未完成
......@@ -2053,9 +2135,10 @@ namespace BLL
}
else
{
ClearMarkByNodeMark();
string log = agv.Name + " [Mark=" + agv.Mark + "] [taskCount = " + taskCount.ToString() + "] 出库任务完成";
Common.log.OutInfo(log);
//Common.log.OutTextBox(log);
Common.log.OutTextBox(log);
return false;
}
//MoveStandby
......
......@@ -349,7 +349,10 @@ namespace AGVControl
/// 是否清除任务缓存
/// </summary>
public bool IsClearRunInfo = false;
/// <summary>
/// 剩余出库任务,针对包装仓出库
/// </summary>
public int LeftTaskCnt { get; set; } = 0;
public struct DockingStru
{
public DateTime startTime;
......@@ -380,20 +383,21 @@ namespace AGVControl
public string[] ToRow()
{
//AGV名称,IP,AGV状态,任务状态,地点,后续任务,在线,电量,调用,清除缓存
string[] s = new string[10];
string[] s = new string[11];
s[0] = Name;
s[1] = IP;
if (IsCon)
{
s[2] = StateText;
s[3] = string.Format("{0}({1})", MissionStatus.ToString(), (int)MissionStatus);
s[4] = Place;
s[5] = NextMission;
s[4] = Mark;
s[5] = Place;
s[6] = NextMission;
}
s[6] = IsCon.ToString();
s[7] = Battery + "%";
s[8] = IsUse.ToString();
s[9] = "Clear";
s[7] = IsCon.ToString();
s[8] = Battery + "%";
s[9] = IsUse.ToString();
s[10] = "Clear";
return s;
}
......
......@@ -34,6 +34,7 @@
this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column14 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column22 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column18 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column13 = new System.Windows.Forms.DataGridViewTextBoxColumn();
......@@ -82,9 +83,11 @@
this.LstAgvPlace = new System.Windows.Forms.ListBox();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.dgvMission = new System.Windows.Forms.DataGridView();
this.Column20 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column21 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.label4 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.DgvAgv)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.DgvNode)).BeginInit();
this.tabControl1.SuspendLayout();
......@@ -92,6 +95,7 @@
this.tabPage3.SuspendLayout();
this.tabPage2.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvMission)).BeginInit();
this.SuspendLayout();
//
......@@ -109,6 +113,7 @@
this.Column2,
this.Column3,
this.Column14,
this.Column22,
this.Column18,
this.Column4,
this.Column13,
......@@ -120,7 +125,7 @@
this.DgvAgv.ReadOnly = true;
this.DgvAgv.RowHeadersWidth = 51;
this.DgvAgv.RowTemplate.Height = 23;
this.DgvAgv.Size = new System.Drawing.Size(970, 126);
this.DgvAgv.Size = new System.Drawing.Size(1069, 126);
this.DgvAgv.TabIndex = 0;
this.DgvAgv.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.DgvAgv_CellClick);
//
......@@ -160,6 +165,14 @@
this.Column14.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
this.Column14.Width = 120;
//
// Column22
//
this.Column22.HeaderText = "标志";
this.Column22.MinimumWidth = 6;
this.Column22.Name = "Column22";
this.Column22.ReadOnly = true;
this.Column22.Width = 80;
//
// Column18
//
this.Column18.HeaderText = "目标地点";
......@@ -236,7 +249,7 @@
this.DgvNode.ReadOnly = true;
this.DgvNode.RowHeadersWidth = 50;
this.DgvNode.RowTemplate.Height = 23;
this.DgvNode.Size = new System.Drawing.Size(950, 486);
this.DgvNode.Size = new System.Drawing.Size(1049, 486);
this.DgvNode.TabIndex = 1;
this.DgvNode.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.DgvNode_CellClick);
//
......@@ -328,7 +341,7 @@
this.TxtLog.Multiline = true;
this.TxtLog.Name = "TxtLog";
this.TxtLog.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.TxtLog.Size = new System.Drawing.Size(329, 486);
this.TxtLog.Size = new System.Drawing.Size(363, 486);
this.TxtLog.TabIndex = 4;
//
// tabControl1
......@@ -342,7 +355,7 @@
this.tabControl1.Location = new System.Drawing.Point(12, 144);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(970, 527);
this.tabControl1.Size = new System.Drawing.Size(1069, 527);
this.tabControl1.TabIndex = 5;
//
// tabPage1
......@@ -351,7 +364,7 @@
this.tabPage1.Location = new System.Drawing.Point(4, 25);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(962, 498);
this.tabPage1.Size = new System.Drawing.Size(1061, 498);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "节点";
this.tabPage1.UseVisualStyleBackColor = true;
......@@ -387,7 +400,7 @@
this.tabPage3.Location = new System.Drawing.Point(4, 25);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Padding = new System.Windows.Forms.Padding(3);
this.tabPage3.Size = new System.Drawing.Size(962, 498);
this.tabPage3.Size = new System.Drawing.Size(1061, 498);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "任务";
this.tabPage3.UseVisualStyleBackColor = true;
......@@ -651,7 +664,7 @@
this.tabPage2.Location = new System.Drawing.Point(4, 25);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(962, 498);
this.tabPage2.Size = new System.Drawing.Size(1061, 498);
this.tabPage2.TabIndex = 3;
this.tabPage2.Text = "日志";
this.tabPage2.UseVisualStyleBackColor = true;
......@@ -662,15 +675,30 @@
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 35.06064F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 64.93936F));
this.tableLayoutPanel1.Controls.Add(this.TxtLog, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.dgvMission, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 1, 0);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 3);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 1;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(956, 492);
this.tableLayoutPanel1.Size = new System.Drawing.Size(1055, 492);
this.tableLayoutPanel1.TabIndex = 5;
//
// tableLayoutPanel2
//
this.tableLayoutPanel2.ColumnCount = 1;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel2.Controls.Add(this.dgvMission, 0, 0);
this.tableLayoutPanel2.Controls.Add(this.label4, 0, 1);
this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel2.Location = new System.Drawing.Point(372, 3);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 2;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(680, 486);
this.tableLayoutPanel2.TabIndex = 5;
//
// dgvMission
//
this.dgvMission.AllowUserToAddRows = false;
......@@ -678,20 +706,21 @@
this.dgvMission.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Column20,
this.Column21});
this.dgvMission.Dock = System.Windows.Forms.DockStyle.Top;
this.dgvMission.Location = new System.Drawing.Point(338, 3);
this.dgvMission.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvMission.Location = new System.Drawing.Point(3, 3);
this.dgvMission.Name = "dgvMission";
this.dgvMission.RowHeadersVisible = false;
this.dgvMission.RowHeadersWidth = 51;
this.dgvMission.RowTemplate.Height = 27;
this.dgvMission.Size = new System.Drawing.Size(615, 186);
this.dgvMission.TabIndex = 5;
this.dgvMission.Size = new System.Drawing.Size(674, 237);
this.dgvMission.TabIndex = 6;
//
// Column20
//
this.Column20.HeaderText = "AGV名称";
this.Column20.MinimumWidth = 6;
this.Column20.Name = "Column20";
this.Column20.Width = 125;
//
// Column21
//
......@@ -700,10 +729,19 @@
this.Column21.Name = "Column21";
this.Column21.Width = 450;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(3, 243);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(55, 15);
this.label4.TabIndex = 7;
this.label4.Text = "label4";
//
// FrmMain
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(994, 683);
this.ClientSize = new System.Drawing.Size(1093, 683);
this.Controls.Add(this.tabControl1);
this.Controls.Add(this.DgvAgv);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
......@@ -721,6 +759,8 @@
this.tabPage2.ResumeLayout(false);
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.tableLayoutPanel2.ResumeLayout(false);
this.tableLayoutPanel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvMission)).EndInit();
this.ResumeLayout(false);
......@@ -751,16 +791,6 @@
private System.Windows.Forms.DataGridViewTextBoxColumn Column5;
private System.Windows.Forms.DataGridViewButtonColumn Column16;
private System.Windows.Forms.DataGridViewButtonColumn Column15;
private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
private System.Windows.Forms.DataGridViewTextBoxColumn Column2;
private System.Windows.Forms.DataGridViewTextBoxColumn Column3;
private System.Windows.Forms.DataGridViewTextBoxColumn Column14;
private System.Windows.Forms.DataGridViewTextBoxColumn Column18;
private System.Windows.Forms.DataGridViewTextBoxColumn Column4;
private System.Windows.Forms.DataGridViewTextBoxColumn Column13;
private System.Windows.Forms.DataGridViewTextBoxColumn Column19;
private System.Windows.Forms.DataGridViewButtonColumn Column11;
private System.Windows.Forms.DataGridViewButtonColumn Column17;
private System.Windows.Forms.CheckBox ChkAutoCharge;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
......@@ -780,9 +810,22 @@
private System.Windows.Forms.Button BtnOpenExcel;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
private System.Windows.Forms.DataGridViewTextBoxColumn Column2;
private System.Windows.Forms.DataGridViewTextBoxColumn Column3;
private System.Windows.Forms.DataGridViewTextBoxColumn Column14;
private System.Windows.Forms.DataGridViewTextBoxColumn Column22;
private System.Windows.Forms.DataGridViewTextBoxColumn Column18;
private System.Windows.Forms.DataGridViewTextBoxColumn Column4;
private System.Windows.Forms.DataGridViewTextBoxColumn Column13;
private System.Windows.Forms.DataGridViewTextBoxColumn Column19;
private System.Windows.Forms.DataGridViewButtonColumn Column11;
private System.Windows.Forms.DataGridViewButtonColumn Column17;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.DataGridView dgvMission;
private System.Windows.Forms.DataGridViewTextBoxColumn Column20;
private System.Windows.Forms.DataGridViewTextBoxColumn Column21;
private System.Windows.Forms.Label label4;
}
}
using System;
using BLL;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
......@@ -46,8 +47,8 @@ namespace AGVControl
LstAgvPlace.Items.Clear();
foreach (var item in Common.agvMission.Keys.ToArray())
{
if (item.Length.Equals(6))
continue;
//if (item.Length.Equals(6))
// continue;
LstAgvPlace.Items.Add(item);
}
......@@ -60,6 +61,16 @@ namespace AGVControl
{
DgvNode.Rows[nodeIndex].SetValues(Common.nodeInfo[nodeIndex].ToRow());
}));
string task = "";
Invoke(new Action(() =>
{
label4.Text = "";
foreach (var item in Common.agvInfo)
{
task += string.Format("{0}: [Mark={1}] [RFID={2}] [剩余任务={3}]\r\n",item.Name,item.Mark,item.RFID,item.LeftTaskCnt);
}
label4.Text = task;
}));
}
private void Server_NodeOnline(int nodeIndex)
......@@ -143,17 +154,17 @@ namespace AGVControl
private void DgvAgv_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex == -1) return;
if (e.ColumnIndex == 8)
if (e.ColumnIndex == 9)
{
Common.agvInfo[e.RowIndex].IsUse = !Common.agvInfo[e.RowIndex].IsUse;
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.Save();
}
else if (e.ColumnIndex == 9)
else if (e.ColumnIndex == 10)
{
//清除小车缓存
Common.log.OutInfo(string.Format("手动清除缓存,{0} {1}", Common.agvInfo[e.RowIndex].Name, Common.agvInfo[e.RowIndex].Place));
Common.log.OutInfo(string.Format("手动清除缓存,{0} {1} Mark={2}", Common.agvInfo[e.RowIndex].Name, Common.agvInfo[e.RowIndex].Place, Common.agvInfo[e.RowIndex].Mark));
string place = Common.agvInfo[e.RowIndex].Place;
Common.agvInfo[e.RowIndex].Mark = "";
Common.agvInfo[e.RowIndex].Place = "";
......@@ -169,7 +180,16 @@ namespace AGVControl
Common.nodeInfo[idx].AgvName = "";
DgvNode.Rows[idx].Cells[5].Value = "";
}
string task = "";
Invoke(new Action(() =>
{
label4.Text = "";
foreach (var item in Common.agvInfo)
{
task += string.Format("{0}: [Mark={1}] [RFID={2}] [剩余任务={3}]\r\n", item.Name, item.Mark, item.RFID, item.LeftTaskCnt);
}
label4.Text = task;
}));
//添加Init任务
Common.mir.Add_Mission_Fleet(Common.agvInfo[e.RowIndex], Common.agvMission["Init"]);
Common.mir.State_Ready(Common.agvInfo[e.RowIndex]);
......@@ -305,7 +325,7 @@ namespace AGVControl
private void BtnReadWriteCharge_Click(object sender, EventArgs e)
{
string name = (sender as Control).Name;
string name = (sender as System.Windows.Forms.Control).Name;
int num = Convert.ToInt32(name.Substring(name.Length - 1, 1));
if (name.IndexOf("Read") > 0)
......@@ -365,5 +385,6 @@ namespace AGVControl
{
System.Diagnostics.Process.Start(".\\AGV点位分布.xlsx");
}
}
}
......@@ -129,6 +129,9 @@
<metadata name="Column14.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column22.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column18.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!