Commit 3803ecbd 张东亮

0421

1 个父辈 cd135516
......@@ -105,6 +105,9 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="log4net.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
......@@ -120,6 +123,8 @@
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<None Include="gray2.png" />
<None Include="green1.png" />
<Content Include="icon.ico" />
</ItemGroup>
<ItemGroup>
......
......@@ -6,74 +6,15 @@
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup>
<log4net>
<appender name="AGVDispatch" type="log4net.Appender.RollingFileAppender">
<file value="logs/AGVDispatch.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t][%c:%L]%-5p %m%n"/>
</layout>
</appender>
<appender name="AgvServer" type="log4net.Appender.RollingFileAppender">
<file value="logs/AgvServer.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<param name="MaxSizeRollBackups" value="30"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t][%c:%L]%-5p %m%n"/>
</layout>
</appender>
<appender name="MiR_API" type="log4net.Appender.RollingFileAppender">
<file value="logs/MiR_API.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<param name="MaxSizeRollBackups" value="30"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t][%c:%L]%-5p %m%n"/>
</layout>
</appender>
<appender name="AGVManager" type="log4net.Appender.RollingFileAppender">
<file value="logs/AGVManager.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<param name="MaxSizeRollBackups" value="30"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t][%c:%L]%-5p %m%n"/>
</layout>
</appender>
<logger name="MiR_API">
<level value="Error"/>
<appender-ref ref="MiR_API"/>
</logger>
<logger name="AgvServer">
<level value="Info"/>
<appender-ref ref="AgvServer"/>
</logger>
<logger name="AGVManager">
<level value="Debug"/>
<appender-ref ref="AGVManager"/>
</logger>
<root name="AGV_3D_SMD">
<level value="Info"/>
<appender-ref ref="AGV_3D_SMD"/>
</root>
</log4net>
<appSettings>
<add key="http_server" value="http://10.85.162.124/myproject/"/>
<add key="http_server" value="http://10.21.69.201/smdbox/"/>
<add key="log4net_configname" value="log4net.config"/>
<add key="FLEET" value="10.85.199.3"/>
<add key="LocalIP" value="10.85.162.40"/>
<add key="AGVServerIp" value="127.0.0.1"/>
<add key="AGVServerPort" value="9501"/>
<add key="Use_Fleet" value="False"/>
<add key="ChargeThreshold" value="20,90"/>
<add key="LimitPoints" value="0,0;0,0;0,0;0,0"/>
</appSettings>
</configuration>
......@@ -37,6 +37,13 @@
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.panelNode = new System.Windows.Forms.Panel();
this.groupBoxNode = new System.Windows.Forms.GroupBox();
this.DgvNode = new System.Windows.Forms.DataGridView();
this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column10 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column9 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column16 = new System.Windows.Forms.DataGridViewButtonColumn();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
......@@ -51,24 +58,28 @@
this.lblStandy3 = new System.Windows.Forms.Label();
this.lblStandy4 = new System.Windows.Forms.Label();
this.lblLimit = new System.Windows.Forms.Label();
this.Column16 = new System.Windows.Forms.DataGridViewButtonColumn();
this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column9 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column10 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column6 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.DgvNode = new System.Windows.Forms.DataGridView();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.tableLayoutPanel3.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout();
this.panelNode.SuspendLayout();
this.groupBoxNode.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.DgvNode)).BeginInit();
this.tabPage3.SuspendLayout();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.tableLayoutPanel4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.DgvNode)).BeginInit();
this.tableLayoutPanel1.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox4.SuspendLayout();
this.SuspendLayout();
//
// tableLayoutPanel3
......@@ -112,10 +123,11 @@
//
// tableLayoutPanel2
//
this.tableLayoutPanel2.ColumnCount = 1;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel2.ColumnCount = 2;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 62.73504F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 37.26496F));
this.tableLayoutPanel2.Controls.Add(this.panelNode, 0, 0);
this.tableLayoutPanel2.Controls.Add(this.tableLayoutPanel1, 1, 0);
this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 3);
this.tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(2);
......@@ -144,6 +156,98 @@
this.groupBoxNode.TabStop = false;
this.groupBoxNode.Text = "节点状态";
//
// DgvNode
//
this.DgvNode.AllowUserToAddRows = false;
this.DgvNode.AllowUserToDeleteRows = false;
this.DgvNode.AllowUserToResizeColumns = false;
this.DgvNode.AllowUserToResizeRows = false;
this.DgvNode.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.DgvNode.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.DgvNode.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
this.DgvNode.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.DgvNode.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Column6,
this.Column7,
this.Column10,
this.Column9,
this.Column5,
this.Column16});
this.DgvNode.Dock = System.Windows.Forms.DockStyle.Fill;
this.DgvNode.Location = new System.Drawing.Point(3, 17);
this.DgvNode.MultiSelect = false;
this.DgvNode.Name = "DgvNode";
this.DgvNode.ReadOnly = true;
this.DgvNode.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
this.DgvNode.RowHeadersVisible = false;
this.DgvNode.RowHeadersWidth = 50;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.DgvNode.RowsDefaultCellStyle = dataGridViewCellStyle2;
this.DgvNode.RowTemplate.Height = 23;
this.DgvNode.Size = new System.Drawing.Size(717, 392);
this.DgvNode.TabIndex = 3;
this.DgvNode.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.DgvNode_CellClick);
//
// Column6
//
this.Column6.FillWeight = 107.563F;
this.Column6.HeaderText = "地点";
this.Column6.MinimumWidth = 6;
this.Column6.Name = "Column6";
this.Column6.ReadOnly = true;
this.Column6.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
//
// Column7
//
this.Column7.FillWeight = 107.563F;
this.Column7.HeaderText = "动作";
this.Column7.MinimumWidth = 6;
this.Column7.Name = "Column7";
this.Column7.ReadOnly = true;
this.Column7.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
//
// Column10
//
this.Column10.FillWeight = 47.05883F;
this.Column10.HeaderText = "类型";
this.Column10.MinimumWidth = 6;
this.Column10.Name = "Column10";
this.Column10.ReadOnly = true;
this.Column10.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
//
// Column9
//
this.Column9.FillWeight = 107.563F;
this.Column9.HeaderText = "RFID";
this.Column9.MinimumWidth = 6;
this.Column9.Name = "Column9";
this.Column9.ReadOnly = true;
this.Column9.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
//
// Column5
//
this.Column5.FillWeight = 107.563F;
this.Column5.HeaderText = "连接";
this.Column5.MinimumWidth = 6;
this.Column5.Name = "Column5";
this.Column5.ReadOnly = true;
this.Column5.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
//
// Column16
//
this.Column16.FillWeight = 107.563F;
this.Column16.HeaderText = "调用";
this.Column16.MinimumWidth = 6;
this.Column16.Name = "Column16";
this.Column16.ReadOnly = true;
//
// tabPage3
//
this.tabPage3.Controls.Add(this.groupBox1);
......@@ -153,7 +257,7 @@
this.tabPage3.Padding = new System.Windows.Forms.Padding(3);
this.tabPage3.Size = new System.Drawing.Size(1176, 424);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "手动&日志";
this.tabPage3.Text = "AGV&日志";
this.tabPage3.UseVisualStyleBackColor = true;
//
// groupBox1
......@@ -291,97 +395,93 @@
this.lblLimit.Size = new System.Drawing.Size(35, 12);
this.lblLimit.TabIndex = 6;
//
// Column16
//
this.Column16.FillWeight = 107.563F;
this.Column16.HeaderText = "调用";
this.Column16.MinimumWidth = 6;
this.Column16.Name = "Column16";
this.Column16.ReadOnly = true;
//
// Column5
//
this.Column5.FillWeight = 107.563F;
this.Column5.HeaderText = "连接";
this.Column5.MinimumWidth = 6;
this.Column5.Name = "Column5";
this.Column5.ReadOnly = true;
this.Column5.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
//
// Column9
//
this.Column9.FillWeight = 107.563F;
this.Column9.HeaderText = "RFID";
this.Column9.MinimumWidth = 6;
this.Column9.Name = "Column9";
this.Column9.ReadOnly = true;
this.Column9.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
//
// Column10
//
this.Column10.FillWeight = 47.05883F;
this.Column10.HeaderText = "类型";
this.Column10.MinimumWidth = 6;
this.Column10.Name = "Column10";
this.Column10.ReadOnly = true;
this.Column10.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
//
// Column7
//
this.Column7.FillWeight = 107.563F;
this.Column7.HeaderText = "动作";
this.Column7.MinimumWidth = 6;
this.Column7.Name = "Column7";
this.Column7.ReadOnly = true;
this.Column7.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
//
// Column6
//
this.Column6.FillWeight = 107.563F;
this.Column6.HeaderText = "地点";
this.Column6.MinimumWidth = 6;
this.Column6.Name = "Column6";
this.Column6.ReadOnly = true;
this.Column6.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
//
// DgvNode
//
this.DgvNode.AllowUserToAddRows = false;
this.DgvNode.AllowUserToDeleteRows = false;
this.DgvNode.AllowUserToResizeColumns = false;
this.DgvNode.AllowUserToResizeRows = false;
this.DgvNode.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.DgvNode.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.DgvNode.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
this.DgvNode.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.DgvNode.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Column6,
this.Column7,
this.Column10,
this.Column9,
this.Column5,
this.Column16});
this.DgvNode.Dock = System.Windows.Forms.DockStyle.Fill;
this.DgvNode.Location = new System.Drawing.Point(3, 17);
this.DgvNode.MultiSelect = false;
this.DgvNode.Name = "DgvNode";
this.DgvNode.ReadOnly = true;
this.DgvNode.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
this.DgvNode.RowHeadersVisible = false;
this.DgvNode.RowHeadersWidth = 50;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.DgvNode.RowsDefaultCellStyle = dataGridViewCellStyle2;
this.DgvNode.RowTemplate.Height = 23;
this.DgvNode.Size = new System.Drawing.Size(717, 392);
this.DgvNode.TabIndex = 3;
this.DgvNode.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.DgvNode_CellClick);
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 1;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Controls.Add(this.groupBox3, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.groupBox4, 0, 1);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(736, 3);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 2;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 46.1165F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 53.8835F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(431, 412);
this.tableLayoutPanel1.TabIndex = 1;
//
// groupBox3
//
this.groupBox3.Controls.Add(this.label2);
this.groupBox3.Controls.Add(this.label1);
this.groupBox3.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox3.Location = new System.Drawing.Point(3, 3);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(425, 183);
this.groupBox3.TabIndex = 0;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "云仓出料口信息";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Dock = System.Windows.Forms.DockStyle.Top;
this.label1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(3, 17);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(80, 19);
this.label1.TabIndex = 0;
this.label1.Text = "出料口1";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Dock = System.Windows.Forms.DockStyle.Top;
this.label2.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(3, 36);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(80, 19);
this.label2.TabIndex = 1;
this.label2.Text = "出料口2";
//
// groupBox4
//
this.groupBox4.Controls.Add(this.label3);
this.groupBox4.Controls.Add(this.button1);
this.groupBox4.Controls.Add(this.textBox1);
this.groupBox4.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox4.Location = new System.Drawing.Point(3, 192);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(425, 217);
this.groupBox4.TabIndex = 1;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "料架缓存清理";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(7, 29);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(85, 21);
this.textBox1.TabIndex = 0;
//
// button1
//
this.button1.Location = new System.Drawing.Point(7, 71);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(85, 69);
this.button1.TabIndex = 1;
this.button1.Text = "清理料架缓存";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(137, 47);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(53, 12);
this.label3.TabIndex = 2;
this.label3.Text = "清理结果";
//
// FrmMain
//
......@@ -403,11 +503,16 @@
this.tableLayoutPanel2.ResumeLayout(false);
this.panelNode.ResumeLayout(false);
this.groupBoxNode.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.DgvNode)).EndInit();
this.tabPage3.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.tableLayoutPanel4.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.DgvNode)).EndInit();
this.tableLayoutPanel1.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.groupBox4.ResumeLayout(false);
this.groupBox4.PerformLayout();
this.ResumeLayout(false);
}
......@@ -440,6 +545,14 @@
private System.Windows.Forms.DataGridViewTextBoxColumn Column9;
private System.Windows.Forms.DataGridViewTextBoxColumn Column5;
private System.Windows.Forms.DataGridViewButtonColumn Column16;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox textBox1;
}
}
......@@ -19,12 +19,12 @@ namespace AGVControl
InitializeComponent();
showTimer = new System.Timers.Timer();
showTimer.Interval = 2000;
//showTimer.Enabled = true;
//showTimer.AutoReset = true;
showTimer.Enabled = true;
showTimer.AutoReset = true;
showTimer.Elapsed += ShowTimer_Elapsed;
showTimer.Start();
CommonVar.control.limitArea.ScopeLimitStateChangedEvent += LimitArea_ScopeLimitStateChangedEvent;
DeviceLibrary.Context.control.limitArea.ScopeLimitStateChangedEvent += LimitArea_ScopeLimitStateChangedEvent;
}
/// <summary>
......@@ -35,11 +35,11 @@ namespace AGVControl
{
Invoke(new Action(()=>
{
if (CommonVar.control.limitArea.Available)
if (DeviceLibrary.Context.control.limitArea.Available)
lblLimit.Text = "限制区域车辆:";
else
{
lblLimit.Text = "限制区域车辆:"+ip;
lblLimit.Text = "限制区域车辆:"+ ip;
}
}
));
......@@ -47,24 +47,26 @@ namespace AGVControl
private void ShowConfig()
{
int n;
for (int i = 0; i < CommonVar.agvInfo.Count; i++)
for (int i = 0; i < DeviceLibrary.Context.agvInfo.Count; i++)
{
MiR_API.Get_IO_Status(CommonVar.agvInfo[i], out bool[] input, out bool[] output);
MiR_API.Get_IO_Status(DeviceLibrary.Context.agvInfo[i], out bool[] input, out bool[] output);
if (input != null && input.Length == 4)
CommonVar.agvInfo[i].IsExistShelf = input[3];
flowPanelKanBan.Controls.Add(CommonVar.agvInfo[i].StateKanban);
AddForm(CommonVar.agvInfo[i].Name,new Manual(CommonVar.agvInfo[i]));
CommonVar.agvInfo[i].StateKanban.Init();
DeviceLibrary.Context.agvInfo[i].IsExistShelf = input[3];
flowPanelKanBan.Controls.Add(DeviceLibrary.Context.agvInfo[i].StateKanban);
AddForm(DeviceLibrary.Context.agvInfo[i].Name,new Manual(DeviceLibrary.Context.agvInfo[i]));
DeviceLibrary.Context.agvInfo[i].StateKanban.Init();
}
for (int i = 0; i < CommonVar.nodeInfo.Count; i++)
for (int i = 0; i < DeviceLibrary.Context.nodeInfo.Count; i++)
{
Agv.ClientNode node = CommonVar.nodeInfo[i];
n = DgvNode.Rows.Add(node.AliceName,node.Action,node.Shelf,node.RFID,node.Online,node.IsUse);
Agv.ClientNode node = DeviceLibrary.Context.nodeInfo[i];
if (node.Name.StartsWith("S"))
continue;
n = DgvNode.Rows.Add(node.AliceName, node.Action, node.Shelf, node.RFID, node.Online, node.IsUse);
DgvNode.Rows[n].HeaderCell.Value = (n + 1).ToString();
if (i % 2 == 0)
DgvNode.Rows[n].DefaultCellStyle.BackColor = Color.LightBlue;
if (!CommonVar.nodeInfo[i].Online)
if (!DeviceLibrary.Context.nodeInfo[i].Online)
DgvNode.Rows[n].DefaultCellStyle.ForeColor = Color.Red;
}
}
......@@ -78,9 +80,9 @@ namespace AGVControl
private void ItemExit_Click(object sender, EventArgs e)
{
foreach (var item in CommonVar.agvInfo)
foreach (var item in DeviceLibrary.Context.agvInfo)
{
CommonVar.WriteIni(item.Name, SettingString.RFID, item.RFID);
DeviceLibrary.Context.WriteIni(item.Name, SettingString.RFID, item.RFID);
}
notify.Dispose();
exit = true;
......@@ -111,8 +113,11 @@ namespace AGVControl
ShowConfig();
change = true;
change = false;
CommonVar.server.NodeChanged += Server_NodeChanged; ;
CommonVar.server.NodeOnline += Server_NodeOnline; ;
DeviceLibrary.Context.server.NodeChanged += Server_NodeChanged; ;
DeviceLibrary.Context.server.NodeOnline += Server_NodeOnline; ;
string ip = AppConfigHelper.GetValue(SettingString.AGVServerIp);
int port = AppConfigHelper.GetIntValue(SettingString.AGVServerPort);
DeviceLibrary.Context.server.Start(ip, port);
LogUtil.logBox= richTextBox1;
}
......@@ -120,12 +125,14 @@ namespace AGVControl
{
this.Invoke(new Action(()=>
{
int idx = CommonVar.nodeInfo.FindIndex(s=>s.Name.Equals(nodeName));
int idx = DeviceLibrary.Context.nodeInfo.FindIndex(s=> s.Name.Equals(nodeName));
if (idx > -1)
{
CommonVar.nodeInfo[idx].Online = online;
DeviceLibrary.Context.nodeInfo[idx].Online = online;
if (!online)
DeviceLibrary.Context.nodeInfo[idx].Action = Agv.ClientAction.None;
DgvNode.Rows[idx].DefaultCellStyle.ForeColor = online ? Color.Black : Color.Red;
DgvNode.Rows[idx].SetValues(CommonVar.nodeInfo[idx].AliceName, CommonVar.nodeInfo[idx].Action, CommonVar.nodeInfo[idx].Shelf, CommonVar.nodeInfo[idx].RFID, CommonVar.nodeInfo[idx].Online, CommonVar.nodeInfo[idx].IsUse);
DgvNode.Rows[idx].SetValues(DeviceLibrary.Context.nodeInfo[idx].AliceName, DeviceLibrary.Context.nodeInfo[idx].Action, DeviceLibrary.Context.nodeInfo[idx].Shelf, DeviceLibrary.Context.nodeInfo[idx].RFID, DeviceLibrary.Context.nodeInfo[idx].Online, DeviceLibrary.Context.nodeInfo[idx].IsUse);
}
}
));
......@@ -133,9 +140,14 @@ namespace AGVControl
private void Server_NodeChanged(Agv.Node clientNode)
{
int idx = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(clientNode.Name));
int idx = DeviceLibrary.Context.nodeInfo.FindIndex(s => s.Name.Equals(clientNode.Name));
if (idx > -1)
DgvNode.Rows[idx].SetValues(CommonVar.nodeInfo[idx].AliceName, clientNode.Action, clientNode.Shelf, clientNode.RFID, CommonVar.nodeInfo[idx].Online, CommonVar.nodeInfo[idx].IsUse);
{
DeviceLibrary.Context.nodeInfo[idx].Action = clientNode.Action;
DeviceLibrary.Context.nodeInfo[idx].Shelf = clientNode.Shelf;
DeviceLibrary.Context.nodeInfo[idx].RFID = clientNode.RFID;
DgvNode.Rows[idx].SetValues(DeviceLibrary.Context.nodeInfo[idx].AliceName, DeviceLibrary.Context.nodeInfo[idx].Action, DeviceLibrary.Context.nodeInfo[idx].Shelf, DeviceLibrary.Context.nodeInfo[idx].RFID, DeviceLibrary.Context.nodeInfo[idx].Online, DeviceLibrary.Context.nodeInfo[idx].IsUse);
}
}
private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
......@@ -145,16 +157,16 @@ namespace AGVControl
e.Cancel = true;
Hide();
}
foreach (var item in CommonVar.agvInfo)
foreach (var item in DeviceLibrary.Context.agvInfo)
{
CommonVar.WriteIni(item.Name, SettingString.RFID, item.RFID);
DeviceLibrary.Context.WriteIni(item.Name, SettingString.RFID, item.RFID);
}
//showTimer.Enabled = false;
showTimer.Stop();
// CommonVar.control.AgvChanged -= Control_AgvChanged;
CommonVar.server.NodeChanged -= Server_NodeChanged;
CommonVar.server.NodeOnline -= Server_NodeOnline;
// CommonVar.control.AgvChanged -= Control_AgvChanged;
DeviceLibrary.Context.server.NodeChanged -= Server_NodeChanged;
DeviceLibrary.Context.server.NodeOnline -= Server_NodeOnline;
}
private void DgvNode_CellClick(object sender, DataGridViewCellEventArgs e)
......@@ -163,31 +175,82 @@ namespace AGVControl
if (e.ColumnIndex == DgvNode.Columns.Count - 1) //调用
{
CommonVar.nodeInfo[e.RowIndex].IsUse = !CommonVar.nodeInfo[e.RowIndex].IsUse;
DgvNode.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = CommonVar.nodeInfo[e.RowIndex].IsUse.ToString();
CommonVar.WriteIni(CommonVar.nodeInfo[e.RowIndex].Name, SettingString.IsUse, CommonVar.nodeInfo[e.RowIndex].IsUse.ToString());
Agv.ClientNode node = CommonVar.nodeInfo[e.RowIndex];
DeviceLibrary.Context.nodeInfo[e.RowIndex].IsUse = !DeviceLibrary.Context.nodeInfo[e.RowIndex].IsUse;
DgvNode.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = DeviceLibrary.Context.nodeInfo[e.RowIndex].IsUse.ToString();
DeviceLibrary.Context.WriteIni(DeviceLibrary.Context.nodeInfo[e.RowIndex].Name, SettingString.IsUse, DeviceLibrary.Context.nodeInfo[e.RowIndex].IsUse.ToString());
Agv.ClientNode node = DeviceLibrary.Context.nodeInfo[e.RowIndex];
DgvNode.Rows[e.RowIndex].SetValues(node.AliceName, node.Action, node.Shelf, node.RFID, node.Online, node.IsUse);
}
}
bool InShhow = false;
Dictionary<string, string> destInfoMap = new Dictionary<string, string>();
private void ShowTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
//ShowEmptyTask();
if (InShhow)
return;
InShhow = true;
BoxDestInfo destInfo;
Agv.ClientNode node;
Invoke(new Action(() =>
{
lblCharge1.Text = "充电桩1:" + CommonVar.Charge.Station[Charge.AutoCharge1];
//lblCharge2.Text = "充电桩2:" + CommonVar.Charge.Station[Charge.AutoCharge2];
lblStandy1.Text = "待机位1:" + CommonVar.Standby.Station[0];
lblStandy2.Text = "待机位2:" + CommonVar.Standby.Station[1];
lblStandy3.Text = "待机位3:" + CommonVar.Standby.Station[2];
lblStandy4.Text = "待机位4:" + CommonVar.Standby.Station[3];
node = DeviceLibrary.Context.nodeInfo.Find(s => s.Name.Equals(SettingString.D2));
if (!destInfoMap.ContainsKey(SettingString.D2))
{
if (RequestManager.FindFullShelfTarget(node.RFID, out destInfo))
{
label1.Text = destInfo.ToString();
destInfoMap.Add(SettingString.D2, node.RFID);
}
else
{
label1.Text = "";
}
}
else if (!destInfoMap[SettingString.D2].Equals(node.RFID))
{
if (RequestManager.FindFullShelfTarget(node.RFID, out destInfo))
{
label1.Text = destInfo.ToString();
destInfoMap[SettingString.D2] = node.RFID;
}
else
{
label1.Text = "";
}
}
node = DeviceLibrary.Context.nodeInfo.Find(s => s.Name.Equals(SettingString.D4));
if (!destInfoMap.ContainsKey(SettingString.D4))
{
if (RequestManager.FindFullShelfTarget(node.RFID, out destInfo))
{
label2.Text = destInfo.ToString();
destInfoMap.Add(SettingString.D4, node.RFID);
}
else
{
label2.Text = "";
}
}
else if (!destInfoMap[SettingString.D4].Equals(node.RFID))
{
if (RequestManager.FindFullShelfTarget(node.RFID, out destInfo))
{
label2.Text = destInfo.ToString();
destInfoMap[SettingString.D4] = node.RFID;
}
else
{
label2.Text = "";
}
}
}));
Application.DoEvents();
InShhow = false;
......@@ -217,5 +280,24 @@ namespace AGVControl
// tabPageList.Add(lineTabPage);
tabControlAGV.Controls.Add(lineTabPage);
}
private void button1_Click(object sender, EventArgs e)
{
label3.Text = "";
if (textBox1.Text.Equals(""))
return;
if(RequestManager.AgvRemoveRfid(textBox1.Text.ToUpper()))
{
LogUtil.info("手动清理料架缓存:"+ textBox1.Text.ToUpper());
label3.Text = "清理料架缓存成功:" + textBox1.Text.ToUpper();
label3.BackColor = Color.Green;
}
else
{
label3.Text = "清理料架缓存失败:" + textBox1.Text.ToUpper();
label3.BackColor = Color.Red;
}
textBox1.Text = "";
}
}
}
......@@ -28,6 +28,7 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Manual));
this.panelInfo = new System.Windows.Forms.Panel();
this.lblInfo = new System.Windows.Forms.Label();
......@@ -42,11 +43,36 @@
this.grpBxMission = new System.Windows.Forms.GroupBox();
this.btnAssignTask = new System.Windows.Forms.Button();
this.cmbBxMission = new System.Windows.Forms.ComboBox();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel();
this.pictureBox5 = new System.Windows.Forms.PictureBox();
this.pictureBox6 = new System.Windows.Forms.PictureBox();
this.pictureBox7 = new System.Windows.Forms.PictureBox();
this.pictureBox8 = new System.Windows.Forms.PictureBox();
this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.pictureBox3 = new System.Windows.Forms.PictureBox();
this.pictureBox4 = new System.Windows.Forms.PictureBox();
this.panelInfo.SuspendLayout();
this.grpBxRunMode.SuspendLayout();
this.grpBxOperation.SuspendLayout();
this.flowLayoutPanel1.SuspendLayout();
this.grpBxMission.SuspendLayout();
this.groupBox1.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.flowLayoutPanel3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox7)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox8)).BeginInit();
this.flowLayoutPanel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit();
this.SuspendLayout();
//
// panelInfo
......@@ -55,7 +81,7 @@
this.panelInfo.Dock = System.Windows.Forms.DockStyle.Top;
this.panelInfo.Location = new System.Drawing.Point(0, 0);
this.panelInfo.Name = "panelInfo";
this.panelInfo.Size = new System.Drawing.Size(385, 43);
this.panelInfo.Size = new System.Drawing.Size(379, 43);
this.panelInfo.TabIndex = 0;
//
// lblInfo
......@@ -65,7 +91,7 @@
this.lblInfo.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblInfo.Location = new System.Drawing.Point(0, 0);
this.lblInfo.Name = "lblInfo";
this.lblInfo.Size = new System.Drawing.Size(385, 43);
this.lblInfo.Size = new System.Drawing.Size(379, 43);
this.lblInfo.TabIndex = 0;
this.lblInfo.Text = "#号车";
this.lblInfo.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
......@@ -78,7 +104,7 @@
this.grpBxRunMode.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.grpBxRunMode.Location = new System.Drawing.Point(0, 43);
this.grpBxRunMode.Name = "grpBxRunMode";
this.grpBxRunMode.Size = new System.Drawing.Size(385, 70);
this.grpBxRunMode.Size = new System.Drawing.Size(379, 64);
this.grpBxRunMode.TabIndex = 1;
this.grpBxRunMode.TabStop = false;
this.grpBxRunMode.Text = "模式选择";
......@@ -96,9 +122,9 @@
//
// btnReSendTask
//
this.btnReSendTask.Location = new System.Drawing.Point(251, 11);
this.btnReSendTask.Location = new System.Drawing.Point(140, 11);
this.btnReSendTask.Name = "btnReSendTask";
this.btnReSendTask.Size = new System.Drawing.Size(75, 53);
this.btnReSendTask.Size = new System.Drawing.Size(104, 45);
this.btnReSendTask.TabIndex = 3;
this.btnReSendTask.Text = "任务重发";
this.btnReSendTask.UseVisualStyleBackColor = true;
......@@ -109,9 +135,9 @@
this.grpBxOperation.Controls.Add(this.flowLayoutPanel1);
this.grpBxOperation.Dock = System.Windows.Forms.DockStyle.Top;
this.grpBxOperation.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.grpBxOperation.Location = new System.Drawing.Point(0, 113);
this.grpBxOperation.Location = new System.Drawing.Point(0, 107);
this.grpBxOperation.Name = "grpBxOperation";
this.grpBxOperation.Size = new System.Drawing.Size(385, 108);
this.grpBxOperation.Size = new System.Drawing.Size(379, 90);
this.grpBxOperation.TabIndex = 2;
this.grpBxOperation.TabStop = false;
this.grpBxOperation.Text = "操作";
......@@ -124,7 +150,7 @@
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 17);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(379, 88);
this.flowLayoutPanel1.Size = new System.Drawing.Size(373, 70);
this.flowLayoutPanel1.TabIndex = 0;
//
// btnReady
......@@ -169,16 +195,16 @@
this.grpBxMission.Controls.Add(this.cmbBxMission);
this.grpBxMission.Dock = System.Windows.Forms.DockStyle.Top;
this.grpBxMission.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.grpBxMission.Location = new System.Drawing.Point(0, 221);
this.grpBxMission.Location = new System.Drawing.Point(0, 197);
this.grpBxMission.Name = "grpBxMission";
this.grpBxMission.Size = new System.Drawing.Size(385, 70);
this.grpBxMission.Size = new System.Drawing.Size(379, 56);
this.grpBxMission.TabIndex = 3;
this.grpBxMission.TabStop = false;
this.grpBxMission.Text = "手动任务";
//
// btnAssignTask
//
this.btnAssignTask.Location = new System.Drawing.Point(216, 12);
this.btnAssignTask.Location = new System.Drawing.Point(206, 9);
this.btnAssignTask.Name = "btnAssignTask";
this.btnAssignTask.Size = new System.Drawing.Size(131, 35);
this.btnAssignTask.TabIndex = 1;
......@@ -188,17 +214,158 @@
//
// cmbBxMission
//
this.cmbBxMission.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.cmbBxMission.FormattingEnabled = true;
this.cmbBxMission.Location = new System.Drawing.Point(12, 20);
this.cmbBxMission.Location = new System.Drawing.Point(8, 20);
this.cmbBxMission.Name = "cmbBxMission";
this.cmbBxMission.Size = new System.Drawing.Size(159, 20);
this.cmbBxMission.Size = new System.Drawing.Size(159, 24);
this.cmbBxMission.TabIndex = 0;
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.tableLayoutPanel1);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Top;
this.groupBox1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox1.Location = new System.Drawing.Point(0, 253);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(379, 54);
this.groupBox1.TabIndex = 4;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "IO信号";
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 2;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel3, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel2, 0, 0);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 17);
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(373, 34);
this.tableLayoutPanel1.TabIndex = 0;
//
// flowLayoutPanel3
//
this.flowLayoutPanel3.Controls.Add(this.pictureBox5);
this.flowLayoutPanel3.Controls.Add(this.pictureBox6);
this.flowLayoutPanel3.Controls.Add(this.pictureBox7);
this.flowLayoutPanel3.Controls.Add(this.pictureBox8);
this.flowLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel3.Location = new System.Drawing.Point(189, 3);
this.flowLayoutPanel3.Name = "flowLayoutPanel3";
this.flowLayoutPanel3.Size = new System.Drawing.Size(181, 28);
this.flowLayoutPanel3.TabIndex = 1;
//
// pictureBox5
//
this.pictureBox5.Image = global::AGVDispatch.Properties.Resources.gray2;
this.pictureBox5.Location = new System.Drawing.Point(3, 3);
this.pictureBox5.Name = "pictureBox5";
this.pictureBox5.Size = new System.Drawing.Size(25, 22);
this.pictureBox5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.pictureBox5.TabIndex = 0;
this.pictureBox5.TabStop = false;
//
// pictureBox6
//
this.pictureBox6.Image = global::AGVDispatch.Properties.Resources.gray2;
this.pictureBox6.Location = new System.Drawing.Point(34, 3);
this.pictureBox6.Name = "pictureBox6";
this.pictureBox6.Size = new System.Drawing.Size(25, 22);
this.pictureBox6.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.pictureBox6.TabIndex = 1;
this.pictureBox6.TabStop = false;
//
// pictureBox7
//
this.pictureBox7.Image = global::AGVDispatch.Properties.Resources.gray2;
this.pictureBox7.Location = new System.Drawing.Point(65, 3);
this.pictureBox7.Name = "pictureBox7";
this.pictureBox7.Size = new System.Drawing.Size(25, 22);
this.pictureBox7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.pictureBox7.TabIndex = 2;
this.pictureBox7.TabStop = false;
//
// pictureBox8
//
this.pictureBox8.Image = global::AGVDispatch.Properties.Resources.gray2;
this.pictureBox8.Location = new System.Drawing.Point(96, 3);
this.pictureBox8.Name = "pictureBox8";
this.pictureBox8.Size = new System.Drawing.Size(25, 22);
this.pictureBox8.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.pictureBox8.TabIndex = 3;
this.pictureBox8.TabStop = false;
//
// flowLayoutPanel2
//
this.flowLayoutPanel2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.flowLayoutPanel2.Controls.Add(this.pictureBox1);
this.flowLayoutPanel2.Controls.Add(this.pictureBox2);
this.flowLayoutPanel2.Controls.Add(this.pictureBox3);
this.flowLayoutPanel2.Controls.Add(this.pictureBox4);
this.flowLayoutPanel2.Location = new System.Drawing.Point(3, 3);
this.flowLayoutPanel2.Name = "flowLayoutPanel2";
this.flowLayoutPanel2.Size = new System.Drawing.Size(180, 28);
this.flowLayoutPanel2.TabIndex = 0;
//
// pictureBox1
//
this.pictureBox1.Image = global::AGVDispatch.Properties.Resources.gray2;
this.pictureBox1.Location = new System.Drawing.Point(3, 3);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(25, 22);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// pictureBox2
//
this.pictureBox2.Image = global::AGVDispatch.Properties.Resources.gray2;
this.pictureBox2.Location = new System.Drawing.Point(34, 3);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(25, 22);
this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.pictureBox2.TabIndex = 1;
this.pictureBox2.TabStop = false;
//
// pictureBox3
//
this.pictureBox3.Image = global::AGVDispatch.Properties.Resources.gray2;
this.pictureBox3.Location = new System.Drawing.Point(65, 3);
this.pictureBox3.Name = "pictureBox3";
this.pictureBox3.Size = new System.Drawing.Size(25, 22);
this.pictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.pictureBox3.TabIndex = 2;
this.pictureBox3.TabStop = false;
//
// pictureBox4
//
this.pictureBox4.Image = global::AGVDispatch.Properties.Resources.gray2;
this.pictureBox4.Location = new System.Drawing.Point(96, 3);
this.pictureBox4.Name = "pictureBox4";
this.pictureBox4.Size = new System.Drawing.Size(25, 22);
this.pictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.pictureBox4.TabIndex = 3;
this.pictureBox4.TabStop = false;
//
// Manual
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(385, 297);
this.ClientSize = new System.Drawing.Size(379, 319);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.grpBxMission);
this.Controls.Add(this.grpBxOperation);
this.Controls.Add(this.grpBxRunMode);
......@@ -213,6 +380,20 @@
this.grpBxOperation.ResumeLayout(false);
this.flowLayoutPanel1.ResumeLayout(false);
this.grpBxMission.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.tableLayoutPanel1.ResumeLayout(false);
this.flowLayoutPanel3.ResumeLayout(false);
this.flowLayoutPanel3.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox7)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox8)).EndInit();
this.flowLayoutPanel2.ResumeLayout(false);
this.flowLayoutPanel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit();
this.ResumeLayout(false);
}
......@@ -232,5 +413,18 @@
private System.Windows.Forms.GroupBox grpBxMission;
private System.Windows.Forms.Button btnAssignTask;
private System.Windows.Forms.ComboBox cmbBxMission;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel3;
private System.Windows.Forms.PictureBox pictureBox5;
private System.Windows.Forms.PictureBox pictureBox6;
private System.Windows.Forms.PictureBox pictureBox7;
private System.Windows.Forms.PictureBox pictureBox8;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.PictureBox pictureBox2;
private System.Windows.Forms.PictureBox pictureBox3;
private System.Windows.Forms.PictureBox pictureBox4;
}
}
......@@ -27,8 +27,10 @@ namespace AGVControl
private void Manual_Load(object sender, EventArgs e)
{
lblInfo.Text = string.Format("[{0}]", Agv.IP);
cmbBxMission.Items.AddRange(CommonVar.showNameMissionName.Values.ToArray());
cmbBxMission.Items.AddRange(DeviceLibrary.Context.showNameMissionName.Values.ToArray());
cmbBxMission.SelectedIndex = 0;
InState.AddRange(new PictureBox[] { pictureBox1,pictureBox2,pictureBox3,pictureBox4});
OutState.AddRange(new PictureBox[] { pictureBox5, pictureBox6, pictureBox7, pictureBox8 });
isInit = true;
}
......@@ -50,8 +52,8 @@ namespace AGVControl
Agv.AssignTask(SettingString.Init);
}
CommonVar.Standby.DelOccupyInfo(Agv.Name);
CommonVar.Charge.DelOccupyInfo(Agv.Name);
DeviceLibrary.Context.Standby.DelOccupyInfo(Agv.Name);
DeviceLibrary.Context.Charge.DelOccupyInfo(Agv.Name);
}
else
......@@ -140,9 +142,9 @@ namespace AGVControl
{
try
{
var key = CommonVar.showNameMissionName.Where(qq => qq.Value == cmbBxMission.SelectedItem.ToString()).Select(qq => qq.Key);
var key = Context.showNameMissionName.Where(qq => qq.Value == cmbBxMission.SelectedItem.ToString()).Select(qq => qq.Key);
string taskName = key.ToList()[0];
if(!CommonVar.agvMission.Keys.Contains(taskName))
if(!DeviceLibrary.Context.agvMission.Keys.Contains(taskName))
{
LogUtil.error("无选定任务: "+ taskName);
return;
......@@ -166,5 +168,44 @@ namespace AGVControl
{
Close();
}
List<PictureBox> InState = new List<PictureBox>();
List<PictureBox> OutState = new List<PictureBox>();
private void timer1_Tick(object sender, EventArgs e)
{
this.Invoke(new Action(() => {
try
{
if (Agv.IOInState != null && Agv.IOInState.Length == 4)
{
for (int i = 0; i < Agv.IOInState.Length; i++)
{
if (Agv.IOInState[i])
{
InState[i].Image = AGVDispatch.Properties.Resources.green1;
}
else
{
InState[i].Image = AGVDispatch.Properties.Resources.gray2;
}
}
}
if (Agv.IOOutState != null && Agv.IOOutState.Length == 4)
{
for (int i = 0; i < Agv.IOOutState.Length; i++)
{
if (Agv.IOOutState[i])
{
OutState[i].Image = AGVDispatch.Properties.Resources.green1;
}
else
{
OutState[i].Image = AGVDispatch.Properties.Resources.gray2;
}
}
}
}
catch { }
}));
}
}
}
......@@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
......
......@@ -9,6 +9,7 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using DeviceLibrary;
using Common;
using System.IO;
namespace AGVControl
{
......@@ -23,7 +24,7 @@ namespace AGVControl
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
Application.ThreadException += Application_ThreadException;
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
XmlConfigurator.Configure();
XmlConfigurator.Configure(new FileInfo(AppConfigHelper.GetValue(SettingString.log4net_configname)));
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
......@@ -51,18 +52,16 @@ namespace AGVControl
{
LogUtil.info("=====程序开始=====");
ReadConfig();
CommonVar.Charge = new Charge();
CommonVar.Standby = new Standby();
CommonVar.control = new DeviceLibrary.Control();
CommonVar.control.Start();
CommonVar.server = new Agv.Server();
CommonVar.server.Start();
DeviceLibrary.Context.Charge = new Charge();
DeviceLibrary.Context.Standby = new Standby();
DeviceLibrary.Context.control = new DeviceLibrary.Control();
DeviceLibrary.Context.server = new Agv.Server();
DeviceLibrary.Context.control.Start();
}
private static void Stop()
{
CommonVar.control.Stop();
CommonVar.server.Stop();
DeviceLibrary.Context.control.Stop();
DeviceLibrary.Context.server.Stop();
LogUtil.info("=====程序结束=====\r\n");
}
private static void ReadConfig()
......@@ -74,48 +73,48 @@ namespace AGVControl
string rfid = "";
CommonVar.agvInfo = new List<Agv_Info>();
path = CommonVar.CONFIG_PATH + SettingString.FileName_AGV;
DeviceLibrary.Context.agvInfo = new List<Agv_Info>();
path = DeviceLibrary.Context.CONFIG_PATH + SettingString.FileName_AGV;
line = System.IO.File.ReadAllLines(path, Encoding.UTF8);
for (int i = 1; i < line.Length; i++)
{
temp = line[i].Split(',');
if (temp.Length != 5) continue;
//string val = CommonVar.appConfig.AppSettings.Settings[temp[1]].Value;
bool.TryParse(CommonVar.ReadIni(temp[1], SettingString.IsUse), out isuse); //Convert.ToBoolean(val.Split(',')[0]);
rfid = CommonVar.ReadIni(temp[1], SettingString.RFID); //val.Split(',')[1];
CommonVar.agvInfo.Add(new Agv_Info(temp[0], temp[1], temp[2], temp[3], temp[4], isuse, rfid));
bool.TryParse(DeviceLibrary.Context.ReadIni(temp[1], SettingString.IsUse), out isuse); //Convert.ToBoolean(val.Split(',')[0]);
rfid = DeviceLibrary.Context.ReadIni(temp[1], SettingString.RFID); //val.Split(',')[1];
DeviceLibrary.Context.agvInfo.Add(new Agv_Info(temp[0], temp[1], temp[2], temp[3], temp[4], isuse, rfid));
}
CommonVar.agvMission = new Dictionary<string, string>();
CommonVar.showNameMissionName = new Dictionary<string, string>();
path = CommonVar.CONFIG_PATH + SettingString.FileName_AgvMission;
DeviceLibrary.Context.agvMission = new Dictionary<string, string>();
DeviceLibrary.Context.showNameMissionName = new Dictionary<string, string>();
path = DeviceLibrary.Context.CONFIG_PATH + SettingString.FileName_AgvMission;
line = System.IO.File.ReadAllLines(path, Encoding.UTF8);
for (int i = 1; i < line.Length; i++)
{
temp = line[i].Split(',');
if (temp.Length != 3) continue;
CommonVar.agvMission.Add(temp[1], temp[2]);
CommonVar.showNameMissionName.Add(temp[1], temp[0]);
DeviceLibrary.Context.agvMission.Add(temp[1], temp[2]);
DeviceLibrary.Context.showNameMissionName.Add(temp[1], temp[0]);
}
CommonVar.nodeInfo = new List<Agv.ClientNode>();
path = CommonVar.CONFIG_PATH + SettingString.FileName_AgvProductionLine;
DeviceLibrary.Context.nodeInfo = new List<Agv.ClientNode>();
path = DeviceLibrary.Context.CONFIG_PATH + SettingString.FileName_AgvProductionLine;
line = System.IO.File.ReadAllLines(path, Encoding.GetEncoding("gb2312"));
for (int i = 1; i < line.Length; i++)
{
temp = line[i].Split(',');
if (temp.Length != 3) continue;
Boolean.TryParse(CommonVar.ReadIni(temp[0], SettingString.IsUse), out bool isUse);
CommonVar.nodeInfo.Add(new Agv.ClientNode(temp[0], temp[1],temp[2], isUse));
bool.TryParse(DeviceLibrary.Context.ReadIni(temp[0], SettingString.IsUse), out bool isUse);
DeviceLibrary.Context.nodeInfo.Add(new Agv.ClientNode(temp[0], temp[1], temp[2], isUse));
}
//加载任务类型
CommonVar.jobTypeInfo = new List<JobType>();
DeviceLibrary.Context.jobTypeInfo = new List<JobType>();
//CommonVar.jobTypeInfo.Add(new PackingJobType());
CommonVar.jobTypeInfo.Add(new BoxInJobType());
CommonVar.jobTypeInfo.Add(new BoxOutJobType());
CommonVar.jobTypeInfo.Add(new ChargeJobType());
DeviceLibrary.Context.jobTypeInfo.Add(new BoxInJobType());
DeviceLibrary.Context.jobTypeInfo.Add(new BoxOutJobType());
DeviceLibrary.Context.jobTypeInfo.Add(new ChargeJobType());
}
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
......
......@@ -59,5 +59,25 @@ namespace AGVDispatch.Properties {
resourceCulture = value;
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap gray2 {
get {
object obj = ResourceManager.GetObject("gray2", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap green1 {
get {
object obj = ResourceManager.GetObject("green1", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}
......@@ -46,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
......@@ -60,6 +60,7 @@
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
......@@ -68,9 +69,10 @@
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
......@@ -85,9 +87,10 @@
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
......@@ -109,9 +112,16 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="gray2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\gray2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="green1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\green1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup>
<log4net>
<appender name="AGVDispatch" type="log4net.Appender.RollingFileAppender">
<file value="logs/AGVDispatch.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t][%c:%L]%-5p %m%n"/>
</layout>
</appender>
<appender name="MiR_API" type="log4net.Appender.RollingFileAppender">
<file value="logs/MiR_API.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<param name="MaxSizeRollBackups" value="30"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t][%c:%L]%-5p %m%n"/>
</layout>
</appender>
<appender name="RequestManager" type="log4net.Appender.RollingFileAppender">
<file value="logs/Request/RequestManager.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<param name="MaxSizeRollBackups" value="30"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t][%c:%L]%-5p %m%n"/>
</layout>
</appender>
<logger name="MiR_API">
<level value="Error"/>
<appender-ref ref="MiR_API"/>
</logger>
<logger name="RequestManager">
<level value="Info"/>
<appender-ref ref="RequestManager"/>
</logger>
<root name="AGVDispatch">
<level value="Info"/>
<appender-ref ref="AGVDispatch"/>
</root>
</log4net>
</configuration>
\ No newline at end of file
......@@ -84,7 +84,9 @@ namespace Common
public const string D4 = "D4";
public const string LimitPoints = "LimitPoints";
public const string LocalIP = "LocalIP";
public const string AGVServerIp = "AGVServerIp";
public const string AGVServerPort = "AGVServerPort";
public const string Use_Fleet = "Use_Fleet";
public const string log4net_configname = "log4net_configname";
}
}
using Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
public class AGVManager
{
private static log4net.ILog log = log4net.LogManager.GetLogger("AGVManager");
/// <summary>
/// 小车从B区域离开前检查出库任务是否完成
/// </summary>
/// <param name="rfid"></param>
/// <returns>true:可以离开</returns>
public static bool LeaveCheck(Agv_Info agv, out int taskCount)
{
taskCount = 0;
try
{
//CommonVar.log.Info("URL:" + CommonVar.webService["URL"]);
string url = AppConfigHelper.GetValue(SettingString.http_server) + "rest/api/qisda/device/shelfTaskCount?rfid=" + agv.RFID;
var client = new RestSharp.RestClient(url) { Timeout = -1 };
var request = new RestSharp.RestRequest(RestSharp.Method.GET);
RestSharp.IRestResponse response = client.Execute(request);
string json = response.Content;
log.Debug(agv.Name + " [URL: " + url+"] [Return: " + json+"]");
if (string.IsNullOrWhiteSpace(json)) return true; //可以离开
//{"code":0,"msg":"ok","data":{"taskCount":1,"rfid":"A14"}}不能搬运锁定的料架,到待机位等待
ShelfTaskCount serverResult = JsonHelper.DeserializeJsonToObject<ShelfTaskCount>(json);
if (serverResult == null)
{
log.Error(" 没有收到服务器反馈");
return true;
}
if (serverResult.code != 0) return true;
agv.LeftTaskCnt = serverResult.data.taskCount;
if (serverResult.data.taskCount == 0) //该料架出库完成
{
log.Info(agv.Name+" 料架【" + agv.RFID + "】 无剩余出库任务,serverResult.shelfTaskData.taskCount=" + serverResult.data.taskCount.ToString());
return true;
}
else //该料架的出库任务未完成
{
// foreach (ShelfLockData item in serverResult.data)
// {
taskCount = serverResult.data.taskCount;
log.Info(agv.Name + " [RFID=" + serverResult.data.rfid + "] [taskCount=" + serverResult.data.taskCount + "]");
// }
return false;
}
}
catch (Exception ex)
{
log.Error(ex);
return true;
}
}
private static string Addr_getShelfLockInfo = "/rest/api/qisda/device/getShelfLockInfo"; //包装仓获取料架锁定状态地址
public static bool GetShelfLockInfo(string name,string rfid, List<string> shelfLockNodeNames)
{
string msg = "";
try
{
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("rfid", rfid);
string server = GetAddr(Addr_getShelfLockInfo, paramMap);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Post(server, "");
log.Info("节点【"+name+ "】 料架锁定状态 " + " 【" + server + "】【" + resultStr + "】");
ShelfLockInfo serverResult = JsonHelper.DeserializeJsonToObject<ShelfLockInfo>(resultStr);
if (serverResult == null)
{
msg = "节点【" + name + "】没有收到服务器反馈";
log.Error(msg);
return false;
}
if (serverResult.data.Count == 0) //该料架未锁定
{
msg = "节点【" + name + "】 料架【" + rfid + "】 没有锁定库位的料";
log.Info(msg);
return false;
}
else //该料架存在锁定库位的料
{
string nodes="";
foreach (ShelfLockData item in serverResult.data)
{
CommonVar.GetNodeNameByAliceName(item.cid,out string nodeName);
int resInt = shelfLockNodeNames.FindIndex(s=>s !=null && s.Equals(nodeName));
if(resInt==-1)
{
shelfLockNodeNames.Add(nodeName);
nodes+="锁定的CID=" + item.cid + ",节点名称=" + nodeName+";";
}
}
log.Info("节点【" + name + "】获取" + rfid+"料仓锁定信息完成:"+nodes);
return true;
}
}
catch (Exception ex)
{
log.Error(ex.Message);
}
return false;
}
private static string Addr_updateDeviceAlarmMsg = "/rest/api/qisda/device/updateDeviceAlarmMsg";
/// <summary>
/// 异常看板
/// </summary>
/// <param name="msgList"></param>
/// <returns></returns>
public static string updateDeviceAlarmMsg(List<AlarmMsg> msgList)
{
string msg = "";
try
{
Dictionary<string, string> paramMap = new Dictionary<string, string>();
string msgListStr = JsonHelper.SerializeObject(msgList);
paramMap.Add("deviceAlarmList", msgListStr);
string server = GetAddr(Addr_updateDeviceAlarmMsg, paramMap);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Post(server, "");
msgList.ForEach(new Action<AlarmMsg>(k => log.Debug("deviceAlarmList " + k.ToString()))); ;
RfidData data = JsonHelper.DeserializeJsonToObject<RfidData>(resultStr);
if (data == null)
{
return msg = " updateDeviceAlarmMsg 没有收到服务器反馈";
}
else if (data.code.Equals(0).Equals(false))
{
return msg = " updateDeviceAlarmMsg 【" + server + "】【" + resultStr + "】" + data.msg;
}
return "";
}
catch (Exception ex)
{
log.Error(ex);
}
return msg;
}
private static string GetAddr(string addr, Dictionary<string, string> paramsMap)
{
string server = AppConfigHelper.GetValue(SettingString.http_server);
if (server.EndsWith("/"))
{
server = server.Substring(0, server.Length - 1);
}
string path = server + addr.Trim() + "?";
foreach (string paramName in paramsMap.Keys)
{
string par = System.Web.HttpUtility.UrlEncode(paramsMap[paramName], System.Text.Encoding.UTF8);
path += paramName + "=" + par + "&";
}
path = path.Substring(0, path.Length - 1);
return path;
}
}
public class ShelfLockInfo
{
//返回: {"code":0,"msg":"ok","data":
//[{"barcode":"S20052301213","cid":"packing-20","rfid":"A12","rfidLoc":"3","lockPos":"4D2001AA0006","lockPosId":"1231"}]}
/// <summary>
/// 返回码,0为正常,其他为异常
/// </summary>
public int code { get; set; }
/// <summary>
/// 消息
/// </summary>
public string msg { get; set; }
public List<ShelfLockData> data { get; set; }
}
public class ShelfLockData
{
/// <summary>
/// 库位中料盘的条码
/// </summary>
public string barcode { get; set; }
/// <summary>
/// 库位中料盘的锁定库位对应的料仓编
/// </summary>
public string cid { get; set; }
/// <summary>
/// 料架RFID
/// </summary>
public string rfid { get; set; }
/// <summary>
/// 料架的库位
/// </summary>
public int rfidLoc { get; set; }
/// <summary>
/// 库位中料盘的锁定库位
/// </summary>
public string lockPos { get; set; }
/// <summary>
/// 料架出库的剩余数量
/// </summary>
public int taskCount { get; set; }
}
/// <summary>
/// 获取料架中的任务数
/// </summary>
public class ShelfTaskCount
{
// {"code":0,"msg":"ok","data":{"taskCount":0,"rfid":"A2"}}
/// <summary>
/// 0为正常,其他为异常
/// </summary>
public int code { get; set; }
/// <summary>
/// 消息
/// </summary>
public string msg { get; set; }
public ShelfTaskData data { get; set; }
}
public struct ShelfTaskData
{
/// <summary>
/// 当前料架剩余任务数(即还有几盘料没放上去)
/// </summary>
public int taskCount { get; set; }
/// <summary>
/// 料架RFID
/// </summary>
public string rfid { get; set; }
}
public class AlarmMsg
{
//>>>name : 异常位置名称
public string name = "";
//>>>msgKey : 异常信息唯一标识
public string msgKey = "";
//>>>msgValue : 异常信息
public string msgValue = "";
public int type;
/// <summary>
/// 异常信息
/// </summary>
/// <param name="name">异常位置名称</param>
/// <param name="key">异常信息唯一标识</param>
/// <param name="value">异常信息</param>
public AlarmMsg(string name, string key, string value,int type=0)
{
this.name = name;
this.msgKey = key;
this.msgValue = value;
this.type = type;
}
public override string ToString()
{
return string.Format("[name:{0},msgKey:{1},msgValue:{2},type:{3}]",name,msgKey,msgValue,type);
}
}
public class RfidData
{
//{"code":0,"msg":"ok","data":"7"}
public int code { get; set; }
public string msg { get; set; }
public Dictionary<string, string> data { get; set; }
}
}
任务别称,任务名称,任务GUID
小车初始化,Init,219cd91a-61da-11eb-96a9-0001297a1dca
待机位,MoveStandby,615cef05-61f4-11eb-96a9-0001297a1dca
充电位1,AutoCharge1,d90853ec-5f06-11eb-9d80-0001297a1dca
小车进料,Enter,ce64c188-61da-11eb-96a9-0001297a1dca
小车出料,Leave,a7220ff0-7927-11eb-9adc-54b2038d1924
空料串线出口,MoveA1,60213bb2-764c-11eb-a016-0001297a1dca
空料串线入口,MoveA2,fa9d938e-764b-11eb-a016-0001297a1dca
上料线出口,MoveA3,60213bb2-764c-11eb-a016-0001297a1dca
上料线入口,MoveA4,fa9d938e-764b-11eb-a016-0001297a1dca
设备1入口,MoveD1,60213bb2-764c-11eb-a016-0001297a1dca
设备1出口,MoveD2,fa9d938e-764b-11eb-a016-0001297a1dca
设备2入口,MoveD3,60213bb2-764c-11eb-a016-0001297a1dca
设备2出口,MoveD4,fa9d938e-764b-11eb-a016-0001297a1dca
产线1,MoveS1,60213bb2-764c-11eb-a016-0001297a1dca
产线2,MoveS2,fa9d938e-764b-11eb-a016-0001297a1dca
\ No newline at end of file
小车初始化,Init,2c2e0fe3-8d43-11eb-bd58-94c6911e764d
待机位,MoveStandby,df5926f0-8d47-11eb-bd58-94c6911e764d
充电位1,AutoCharge1,6b514f0a-8d46-11eb-bd58-94c6911e764d
小车进料,Enter,4e4c2947-8d3d-11eb-bd58-94c6911e764d
小车出料,Leave,011a98ec-8d41-11eb-bd58-94c6911e764d
空料串线出口,MoveA1,ff58076c-8cc6-11eb-952c-94c6911e764d
空料串线入口,MoveA2,3437439d-8cc9-11eb-952c-94c6911e764d
上料线出口,MoveA3,6167bce7-8cc9-11eb-952c-94c6911e764d
上料线入口,MoveA4,8d5f39a9-8cc9-11eb-952c-94c6911e764d
设备1入口,MoveD1,2bb17432-8cca-11eb-952c-94c6911e764d
设备1出口,MoveD2,c3d71c15-8cca-11eb-952c-94c6911e764d
设备2入口,MoveD3,61c2ea2a-8cca-11eb-952c-94c6911e764d
设备2出口,MoveD4,3820bb99-8ccb-11eb-952c-94c6911e764d
产线1,MoveS1,13e34f3b-8d3b-11eb-bd58-94c6911e764d
产线2,MoveS2,13e34f3b-8d3b-11eb-bd58-94c6911e764d
\ No newline at end of file
Fleet ID,agv名称,IP,授权码,IOID
1,1号车,10.85.199.18,Basic ZGlzdHJpYnV0b3I6NjJmMmYwZjFlZmYxMGQzMTUyYzk1ZjZmMDU5NjU3NmU0ODJiYjhlNDQ4MDY0MzNmNGNmOTI5NzkyODM0YjAxNA==,d38637b1-6150-11eb-b885-0001297a1dca
1,1号车,10.21.67.1,Basic ZGlzdHJpYnV0b3I6NjJmMmYwZjFlZmYxMGQzMTUyYzk1ZjZmMDU5NjU3NmU0ODJiYjhlNDQ4MDY0MzNmNGNmOTI5NzkyODM0YjAxNA==,d1d882a2-8c7a-11eb-8fb4-94c6911e764d
......@@ -8,4 +8,10 @@ D2,D2,设备1出口-D2
D3,D3,设备2入口-D3
D4,D4,设备3入口-D4
S1,S1,产线1
S2,S2,产线2
\ No newline at end of file
S2,S2,产线2
S3,S3,产线3
S4,S4,产线4
S5,S5,产线5
S6,S6,产线6
S7,S7,产线7
S8,S8,产线8
\ No newline at end of file
......@@ -9,9 +9,9 @@ using Common;
namespace DeviceLibrary
{
/// <summary>
/// 公共参数
/// 程序上下文变量
/// </summary>
public static class CommonVar
public static class Context
{
/// <summary>
/// 节点信息
......
......@@ -79,18 +79,18 @@ namespace DeviceLibrary
if (AgvStateInProcess) return;
AgvStateInProcess = true;
for (int i = 0; i < CommonVar.agvInfo.Count; i++)
for (int i = 0; i < Context.agvInfo.Count; i++)
{
try
{
if (!CheckOnline(i)) continue;
bool change = false;
MiR_API.Get_Task_State(CommonVar.agvInfo[i], out string stateStr);
MiR_API.Get_Task_State(Context.agvInfo[i], out string stateStr);
Thread.Sleep(50);
//获取AGV状态
rtn = MiR_API.Get_State(CommonVar.agvInfo[i], out eAGVState stateID, out string stateText, out int battery, out string mission_text, out Agv_Info.AgvPosition position);
rtn = MiR_API.Get_State(Context.agvInfo[i], out eAGVState stateID, out string stateText, out int battery, out string mission_text, out Agv_Info.AgvPosition position);
Thread.Sleep(50);
change = CommonVar.agvInfo[i].SetState(stateID, stateStr, battery, mission_text, position);
change = Context.agvInfo[i].SetState(stateID, stateStr, battery, mission_text, position);
//更新状态stateID.Equals(eAGVState.Executing)
if (change)
......@@ -101,7 +101,7 @@ namespace DeviceLibrary
}
catch (Exception ex)
{
LogUtil.error("AgvStateTimer_" + CommonVar.agvInfo[i].Name + ex.Message + ex.StackTrace);
LogUtil.error("AgvStateTimer_" + Context.agvInfo[i].Name + ex.Message + ex.StackTrace);
}
}
......@@ -120,7 +120,7 @@ namespace DeviceLibrary
{
lock(lockGetObj)
{
foreach (JobType find in CommonVar.jobTypeInfo)
foreach (JobType find in Context.jobTypeInfo)
{
Job job = null;
......@@ -149,19 +149,19 @@ namespace DeviceLibrary
{
if (AgvCallInProcess) return;
AgvCallInProcess = true;
for (int i = 0; i < CommonVar.agvInfo.Count; i++)
for (int i = 0; i < Context.agvInfo.Count; i++)
{
try
{
Agv_Info agv = CommonVar.agvInfo[i];
Agv_Info agv = Context.agvInfo[i];
if (!agv.IsCon) continue; //AGV网络连接
if (!CommonVar.agvInfo[i].IsUse) continue; //AGV是否可用
if (!Context.agvInfo[i].IsUse) continue; //AGV是否可用
//Ready,Pause,Executing,Error
if (!CommonVar.agvInfo[i].StateID.Equals(eAGVState.Ready) && !CommonVar.agvInfo[i].StateID.Equals(eAGVState.Pause)
&& !CommonVar.agvInfo[i].StateID.Equals(eAGVState.Executing) && !CommonVar.agvInfo[i].StateID.Equals(eAGVState.None))
if (!Context.agvInfo[i].StateID.Equals(eAGVState.Ready) && !Context.agvInfo[i].StateID.Equals(eAGVState.Pause)
&& !Context.agvInfo[i].StateID.Equals(eAGVState.Executing) && !Context.agvInfo[i].StateID.Equals(eAGVState.None))
{
LogUtil.debug(CommonVar.agvInfo[i].Name + " 不可调用 StateID=" + CommonVar.agvInfo[i].StateID.ToString());
LogUtil.debug(Context.agvInfo[i].Name + " 不可调用 StateID=" + Context.agvInfo[i].StateID.ToString());
continue;
}
......@@ -192,31 +192,31 @@ namespace DeviceLibrary
private bool CheckOnline(int idx)
{
bool rtn = MiR_API.CheckIP(CommonVar.agvInfo[idx].IP);
bool rtn = MiR_API.CheckIP(Context.agvInfo[idx].IP);
if (rtn)
{
if (CommonVar.agvInfo[idx].IsCon)
if (Context.agvInfo[idx].IsCon)
{
LogUtil.debug(CommonVar.agvInfo[idx].Name + " Online");
LogUtil.debug(Context.agvInfo[idx].Name + " Online");
}
else
{
CommonVar.agvInfo[idx].IsCon = true;
LogUtil.info(CommonVar.agvInfo[idx].Name + " Online");
Context.agvInfo[idx].IsCon = true;
LogUtil.info(Context.agvInfo[idx].Name + " Online");
AgvOnline?.Invoke(idx);
}
}
else
{
if (CommonVar.agvInfo[idx].IsCon)
if (Context.agvInfo[idx].IsCon)
{
CommonVar.agvInfo[idx].IsCon = false;
LogUtil.info(CommonVar.agvInfo[idx].Name + " Offline");
Context.agvInfo[idx].IsCon = false;
LogUtil.info(Context.agvInfo[idx].Name + " Offline");
AgvOnline?.Invoke(idx);
}
else
{
LogUtil.debug(CommonVar.agvInfo[idx].Name + " Offline");
LogUtil.debug(Context.agvInfo[idx].Name + " Offline");
}
}
return rtn;
......
......@@ -56,11 +56,11 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AGVManager.cs" />
<Compile Include="manager\RequestManager.cs" />
<Compile Include="bean\Agv_Info.cs" />
<Compile Include="bean\Job.cs" />
<Compile Include="bean\job\Job.cs" />
<Compile Include="bean\JobStep.cs" />
<Compile Include="bean\JobType.cs" />
<Compile Include="bean\jobType\JobType.cs" />
<Compile Include="bean\jobType\ChargeJobType.cs" />
<Compile Include="bean\jobType\BoxInJobType.cs" />
<Compile Include="bean\jobType\BoxOutJobType.cs" />
......@@ -72,7 +72,7 @@
<Compile Include="bean\job\SendShelfJob.cs" />
<Compile Include="bean\job\StandyJob.cs" />
<Compile Include="Charge.cs" />
<Compile Include="CommonVar.cs" />
<Compile Include="Context.cs" />
<Compile Include="Control.cs" />
<Compile Include="DisplayBoard.cs" />
<Compile Include="bean\MiR_API.cs" />
......
......@@ -40,7 +40,7 @@ namespace DeviceLibrary
{
if (MsgList != null && MsgList.Count > 0)
{
AGVManager.updateDeviceAlarmMsg(MsgList);
RequestManager.updateDeviceAlarmMsg(MsgList);
ClearAlram();
}
......
......@@ -50,7 +50,7 @@ namespace DeviceLibrary
foreach (string ip in agvIPs)
{
Thread.Sleep(1000);
rtn = MiR_API.Get_Position(ip, CommonVar.agvInfo[0].Authorization, out Agv_Info.AgvPosition position);
rtn = MiR_API.Get_Position(ip, Context.agvInfo[0].Authorization, out Agv_Info.AgvPosition position);
if (rtn)
{
if (IsInPolygon(position, positions))
......
......@@ -33,6 +33,8 @@ namespace DeviceLibrary
/// </summary>
public string RFID { set; get; }
public int LeftTaskCnt { get; set; }
public bool[] IOInState { get; private set; }
public bool[] IOOutState { get; private set; }
/// <summary>
/// 是否在线
/// </summary>
......@@ -64,7 +66,7 @@ namespace DeviceLibrary
if (!value.Equals(_IsUse))
{
_IsUse = value;
CommonVar.WriteIni(Name, SettingString.IsUse, _IsUse.ToString());
Context.WriteIni(Name, SettingString.IsUse, _IsUse.ToString());
}
}
get { return _IsUse; }
......@@ -211,8 +213,21 @@ namespace DeviceLibrary
bool isChange = false;
bool preShelfState = IsExistShelf;
MiR_API.Get_IO_Status(this, out bool[] input, out bool[] output);
if(input !=null && output !=null)
{
try
{
IOInState = input;
IOOutState = output;
}
catch
{
}
}
if (input != null && input.Length == 4)
{
bool reachIoValue = input[3].Equals(true);//input[2] &&
if (reachIoValue)
{
......@@ -259,9 +274,9 @@ namespace DeviceLibrary
StateKanban.SetBattery(battery);
}
//"目的地", "RFID", "负载", "运行模式","任务信息", "AGV运行信息"
if (CommonVar.nodeInfo != null && CommonVar.nodeInfo.Count != 0)
if (Context.nodeInfo != null && Context.nodeInfo.Count != 0)
{
Agv.ClientNode node = CommonVar.nodeInfo.Find(ss => ss.Name == Place);
Agv.ClientNode node = Context.nodeInfo.Find(ss => ss.Name == Place);
if (node != null)
PlaceAliceName = node.AliceName;
else
......@@ -416,9 +431,9 @@ namespace DeviceLibrary
s.Add(CurTaskState);
//s.Add(Msg);
// s.Add(MissionText);
if (CommonVar.nodeInfo != null && CommonVar.nodeInfo.Count != 0)
if (Context.nodeInfo != null && Context.nodeInfo.Count != 0)
{
Agv.ClientNode node = CommonVar.nodeInfo.Find(ss => ss.Name == Place);
Agv.ClientNode node = Context.nodeInfo.Find(ss => ss.Name == Place);
if (node != null)
PlaceAliceName = node.AliceName;
else
......@@ -441,11 +456,11 @@ namespace DeviceLibrary
bool rtn=false;
if (Use_Fleet)
{
rtn = MiR_API.Add_Mission_Fleet(this, CommonVar.agvMission[taskName]);
rtn = MiR_API.Add_Mission_Fleet(this, Context.agvMission[taskName]);
}
else
{
rtn = MiR_API.Add_Mission(this, CommonVar.agvMission[taskName]);
rtn = MiR_API.Add_Mission(this, Context.agvMission[taskName]);
}
if (rtn)
{
......@@ -455,7 +470,7 @@ namespace DeviceLibrary
{
LogUtil.info(string.Format("{0} 分配{1}任务失败", Name, taskName));
}
StateKanban.SetCurTask(CommonVar.showNameMissionName[taskName]);
StateKanban.SetCurTask(Context.showNameMissionName[taskName]);
MiR_API.State_Ready(this);
return rtn;
}
......
......@@ -190,7 +190,7 @@ namespace DeviceLibrary
info.CurTaskID = -1;
info.CurTaskGUID = "";
info.CurTaskState = SettingString.Wait;
var key = CommonVar.agvMission.Where(qq => qq.Value == mission_id).Select(qq => qq.Key);
var key = Context.agvMission.Where(qq => qq.Value == mission_id).Select(qq => qq.Key);
info.CurTaskName = key.ToList()[0];
//删除上一任务
Del_Mission(info);
......@@ -252,7 +252,7 @@ namespace DeviceLibrary
info.CurTaskID = -1;
info.CurTaskGUID = "";
info.CurTaskState = SettingString.Wait;
var key = CommonVar.agvMission.Where(qq => qq.Value == mission_id).Select(qq => qq.Key);
var key = Context.agvMission.Where(qq => qq.Value == mission_id).Select(qq => qq.Key);
info.CurTaskName = key.ToList()[0];
//防止上一个任务已执行但返回失败时,删除任务
Del_Mission(info);
......@@ -514,7 +514,7 @@ namespace DeviceLibrary
{
string ip = AppConfigHelper.GetValue(SettingString.FLEET);
string url = "http://" + ip + "/api/v2.0.0/mission_scheduler/" + agv.CurTaskID;
string json = HttpGet(url, ip, CommonVar.agvInfo[0].Authorization);
string json = HttpGet(url, ip, Context.agvInfo[0].Authorization);
log.Debug("URL: " + url + "\n" + "Return: " + json);
if (string.IsNullOrWhiteSpace(json)) return false;
......
......@@ -43,13 +43,13 @@ namespace DeviceLibrary
bool rtn = false;
agv.Msg = RunInfo;
CurTaskState = CommonVar.GetTakJobState(agv);
CurTaskState = Context.GetTakJobState(agv);
if (ChargeStep.IsStep(CHARGE_STEP.NONE))
{
if (!CommonVar.Charge.StartCharge(agv))
if (!Context.Charge.StartCharge(agv))
{
runInfo = "电量[" + agv.Battery + "%]小于最大电量[" + CommonVar.Charge.BatteryMax + "%],由于充电桩有小车,从当前位置" + agvPlace + "回到待机位";
runInfo = "电量[" + agv.Battery + "%]小于最大电量[" + Context.Charge.BatteryMax + "%],由于充电桩有小车,从当前位置" + agvPlace + "回到待机位";
msg += runInfo;
ChargeStep.Msg = msg;
return new StandyJob(agv.Place);
......@@ -57,7 +57,7 @@ namespace DeviceLibrary
else
{
ChargeStep.ToNextStep(CHARGE_STEP.WAIT_REACH_CHARGE_STATION);
runInfo = "电量[" + agv.Battery + "%]小于最大电量[" + CommonVar.Charge.BatteryMax + "%],从当前位置" + agvPlace + "去到充电位";
runInfo = "电量[" + agv.Battery + "%]小于最大电量[" + Context.Charge.BatteryMax + "%],从当前位置" + agvPlace + "去到充电位";
msg += runInfo;
ChargeStep.Msg = msg;
UpdateJobTaskInfo(agv);
......@@ -67,7 +67,7 @@ namespace DeviceLibrary
else if (ChargeStep.IsStep(CHARGE_STEP.WAIT_REACH_CHARGE_STATION))
{
if (CommonVar.CheckTaskFinished(agv, CurTaskName))
if (Context.CheckTaskFinished(agv, CurTaskName))
{
ChargeStep.ToNextStep(CHARGE_STEP.WAIT_REACH_CHARGE_OK);
runInfo = "充电任务分配完成,去充电且等待任务";
......@@ -77,23 +77,23 @@ namespace DeviceLibrary
}
else if (ChargeStep.IsStep(CHARGE_STEP.WAIT_REACH_CHARGE_OK))
{
if (agv.Battery > CommonVar.Charge.BatteryMax)
if (agv.Battery > Context.Charge.BatteryMax)
{
runInfo = "充电完成,回待机位";
msg += runInfo;
ChargeStep.Msg = msg;
CommonVar.Charge.DelOccupyInfoByAGV(agv);
Context.Charge.DelOccupyInfoByAGV(agv);
return new StandyJob(agv.Place);
}
else if (agv.Battery > CommonVar.Charge.BatteryMin)
else if (agv.Battery > Context.Charge.BatteryMin)
{
Job job = CommonVar.control.GetJob(agv);
Job job = Context.control.GetJob(agv);
if (job != null && !(job is ChargeJob) && !(job is StandyJob))
{
runInfo = "在充电位检测到任务,电量[" + agv.Battery + " %]大于最小电量[" + CommonVar.Charge.BatteryMin + " %],可执行任务";
runInfo = "在充电位检测到任务,电量[" + agv.Battery + " %]大于最小电量[" + Context.Charge.BatteryMin + " %],可执行任务";
msg += runInfo;
ChargeStep.Msg = msg;
CommonVar.Charge.DelOccupyInfoByAGV(agv);
Context.Charge.DelOccupyInfoByAGV(agv);
return job;
}
}
......
......@@ -39,16 +39,16 @@ namespace DeviceLibrary
{
get
{
int t1 = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(agvPlace));
int t1 = Context.nodeInfo.FindIndex(s => s.Name.Equals(agvPlace));
string from = "";
if (t1 > -1)
from = CommonVar.nodeInfo[t1].AliceName;
from = Context.nodeInfo[t1].AliceName;
else
from = agvPlace;
int t2 = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(TargetPlace));
int t2 = Context.nodeInfo.FindIndex(s => s.Name.Equals(TargetPlace));
string to = "";
if (t2 > -1)
to = CommonVar.nodeInfo[t2].AliceName;
to = Context.nodeInfo[t2].AliceName;
else
to = TargetPlace;
return string.Format("取满料架任务:{0}[RFID={1}][目的地={2}][任务名称={3}][任务状态={4}]", runInfo, RFID, to, CurTaskName, CurTaskState);
......@@ -67,7 +67,7 @@ namespace DeviceLibrary
bool rtn = false;
agv.Msg = runInfo;
CurTaskState = CommonVar.GetTakJobState(agv);
CurTaskState = Context.GetTakJobState(agv);
if (curJobStep.IsStep(EXECUTE_STEP.P1_NONE))
{
......@@ -77,7 +77,7 @@ namespace DeviceLibrary
runInfo = "待机位/充电位收到任务,开始执行";
msg += runInfo;
curJobStep.Msg = msg;
CommonVar.MoveToNode(agv, TargetPlace);
Context.MoveToNode(agv, TargetPlace);
UpdateJobTaskInfo(agv);
}
else
......@@ -87,14 +87,14 @@ namespace DeviceLibrary
msg += runInfo;
curJobStep.Msg = msg;
CommonVar.MoveToNode(agv, TargetPlace);
Context.MoveToNode(agv, TargetPlace);
UpdateJobTaskInfo(agv);
}
}
else if (curJobStep.IsStep(EXECUTE_STEP.P2_WAIT_REACH_OUT_SHELF_PLACE))
{
if (CommonVar.CheckTaskMoveFinished(agv, TargetPlace, CurTaskState))
if (Context.CheckTaskMoveFinished(agv, TargetPlace, CurTaskState))
{
curJobStep.ToNextStep(EXECUTE_STEP.P3_CHECK_STATION_STATE);
runInfo = "到达云仓出料口 " + TargetPlace;
......@@ -104,14 +104,14 @@ namespace DeviceLibrary
}
else if (curJobStep.IsStep(EXECUTE_STEP.P3_CHECK_STATION_STATE))
{
if (BoxOutJobType.CheckFullTask(RFID))
if (BoxOutJobType.CheckFullTask(RFID,out string tarname))
{
curJobStep.ToNextStep(EXECUTE_STEP.P4_WAIT_LINE_RESPONSE);
runInfo = RFID + " 满料任务确认存在,并向线体" + TargetPlace + "发送出料请求";
runInfo = RFID + " 满料任务确认存在,目的地为"+ tarname + ",并向线体" + TargetPlace + "发送出料请求";
msg += runInfo;
curJobStep.Msg = msg;
CommonVar.server.Ready(TargetPlace, "");
Context.server.Ready(TargetPlace, "");
}
else
{
......@@ -125,19 +125,19 @@ namespace DeviceLibrary
msg += runInfo;
curJobStep.Msg = msg;
recyMark = true;
CommonVar.server.Ready(TargetPlace, "");
Context.server.Ready(TargetPlace, "");
}
else
{
if (BoxOutJobType.CheckFullTask(rfid))
if (BoxOutJobType.CheckFullTask(rfid,out string tarname1))
{
curJobStep.ToNextStep(EXECUTE_STEP.P4_WAIT_LINE_RESPONSE);
rfid = RFID;
runInfo = RFID + " 满料任务存在,并向线体" + TargetPlace + "发送出料请求";
RFID=rfid;
runInfo = RFID + " 满料任务存在,目的地为"+ tarname1 + ",并向线体" + TargetPlace + "发送出料请求";
msg += runInfo;
curJobStep.Msg = msg;
CommonVar.server.Ready(TargetPlace, "");
Context.server.Ready(TargetPlace, "");
}
else
{
......@@ -146,7 +146,7 @@ namespace DeviceLibrary
msg += runInfo;
curJobStep.Msg = msg;
recyMark = true;
CommonVar.server.Ready(TargetPlace, "");
Context.server.Ready(TargetPlace, "");
}
}
}
......@@ -171,9 +171,9 @@ namespace DeviceLibrary
}
else if (curJobStep.IsStep(EXECUTE_STEP.P5_WAIT_SHELF_IN_AGV))
{
if (CommonVar.CheckEnterOrLeaveFinished(agv, SettingString.Enter, CurTaskState))
if (Context.CheckEnterOrLeaveFinished(agv, SettingString.Enter, CurTaskState))
{
CommonVar.server.CloseDoor(TargetPlace);
Context.server.CloseDoor(TargetPlace);
if (recyMark)
{
......@@ -182,12 +182,13 @@ namespace DeviceLibrary
curJobStep.Msg = msg;
return new SendShelfJob(TargetPlace, SettingString.A2, RFID);
}
if (BoxOutJobType.CheckFullTask(RFID))
if (BoxOutJobType.CheckFullTask(RFID,out string tarname))
{
runInfo = "料架进入小车完成,无目的地。回收该料架";
runInfo = RFID+"料架进入小车完成,去"+tarname;
msg += runInfo;
curJobStep.Msg = msg;
return new RecycleEmptyShelf(agvPlace, SettingString.A2, true);
RequestManager.AgvRemoveRfid(RFID);
return new SendFullShelfJob(TargetPlace,tarname,"",RFID);
}
else
{
......
......@@ -44,16 +44,16 @@ namespace DeviceLibrary
{
get
{
int t1 = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(agvPlace));
int t1 = Context.nodeInfo.FindIndex(s => s.Name.Equals(agvPlace));
string from = "";
if (t1 > -1)
from = CommonVar.nodeInfo[t1].AliceName;
from = Context.nodeInfo[t1].AliceName;
else
from = agvPlace;
int t2 = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(TargetPlace));
int t2 = Context.nodeInfo.FindIndex(s => s.Name.Equals(TargetPlace));
string to = "";
if (t2 > -1)
to = CommonVar.nodeInfo[t2].AliceName;
to = Context.nodeInfo[t2].AliceName;
else
to = TargetPlace;
return string.Format("取{5}料串任务[RFID={4}]: {0}[目的地={1}][任务名称={2}][任务状态={3}]", runInfo, to, CurTaskName, CurTaskState, RFID, isFullShelf ? "满" : "空");
......@@ -64,16 +64,16 @@ namespace DeviceLibrary
private string GetShowInfo()
{
int t1 = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(agvPlace));
int t1 = Context.nodeInfo.FindIndex(s => s.Name.Equals(agvPlace));
string from = "";
if (t1 > -1)
from = CommonVar.nodeInfo[t1].AliceName;
from = Context.nodeInfo[t1].AliceName;
else
from = agvPlace;
int t2 = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(TargetPlace));
int t2 = Context.nodeInfo.FindIndex(s => s.Name.Equals(TargetPlace));
string to = "";
if (t2 > -1)
to = CommonVar.nodeInfo[t2].AliceName;
to = Context.nodeInfo[t2].AliceName;
else
to = TargetPlace;
return string.Format("取料串任务: {0} [{1}->{2}]", runInfo, from, to); ;
......@@ -88,7 +88,7 @@ namespace DeviceLibrary
bool rtn = false;
agv.Msg = GetShowInfo();
agv.RFID = RFID;
CurTaskState = CommonVar.GetTakJobState(agv);
CurTaskState = Context.GetTakJobState(agv);
if (curJobStep.IsStep(EXECUTE_STEP.P1_NONE))
{
......@@ -98,7 +98,7 @@ namespace DeviceLibrary
runInfo = "待机位/充电位收到任务,开始执行";
msg += runInfo;
curJobStep.Msg = msg;
CommonVar.MoveToNode(agv, TargetPlace);
Context.MoveToNode(agv, TargetPlace);
UpdateJobTaskInfo(agv);
}
else
......@@ -108,26 +108,26 @@ namespace DeviceLibrary
msg += runInfo;
curJobStep.Msg = msg;
CommonVar.MoveToNode(agv, TargetPlace);
Context.MoveToNode(agv, TargetPlace);
UpdateJobTaskInfo(agv);
}
}
else if (curJobStep.IsStep(EXECUTE_STEP.P2_WAIT_REACH_SHELF_PLACE))
{
if (CommonVar.CheckTaskMoveFinished(agv, TargetPlace, CurTaskState))
if (Context.CheckTaskMoveFinished(agv, TargetPlace, CurTaskState))
{
curJobStep.ToNextStep(EXECUTE_STEP.P4_WAIT_LINE_RESPONSE);
runInfo = "到达料架处" + TargetPlace + ",并向线体发送出料请求";
msg += runInfo;
curJobStep.Msg = msg;
CommonVar.server.Ready(TargetPlace, "");
Context.server.Ready(TargetPlace, "");
}
}
else if (curJobStep.IsStep(EXECUTE_STEP.P4_WAIT_LINE_RESPONSE))
{
int i = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(TargetPlace));//&& s.StateEquals(eNodeStatus.MayLeave)
int i = Context.nodeInfo.FindIndex(s => s.Name.Equals(TargetPlace));//&& s.StateEquals(eNodeStatus.MayLeave)
if (i > -1)
{
curJobStep.ToNextStep(EXECUTE_STEP.P5_WAIT_SHELF_IN_AGV);
......@@ -158,9 +158,9 @@ namespace DeviceLibrary
}
else if (curJobStep.IsStep(EXECUTE_STEP.P5_WAIT_SHELF_IN_AGV))
{
if (CommonVar.CheckEnterOrLeaveFinished(agv, SettingString.Enter, CurTaskState))
if (Context.CheckEnterOrLeaveFinished(agv, SettingString.Enter, CurTaskState))
{
CommonVar.server.CloseDoor(TargetPlace);
Context.server.CloseDoor(TargetPlace);
if (FindShelfTarget(agv, out string tarNodeName))
{
runInfo = "料串进入小车完成,任务结束";
......@@ -175,7 +175,7 @@ namespace DeviceLibrary
msg += runInfo;
curJobStep.Msg = msg;
CommonVar.MoveToNode(agv, SettingString.Standby);
Context.MoveToNode(agv, SettingString.Standby);
UpdateJobTaskInfo(agv);
}
......@@ -190,7 +190,7 @@ namespace DeviceLibrary
}
else if (curJobStep.IsStep(EXECUTE_STEP.P6_WAIT_REACH_STANDBY))
{
if (CommonVar.CheckTaskMoveFinished(agv, SettingString.Standby, CurTaskState))
if (Context.CheckTaskMoveFinished(agv, SettingString.Standby, CurTaskState))
{
runInfo = "到达待机位并搜索任务";
msg += runInfo;
......
......@@ -38,7 +38,7 @@ namespace DeviceLibrary
CurTaskID = agv.CurTaskID;
CurTaskName = agv.CurTaskName;
//CurTaskState = SettingString.Wait;
CurTaskState = CommonVar.GetTakJobState(agv);
CurTaskState = Context.GetTakJobState(agv);
}
/// <summary>
/// 任务重发
......@@ -60,7 +60,7 @@ namespace DeviceLibrary
}
}
else if (!CurTaskName.Equals("") && !CommonVar.agvMission[CurTaskName].Equals(agv.CurTaskGUID))//Job的当前任务与agv最新任务不一致
else if (!CurTaskName.Equals("") && !Context.agvMission[CurTaskName].Equals(agv.CurTaskGUID))//Job的当前任务与agv最新任务不一致
{
rtn = agv.AssignTask(CurTaskName);
if (rtn)
......
......@@ -61,16 +61,16 @@ namespace DeviceLibrary
{
get
{
int t1 = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(agvPlace));
int t1 = Context.nodeInfo.FindIndex(s => s.Name.Equals(agvPlace));
string from = "";
if (t1 > -1)
from = CommonVar.nodeInfo[t1].AliceName;
from = Context.nodeInfo[t1].AliceName;
else
from = agvPlace;
int t2 = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(TargetPlace));
int t2 = Context.nodeInfo.FindIndex(s => s.Name.Equals(TargetPlace));
string to = "";
if (t2 > -1)
to = CommonVar.nodeInfo[t2].AliceName;
to = Context.nodeInfo[t2].AliceName;
else
to = TargetPlace;
return string.Format("回收空料架任务:{0} [ShelfType={1}][任务名称={2}][任务状态={3}]", runInfo, shelfType.ToString(),CurTaskName,CurTaskState);
......@@ -89,7 +89,7 @@ namespace DeviceLibrary
bool rtn = false;
agv.Msg = runInfo;
CurTaskState = CommonVar.GetTakJobState(agv);
CurTaskState = Context.GetTakJobState(agv);
if (curJobStep.IsStep(EXECUTE_STEP.R1_NONE))
{
if(hasLoad)
......@@ -100,7 +100,7 @@ namespace DeviceLibrary
runInfo = "车上已有空料架,向" + RecycleStation + "运行";
msg += runInfo;
curJobStep.Msg = msg;
CommonVar.MoveToNode(agv, RecycleStation);
Context.MoveToNode(agv, RecycleStation);
UpdateJobTaskInfo(agv);
}
else
......@@ -110,7 +110,7 @@ namespace DeviceLibrary
msg += runInfo;
curJobStep.Msg = msg;
CommonVar.MoveToNode(agv, SettingString.Standby);
Context.MoveToNode(agv, SettingString.Standby);
UpdateJobTaskInfo(agv);
}
}
......@@ -122,7 +122,7 @@ namespace DeviceLibrary
runInfo = "待机位/充电位收到任务,开始执行";
msg += runInfo;
curJobStep.Msg = msg;
CommonVar.MoveToNode(agv, TargetPlace);
Context.MoveToNode(agv, TargetPlace);
UpdateJobTaskInfo(agv);
}
else
......@@ -132,20 +132,20 @@ namespace DeviceLibrary
msg += runInfo;
curJobStep.Msg = msg;
CommonVar.MoveToNode(agv, TargetPlace);
Context.MoveToNode(agv, TargetPlace);
UpdateJobTaskInfo(agv);
}
}
}
else if (curJobStep.IsStep(EXECUTE_STEP.R2_WAIT_REACH_EMPTY_SHELF_PLACE))
{
if (CommonVar.CheckTaskMoveFinished(agv, TargetPlace, CurTaskState))
if (Context.CheckTaskMoveFinished(agv, TargetPlace, CurTaskState))
{
curJobStep.ToNextStep(EXECUTE_STEP.R3_WAIT_LINE_RESPONSE);
runInfo = "到达空料架处"+TargetPlace+",向线体发送出料请求";
msg += runInfo;
curJobStep.Msg = msg;
CommonVar.server.Ready(TargetPlace, "");
Context.server.Ready(TargetPlace, "");
}
}
else if (curJobStep.IsStep(EXECUTE_STEP.R3_WAIT_LINE_RESPONSE))
......@@ -169,16 +169,16 @@ namespace DeviceLibrary
}
else if (curJobStep.IsStep(EXECUTE_STEP.R4_WAIT_SHELF_IN_AGV))
{
if (CommonVar.CheckEnterOrLeaveFinished(agv, SettingString.Enter, CurTaskState))
if (Context.CheckEnterOrLeaveFinished(agv, SettingString.Enter, CurTaskState))
{
CommonVar.server.CloseDoor(TargetPlace);
Context.server.CloseDoor(TargetPlace);
if (FindRecycleStation(agv))
{
curJobStep.ToNextStep(EXECUTE_STEP.R5_WAIT_REACH_RECYCLE_STATION);
runInfo = "空料架进入小车完成,向"+TargetPlace+"运行";
msg += runInfo;
curJobStep.Msg = msg;
CommonVar.MoveToNode(agv, RecycleStation);
Context.MoveToNode(agv, RecycleStation);
UpdateJobTaskInfo(agv);
}
else
......@@ -188,20 +188,20 @@ namespace DeviceLibrary
msg += runInfo;
curJobStep.Msg = msg;
CommonVar.MoveToNode(agv, SettingString.Standby);
Context.MoveToNode(agv, SettingString.Standby);
UpdateJobTaskInfo(agv);
}
}
}
else if (curJobStep.IsStep(EXECUTE_STEP.R5_WAIT_REACH_RECYCLE_STATION))
{
if (CommonVar.CheckTaskMoveFinished(agv, RecycleStation, CurTaskState))
if (Context.CheckTaskMoveFinished(agv, RecycleStation, CurTaskState))
{
curJobStep.ToNextStep(EXECUTE_STEP.R6_WAIT_RECYCLE_STATION_RESPONSE);
runInfo = "到达"+TargetPlace+",发送入料请求";
msg += runInfo;
curJobStep.Msg = msg;
CommonVar.server.Ready(RecycleStation,"00");
Context.server.Ready(RecycleStation,"00");
}
}
else if (curJobStep.IsStep(EXECUTE_STEP.R6_WAIT_RECYCLE_STATION_RESPONSE))
......@@ -225,9 +225,9 @@ namespace DeviceLibrary
}
else if (curJobStep.IsStep(EXECUTE_STEP.R7_WAIT_SHELF_IN_LINE))
{
if (CommonVar.CheckEnterOrLeaveFinished(agv, SettingString.Leave, CurTaskState))
if (Context.CheckEnterOrLeaveFinished(agv, SettingString.Leave, CurTaskState))
{
CommonVar.server.CloseDoor(RecycleStation);
Context.server.CloseDoor(RecycleStation);
//int i = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(RecycleStation) && s.StateEquals(eNodeStatus.FinishEnter));
//if (i > -1)
{
......@@ -240,7 +240,7 @@ namespace DeviceLibrary
}
else if (curJobStep.IsStep(EXECUTE_STEP.R8_WAIT_REACH_STANDY))
{
if (CommonVar.CheckTaskMoveFinished(agv, SettingString.Standby, CurTaskState))
if (Context.CheckTaskMoveFinished(agv, SettingString.Standby, CurTaskState))
{
if (FindRecycleStation(agv))
{
......@@ -248,7 +248,7 @@ namespace DeviceLibrary
runInfo = "检测到"+RecycleStation+"需要空料架,向" + RecycleStation + "运行";
msg += runInfo;
curJobStep.Msg = msg;
CommonVar.MoveToNode(agv, RecycleStation);
Context.MoveToNode(agv, RecycleStation);
UpdateJobTaskInfo(agv);
}
}
......
......@@ -3,12 +3,12 @@
namespace DeviceLibrary
{
/// <summary>
/// 包装仓任务:将包装料架送往包装仓
/// 将满料架送往线体
/// </summary>
public class SendFullShelfJob : Job
{
/// <summary>
/// 将包装料架送往包装仓
/// 将满料架送往线体
/// </summary>
/// <param name="agvPlae">agv当前位置</param>
/// <param name="tarPlace">目的地</param>
......@@ -40,16 +40,16 @@ namespace DeviceLibrary
{
get
{
int t1 = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(agvPlace));
int t1 = Context.nodeInfo.FindIndex(s => s.Name.Equals(agvPlace));
string from = "";
if (t1 > -1)
from = CommonVar.nodeInfo[t1].AliceName;
from = Context.nodeInfo[t1].AliceName;
else
from = agvPlace;
int t2 = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(TargetPlace));
int t2 = Context.nodeInfo.FindIndex(s => s.Name.Equals(TargetPlace));
string to = "";
if (t2 > -1)
to = CommonVar.nodeInfo[t2].AliceName;
to = Context.nodeInfo[t2].AliceName;
else
to = TargetPlace;
return string.Format("送满料架任务:{0} [RFID={1}][目的地={2}][任务名称={3}][任务状态={4}]", runInfo, RFID ,to,CurTaskName,CurTaskState);
......@@ -68,7 +68,7 @@ namespace DeviceLibrary
bool rtn = false;
agv.Msg = runInfo;
CurTaskState = CommonVar.GetTakJobState(agv);
CurTaskState = Context.GetTakJobState(agv);
if (curJobStep.IsStep(EXECUTE_STEP.P1_NONE))
{
......@@ -76,13 +76,13 @@ namespace DeviceLibrary
runInfo = "收到任务,向线体" + TargetPlace + "运行";
msg += runInfo;
curJobStep.Msg = msg;
CommonVar.MoveToNode(agv, TargetPlace);
Context.MoveToNode(agv, TargetPlace);
UpdateJobTaskInfo(agv);
}
else if (curJobStep.IsStep(EXECUTE_STEP.P2_WAIT_REACH_LINE))
{
if (CommonVar.CheckTaskMoveFinished(agv, TargetPlace, CurTaskState))
if (Context.CheckTaskMoveFinished(agv, TargetPlace, CurTaskState))
{
curJobStep.ToNextStep(EXECUTE_STEP.P3_WAIT_MANNUAL_OPERATION);
runInfo = "到达线体" + TargetPlace + ",等待卸料";
......@@ -99,6 +99,7 @@ namespace DeviceLibrary
runInfo = "料架上的料在" + TargetPlace + "卸料完成.";
msg += runInfo;
curJobStep.Msg = msg;
RequestManager.AgvRemoveRfid(RFID);
return new RecycleEmptyShelf(TargetPlace,"",true);
}
}
......
......@@ -38,16 +38,16 @@ namespace DeviceLibrary
{
get
{
int t1 = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(agvPlace));
int t1 = Context.nodeInfo.FindIndex(s => s.Name.Equals(agvPlace));
string from = "";
if (t1 > -1)
from = CommonVar.nodeInfo[t1].AliceName;
from = Context.nodeInfo[t1].AliceName;
else
from = agvPlace;
int t2 = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(TargetPlace));
int t2 = Context.nodeInfo.FindIndex(s => s.Name.Equals(TargetPlace));
string to = "";
if (t2 > -1)
to = CommonVar.nodeInfo[t2].AliceName;
to = Context.nodeInfo[t2].AliceName;
else
to = TargetPlace;
return string.Format("送料串任务[RFID={4}]:{0} [目的地={1}][任务名称={2}][任务状态={3}]", runInfo, to, CurTaskName, CurTaskState, RFID);
......@@ -58,16 +58,16 @@ namespace DeviceLibrary
private string GetShowInfo()
{
int t1 = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(agvPlace));
int t1 = Context.nodeInfo.FindIndex(s => s.Name.Equals(agvPlace));
string from = "";
if (t1 > -1)
from = CommonVar.nodeInfo[t1].AliceName;
from = Context.nodeInfo[t1].AliceName;
else
from = agvPlace;
int t2 = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(TargetPlace));
int t2 = Context.nodeInfo.FindIndex(s => s.Name.Equals(TargetPlace));
string to = "";
if (t2 > -1)
to = CommonVar.nodeInfo[t2].AliceName;
to = Context.nodeInfo[t2].AliceName;
else
to = TargetPlace;
return string.Format("送料串任务: {0} [{1}->{2}]", runInfo, from, to);
......@@ -82,30 +82,30 @@ namespace DeviceLibrary
bool rtn = false;
agv.Msg = GetShowInfo();
agv.RFID = RFID;
CurTaskState = CommonVar.GetTakJobState(agv);
CurTaskState = Context.GetTakJobState(agv);
if (curJobStep.IsStep(EXECUTE_STEP.P1_NONE))
{
curJobStep.ToNextStep(EXECUTE_STEP.P2_WAIT_REACH_STATION);
runInfo = "收到任务,向" + TargetPlace + "运行";
msg += runInfo;
curJobStep.Msg = msg;
CommonVar.MoveToNode(agv, TargetPlace);
Context.MoveToNode(agv, TargetPlace);
UpdateJobTaskInfo(agv);
}
else if (curJobStep.IsStep(EXECUTE_STEP.P2_WAIT_REACH_STATION))
{
if (CommonVar.CheckTaskMoveFinished(agv, TargetPlace, CurTaskState))
if (Context.CheckTaskMoveFinished(agv, TargetPlace, CurTaskState))
{
curJobStep.ToNextStep(EXECUTE_STEP.P3_WAIT_STATION_RESPONSE);
runInfo = "到达" + TargetPlace + ",并发送进料请求";
msg += runInfo;
curJobStep.Msg = msg;
CommonVar.server.Ready(TargetPlace, RFID);
Context.server.Ready(TargetPlace, RFID);
}
}
else if (curJobStep.IsStep(EXECUTE_STEP.P3_WAIT_STATION_RESPONSE))
{
int i = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(TargetPlace));//&& s.StateEquals(eNodeStatus.MayEnter)
int i = Context.nodeInfo.FindIndex(s => s.Name.Equals(TargetPlace));//&& s.StateEquals(eNodeStatus.MayEnter)
if (i > -1)
{
curJobStep.ToNextStep(EXECUTE_STEP.P4_WAIT_SHELF_IN_STATION);
......@@ -125,9 +125,9 @@ namespace DeviceLibrary
}
else if (curJobStep.IsStep(EXECUTE_STEP.P4_WAIT_SHELF_IN_STATION))
{
if (CommonVar.CheckEnterOrLeaveFinished(agv, SettingString.Leave, CurTaskState))
if (Context.CheckEnterOrLeaveFinished(agv, SettingString.Leave, CurTaskState))
{
CommonVar.server.CloseDoor(TargetPlace);
Context.server.CloseDoor(TargetPlace);
curJobStep.ToNextStep(EXECUTE_STEP.P5_END);
runInfo = "料架进入" + TargetPlace + "完成";
msg += runInfo;
......
......@@ -43,7 +43,7 @@ namespace DeviceLibrary
bool rtn = false;
agv.Msg = RunInfo;
CurTaskState = CommonVar.GetTakJobState(agv);
CurTaskState = Context.GetTakJobState(agv);
if (curJobStep.IsStep(EXECUTE_STEP.NONE))
{
if (agvPlace.Equals(SettingString.Standby))//在待机位不操作
......@@ -61,14 +61,14 @@ namespace DeviceLibrary
msg += runInfo;
curJobStep.Msg = msg;
CommonVar.MoveToNode(agv, SettingString.Standby);
Context.MoveToNode(agv, SettingString.Standby);
UpdateJobTaskInfo(agv);
}
}
else if (curJobStep.IsStep(EXECUTE_STEP.WAIT_REACH_STANDBY))
{
if (CommonVar.CheckTaskMoveFinished(agv, SettingString.Standby, CurTaskState))
if (Context.CheckTaskMoveFinished(agv, SettingString.Standby, CurTaskState))
{
curJobStep.ToNextStep(EXECUTE_STEP.END);
runInfo = "到达待机位";
......@@ -78,7 +78,7 @@ namespace DeviceLibrary
}
else if (curJobStep.IsStep(EXECUTE_STEP.END))
{
Job job = CommonVar.control.GetJob(agv);
Job job = Context.control.GetJob(agv);
if (job != null && !(job is StandyJob))
{
runInfo = "在待机位检测到任务,执行任务";
......
......@@ -17,9 +17,9 @@ namespace DeviceLibrary
/// <returns></returns>
public override Job GetNewJob(Agv_Info currentAgv)
{
if (!CommonVar.CheckCanExecuteMission(currentAgv))
if (!Context.CheckCanExecuteMission(currentAgv))
return null;
if (!CommonVar.CheckAGVStatusNone(currentAgv))
if (!Context.CheckAGVStatusNone(currentAgv))
return null;
string rfid = "";
//检查设备1入口需要空料串用作出库
......
......@@ -16,9 +16,9 @@ namespace DeviceLibrary
public override Job GetNewJob(Agv_Info agv)
{
if (!CommonVar.CheckCanExecuteMission(agv))
if (!Context.CheckCanExecuteMission(agv))
return null;
if (!CommonVar.CheckAGVStatusNone(agv))
if (!Context.CheckAGVStatusNone(agv))
return null;
string rfid = "";
string checkPlace = SettingString.D2;
......@@ -63,9 +63,15 @@ namespace DeviceLibrary
return null;
}
public static bool CheckFullTask(string rfid = "")
public static bool CheckFullTask(string rfid,out string targetName)
{
return true;
targetName = "";
if (RequestManager.FindFullShelfTarget(rfid, out BoxDestInfo destInfo))
{
targetName = destInfo.data;
return true;
}
return false;
}
}
......
......@@ -14,7 +14,7 @@ namespace DeviceLibrary
/// <returns></returns>
public override Job GetNewJob(Agv_Info currentAgv)
{
if (currentAgv.Battery < CommonVar.Charge.BatteryMax - 10 && CommonVar.Charge.HasEmptyChargeStation(currentAgv))
if (currentAgv.Battery < Context.Charge.BatteryMax - 10 && Context.Charge.HasEmptyChargeStation(currentAgv))
{
currentAgv.RFID = "";
return new ChargeJob(currentAgv.Place);
......
......@@ -28,23 +28,23 @@ namespace DeviceLibrary
public static bool FindNeedLeave(Agv_Info agv, string nodeName, out string rfid, bool empty)
{
rfid = "";
int nodeIdx = CommonVar.FindNode(nodeName);
int nodeIdx = Context.FindNode(nodeName);
if (nodeIdx > -1)
{
if (!empty)
nodeIdx = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(nodeName) && s.Action.Equals(Agv.ClientAction.NeedLeave) && s.Shelf.Equals(Agv.ClientShelf.Full));
nodeIdx = Context.nodeInfo.FindIndex(s => s.Name.Equals(nodeName) && s.Action.Equals(Agv.ClientAction.NeedLeave) && s.Shelf.Equals(Agv.ClientShelf.Full));
else
nodeIdx = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(nodeName) && s.Action.Equals(Agv.ClientAction.NeedLeave));
nodeIdx = Context.nodeInfo.FindIndex(s => s.Name.Equals(nodeName) && s.Action.Equals(Agv.ClientAction.NeedLeave));
if (nodeIdx > -1)
{
if (CommonVar.nodeInfo[nodeIdx].RFID.StartsWith(SettingString.ReelString_RFID_Prefix))
if (Context.nodeInfo[nodeIdx].RFID.StartsWith(SettingString.ReelString_RFID_Prefix))
{
rfid = CommonVar.nodeInfo[nodeIdx].RFID;
rfid = Context.nodeInfo[nodeIdx].RFID;
return true;
}
else
{
agv.AddDisplayBoard(nodeName, "Using." + nodeName, "出口为出料任务,但是RFID状态异常:rfid="+ CommonVar.nodeInfo[nodeIdx].RFID);
agv.AddDisplayBoard(nodeName, "Using." + nodeName, "出口为出料任务,但是RFID状态异常:rfid="+ Context.nodeInfo[nodeIdx].RFID);
}
}
}
......@@ -63,14 +63,14 @@ namespace DeviceLibrary
/// <returns></returns>
static bool FindNeedEnter(Agv_Info agv, string nodeName, bool empty)
{
int nodeIdx = CommonVar.FindNode(nodeName);
int nodeIdx = Context.FindNode(nodeName);
if (nodeIdx > -1)
{
if (empty)
nodeIdx = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(nodeName) && s.Action.Equals(Agv.ClientAction.NeedEnter) &&
nodeIdx = Context.nodeInfo.FindIndex(s => s.Name.Equals(nodeName) && s.Action.Equals(Agv.ClientAction.NeedEnter) &&
(s.Shelf.Equals(Agv.ClientShelf.Empty) || s.Shelf.Equals(Agv.ClientShelf.None)));
else
nodeIdx = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(nodeName) && s.Action.Equals(Agv.ClientAction.NeedEnter) &&
nodeIdx = Context.nodeInfo.FindIndex(s => s.Name.Equals(nodeName) && s.Action.Equals(Agv.ClientAction.NeedEnter) &&
s.Shelf.Equals(Agv.ClientShelf.Full));
if (nodeIdx > -1)
return true;
......@@ -94,7 +94,7 @@ namespace DeviceLibrary
if (FindNeedEnter(agv, nodeName, empty))
{
int idx = CommonVar.agvInfo.FindIndex(s => !s.IP.Equals(agv.IP) && s.CurJob != null &&
int idx = Context.agvInfo.FindIndex(s => !s.IP.Equals(agv.IP) && s.CurJob != null &&
(
s.CurJob is SendShelfJob && (((SendShelfJob)s.CurJob).TargetPlace.Equals(nodeName)) ||
s.CurJob is RecycleEmptyShelf && (((RecycleEmptyShelf)s.CurJob).TargetPlace.Equals(nodeName))
......@@ -122,7 +122,7 @@ namespace DeviceLibrary
if (FindNeedLeave(agv, nodeName, out string rfid,empty))
{
int idx = CommonVar.agvInfo.FindIndex(s => !s.IP.Equals(agv.IP) && s.CurJob != null &&
int idx = Context.agvInfo.FindIndex(s => !s.IP.Equals(agv.IP) && s.CurJob != null &&
(
(s.CurJob is GetShelfJob && (((GetShelfJob)s.CurJob).TargetPlace.Equals(nodeName)))||
(s.CurJob is GetFullShelfJob && (((GetFullShelfJob)s.CurJob).TargetPlace.Equals(nodeName)))
......
using Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
/// <summary>
/// 请求管理
/// </summary>
public class RequestManager
{
private static log4net.ILog log = log4net.LogManager.GetLogger("RequestManager");
private static string Addr_FindFullShelfTarget = "/rest/api/dcs/device/shelfDestination"; //AGV获取料串目的地(线别)
/// <summary>
/// 查找满料架目的地
/// </summary>
/// <param name="rfid"></param>
/// <param name="dest"></param>
/// <returns></returns>
public static bool FindFullShelfTarget(string rfid, out BoxDestInfo destInfo)
{
destInfo = null;
try
{
if (rfid.Equals("") || rfid.Equals("00"))
return false;
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("rfid", rfid);
string server = GetAddr(Addr_FindFullShelfTarget, paramMap);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Post(server, "");
destInfo = JsonHelper.DeserializeJsonToObject<BoxDestInfo>(resultStr);
if (destInfo == null)
{
log.Error("查找目的地【" + server + "】【" + resultStr + "】");
return false;
}
else if (destInfo.code.Equals(0).Equals(true))
{
if (destInfo.data.ToLower().Equals("none"))
return false;
else
return true;
}
return false;
}
catch (Exception ex)
{
log.Error("FindFullShelfTarget", ex);
return false;
}
}
private static string Addr_agvRemoveRfid = "/rest/api/dcs/device/agvRemoveRfid";
/// <summary>
/// 根据RFID清理料架的缓存信息
/// </summary>
/// <param name="rfid"></param>
/// <returns></returns>
public static bool AgvRemoveRfid(string rfid)
{
try
{
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("rfid", rfid.ToUpper());
string server = GetAddr(Addr_agvRemoveRfid, paramMap);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Get(server);
log.Debug("清理料架的缓存信息【" + server + "】【" + resultStr + "】");
RfidData rfidData = JsonHelper.DeserializeJsonToObject<RfidData>(resultStr);
if (rfidData == null)
{
log.Error("清理料架的缓存信息【" + server + "】【" + resultStr + "】");
return false;
}
else
{
if (rfidData.code.Equals(0))
{
log.Info("清理料架的缓存信息【" + server + "】【" + resultStr + "】");
return true;
}
}
}
catch (Exception ex)
{
log.Error(ex);
return false;
}
return false;
}
private static string Addr_updateDeviceAlarmMsg = "/rest/api/dcs/device/updateDeviceAlarmMsg";
/// <summary>
/// 异常看板
/// </summary>
/// <param name="msgList"></param>
/// <returns></returns>
public static string updateDeviceAlarmMsg(List<AlarmMsg> msgList)
{
string msg = "";
try
{
Dictionary<string, string> paramMap = new Dictionary<string, string>();
string msgListStr = JsonHelper.SerializeObject(msgList);
paramMap.Add("deviceAlarmList", msgListStr);
string server = GetAddr(Addr_updateDeviceAlarmMsg, paramMap);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Post(server, "");
msgList.ForEach(new Action<AlarmMsg>(k => log.Debug("deviceAlarmList " + k.ToString()))); ;
RfidData data = JsonHelper.DeserializeJsonToObject<RfidData>(resultStr);
if (data == null)
{
return msg = " updateDeviceAlarmMsg 没有收到服务器反馈";
}
else if (data.code.Equals(0).Equals(false))
{
return msg = " updateDeviceAlarmMsg 【" + server + "】【" + resultStr + "】" + data.msg;
}
return "";
}
catch (Exception ex)
{
log.Error(ex);
}
return msg;
}
private static string GetAddr(string addr, Dictionary<string, string> paramsMap)
{
string server = AppConfigHelper.GetValue(SettingString.http_server);
if (server.EndsWith("/"))
{
server = server.Substring(0, server.Length - 1);
}
string path = server + addr.Trim() + "?";
foreach (string paramName in paramsMap.Keys)
{
string par = System.Web.HttpUtility.UrlEncode(paramsMap[paramName], System.Text.Encoding.UTF8);
path += paramName + "=" + par + "&";
}
path = path.Substring(0, path.Length - 1);
return path;
}
}
public class BoxDestInfo
{
public int code { get; set; }
public string msg { get; set; }
public string data { get; set; }
public override string ToString()
{
return string.Format("code:{0}, msg:{1}, data:{2}",code,msg,data);
}
}
public class AlarmMsg
{
//>>>name : 异常位置名称
public string name = "";
//>>>msgKey : 异常信息唯一标识
public string msgKey = "";
//>>>msgValue : 异常信息
public string msgValue = "";
public int type;
/// <summary>
/// 异常信息
/// </summary>
/// <param name="name">异常位置名称</param>
/// <param name="key">异常信息唯一标识</param>
/// <param name="value">异常信息</param>
public AlarmMsg(string name, string key, string value, int type = 0)
{
this.name = name;
this.msgKey = key;
this.msgValue = value;
this.type = type;
}
public override string ToString()
{
return string.Format("[name:{0},msgKey:{1},msgValue:{2},type:{3}]", name, msgKey, msgValue, type);
}
}
public class RfidData
{
//{"code":0,"msg":"ok","data":"7"}
public int code { get; set; }
public string msg { get; set; }
public Dictionary<string, string> data { get; set; }
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!