Commit 9d07df69 张东亮

二期初版

1 个父辈 34d4da0b
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<add name="AGVDataContext" connectionString="data source=.\Config\agv.db" providerName="System.Data.SQLite.EF6" />
</connectionStrings>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup> </startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
<provider invariantName="System.Data.SQLite" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SQLite.EF6" />
<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite"
type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite"/>
<add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6"
description=".Net Framework Data Provider for SQLite (Entity Framework 6)"
type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
</DbProviderFactories>
</system.data>
<appSettings> <appSettings>
<!--AGV系统标识:NEOTEL-1C,NEOTEL-3D,NEOTEL-3C,NEOTEL-4C,NEOTEL-4D--> <!--AGV系统标识:NEOTEL-1C,NEOTEL-3D,NEOTEL-3C,NEOTEL-4C,NEOTEL-4D-->
<add key="AppIdentity" value="NEOTEL" /> <add key="AppIdentity" value="NEOTEL" />
...@@ -34,6 +61,8 @@ ...@@ -34,6 +61,8 @@
<add key="StandTimeout" value="6" /> <add key="StandTimeout" value="6" />
<!--Agv上下文信息文件名--> <!--Agv上下文信息文件名-->
<add key="FileName_AgvContext" value="AgvContext.json" /> <add key="FileName_AgvContext" value="AgvContext.json" />
<!--3D放置钢网的地方-->
<add key="SteelShelfPos" value="SteelShelfPos" />
</appSettings> </appSettings>
<runtime> <runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
......
...@@ -190,20 +190,10 @@ namespace AGVControl ...@@ -190,20 +190,10 @@ namespace AGVControl
{ {
LogUtil.logBox = this.richTextBox1; LogUtil.logBox = this.richTextBox1;
} }
} this.Invoke(new Action(() =>
private void button1_Click(object sender, EventArgs e)
{ {
//try DeviceLibrary.manager.MissionManager.UpdateDataSource(dgvInfos);
//{ }));
// string missionId = textBox1.Text.Trim();
// MissionInfo missionInfo = MissionManager.GetMission(missionId);
// if(missionInfo != null)
// {
// MissionManager.DeleteById(missionId);
// }
//}
//catch { }
} }
private void dgvInfos_CellContentClick(object sender, DataGridViewCellEventArgs e) private void dgvInfos_CellContentClick(object sender, DataGridViewCellEventArgs e)
......
...@@ -83,12 +83,6 @@ namespace AGVControl ...@@ -83,12 +83,6 @@ namespace AGVControl
{ {
if (!chkBxAuto.Checked && !Agv.JobContext.MissionId.Equals("")) if (!chkBxAuto.Checked && !Agv.JobContext.MissionId.Equals(""))
{ {
//if (MessageBox.Show($"正在执行任务[{Agv.JobContext.MissionId}],切到手动后该任务无法继续执行,确定切到手动状态?", "警告", MessageBoxButtons.YesNo).Equals(
// DialogResult.No))
//{
// chkBxAuto.Checked = true;
// return;
//}
LogUtil.info($"人员切换到手动,{Agv.Name}当前执行的任务为{Agv.JobContext.MissionId}"); LogUtil.info($"人员切换到手动,{Agv.Name}当前执行的任务为{Agv.JobContext.MissionId}");
} }
btnReSendTask.Enabled = chkBxAuto.Checked; btnReSendTask.Enabled = chkBxAuto.Checked;
...@@ -98,8 +92,6 @@ namespace AGVControl ...@@ -98,8 +92,6 @@ namespace AGVControl
{ {
Agv.Auto = false; Agv.Auto = false;
ChargePileManager.StopCharge(Agv); ChargePileManager.StopCharge(Agv);
if (Agv.IsCon)
{
LogUtil.info($"取消自动任务,当前运行信息是:{Agv.Msg}"); LogUtil.info($"取消自动任务,当前运行信息是:{Agv.Msg}");
try try
{ {
...@@ -110,6 +102,12 @@ namespace AGVControl ...@@ -110,6 +102,12 @@ namespace AGVControl
{ {
DeviceLibrary.manager.MissionManager.SetMissionState(Agv.CurJob.JobParam.GetMissionInfo().missionId, DeviceLibrary.service.model.MissionState.中止, out string msg); DeviceLibrary.manager.MissionManager.SetMissionState(Agv.CurJob.JobParam.GetMissionInfo().missionId, DeviceLibrary.service.model.MissionState.中止, out string msg);
LogUtil.info($"{Agv.Name}取消自动任务,并终止当前任务:{Common.JsonHelper.SerializeObject(Agv.CurJob.JobParam.GetMissionInfo())}"); LogUtil.info($"{Agv.Name}取消自动任务,并终止当前任务:{Common.JsonHelper.SerializeObject(Agv.CurJob.JobParam.GetMissionInfo())}");
foreach (string item in Agv.Scope.Remark.Split(','))
{
DeviceLibrary.lift.LiftContext.ResetLiftOccupiedAgv(item);
}
Agv.CurJob = null;
Agv.JobContext = new DeviceLibrary.bean.agv.JobContext();
} }
else else
{ {
...@@ -117,26 +115,21 @@ namespace AGVControl ...@@ -117,26 +115,21 @@ namespace AGVControl
} }
} }
} }
catch { } catch (Exception ex)
foreach (string item in Agv.Scope.Remark.Split(','))
{ {
DeviceLibrary.lift.LiftContext.ResetLiftOccupiedAgv(item); LogUtil.error($"切换到手动异常", ex);
} }
//MiR_API.Del_Mission(Agv);
//添加Init任务 //添加Init任务
AgvTaskManager.AssignMission(Agv, $"{SettingString.Init}"); AgvTaskManager.AssignMission(Agv, $"{SettingString.Init}");
}
Agv.CurJob = null;
Agv.JobContext = new DeviceLibrary.bean.agv.JobContext();
} }
else else
{ {
if (Agv.IsExistShelf) if (Agv.IsExistShelf && Agv.CurJob == null)
{ {
chkBxAuto.Checked = false; LogUtil.error(string.Format("{0} 车上有料车,开启自动模式!", Agv.Name));
MessageBox.Show(this, string.Format("{0} 车上有负载,无法开启自动模式,请先清空小车负载!", Agv.Name), "警告"); MessageBox.Show($"{Agv.Name}车上有料车,开启自动模式!", "警告");
LogUtil.error(string.Format("{0} 车上有负载,无法开启自动模式,请先清空小车负载!", Agv.Name));
return;
} }
Agv.Auto = true; Agv.Auto = true;
} }
......
...@@ -5,11 +5,11 @@ using System.Runtime.InteropServices; ...@@ -5,11 +5,11 @@ using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下 // 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改 // 控制。更改这些特性值可修改
// 与程序集关联的信息。 // 与程序集关联的信息。
[assembly: AssemblyTitle("AGVControl-Fixture")] [assembly: AssemblyTitle("AGVDispatch-Intelligentlogistics")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AGVControl-Fixture")] [assembly: AssemblyProduct("AGVDispatch-Intelligentlogistics")]
[assembly: AssemblyCopyright("Copyright © 2020")] [assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
......
...@@ -125,9 +125,9 @@ ...@@ -125,9 +125,9 @@
<level value="fatal"/> <level value="fatal"/>
<appender-ref ref="TcpKPIO"/> <appender-ref ref="TcpKPIO"/>
</logger> </logger>
<root name="AGVDispatch"> <logger name="AGVDispatch">
<level value="info"/> <level value="info"/>
<appender-ref ref="AGVDispatch"/> <appender-ref ref="AGVDispatch"/>
</root> </logger>
</log4net> </log4net>
</configuration> </configuration>
\ No newline at end of file \ No newline at end of file
...@@ -39,7 +39,6 @@ namespace Common ...@@ -39,7 +39,6 @@ namespace Common
public const string File_AgvInfo = "File_AgvInfo"; public const string File_AgvInfo = "File_AgvInfo";
public const string File_AgvTaskInfo = "File_AgvTaskInfo"; public const string File_AgvTaskInfo = "File_AgvTaskInfo";
public const string File_NodeInfo = "File_NodeInfo"; public const string File_NodeInfo = "File_NodeInfo";
public const string FileName_Missions = "Missions.json";
public const string FileName_AgvContext = "FileName_AgvContext"; public const string FileName_AgvContext = "FileName_AgvContext";
public const string IsUse = "IsUse"; public const string IsUse = "IsUse";
public const string RFID = "RFID"; public const string RFID = "RFID";
......
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SQLite.EF6" />
<add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
<remove invariant="System.Data.SQLite" /><add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /></DbProviderFactories>
</system.data>
</configuration>
\ No newline at end of file \ No newline at end of file
...@@ -144,7 +144,7 @@ namespace DeviceLibrary ...@@ -144,7 +144,7 @@ namespace DeviceLibrary
return null; return null;
if (job != null) if (job != null)
{ {
log.Debug(agv_Info.Name + " GetJob OK " + job.ToString()); //log.Debug(agv_Info.Name + " GetJob OK " + job.ToString());
return job; return job;
} }
} }
...@@ -163,7 +163,6 @@ namespace DeviceLibrary ...@@ -163,7 +163,6 @@ namespace DeviceLibrary
AgvInfo agv = AGVManager.agvInfo[i]; AgvInfo agv = AGVManager.agvInfo[i];
if (!agv.IsCon) continue; //AGV网络连接 if (!agv.IsCon) continue; //AGV网络连接
if (!AGVManager.agvInfo[i].Auto) continue; //AGV是否可用 if (!AGVManager.agvInfo[i].Auto) continue; //AGV是否可用
//Ready,Pause,Executing,Error //Ready,Pause,Executing,Error
if (AGVManager.agvInfo[i].StateID.Equals(eAGVState.Pause)) if (AGVManager.agvInfo[i].StateID.Equals(eAGVState.Pause))
{ {
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\AGVDispatch\packages\EntityFramework.6.4.4\build\EntityFramework.props" Condition="Exists('..\AGVDispatch\packages\EntityFramework.6.4.4\build\EntityFramework.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
...@@ -12,6 +13,8 @@ ...@@ -12,6 +13,8 @@
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic> <Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
...@@ -31,6 +34,12 @@ ...@@ -31,6 +34,12 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\AGVDispatch\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\AGVDispatch\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL"> <Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\AGVDispatch\packages\log4net.2.0.12\lib\net45\log4net.dll</HintPath> <HintPath>..\AGVDispatch\packages\log4net.2.0.12\lib\net45\log4net.dll</HintPath>
</Reference> </Reference>
...@@ -38,9 +47,22 @@ ...@@ -38,9 +47,22 @@
<Reference Include="RestSharp"> <Reference Include="RestSharp">
<HintPath>.\RestSharp.dll</HintPath> <HintPath>.\RestSharp.dll</HintPath>
</Reference> </Reference>
<Reference Include="SQLite.CodeFirst, Version=1.7.0.34, Culture=neutral, PublicKeyToken=eb96ba0a78d831a7, processorArchitecture=MSIL">
<HintPath>..\AGVDispatch\packages\SQLite.CodeFirst.1.7.0.34\lib\net45\SQLite.CodeFirst.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Data.SQLite, Version=1.0.116.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>..\AGVDispatch\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.116.0\lib\net46\System.Data.SQLite.dll</HintPath>
</Reference>
<Reference Include="System.Data.SQLite.EF6, Version=1.0.116.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>..\AGVDispatch\packages\System.Data.SQLite.EF6.1.0.116.0\lib\net46\System.Data.SQLite.EF6.dll</HintPath>
</Reference>
<Reference Include="System.Data.SQLite.Linq, Version=1.0.116.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>..\AGVDispatch\packages\System.Data.SQLite.Linq.1.0.116.0\lib\net46\System.Data.SQLite.Linq.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.Runtime.Serialization" /> <Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" /> <Reference Include="System.ServiceModel" />
...@@ -65,21 +87,25 @@ ...@@ -65,21 +87,25 @@
<Compile Include="bean\agv\Mir_Error.cs" /> <Compile Include="bean\agv\Mir_Error.cs" />
<Compile Include="bean\agv\Scope.cs" /> <Compile Include="bean\agv\Scope.cs" />
<Compile Include="bean\ChargePiles.cs" /> <Compile Include="bean\ChargePiles.cs" />
<Compile Include="bean\jobType\SteelBackLiftToLinesJobType.cs" />
<Compile Include="bean\jobType\F1LiftC1ToLiftD2JobType.cs" /> <Compile Include="bean\jobType\F1LiftC1ToLiftD2JobType.cs" />
<Compile Include="bean\jobType\F1LiftD2ToLiftC1JobType.cs" /> <Compile Include="bean\jobType\F1LiftD2ToLiftC1JobType.cs" />
<Compile Include="bean\jobType\SteelLineToLiftJobType.cs" />
<Compile Include="bean\jobType\LineToLineJobType.cs" /> <Compile Include="bean\jobType\LineToLineJobType.cs" />
<Compile Include="bean\jobType\RecoveryJobType.cs" /> <Compile Include="bean\jobType\RecoveryJobType.cs" />
<Compile Include="bean\jobType\LineOneToManyJobType.cs" /> <Compile Include="bean\jobType\LineOneToManyJobType.cs" />
<Compile Include="bean\job\ChargeJob.cs" /> <Compile Include="bean\job\ChargeJob.cs" />
<Compile Include="bean\job\F1LiftC1ToLiftD2Job.cs" /> <Compile Include="bean\job\F1LiftC1ToLiftD2Job.cs" />
<Compile Include="bean\job\F1LiftD2ToLiftC1Job.cs" /> <Compile Include="bean\job\F1LiftD2ToLiftC1Job.cs" />
<Compile Include="bean\job\SteelLiftToLinesJob.cs" />
<Compile Include="bean\job\LineOneToManyJob.cs" /> <Compile Include="bean\job\LineOneToManyJob.cs" />
<Compile Include="bean\job\SteelLineToLiftJob.cs" />
<Compile Include="bean\job\LineToLineJob.cs" /> <Compile Include="bean\job\LineToLineJob.cs" />
<Compile Include="bean\job\LiftToLinesJob.cs" /> <Compile Include="bean\job\LiftToLinesJob.cs" />
<Compile Include="bean\job\F1LiftToStoreJob.cs" /> <Compile Include="bean\job\F1LiftToStoreJob.cs" />
<Compile Include="bean\job\LineToLiftJob.cs" /> <Compile Include="bean\job\LineToLiftJob.cs" />
<Compile Include="bean\JobParam.cs" /> <Compile Include="bean\JobParam.cs" />
<Compile Include="bean\jobType\F1LiftToStoreJobType.cs" /> <Compile Include="bean\jobType\BackLiftToLineJobType.cs" />
<Compile Include="bean\jobType\LineToLiftJobType.cs" /> <Compile Include="bean\jobType\LineToLiftJobType.cs" />
<Compile Include="bean\TaskRunState.cs" /> <Compile Include="bean\TaskRunState.cs" />
<Compile Include="bean\jobType\LiftToLinesJobType.cs" /> <Compile Include="bean\jobType\LiftToLinesJobType.cs" />
...@@ -88,6 +114,8 @@ ...@@ -88,6 +114,8 @@
<Compile Include="bean\Node.cs" /> <Compile Include="bean\Node.cs" />
<Compile Include="bean\RunStep.cs" /> <Compile Include="bean\RunStep.cs" />
<Compile Include="Control.cs" /> <Compile Include="Control.cs" />
<Compile Include="db\AGVDataContext.cs" />
<Compile Include="db\JobContextInfo.cs" />
<Compile Include="lift\ClientStatus.cs" /> <Compile Include="lift\ClientStatus.cs" />
<Compile Include="lift\LiftContext.cs" /> <Compile Include="lift\LiftContext.cs" />
<Compile Include="lift\LiftInfo.cs" /> <Compile Include="lift\LiftInfo.cs" />
...@@ -148,7 +176,19 @@ ...@@ -148,7 +176,19 @@
</Content> </Content>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="App.config" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\AGVDispatch\packages\EntityFramework.6.4.4\build\EntityFramework.props')" Text="$([System.String]::Format('$(ErrorText)', '..\AGVDispatch\packages\EntityFramework.6.4.4\build\EntityFramework.props'))" />
<Error Condition="!Exists('..\AGVDispatch\packages\EntityFramework.6.4.4\build\EntityFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\AGVDispatch\packages\EntityFramework.6.4.4\build\EntityFramework.targets'))" />
<Error Condition="!Exists('..\AGVDispatch\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.116.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\AGVDispatch\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.116.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets'))" />
</Target>
<Import Project="..\AGVDispatch\packages\EntityFramework.6.4.4\build\EntityFramework.targets" Condition="Exists('..\AGVDispatch\packages\EntityFramework.6.4.4\build\EntityFramework.targets')" />
<Import Project="..\AGVDispatch\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.116.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets" Condition="Exists('..\AGVDispatch\packages\Stub.System.Data.SQLite.Core.NetFramework.1.0.116.0\build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets')" />
</Project> </Project>
\ No newline at end of file \ No newline at end of file
...@@ -34,7 +34,10 @@ namespace DeviceLibrary.bean ...@@ -34,7 +34,10 @@ namespace DeviceLibrary.bean
{ {
missionInfo = value; missionInfo = value;
} }
/// <summary>
/// 存放钢网料架的节点
/// </summary>
public Node SteelShelfNode { get; set; }
/// <summary> /// <summary>
/// 当前目标地点 /// 当前目标地点
/// </summary> /// </summary>
......
...@@ -23,7 +23,6 @@ namespace DeviceLibrary ...@@ -23,7 +23,6 @@ namespace DeviceLibrary
//不为空,且与上一个消息不一样才打印 //不为空,且与上一个消息不一样才打印
if (!value.Equals(msg)) if (!value.Equals(msg))
{ {
AGVManager.SaveAgvContextInfo(step.ToString());
LogUtil.info(string.Format("RunMsg:[{0}][{1}]{2}",Agv,step,value)); LogUtil.info(string.Format("RunMsg:[{0}][{1}]{2}",Agv,step,value));
} }
} }
......
...@@ -71,6 +71,9 @@ namespace DeviceLibrary.bean ...@@ -71,6 +71,9 @@ namespace DeviceLibrary.bean
#region 1F库房到电梯 #region 1F库房到电梯
S1F_StoreToLift_01_ToStore, S1F_StoreToLift_01_ToStore,
S1F_StoreToLift_02_PutShelfOn, S1F_StoreToLift_02_PutShelfOn,
S1F_StoreToLift_ToSteelSrc,
S1F_StoreToLift_PlaySound,
S1F_StoreToLift_WaitConfirm,
S1F_StoreToLift_03_ToLift, S1F_StoreToLift_03_ToLift,
S1F_StoreToLift_04_CheckLiftStatus, S1F_StoreToLift_04_CheckLiftStatus,
...@@ -172,6 +175,7 @@ namespace DeviceLibrary.bean ...@@ -172,6 +175,7 @@ namespace DeviceLibrary.bean
/// </summary> /// </summary>
SD_LiftToLine_14_04_CloseLiftDoor, SD_LiftToLine_14_04_CloseLiftDoor,
#endregion #endregion
SD_LiftToLine_15_ToSteelShelfOff,
/// <summary> /// <summary>
/// 料车无需返回,直接结束 /// 料车无需返回,直接结束
/// </summary> /// </summary>
......
...@@ -624,6 +624,7 @@ namespace DeviceLibrary ...@@ -624,6 +624,7 @@ namespace DeviceLibrary
if(!JobContext.Equals(jobContext)) if(!JobContext.Equals(jobContext))
{ {
JobContext = jobContext; JobContext = jobContext;
AGVManager.SaveJobContext(this);
} }
} }
} }
......
...@@ -173,13 +173,31 @@ namespace DeviceLibrary ...@@ -173,13 +173,31 @@ namespace DeviceLibrary
if (JobParam.GetMissionInfo() != null) if (JobParam.GetMissionInfo() != null)
{ {
service.model.ProjectType type = JobParam.GetMissionInfo().projectType; service.model.ProjectType type = JobParam.GetMissionInfo().projectType;
if (type.Equals(service.model.ProjectType.空台车领用) || type.Equals(service.model.ProjectType.空台车归还)) if (type.Equals(service.model.ProjectType.台车领用) || type.Equals(service.model.ProjectType.台车归还)||
type.Equals(service.model.ProjectType.厂内PCBA入库_台车)|| type.Equals(service.model.ProjectType.半成品入库_台车)
|| type.Equals(service.model.ProjectType.PCBA半成品领用_台车))
{ {
return false; return false;
} }
} }
return true; return true;
} }
/// <summary>
/// 是否是指定项目类型
/// </summary>
/// <returns></returns>
protected bool IsProjectType(ProjectType projectType)
{
if (JobParam.GetMissionInfo() != null)
{
service.model.ProjectType type = JobParam.GetMissionInfo().projectType;
if (type.Equals(projectType))
{
return true;
}
}
return false;
}
protected string GetTargetName(Node node) protected string GetTargetName(Node node)
{ {
if (JobParam.GetMissionInfo() != null && JobParam.GetMissionInfo().projectType.Equals(ProjectType.Tray领用)) if (JobParam.GetMissionInfo() != null && JobParam.GetMissionInfo().projectType.Equals(ProjectType.Tray领用))
...@@ -214,7 +232,7 @@ namespace DeviceLibrary ...@@ -214,7 +232,7 @@ namespace DeviceLibrary
/// <param name="missionInfo"></param> /// <param name="missionInfo"></param>
protected void ResetOccupiedAgv(MissionInfo missionInfo) protected void ResetOccupiedAgv(MissionInfo missionInfo)
{ {
missionInfo.ResetOccupied(); MissionManager.SetLiftOccupiedAgv(missionInfo.missionId, string.Empty);
} }
} }
} }
......
...@@ -45,7 +45,7 @@ namespace DeviceLibrary.bean.job ...@@ -45,7 +45,7 @@ namespace DeviceLibrary.bean.job
//上报运输状态 //上报运输状态
manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId, manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId,
service.model.TransportStatus.TypeStr.status, agv.Name, JobParam.SrcNode.Name, service.model.TransportStatus.ModeStr.auto, service.model.TransportStatus.TypeStr.status, agv.Name, JobParam.SrcNode.Name, service.model.TransportStatus.ModeStr.auto,
$"到达{ JobParam.SrcNode.Name }")); $"到达{JobParam.SrcNode.Name}"));
runInfo = $"到达{JobParam.SrcNode.AliceName},等待门开启"; runInfo = $"到达{JobParam.SrcNode.AliceName},等待门开启";
JobRunStep.Msg = runInfo; JobRunStep.Msg = runInfo;
...@@ -124,7 +124,7 @@ namespace DeviceLibrary.bean.job ...@@ -124,7 +124,7 @@ namespace DeviceLibrary.bean.job
//上报位置 //上报位置
manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId, manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId,
service.model.TransportStatus.TypeStr.status, agv.Name, JobParam.CurTargetNode.Name, service.model.TransportStatus.ModeStr.auto, service.model.TransportStatus.TypeStr.status, agv.Name, JobParam.CurTargetNode.Name, service.model.TransportStatus.ModeStr.auto,
$"到达{ JobParam.CurTargetNode.Name }")); $"到达{JobParam.CurTargetNode.Name}"));
} }
} }
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_08_UpdateLocation)) else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_08_UpdateLocation))
...@@ -152,7 +152,7 @@ namespace DeviceLibrary.bean.job ...@@ -152,7 +152,7 @@ namespace DeviceLibrary.bean.job
JobRunStep.Msg = runInfo; JobRunStep.Msg = runInfo;
manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId, manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId,
service.model.TransportStatus.TypeStr.status, agv.Name, JobParam.CurTargetNode.Name, service.model.TransportStatus.ModeStr.agvButton, service.model.TransportStatus.TypeStr.status, agv.Name, JobParam.CurTargetNode.Name, service.model.TransportStatus.ModeStr.agvButton,
$"卸货{ JobParam.CurTargetNode.Name }")); $"卸货{JobParam.CurTargetNode.Name}"));
//重置确认信息 //重置确认信息
JobParam.CurTargetNode.ExtendEquip.Reset(); JobParam.CurTargetNode.ExtendEquip.Reset();
StopSound(agv); StopSound(agv);
...@@ -162,7 +162,7 @@ namespace DeviceLibrary.bean.job ...@@ -162,7 +162,7 @@ namespace DeviceLibrary.bean.job
//报警,$"等待{JobParam.CurTargetNode.AliceName}的人员确认超时{timeoutval}分" //报警,$"等待{JobParam.CurTargetNode.AliceName}的人员确认超时{timeoutval}分"
manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId, manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId,
service.model.TransportStatus.TypeStr.error, agv.Name, JobParam.CurTargetNode.Name, service.model.TransportStatus.ModeStr.agvButton, service.model.TransportStatus.TypeStr.error, agv.Name, JobParam.CurTargetNode.Name, service.model.TransportStatus.ModeStr.agvButton,
$"等待{ JobParam.CurTargetNode.Name }确认超时{timeoutval}分")); $"等待{JobParam.CurTargetNode.Name}确认超时{timeoutval}分"));
} }
} }
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_10_CheckNextLine)) else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_10_CheckNextLine))
...@@ -192,10 +192,7 @@ namespace DeviceLibrary.bean.job ...@@ -192,10 +192,7 @@ namespace DeviceLibrary.bean.job
else if (JobParam.GetMissionInfo() != null && !JobParam.GetMissionInfo().needBack) else if (JobParam.GetMissionInfo() != null && !JobParam.GetMissionInfo().needBack)
{ {
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_15_TakeShelfOff); JobRunStep.ToNextStep(RunStep.SD_LiftToLine_15_TakeShelfOff);
runInfo = $"{JobParam.CurTargetNode.AliceName}是最后一个线体,分发结束,料车无需返回,准备卸车"; runInfo = $"{JobParam.CurTargetNode.AliceName}是最后一个线体,料车无需返回,准备卸车";
//任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.完成, out string msg);
AllocateTask(agv, SettingString.TakeShelfOff); AllocateTask(agv, SettingString.TakeShelfOff);
JobRunStep.Msg = runInfo; JobRunStep.Msg = runInfo;
} }
...@@ -211,7 +208,7 @@ namespace DeviceLibrary.bean.job ...@@ -211,7 +208,7 @@ namespace DeviceLibrary.bean.job
//上报位置 //上报位置
manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId, manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId,
service.model.TransportStatus.TypeStr.status, agv.Name, JobParam.SrcNode.Name, service.model.TransportStatus.ModeStr.auto, service.model.TransportStatus.TypeStr.status, agv.Name, JobParam.SrcNode.Name, service.model.TransportStatus.ModeStr.auto,
$"到达{ JobParam.SrcNode.Name }")); $"到达{JobParam.SrcNode.Name}"));
//请求电梯 //请求电梯
lift.LiftContext.Request(JobParam.GetMissionInfo(), agv, true); lift.LiftContext.Request(JobParam.GetMissionInfo(), agv, true);
System.Threading.Thread.Sleep(1000); System.Threading.Thread.Sleep(1000);
...@@ -361,6 +358,22 @@ namespace DeviceLibrary.bean.job ...@@ -361,6 +358,22 @@ namespace DeviceLibrary.bean.job
} }
#endregion #endregion
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_15_TakeShelfOff))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.END);
runInfo = $"在{JobParam.CurTargetNode.AliceName}卸下料车完成";
JobRunStep.Msg = runInfo;
//任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.完成, out string msg);
//上报状态
manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId,
service.model.TransportStatus.TypeStr.status, agv.Name, JobParam.CurTargetNode.Name, service.model.TransportStatus.ModeStr.auto,
$"卸车"));
}
}
else if (JobRunStep.IsStep(RunStep.END)) else if (JobRunStep.IsStep(RunStep.END))
{ {
JobRunStep.EndJob(); JobRunStep.EndJob();
......
...@@ -68,18 +68,31 @@ namespace DeviceLibrary.bean.job ...@@ -68,18 +68,31 @@ namespace DeviceLibrary.bean.job
{ {
if (agv.TaskRunState.CheckTaskFinished(agv.Name)) if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{ {
if(NeedConfirm())
{
JobRunStep.ToNextStep(RunStep.SD_LineToLine_04_PlaySound); JobRunStep.ToNextStep(RunStep.SD_LineToLine_04_PlaySound);
//确认按钮生效 //确认按钮生效
JobParam.CurTargetNode.ExtendEquip.AllowConfirm(); JobParam.CurTargetNode.ExtendEquip.AllowConfirm();
//上报运输状态 //上报运输状态
manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId, manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId,
service.model.TransportStatus.TypeStr.status, agv.Name, agv.Place.Name, service.model.TransportStatus.ModeStr.auto, service.model.TransportStatus.TypeStr.status, agv.Name, agv.Place.Name, service.model.TransportStatus.ModeStr.auto,
$"到达{ JobParam.CurTargetNode.Name }")); $"到达{JobParam.CurTargetNode.Name}"));
runInfo = $"到达{JobParam.CurTargetNode.AliceName}的放料点"; runInfo = $"到达{JobParam.CurTargetNode.AliceName}的放料点";
JobRunStep.Msg = runInfo; JobRunStep.Msg = runInfo;
PlaySound(agv); PlaySound(agv);
} }
else
{
JobRunStep.ToNextStep(RunStep.SD_LineToLine_04_WaitConfirm);
//上报运输状态
manager.UploadManager.UploadTransportStatus(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId,
service.model.TransportStatus.TypeStr.status, agv.Name, agv.Place.Name, service.model.TransportStatus.ModeStr.auto,
$"到达{JobParam.CurTargetNode.Name}"));
runInfo = $"到达{JobParam.CurTargetNode.AliceName}的放料点";
JobRunStep.Msg = runInfo;
}
}
} }
else if (JobRunStep.IsStep(RunStep.SD_LineToLine_04_PlaySound)) else if (JobRunStep.IsStep(RunStep.SD_LineToLine_04_PlaySound))
{ {
...@@ -87,6 +100,9 @@ namespace DeviceLibrary.bean.job ...@@ -87,6 +100,9 @@ namespace DeviceLibrary.bean.job
{ {
if (OpManager.WaitConfirm.Line(JobParam.CurTargetNode)) if (OpManager.WaitConfirm.Line(JobParam.CurTargetNode))
{ {
JobRunStep.ToNextStep(RunStep.SD_LineToLine_04_WaitConfirm);
runInfo = $"在{JobParam.CurTargetNode.AliceName}确认完成";
JobRunStep.Msg = runInfo;
StopSound(agv); StopSound(agv);
} }
else if (JobRunStep.IsTimeOut(WaitTimeOut, out double timeoutval)) else if (JobRunStep.IsTimeOut(WaitTimeOut, out double timeoutval))
......
...@@ -6,7 +6,7 @@ namespace DeviceLibrary.bean.jobType ...@@ -6,7 +6,7 @@ namespace DeviceLibrary.bean.jobType
/// <summary> /// <summary>
/// 1F,电梯到库房 /// 1F,电梯到库房
/// </summary> /// </summary>
public class F1LiftToStoreJobType : JobType public class BackLiftToLineJobType : JobType
{ {
public override Job GetNewJob(AgvInfo agv) public override Job GetNewJob(AgvInfo agv)
{ {
...@@ -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.HasEmptyShelfInLift(out string liftname, out lift.LiftStatus lift)) if(agv.HasEmptyShelfInLift(out string liftname, out lift.LiftStatus lift))//agv.Scope.Floor.Equals(1) &&
{ {
service.model.MissionInfo missionInfo = manager.MissionManager.GetF1ReceiveMission(agv); service.model.MissionInfo missionInfo = manager.MissionManager.GetF1ReceiveMission(agv);
if(missionInfo!=null) if(missionInfo!=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.HasEmptyShelfInLift(out string liftname, out lift.LiftStatus lift)) if ( agv.HasEmptyShelfInLift(out string liftname, out lift.LiftStatus lift))//!agv.Scope.Floor.Equals(1) &&
{ {
service.model.MissionInfo missionInfo = manager.MissionManager.GetReceiveMission(agv); service.model.MissionInfo missionInfo = manager.MissionManager.GetReceiveMission(agv);
if (missionInfo != null) if (missionInfo != null)
......
...@@ -10,38 +10,13 @@ namespace DeviceLibrary.bean.jobType ...@@ -10,38 +10,13 @@ namespace DeviceLibrary.bean.jobType
/// <summary> /// <summary>
/// 从线体取料并送入电梯内 /// 从线体取料并送入电梯内
/// </summary> /// </summary>
public class LineToLiftJobType:JobType public class LineToLiftJobType : JobType
{ {
public override Job GetNewJob(AgvInfo agv) public override Job GetNewJob(AgvInfo agv)
{ {
if (!agv.IsIdle()) if (!agv.IsIdle())
return null; return null;
else if (agv.Scope.Floor.Equals(1)) service.model.MissionInfo missionInfo = manager.MissionManager.GetLineToLiftMission(agv, out string liftname);
{
service.model.MissionInfo missionInfo = manager.MissionManager.GetF1DeliverMission(agv,out string liftname);
if(missionInfo!=null)
{
Node src = manager.NodeManager.GetNode(missionInfo.sourcePoint, NodeType.Node);
Node dest = manager.NodeManager.GetNode(liftname, NodeType.Lift);
if (src == null)
{
Common.LogUtil.error($"无法生成任务,起始点不存在:{missionInfo.sourcePoint}");
return null;
}
if (dest == null)
{
Common.LogUtil.error($"无法生成任务,电梯不存在:{liftname}");
return null;
}
JobParam jobParam = new JobParam(src, dest, null, missionInfo);
//任务状态变更
MissionManager.SetMissionState(missionInfo.missionId, service.model.MissionState.已分配, out string msg);
return new LineToLiftJob(jobParam);
}
}
else
{
service.model.MissionInfo missionInfo = manager.MissionManager.GetFinishedDeliverMission(agv, out string liftname);
if (missionInfo != null) if (missionInfo != null)
{ {
Node src = manager.NodeManager.GetNode(missionInfo.sourcePoint, NodeType.Node); Node src = manager.NodeManager.GetNode(missionInfo.sourcePoint, NodeType.Node);
...@@ -61,7 +36,6 @@ namespace DeviceLibrary.bean.jobType ...@@ -61,7 +36,6 @@ namespace DeviceLibrary.bean.jobType
MissionManager.SetMissionState(missionInfo.missionId, service.model.MissionState.已分配, out string msg); MissionManager.SetMissionState(missionInfo.missionId, service.model.MissionState.已分配, out string msg);
return new LineToLiftJob(jobParam); return new LineToLiftJob(jobParam);
} }
}
return null; return null;
} }
} }
......
...@@ -20,9 +20,11 @@ namespace DeviceLibrary.bean.jobType ...@@ -20,9 +20,11 @@ namespace DeviceLibrary.bean.jobType
service.model.MissionInfo missionInfo = manager.MissionManager.GetMission(agv.JobContext.MissionId); service.model.MissionInfo missionInfo = manager.MissionManager.GetMission(agv.JobContext.MissionId);
if (missionInfo != null) if (missionInfo != null)
{ {
agv.TaskRunState = new TaskRunState();
agv.TaskRunState.Task = agv.JobContext.AgvTask;
Type type = Type.GetType(agv.JobContext.JobFullName); // 通过类名获取同名类 Type type = Type.GetType(agv.JobContext.JobFullName); // 通过类名获取同名类
Job job = (Job)System.Activator.CreateInstance(type); Job job = (Job)System.Activator.CreateInstance(type);
job.JobParam= agv.JobContext.JobParam; job.JobParam = agv.JobContext.JobParam;
job.JobParam.CurTargetNode = manager.NodeManager.GetNodeByName(agv.JobContext.JobParam.CurTargetNode.Name); job.JobParam.CurTargetNode = manager.NodeManager.GetNodeByName(agv.JobContext.JobParam.CurTargetNode.Name);
job.JobParam.SetMissionInfo(missionInfo); job.JobParam.SetMissionInfo(missionInfo);
job.Task = agv.JobContext.AgvTask; job.Task = agv.JobContext.AgvTask;
......
using Common;
using DeviceLibrary.bean.job;
using DeviceLibrary.manager;
namespace DeviceLibrary.bean.jobType
{
/// <summary>
/// 钢网项目-钢网领用-返回楼层,电梯
/// </summary>
public class SteelBackLiftToLinesJobType : JobType
{
public override Job GetNewJob(AgvInfo agv)
{
if (!agv.IsIdle())
return null;
else
{
if(agv.HasEmptyShelfInLift(out string liftname, out lift.LiftStatus lift))
{
service.model.MissionInfo missionInfo = manager.MissionManager.GetSteelReceiveMission(agv);
if(missionInfo!=null)
{
Node src = manager.NodeManager.GetNode(liftname, NodeType.Lift);
string[] dests = lift.destinationPoint.Split(',');
Node dest = manager.NodeManager.GetNode(dests.Length > 1 ? dests[0] : lift.destinationPoint, NodeType.Node);
JobParam jobParam = new JobParam(src, dest,null,missionInfo);
jobParam.SteelShelfNode = NodeManager.GetNode(Common.AppConfigHelper.GetValue("SteelShelfPos"), NodeType.Node);
if (dests.Length > 1)
{
for (int i = 1; i < dests.Length; i++)
{
Node node = manager.NodeManager.GetNode(dests[i], NodeType.Node);
if (node != null)
jobParam.TargetNodes.Add(node);
else
{
LogUtil.error($"无法生成任务,因不存在的节点:{dests[i]}");
return null;
}
}
}
return new SteelLiftToLinesJob(jobParam);
}
}
}
return null;
}
}
}
using DeviceLibrary.manager;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary.bean.jobType
{
/// <summary>
/// 钢网入库,从线体取料并送入电梯内
/// </summary>
public class SteelLineToLiftJobType : JobType
{
public override Job GetNewJob(AgvInfo agv)
{
if (!agv.IsIdle())
return null;
service.model.MissionInfo missionInfo = manager.MissionManager.GetSteelLineToLiftMission(agv, out string liftname);
if (missionInfo != null)
{
Node src = manager.NodeManager.GetNode(missionInfo.sourcePoint, NodeType.Node);
Node dest = manager.NodeManager.GetNode(liftname, NodeType.Lift);
if (src == null)
{
Common.LogUtil.error($"无法生成任务,起始点不存在:{missionInfo.sourcePoint}");
return null;
}
if (dest == null)
{
Common.LogUtil.error($"无法生成任务,电梯不存在:{liftname}");
return null;
}
JobParam jobParam = new JobParam(src, dest, null, missionInfo);
jobParam.SteelShelfNode = NodeManager.GetNode(Common.AppConfigHelper.GetValue("SteelShelfPos"), NodeType.Node);
//任务状态变更
MissionManager.SetMissionState(missionInfo.missionId, service.model.MissionState.已分配, out string msg);
return new SteelLineToLiftJob(jobParam);
}
return null;
}
}
}
using System.Data.SQLite;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SQLite.CodeFirst;
using DeviceLibrary.service.model;
namespace DeviceLibrary
{
internal class AGVDataContext:DbContext
{
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
var sqliteConnectionInitializer = new SqliteCreateDatabaseIfNotExists<AGVDataContext>(modelBuilder);
Database.SetInitializer(sqliteConnectionInitializer);
}
public AGVDataContext() :base("AGVDataContext") { }////配置使用的连接名
public DbSet<MissionInfo> MissionInfos { get; set; }
public DbSet<JobContextInfo> JobContextInfos { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
[Table("job_context")]
internal class JobContextInfo
{
public string agvName { get; set; }
[Key]
public string ip { get; set; }
public string jobContext { get; set; }
}
}
文件属性发生变化
...@@ -62,7 +62,7 @@ namespace DeviceLibrary ...@@ -62,7 +62,7 @@ namespace DeviceLibrary
{ {
jobTypes = new List<JobType>(); jobTypes = new List<JobType>();
jobTypes.Add(new LiftToLinesJobType()); jobTypes.Add(new LiftToLinesJobType());
jobTypes.Add(new F1LiftToStoreJobType()); jobTypes.Add(new BackLiftToLineJobType());
jobTypes.Add(new LineToLiftJobType()); jobTypes.Add(new LineToLiftJobType());
//jobTypes.Add(new LineToLineJobType()); //jobTypes.Add(new LineToLineJobType());
jobTypes.Add(new LineOneToManyJobType()); jobTypes.Add(new LineOneToManyJobType());
...@@ -102,84 +102,65 @@ namespace DeviceLibrary ...@@ -102,84 +102,65 @@ namespace DeviceLibrary
sysClients.Add(item.Client); sysClients.Add(item.Client);
} }
} }
static object writeobj = new object(); /// <summary>
public static void SaveAgvContextInfo(string step) /// 获取agv运行上下文
/// </summary>
/// <param name="agv"></param>
/// <returns></returns>
public static JobContext GetJobContext(AgvInfo agv)
{ {
string filePath = CONFIG_PATH + AppConfigHelper.GetValue(SettingString.FileName_AgvContext); using (AGVDataContext ctx = new AGVDataContext())
if (Monitor.TryEnter(writeobj, 500))
{ {
try var info = ctx.JobContextInfos.Where(s => s.ip.Equals(agv.IP)).FirstOrDefault();
if (info != null)
{ {
List<JobContext> context = new List<JobContext>(); try
foreach (AgvInfo item in agvInfo)
{ {
context.Add(item.JobContext); return JsonHelper.DeserializeJsonToObject<JobContext>(info.jobContext);
} }
string json = JsonHelper.SerializeObject(context); catch
if (File.Exists(filePath))
{ {
if (true) return new JobContext();
{
string backUpPath = filePath + ".back";
File.Copy(filePath, backUpPath, true);
} }
File.Delete(filePath);
} }
File.WriteAllText(filePath, json);
LogUtil.debug("保存Agv上下文信息到[" + filePath + $"]:{json}");
} }
catch (Exception ex) return null;
{
LogUtil.error("保存Agv上下文信息到[" + filePath + "]失败:", ex);
} }
finally /// <summary>
/// 保存agv运行上下文
/// </summary>
/// <param name="agv"></param>
public static void SaveJobContext(AgvInfo agv)
{ {
Monitor.Exit(writeobj); using (AGVDataContext ctx = new AGVDataContext())
} {
var info = ctx.JobContextInfos.Where(s => s.ip.Equals(agv.IP)).FirstOrDefault();
if (info != null)
{
info.jobContext = JsonHelper.SerializeObject(agv.JobContext);
} }
else else
{ {
LogUtil.error("SaveAgvContextInfo timeout:" + step); info = new JobContextInfo();
info.agvName = agv.Name;
info.ip = agv.IP;
info.jobContext = JsonHelper.SerializeObject(agv.JobContext);
ctx.JobContextInfos.Add(info);
} }
ctx.SaveChangesAsync();
}
} }
static void ReadAgvContextInfo(List<AgvInfo> agvInfos) static void ReadAgvContextInfo(List<AgvInfo> agvInfos)
{ {
string filePath = CONFIG_PATH + AppConfigHelper.GetValue(SettingString.FileName_AgvContext);
List<JobContext> agvs = new List<JobContext>();
try try
{ {
string json = "";
bool configchanged = false;
if (File.Exists(filePath))
{
json = File.ReadAllText(filePath);
if (!string.IsNullOrEmpty(json))
{
agvs = JsonHelper.DeserializeJsonToList<JobContext>(json);
if (agvs == null)
{
return;
}
else
{
foreach (AgvInfo agv in agvInfos) foreach (AgvInfo agv in agvInfos)
{ {
JobContext info = agvs.Find(s => agv.Name.Equals(s.Name)); if(!agv.Auto)
if (info == null) continue;
{
LogUtil.info($"{agv.Name}配置文件发生变化,不使用Agv上下文信息");
configchanged = true;
break;
}
}
if (!configchanged)
{
bean.jobType.RecoveryJobType recoveryJobType = new RecoveryJobType(); bean.jobType.RecoveryJobType recoveryJobType = new RecoveryJobType();
foreach (AgvInfo agv in agvInfos) JobContext info = GetJobContext(agv);
{
JobContext info = agvs.Find(s => s.Name.Equals(agv.Name));
if (info != null) if (info != null)
{ {
agv.SetJobContext(info); agv.SetJobContext(info);
...@@ -188,18 +169,13 @@ namespace DeviceLibrary ...@@ -188,18 +169,13 @@ namespace DeviceLibrary
{ {
agv.CurJob = null; agv.CurJob = null;
} }
LogUtil.info($"读取并使用{agv.Name}上下文信息:{JsonHelper.SerializeObject(info)}");
} }
} }
LogUtil.info("读取并使用Agv上下文信息[" + filePath + "]:" + json);
}
}
}
}
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("读取Agv上下文信息[" + filePath + "]失败:", ex); LogUtil.error("读取Agv上下文信息失败:", ex);
} }
} }
} }
......
...@@ -66,7 +66,7 @@ namespace DeviceLibrary.manager ...@@ -66,7 +66,7 @@ namespace DeviceLibrary.manager
{ {
agvState.state = "执行任务"; agvState.state = "执行任务";
agvState.missionId = item.CurJob.JobParam.GetMissionInfo().missionId; agvState.missionId = item.CurJob.JobParam.GetMissionInfo().missionId;
agvState.remark = item.CurJob.JobParam.GetMissionInfo().Remark; agvState.remark = item.CurJob.JobParam.GetMissionInfo().remark;
} }
else else
agvState.state = "自动"; agvState.state = "自动";
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="EntityFramework" version="6.4.4" targetFramework="net472" />
<package id="log4net" version="2.0.12" targetFramework="net472" /> <package id="log4net" version="2.0.12" targetFramework="net472" />
<package id="SQLite.CodeFirst" version="1.7.0.34" targetFramework="net472" />
<package id="Stub.System.Data.SQLite.Core.NetFramework" version="1.0.116.0" targetFramework="net472" />
<package id="System.Data.SQLite" version="1.0.116.0" targetFramework="net472" />
<package id="System.Data.SQLite.Core" version="1.0.116.0" targetFramework="net472" />
<package id="System.Data.SQLite.EF6" version="1.0.116.0" targetFramework="net472" />
<package id="System.Data.SQLite.Linq" version="1.0.116.0" targetFramework="net472" />
</packages> </packages>
\ No newline at end of file \ No newline at end of file
...@@ -35,7 +35,7 @@ namespace DeviceLibrary ...@@ -35,7 +35,7 @@ namespace DeviceLibrary
result.msg = $"不存在的节点:{createMissionInfo.sourcePoint}"; result.msg = $"不存在的节点:{createMissionInfo.sourcePoint}";
Log.Error(result.msg); Log.Error(result.msg);
} }
else if(!NodeManager.CheckNodes(createMissionInfo.destinationPoint,out string nodenames)) else if (!NodeManager.CheckNodes(createMissionInfo.destinationPoint, out string nodenames))
{ {
result.code = -1; result.code = -1;
result.msg = $"不存在的节点:{nodenames}"; result.msg = $"不存在的节点:{nodenames}";
...@@ -44,14 +44,20 @@ namespace DeviceLibrary ...@@ -44,14 +44,20 @@ namespace DeviceLibrary
else if (!MissionManager.Contains(createMissionInfo)) else if (!MissionManager.Contains(createMissionInfo))
{ {
MissionManager.SetMissionState(createMissionInfo.missionId, MissionState.创建, out string msg); MissionManager.SetMissionState(createMissionInfo.missionId, MissionState.创建, out string msg);
MissionManager.Add(createMissionInfo); bool rtn = MissionManager.AddMission(createMissionInfo);
if (rtn)
Log.Info($"创建任务成功:{s}"); Log.Info($"创建任务成功:{s}");
else
{
result.code = -1;
result.msg = $"创建任务失败,已存在该任务id:{createMissionInfo.missionId}";
Log.Error(result.msg);
}
} }
else else
{ {
result.code = -1; result.code = -1;
result.msg = $"已存在该任务id:{createMissionInfo.missionId}"; result.msg = $"创建任务失败:{createMissionInfo.missionId}";
Log.Error(result.msg); Log.Error(result.msg);
} }
} }
...@@ -92,10 +98,10 @@ namespace DeviceLibrary ...@@ -92,10 +98,10 @@ namespace DeviceLibrary
} }
else else
{ {
if(MissionManager.Contains(deleteMission.missionId)) if (MissionManager.Contains(deleteMission.missionId))
{ {
MissionInfo missionInfo = MissionManager.GetMission(deleteMission.missionId); MissionInfo missionInfo = MissionManager.GetMission(deleteMission.missionId);
if(missionInfo ==null) if (missionInfo == null)
{ {
result.code = -1; result.code = -1;
result.msg = $"不存在该任务id:{deleteMission.missionId}"; result.msg = $"不存在该任务id:{deleteMission.missionId}";
...@@ -105,15 +111,15 @@ namespace DeviceLibrary ...@@ -105,15 +111,15 @@ namespace DeviceLibrary
{ {
if (missionInfo.state.Equals(MissionState.创建)) if (missionInfo.state.Equals(MissionState.创建))
{ {
MissionManager.SetMissionState(missionInfo.missionId, MissionState.取消,out string msg); MissionManager.SetMissionState(missionInfo.missionId, MissionState.取消, out string msg);
result.msg = msg; result.msg = msg;
} }
else else
{ {
AgvInfo agvInfo=AGVManager.agvInfo.Find(k=>k.JobContext.MissionId == deleteMission.missionId); AgvInfo agvInfo = AGVManager.agvInfo.Find(k => k.JobContext.MissionId == deleteMission.missionId);
if(agvInfo == null) if (agvInfo == null)
{ {
MissionManager.SetMissionState(missionInfo.missionId, MissionState.中止,out string msg); MissionManager.SetMissionState(missionInfo.missionId, MissionState.中止, out string msg);
result.msg = msg; result.msg = msg;
} }
else else
...@@ -153,7 +159,7 @@ namespace DeviceLibrary ...@@ -153,7 +159,7 @@ namespace DeviceLibrary
else else
{ {
Node node = NodeManager.GetNode(operationFinish.line); Node node = NodeManager.GetNode(operationFinish.line);
if(node==null) if (node == null)
{ {
result.code = -1; result.code = -1;
result.msg = $"不存在的线体名:{operationFinish.line}"; result.msg = $"不存在的线体名:{operationFinish.line}";
...@@ -164,7 +170,7 @@ namespace DeviceLibrary ...@@ -164,7 +170,7 @@ namespace DeviceLibrary
//if(node.ExtendEquip.CanConfirm) //if(node.ExtendEquip.CanConfirm)
{ {
Log.Info($"线体[{operationFinish.line}]被调用确认接口"); Log.Info($"线体[{operationFinish.line}]被调用确认接口");
node.ExtendEquip.ApiConfirmSig=true; node.ExtendEquip.ApiConfirmSig = true;
} }
//else //else
//{ //{
......
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
...@@ -9,11 +11,13 @@ namespace DeviceLibrary.service.model ...@@ -9,11 +11,13 @@ namespace DeviceLibrary.service.model
/// <summary> /// <summary>
/// 任务信息 /// 任务信息
/// </summary> /// </summary>
[Table("mission_info")]
public class MissionInfo public class MissionInfo
{ {
/// <summary> /// <summary>
/// 任务编号 /// 任务编号
/// </summary> /// </summary>
[Key]
public string missionId { get; set; } public string missionId { get; set; }
/// <summary> /// <summary>
/// 任务状态 /// 任务状态
...@@ -127,22 +131,19 @@ namespace DeviceLibrary.service.model ...@@ -127,22 +131,19 @@ namespace DeviceLibrary.service.model
public void SetState(MissionState missionState) public void SetState(MissionState missionState)
{ {
state = missionState; state = missionState;
remark = $"{projectType.ToString()},{state.ToString()}";
} }
public string Remark { get; set; } public string remark { get; set; }
public void SetAgvOccupied(string agvname) public void SetAgvOccupied(string agvname)
{ {
occupiedAgv = agvname; occupiedAgv = agvname;
} }
public void ResetOccupied()
{
occupiedAgv = string.Empty;
}
public static bool IsFinishedProdcut(MissionInfo missionInfo) public static bool IsFinishedProdcut(MissionInfo missionInfo)
{ {
if (missionInfo == null) if (missionInfo == null)
return false; return false;
return missionInfo.projectType.Equals(ProjectType.成品入库); return missionInfo.projectType.Equals(ProjectType.移远成品入库);
} }
} }
...@@ -216,13 +217,58 @@ namespace DeviceLibrary.service.model ...@@ -216,13 +217,58 @@ namespace DeviceLibrary.service.model
包材领用, 包材领用,
半成品领用, 半成品领用,
静电箱领用, 静电箱领用,
空台车领用, /// <summary>
空台车归还, /// 二期
/// </summary>
台车领用,
/// <summary>
/// 二期
/// </summary>
台车归还,
包材归还, 包材归还,
/// <summary>
/// 二期
/// </summary>
成品入库, 成品入库,
半成品入库, 半成品入库,
半成品入库与领用, 半成品入库与领用,
垃圾清运, 垃圾清运,
治具领用 治具领用,
/// <summary>
/// 二期项目
/// </summary>
钢网入库,
/// <summary>
/// 二期
/// </summary>
钢网领用,
/// <summary>
/// 二期
/// </summary>
厂内PCBA入库_台车,
/// <summary>
/// 二期
/// </summary>
移远半成品入库,
/// <summary>
/// 二期
/// </summary>
移远成品入库,
/// <summary>
/// 二期
/// </summary>
Tray_静电箱回收,
/// <summary>
/// 二期
/// </summary>
半成品入库_台车,
/// <summary>
/// 二期
/// </summary>
PCBA半成品领用_料架,
/// <summary>
/// 二期
/// </summary>
PCBA半成品领用_台车,
} }
} }
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!