Commit fac119ae 张东亮

V1

1 个父辈 2f437d22
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<!--ITS智能物流系统服务端口--> <!--ITS智能物流系统服务端口-->
<add key="ITS_UpdateLine" value="http://127.0.0.1:8888" /> <add key="ITS_UpdateLine" value="http://127.0.0.1:8888" />
<!--电梯控制系统系统服务端口--> <!--电梯控制系统系统服务端口-->
<add key="Lift_GetState" value="http://127.0.0.1:8888/lift/status" /> <add key="Lift_Server" value="http://127.0.0.1:8888/lift/" />
<!--日志配置文件名--> <!--日志配置文件名-->
<add key="log4net_configname" value="log4net.config" /> <add key="log4net_configname" value="log4net.config" />
<!--agv配置文件名--> <!--agv配置文件名-->
......
...@@ -31,6 +31,9 @@ ...@@ -31,6 +31,9 @@
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain));
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.tabPage1 = new System.Windows.Forms.TabPage(); this.tabPage1 = new System.Windows.Forms.TabPage();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.DgvNode = new System.Windows.Forms.DataGridView(); this.DgvNode = new System.Windows.Forms.DataGridView();
...@@ -40,11 +43,7 @@ ...@@ -40,11 +43,7 @@
this.grpUnlock = new System.Windows.Forms.GroupBox(); this.grpUnlock = new System.Windows.Forms.GroupBox();
this.tblLayoutUnlock = new System.Windows.Forms.TableLayoutPanel(); this.tblLayoutUnlock = new System.Windows.Forms.TableLayoutPanel();
this.dgvInfos = new System.Windows.Forms.DataGridView(); this.dgvInfos = new System.Windows.Forms.DataGridView();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.tabPage3 = new System.Windows.Forms.TabPage(); this.tabPage3 = new System.Windows.Forms.TabPage();
this.button1 = new System.Windows.Forms.Button();
this.label12 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox();
this.tabControlManual = new System.Windows.Forms.TabControl(); this.tabControlManual = new System.Windows.Forms.TabControl();
...@@ -52,6 +51,8 @@ ...@@ -52,6 +51,8 @@
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.tableLayoutPanel3.SuspendLayout(); this.tableLayoutPanel3.SuspendLayout();
this.tabControl1.SuspendLayout(); this.tabControl1.SuspendLayout();
this.tabPage2.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.tabPage1.SuspendLayout(); this.tabPage1.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.DgvNode)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.DgvNode)).BeginInit();
...@@ -61,8 +62,6 @@ ...@@ -61,8 +62,6 @@
this.grpUnlock.SuspendLayout(); this.grpUnlock.SuspendLayout();
this.tblLayoutUnlock.SuspendLayout(); this.tblLayoutUnlock.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvInfos)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvInfos)).BeginInit();
this.tabPage2.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.tabPage3.SuspendLayout(); this.tabPage3.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
this.tableLayoutPanel4.SuspendLayout(); this.tableLayoutPanel4.SuspendLayout();
...@@ -99,6 +98,41 @@ ...@@ -99,6 +98,41 @@
this.tabControl1.TabIndex = 7; this.tabControl1.TabIndex = 7;
this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged); this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged);
// //
// tabPage2
//
this.tabPage2.Controls.Add(this.tableLayoutPanel1);
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(1201, 347);
this.tabPage2.TabIndex = 3;
this.tabPage2.Text = "日志";
this.tabPage2.UseVisualStyleBackColor = true;
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 1;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.Controls.Add(this.richTextBox1, 0, 0);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 3);
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(2);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 1;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(1195, 341);
this.tableLayoutPanel1.TabIndex = 6;
//
// richTextBox1
//
this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.richTextBox1.Location = new System.Drawing.Point(3, 3);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(1189, 335);
this.richTextBox1.TabIndex = 7;
this.richTextBox1.Text = "";
//
// tabPage1 // tabPage1
// //
this.tabPage1.Controls.Add(this.tableLayoutPanel2); this.tabPage1.Controls.Add(this.tableLayoutPanel2);
...@@ -226,44 +260,8 @@ ...@@ -226,44 +260,8 @@
this.dgvInfos.Size = new System.Drawing.Size(1179, 292); this.dgvInfos.Size = new System.Drawing.Size(1179, 292);
this.dgvInfos.TabIndex = 0; this.dgvInfos.TabIndex = 0;
// //
// tabPage2
//
this.tabPage2.Controls.Add(this.tableLayoutPanel1);
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(1201, 347);
this.tabPage2.TabIndex = 3;
this.tabPage2.Text = "日志";
this.tabPage2.UseVisualStyleBackColor = true;
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 1;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.Controls.Add(this.richTextBox1, 0, 0);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 3);
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(2);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 1;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(1195, 341);
this.tableLayoutPanel1.TabIndex = 6;
//
// richTextBox1
//
this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.richTextBox1.Location = new System.Drawing.Point(3, 3);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(1189, 335);
this.richTextBox1.TabIndex = 7;
this.richTextBox1.Text = "";
//
// tabPage3 // tabPage3
// //
this.tabPage3.Controls.Add(this.button1);
this.tabPage3.Controls.Add(this.label12); this.tabPage3.Controls.Add(this.label12);
this.tabPage3.Controls.Add(this.groupBox2); this.tabPage3.Controls.Add(this.groupBox2);
this.tabPage3.Location = new System.Drawing.Point(4, 22); this.tabPage3.Location = new System.Drawing.Point(4, 22);
...@@ -274,16 +272,6 @@ ...@@ -274,16 +272,6 @@
this.tabPage3.Text = "手动"; this.tabPage3.Text = "手动";
this.tabPage3.UseVisualStyleBackColor = true; this.tabPage3.UseVisualStyleBackColor = true;
// //
// button1
//
this.button1.Location = new System.Drawing.Point(300, 71);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 47;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label12 // label12
// //
this.label12.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(224)))), ((int)(((byte)(192))))); this.label12.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(224)))), ((int)(((byte)(192)))));
...@@ -355,6 +343,8 @@ ...@@ -355,6 +343,8 @@
this.Load += new System.EventHandler(this.FrmMain_Load); this.Load += new System.EventHandler(this.FrmMain_Load);
this.tableLayoutPanel3.ResumeLayout(false); this.tableLayoutPanel3.ResumeLayout(false);
this.tabControl1.ResumeLayout(false); this.tabControl1.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
this.tableLayoutPanel1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false); this.tabPage1.ResumeLayout(false);
this.tableLayoutPanel2.ResumeLayout(false); this.tableLayoutPanel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.DgvNode)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.DgvNode)).EndInit();
...@@ -365,8 +355,6 @@ ...@@ -365,8 +355,6 @@
this.grpUnlock.PerformLayout(); this.grpUnlock.PerformLayout();
this.tblLayoutUnlock.ResumeLayout(false); this.tblLayoutUnlock.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgvInfos)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvInfos)).EndInit();
this.tabPage2.ResumeLayout(false);
this.tableLayoutPanel1.ResumeLayout(false);
this.tabPage3.ResumeLayout(false); this.tabPage3.ResumeLayout(false);
this.groupBox2.ResumeLayout(false); this.groupBox2.ResumeLayout(false);
this.tableLayoutPanel4.ResumeLayout(false); this.tableLayoutPanel4.ResumeLayout(false);
...@@ -389,7 +377,6 @@ ...@@ -389,7 +377,6 @@
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.TabControl tabControlManual; private System.Windows.Forms.TabControl tabControlManual;
private System.Windows.Forms.DataGridView DgvNode; private System.Windows.Forms.DataGridView DgvNode;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TabPage tabPage4; private System.Windows.Forms.TabPage tabPage4;
private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel5; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel5;
......
...@@ -27,7 +27,7 @@ namespace AGVControl ...@@ -27,7 +27,7 @@ namespace AGVControl
private void Manual_Load(object sender, EventArgs e) private void Manual_Load(object sender, EventArgs e)
{ {
lblInfo.Text = string.Format("[{0}]", Agv.IP); lblInfo.Text = string.Format("[{0}]", Agv.IP);
AgvTaskManager.InitView(cmbBxMission); AgvTaskManager.InitView(cmbBxMission,Agv);
InState.AddRange(new PictureBox[] { pictureBox1, pictureBox2, pictureBox3, pictureBox4 }); InState.AddRange(new PictureBox[] { pictureBox1, pictureBox2, pictureBox3, pictureBox4 });
OutState.AddRange(new PictureBox[] { pictureBox5, pictureBox6, pictureBox7, pictureBox8 }); OutState.AddRange(new PictureBox[] { pictureBox5, pictureBox6, pictureBox7, pictureBox8 });
timer1.Enabled = true; timer1.Enabled = true;
...@@ -57,11 +57,11 @@ namespace AGVControl ...@@ -57,11 +57,11 @@ namespace AGVControl
} }
} }
} }
if(Agv.IOStatus[2]!=null && Agv.IOStatus[2].Inputs!=null) if(Agv.IOStatus[0]!=null && Agv.IOStatus[0].Inputs!=null)
{ {
for (int i = 0; i < Agv.IOStatus[2].Inputs.Length; i++) for (int i = 0; i < Agv.IOStatus[0].Inputs.Length; i++)
{ {
if (Agv.GetInput(2, i)) if (Agv.GetOutput(0, i))
{ {
OutState[i].Image = AGVDispatch.Properties.Resources.green1; OutState[i].Image = AGVDispatch.Properties.Resources.green1;
} }
...@@ -90,7 +90,17 @@ namespace AGVControl ...@@ -90,7 +90,17 @@ namespace AGVControl
ChargePileManager.StopCharge(Agv); ChargePileManager.StopCharge(Agv);
if (Agv.IsCon) if (Agv.IsCon)
{ {
LogUtil.info($"取消自动任务,当前任务信息是:{Agv.Msg}"); LogUtil.info($"取消自动任务,当前运行信息是:{Agv.Msg}");
try
{
if (Agv.CurJob != null && Agv.CurJob.JobParam != null && Agv.CurJob.JobParam.GetMissionInfo() != null)
{
DeviceLibrary.manager.MissionManager.SetMissionState(Agv.CurJob.JobParam.GetMissionInfo(), DeviceLibrary.service.model.MissionState.中止);
LogUtil.info($"取消自动任务,当前任务信息是:{Common.JsonHelper.SerializeObject(Agv.CurJob.JobParam.GetMissionInfo())}");
}
}
catch { }
Agv.CurJob = null; Agv.CurJob = null;
//MiR_API.Del_Mission(Agv); //MiR_API.Del_Mission(Agv);
//添加Init任务 //添加Init任务
...@@ -167,7 +177,7 @@ namespace AGVControl ...@@ -167,7 +177,7 @@ namespace AGVControl
{ {
if (Agv.IsCon) if (Agv.IsCon)
{ {
DeviceLibrary.AgvTask task = AgvTaskManager.GetTaskById((cmbBxMission.SelectedItem as DeviceLibrary.AgvTask).Id); DeviceLibrary.AgvTask task = AgvTaskManager.GetTaskByName((cmbBxMission.SelectedItem as DeviceLibrary.AgvTask).Name,Agv);
if (task.Type.Equals(TaskType.InOut)) if (task.Type.Equals(TaskType.InOut))
if (MessageBox.Show("确定对小车发送进/出任务?", Agv.Name, MessageBoxButtons.YesNo) == DialogResult.No) if (MessageBox.Show("确定对小车发送进/出任务?", Agv.Name, MessageBoxButtons.YesNo) == DialogResult.No)
return; return;
......
...@@ -39,8 +39,8 @@ ...@@ -39,8 +39,8 @@
<conversionPattern value="[%date][%t][%c:%L]%-5p %m%n"/> <conversionPattern value="[%date][%t][%c:%L]%-5p %m%n"/>
</layout> </layout>
</appender> </appender>
<appender name="FixtureServices" type="log4net.Appender.RollingFileAppender"> <appender name="WebService" type="log4net.Appender.RollingFileAppender">
<file value="logs/Service/Records.log"/> <file value="logs/WebService/Records.log"/>
<param name="Encoding" value="UTF-8"/> <param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/> <appendToFile value="true"/>
<param name="MaxSizeRollBackups" value="30"/> <param name="MaxSizeRollBackups" value="30"/>
...@@ -75,17 +75,32 @@ ...@@ -75,17 +75,32 @@
<conversionPattern value="%m%n"/> <conversionPattern value="%m%n"/>
</layout> </layout>
</appender> </appender>
<appender name="MissionManager" type="log4net.Appender.RollingFileAppender">
<file value="logs/MissionManager/MissionManager.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="%m%n"/>
</layout>
</appender>
<logger name="MissionManager">
<level value="info"/>
<appender-ref ref="MissionManager"/>
</logger>
<logger name="MiR_API"> <logger name="MiR_API">
<level value="MiR_API"/> <level value="info"/>
<appender-ref ref="MiR_API"/> <appender-ref ref="MiR_API"/>
</logger> </logger>
<logger name="RunLog"> <logger name="RunLog">
<level value="Info"/> <level value="Info"/>
<appender-ref ref="RunLog"/> <appender-ref ref="RunLog"/>
</logger> </logger>
<logger name="FixtureServices"> <logger name="WebService">
<level value="Info"/> <level value="Info"/>
<appender-ref ref="FixtureServices"/> <appender-ref ref="WebService"/>
</logger> </logger>
<logger name="AgvServer"> <logger name="AgvServer">
<level value="Info"/> <level value="Info"/>
......
...@@ -63,7 +63,7 @@ namespace Common ...@@ -63,7 +63,7 @@ namespace Common
public const string httpServer ="http.server"; public const string httpServer ="http.server";
public const string log4net_configname = "log4net_configname"; public const string log4net_configname = "log4net_configname";
public const string ITS_UpdateLine = "ITS_UpdateLine"; public const string ITS_UpdateLine = "ITS_UpdateLine";
public const string Lift_GetState = "Lift_GetState"; public const string Lift_Server = "Lift_Server";
public const string AppIdentity = "AppIdentity"; public const string AppIdentity = "AppIdentity";
public const string Lift_Names = "Lift_Names"; public const string Lift_Names = "Lift_Names";
#endregion #endregion
......
...@@ -24,7 +24,6 @@ namespace DeviceLibrary.manager ...@@ -24,7 +24,6 @@ namespace DeviceLibrary.manager
XmlReader xmlReader = XmlReader.Create(File_AgvInfo, xmlReaderSettings); XmlReader xmlReader = XmlReader.Create(File_AgvInfo, xmlReaderSettings);
doc.Load(xmlReader); doc.Load(xmlReader);
XmlNode xn = doc.SelectSingleNode("agvs"); XmlNode xn = doc.SelectSingleNode("agvs");
XmlNodeList xnl = xn.ChildNodes; XmlNodeList xnl = xn.ChildNodes;
foreach (XmlNode node in xnl) foreach (XmlNode node in xnl)
{ {
...@@ -66,9 +65,8 @@ namespace DeviceLibrary.manager ...@@ -66,9 +65,8 @@ namespace DeviceLibrary.manager
} }
xmlReader.Close(); xmlReader.Close();
isLoadAgv = true; isLoadAgv = true;
LogUtil.info($"加载Agv配置成功{File_AgvInfo}"); LogUtil.info($"加载Agv配置成功{File_AgvInfo}");
} }
public static void SetAgvIsUse(AgvInfo agv) public static void SetAgvIsUse(AgvInfo agv)
{ {
if (!isLoadAgv) return; if (!isLoadAgv) return;
...@@ -78,7 +76,7 @@ namespace DeviceLibrary.manager ...@@ -78,7 +76,7 @@ namespace DeviceLibrary.manager
string strPath = string.Format("/agvs/agv[@id=\"{0}\"]", agv.ID); string strPath = string.Format("/agvs/agv[@id=\"{0}\"]", agv.ID);
XmlElement selectXe = (XmlElement)xe.SelectSingleNode(strPath); //selectSingleNode 根据XPath表达式,获得符合条件的第一个节点. XmlElement selectXe = (XmlElement)xe.SelectSingleNode(strPath); //selectSingleNode 根据XPath表达式,获得符合条件的第一个节点.
//selectXe.SetAttribute("Type", dgvBookInfo.CurrentRow.Cells[0].Value.ToString());//也可以通过SetAttribute来增加一个属性 //selectXe.SetAttribute("Type", dgvBookInfo.CurrentRow.Cells[0].Value.ToString());//也可以通过SetAttribute来增加一个属性
selectXe.GetElementsByTagName("IsUse").Item(0).InnerText = agv.Auto.ToString(); selectXe.GetElementsByTagName("Auto").Item(0).InnerText = agv.Auto.ToString();
xmlDoc.Save(File_AgvInfo); xmlDoc.Save(File_AgvInfo);
} }
...@@ -138,26 +136,31 @@ namespace DeviceLibrary.manager ...@@ -138,26 +136,31 @@ namespace DeviceLibrary.manager
XmlReader xmlReader = XmlReader.Create(File_AgvTaskInfo, xmlReaderSettings); XmlReader xmlReader = XmlReader.Create(File_AgvTaskInfo, xmlReaderSettings);
doc.Load(xmlReader); doc.Load(xmlReader);
XmlNode xn = doc.SelectSingleNode("tasks"); XmlNode xn = doc.SelectSingleNode("tasks");
XmlNodeList xnl = xn.ChildNodes; XmlNodeList xnl = xn.ChildNodes;
foreach (XmlNode xnode in xnl) foreach (XmlNode xnode in xnl)
{ {
// nodeInfo.Add(new Node(id, name, ip, alicename, nodeType, area, isUse)); XmlNodeList xnls = xnode.ChildNodes;
AgvTask node = new AgvTask(); foreach (XmlNode item in xnls)
// 将节点转换为元素,便于得到节点的属性值 {
XmlElement xe = (XmlElement)xnode; AgvTask node = new AgvTask();
// 得到属性的属性值 // 将节点转换为元素,便于得到节点的属性值
node.Id = int.Parse(xe.GetAttribute("id")); XmlElement xe = (XmlElement)xnode;
// 得到节点的所有子节点 node.TypeId = xe.GetAttribute("id");
XmlNodeList xnl0 = xe.ChildNodes; // 得到属性的属性值
node.Name = xnl0.Item(0).InnerText; XmlElement itemxe = (XmlElement)item;
node.AliceName = xnl0.Item(1).InnerText; node.Id = int.Parse(itemxe.GetAttribute("id"));
node.Guid = xnl0.Item(2).InnerText; // 得到节点的所有子节点
node.Type = (TaskType)Enum.Parse(typeof(TaskType), xnl0.Item(3).InnerText); XmlNodeList xnl0 = itemxe.ChildNodes;
tasks.Add(node); node.Name = xnl0.Item(0).InnerText;
node.AliceName = xnl0.Item(1).InnerText;
node.Guid = xnl0.Item(2).InnerText;
node.Type = (TaskType)Enum.Parse(typeof(TaskType), xnl0.Item(3).InnerText);
tasks.Add(node);
}
} }
xmlReader.Close(); xmlReader.Close();
LogUtil.info($"加载任务配置成功{File_AgvTaskInfo}"); LogUtil.info($"加载任务配置成功{File_AgvTaskInfo}");
} }
public static void LoadChargePileInfos(bean.ChargePiles chargePiles) public static void LoadChargePileInfos(bean.ChargePiles chargePiles)
...@@ -197,7 +200,7 @@ namespace DeviceLibrary.manager ...@@ -197,7 +200,7 @@ namespace DeviceLibrary.manager
chargePiles.AddPile(node); chargePiles.AddPile(node);
} }
xmlReader.Close(); xmlReader.Close();
LogUtil.info($"加载充电桩配置成功{File_ChargePileInfo}"); LogUtil.info($"加载充电桩配置成功{File_ChargePileInfo}");
} }
} }
} }
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<agvs> <agvs>
<agv id="49" ip="10.85.199.81"> <agv id="20" ip="10.85.199.68">
<name>1号车</name> <name>2号车</name>
<!--职责范围--> <!--职责范围-->
<Scope> <Scope>
<Workshop>4D</Workshop> <Workshop>4D</Workshop>
<!--可执行的任务: 无, <!--可执行的任务:
治具, 无,
PCB, PCB领用 = 1,
Tray盘, Tray领用 = 2,
PCBA, 包材领用 = 4,
包材, 半成品领用,
静电箱, 静电箱领用,
半成品, 空台车领用,
成品, 空台车归还,
台车, 成品入库,
垃圾--> 半成品入库,
半成品入库与领用,
垃圾清运
-->
<Tasks> <Tasks>
<Task>PCB</Task> <Task>PCB领用</Task>
<Task>Tray盘</Task> <Task>半成品领用</Task>
</Tasks> </Tasks>
<!--使用的电梯,多个电梯使用逗号隔开--> <!--使用的电梯,多个电梯使用逗号隔开-->
<Remark>LIFT_D2</Remark> <Remark>LIFT_D2</Remark>
...@@ -32,25 +35,28 @@ ...@@ -32,25 +35,28 @@
<IO_GUID index="0">6ad07e3a-e0e9-11eb-a184-0001299981d4</IO_GUID> <IO_GUID index="0">6ad07e3a-e0e9-11eb-a184-0001299981d4</IO_GUID>
</IO_GUIDs> </IO_GUIDs>
</agv> </agv>
<agv id="50" ip="10.85.199.82"> <agv id="7" ip="10.85.199.73">
<name>2号车</name> <name>7号车</name>
<!--职责范围--> <!--职责范围-->
<Scope> <Scope>
<Workshop>4D</Workshop> <Workshop>4D</Workshop>
<!--可执行的任务: 无, <!--可执行的任务:
治具, 无,
PCB, PCB领用 = 1,
Tray盘, Tray领用 = 2,
PCBA, 包材领用 = 4,
包材, 半成品领用,
静电箱, 静电箱领用,
半成品, 空台车领用,
成品, 空台车归还,
台车, 成品入库,
垃圾--> 半成品入库,
半成品入库与领用,
垃圾清运
-->
<Tasks> <Tasks>
<Task>PCB</Task> <Task>PCB领用</Task>
<Task>Tray盘</Task> <Task>半成品领用</Task>
</Tasks> </Tasks>
<!--使用的电梯,多个电梯使用逗号隔开--> <!--使用的电梯,多个电梯使用逗号隔开-->
<Remark>LIFT_D2</Remark> <Remark>LIFT_D2</Remark>
...@@ -64,4 +70,39 @@ ...@@ -64,4 +70,39 @@
<IO_GUID index="0">6ad07e3a-e0e9-11eb-a184-0001299981d4</IO_GUID> <IO_GUID index="0">6ad07e3a-e0e9-11eb-a184-0001299981d4</IO_GUID>
</IO_GUIDs> </IO_GUIDs>
</agv> </agv>
<agv id="17" ip="10.85.199.64">
<name>17号车</name>
<!--职责范围-->
<Scope>
<Workshop>3D</Workshop>
<!--可执行的任务:
无,
PCB领用 = 1,
Tray领用 = 2,
包材领用 = 4,
半成品领用,
静电箱领用,
空台车领用,
空台车归还,
成品入库,
半成品入库,
半成品入库与领用,
垃圾清运
-->
<Tasks>
<Task>PCB领用</Task>
<Task>半成品领用</Task>
</Tasks>
<!--使用的电梯,多个电梯使用逗号隔开-->
<Remark>LIFT_D2</Remark>
</Scope>
<!--是否自动-->
<Auto>False</Auto>
<UseFleet>true</UseFleet>
<FleetIp>10.85.199.140</FleetIp>
<Authorization>Basic ZGlzdHJpYnV0b3I6NjJmMmYwZjFlZmYxMGQzMTUyYzk1ZjZmMDU5NjU3NmU0ODJiYjhlNDQ4MDY0MzNmNGNmOTI5NzkyODM0YjAxNA==</Authorization>
<IO_GUIDs>
<IO_GUID index="0">6ad07e3a-e0e9-11eb-a184-0001299981d4</IO_GUID>
</IO_GUIDs>
</agv>
</agvs> </agvs>
\ No newline at end of file \ No newline at end of file
...@@ -26,7 +26,7 @@ namespace DeviceLibrary ...@@ -26,7 +26,7 @@ namespace DeviceLibrary
/// <summary> /// <summary>
/// 节点IP /// 节点IP
/// </summary> /// </summary>
public string IP { get; set; } public string IP { get; set; } = "";
/// <summary> /// <summary>
/// 在线状态 /// 在线状态
/// </summary> /// </summary>
......
...@@ -33,6 +33,10 @@ namespace DeviceLibrary ...@@ -33,6 +33,10 @@ namespace DeviceLibrary
/// </summary> /// </summary>
public TaskType Type { get; set; } public TaskType Type { get; set; }
/// <summary> /// <summary>
/// 任务类型ID
/// </summary>
public string TypeId { get; set; }
/// <summary>
/// 任务 /// 任务
/// </summary> /// </summary>
/// <param name="name">任务名称</param> /// <param name="name">任务名称</param>
......
...@@ -35,6 +35,16 @@ namespace DeviceLibrary ...@@ -35,6 +35,16 @@ namespace DeviceLibrary
/// </summary> /// </summary>
public string Authorization { set; get; } public string Authorization { set; get; }
/// <summary> /// <summary>
/// 系统标识
/// </summary>
public string Client { get {
if (Scope != null)
{
return $"{Common.AppConfigHelper.GetValue(SettingString.AppIdentity)}-{Scope.Workshop}-{Name}";
}
else return Name;
} }
/// <summary>
/// 责任范围 /// 责任范围
/// </summary> /// </summary>
public Scope Scope{ get; set; } public Scope Scope{ get; set; }
...@@ -175,6 +185,26 @@ namespace DeviceLibrary ...@@ -175,6 +185,26 @@ namespace DeviceLibrary
ErrorMsg = ""; ErrorMsg = "";
} }
/// <summary> /// <summary>
/// 是否有空料车在电梯中准备送出
/// </summary>
/// <param name="liftname"></param>
/// <returns></returns>
public bool HasEmptyShelfInLift(out string liftname, out lift.LiftStatus liftStatus)
{
liftname = "";
liftStatus = null;
string[] lifts = Scope.Remark.Split(',');
foreach (string item in lifts)
{
if (lift.LiftContext.HasShelfNeedLeave(item, Client, out liftStatus))
{
liftname = item;
return true;
}
}
return false;
}
/// <summary>
/// 任务重发 /// 任务重发
/// </summary> /// </summary>
public void Resend() public void Resend()
...@@ -305,7 +335,10 @@ namespace DeviceLibrary ...@@ -305,7 +335,10 @@ namespace DeviceLibrary
if (this.CurJob != null) if (this.CurJob != null)
{ {
Msg = this.CurJob.runInfo; Msg = this.CurJob.runInfo;
if(CurJob.JobParam.GetMissionInfo()==null)
StateKanban.ShowInfo("任务信息", this.CurJob.RunInfo); StateKanban.ShowInfo("任务信息", this.CurJob.RunInfo);
else
StateKanban.ShowInfo("任务信息", string.Format("[{0}]{1}",CurJob.JobParam.GetMissionInfo().missionId, this.CurJob.RunInfo));
} }
} }
DateTime agvErrorStartTime = DateTime.MaxValue; DateTime agvErrorStartTime = DateTime.MaxValue;
...@@ -456,7 +489,7 @@ namespace DeviceLibrary ...@@ -456,7 +489,7 @@ namespace DeviceLibrary
{ {
isAlarm = true; isAlarm = true;
SetErrorMsg("状态:" + StateID.ToString(), (DateTime.Now - offlineStartTime).TotalMinutes.ToString("f2")); SetErrorMsg("状态:" + StateID.ToString(), (DateTime.Now - offlineStartTime).TotalMinutes.ToString("f2"));
msglist.Add(new AlarmMsg(Name, "lineAgv." + Name + ".Msg", "状态:" + StateID.ToString())); msglist.Add(new AlarmMsg(Name, "lineAgv." + Name + ".Msg", StateID.ToString()));
} }
if (!isAlarm && StandTimeOut) if (!isAlarm && StandTimeOut)
......
...@@ -37,29 +37,5 @@ namespace DeviceLibrary.bean.agv ...@@ -37,29 +37,5 @@ namespace DeviceLibrary.bean.agv
/// </summary> /// </summary>
public string Remark { get; set; } public string Remark { get; set; }
/// <summary>
/// 任务系统标识
/// </summary>
public string client { get { return Workshop; } }
/// <summary>
/// 是否有空料车在电梯中准备送出
/// </summary>
/// <param name="liftname"></param>
/// <returns></returns>
public bool HasEmptyShelfInLift(out string liftname,out lift.LiftStatus liftStatus)
{
liftname = "";
liftStatus = null;
string[] lifts = Remark.Split(',');
foreach (string item in lifts)
{
if(lift.LiftContext.HasShelfNeedLeave(item,client,out liftStatus))
{
liftname = item;
return true;
}
}
return false;
}
} }
} }
...@@ -30,14 +30,14 @@ namespace DeviceLibrary ...@@ -30,14 +30,14 @@ namespace DeviceLibrary
{ {
runInfo = $"无空闲充电桩,从" + JobParam.SrcNode + "回到待机位"; runInfo = $"无空闲充电桩,从" + JobParam.SrcNode + "回到待机位";
JobRunStep.Msg = runInfo; JobRunStep.Msg = runInfo;
return new StandyJob(new JobParam(JobParam.CurTargetNode.ToCopy(), manager.NodeManager.GetNodeByType(NodeType.Standby))); return new StandyJob(new JobParam(JobParam.SrcNode.ToCopy()));
} }
else else
{ {
JobRunStep.ToNextStep(RunStep.CHARGE_WAIT_REACH_CHARGE); JobRunStep.ToNextStep(RunStep.CHARGE_WAIT_REACH_CHARGE);
runInfo = $"当前电量{agv.Battery}小于最大电量{BatteryMax},从{JobParam.SrcNode}去充电桩{charge.AliceName}"; runInfo = $"当前电量{agv.Battery}小于最大电量{BatteryMax},从{JobParam.SrcNode}去{charge.AliceName}";
JobRunStep.Msg = runInfo; JobRunStep.Msg = runInfo;
AllocateTask(agv, charge.Guid); AllocateTask(agv, charge);
ChargePileManager.StartCharge(agv, charge.Name); ChargePileManager.StartCharge(agv, charge.Name);
} }
} }
...@@ -85,7 +85,7 @@ namespace DeviceLibrary ...@@ -85,7 +85,7 @@ namespace DeviceLibrary
runInfo = "充电完成"; runInfo = "充电完成";
JobRunStep.Msg = runInfo; JobRunStep.Msg = runInfo;
JobRunStep.EndJob(); JobRunStep.EndJob();
return new StandyJob(new JobParam(JobParam.CurTargetNode.ToCopy())); return new StandyJob(new JobParam(JobParam.SrcNode.ToCopy()));
} }
else if (agv.Battery >= ChargePileManager.GetChargePiles().BatteryMin) else if (agv.Battery >= ChargePileManager.GetChargePiles().BatteryMin)
{ {
......
...@@ -74,7 +74,7 @@ namespace DeviceLibrary.bean.job ...@@ -74,7 +74,7 @@ namespace DeviceLibrary.bean.job
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.返回离开电梯, out string msg); MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.返回离开电梯, out string msg);
JobRunStep.Msg = runInfo; JobRunStep.Msg = runInfo;
//关门 //关门
lift.LiftContext.CloseDoor(JobParam.SrcNode.Name); lift.LiftContext.CloseDoor(JobParam.SrcNode.Name,agv);
} }
} }
else if (JobRunStep.IsStep(RunStep.S1F_LiftToStore_05_CloseLiftDoor)) else if (JobRunStep.IsStep(RunStep.S1F_LiftToStore_05_CloseLiftDoor))
......
...@@ -67,7 +67,7 @@ namespace DeviceLibrary ...@@ -67,7 +67,7 @@ namespace DeviceLibrary
{ {
if (lift.LiftContext.IsDoorOpen(JobParam.CurTargetNode.Name,JobParam.GetMissionInfo().sourceFloor)) if (lift.LiftContext.IsDoorOpen(JobParam.CurTargetNode.Name,JobParam.GetMissionInfo().sourceFloor))
{ {
if (lift.LiftContext.HasShelfNeedLeave(JobParam.CurTargetNode.Name, agv.Scope.client, out lift.LiftStatus liftStatus)) if (lift.LiftContext.HasShelfNeedLeave(JobParam.CurTargetNode.Name, agv.Client, out lift.LiftStatus liftStatus))
{ {
JobRunStep.ToNextStep(RunStep.S1F_StoreToLift_05_01_ToTemp1); JobRunStep.ToNextStep(RunStep.S1F_StoreToLift_05_01_ToTemp1);
runInfo = $"{JobParam.CurTargetNode.AliceName}已开门。电梯内有料车,去临时点1的卸料点,准备卸下车上料车"; runInfo = $"{JobParam.CurTargetNode.AliceName}已开门。电梯内有料车,去临时点1的卸料点,准备卸下车上料车";
......
...@@ -23,7 +23,7 @@ namespace DeviceLibrary ...@@ -23,7 +23,7 @@ namespace DeviceLibrary
/// <summary> /// <summary>
/// 运行信息 /// 运行信息
/// </summary> /// </summary>
public string RunInfo { get { return $"{JobName}{TaskStateInfo}{FixInfo}:{runInfo}"; } } public string RunInfo { get { return $"{JobName} {TaskStateInfo}{FixInfo}:{runInfo}"; } }
/// <summary> /// <summary>
/// agv任务状态信息 /// agv任务状态信息
/// </summary> /// </summary>
...@@ -66,10 +66,19 @@ namespace DeviceLibrary ...@@ -66,10 +66,19 @@ namespace DeviceLibrary
protected void AllocateTask(AgvInfo agv, string taskName) protected void AllocateTask(AgvInfo agv, string taskName)
{ {
Task = AgvTaskManager.GetTaskByName(taskName); Task = AgvTaskManager.GetTaskByName(taskName,agv);
AgvTaskManager.AssignMission(agv, taskName); AgvTaskManager.AssignMission(agv, taskName);
} }
protected void AllocateTask(AgvInfo agv,ChargePile chargePile)
{
Task = new AgvTask() { AliceName = chargePile.AliceName, Name = chargePile.Name, Guid=chargePile.Guid};
AgvTaskManager.AssignMission(agv, chargePile,Task);
}
protected void AllocateStandbyTask(AgvInfo agv)
{
Task = AgvTaskManager.GetTaskByName(SettingString.Standby, agv);
AgvTaskManager.AssignMission(agv, SettingString.Standby);
}
/// <summary> /// <summary>
/// 设置PLC值 /// 设置PLC值
/// </summary> /// </summary>
......
...@@ -75,7 +75,7 @@ namespace DeviceLibrary.bean.job ...@@ -75,7 +75,7 @@ namespace DeviceLibrary.bean.job
//任务状态变更 //任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.离开电梯, out string msg); MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.离开电梯, out string msg);
//关门 //关门
lift.LiftContext.CloseDoor(JobParam.SrcNode.Name); lift.LiftContext.CloseDoor(JobParam.SrcNode.Name,agv);
} }
} }
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_06_CloseLiftDoor)) else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_06_CloseLiftDoor))
...@@ -183,7 +183,7 @@ namespace DeviceLibrary.bean.job ...@@ -183,7 +183,7 @@ namespace DeviceLibrary.bean.job
{ {
if (lift.LiftContext.IsDoorOpen(JobParam.CurTargetNode.Name, JobParam.GetMissionInfo().sourceFloor)) if (lift.LiftContext.IsDoorOpen(JobParam.CurTargetNode.Name, JobParam.GetMissionInfo().sourceFloor))
{ {
if (lift.LiftContext.HasShelfNeedLeave(JobParam.SrcNode.Name, agv.Scope.client, out liftStatus)) if (lift.LiftContext.HasShelfNeedLeave(JobParam.SrcNode.Name, agv.Client, out liftStatus))
{ {
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_14_01_ToTemp1); JobRunStep.ToNextStep(RunStep.SD_LiftToLine_14_01_ToTemp1);
runInfo = $"{JobParam.SrcNode.AliceName}内有料车,去临时点1放料点"; runInfo = $"{JobParam.SrcNode.AliceName}内有料车,去临时点1放料点";
...@@ -239,7 +239,7 @@ namespace DeviceLibrary.bean.job ...@@ -239,7 +239,7 @@ namespace DeviceLibrary.bean.job
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_14_04_CloseLiftDoor); JobRunStep.ToNextStep(RunStep.SD_LiftToLine_14_04_CloseLiftDoor);
runInfo = $"离开{JobParam.SrcNode.AliceName},关门"; runInfo = $"离开{JobParam.SrcNode.AliceName},关门";
JobRunStep.Msg = runInfo; JobRunStep.Msg = runInfo;
lift.LiftContext.CloseDoor(JobParam.SrcNode.Name); lift.LiftContext.CloseDoor(JobParam.SrcNode.Name,agv);
System.Threading.Thread.Sleep(1000); System.Threading.Thread.Sleep(1000);
} }
} }
...@@ -253,7 +253,7 @@ namespace DeviceLibrary.bean.job ...@@ -253,7 +253,7 @@ namespace DeviceLibrary.bean.job
} }
else if (JobRunStep.IsTimeOut(1, out double time)) else if (JobRunStep.IsTimeOut(1, out double time))
{ {
lift.LiftContext.CloseDoor(JobParam.SrcNode.Name); lift.LiftContext.CloseDoor(JobParam.SrcNode.Name,agv);
System.Threading.Thread.Sleep(1000); System.Threading.Thread.Sleep(1000);
} }
} }
...@@ -429,7 +429,7 @@ namespace DeviceLibrary.bean.job ...@@ -429,7 +429,7 @@ namespace DeviceLibrary.bean.job
} }
else if (JobRunStep.IsTimeOut(1, out double time)) else if (JobRunStep.IsTimeOut(1, out double time))
{ {
lift.LiftContext.CloseDoor(JobParam.SrcNode.Name); lift.LiftContext.CloseDoor(JobParam.SrcNode.Name,agv);
System.Threading.Thread.Sleep(1000); System.Threading.Thread.Sleep(1000);
} }
} }
......
...@@ -33,7 +33,7 @@ namespace DeviceLibrary ...@@ -33,7 +33,7 @@ namespace DeviceLibrary
JobRunStep.ToNextStep(RunStep.STANDBY_WAIT_REACH_STANDBY); JobRunStep.ToNextStep(RunStep.STANDBY_WAIT_REACH_STANDBY);
runInfo = "从" + JobParam.SrcNode + "回到待机位"; runInfo = "从" + JobParam.SrcNode + "回到待机位";
JobRunStep.Msg = runInfo; JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.Standby); AllocateStandbyTask(agv);
} }
} }
......
 
