Commit 3803ecbd 张东亮

0421

1 个父辈 cd135516
...@@ -105,6 +105,9 @@ ...@@ -105,6 +105,9 @@
<DependentUpon>Resources.resx</DependentUpon> <DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime> <DesignTime>True</DesignTime>
</Compile> </Compile>
<None Include="log4net.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="packages.config" /> <None Include="packages.config" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
...@@ -120,6 +123,8 @@ ...@@ -120,6 +123,8 @@
<None Include="App.config" /> <None Include="App.config" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="gray2.png" />
<None Include="green1.png" />
<Content Include="icon.ico" /> <Content Include="icon.ico" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
......
...@@ -6,71 +6,12 @@ ...@@ -6,71 +6,12 @@
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup> </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> <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="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="Use_Fleet" value="False"/>
<add key="ChargeThreshold" value="20,90"/> <add key="ChargeThreshold" value="20,90"/>
<add key="LimitPoints" value="0,0;0,0;0,0;0,0"/> <add key="LimitPoints" value="0,0;0,0;0,0;0,0"/>
......
...@@ -27,8 +27,10 @@ namespace AGVControl ...@@ -27,8 +27,10 @@ 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);
cmbBxMission.Items.AddRange(CommonVar.showNameMissionName.Values.ToArray()); cmbBxMission.Items.AddRange(DeviceLibrary.Context.showNameMissionName.Values.ToArray());
cmbBxMission.SelectedIndex = 0; cmbBxMission.SelectedIndex = 0;
InState.AddRange(new PictureBox[] { pictureBox1,pictureBox2,pictureBox3,pictureBox4});
OutState.AddRange(new PictureBox[] { pictureBox5, pictureBox6, pictureBox7, pictureBox8 });
isInit = true; isInit = true;
} }
...@@ -50,8 +52,8 @@ namespace AGVControl ...@@ -50,8 +52,8 @@ namespace AGVControl
Agv.AssignTask(SettingString.Init); Agv.AssignTask(SettingString.Init);
} }
CommonVar.Standby.DelOccupyInfo(Agv.Name); DeviceLibrary.Context.Standby.DelOccupyInfo(Agv.Name);
CommonVar.Charge.DelOccupyInfo(Agv.Name); DeviceLibrary.Context.Charge.DelOccupyInfo(Agv.Name);
} }
else else
...@@ -140,9 +142,9 @@ namespace AGVControl ...@@ -140,9 +142,9 @@ namespace AGVControl
{ {
try 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]; string taskName = key.ToList()[0];
if(!CommonVar.agvMission.Keys.Contains(taskName)) if(!DeviceLibrary.Context.agvMission.Keys.Contains(taskName))
{ {
LogUtil.error("无选定任务: "+ taskName); LogUtil.error("无选定任务: "+ taskName);
return; return;
...@@ -166,5 +168,44 @@ namespace AGVControl ...@@ -166,5 +168,44 @@ namespace AGVControl
{ {
Close(); 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 @@ ...@@ -117,6 +117,9 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.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> </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" /> <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"> <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
......
...@@ -9,6 +9,7 @@ using System.Threading.Tasks; ...@@ -9,6 +9,7 @@ using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using DeviceLibrary; using DeviceLibrary;
using Common; using Common;
using System.IO;
namespace AGVControl namespace AGVControl
{ {
...@@ -23,7 +24,7 @@ namespace AGVControl ...@@ -23,7 +24,7 @@ namespace AGVControl
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
Application.ThreadException += Application_ThreadException; Application.ThreadException += Application_ThreadException;
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
XmlConfigurator.Configure(); XmlConfigurator.Configure(new FileInfo(AppConfigHelper.GetValue(SettingString.log4net_configname)));
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
...@@ -51,18 +52,16 @@ namespace AGVControl ...@@ -51,18 +52,16 @@ namespace AGVControl
{ {
LogUtil.info("=====程序开始====="); LogUtil.info("=====程序开始=====");
ReadConfig(); ReadConfig();
CommonVar.Charge = new Charge(); DeviceLibrary.Context.Charge = new Charge();
CommonVar.Standby = new Standby(); DeviceLibrary.Context.Standby = new Standby();
CommonVar.control = new DeviceLibrary.Control(); DeviceLibrary.Context.control = new DeviceLibrary.Control();
DeviceLibrary.Context.server = new Agv.Server();
CommonVar.control.Start(); DeviceLibrary.Context.control.Start();
CommonVar.server = new Agv.Server();
CommonVar.server.Start();
} }
private static void Stop() private static void Stop()
{ {
CommonVar.control.Stop(); DeviceLibrary.Context.control.Stop();
CommonVar.server.Stop(); DeviceLibrary.Context.server.Stop();
LogUtil.info("=====程序结束=====\r\n"); LogUtil.info("=====程序结束=====\r\n");
} }
private static void ReadConfig() private static void ReadConfig()
...@@ -74,48 +73,48 @@ namespace AGVControl ...@@ -74,48 +73,48 @@ namespace AGVControl
string rfid = ""; string rfid = "";
CommonVar.agvInfo = new List<Agv_Info>(); DeviceLibrary.Context.agvInfo = new List<Agv_Info>();
path = CommonVar.CONFIG_PATH + SettingString.FileName_AGV; path = DeviceLibrary.Context.CONFIG_PATH + SettingString.FileName_AGV;
line = System.IO.File.ReadAllLines(path, Encoding.UTF8); line = System.IO.File.ReadAllLines(path, Encoding.UTF8);
for (int i = 1; i < line.Length; i++) for (int i = 1; i < line.Length; i++)
{ {
temp = line[i].Split(','); temp = line[i].Split(',');
if (temp.Length != 5) continue; if (temp.Length != 5) continue;
//string val = CommonVar.appConfig.AppSettings.Settings[temp[1]].Value; //string val = CommonVar.appConfig.AppSettings.Settings[temp[1]].Value;
bool.TryParse(CommonVar.ReadIni(temp[1], SettingString.IsUse), out isuse); //Convert.ToBoolean(val.Split(',')[0]); bool.TryParse(DeviceLibrary.Context.ReadIni(temp[1], SettingString.IsUse), out isuse); //Convert.ToBoolean(val.Split(',')[0]);
rfid = CommonVar.ReadIni(temp[1], SettingString.RFID); //val.Split(',')[1]; rfid = DeviceLibrary.Context.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)); 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>(); DeviceLibrary.Context.agvMission = new Dictionary<string, string>();
CommonVar.showNameMissionName = new Dictionary<string, string>(); DeviceLibrary.Context.showNameMissionName = new Dictionary<string, string>();
path = CommonVar.CONFIG_PATH + SettingString.FileName_AgvMission; path = DeviceLibrary.Context.CONFIG_PATH + SettingString.FileName_AgvMission;
line = System.IO.File.ReadAllLines(path, Encoding.UTF8); line = System.IO.File.ReadAllLines(path, Encoding.UTF8);
for (int i = 1; i < line.Length; i++) for (int i = 1; i < line.Length; i++)
{ {
temp = line[i].Split(','); temp = line[i].Split(',');
if (temp.Length != 3) continue; if (temp.Length != 3) continue;
CommonVar.agvMission.Add(temp[1], temp[2]); DeviceLibrary.Context.agvMission.Add(temp[1], temp[2]);
CommonVar.showNameMissionName.Add(temp[1], temp[0]); DeviceLibrary.Context.showNameMissionName.Add(temp[1], temp[0]);
} }
CommonVar.nodeInfo = new List<Agv.ClientNode>(); DeviceLibrary.Context.nodeInfo = new List<Agv.ClientNode>();
path = CommonVar.CONFIG_PATH + SettingString.FileName_AgvProductionLine; path = DeviceLibrary.Context.CONFIG_PATH + SettingString.FileName_AgvProductionLine;
line = System.IO.File.ReadAllLines(path, Encoding.GetEncoding("gb2312")); line = System.IO.File.ReadAllLines(path, Encoding.GetEncoding("gb2312"));
for (int i = 1; i < line.Length; i++) for (int i = 1; i < line.Length; i++)
{ {
temp = line[i].Split(','); temp = line[i].Split(',');
if (temp.Length != 3) continue; if (temp.Length != 3) continue;
Boolean.TryParse(CommonVar.ReadIni(temp[0], SettingString.IsUse), out bool isUse); bool.TryParse(DeviceLibrary.Context.ReadIni(temp[0], SettingString.IsUse), out bool isUse);
CommonVar.nodeInfo.Add(new Agv.ClientNode(temp[0], temp[1],temp[2], 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 PackingJobType());
CommonVar.jobTypeInfo.Add(new BoxInJobType()); DeviceLibrary.Context.jobTypeInfo.Add(new BoxInJobType());
CommonVar.jobTypeInfo.Add(new BoxOutJobType()); DeviceLibrary.Context.jobTypeInfo.Add(new BoxOutJobType());
CommonVar.jobTypeInfo.Add(new ChargeJobType()); DeviceLibrary.Context.jobTypeInfo.Add(new ChargeJobType());
} }
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
......
...@@ -59,5 +59,25 @@ namespace AGVDispatch.Properties { ...@@ -59,5 +59,25 @@ namespace AGVDispatch.Properties {
resourceCulture = value; 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 @@ ...@@ -46,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64 mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64 mimetype: application/x-microsoft.net.object.soap.base64
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
: and then encoded with base64 encoding. : 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: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:element name="root" msdata:IsDataSet="true">
<xsd:complexType> <xsd:complexType>
<xsd:choice maxOccurs="unbounded"> <xsd:choice maxOccurs="unbounded">
...@@ -68,9 +69,10 @@ ...@@ -68,9 +69,10 @@
<xsd:sequence> <xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" /> <xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence> </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="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" /> <xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="assembly"> <xsd:element name="assembly">
...@@ -85,9 +87,10 @@ ...@@ -85,9 +87,10 @@
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <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:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence> </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="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType> </xsd:complexType>
</xsd:element> </xsd:element>
<xsd:element name="resheader"> <xsd:element name="resheader">
...@@ -109,9 +112,16 @@ ...@@ -109,9 +112,16 @@
<value>2.0</value> <value>2.0</value>
</resheader> </resheader>
<resheader name="reader"> <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>
<resheader name="writer"> <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> </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> </root>
\ No newline at end of file \ 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 \ No newline at end of file
...@@ -84,7 +84,9 @@ namespace Common ...@@ -84,7 +84,9 @@ namespace Common
public const string D4 = "D4"; public const string D4 = "D4";
public const string LimitPoints = "LimitPoints"; 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 Use_Fleet = "Use_Fleet";
public const string log4net_configname = "log4net_configname";
} }
} }
任务别称,任务名称,任务GUID 任务别称,任务名称,任务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 \ 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 \ No newline at end of file
Fleet ID,agv名称,IP,授权码,IOID 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
...@@ -9,3 +9,9 @@ D3,D3,设备2入口-D3 ...@@ -9,3 +9,9 @@ D3,D3,设备2入口-D3
D4,D4,设备3入口-D4 D4,D4,设备3入口-D4
S1,S1,产线1 S1,S1,产线1
S2,S2,产线2 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 \ No newline at end of file
...@@ -9,9 +9,9 @@ using Common; ...@@ -9,9 +9,9 @@ using Common;
namespace DeviceLibrary namespace DeviceLibrary
{ {
/// <summary> /// <summary>
/// 公共参数 /// 程序上下文变量
/// </summary> /// </summary>
public static class CommonVar public static class Context
{ {
/// <summary> /// <summary>
/// 节点信息 /// 节点信息
......
...@@ -79,18 +79,18 @@ namespace DeviceLibrary ...@@ -79,18 +79,18 @@ namespace DeviceLibrary
if (AgvStateInProcess) return; if (AgvStateInProcess) return;
AgvStateInProcess = true; AgvStateInProcess = true;
for (int i = 0; i < CommonVar.agvInfo.Count; i++) for (int i = 0; i < Context.agvInfo.Count; i++)
{ {
try try
{ {
if (!CheckOnline(i)) continue; if (!CheckOnline(i)) continue;
bool change = false; 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); Thread.Sleep(50);
//获取AGV状态 //获取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); 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) //更新状态stateID.Equals(eAGVState.Executing)
if (change) if (change)
...@@ -101,7 +101,7 @@ namespace DeviceLibrary ...@@ -101,7 +101,7 @@ namespace DeviceLibrary
} }
catch (Exception ex) 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 ...@@ -120,7 +120,7 @@ namespace DeviceLibrary
{ {
lock(lockGetObj) lock(lockGetObj)
{ {
foreach (JobType find in CommonVar.jobTypeInfo) foreach (JobType find in Context.jobTypeInfo)
{ {
Job job = null; Job job = null;
...@@ -149,19 +149,19 @@ namespace DeviceLibrary ...@@ -149,19 +149,19 @@ namespace DeviceLibrary
{ {
if (AgvCallInProcess) return; if (AgvCallInProcess) return;
AgvCallInProcess = true; AgvCallInProcess = true;
for (int i = 0; i < CommonVar.agvInfo.Count; i++) for (int i = 0; i < Context.agvInfo.Count; i++)
{ {
try try
{ {
Agv_Info agv = CommonVar.agvInfo[i]; Agv_Info agv = Context.agvInfo[i];
if (!agv.IsCon) continue; //AGV网络连接 if (!agv.IsCon) continue; //AGV网络连接
if (!CommonVar.agvInfo[i].IsUse) continue; //AGV是否可用 if (!Context.agvInfo[i].IsUse) continue; //AGV是否可用
//Ready,Pause,Executing,Error //Ready,Pause,Executing,Error
if (!CommonVar.agvInfo[i].StateID.Equals(eAGVState.Ready) && !CommonVar.agvInfo[i].StateID.Equals(eAGVState.Pause) if (!Context.agvInfo[i].StateID.Equals(eAGVState.Ready) && !Context.agvInfo[i].StateID.Equals(eAGVState.Pause)
&& !CommonVar.agvInfo[i].StateID.Equals(eAGVState.Executing) && !CommonVar.agvInfo[i].StateID.Equals(eAGVState.None)) && !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; continue;
} }
...@@ -192,31 +192,31 @@ namespace DeviceLibrary ...@@ -192,31 +192,31 @@ namespace DeviceLibrary
private bool CheckOnline(int idx) 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 (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 else
{ {
CommonVar.agvInfo[idx].IsCon = true; Context.agvInfo[idx].IsCon = true;
LogUtil.info(CommonVar.agvInfo[idx].Name + " Online"); LogUtil.info(Context.agvInfo[idx].Name + " Online");
AgvOnline?.Invoke(idx); AgvOnline?.Invoke(idx);
} }
} }
else else
{ {
if (CommonVar.agvInfo[idx].IsCon) if (Context.agvInfo[idx].IsCon)
{ {
CommonVar.agvInfo[idx].IsCon = false; Context.agvInfo[idx].IsCon = false;
LogUtil.info(CommonVar.agvInfo[idx].Name + " Offline"); LogUtil.info(Context.agvInfo[idx].Name + " Offline");
AgvOnline?.Invoke(idx); AgvOnline?.Invoke(idx);
} }
else else
{ {
LogUtil.debug(CommonVar.agvInfo[idx].Name + " Offline"); LogUtil.debug(Context.agvInfo[idx].Name + " Offline");
} }
} }
return rtn; return rtn;
......
...@@ -56,11 +56,11 @@ ...@@ -56,11 +56,11 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="AGVManager.cs" /> <Compile Include="manager\RequestManager.cs" />
<Compile Include="bean\Agv_Info.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\JobStep.cs" />
<Compile Include="bean\JobType.cs" /> <Compile Include="bean\jobType\JobType.cs" />
<Compile Include="bean\jobType\ChargeJobType.cs" /> <Compile Include="bean\jobType\ChargeJobType.cs" />
<Compile Include="bean\jobType\BoxInJobType.cs" /> <Compile Include="bean\jobType\BoxInJobType.cs" />
<Compile Include="bean\jobType\BoxOutJobType.cs" /> <Compile Include="bean\jobType\BoxOutJobType.cs" />
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
<Compile Include="bean\job\SendShelfJob.cs" /> <Compile Include="bean\job\SendShelfJob.cs" />
<Compile Include="bean\job\StandyJob.cs" /> <Compile Include="bean\job\StandyJob.cs" />
<Compile Include="Charge.cs" /> <Compile Include="Charge.cs" />
<Compile Include="CommonVar.cs" /> <Compile Include="Context.cs" />
<Compile Include="Control.cs" /> <Compile Include="Control.cs" />
<Compile Include="DisplayBoard.cs" /> <Compile Include="DisplayBoard.cs" />
<Compile Include="bean\MiR_API.cs" /> <Compile Include="bean\MiR_API.cs" />
......
...@@ -40,7 +40,7 @@ namespace DeviceLibrary ...@@ -40,7 +40,7 @@ namespace DeviceLibrary
{ {
if (MsgList != null && MsgList.Count > 0) if (MsgList != null && MsgList.Count > 0)
{ {
AGVManager.updateDeviceAlarmMsg(MsgList); RequestManager.updateDeviceAlarmMsg(MsgList);
ClearAlram(); ClearAlram();
} }
......
...@@ -50,7 +50,7 @@ namespace DeviceLibrary ...@@ -50,7 +50,7 @@ namespace DeviceLibrary
foreach (string ip in agvIPs) foreach (string ip in agvIPs)
{ {
Thread.Sleep(1000); 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 (rtn)
{ {
if (IsInPolygon(position, positions)) if (IsInPolygon(position, positions))
......
...@@ -33,6 +33,8 @@ namespace DeviceLibrary ...@@ -33,6 +33,8 @@ namespace DeviceLibrary
/// </summary> /// </summary>
public string RFID { set; get; } public string RFID { set; get; }
public int LeftTaskCnt { get; set; } public int LeftTaskCnt { get; set; }
public bool[] IOInState { get; private set; }
public bool[] IOOutState { get; private set; }
/// <summary> /// <summary>
/// 是否在线 /// 是否在线
/// </summary> /// </summary>
...@@ -64,7 +66,7 @@ namespace DeviceLibrary ...@@ -64,7 +66,7 @@ namespace DeviceLibrary
if (!value.Equals(_IsUse)) if (!value.Equals(_IsUse))
{ {
_IsUse = value; _IsUse = value;
CommonVar.WriteIni(Name, SettingString.IsUse, _IsUse.ToString()); Context.WriteIni(Name, SettingString.IsUse, _IsUse.ToString());
} }
} }
get { return _IsUse; } get { return _IsUse; }
...@@ -211,8 +213,21 @@ namespace DeviceLibrary ...@@ -211,8 +213,21 @@ namespace DeviceLibrary
bool isChange = false; bool isChange = false;
bool preShelfState = IsExistShelf; bool preShelfState = IsExistShelf;
MiR_API.Get_IO_Status(this, out bool[] input, out bool[] output); 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) if (input != null && input.Length == 4)
{ {
bool reachIoValue = input[3].Equals(true);//input[2] && bool reachIoValue = input[3].Equals(true);//input[2] &&
if (reachIoValue) if (reachIoValue)
{ {
...@@ -259,9 +274,9 @@ namespace DeviceLibrary ...@@ -259,9 +274,9 @@ namespace DeviceLibrary
StateKanban.SetBattery(battery); StateKanban.SetBattery(battery);
} }
//"目的地", "RFID", "负载", "运行模式","任务信息", "AGV运行信息" //"目的地", "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) if (node != null)
PlaceAliceName = node.AliceName; PlaceAliceName = node.AliceName;
else else
...@@ -416,9 +431,9 @@ namespace DeviceLibrary ...@@ -416,9 +431,9 @@ namespace DeviceLibrary
s.Add(CurTaskState); s.Add(CurTaskState);
//s.Add(Msg); //s.Add(Msg);
// s.Add(MissionText); // 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) if (node != null)
PlaceAliceName = node.AliceName; PlaceAliceName = node.AliceName;
else else
...@@ -441,11 +456,11 @@ namespace DeviceLibrary ...@@ -441,11 +456,11 @@ namespace DeviceLibrary
bool rtn=false; bool rtn=false;
if (Use_Fleet) if (Use_Fleet)
{ {
rtn = MiR_API.Add_Mission_Fleet(this, CommonVar.agvMission[taskName]); rtn = MiR_API.Add_Mission_Fleet(this, Context.agvMission[taskName]);
} }
else else
{ {
rtn = MiR_API.Add_Mission(this, CommonVar.agvMission[taskName]); rtn = MiR_API.Add_Mission(this, Context.agvMission[taskName]);
} }
if (rtn) if (rtn)
{ {
...@@ -455,7 +470,7 @@ namespace DeviceLibrary ...@@ -455,7 +470,7 @@ namespace DeviceLibrary
{ {
LogUtil.info(string.Format("{0} 分配{1}任务失败", Name, taskName)); LogUtil.info(string.Format("{0} 分配{1}任务失败", Name, taskName));
} }
StateKanban.SetCurTask(CommonVar.showNameMissionName[taskName]); StateKanban.SetCurTask(Context.showNameMissionName[taskName]);
MiR_API.State_Ready(this); MiR_API.State_Ready(this);
return rtn; return rtn;
} }
......
...@@ -190,7 +190,7 @@ namespace DeviceLibrary ...@@ -190,7 +190,7 @@ namespace DeviceLibrary
info.CurTaskID = -1; info.CurTaskID = -1;
info.CurTaskGUID = ""; info.CurTaskGUID = "";
info.CurTaskState = SettingString.Wait; 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]; info.CurTaskName = key.ToList()[0];
//删除上一任务 //删除上一任务
Del_Mission(info); Del_Mission(info);
...@@ -252,7 +252,7 @@ namespace DeviceLibrary ...@@ -252,7 +252,7 @@ namespace DeviceLibrary
info.CurTaskID = -1; info.CurTaskID = -1;
info.CurTaskGUID = ""; info.CurTaskGUID = "";
info.CurTaskState = SettingString.Wait; 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]; info.CurTaskName = key.ToList()[0];
//防止上一个任务已执行但返回失败时,删除任务 //防止上一个任务已执行但返回失败时,删除任务
Del_Mission(info); Del_Mission(info);
...@@ -514,7 +514,7 @@ namespace DeviceLibrary ...@@ -514,7 +514,7 @@ namespace DeviceLibrary
{ {
string ip = AppConfigHelper.GetValue(SettingString.FLEET); string ip = AppConfigHelper.GetValue(SettingString.FLEET);
string url = "http://" + ip + "/api/v2.0.0/mission_scheduler/" + agv.CurTaskID; 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); log.Debug("URL: " + url + "\n" + "Return: " + json);
if (string.IsNullOrWhiteSpace(json)) return false; if (string.IsNullOrWhiteSpace(json)) return false;
......
...@@ -43,13 +43,13 @@ namespace DeviceLibrary ...@@ -43,13 +43,13 @@ namespace DeviceLibrary
bool rtn = false; bool rtn = false;
agv.Msg = RunInfo; agv.Msg = RunInfo;
CurTaskState = CommonVar.GetTakJobState(agv); CurTaskState = Context.GetTakJobState(agv);
if (ChargeStep.IsStep(CHARGE_STEP.NONE)) 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; msg += runInfo;
ChargeStep.Msg = msg; ChargeStep.Msg = msg;
return new StandyJob(agv.Place); return new StandyJob(agv.Place);
...@@ -57,7 +57,7 @@ namespace DeviceLibrary ...@@ -57,7 +57,7 @@ namespace DeviceLibrary
else else
{ {
ChargeStep.ToNextStep(CHARGE_STEP.WAIT_REACH_CHARGE_STATION); ChargeStep.ToNextStep(CHARGE_STEP.WAIT_REACH_CHARGE_STATION);
runInfo = "电量[" + agv.Battery + "%]小于最大电量[" + CommonVar.Charge.BatteryMax + "%],从当前位置" + agvPlace + "去到充电位"; runInfo = "电量[" + agv.Battery + "%]小于最大电量[" + Context.Charge.BatteryMax + "%],从当前位置" + agvPlace + "去到充电位";
msg += runInfo; msg += runInfo;
ChargeStep.Msg = msg; ChargeStep.Msg = msg;
UpdateJobTaskInfo(agv); UpdateJobTaskInfo(agv);
...@@ -67,7 +67,7 @@ namespace DeviceLibrary ...@@ -67,7 +67,7 @@ namespace DeviceLibrary
else if (ChargeStep.IsStep(CHARGE_STEP.WAIT_REACH_CHARGE_STATION)) 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); ChargeStep.ToNextStep(CHARGE_STEP.WAIT_REACH_CHARGE_OK);
runInfo = "充电任务分配完成,去充电且等待任务"; runInfo = "充电任务分配完成,去充电且等待任务";
...@@ -77,23 +77,23 @@ namespace DeviceLibrary ...@@ -77,23 +77,23 @@ namespace DeviceLibrary
} }
else if (ChargeStep.IsStep(CHARGE_STEP.WAIT_REACH_CHARGE_OK)) else if (ChargeStep.IsStep(CHARGE_STEP.WAIT_REACH_CHARGE_OK))
{ {
if (agv.Battery > CommonVar.Charge.BatteryMax) if (agv.Battery > Context.Charge.BatteryMax)
{ {
runInfo = "充电完成,回待机位"; runInfo = "充电完成,回待机位";
msg += runInfo; msg += runInfo;
ChargeStep.Msg = msg; ChargeStep.Msg = msg;
CommonVar.Charge.DelOccupyInfoByAGV(agv); Context.Charge.DelOccupyInfoByAGV(agv);
return new StandyJob(agv.Place); 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)) if (job != null && !(job is ChargeJob) && !(job is StandyJob))
{ {
runInfo = "在充电位检测到任务,电量[" + agv.Battery + " %]大于最小电量[" + CommonVar.Charge.BatteryMin + " %],可执行任务"; runInfo = "在充电位检测到任务,电量[" + agv.Battery + " %]大于最小电量[" + Context.Charge.BatteryMin + " %],可执行任务";
msg += runInfo; msg += runInfo;
ChargeStep.Msg = msg; ChargeStep.Msg = msg;
CommonVar.Charge.DelOccupyInfoByAGV(agv); Context.Charge.DelOccupyInfoByAGV(agv);
return job; return job;
} }
} }
......
...@@ -39,16 +39,16 @@ namespace DeviceLibrary ...@@ -39,16 +39,16 @@ namespace DeviceLibrary
{ {
get get
{ {
int t1 = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(agvPlace)); int t1 = Context.nodeInfo.FindIndex(s => s.Name.Equals(agvPlace));
string from = ""; string from = "";
if (t1 > -1) if (t1 > -1)
from = CommonVar.nodeInfo[t1].AliceName; from = Context.nodeInfo[t1].AliceName;
else else
from = agvPlace; from = agvPlace;
int t2 = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(TargetPlace)); int t2 = Context.nodeInfo.FindIndex(s => s.Name.Equals(TargetPlace));
string to = ""; string to = "";
if (t2 > -1) if (t2 > -1)
to = CommonVar.nodeInfo[t2].AliceName; to = Context.nodeInfo[t2].AliceName;
else else
to = TargetPlace; to = TargetPlace;
return string.Format("取满料架任务:{0}[RFID={1}][目的地={2}][任务名称={3}][任务状态={4}]", runInfo, RFID, to, CurTaskName, CurTaskState); return string.Format("取满料架任务:{0}[RFID={1}][目的地={2}][任务名称={3}][任务状态={4}]", runInfo, RFID, to, CurTaskName, CurTaskState);
...@@ -67,7 +67,7 @@ namespace DeviceLibrary ...@@ -67,7 +67,7 @@ namespace DeviceLibrary
bool rtn = false; bool rtn = false;
agv.Msg = runInfo; agv.Msg = runInfo;
CurTaskState = CommonVar.GetTakJobState(agv); CurTaskState = Context.GetTakJobState(agv);
if (curJobStep.IsStep(EXECUTE_STEP.P1_NONE)) if (curJobStep.IsStep(EXECUTE_STEP.P1_NONE))
{ {
...@@ -77,7 +77,7 @@ namespace DeviceLibrary ...@@ -77,7 +77,7 @@ namespace DeviceLibrary
runInfo = "待机位/充电位收到任务,开始执行"; runInfo = "待机位/充电位收到任务,开始执行";
msg += runInfo; msg += runInfo;
curJobStep.Msg = msg; curJobStep.Msg = msg;
CommonVar.MoveToNode(agv, TargetPlace); Context.MoveToNode(agv, TargetPlace);
UpdateJobTaskInfo(agv); UpdateJobTaskInfo(agv);
} }
else else
...@@ -87,14 +87,14 @@ namespace DeviceLibrary ...@@ -87,14 +87,14 @@ namespace DeviceLibrary
msg += runInfo; msg += runInfo;
curJobStep.Msg = msg; curJobStep.Msg = msg;
CommonVar.MoveToNode(agv, TargetPlace); Context.MoveToNode(agv, TargetPlace);
UpdateJobTaskInfo(agv); UpdateJobTaskInfo(agv);
} }
} }
else if (curJobStep.IsStep(EXECUTE_STEP.P2_WAIT_REACH_OUT_SHELF_PLACE)) 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); curJobStep.ToNextStep(EXECUTE_STEP.P3_CHECK_STATION_STATE);
runInfo = "到达云仓出料口 " + TargetPlace; runInfo = "到达云仓出料口 " + TargetPlace;
...@@ -104,14 +104,14 @@ namespace DeviceLibrary ...@@ -104,14 +104,14 @@ namespace DeviceLibrary
} }
else if (curJobStep.IsStep(EXECUTE_STEP.P3_CHECK_STATION_STATE)) 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); curJobStep.ToNextStep(EXECUTE_STEP.P4_WAIT_LINE_RESPONSE);
runInfo = RFID + " 满料任务确认存在,并向线体" + TargetPlace + "发送出料请求"; runInfo = RFID + " 满料任务确认存在,目的地为"+ tarname + ",并向线体" + TargetPlace + "发送出料请求";
msg += runInfo; msg += runInfo;
curJobStep.Msg = msg; curJobStep.Msg = msg;
CommonVar.server.Ready(TargetPlace, ""); Context.server.Ready(TargetPlace, "");
} }
else else
{ {
...@@ -125,19 +125,19 @@ namespace DeviceLibrary ...@@ -125,19 +125,19 @@ namespace DeviceLibrary
msg += runInfo; msg += runInfo;
curJobStep.Msg = msg; curJobStep.Msg = msg;
recyMark = true; recyMark = true;
CommonVar.server.Ready(TargetPlace, ""); Context.server.Ready(TargetPlace, "");
} }
else else
{ {
if (BoxOutJobType.CheckFullTask(rfid)) if (BoxOutJobType.CheckFullTask(rfid,out string tarname1))
{ {
curJobStep.ToNextStep(EXECUTE_STEP.P4_WAIT_LINE_RESPONSE); curJobStep.ToNextStep(EXECUTE_STEP.P4_WAIT_LINE_RESPONSE);
rfid = RFID; RFID=rfid;
runInfo = RFID + " 满料任务存在,并向线体" + TargetPlace + "发送出料请求"; runInfo = RFID + " 满料任务存在,目的地为"+ tarname1 + ",并向线体" + TargetPlace + "发送出料请求";
msg += runInfo; msg += runInfo;
curJobStep.Msg = msg; curJobStep.Msg = msg;
CommonVar.server.Ready(TargetPlace, ""); Context.server.Ready(TargetPlace, "");
} }
else else
{ {
...@@ -146,7 +146,7 @@ namespace DeviceLibrary ...@@ -146,7 +146,7 @@ namespace DeviceLibrary
msg += runInfo; msg += runInfo;
curJobStep.Msg = msg; curJobStep.Msg = msg;
recyMark = true; recyMark = true;
CommonVar.server.Ready(TargetPlace, ""); Context.server.Ready(TargetPlace, "");
} }
} }
} }
...@@ -171,9 +171,9 @@ namespace DeviceLibrary ...@@ -171,9 +171,9 @@ namespace DeviceLibrary
} }
else if (curJobStep.IsStep(EXECUTE_STEP.P5_WAIT_SHELF_IN_AGV)) 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) if (recyMark)
{ {
...@@ -182,12 +182,13 @@ namespace DeviceLibrary ...@@ -182,12 +182,13 @@ namespace DeviceLibrary
curJobStep.Msg = msg; curJobStep.Msg = msg;
return new SendShelfJob(TargetPlace, SettingString.A2, RFID); return new SendShelfJob(TargetPlace, SettingString.A2, RFID);
} }
if (BoxOutJobType.CheckFullTask(RFID)) if (BoxOutJobType.CheckFullTask(RFID,out string tarname))
{ {
runInfo = "料架进入小车完成,无目的地。回收该料架"; runInfo = RFID+"料架进入小车完成,去"+tarname;
msg += runInfo; msg += runInfo;
curJobStep.Msg = msg; curJobStep.Msg = msg;
return new RecycleEmptyShelf(agvPlace, SettingString.A2, true); RequestManager.AgvRemoveRfid(RFID);
return new SendFullShelfJob(TargetPlace,tarname,"",RFID);
} }
else else
{ {
......
...@@ -44,16 +44,16 @@ namespace DeviceLibrary ...@@ -44,16 +44,16 @@ namespace DeviceLibrary
{ {
get get
{ {
int t1 = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(agvPlace)); int t1 = Context.nodeInfo.FindIndex(s => s.Name.Equals(agvPlace));
string from = ""; string from = "";
if (t1 > -1) if (t1 > -1)
from = CommonVar.nodeInfo[t1].AliceName; from = Context.nodeInfo[t1].AliceName;
else else
from = agvPlace; from = agvPlace;
int t2 = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(TargetPlace)); int t2 = Context.nodeInfo.FindIndex(s => s.Name.Equals(TargetPlace));
string to = ""; string to = "";
if (t2 > -1) if (t2 > -1)
to = CommonVar.nodeInfo[t2].AliceName; to = Context.nodeInfo[t2].AliceName;
else else
to = TargetPlace; to = TargetPlace;
return string.Format("取{5}料串任务[RFID={4}]: {0}[目的地={1}][任务名称={2}][任务状态={3}]", runInfo, to, CurTaskName, CurTaskState, RFID, isFullShelf ? "满" : "空"); return string.Format("取{5}料串任务[RFID={4}]: {0}[目的地={1}][任务名称={2}][任务状态={3}]", runInfo, to, CurTaskName, CurTaskState, RFID, isFullShelf ? "满" : "空");
...@@ -64,16 +64,16 @@ namespace DeviceLibrary ...@@ -64,16 +64,16 @@ namespace DeviceLibrary
private string GetShowInfo() 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 = ""; string from = "";
if (t1 > -1) if (t1 > -1)
from = CommonVar.nodeInfo[t1].AliceName; from = Context.nodeInfo[t1].AliceName;
else else
from = agvPlace; from = agvPlace;
int t2 = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(TargetPlace)); int t2 = Context.nodeInfo.FindIndex(s => s.Name.Equals(TargetPlace));
string to = ""; string to = "";
if (t2 > -1) if (t2 > -1)
to = CommonVar.nodeInfo[t2].AliceName; to = Context.nodeInfo[t2].AliceName;
else else
to = TargetPlace; to = TargetPlace;
return string.Format("取料串任务: {0} [{1}->{2}]", runInfo, from, to); ; return string.Format("取料串任务: {0} [{1}->{2}]", runInfo, from, to); ;
...@@ -88,7 +88,7 @@ namespace DeviceLibrary ...@@ -88,7 +88,7 @@ namespace DeviceLibrary
bool rtn = false; bool rtn = false;
agv.Msg = GetShowInfo(); agv.Msg = GetShowInfo();
agv.RFID = RFID; agv.RFID = RFID;
CurTaskState = CommonVar.GetTakJobState(agv); CurTaskState = Context.GetTakJobState(agv);
if (curJobStep.IsStep(EXECUTE_STEP.P1_NONE)) if (curJobStep.IsStep(EXECUTE_STEP.P1_NONE))
{ {
...@@ -98,7 +98,7 @@ namespace DeviceLibrary ...@@ -98,7 +98,7 @@ namespace DeviceLibrary
runInfo = "待机位/充电位收到任务,开始执行"; runInfo = "待机位/充电位收到任务,开始执行";
msg += runInfo; msg += runInfo;
curJobStep.Msg = msg; curJobStep.Msg = msg;
CommonVar.MoveToNode(agv, TargetPlace); Context.MoveToNode(agv, TargetPlace);
UpdateJobTaskInfo(agv); UpdateJobTaskInfo(agv);
} }
else else
...@@ -108,26 +108,26 @@ namespace DeviceLibrary ...@@ -108,26 +108,26 @@ namespace DeviceLibrary
msg += runInfo; msg += runInfo;
curJobStep.Msg = msg; curJobStep.Msg = msg;
CommonVar.MoveToNode(agv, TargetPlace); Context.MoveToNode(agv, TargetPlace);
UpdateJobTaskInfo(agv); UpdateJobTaskInfo(agv);
} }
} }
else if (curJobStep.IsStep(EXECUTE_STEP.P2_WAIT_REACH_SHELF_PLACE)) 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); curJobStep.ToNextStep(EXECUTE_STEP.P4_WAIT_LINE_RESPONSE);
runInfo = "到达料架处" + TargetPlace + ",并向线体发送出料请求"; runInfo = "到达料架处" + TargetPlace + ",并向线体发送出料请求";
msg += runInfo; msg += runInfo;
curJobStep.Msg = msg; curJobStep.Msg = msg;
CommonVar.server.Ready(TargetPlace, ""); Context.server.Ready(TargetPlace, "");
} }
} }
else if (curJobStep.IsStep(EXECUTE_STEP.P4_WAIT_LINE_RESPONSE)) 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) if (i > -1)
{ {
curJobStep.ToNextStep(EXECUTE_STEP.P5_WAIT_SHELF_IN_AGV); curJobStep.ToNextStep(EXECUTE_STEP.P5_WAIT_SHELF_IN_AGV);
...@@ -158,9 +158,9 @@ namespace DeviceLibrary ...@@ -158,9 +158,9 @@ namespace DeviceLibrary
} }
else if (curJobStep.IsStep(EXECUTE_STEP.P5_WAIT_SHELF_IN_AGV)) 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)) if (FindShelfTarget(agv, out string tarNodeName))
{ {
runInfo = "料串进入小车完成,任务结束"; runInfo = "料串进入小车完成,任务结束";
...@@ -175,7 +175,7 @@ namespace DeviceLibrary ...@@ -175,7 +175,7 @@ namespace DeviceLibrary
msg += runInfo; msg += runInfo;
curJobStep.Msg = msg; curJobStep.Msg = msg;
CommonVar.MoveToNode(agv, SettingString.Standby); Context.MoveToNode(agv, SettingString.Standby);
UpdateJobTaskInfo(agv); UpdateJobTaskInfo(agv);
} }
...@@ -190,7 +190,7 @@ namespace DeviceLibrary ...@@ -190,7 +190,7 @@ namespace DeviceLibrary
} }
else if (curJobStep.IsStep(EXECUTE_STEP.P6_WAIT_REACH_STANDBY)) 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 = "到达待机位并搜索任务"; runInfo = "到达待机位并搜索任务";
msg += runInfo; msg += runInfo;
......
...@@ -38,7 +38,7 @@ namespace DeviceLibrary ...@@ -38,7 +38,7 @@ namespace DeviceLibrary
CurTaskID = agv.CurTaskID; CurTaskID = agv.CurTaskID;
CurTaskName = agv.CurTaskName; CurTaskName = agv.CurTaskName;
//CurTaskState = SettingString.Wait; //CurTaskState = SettingString.Wait;
CurTaskState = CommonVar.GetTakJobState(agv); CurTaskState = Context.GetTakJobState(agv);
} }
/// <summary> /// <summary>
/// 任务重发 /// 任务重发
...@@ -60,7 +60,7 @@ namespace DeviceLibrary ...@@ -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); rtn = agv.AssignTask(CurTaskName);
if (rtn) if (rtn)
......
...@@ -61,16 +61,16 @@ namespace DeviceLibrary ...@@ -61,16 +61,16 @@ namespace DeviceLibrary
{ {
get get
{ {
int t1 = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(agvPlace)); int t1 = Context.nodeInfo.FindIndex(s => s.Name.Equals(agvPlace));
string from = ""; string from = "";
if (t1 > -1) if (t1 > -1)
from = CommonVar.nodeInfo[t1].AliceName; from = Context.nodeInfo[t1].AliceName;
else else
from = agvPlace; from = agvPlace;
int t2 = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(TargetPlace)); int t2 = Context.nodeInfo.FindIndex(s => s.Name.Equals(TargetPlace));
string to = ""; string to = "";
if (t2 > -1) if (t2 > -1)
to = CommonVar.nodeInfo[t2].AliceName; to = Context.nodeInfo[t2].AliceName;
else else
to = TargetPlace; to = TargetPlace;
return string.Format("回收空料架任务:{0} [ShelfType={1}][任务名称={2}][任务状态={3}]", runInfo, shelfType.ToString(),CurTaskName,CurTaskState); return string.Format("回收空料架任务:{0} [ShelfType={1}][任务名称={2}][任务状态={3}]", runInfo, shelfType.ToString(),CurTaskName,CurTaskState);
...@@ -89,7 +89,7 @@ namespace DeviceLibrary ...@@ -89,7 +89,7 @@ namespace DeviceLibrary
bool rtn = false; bool rtn = false;
agv.Msg = runInfo; agv.Msg = runInfo;
CurTaskState = CommonVar.GetTakJobState(agv); CurTaskState = Context.GetTakJobState(agv);
if (curJobStep.IsStep(EXECUTE_STEP.R1_NONE)) if (curJobStep.IsStep(EXECUTE_STEP.R1_NONE))
{ {
if(hasLoad) if(hasLoad)
...@@ -100,7 +100,7 @@ namespace DeviceLibrary ...@@ -100,7 +100,7 @@ namespace DeviceLibrary
runInfo = "车上已有空料架,向" + RecycleStation + "运行"; runInfo = "车上已有空料架,向" + RecycleStation + "运行";
msg += runInfo; msg += runInfo;
curJobStep.Msg = msg; curJobStep.Msg = msg;
CommonVar.MoveToNode(agv, RecycleStation); Context.MoveToNode(agv, RecycleStation);
UpdateJobTaskInfo(agv); UpdateJobTaskInfo(agv);
} }
else else
...@@ -110,7 +110,7 @@ namespace DeviceLibrary ...@@ -110,7 +110,7 @@ namespace DeviceLibrary
msg += runInfo; msg += runInfo;
curJobStep.Msg = msg; curJobStep.Msg = msg;
CommonVar.MoveToNode(agv, SettingString.Standby); Context.MoveToNode(agv, SettingString.Standby);
UpdateJobTaskInfo(agv); UpdateJobTaskInfo(agv);
} }
} }
...@@ -122,7 +122,7 @@ namespace DeviceLibrary ...@@ -122,7 +122,7 @@ namespace DeviceLibrary
runInfo = "待机位/充电位收到任务,开始执行"; runInfo = "待机位/充电位收到任务,开始执行";
msg += runInfo; msg += runInfo;
curJobStep.Msg = msg; curJobStep.Msg = msg;
CommonVar.MoveToNode(agv, TargetPlace); Context.MoveToNode(agv, TargetPlace);
UpdateJobTaskInfo(agv); UpdateJobTaskInfo(agv);
} }
else else
...@@ -132,20 +132,20 @@ namespace DeviceLibrary ...@@ -132,20 +132,20 @@ namespace DeviceLibrary
msg += runInfo; msg += runInfo;
curJobStep.Msg = msg; curJobStep.Msg = msg;
CommonVar.MoveToNode(agv, TargetPlace); Context.MoveToNode(agv, TargetPlace);
UpdateJobTaskInfo(agv); UpdateJobTaskInfo(agv);
} }
} }
} }
else if (curJobStep.IsStep(EXECUTE_STEP.R2_WAIT_REACH_EMPTY_SHELF_PLACE)) 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); curJobStep.ToNextStep(EXECUTE_STEP.R3_WAIT_LINE_RESPONSE);
runInfo = "到达空料架处"+TargetPlace+",向线体发送出料请求"; runInfo = "到达空料架处"+TargetPlace+",向线体发送出料请求";
msg += runInfo; msg += runInfo;
curJobStep.Msg = msg; curJobStep.Msg = msg;
CommonVar.server.Ready(TargetPlace, ""); Context.server.Ready(TargetPlace, "");
} }
} }
else if (curJobStep.IsStep(EXECUTE_STEP.R3_WAIT_LINE_RESPONSE)) else if (curJobStep.IsStep(EXECUTE_STEP.R3_WAIT_LINE_RESPONSE))
...@@ -169,16 +169,16 @@ namespace DeviceLibrary ...@@ -169,16 +169,16 @@ namespace DeviceLibrary
} }
else if (curJobStep.IsStep(EXECUTE_STEP.R4_WAIT_SHELF_IN_AGV)) 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)) if (FindRecycleStation(agv))
{ {
curJobStep.ToNextStep(EXECUTE_STEP.R5_WAIT_REACH_RECYCLE_STATION); curJobStep.ToNextStep(EXECUTE_STEP.R5_WAIT_REACH_RECYCLE_STATION);
runInfo = "空料架进入小车完成,向"+TargetPlace+"运行"; runInfo = "空料架进入小车完成,向"+TargetPlace+"运行";
msg += runInfo; msg += runInfo;
curJobStep.Msg = msg; curJobStep.Msg = msg;
CommonVar.MoveToNode(agv, RecycleStation); Context.MoveToNode(agv, RecycleStation);
UpdateJobTaskInfo(agv); UpdateJobTaskInfo(agv);
} }
else else
...@@ -188,20 +188,20 @@ namespace DeviceLibrary ...@@ -188,20 +188,20 @@ namespace DeviceLibrary
msg += runInfo; msg += runInfo;
curJobStep.Msg = msg; curJobStep.Msg = msg;
CommonVar.MoveToNode(agv, SettingString.Standby); Context.MoveToNode(agv, SettingString.Standby);
UpdateJobTaskInfo(agv); UpdateJobTaskInfo(agv);
} }
} }
} }
else if (curJobStep.IsStep(EXECUTE_STEP.R5_WAIT_REACH_RECYCLE_STATION)) 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); curJobStep.ToNextStep(EXECUTE_STEP.R6_WAIT_RECYCLE_STATION_RESPONSE);
runInfo = "到达"+TargetPlace+",发送入料请求"; runInfo = "到达"+TargetPlace+",发送入料请求";
msg += runInfo; msg += runInfo;
curJobStep.Msg = msg; curJobStep.Msg = msg;
CommonVar.server.Ready(RecycleStation,"00"); Context.server.Ready(RecycleStation,"00");
} }
} }
else if (curJobStep.IsStep(EXECUTE_STEP.R6_WAIT_RECYCLE_STATION_RESPONSE)) else if (curJobStep.IsStep(EXECUTE_STEP.R6_WAIT_RECYCLE_STATION_RESPONSE))
...@@ -225,9 +225,9 @@ namespace DeviceLibrary ...@@ -225,9 +225,9 @@ namespace DeviceLibrary
} }
else if (curJobStep.IsStep(EXECUTE_STEP.R7_WAIT_SHELF_IN_LINE)) 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)); //int i = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(RecycleStation) && s.StateEquals(eNodeStatus.FinishEnter));
//if (i > -1) //if (i > -1)
{ {
...@@ -240,7 +240,7 @@ namespace DeviceLibrary ...@@ -240,7 +240,7 @@ namespace DeviceLibrary
} }
else if (curJobStep.IsStep(EXECUTE_STEP.R8_WAIT_REACH_STANDY)) 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)) if (FindRecycleStation(agv))
{ {
...@@ -248,7 +248,7 @@ namespace DeviceLibrary ...@@ -248,7 +248,7 @@ namespace DeviceLibrary
runInfo = "检测到"+RecycleStation+"需要空料架,向" + RecycleStation + "运行"; runInfo = "检测到"+RecycleStation+"需要空料架,向" + RecycleStation + "运行";
msg += runInfo; msg += runInfo;
curJobStep.Msg = msg; curJobStep.Msg = msg;
CommonVar.MoveToNode(agv, RecycleStation); Context.MoveToNode(agv, RecycleStation);
UpdateJobTaskInfo(agv); UpdateJobTaskInfo(agv);
} }
} }
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
namespace DeviceLibrary namespace DeviceLibrary
{ {
/// <summary> /// <summary>
/// 包装仓任务:将包装料架送往包装仓 /// 将满料架送往线体
/// </summary> /// </summary>
public class SendFullShelfJob : Job public class SendFullShelfJob : Job
{ {
/// <summary> /// <summary>
/// 将包装料架送往包装仓 /// 将满料架送往线体
/// </summary> /// </summary>
/// <param name="agvPlae">agv当前位置</param> /// <param name="agvPlae">agv当前位置</param>
/// <param name="tarPlace">目的地</param> /// <param name="tarPlace">目的地</param>
...@@ -40,16 +40,16 @@ namespace DeviceLibrary ...@@ -40,16 +40,16 @@ namespace DeviceLibrary
{ {
get get
{ {
int t1 = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(agvPlace)); int t1 = Context.nodeInfo.FindIndex(s => s.Name.Equals(agvPlace));
string from = ""; string from = "";
if (t1 > -1) if (t1 > -1)
from = CommonVar.nodeInfo[t1].AliceName; from = Context.nodeInfo[t1].AliceName;
else else
from = agvPlace; from = agvPlace;
int t2 = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(TargetPlace)); int t2 = Context.nodeInfo.FindIndex(s => s.Name.Equals(TargetPlace));
string to = ""; string to = "";
if (t2 > -1) if (t2 > -1)
to = CommonVar.nodeInfo[t2].AliceName; to = Context.nodeInfo[t2].AliceName;
else else
to = TargetPlace; to = TargetPlace;
return string.Format("送满料架任务:{0} [RFID={1}][目的地={2}][任务名称={3}][任务状态={4}]", runInfo, RFID ,to,CurTaskName,CurTaskState); return string.Format("送满料架任务:{0} [RFID={1}][目的地={2}][任务名称={3}][任务状态={4}]", runInfo, RFID ,to,CurTaskName,CurTaskState);
...@@ -68,7 +68,7 @@ namespace DeviceLibrary ...@@ -68,7 +68,7 @@ namespace DeviceLibrary
bool rtn = false; bool rtn = false;
agv.Msg = runInfo; agv.Msg = runInfo;
CurTaskState = CommonVar.GetTakJobState(agv); CurTaskState = Context.GetTakJobState(agv);
if (curJobStep.IsStep(EXECUTE_STEP.P1_NONE)) if (curJobStep.IsStep(EXECUTE_STEP.P1_NONE))
{ {
...@@ -76,13 +76,13 @@ namespace DeviceLibrary ...@@ -76,13 +76,13 @@ namespace DeviceLibrary
runInfo = "收到任务,向线体" + TargetPlace + "运行"; runInfo = "收到任务,向线体" + TargetPlace + "运行";
msg += runInfo; msg += runInfo;
curJobStep.Msg = msg; curJobStep.Msg = msg;
CommonVar.MoveToNode(agv, TargetPlace); Context.MoveToNode(agv, TargetPlace);
UpdateJobTaskInfo(agv); UpdateJobTaskInfo(agv);
} }
else if (curJobStep.IsStep(EXECUTE_STEP.P2_WAIT_REACH_LINE)) 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); curJobStep.ToNextStep(EXECUTE_STEP.P3_WAIT_MANNUAL_OPERATION);
runInfo = "到达线体" + TargetPlace + ",等待卸料"; runInfo = "到达线体" + TargetPlace + ",等待卸料";
...@@ -99,6 +99,7 @@ namespace DeviceLibrary ...@@ -99,6 +99,7 @@ namespace DeviceLibrary
runInfo = "料架上的料在" + TargetPlace + "卸料完成."; runInfo = "料架上的料在" + TargetPlace + "卸料完成.";
msg += runInfo; msg += runInfo;
curJobStep.Msg = msg; curJobStep.Msg = msg;
RequestManager.AgvRemoveRfid(RFID);
return new RecycleEmptyShelf(TargetPlace,"",true); return new RecycleEmptyShelf(TargetPlace,"",true);
} }
} }
......
...@@ -38,16 +38,16 @@ namespace DeviceLibrary ...@@ -38,16 +38,16 @@ namespace DeviceLibrary
{ {
get get
{ {
int t1 = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(agvPlace)); int t1 = Context.nodeInfo.FindIndex(s => s.Name.Equals(agvPlace));
string from = ""; string from = "";
if (t1 > -1) if (t1 > -1)
from = CommonVar.nodeInfo[t1].AliceName; from = Context.nodeInfo[t1].AliceName;
else else
from = agvPlace; from = agvPlace;
int t2 = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(TargetPlace)); int t2 = Context.nodeInfo.FindIndex(s => s.Name.Equals(TargetPlace));
string to = ""; string to = "";
if (t2 > -1) if (t2 > -1)
to = CommonVar.nodeInfo[t2].AliceName; to = Context.nodeInfo[t2].AliceName;
else else
to = TargetPlace; to = TargetPlace;
return string.Format("送料串任务[RFID={4}]:{0} [目的地={1}][任务名称={2}][任务状态={3}]", runInfo, to, CurTaskName, CurTaskState, RFID); return string.Format("送料串任务[RFID={4}]:{0} [目的地={1}][任务名称={2}][任务状态={3}]", runInfo, to, CurTaskName, CurTaskState, RFID);
...@@ -58,16 +58,16 @@ namespace DeviceLibrary ...@@ -58,16 +58,16 @@ namespace DeviceLibrary
private string GetShowInfo() 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 = ""; string from = "";
if (t1 > -1) if (t1 > -1)
from = CommonVar.nodeInfo[t1].AliceName; from = Context.nodeInfo[t1].AliceName;
else else
from = agvPlace; from = agvPlace;
int t2 = CommonVar.nodeInfo.FindIndex(s => s.Name.Equals(TargetPlace)); int t2 = Context.nodeInfo.FindIndex(s => s.Name.Equals(TargetPlace));
string to = ""; string to = "";
if (t2 > -1) if (t2 > -1)
to = CommonVar.nodeInfo[t2].AliceName; to = Context.nodeInfo[t2].AliceName;
else else
to = TargetPlace; to = TargetPlace;
return string.Format("送料串任务: {0} [{1}->{2}]", runInfo, from, to); return string.Format("送料串任务: {0} [{1}->{2}]", runInfo, from, to);
...@@ -82,30 +82,30 @@ namespace DeviceLibrary ...@@ -82,30 +82,30 @@ namespace DeviceLibrary
bool rtn = false; bool rtn = false;
agv.Msg = GetShowInfo(); agv.Msg = GetShowInfo();
agv.RFID = RFID; agv.RFID = RFID;
CurTaskState = CommonVar.GetTakJobState(agv); CurTaskState = Context.GetTakJobState(agv);
if (curJobStep.IsStep(EXECUTE_STEP.P1_NONE)) if (curJobStep.IsStep(EXECUTE_STEP.P1_NONE))
{ {
curJobStep.ToNextStep(EXECUTE_STEP.P2_WAIT_REACH_STATION); curJobStep.ToNextStep(EXECUTE_STEP.P2_WAIT_REACH_STATION);
runInfo = "收到任务,向" + TargetPlace + "运行"; runInfo = "收到任务,向" + TargetPlace + "运行";
msg += runInfo; msg += runInfo;
curJobStep.Msg = msg; curJobStep.Msg = msg;
CommonVar.MoveToNode(agv, TargetPlace); Context.MoveToNode(agv, TargetPlace);
UpdateJobTaskInfo(agv); UpdateJobTaskInfo(agv);
} }
else if (curJobStep.IsStep(EXECUTE_STEP.P2_WAIT_REACH_STATION)) 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); curJobStep.ToNextStep(EXECUTE_STEP.P3_WAIT_STATION_RESPONSE);
runInfo = "到达" + TargetPlace + ",并发送进料请求"; runInfo = "到达" + TargetPlace + ",并发送进料请求";
msg += runInfo; msg += runInfo;
curJobStep.Msg = msg; curJobStep.Msg = msg;
CommonVar.server.Ready(TargetPlace, RFID); Context.server.Ready(TargetPlace, RFID);
} }
} }
else if (curJobStep.IsStep(EXECUTE_STEP.P3_WAIT_STATION_RESPONSE)) 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) if (i > -1)
{ {
curJobStep.ToNextStep(EXECUTE_STEP.P4_WAIT_SHELF_IN_STATION); curJobStep.ToNextStep(EXECUTE_STEP.P4_WAIT_SHELF_IN_STATION);
...@@ -125,9 +125,9 @@ namespace DeviceLibrary ...@@ -125,9 +125,9 @@ namespace DeviceLibrary
} }
else if (curJobStep.IsStep(EXECUTE_STEP.P4_WAIT_SHELF_IN_STATION)) 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); curJobStep.ToNextStep(EXECUTE_STEP.P5_END);
runInfo = "料架进入" + TargetPlace + "完成"; runInfo = "料架进入" + TargetPlace + "完成";
msg += runInfo; msg += runInfo;
......
...@@ -43,7 +43,7 @@ namespace DeviceLibrary ...@@ -43,7 +43,7 @@ namespace DeviceLibrary
bool rtn = false; bool rtn = false;
agv.Msg = RunInfo; agv.Msg = RunInfo;
CurTaskState = CommonVar.GetTakJobState(agv); CurTaskState = Context.GetTakJobState(agv);
if (curJobStep.IsStep(EXECUTE_STEP.NONE)) if (curJobStep.IsStep(EXECUTE_STEP.NONE))
{ {
if (agvPlace.Equals(SettingString.Standby))//在待机位不操作 if (agvPlace.Equals(SettingString.Standby))//在待机位不操作
...@@ -61,14 +61,14 @@ namespace DeviceLibrary ...@@ -61,14 +61,14 @@ namespace DeviceLibrary
msg += runInfo; msg += runInfo;
curJobStep.Msg = msg; curJobStep.Msg = msg;
CommonVar.MoveToNode(agv, SettingString.Standby); Context.MoveToNode(agv, SettingString.Standby);
UpdateJobTaskInfo(agv); UpdateJobTaskInfo(agv);
} }
} }
else if (curJobStep.IsStep(EXECUTE_STEP.WAIT_REACH_STANDBY)) 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); curJobStep.ToNextStep(EXECUTE_STEP.END);
runInfo = "到达待机位"; runInfo = "到达待机位";
...@@ -78,7 +78,7 @@ namespace DeviceLibrary ...@@ -78,7 +78,7 @@ namespace DeviceLibrary
} }
else if (curJobStep.IsStep(EXECUTE_STEP.END)) 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)) if (job != null && !(job is StandyJob))
{ {
runInfo = "在待机位检测到任务,执行任务"; runInfo = "在待机位检测到任务,执行任务";
......
...@@ -17,9 +17,9 @@ namespace DeviceLibrary ...@@ -17,9 +17,9 @@ namespace DeviceLibrary
/// <returns></returns> /// <returns></returns>
public override Job GetNewJob(Agv_Info currentAgv) public override Job GetNewJob(Agv_Info currentAgv)
{ {
if (!CommonVar.CheckCanExecuteMission(currentAgv)) if (!Context.CheckCanExecuteMission(currentAgv))
return null; return null;
if (!CommonVar.CheckAGVStatusNone(currentAgv)) if (!Context.CheckAGVStatusNone(currentAgv))
return null; return null;
string rfid = ""; string rfid = "";
//检查设备1入口需要空料串用作出库 //检查设备1入口需要空料串用作出库
......
...@@ -16,9 +16,9 @@ namespace DeviceLibrary ...@@ -16,9 +16,9 @@ namespace DeviceLibrary
public override Job GetNewJob(Agv_Info agv) public override Job GetNewJob(Agv_Info agv)
{ {
if (!CommonVar.CheckCanExecuteMission(agv)) if (!Context.CheckCanExecuteMission(agv))
return null; return null;
if (!CommonVar.CheckAGVStatusNone(agv)) if (!Context.CheckAGVStatusNone(agv))
return null; return null;
string rfid = ""; string rfid = "";
string checkPlace = SettingString.D2; string checkPlace = SettingString.D2;
...@@ -63,10 +63,16 @@ namespace DeviceLibrary ...@@ -63,10 +63,16 @@ namespace DeviceLibrary
return null; return null;
} }
public static bool CheckFullTask(string rfid = "") public static bool CheckFullTask(string rfid,out string targetName)
{ {
targetName = "";
if (RequestManager.FindFullShelfTarget(rfid, out BoxDestInfo destInfo))
{
targetName = destInfo.data;
return true; return true;
} }
return false;
}
} }
......
...@@ -14,7 +14,7 @@ namespace DeviceLibrary ...@@ -14,7 +14,7 @@ namespace DeviceLibrary
/// <returns></returns> /// <returns></returns>
public override Job GetNewJob(Agv_Info currentAgv) 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 = ""; currentAgv.RFID = "";
return new ChargeJob(currentAgv.Place); return new ChargeJob(currentAgv.Place);
......
...@@ -28,23 +28,23 @@ namespace DeviceLibrary ...@@ -28,23 +28,23 @@ namespace DeviceLibrary
public static bool FindNeedLeave(Agv_Info agv, string nodeName, out string rfid, bool empty) public static bool FindNeedLeave(Agv_Info agv, string nodeName, out string rfid, bool empty)
{ {
rfid = ""; rfid = "";
int nodeIdx = CommonVar.FindNode(nodeName); int nodeIdx = Context.FindNode(nodeName);
if (nodeIdx > -1) if (nodeIdx > -1)
{ {
if (!empty) 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 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 (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; return true;
} }
else 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 ...@@ -63,14 +63,14 @@ namespace DeviceLibrary
/// <returns></returns> /// <returns></returns>
static bool FindNeedEnter(Agv_Info agv, string nodeName, bool empty) static bool FindNeedEnter(Agv_Info agv, string nodeName, bool empty)
{ {
int nodeIdx = CommonVar.FindNode(nodeName); int nodeIdx = Context.FindNode(nodeName);
if (nodeIdx > -1) if (nodeIdx > -1)
{ {
if (empty) 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))); (s.Shelf.Equals(Agv.ClientShelf.Empty) || s.Shelf.Equals(Agv.ClientShelf.None)));
else 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)); s.Shelf.Equals(Agv.ClientShelf.Full));
if (nodeIdx > -1) if (nodeIdx > -1)
return true; return true;
...@@ -94,7 +94,7 @@ namespace DeviceLibrary ...@@ -94,7 +94,7 @@ namespace DeviceLibrary
if (FindNeedEnter(agv, nodeName, empty)) 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 SendShelfJob && (((SendShelfJob)s.CurJob).TargetPlace.Equals(nodeName)) ||
s.CurJob is RecycleEmptyShelf && (((RecycleEmptyShelf)s.CurJob).TargetPlace.Equals(nodeName)) s.CurJob is RecycleEmptyShelf && (((RecycleEmptyShelf)s.CurJob).TargetPlace.Equals(nodeName))
...@@ -122,7 +122,7 @@ namespace DeviceLibrary ...@@ -122,7 +122,7 @@ namespace DeviceLibrary
if (FindNeedLeave(agv, nodeName, out string rfid,empty)) 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 GetShelfJob && (((GetShelfJob)s.CurJob).TargetPlace.Equals(nodeName)))||
(s.CurJob is GetFullShelfJob && (((GetFullShelfJob)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!