using Common;
namespace DeviceLibrary namespace DeviceLibrary
{ {
/// <summary> /// <summary>
...@@ -16,10 +18,10 @@ namespace DeviceLibrary ...@@ -16,10 +18,10 @@ namespace DeviceLibrary
{ {
if (agv.Battery < ChargePileManager.GetChargePiles().BatteryMax && ChargePileManager.HasEmpty(agv,out bean.ChargePile charge)) if (agv.Battery < ChargePileManager.GetChargePiles().BatteryMax && ChargePileManager.HasEmpty(agv,out bean.ChargePile charge))
{ {
return new ChargeJob(new bean.JobParam(agv.Place, manager.NodeManager.GetNodeByType(NodeType.AutoCharge))); return new ChargeJob(new bean.JobParam(agv.Place));
} }
else else
return new StandyJob(new bean.JobParam(agv.Place, manager.NodeManager.GetNodeByType(NodeType.Standby))); return new StandyJob(new bean.JobParam(agv.Place));
} }
} }
} }
...@@ -14,7 +14,7 @@ namespace DeviceLibrary.bean.jobType ...@@ -14,7 +14,7 @@ namespace DeviceLibrary.bean.jobType
return null; return null;
else else
{ {
if(agv.Scope.Floor.Equals(1) && agv.Scope.HasEmptyShelfInLift(out string liftname, out lift.LiftStatus lift)) if(agv.Scope.Floor.Equals(1) && agv.HasEmptyShelfInLift(out string liftname, out lift.LiftStatus lift))
{ {
service.model.MissionInfo missionInfo = manager.MissionManager.GetReceiveMission(agv); service.model.MissionInfo missionInfo = manager.MissionManager.GetReceiveMission(agv);
if(missionInfo!=null) if(missionInfo!=null)
......
...@@ -15,7 +15,7 @@ namespace DeviceLibrary.bean.jobType ...@@ -15,7 +15,7 @@ namespace DeviceLibrary.bean.jobType
{ {
if (!agv.IsIdle()) if (!agv.IsIdle())
return null; return null;
else else if(agv.Scope.Floor.Equals(1))
{ {
service.model.MissionInfo missionInfo = manager.MissionManager.GetDeliverMission(agv,out string liftname); service.model.MissionInfo missionInfo = manager.MissionManager.GetDeliverMission(agv,out string liftname);
if(missionInfo!=null) if(missionInfo!=null)
......
using System; 
using System.Collections.Generic; using DeviceLibrary.bean.job;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary.bean.jobType namespace DeviceLibrary.bean.jobType
{ {
public class LineToLineJobType:JobType public class LineToLineJobType:JobType
...@@ -12,7 +8,7 @@ namespace DeviceLibrary.bean.jobType ...@@ -12,7 +8,7 @@ namespace DeviceLibrary.bean.jobType
{ {
if (!agv.IsIdle()) if (!agv.IsIdle())
return null; return null;
else else if(!agv.Scope.Floor.Equals(1))
{ {
service.model.MissionInfo missionInfo = manager.MissionManager.GetLineToLineMission(agv); service.model.MissionInfo missionInfo = manager.MissionManager.GetLineToLineMission(agv);
if (missionInfo != null) if (missionInfo != null)
...@@ -20,7 +16,7 @@ namespace DeviceLibrary.bean.jobType ...@@ -20,7 +16,7 @@ namespace DeviceLibrary.bean.jobType
Node src = manager.NodeManager.GetNode(missionInfo.sourcePoint, NodeType.Node); Node src = manager.NodeManager.GetNode(missionInfo.sourcePoint, NodeType.Node);
Node dest = manager.NodeManager.GetNode(missionInfo.destinationPoint, NodeType.Node); Node dest = manager.NodeManager.GetNode(missionInfo.destinationPoint, NodeType.Node);
JobParam jobParam = new JobParam(src, dest, null, missionInfo); JobParam jobParam = new JobParam(src, dest, null, missionInfo);
return new F1StoreToLiftJob(jobParam); return new LineToLineJob(jobParam);
} }
} }
return null; return null;
......
...@@ -25,7 +25,7 @@ namespace DeviceLibrary ...@@ -25,7 +25,7 @@ namespace DeviceLibrary
return null; return null;
else else
{ {
if (!agv.Scope.Floor.Equals(1) && agv.Scope.HasEmptyShelfInLift(out string liftname, out lift.LiftStatus lift)) if (!agv.Scope.Floor.Equals(1) && agv.HasEmptyShelfInLift(out string liftname, out lift.LiftStatus lift))
{ {
service.model.MissionInfo missionInfo = manager.MissionManager.GetReceiveMission(agv); service.model.MissionInfo missionInfo = manager.MissionManager.GetReceiveMission(agv);
if (missionInfo != null) if (missionInfo != null)
......
using Common; using Common;
using System; using DeviceLibrary.bean.job;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary.bean.jobType namespace DeviceLibrary.bean.jobType
{ {
...@@ -13,7 +9,7 @@ namespace DeviceLibrary.bean.jobType ...@@ -13,7 +9,7 @@ namespace DeviceLibrary.bean.jobType
{ {
if (!agv.IsIdle()) if (!agv.IsIdle())
return null; return null;
else else if (!agv.Scope.Floor.Equals(1))
{ {
service.model.MissionInfo missionInfo = manager.MissionManager.GetStoreToLinesMission(agv); service.model.MissionInfo missionInfo = manager.MissionManager.GetStoreToLinesMission(agv);
if (missionInfo != null) if (missionInfo != null)
...@@ -37,7 +33,7 @@ namespace DeviceLibrary.bean.jobType ...@@ -37,7 +33,7 @@ namespace DeviceLibrary.bean.jobType
} }
} }
return new F1StoreToLiftJob(jobParam); return new StoreToLinesWithBackJob(jobParam);
} }
} }
return null; return null;
......
...@@ -37,17 +37,29 @@ namespace DeviceLibrary.lift ...@@ -37,17 +37,29 @@ namespace DeviceLibrary.lift
/// 电梯关门 /// 电梯关门
/// </summary> /// </summary>
/// <param name="liftId"></param> /// <param name="liftId"></param>
public static void CloseDoor(string liftId) public static void CloseDoor(string liftId,AgvInfo agvInfo)
{ {
bool rtn= HttpManager.CloseDoor(new service.model.DoorInfo() { liftId=liftId,sourceClient=agvInfo.Client,sourceFloor=agvInfo.Scope.Floor});
Common.LogUtil.info($"{agvInfo.Name} 关门 {rtn}");
} }
/// <summary> /// <summary>
/// 请求使用电梯 /// 请求使用电梯
/// </summary> /// </summary>
/// <param name="liftId"></param> /// <param name="liftId"></param>
public static void Request(string liftId,service.model.MissionInfo missionInfo) /// <param name="missionInfo"></param>
/// <param name="isback">是否是返回</param>
public static void Request(string liftId,service.model.MissionInfo missionInfo,bool isback=false)
{ {
service.model.SendInInfo info;
if(isback)
{
info = new service.model.SendInInfo() { };
}
else
{
info = new service.model.SendInInfo() { };
}
HttpManager.RequestSendIn(info);
} }
public static void SwitchControl(string liftId, service.model.MissionInfo missionInfo) public static void SwitchControl(string liftId, service.model.MissionInfo missionInfo)
{ {
...@@ -57,9 +69,10 @@ namespace DeviceLibrary.lift ...@@ -57,9 +69,10 @@ namespace DeviceLibrary.lift
/// 电梯开门 /// 电梯开门
/// </summary> /// </summary>
/// <param name="liftId"></param> /// <param name="liftId"></param>
public static void OpenDoor(string liftId) public static void OpenDoor(string liftId,AgvInfo agvInfo)
{ {
bool rtn = HttpManager.OpenDoor(new service.model.DoorInfo() { liftId = liftId, sourceClient = agvInfo.Client, sourceFloor = agvInfo.Scope.Floor });
Common.LogUtil.info($"{agvInfo.Name} 开门 {rtn}");
} }
/// <summary> /// <summary>
/// 运行到指定楼层 /// 运行到指定楼层
......
...@@ -62,6 +62,8 @@ namespace DeviceLibrary ...@@ -62,6 +62,8 @@ namespace DeviceLibrary
jobTypes.Add(new SendToLinesWithBackJobType()); jobTypes.Add(new SendToLinesWithBackJobType());
jobTypes.Add(new F1LiftToStoreJobType()); jobTypes.Add(new F1LiftToStoreJobType());
jobTypes.Add(new F1StoreToLiftJobType()); jobTypes.Add(new F1StoreToLiftJobType());
jobTypes.Add(new LineToLineJobType());
jobTypes.Add(new StoreToLinesWithBackJobType());
jobTypes.Add(new ChargeJobType()); jobTypes.Add(new ChargeJobType());
InitAgv(); InitAgv();
......
...@@ -34,37 +34,38 @@ namespace DeviceLibrary ...@@ -34,37 +34,38 @@ namespace DeviceLibrary
} }
} }
public static void InitView(ComboBox comboBox) public static void InitView(ComboBox comboBox, AgvInfo agv)
{ {
comboBox.DisplayMember = "AliceName"; comboBox.DisplayMember = "AliceName";
comboBox.ValueMember = "Id"; comboBox.ValueMember = "Name";
foreach (AgvTask mission in AgvTaskManager.AgvTasks) List<AgvTask> tasks = AgvTaskManager.AgvTasks.FindAll(s => s.TypeId.Equals(agv.FleetIP));
foreach (AgvTask mission in tasks)
{ {
comboBox.Items.Add(mission); comboBox.Items.Add(mission);
} }
comboBox.SelectedItem = GetTaskByName(SettingString.Init); comboBox.SelectedItem = GetTaskByName(SettingString.Init, agv);
} }
/// <summary> /// <summary>
/// 根据id获取任务 /// 根据id获取任务
/// </summary> /// </summary>
/// <param name="taskName"></param> /// <param name="taskName"></param>
/// <returns></returns> /// <returns></returns>
public static AgvTask GetTaskById(int id) //public static AgvTask GetTaskById(int id)
{ //{
AgvTask task = AgvTasks.Find(s => s.Id.Equals(id)); // AgvTask task = AgvTasks.Find(s => s.Id.Equals(id));
if (task != null) // if (task != null)
return task; // return task;
else // else
LogUtil.error(string.Format("任务Id={0}不存在,请检查配置文件!", id)); // LogUtil.error(string.Format("任务Id={0}不存在,请检查配置文件!", id));
return new AgvTask(); // return new AgvTask();
} //}
/// <summary> /// <summary>
/// 根据任务名获取任务 /// 根据任务名获取任务
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public static AgvTask GetTaskByName(string name) public static AgvTask GetTaskByName(string name, AgvInfo agv)
{ {
AgvTask task = AgvTasks.Find(s => s.Name.Equals(name)); AgvTask task = AgvTasks.Find(s => s.Name.Equals(name) && agv.FleetIP.Equals(s.TypeId));
if (task != null) if (task != null)
return task.ToCopy(); return task.ToCopy();
else else
...@@ -87,9 +88,73 @@ namespace DeviceLibrary ...@@ -87,9 +88,73 @@ namespace DeviceLibrary
public static bool AssignMission(AgvInfo agv, string taskname) public static bool AssignMission(AgvInfo agv, string taskname)
{ {
bool rtn = false; bool rtn = false;
AgvTask task = GetTaskByName(taskname); AgvTask task = GetTaskByName(taskname, agv);
Node node = manager.NodeManager.GetNodeByName(taskname); Node node=null;
if (task !=null) if (taskname.Equals(SettingString.Standby))
{
node = new Node() { Name = SettingString.Standby, AliceName = "待机位", Type = NodeType.Standby};
}
else
{
string[] names = taskname.Split('_');
foreach (string item in names)
{
node = manager.NodeManager.GetNodeByName(item);
if (node != null)
break;
}
}
if (task != null)
{
agv.TaskRunState.Task = task;
if (node != null)
agv.Place = node;
if (!agv.IsCon)
{
agv.TaskRunState.ResetInfo();
agv.TaskRunState.EnWaitTaskQueue(task);
LogUtil.info(string.Format("{0} 离线,任务{1}加入等待队列 ", agv.Name, task.AliceName));
return false;
}
if (agv.UseFleet)
{
rtn = MiR_API.Add_Mission_Fleet(agv);
MiR_API.State_Ready(agv);
if (rtn)
{
LogUtil.info(string.Format("{0} Add_Mission_Fleet {1} Success", agv.Name, agv.TaskRunState.ToTaskInfo()));
}
else
{
LogUtil.info(string.Format("{0} Add_Mission_Fleet {1} Fail", agv.Name, agv.TaskRunState.ToTaskInfo()));
}
}
else
{
rtn = MiR_API.Add_Mission(agv);
MiR_API.State_Ready(agv);
if (rtn)
{
LogUtil.info(string.Format("{0} Add_Mission {1} Success", agv.Name, agv.TaskRunState.ToTaskInfo()));
}
else
{
LogUtil.info(string.Format("{0} Add_Mission {1} Fail", agv.Name, agv.TaskRunState.ToTaskInfo()));
}
}
agv.StateKanban.SetCurTask(agv.TaskRunState.ToTaskShowInfo());
if (!rtn)
agv.TaskRunState.EnWaitTaskQueue(task);
}
return rtn;
}
public static bool AssignMission(AgvInfo agv, DeviceLibrary.bean.ChargePile chargePile, AgvTask task)
{
bool rtn = false;
Node node = new Node() { Name = chargePile.Name, AliceName = chargePile.AliceName, Type = NodeType.AutoCharge};
if (task != null)
{ {
agv.TaskRunState.Task = task; agv.TaskRunState.Task = task;
if (node != null) if (node != null)
......
...@@ -103,7 +103,7 @@ namespace DeviceLibrary ...@@ -103,7 +103,7 @@ namespace DeviceLibrary
return path; return path;
} }
public static string updateStatus = AppConfigHelper.GetValue(SettingString.Lift_GetState); static string updateStatus = AppConfigHelper.GetValue(SettingString.Lift_Server)+"status";
public static lift.LiftStatus UpdateStatusToLift(lift.ClientStatus clientStatus) public static lift.LiftStatus UpdateStatusToLift(lift.ClientStatus clientStatus)
{ {
try try
...@@ -127,35 +127,114 @@ namespace DeviceLibrary ...@@ -127,35 +127,114 @@ namespace DeviceLibrary
} }
} }
public static bool DoorOperation(service.model.DoorInfo doorInfo) static string opendoor = AppConfigHelper.GetValue(SettingString.Lift_Server) + "openDoor";
/// <summary>
/// 开门操作
/// </summary>
/// <param name="doorInfo"></param>
/// <returns></returns>
public static bool OpenDoor(service.model.DoorInfo doorInfo)
{ {
try try
{ {
string resultStr = HttpHelper.Post(updateStatus, JsonHelper.SerializeObject(doorInfo)); string resultStr = HttpHelper.Post(opendoor, JsonHelper.SerializeObject(doorInfo));
Result data = JsonHelper.DeserializeJsonToObject<Result>(resultStr); Result data = JsonHelper.DeserializeJsonToObject<Result>(resultStr);
if (data == null) if (data == null)
{ {
log.Warn($"DoorOperation fail:{JsonHelper.SerializeObject(doorInfo)}"); log.Warn($"OpenDoor fail:{JsonHelper.SerializeObject(doorInfo)}");
return false; return false;
} }
else else
{ {
if(data.code.Equals(0)) if(data.code.Equals(0))
{ {
log.Info($"DoorOperation info:{JsonHelper.SerializeObject(doorInfo)},result:code={data.code},msg={data.msg},data={data.data}"); log.Info($"OpenDoor info:{JsonHelper.SerializeObject(doorInfo)},result:code={data.code},msg={data.msg},data={data.data}");
return true; return true;
} }
else else
{ {
log.Warn($"DoorOperation info:{JsonHelper.SerializeObject(doorInfo)},result:code={data.code},msg={data.msg},data={data.data}"); log.Warn($"OpenDoor info:{JsonHelper.SerializeObject(doorInfo)},result:code={data.code},msg={data.msg},data={data.data}");
return false;
}
}
}
catch (Exception e)
{
log.Error("OpenDoor", e);
}
return false;
}
static string closedoor = AppConfigHelper.GetValue(SettingString.Lift_Server) + "closeDoor";
/// <summary>
/// 关门操作
/// </summary>
/// <param name="doorInfo"></param>
/// <returns></returns>
public static bool CloseDoor(service.model.DoorInfo doorInfo)
{
try
{
string resultStr = HttpHelper.Post(closedoor, JsonHelper.SerializeObject(doorInfo));
Result data = JsonHelper.DeserializeJsonToObject<Result>(resultStr);
if (data == null)
{
log.Warn($"CloseDoor fail:{JsonHelper.SerializeObject(doorInfo)}");
return false;
}
else
{
if (data.code.Equals(0))
{
log.Info($"CloseDoor info:{JsonHelper.SerializeObject(doorInfo)},result:code={data.code},msg={data.msg},data={data.data}");
return true;
}
else
{
log.Warn($"CloseDoor info:{JsonHelper.SerializeObject(doorInfo)},result:code={data.code},msg={data.msg},data={data.data}");
return false;
}
}
}
catch (Exception e)
{
log.Error("CloseDoor", e);
}
return false;
}
static string sendIn = AppConfigHelper.GetValue(SettingString.Lift_Server) + "sendIn";
public static bool RequestSendIn(service.model.SendInInfo send)
{
try
{
string resultStr = HttpHelper.Post(sendIn, JsonHelper.SerializeObject(send));
Result data = JsonHelper.DeserializeJsonToObject<Result>(resultStr);
if (data == null)
{
log.Warn($"RequestSendIn fail:{JsonHelper.SerializeObject(send)}");
return false;
}
else
{
if (data.code.Equals(0))
{
log.Info($"RequestSendIn info:{JsonHelper.SerializeObject(send)},result:code={data.code},msg={data.msg},data={data.data}");
return true;
}
else
{
log.Warn($"RequestSendIn info:{JsonHelper.SerializeObject(send)},result:code={data.code},msg={data.msg},data={data.data}");
return false; return false;
} }
} }
} }
catch (Exception e) catch (Exception e)
{ {
log.Error("DoorOperation", e); log.Error("RequestSendIn", e);
} }
return false; return false;
} }
......
...@@ -107,7 +107,7 @@ namespace DeviceLibrary.manager ...@@ -107,7 +107,7 @@ namespace DeviceLibrary.manager
if (Monitor.TryEnter(lockObj, 1000)) if (Monitor.TryEnter(lockObj, 1000))
{ {
MissionInfos.Add(mission); MissionInfos.Add(mission);
Log.Info($"新建任务 {JsonHelper.SerializeObject(mission)}"); Log.Info($"新建任务{JsonHelper.SerializeObject(mission)}");
WriteMission(); WriteMission();
} }
} }
...@@ -130,7 +130,7 @@ namespace DeviceLibrary.manager ...@@ -130,7 +130,7 @@ namespace DeviceLibrary.manager
{ {
missionInfo = MissionInfos.Find(s => s.missionId.Equals(missioId)); missionInfo = MissionInfos.Find(s => s.missionId.Equals(missioId));
MissionInfos.Remove(missionInfo); MissionInfos.Remove(missionInfo);
Log.Info($"删除任务 {JsonHelper.SerializeObject(missionInfo)}"); Log.Info($"删除任务{JsonHelper.SerializeObject(missionInfo)}");
WriteMission(); WriteMission();
} }
} }
...@@ -227,7 +227,7 @@ namespace DeviceLibrary.manager ...@@ -227,7 +227,7 @@ namespace DeviceLibrary.manager
{ {
missionInfo = MissionInfos.Find(s => s.destinationWorkshop.Equals(agv.Scope.Workshop) && missionInfo = MissionInfos.Find(s => s.destinationWorkshop.Equals(agv.Scope.Workshop) &&
s.sourceWorkshop.Equals(agv.Scope.Workshop) && s.projectType.Equals(ProjectType.半成品领用) && s.sourceWorkshop.Equals(agv.Scope.Workshop) && s.projectType.Equals(ProjectType.半成品领用) &&
(s.State >= MissionState.创建) && agv.Scope.Tasks.Contains(s.projectType.ToString())); (s.State == MissionState.创建) && agv.Scope.Tasks.Contains(s.projectType.ToString()));
if (missionInfo != null) if (missionInfo != null)
{ {
Log.Info($"执行任务[{agv.Name}][目的地] {JsonHelper.SerializeObject(missionInfo)}"); Log.Info($"执行任务[{agv.Name}][目的地] {JsonHelper.SerializeObject(missionInfo)}");
...@@ -336,7 +336,7 @@ namespace DeviceLibrary.manager ...@@ -336,7 +336,7 @@ namespace DeviceLibrary.manager
if (CanMissionDelete(missionState)) if (CanMissionDelete(missionState))
{ {
MissionInfos.Remove(missionInfo); MissionInfos.Remove(missionInfo);
Log.Info($"删除任务 {JsonHelper.SerializeObject(missionInfo)}"); Log.Info($"删除任务{JsonHelper.SerializeObject(missionInfo)}");
} }
} }
WriteMission(); WriteMission();
...@@ -356,7 +356,7 @@ namespace DeviceLibrary.manager ...@@ -356,7 +356,7 @@ namespace DeviceLibrary.manager
public static void SetMissionState(MissionInfo missionInfo,MissionState missionState) public static void SetMissionState(MissionInfo missionInfo,MissionState missionState)
{ {
missionInfo.SetState(missionState); missionInfo.SetState(missionState);
Log.Info($"设置任务{missionInfo.missionId}状态为{missionState}成功"); Log.Info($"设置任务[{missionInfo.missionId}] 状态为{missionState}成功");
} }
/// <summary> /// <summary>
/// 任务能否被删除 /// 任务能否被删除
...@@ -365,7 +365,7 @@ namespace DeviceLibrary.manager ...@@ -365,7 +365,7 @@ namespace DeviceLibrary.manager
/// <returns></returns> /// <returns></returns>
static bool CanMissionDelete(MissionState missionState) static bool CanMissionDelete(MissionState missionState)
{ {
if (missionState.Equals(MissionState.中止) || missionState.Equals(MissionState.取消)) if (missionState.Equals(MissionState.中止) || missionState.Equals(MissionState.取消) || missionState.Equals(MissionState.完成))
return true; return true;
return false; return false;
} }
......
...@@ -41,7 +41,7 @@ namespace DeviceLibrary.manager ...@@ -41,7 +41,7 @@ namespace DeviceLibrary.manager
DgvNode.AlternatingRowsDefaultCellStyle.BackColor = Color.LightBlue; DgvNode.AlternatingRowsDefaultCellStyle.BackColor = Color.LightBlue;
}; };
DgvNode.Columns.Add(new DataGridViewCheckBoxColumn() { HeaderText = "启用", DataPropertyName = "IsUse" }); DgvNode.Columns.Add(new DataGridViewCheckBoxColumn() { HeaderText = "启用", DataPropertyName = "IsUse" });
DgvNode.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "编号", DataPropertyName = "Id" }); //DgvNode.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "编号", DataPropertyName = "Id" });
DgvNode.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "名称", DataPropertyName = "Name" }); DgvNode.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "名称", DataPropertyName = "Name" });
DgvNode.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "别名", DataPropertyName = "AliceName" }); DgvNode.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "别名", DataPropertyName = "AliceName" });
DgvNode.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "车间", DataPropertyName = "Workshop" }); DgvNode.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "车间", DataPropertyName = "Workshop" });
......
...@@ -46,7 +46,7 @@ namespace DeviceLibrary.manager ...@@ -46,7 +46,7 @@ namespace DeviceLibrary.manager
agvStates.Add(agvState); agvStates.Add(agvState);
} }
string txt = Common.JsonHelper.SerializeObject(agvStates); string txt = Common.JsonHelper.SerializeObject(agvStates);
Common.LogUtil.info(txt); Common.LogUtil.debug(txt);
} }
finally finally
{ {
......
...@@ -29,7 +29,6 @@ namespace DeviceLibrary ...@@ -29,7 +29,6 @@ namespace DeviceLibrary
} }
else else
{ {
MissionManager.SetMissionState(createMissionInfo.missionId, MissionState.创建, out string msg);
if (!NodeManager.CheckNode(createMissionInfo.sourcePoint)) if (!NodeManager.CheckNode(createMissionInfo.sourcePoint))
{ {
result.code = -1; result.code = -1;
...@@ -44,6 +43,7 @@ namespace DeviceLibrary ...@@ -44,6 +43,7 @@ namespace DeviceLibrary
} }
else if (!MissionManager.Contains(createMissionInfo)) else if (!MissionManager.Contains(createMissionInfo))
{ {
MissionManager.SetMissionState(createMissionInfo.missionId, MissionState.创建, out string msg);
MissionManager.Add(createMissionInfo); MissionManager.Add(createMissionInfo);
Log.Info($"Create mission from API:{s}"); Log.Info($"Create mission from API:{s}");
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!