Commit 2f437d22 张东亮

init

0 个父辈
正在显示 148 个修改的文件 包含 15693 行增加0 行删除
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
project.fragment.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
#*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E1C3207D-C67D-4B46-A9DB-D182F2074CCB}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>AGVDispatch</RootNamespace>
<AssemblyName>AGVDispatch-Intelligentlogistics</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>line.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="AsaPL.AgvClient">
<HintPath>..\AgvClient\bin\Debug\AsaPL.AgvClient.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>packages\log4net.2.0.12\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=3.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>dll\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="RestSharp, Version=106.11.4.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
<HintPath>..\packages\RestSharp.106.11.4\lib\net452\RestSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.ServiceModel.Activation" />
<Reference Include="System.ServiceModel.Web" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="FrmMain.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmMain.Designer.cs">
<DependentUpon>FrmMain.cs</DependentUpon>
</Compile>
<Compile Include="Manual.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Manual.designer.cs">
<DependentUpon>Manual.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="FrmMain.resx">
<DependentUpon>FrmMain.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Manual.resx">
<DependentUpon>Manual.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="log4net.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<None Include="gray2.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="green1.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Content Include="line.ico" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AGV_UI\AGV_UI.csproj">
<Project>{c6d2fc09-46f7-4ec5-a877-15ea06342e4f}</Project>
<Name>AGV_UI</Name>
</ProjectReference>
<ProjectReference Include="..\Common\Common.csproj">
<Project>{bafeafe6-04e2-48ee-8845-bfc7ea3e3c21}</Project>
<Name>Common</Name>
</ProjectReference>
<ProjectReference Include="..\DeviceLibrary\DeviceLibrary.csproj">
<Project>{f9619f07-15f1-4e59-a383-3871952bbb79}</Project>
<Name>DeviceLibrary</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file \ No newline at end of file

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30523.141
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AGVDispatch", "AGVDispatch.csproj", "{E1C3207D-C67D-4B46-A9DB-D182F2074CCB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AGV_UI", "..\AGV_UI\AGV_UI.csproj", "{C6D2FC09-46F7-4EC5-A877-15EA06342E4F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "..\Common\Common.csproj", "{BAFEAFE6-04E2-48EE-8845-BFC7EA3E3C21}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeviceLibrary", "..\DeviceLibrary\DeviceLibrary.csproj", "{F9619F07-15F1-4E59-A383-3871952BBB79}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E1C3207D-C67D-4B46-A9DB-D182F2074CCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E1C3207D-C67D-4B46-A9DB-D182F2074CCB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E1C3207D-C67D-4B46-A9DB-D182F2074CCB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E1C3207D-C67D-4B46-A9DB-D182F2074CCB}.Release|Any CPU.Build.0 = Release|Any CPU
{C6D2FC09-46F7-4EC5-A877-15EA06342E4F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C6D2FC09-46F7-4EC5-A877-15EA06342E4F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C6D2FC09-46F7-4EC5-A877-15EA06342E4F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C6D2FC09-46F7-4EC5-A877-15EA06342E4F}.Release|Any CPU.Build.0 = Release|Any CPU
{BAFEAFE6-04E2-48EE-8845-BFC7EA3E3C21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BAFEAFE6-04E2-48EE-8845-BFC7EA3E3C21}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BAFEAFE6-04E2-48EE-8845-BFC7EA3E3C21}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BAFEAFE6-04E2-48EE-8845-BFC7EA3E3C21}.Release|Any CPU.Build.0 = Release|Any CPU
{F9619F07-15F1-4E59-A383-3871952BBB79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F9619F07-15F1-4E59-A383-3871952BBB79}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F9619F07-15F1-4E59-A383-3871952BBB79}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F9619F07-15F1-4E59-A383-3871952BBB79}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C1E472B0-A5EF-4CB3-834D-7643344D6FD9}
EndGlobalSection
EndGlobal
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C6D2FC09-46F7-4EC5-A877-15EA06342E4F}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>AGV_UI</RootNamespace>
<AssemblyName>AGV_UI</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Status.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Status.Designer.cs">
<DependentUpon>Status.cs</DependentUpon>
</Compile>
<Compile Include="Manager.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Service Include="{94E38DFF-614B-4cbd-B67C-F211BB35CE8B}" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Status.resx">
<DependentUpon>Status.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Content Include="battery\charge.png" />
<None Include="state\Unknown.png" />
<None Include="state\ready.png" />
<None Include="state\pause.png" />
<None Include="state\manual.png" />
<None Include="state\Executing.png" />
<None Include="state\Error.png" />
<None Include="state\emergency.png" />
<None Include="state\Aborted.png" />
<None Include="task.png" />
<None Include="online.png" />
<None Include="battery\full.png" />
<None Include="battery\common.png" />
<None Include="battery\low.png" />
<None Include="offline.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<appSettings>
<!--AGV系统标识:NEOTEL-1C,NEOTEL-3D,NEOTEL-3C,NEOTEL-4C,NEOTEL-4D-->
<add key="AppIdentity" value="NEOTEL" />
<!--ITS服务器-->
<add key="ITS" value="10.85.17.233" />
<!--AGV服务端口-->
<add key="WebService" value="http://127.0.0.1:8888" />
<!--云仓服务器端口-->
<add key="http.server" value="http://10.85.199.25/myproject/" />
<!--ITS智能物流系统服务端口-->
<add key="ITS_UpdateLine" value="http://127.0.0.1:8888" />
<!--电梯控制系统系统服务端口-->
<add key="Lift_GetState" value="http://127.0.0.1:8888/lift/status" />
<!--日志配置文件名-->
<add key="log4net_configname" value="log4net.config" />
<!--agv配置文件名-->
<add key="File_AgvInfo" value="agvinfos.xml" />
<!--agv任务配置文件名-->
<add key="File_AgvTaskInfo" value="taskinfos.xml" />
<!--点位配置文件名-->
<add key="File_NodeInfo" value="nodeinfos.xml" />
<!--使用到的电梯名配置名-->
<add key="Lift_Names" value="LEFT_D2,LEFT_C1" />
<!--充电最低/最高电量值-->
<add key="ChargeThreshold" value="20,90" />
<!--等待人员操作超时时间(分钟)-->
<add key="WaitTimeout" value="5" />
<!--停留超时异常上报时间(分钟)-->
<add key="StandTimeout" value="6" />
</appSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.12.0" newVersion="2.0.12.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="RestSharp" publicKeyToken="598062e77f915f75" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-106.11.4.0" newVersion="106.11.4.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file \ No newline at end of file
namespace AGVControl
{
partial class FrmMain
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain));
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.DgvNode = new System.Windows.Forms.DataGridView();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel5 = new System.Windows.Forms.TableLayoutPanel();
this.grpUnlock = new System.Windows.Forms.GroupBox();
this.tblLayoutUnlock = new System.Windows.Forms.TableLayoutPanel();
this.dgvInfos = new System.Windows.Forms.DataGridView();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.button1 = new System.Windows.Forms.Button();
this.label12 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.tabControlManual = new System.Windows.Forms.TabControl();
this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.tableLayoutPanel3.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.DgvNode)).BeginInit();
this.tabPage4.SuspendLayout();
this.groupBox1.SuspendLayout();
this.tableLayoutPanel5.SuspendLayout();
this.grpUnlock.SuspendLayout();
this.tblLayoutUnlock.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgvInfos)).BeginInit();
this.tabPage2.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.tabPage3.SuspendLayout();
this.groupBox2.SuspendLayout();
this.tableLayoutPanel4.SuspendLayout();
this.SuspendLayout();
//
// tableLayoutPanel3
//
this.tableLayoutPanel3.ColumnCount = 1;
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel3.Controls.Add(this.tabControl1, 0, 1);
this.tableLayoutPanel3.Controls.Add(this.tableLayoutPanel4, 0, 0);
this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel3.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(2);
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
this.tableLayoutPanel3.RowCount = 2;
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 48.43538F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 51.56462F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel3.Size = new System.Drawing.Size(1215, 735);
this.tableLayoutPanel3.TabIndex = 7;
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage4);
this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(3, 359);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(1209, 373);
this.tabControl1.TabIndex = 7;
this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged);
//
// tabPage1
//
this.tabPage1.Controls.Add(this.tableLayoutPanel2);
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(1201, 347);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "节点状态";
this.tabPage1.UseVisualStyleBackColor = true;
//
// tableLayoutPanel2
//
this.tableLayoutPanel2.ColumnCount = 1;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel2.Controls.Add(this.DgvNode, 0, 0);
this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 3);
this.tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(2);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 1;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(1195, 341);
this.tableLayoutPanel2.TabIndex = 34;
//
// DgvNode
//
this.DgvNode.AllowUserToAddRows = false;
this.DgvNode.AllowUserToDeleteRows = false;
this.DgvNode.AllowUserToResizeColumns = false;
this.DgvNode.AllowUserToResizeRows = false;
this.DgvNode.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.DgvNode.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
this.DgvNode.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.DgvNode.Dock = System.Windows.Forms.DockStyle.Fill;
this.DgvNode.Location = new System.Drawing.Point(3, 3);
this.DgvNode.MultiSelect = false;
this.DgvNode.Name = "DgvNode";
this.DgvNode.ReadOnly = true;
this.DgvNode.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
this.DgvNode.RowHeadersVisible = false;
this.DgvNode.RowHeadersWidth = 50;
this.DgvNode.RowTemplate.Height = 23;
this.DgvNode.Size = new System.Drawing.Size(1189, 335);
this.DgvNode.TabIndex = 1;
this.DgvNode.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.DgvNode_CellClick);
//
// tabPage4
//
this.tabPage4.Controls.Add(this.groupBox1);
this.tabPage4.Location = new System.Drawing.Point(4, 22);
this.tabPage4.Name = "tabPage4";
this.tabPage4.Size = new System.Drawing.Size(1201, 347);
this.tabPage4.TabIndex = 4;
this.tabPage4.Text = "任务信息";
this.tabPage4.UseVisualStyleBackColor = true;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.tableLayoutPanel5);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox1.Font = new System.Drawing.Font("宋体", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox1.Location = new System.Drawing.Point(0, 0);
this.groupBox1.Margin = new System.Windows.Forms.Padding(2);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(2);
this.groupBox1.Size = new System.Drawing.Size(1201, 347);
this.groupBox1.TabIndex = 34;
this.groupBox1.TabStop = false;
//
// tableLayoutPanel5
//
this.tableLayoutPanel5.ColumnCount = 1;
this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel5.Controls.Add(this.grpUnlock, 0, 0);
this.tableLayoutPanel5.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel5.Location = new System.Drawing.Point(2, 19);
this.tableLayoutPanel5.Margin = new System.Windows.Forms.Padding(2);
this.tableLayoutPanel5.Name = "tableLayoutPanel5";
this.tableLayoutPanel5.RowCount = 1;
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 326F));
this.tableLayoutPanel5.Size = new System.Drawing.Size(1197, 326);
this.tableLayoutPanel5.TabIndex = 2;
//
// grpUnlock
//
this.grpUnlock.Controls.Add(this.tblLayoutUnlock);
this.grpUnlock.Dock = System.Windows.Forms.DockStyle.Fill;
this.grpUnlock.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.grpUnlock.Location = new System.Drawing.Point(3, 3);
this.grpUnlock.Name = "grpUnlock";
this.grpUnlock.Size = new System.Drawing.Size(1191, 320);
this.grpUnlock.TabIndex = 4;
this.grpUnlock.TabStop = false;
this.grpUnlock.Text = "任务信息";
//
// tblLayoutUnlock
//
this.tblLayoutUnlock.AutoSize = true;
this.tblLayoutUnlock.ColumnCount = 1;
this.tblLayoutUnlock.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tblLayoutUnlock.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tblLayoutUnlock.Controls.Add(this.dgvInfos, 0, 0);
this.tblLayoutUnlock.Dock = System.Windows.Forms.DockStyle.Fill;
this.tblLayoutUnlock.Location = new System.Drawing.Point(3, 19);
this.tblLayoutUnlock.Name = "tblLayoutUnlock";
this.tblLayoutUnlock.RowCount = 1;
this.tblLayoutUnlock.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tblLayoutUnlock.Size = new System.Drawing.Size(1185, 298);
this.tblLayoutUnlock.TabIndex = 1;
//
// dgvInfos
//
this.dgvInfos.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
this.dgvInfos.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
this.dgvInfos.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvInfos.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvInfos.Location = new System.Drawing.Point(3, 3);
this.dgvInfos.Name = "dgvInfos";
this.dgvInfos.ReadOnly = true;
this.dgvInfos.RowHeadersVisible = false;
this.dgvInfos.RowTemplate.Height = 23;
this.dgvInfos.Size = new System.Drawing.Size(1179, 292);
this.dgvInfos.TabIndex = 0;
//
// tabPage2
//
this.tabPage2.Controls.Add(this.tableLayoutPanel1);
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(1201, 347);
this.tabPage2.TabIndex = 3;
this.tabPage2.Text = "日志";
this.tabPage2.UseVisualStyleBackColor = true;
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 1;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.Controls.Add(this.richTextBox1, 0, 0);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 3);
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(2);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 1;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(1195, 341);
this.tableLayoutPanel1.TabIndex = 6;
//
// richTextBox1
//
this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.richTextBox1.Location = new System.Drawing.Point(3, 3);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(1189, 335);
this.richTextBox1.TabIndex = 7;
this.richTextBox1.Text = "";
//
// tabPage3
//
this.tabPage3.Controls.Add(this.button1);
this.tabPage3.Controls.Add(this.label12);
this.tabPage3.Controls.Add(this.groupBox2);
this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Padding = new System.Windows.Forms.Padding(3);
this.tabPage3.Size = new System.Drawing.Size(1201, 347);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "手动";
this.tabPage3.UseVisualStyleBackColor = true;
//
// button1
//
this.button1.Location = new System.Drawing.Point(300, 71);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 47;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label12
//
this.label12.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(224)))), ((int)(((byte)(192)))));
this.label12.Dock = System.Windows.Forms.DockStyle.Left;
this.label12.Location = new System.Drawing.Point(3, 3);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(250, 341);
this.label12.TabIndex = 46;
this.label12.Text = "说明:\r\n·小车/任务状态:\r\n Wait=已发送任务,还未获取到最新状态\r\n Executing=正在执行任务\r\n None=空闲状态\r\n " +
" Done=任务完成\r\n Aborted=任务中止\r\n Unknown=软件获取小车状态失败\r\n\r\n";
//
// groupBox2
//
this.groupBox2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
this.groupBox2.Controls.Add(this.tabControlManual);
this.groupBox2.Dock = System.Windows.Forms.DockStyle.Right;
this.groupBox2.Location = new System.Drawing.Point(770, 3);
this.groupBox2.Margin = new System.Windows.Forms.Padding(2);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Padding = new System.Windows.Forms.Padding(2);
this.groupBox2.Size = new System.Drawing.Size(428, 341);
this.groupBox2.TabIndex = 32;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "小车操作";
//
// tabControlManual
//
this.tabControlManual.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControlManual.Location = new System.Drawing.Point(2, 16);
this.tabControlManual.Name = "tabControlManual";
this.tabControlManual.SelectedIndex = 0;
this.tabControlManual.Size = new System.Drawing.Size(424, 323);
this.tabControlManual.TabIndex = 0;
//
// tableLayoutPanel4
//
this.tableLayoutPanel4.ColumnCount = 1;
this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel4.Controls.Add(this.flowLayoutPanel1, 0, 0);
this.tableLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel4.Location = new System.Drawing.Point(2, 2);
this.tableLayoutPanel4.Margin = new System.Windows.Forms.Padding(2);
this.tableLayoutPanel4.Name = "tableLayoutPanel4";
this.tableLayoutPanel4.RowCount = 1;
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 352F));
this.tableLayoutPanel4.Size = new System.Drawing.Size(1211, 352);
this.tableLayoutPanel4.TabIndex = 8;
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 3);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(1205, 346);
this.flowLayoutPanel1.TabIndex = 0;
//
// FrmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1215, 735);
this.Controls.Add(this.tableLayoutPanel3);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.Name = "FrmMain";
this.Text = "AGV调度系统";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmMain_FormClosing);
this.Load += new System.EventHandler(this.FrmMain_Load);
this.tableLayoutPanel3.ResumeLayout(false);
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tableLayoutPanel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.DgvNode)).EndInit();
this.tabPage4.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.tableLayoutPanel5.ResumeLayout(false);
this.grpUnlock.ResumeLayout(false);
this.grpUnlock.PerformLayout();
this.tblLayoutUnlock.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgvInfos)).EndInit();
this.tabPage2.ResumeLayout(false);
this.tableLayoutPanel1.ResumeLayout(false);
this.tabPage3.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.tableLayoutPanel4.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel4;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.TabControl tabControlManual;
private System.Windows.Forms.DataGridView DgvNode;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TabPage tabPage4;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel5;
private System.Windows.Forms.GroupBox grpUnlock;
private System.Windows.Forms.TableLayoutPanel tblLayoutUnlock;
private System.Windows.Forms.DataGridView dgvInfos;
}
}
using System;
using System.CodeDom;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using Common;
using DeviceLibrary;
using DeviceLibrary.manager;
namespace AGVControl
{
public partial class FrmMain : Form
{
private bool exit = false;
private NotifyIcon notify;
private ContextMenuStrip notifyMenu;
private System.Timers.Timer showTimer;
//private string[] agvRunStep;
public FrmMain()
{
InitializeComponent();
showTimer = new System.Timers.Timer();
showTimer.Interval = 5000;
//showTimer.Enabled = true;
showTimer.AutoReset = true;
showTimer.Elapsed += ShowTimer_Elapsed;
showTimer.Start();
LogUtil.logBox = richTextBox1;
}
private void ShowConfig()
{
//agvRunStep = new string[Common.agvInfo.Count];
for (int i = 0; i < AGVManager.agvInfo.Count; i++)
{
MiR_API.Get_IO_Status(AGVManager.agvInfo[i]);
AGVManager.agvInfo[i].IsExistShelf = AGVManager.agvInfo[i].GetInput(0, 3);
flowLayoutPanel1.Controls.Add(AGVManager.agvInfo[i].StateKanban);
AddForm(AGVManager.agvInfo[i].Name, new Manual(AGVManager.agvInfo[i]));
AGVManager.agvInfo[i].StateKanban.Init(AGVManager.agvInfo[i].Name);
}
NodeManager.InitView(DgvNode);
DeviceLibrary.manager.MissionManager.InitView(dgvInfos);
DeviceLibrary.manager.MissionManager.MissionChangedEvent += FixMissionManager_MissionChangedEvent;
}
private void FixMissionManager_MissionChangedEvent()
{
this.Invoke(new Action(() =>
{
DeviceLibrary.manager.MissionManager.UpdateDataSource(dgvInfos);
}));
}
private void Server_NodeChanged(Node node)
{
Invoke(new Action(() =>
{
NodeManager.UpdateDataSource(DgvNode);
}));
}
private void Server_NodeOnline(Node node)
{
Invoke(new Action(() =>
{
NodeManager.UpdateDataSource(DgvNode);
}));
}
private void ItemShow_Click(object sender, EventArgs e)
{
Show();
if (WindowState == FormWindowState.Minimized)
WindowState = FormWindowState.Normal;
}
private void ItemExit_Click(object sender, EventArgs e)
{
notify.Dispose();
exit = true;
Close();
}
private void Notify_MouseDoubleClick(object sender, MouseEventArgs e)
{
Show();
if (WindowState == FormWindowState.Minimized)
WindowState = FormWindowState.Normal;
}
private void FrmMain_Load(object sender, EventArgs e)
{
//托盘菜单
notifyMenu = new ContextMenuStrip();
ToolStripMenuItem itemShow = new ToolStripMenuItem("显示(&S)");
itemShow.Click += ItemShow_Click;
ToolStripMenuItem itemExit = new ToolStripMenuItem("退出(&X)");
itemExit.Click += ItemExit_Click;
notifyMenu.Items.Add(itemShow);
notifyMenu.Items.Add(itemExit);
//托盘控件
notify = new NotifyIcon { Icon = Icon, Visible = true, ContextMenuStrip = notifyMenu, Text = Text };
notify.MouseDoubleClick += Notify_MouseDoubleClick;
ShowConfig();
NodeManager.RegisEvent(Server_NodeChanged, Server_NodeOnline);
}
private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
{
if (!exit)
{
e.Cancel = true;
Hide();
}
LogUtil.logBox = null;
//showTimer.Enabled = false;
showTimer.Stop();
NodeManager.UnRegisEvent(Server_NodeChanged, Server_NodeOnline);
}
private void DgvNode_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex == -1) return;
int idx = e.RowIndex;
if (e.ColumnIndex == 0) //调用
{
NodeManager.nodeInfo[idx].IsUse = !NodeManager.nodeInfo[idx].IsUse;
NodeManager.UpdateDataSource(DgvNode);
}
}
bool InShhow = false;
private void ShowTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
//ShowEmptyTask();
if (InShhow)
return;
InShhow = true;
Invoke(new Action(() =>
{
}));
InShhow = false;
}
private void AddForm(string text, Form form)
{
text = text.PadLeft(10, ' ');
TabPage lineTabPage = new TabPage(text);
// lineTabPage.AutoScroll = true;
// lineTabPage.Tag = lineBean;
Panel linePan = new Panel();
linePan.Dock = DockStyle.Fill;
linePan.AutoScroll = true;
lineTabPage.Controls.Add(linePan);
form.FormBorderStyle = FormBorderStyle.None;
form.TopLevel = false;
linePan.Controls.Add(form);
//form.Dock = DockStyle.Fill;
//linePan.Anchor = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Left)));
//form.Anchor = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Left)));
form.Show();
// tabPageList.Add(lineTabPage);
tabControlManual.Controls.Add(lineTabPage);
}
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
if (tabControl1.SelectedIndex == 1)
{
LogUtil.logBox = this.richTextBox1;
}
}
private void dgvInfos_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == 5)
{
if (e.RowIndex == -1)
return;
DeviceLibrary.manager.MissionManager.UpdateDataSource(dgvInfos);
}
}
private void button1_Click(object sender, EventArgs e)
{
HttpManager.UpdateStatusToLift(new DeviceLibrary.lift.ClientStatus() { liftId = "D2", sourceClient = "4D", hasIdleAgv = true });
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAIAEBAAAAEAIABoBAAAJgAAACAgAAABACAAqBAAAI4EAAAoAAAAEAAAACAAAAABACAAAAAAADAE
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA7u7MD+Xtx4Dm7ce25uzHo+ju
xSwAAAAA7e3IDv///wIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA5ubMCubtx9nm7cf/5u3H/+bt
x//m7cf15u3Hyubtx//m7cbL5uzHKejo0QsAAAAAAAAAAAAAAAAAAAAAAAAAAObsx27j68b/hKGZ/4Om
nf/AzbT/5u3H/7vKsf+DqZ7/hKGY/+btx//m7Mfq5+3IKgAAAAAAAAAAAAAAAObsxynn7ce83+bC/2ur
pP940MD/nrGh/9LZuv+XrZ//d8m7/3CgoP/a48n/09vC/9vkwoUAAAAAAAAAAOfryEHo78z75u3H/+Pr
xv9+opj/hrep/7/MtP/m7cf/usuy/5m2tP/s+fr/7/z9/+Pw8v+ttLSWAAAAAP///wXv9duc7fPX/+nv
z//m7cf/yM6y/+btx//m7cf/5u3H/+btx//m7cf/s7mu/8fR0f+/yL//2NjEGgAAAAAAAAAA6OzHN+bt
x/fm7cf/5u3H/9Tbuv/m7cf/5u3H/+btx//m7cf/5u3H/8jOsv/m7cf/5u3H/+ftyCoAAAAAAAAAAAAA
AADm7sQe5uzH+OLoxP9pl5T/c7Ko/6u+qv/m7cf/prqo/3SzqP9ql5T/5u3H/+btxrkAAAAAAAAAAAAA
AACDip8lqLO8kLrFwcnG0Mb+aKWh/3XKu/+arqD/09m6/5qxof9zx7n/aaOf/+fsx7Lf378IAAAAAAAA
AAAAAAAAlJurT9Xh5u/i7vH/7/z9/7HJzP+Ura751N29/+btx//S3Lv/qsGs/67Cq//l7cZjAAAAAAAA
AAAAAAAAAAAAAAAAAACNlqQ4rrfCt9Xi5e2wucSyu8K0aebtx/vm7cf/6vDP/+702f/w9tzY///6LwAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAEtLaRFjaH0xAAAAAAAAAADm68k05e3Hn+Xsx7Pp7cp9+PjxJQAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AAD//wAA+P8AAPAPAADwAwAA4AEAAMABAACAAwAAwAMAAOAD
AADABwAAwA8AAOIPAAD/PwAA//8AAP//AAAoAAAAIAAAAEAAAAABACAAAAAAAIAQAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA///MBebvxT7l7Mdt5e7Hd+XtxmLi68QaAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAOXtyEXm7cbd5u3H/+btx//m7cf/5u3H/+btx/vn7cid5vLMFAAA
AAD///8B5+3KK+juxi3j48YJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADm7cdl5u3H/Obtx//m7cf/5u3H/+btx//m7cf/5u3H/+bt
x//m7cfa6O7GTObsx87m7cf/5u3H/+btx+jn7chUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA5e3GOubtx/zm7cf/5u3H/+btx//m7cf/5u3H/+bt
x//m7cf/5u3H/+btx//m7cf/5u3H/+btx//m7cf/5u3H/+btx/7n7MZe6OzJQufvxyAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADl7ca95u3H/+btx/+6wqz/namc/52p
nP+dqZz/1Ny7/+btx//m7cf/5u3H/+btx//N1bj/namc/52pnP+dqZz/wMiv/+btx//m7cf/5u3H/+bt
x67u7swPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA6OjFFubtx/3m7cf/3uXB/16E
h/9orqb/ZKii/2iupv9yioj/3+bC/9/mwv/a4L//2uC//2yGhv9mrKX/abOq/2OkoP9ggYT/5u3H/+bt
x//m7cf/5u3H/+btx5wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADl7cY65u3H/+bt
x//X3b3/Y5KR/268sv940MD/eNDA/2mAgv/IzrL/yM6y/7S5pf+0uaX/ZoGD/3jQwP940MD/ccO2/2GJ
iv/m7cf/5u3H/+btx//m7cf/5u3H9P//qgMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADn78cg5u3Hm+bt
x9fm7cf/5u3H/9fdvf9jlJL/csW3/3jQwP940MD/c46M/+btx//m7cf/5u3H/+btx/9ujIv/eNDA/3Kt
qf9tk5n/aH2I/8bOwP/M08f/ytLE/6mvpv/CybP/5vLMFAAAAAAAAAAAAAAAAAAAAAAAAAAA5uvJNObt
x/Lm7cf/5u3H/+btx//m7cf/3OPB/2GMjP91yrv/eNDA/3fPv/90jIr/5u3H/+btx//m7cf/5u3H/2yJ
iP9utq7/xdPY/+/8/f/v/P3/7/z9/+/8/f/v/P3/7/z9/664vforK1UGAAAAAAAAAAAAAAAAAAAAAAAA
AADm7sfN7PLV/+btyP/m7cf/5u3H/+btx//m7cf/qLSi/2h1ef9+jor/gZGL/8zTt//m7cf/5u3H/+bt
x//m7cf/xM6y/3qJiP+HkJz/3ens/+/8/f/v/P3/7/z9/+/8/f/E0Nb/hoyazAAAAAAAAAAAAAAAAAAA
AAD///8X/f34bu/z2/7v9Nz/7/Pc/+7z2v/s8dX/5u3H/+btx//m7cf/qa+e/+btx//m7cf/5u3H/+bt
x//m7cf/5u3H/+btx//m7cf/5u3H/+Pqxf+epZ7/qLC1/+/8/f/k8PP/3urs/664vP+7wawxAAAAAAAA
AAAAAAAAAAAAAP///wT19esa6O7L/O7y2P/v89v/5u3I/+btx//m7cf/5u3H/+btx/+pr57/5u3H/+bt
x//m7cf/5u3H/+btx//m7cf/5u3H/+btx//m7cf/5u3H/6+0ov+7wrD/rba5/5+npv+5v6v/zNO3/+bt
x2QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADm7ca05u3H/+btx//m7cf/5u3H/+btx//m7cf/5u3H/9je
vf/m7cf/5u3H/+btx//m7cf/5u3H/+btx//m7cf/5u3H/+btx//m7cf/qa+e/+btx//m7cf/5u3H/+bt
x//m7cf/5ezGbAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAObvxR/m7cjY5u3H/+btx//m7cf/5u3H/+bt
x//i6MT/o6ia/9rgv//a4L//5u3H/+btx//m7cf/5u3H/+btx//l7Mb/2uC//9rgv/+hppn/4+rF/+bt
x//m7cf/5u3H/+btx//n68hBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAObmzArn7chz5u3H/+bt
x//m7cf/4unE/194ff9hi4z/ZZGQ/2WRkP+ClI7/5u3H/+btx//m7cf/5u3H/3iLiv9lkZD/ZZGQ/2GL
jP9lfH//5u3H/+btx//m7cf/5u3G1P///wIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANX/
1Qbm7cfu5u3H/+btx//X3b3/Y5KR/268sv940MD/eNDA/3OOjP/m7cf/5u3H/+btx//m7cf/boyL/3jQ
wP940MD/b7+0/2GJiv/m7cf/5u3H/+btyO/m68cyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAoKEggJi1EIre+po3M07X/zNO1/8rQuP9jkpL/csO3/3jQwP940MD/c46M/+btx//m7cf/5u3H/+bt
x/9ujIv/eNDA/3jQwP9st67/YYmK/+btx//n7sex4+rIJQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAeICRkMnT2fbU4OT/1ODk/9Tg5P/U4OT/097j/2OSlf9jpqH/csK3/227sP9nfYD/p6yd/6es
nf/Fy7H/u8Gq/2R/gv9tuK7/arOr/2mwqf9iiov/5u3H/+fsxTUAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAACdprLG4u7x/9Tf5P/v/P3/7/z9/+/8/f/v/P3/i6Gq/3qaoP96mqD/aIaN/626
p//m7cf/5u3H/+btx//m7cf/pLKi/3eWkf93lpH/d5aR/5CjmP/m7cf57e3IDgAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAHJ5i26krbja5fHz/8XQ1v/c5+v/7/z9/+/8/f/v/P3/7/z9/8nT
1/aqsKf/5u3H/+btx//m7cf/5u3H/+btx//m7cf/5u3H/+btx//m7cf/5u3H/+buxrAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADMzTQqKj5+9h4+f2dvm6v/n8/X/6PT2/+Pv
8f7u+/z/hY2Zpebtx+3m7cf/5u3H/+btx//m7cf/5u3H/+nvzv/q8ND/7fLY//D03v/v89r6+PjuaQAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABVWXA5x9LY8u/8
/f+hqbXZaW2EfnJ2iI9QUHAQ5OzGQ+btx/Tm7cf/5u3H/+btx//m7cj/7vPZ/+7z2v/v89v/7fDT+vD0
4Xb///9LAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AABrboJYeoGSjGJnezQAAAAAAAAAAAAAAAAAAAAA6O7GLeftyMbm7cf/5u3H/+btx//m7cf/5u3H/+rw
0ND5+e53////KQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAObryDPm7Mdu5e7Hd+bu
x2jj7sguAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///////////////////////////8B///+AIf//AAD//gAAD/4A
AAf+AAAH+AAAB/AAAAfgAAAH4AAAD+AAAA/gAAAP8AAAD/wAAA/8AAAf/AAAP+AAAH/gAAB/8AAAf/gA
AP/+LAH//34D////////////////////////////
</value>
</data>
</root>
\ No newline at end of file \ No newline at end of file
namespace AGVControl
{
partial class Manual
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Manual));
this.panelInfo = new System.Windows.Forms.Panel();
this.lblInfo = new System.Windows.Forms.Label();
this.grpBxRunMode = new System.Windows.Forms.GroupBox();
this.chkBxAuto = new System.Windows.Forms.CheckBox();
this.btnReSendTask = new System.Windows.Forms.Button();
this.grpBxOperation = new System.Windows.Forms.GroupBox();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.btnReady = new System.Windows.Forms.Button();
this.btnPause = new System.Windows.Forms.Button();
this.btnClearErr = new System.Windows.Forms.Button();
this.btnAssignTask = new System.Windows.Forms.Button();
this.cmbBxMission = new System.Windows.Forms.ComboBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.pictureBox3 = new System.Windows.Forms.PictureBox();
this.pictureBox4 = new System.Windows.Forms.PictureBox();
this.pictureBox5 = new System.Windows.Forms.PictureBox();
this.pictureBox6 = new System.Windows.Forms.PictureBox();
this.pictureBox7 = new System.Windows.Forms.PictureBox();
this.pictureBox8 = new System.Windows.Forms.PictureBox();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.panelInfo.SuspendLayout();
this.grpBxRunMode.SuspendLayout();
this.grpBxOperation.SuspendLayout();
this.flowLayoutPanel1.SuspendLayout();
this.groupBox1.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.flowLayoutPanel2.SuspendLayout();
this.flowLayoutPanel3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox7)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox8)).BeginInit();
this.SuspendLayout();
//
// panelInfo
//
this.panelInfo.Controls.Add(this.lblInfo);
this.panelInfo.Dock = System.Windows.Forms.DockStyle.Top;
this.panelInfo.Location = new System.Drawing.Point(0, 0);
this.panelInfo.Name = "panelInfo";
this.panelInfo.Size = new System.Drawing.Size(390, 43);
this.panelInfo.TabIndex = 0;
//
// lblInfo
//
this.lblInfo.BackColor = System.Drawing.Color.LightBlue;
this.lblInfo.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblInfo.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblInfo.Location = new System.Drawing.Point(0, 0);
this.lblInfo.Name = "lblInfo";
this.lblInfo.Size = new System.Drawing.Size(390, 43);
this.lblInfo.TabIndex = 0;
this.lblInfo.Text = "#号车";
this.lblInfo.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// grpBxRunMode
//
this.grpBxRunMode.Controls.Add(this.btnAssignTask);
this.grpBxRunMode.Controls.Add(this.chkBxAuto);
this.grpBxRunMode.Controls.Add(this.cmbBxMission);
this.grpBxRunMode.Dock = System.Windows.Forms.DockStyle.Top;
this.grpBxRunMode.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.grpBxRunMode.Location = new System.Drawing.Point(0, 43);
this.grpBxRunMode.Name = "grpBxRunMode";
this.grpBxRunMode.Size = new System.Drawing.Size(390, 50);
this.grpBxRunMode.TabIndex = 1;
this.grpBxRunMode.TabStop = false;
this.grpBxRunMode.Text = "模式选择";
//
// chkBxAuto
//
this.chkBxAuto.AutoSize = true;
this.chkBxAuto.Location = new System.Drawing.Point(6, 20);
this.chkBxAuto.Name = "chkBxAuto";
this.chkBxAuto.Size = new System.Drawing.Size(76, 16);
this.chkBxAuto.TabIndex = 0;
this.chkBxAuto.Text = "自动模式";
this.chkBxAuto.UseVisualStyleBackColor = true;
this.chkBxAuto.CheckedChanged += new System.EventHandler(this.chkBxAuto_CheckedChanged);
//
// btnReSendTask
//
this.btnReSendTask.Location = new System.Drawing.Point(285, 3);
this.btnReSendTask.Name = "btnReSendTask";
this.btnReSendTask.Size = new System.Drawing.Size(88, 61);
this.btnReSendTask.TabIndex = 3;
this.btnReSendTask.Text = "任务重发";
this.btnReSendTask.UseVisualStyleBackColor = true;
this.btnReSendTask.Click += new System.EventHandler(this.btnReSendTask_Click);
//
// grpBxOperation
//
this.grpBxOperation.Controls.Add(this.flowLayoutPanel1);
this.grpBxOperation.Dock = System.Windows.Forms.DockStyle.Top;
this.grpBxOperation.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.grpBxOperation.Location = new System.Drawing.Point(0, 93);
this.grpBxOperation.Name = "grpBxOperation";
this.grpBxOperation.Size = new System.Drawing.Size(390, 92);
this.grpBxOperation.TabIndex = 2;
this.grpBxOperation.TabStop = false;
this.grpBxOperation.Text = "操作";
//
// flowLayoutPanel1
//
this.flowLayoutPanel1.Controls.Add(this.btnReady);
this.flowLayoutPanel1.Controls.Add(this.btnPause);
this.flowLayoutPanel1.Controls.Add(this.btnClearErr);
this.flowLayoutPanel1.Controls.Add(this.btnReSendTask);
this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 17);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(384, 72);
this.flowLayoutPanel1.TabIndex = 0;
//
// btnReady
//
this.btnReady.BackColor = System.Drawing.Color.Lime;
this.btnReady.Location = new System.Drawing.Point(3, 3);
this.btnReady.Name = "btnReady";
this.btnReady.Size = new System.Drawing.Size(88, 61);
this.btnReady.TabIndex = 0;
this.btnReady.Text = "运行";
this.btnReady.UseVisualStyleBackColor = false;
this.btnReady.Click += new System.EventHandler(this.btnReady_Click);
//
// btnPause
//
this.btnPause.BackColor = System.Drawing.Color.Red;
this.btnPause.Location = new System.Drawing.Point(97, 3);
this.btnPause.Name = "btnPause";
this.btnPause.Size = new System.Drawing.Size(88, 61);
this.btnPause.TabIndex = 1;
this.btnPause.Text = "暂停";
this.btnPause.UseVisualStyleBackColor = false;
this.btnPause.Click += new System.EventHandler(this.btnPause_Click);
//
// btnClearErr
//
this.btnClearErr.BackColor = System.Drawing.Color.Yellow;
this.btnClearErr.Location = new System.Drawing.Point(191, 3);
this.btnClearErr.Name = "btnClearErr";
this.btnClearErr.Size = new System.Drawing.Size(88, 61);
this.btnClearErr.TabIndex = 2;
this.btnClearErr.Text = "清除错误";
this.btnClearErr.UseVisualStyleBackColor = false;
this.btnClearErr.Click += new System.EventHandler(this.btnClearErr_Click);
//
// btnAssignTask
//
this.btnAssignTask.Location = new System.Drawing.Point(288, 10);
this.btnAssignTask.Name = "btnAssignTask";
this.btnAssignTask.Size = new System.Drawing.Size(88, 35);
this.btnAssignTask.TabIndex = 1;
this.btnAssignTask.Text = "发任务";
this.btnAssignTask.UseVisualStyleBackColor = true;
this.btnAssignTask.Click += new System.EventHandler(this.btnAssignTask_Click);
//
// cmbBxMission
//
this.cmbBxMission.FormattingEnabled = true;
this.cmbBxMission.Location = new System.Drawing.Point(102, 16);
this.cmbBxMission.Name = "cmbBxMission";
this.cmbBxMission.Size = new System.Drawing.Size(159, 20);
this.cmbBxMission.TabIndex = 0;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.tableLayoutPanel1);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Top;
this.groupBox1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox1.Location = new System.Drawing.Point(0, 185);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(390, 57);
this.groupBox1.TabIndex = 4;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "IO";
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 2;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel2, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel3, 1, 0);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 17);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 1;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(384, 37);
this.tableLayoutPanel1.TabIndex = 0;
//
// flowLayoutPanel2
//
this.flowLayoutPanel2.Controls.Add(this.pictureBox1);
this.flowLayoutPanel2.Controls.Add(this.pictureBox2);
this.flowLayoutPanel2.Controls.Add(this.pictureBox3);
this.flowLayoutPanel2.Controls.Add(this.pictureBox4);
this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel2.Location = new System.Drawing.Point(3, 3);
this.flowLayoutPanel2.Name = "flowLayoutPanel2";
this.flowLayoutPanel2.Size = new System.Drawing.Size(186, 31);
this.flowLayoutPanel2.TabIndex = 0;
//
// flowLayoutPanel3
//
this.flowLayoutPanel3.Controls.Add(this.pictureBox5);
this.flowLayoutPanel3.Controls.Add(this.pictureBox6);
this.flowLayoutPanel3.Controls.Add(this.pictureBox7);
this.flowLayoutPanel3.Controls.Add(this.pictureBox8);
this.flowLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel3.Location = new System.Drawing.Point(195, 3);
this.flowLayoutPanel3.Name = "flowLayoutPanel3";
this.flowLayoutPanel3.Size = new System.Drawing.Size(186, 31);
this.flowLayoutPanel3.TabIndex = 1;
//
// pictureBox1
//
this.pictureBox1.Image = global::AGVDispatch.Properties.Resources.gray2;
this.pictureBox1.Location = new System.Drawing.Point(10, 3);
this.pictureBox1.Margin = new System.Windows.Forms.Padding(10, 3, 3, 3);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(25, 24);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// pictureBox2
//
this.pictureBox2.Image = global::AGVDispatch.Properties.Resources.gray2;
this.pictureBox2.Location = new System.Drawing.Point(48, 3);
this.pictureBox2.Margin = new System.Windows.Forms.Padding(10, 3, 3, 3);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(25, 24);
this.pictureBox2.TabIndex = 1;
this.pictureBox2.TabStop = false;
//
// pictureBox3
//
this.pictureBox3.Image = global::AGVDispatch.Properties.Resources.gray2;
this.pictureBox3.Location = new System.Drawing.Point(86, 3);
this.pictureBox3.Margin = new System.Windows.Forms.Padding(10, 3, 3, 3);
this.pictureBox3.Name = "pictureBox3";
this.pictureBox3.Size = new System.Drawing.Size(25, 24);
this.pictureBox3.TabIndex = 2;
this.pictureBox3.TabStop = false;
//
// pictureBox4
//
this.pictureBox4.Image = global::AGVDispatch.Properties.Resources.gray2;
this.pictureBox4.Location = new System.Drawing.Point(124, 3);
this.pictureBox4.Margin = new System.Windows.Forms.Padding(10, 3, 3, 3);
this.pictureBox4.Name = "pictureBox4";
this.pictureBox4.Size = new System.Drawing.Size(25, 24);
this.pictureBox4.TabIndex = 3;
this.pictureBox4.TabStop = false;
//
// pictureBox5
//
this.pictureBox5.Image = global::AGVDispatch.Properties.Resources.gray2;
this.pictureBox5.Location = new System.Drawing.Point(10, 3);
this.pictureBox5.Margin = new System.Windows.Forms.Padding(10, 3, 3, 3);
this.pictureBox5.Name = "pictureBox5";
this.pictureBox5.Size = new System.Drawing.Size(25, 24);
this.pictureBox5.TabIndex = 1;
this.pictureBox5.TabStop = false;
//
// pictureBox6
//
this.pictureBox6.Image = global::AGVDispatch.Properties.Resources.gray2;
this.pictureBox6.Location = new System.Drawing.Point(48, 3);
this.pictureBox6.Margin = new System.Windows.Forms.Padding(10, 3, 3, 3);
this.pictureBox6.Name = "pictureBox6";
this.pictureBox6.Size = new System.Drawing.Size(25, 24);
this.pictureBox6.TabIndex = 2;
this.pictureBox6.TabStop = false;
//
// pictureBox7
//
this.pictureBox7.Image = global::AGVDispatch.Properties.Resources.gray2;
this.pictureBox7.Location = new System.Drawing.Point(86, 3);
this.pictureBox7.Margin = new System.Windows.Forms.Padding(10, 3, 3, 3);
this.pictureBox7.Name = "pictureBox7";
this.pictureBox7.Size = new System.Drawing.Size(25, 24);
this.pictureBox7.TabIndex = 3;
this.pictureBox7.TabStop = false;
//
// pictureBox8
//
this.pictureBox8.Image = global::AGVDispatch.Properties.Resources.gray2;
this.pictureBox8.Location = new System.Drawing.Point(124, 3);
this.pictureBox8.Margin = new System.Windows.Forms.Padding(10, 3, 3, 3);
this.pictureBox8.Name = "pictureBox8";
this.pictureBox8.Size = new System.Drawing.Size(25, 24);
this.pictureBox8.TabIndex = 4;
this.pictureBox8.TabStop = false;
//
// timer1
//
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// Manual
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(390, 257);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.grpBxOperation);
this.Controls.Add(this.grpBxRunMode);
this.Controls.Add(this.panelInfo);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "Manual";
this.Load += new System.EventHandler(this.Manual_Load);
this.panelInfo.ResumeLayout(false);
this.grpBxRunMode.ResumeLayout(false);
this.grpBxRunMode.PerformLayout();
this.grpBxOperation.ResumeLayout(false);
this.flowLayoutPanel1.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.tableLayoutPanel1.ResumeLayout(false);
this.flowLayoutPanel2.ResumeLayout(false);
this.flowLayoutPanel3.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox7)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox8)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel panelInfo;
private System.Windows.Forms.Label lblInfo;
private System.Windows.Forms.GroupBox grpBxRunMode;
private System.Windows.Forms.CheckBox chkBxAuto;
private System.Windows.Forms.GroupBox grpBxOperation;
private System.Windows.Forms.Button btnReady;
private System.Windows.Forms.Button btnPause;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.Button btnReSendTask;
private System.Windows.Forms.Button btnClearErr;
private System.Windows.Forms.Button btnAssignTask;
private System.Windows.Forms.ComboBox cmbBxMission;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel3;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.PictureBox pictureBox2;
private System.Windows.Forms.PictureBox pictureBox3;
private System.Windows.Forms.PictureBox pictureBox4;
private System.Windows.Forms.PictureBox pictureBox5;
private System.Windows.Forms.PictureBox pictureBox6;
private System.Windows.Forms.PictureBox pictureBox7;
private System.Windows.Forms.PictureBox pictureBox8;
private System.Windows.Forms.Timer timer1;
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DeviceLibrary;
using Common;
namespace AGVControl
{
public partial class Manual : Form
{
public Manual(AgvInfo agv)
{
InitializeComponent();
Agv = agv;
chkBxAuto.Checked = agv.Auto;
btnReSendTask.Enabled = agv.Auto;
btnAssignTask.Enabled = !agv.Auto;
}
AgvInfo Agv;
private bool isIni = false;
private void Manual_Load(object sender, EventArgs e)
{
lblInfo.Text = string.Format("[{0}]", Agv.IP);
AgvTaskManager.InitView(cmbBxMission);
InState.AddRange(new PictureBox[] { pictureBox1, pictureBox2, pictureBox3, pictureBox4 });
OutState.AddRange(new PictureBox[] { pictureBox5, pictureBox6, pictureBox7, pictureBox8 });
timer1.Enabled = true;
isIni = true;
}
List<PictureBox> InState = new List<PictureBox>();
List<PictureBox> OutState = new List<PictureBox>();
private void timer1_Tick(object sender, EventArgs e)
{
if (!IsHandleCreated)
return;
this.Invoke(new Action(() =>
{
try
{
if (Agv.IOStatus[0] != null && Agv.IOStatus[0].Inputs !=null)
{
for (int i = 0; i < Agv.IOStatus[0].Inputs.Length; i++)
{
if (Agv.GetInput(0,i))
{
InState[i].Image = AGVDispatch.Properties.Resources.green1;
}
else
{
InState[i].Image = AGVDispatch.Properties.Resources.gray2;
}
}
}
if(Agv.IOStatus[2]!=null && Agv.IOStatus[2].Inputs!=null)
{
for (int i = 0; i < Agv.IOStatus[2].Inputs.Length; i++)
{
if (Agv.GetInput(2, i))
{
OutState[i].Image = AGVDispatch.Properties.Resources.green1;
}
else
{
OutState[i].Image = AGVDispatch.Properties.Resources.gray2;
}
}
}
}
catch { }
}));
}
private void chkBxAuto_CheckedChanged(object sender, EventArgs e)
{
if (!isIni) return;
this.Invoke(new Action(() =>
{
btnReSendTask.Enabled = chkBxAuto.Checked;
btnAssignTask.Enabled = !chkBxAuto.Checked;
cmbBxMission.Enabled = !chkBxAuto.Checked;
if (!chkBxAuto.Checked)
{
Agv.Auto = false;
ChargePileManager.StopCharge(Agv);
if (Agv.IsCon)
{
LogUtil.info($"取消自动任务,当前任务信息是:{Agv.Msg}");
Agv.CurJob = null;
//MiR_API.Del_Mission(Agv);
//添加Init任务
AgvTaskManager.AssignMission(Agv, SettingString.Init);
}
}
else
{
if (Agv.IsExistShelf)
{
chkBxAuto.Checked = false;
MessageBox.Show(this, string.Format("{0} 车上有负载,无法开启自动模式,请先清空小车负载!", Agv.Name), "警告");
LogUtil.error(string.Format("{0} 车上有负载,无法开启自动模式,请先清空小车负载!", Agv.Name));
return;
}
Agv.Auto = true;
}
}));
}
private void btnReSendTask_Click(object sender, EventArgs e)
{
if (Agv.IsCon)
{
if (Agv.CurJob.Task.Name.Equals(""))
return;
if (MessageBox.Show($"确定对小车重发任务:{Agv.CurJob.Task.AliceName}?", Agv.Name, MessageBoxButtons.YesNo) == DialogResult.No)
return;
System.Threading.Tasks.Task.Factory.StartNew(new Action(() =>
{
MiR_API.Clear_Error(Agv);
System.Threading.Thread.Sleep(1000);
MiR_API.State_Ready(Agv);
Agv.Resend();
LogUtil.info(string.Format("{0} 手动重发任务", Agv.Name));
}));
}
}
private void btnReady_Click(object sender, EventArgs e)
{
if (Agv.IsCon)
{
MiR_API.State_Ready(Agv);
LogUtil.info(string.Format("{0} 手动点击运行", Agv.Name));
}
}
private void btnPause_Click(object sender, EventArgs e)
{
if (Agv.IsCon)
{
MiR_API.State_Pause(Agv);
LogUtil.info(string.Format("{0} 手动点击暂停", Agv.Name));
}
}
private void btnClearErr_Click(object sender, EventArgs e)
{
if (Agv.IsCon)
{
MiR_API.Clear_Error(Agv);
LogUtil.info(string.Format("{0} 手动点击清除按钮", Agv.Name));
}
}
private void btnAssignTask_Click(object sender, EventArgs e)
{
try
{
if (Agv.IsCon)
{
DeviceLibrary.AgvTask task = AgvTaskManager.GetTaskById((cmbBxMission.SelectedItem as DeviceLibrary.AgvTask).Id);
if (task.Type.Equals(TaskType.InOut))
if (MessageBox.Show("确定对小车发送进/出任务?", Agv.Name, MessageBoxButtons.YesNo) == DialogResult.No)
return;
AgvTaskManager.AssignMission(Agv, task.Name);
AgvTask agvTask = cmbBxMission.SelectedItem as AgvTask;
LogUtil.info(string.Format("{0} 手动发任务 [{1}]", Agv.Name, agvTask.Name));
}
}
catch (Exception ex)
{
LogUtil.error("手动发任务 ", ex);
}
}
private void btnExit_Click(object sender, EventArgs e)
{
Close();
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAMAQAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAD/J75P/ye9d/8nvXf/J713/ye9d/8nvXf/J713/ye9d/8nvXf/J713/ye9d/8n
vXf/J713/ye+TgAAAAD/LKwu/yyuaAAAAAAAAAAAAAAAAAAAAAD/LK1d/y2ud/8trnf/LK9cAAAAAAAA
AAAAAAAAAAAAAP8ur2n/LbAt/y2lEf8zn6D/M6Cm/zOfiP8zn4j/M5+I/zWiPwAAAAAAAAAA/zWiP/8z
n4j/M5+I/zOfiP8zoKb/M5+g/y2lEQAAAAD/OJNA/zeUcP85kqb/OJKI/ziSiP84koj/OJKI/ziSiP84
koj/OJKI/ziSiP85kqb/N5Rw/ziTQAAAAAAAAAAA/0CDQP9AhHD/QINAAAAAAAAAAAD/P4FB/0CDkP9A
grT/QINn/0OFFwAAAAD/QINA/0CEcP9Ag0AAAAAAAAAAAP9IdED/R3Rw/0h0QAAAAAAAAAAA/0Z2kf9F
dTD/QnAy/0V1Vf9FdHIAAAAA/0h0QP9HdHD/SHRAAAAAAAAAAAD/TGhA/0tmcP9MaEAAAAAA/01nav9N
aEz/Y3qx/3mM6f9LZDP/TGe1AAAAAP9MaED/S2Zw/0xoQAAAAAAAAAAA/1RYQP9UV3D/VFhAAAAAAP9R
Vy//Ulif/2lfa/9rYbX/UFUw/1NakQAAAAD/VFhA/1RXcP9UWEAAAAAAAAAAAP9YTED/V0tw/1hMQAAA
AAD/gIAC/1lJp/9YS53/V0lJ/1dKlf9XSUYAAAAA/1hMQP9XS3D/WExAAAAAAAAAAAD/YDxA/106bv9d
PkIAAAAAAAAAAAAAAAD/Xj4x/188bgAAAAAAAAAAAAAAAP9dPkL/XTpu/2A8QAAAAAAAAAAA/2IrL/9l
LXL/ZC94/2MviP9jL4j/Yy+I/2MviP9jL4j/Yy+I/2MviP9jL4j/ZS13/2Utcv9kLC4AAAAAAAAAAAAA
AAD/bCFc/2sgiP9rIIj/ayCI/2sgiP9rIIj/ayCI/2sgiP9rIIj/ayCI/2sgiP9sH1oAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAA//8AAP//AAD//wAA//8AAIPBAADgBwAA/n8AAP3/AAD+XwAA/V8AAPy/AAD//wAA8A8AAOAH
AAD//wAA//8AAA==
</value>
</data>
</root>
\ No newline at end of file \ No newline at end of file
using log4net.Config;
using log4net.Util.TypeConverters;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using Common;
using System.Windows.Forms;
using DeviceLibrary;
using DeviceLibrary.manager;
using System.IO;
namespace AGVControl
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
Application.ThreadException += Application_ThreadException;
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
XmlConfigurator.Configure(new FileInfo(AppConfigHelper.GetValue(SettingString.log4net_configname)));
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
//程序只能运行一次
Process current = Process.GetCurrentProcess();
Process[] processes = Process.GetProcessesByName(current.ProcessName);
foreach (Process process in processes)
{
if (process.Id == current.Id) continue; //自己
if (process.MainModule.FileName == current.MainModule.FileName)
{
//显示已打开的程序
Window_API.ShowWindow(process.MainWindowHandle, Window_API.SW_RESTORE);
Window_API.SwitchToThisWindow(process.MainWindowHandle, true);
return;
}
}
LogUtil.info("=====程序开始=====");
NodeManager.InitNodesInfos();
IOManager.Start();
AGVManager.Init();
ChargePileManager.Init();
AGVManager.control = new DeviceLibrary.Control();
AGVManager.control.Start();
AGVManager.server = new AgvServer();
AGVManager.server.Start();
DeviceLibrary.manager.MissionManager.InitMission();
DeviceLibrary.manager.MissionManager.Open();
Application.Run(new FrmMain());
AGVManager.control.Stop();
AGVManager.server.Stop();
IOManager.Stop();
DeviceLibrary.manager.MissionManager.Close();
LogUtil.info("=====程序结束=====\r\n");
}
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
LogUtil.error("CurrentDomain_UnhandledException", (Exception)e.ExceptionObject);
}
private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
{
LogUtil.error("Application_ThreadException", e.Exception);
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("AGVControl-Fixture")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AGVControl-Fixture")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("e1c3207d-c67d-4b46-a9db-d182f2074ccb")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace AGVDispatch.Properties {
using System;
/// <summary>
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// 返回此类使用的缓存的 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AGVDispatch.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
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));
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="gray2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\gray2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="green1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\green1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
\ No newline at end of file \ No newline at end of file
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace AGVDispatch.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AGV_UI
{
public partial class Status : UserControl
{
public Status(string name, List<string> infos)
{
InitializeComponent();
AGVName = name;
missionShow = new Dictionary<string, Control>();
if (infos != null && infos.Count > 0)
{
foreach (var item in infos)
{
missionShow.Add(item, new Label() { Name = item,
Font = new Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))),
AutoSize = true
});
}
flowPanelMissionState.Controls.AddRange(missionShow.Values.ToArray());
}
}
public Status()
{
}
public void Init()
{
foreach (string item in missionShow.Keys)
{
ShowInfo(item, item);
}
SetTitle();
}
public int MaxBattery { get; set; } = 90;
public int MinBattery { get; set; } = 20;
public string AGVName { get; private set; }
#region 私有字段
private Dictionary<string, Control> missionShow;
#endregion
void SetTitle()
{
this.Invoke(new Action(() =>
{
lblName.Text = AGVName;
}
));
}
/// <summary>
/// 设置电量
/// </summary>
/// <param name="curBattery"></param>
/// <param name="isInCharge"></param>
public void SetBattery(int curBattery, bool isInCharge = false)
{
object[] objs = Manager.SetBattery(curBattery, isInCharge, MinBattery, MaxBattery);
try
{
this.Invoke(new Action(() =>
{
lblBattery.Text = objs[0] as string;
lblBattery.Image = objs[1] as Image;
}
));
}
catch { }
}
/// <summary>
/// 设置连接状态
/// </summary>
/// <param name="state"></param>
public void SetConnectState(bool state = false)
{
Image image = Manager.SetConnState(state);
this.Invoke(new Action(() =>
{
picBxConn.Image = image;
}
));
}
public void ShowInfo(string key, string info)
{
this.Invoke(new Action(() =>
{
if (missionShow.ContainsKey(key))
missionShow[key].Text = string.Format("{0}:{1}",key, info);
}
));
}
/// <summary>
/// 设置当前任务名称
/// </summary>
/// <param name="taskName"></param>
public void SetCurTask(string taskName)
{
this.Invoke(new Action(() =>
{
lblTask.Text = taskName;
}
));
}
/// <summary>
/// 设置agv当前状态
/// </summary>
/// <param name="curState"></param>
public void SetCurState(string curState)
{
object[] objs = Manager.SetAGVState(curState);
this.Invoke(new Action(() =>
{
lblAGVState.Text = objs[0] as string;
lblAGVState.Image = objs[1] as Image;
}
));
}
}
}
namespace AGV_UI
{
partial class Status
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Status));
this.panelTitle = new System.Windows.Forms.Panel();
this.lblBattery = new System.Windows.Forms.Label();
this.picBxConn = new System.Windows.Forms.PictureBox();
this.lblName = new System.Windows.Forms.Label();
this.panelAGVState = new System.Windows.Forms.Panel();
this.lblAGVState = new System.Windows.Forms.Label();
this.lblTask = new System.Windows.Forms.Label();
this.flowPanelMissionState = new System.Windows.Forms.FlowLayoutPanel();
this.panelTitle.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picBxConn)).BeginInit();
this.panelAGVState.SuspendLayout();
this.SuspendLayout();
//
// panelTitle
//
this.panelTitle.BackColor = System.Drawing.Color.LightBlue;
this.panelTitle.Controls.Add(this.lblBattery);
this.panelTitle.Controls.Add(this.picBxConn);
this.panelTitle.Controls.Add(this.lblName);
this.panelTitle.Dock = System.Windows.Forms.DockStyle.Top;
this.panelTitle.Location = new System.Drawing.Point(0, 0);
this.panelTitle.Name = "panelTitle";
this.panelTitle.Size = new System.Drawing.Size(287, 47);
this.panelTitle.TabIndex = 0;
//
// lblBattery
//
this.lblBattery.Dock = System.Windows.Forms.DockStyle.Right;
this.lblBattery.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblBattery.ForeColor = System.Drawing.Color.Black;
this.lblBattery.Image = ((System.Drawing.Image)(resources.GetObject("lblBattery.Image")));
this.lblBattery.Location = new System.Drawing.Point(249, 0);
this.lblBattery.Name = "lblBattery";
this.lblBattery.Size = new System.Drawing.Size(38, 47);
this.lblBattery.TabIndex = 2;
this.lblBattery.Text = "0%";
this.lblBattery.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// picBxConn
//
this.picBxConn.Dock = System.Windows.Forms.DockStyle.Left;
this.picBxConn.Image = global::AGV_UI.Properties.Resources.offline;
this.picBxConn.Location = new System.Drawing.Point(0, 0);
this.picBxConn.Name = "picBxConn";
this.picBxConn.Size = new System.Drawing.Size(51, 47);
this.picBxConn.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.picBxConn.TabIndex = 1;
this.picBxConn.TabStop = false;
//
// lblName
//
this.lblName.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblName.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblName.ForeColor = System.Drawing.Color.Black;
this.lblName.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.lblName.Location = new System.Drawing.Point(0, 0);
this.lblName.Name = "lblName";
this.lblName.Size = new System.Drawing.Size(287, 47);
this.lblName.TabIndex = 0;
this.lblName.Text = "#号车";
this.lblName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// panelAGVState
//
this.panelAGVState.Controls.Add(this.lblAGVState);
this.panelAGVState.Controls.Add(this.lblTask);
this.panelAGVState.Dock = System.Windows.Forms.DockStyle.Top;
this.panelAGVState.Location = new System.Drawing.Point(0, 47);
this.panelAGVState.Name = "panelAGVState";
this.panelAGVState.Size = new System.Drawing.Size(287, 50);
this.panelAGVState.TabIndex = 1;
//
// lblAGVState
//
this.lblAGVState.Dock = System.Windows.Forms.DockStyle.Right;
this.lblAGVState.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblAGVState.Image = global::AGV_UI.Properties.Resources.Unknown;
this.lblAGVState.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.lblAGVState.Location = new System.Drawing.Point(160, 0);
this.lblAGVState.Name = "lblAGVState";
this.lblAGVState.Size = new System.Drawing.Size(127, 50);
this.lblAGVState.TabIndex = 1;
this.lblAGVState.Text = "None";
this.lblAGVState.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// lblTask
//
this.lblTask.Dock = System.Windows.Forms.DockStyle.Left;
this.lblTask.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblTask.Image = global::AGV_UI.Properties.Resources.task;
this.lblTask.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.lblTask.Location = new System.Drawing.Point(0, 0);
this.lblTask.Name = "lblTask";
this.lblTask.Size = new System.Drawing.Size(216, 50);
this.lblTask.TabIndex = 0;
this.lblTask.Text = "无任务";
this.lblTask.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// flowPanelMissionState
//
this.flowPanelMissionState.BackColor = System.Drawing.Color.LightBlue;
this.flowPanelMissionState.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowPanelMissionState.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowPanelMissionState.Location = new System.Drawing.Point(0, 97);
this.flowPanelMissionState.Name = "flowPanelMissionState";
this.flowPanelMissionState.Size = new System.Drawing.Size(287, 230);
this.flowPanelMissionState.TabIndex = 2;
//
// Status
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.flowPanelMissionState);
this.Controls.Add(this.panelAGVState);
this.Controls.Add(this.panelTitle);
this.Name = "Status";
this.Size = new System.Drawing.Size(287, 327);
this.panelTitle.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.picBxConn)).EndInit();
this.panelAGVState.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel panelTitle;
private System.Windows.Forms.Label lblName;
private System.Windows.Forms.PictureBox picBxConn;
private System.Windows.Forms.Label lblBattery;
private System.Windows.Forms.Panel panelAGVState;
private System.Windows.Forms.Label lblTask;
private System.Windows.Forms.Label lblAGVState;
private System.Windows.Forms.FlowLayoutPanel flowPanelMissionState;
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="lblBattery.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABGdBTUEAALGPC/xhBQAAAOZJREFUaEPt
ziEOw1AQxNBcrCT3v1NKDA0CxmrBtzRspbfX6XTadd/382ac/1/2rI3z32QPLQfTZehyMF2GLgfTZehy
MF2GLgfTZehyMF2GLgfTZehyMF2GLgfTZehyMF2GLgfTZehyMF2GLgfTZehyMF2GLgfTZehyMF2GLgfT
ZehyMF2GLgfTZehyMF2GLgfTZehyMF2GLgfTZehyMF2GLgfTZehyMF2GLgfTZehyMF2GLgfTZehyMF2G
LgfTZehyMF2GLgfT9XyupxxMl6HLwXQZuhxMl6HLwXQZuhzM6XR61XV9AQQ5qN/xmUs6AAAAAElFTkSu
QmCC
</value>
</data>
</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="AgvServer" type="log4net.Appender.RollingFileAppender">
<file value="logs/AgvServer/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="HttpManager" type="log4net.Appender.RollingFileAppender">
<file value="logs/HttpManager/HttpManager.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="AGVDispatch" type="log4net.Appender.RollingFileAppender">
<file value="logs/AGVDispatch/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="FixtureServices" type="log4net.Appender.RollingFileAppender">
<file value="logs/Service/Records.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<param name="MaxSizeRollBackups" value="30"/>
<!-- 切割最多文件数 -->
<param name="MaximumFileSize" value="50MB"/>
<!-- 每个文件的大小 -->
<param name="RollingStyle" value="Size"/>
<!--param name="StaticLogFileName" value="true"/-->
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date]%-5p %m%n"/>
</layout>
</appender>
<appender name="RunLog" type="log4net.Appender.RollingFileAppender">
<file value="logs/runLog/RunLog.json"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<param name="MaxSizeRollBackups" value="30" />
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%m%n"/>
</layout>
</appender>
<appender name="MiR_API" type="log4net.Appender.RollingFileAppender">
<file value="logs/MiR_API/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="%m%n"/>
</layout>
</appender>
<logger name="MiR_API">
<level value="MiR_API"/>
<appender-ref ref="MiR_API"/>
</logger>
<logger name="RunLog">
<level value="Info"/>
<appender-ref ref="RunLog"/>
</logger>
<logger name="FixtureServices">
<level value="Info"/>
<appender-ref ref="FixtureServices"/>
</logger>
<logger name="AgvServer">
<level value="Info"/>
<appender-ref ref="AgvServer"/>
</logger>
<logger name="HttpManager">
<level value="Info"/>
<appender-ref ref="HttpManager"/>
</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
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.12" targetFramework="net472" />
<package id="RestSharp" version="106.11.4" targetFramework="net461" />
</packages>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C6D2FC09-46F7-4EC5-A877-15EA06342E4F}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>AGV_UI</RootNamespace>
<AssemblyName>AGV_UI</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Status.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Status.Designer.cs">
<DependentUpon>Status.cs</DependentUpon>
</Compile>
<Compile Include="Manager.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Service Include="{94E38DFF-614B-4cbd-B67C-F211BB35CE8B}" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Status.resx">
<DependentUpon>Status.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Content Include="battery\charge.png" />
<None Include="state\Unknown.png" />
<None Include="state\ready.png" />
<None Include="state\pause.png" />
<None Include="state\manual.png" />
<None Include="state\Executing.png" />
<None Include="state\Error.png" />
<None Include="state\emergency.png" />
<None Include="state\Aborted.png" />
<None Include="task.png" />
<None Include="online.png" />
<None Include="battery\full.png" />
<None Include="battery\common.png" />
<None Include="battery\low.png" />
<None Include="offline.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file \ No newline at end of file
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AGV_UI
{
class Manager
{
static ImageList connImageList;
static ImageList batteryImageList;
static ImageList stateImageList;
static string OnLine = "OnLine";
static string OffLine = "OffLine";
static string LowBattery = "LowBattery";
static string CommonBattery = "CommonBattery";
static string FullBattery = "FullBattery";
static string ChargeBattery = "ChargeBattery";
static string Ready = "Ready";
static string Done = "Done";
static string Pause = "Pause";
static string Executing = "Executing";
static string Aborted = "Aborted";
static string Invalid = "Invalid";
static string EmergencyStop = "EmergencyStop";
static string ManualControl = "ManualControl";
static string Error = "Error";
static string UNKNOWN = "UNKNOWN";
static void InitconnImageList()
{
connImageList = new ImageList();
connImageList.ImageSize = new System.Drawing.Size(32, 32);
connImageList.Images.Add(OnLine, Properties.Resources.online);
connImageList.Images.Add(OffLine, Properties.Resources.offline);
}
static void InitbatteryImageList()
{
batteryImageList = new ImageList();
batteryImageList.ImageSize = new System.Drawing.Size(48, 48);
batteryImageList.Images.Add(LowBattery, Properties.Resources.low);
batteryImageList.Images.Add(CommonBattery, Properties.Resources.common);
batteryImageList.Images.Add(FullBattery, Properties.Resources.full);
batteryImageList.Images.Add(ChargeBattery, Properties.Resources.charge);
}
static void InitStateImageList()
{
stateImageList = new ImageList();
stateImageList.ImageSize = new System.Drawing.Size(48, 48);
stateImageList.Images.Add(UNKNOWN, Properties.Resources.Unknown);
stateImageList.Images.Add(Ready, Properties.Resources.ready);
stateImageList.Images.Add(Done, Properties.Resources.ready);
stateImageList.Images.Add(Pause, Properties.Resources.pause);
stateImageList.Images.Add(ManualControl, Properties.Resources.manual);
stateImageList.Images.Add(Executing, Properties.Resources.Executing);
stateImageList.Images.Add(Error, Properties.Resources.Error);
stateImageList.Images.Add(EmergencyStop, Properties.Resources.emergency);
stateImageList.Images.Add(Aborted, Properties.Resources.Aborted);
stateImageList.Images.Add(Invalid, Properties.Resources.Aborted);
}
/// <summary>
/// 设置连接状态
/// </summary>
/// <param name="state"></param>
/// <returns></returns>
public static Image SetConnState(bool state = false)
{
string tmp = state ? OnLine : OffLine;
if (connImageList == null)
InitconnImageList();
return connImageList.Images[tmp];
}
/// <summary>
/// 设置电量
/// </summary>
/// <param name="min"></param>
/// <param name="max"></param>
public static object[] SetBattery(int curBattery, bool isCharge = false, int min = 20, int max = 90)
{
if (curBattery < 0) curBattery = 0;
Image image;
if (batteryImageList == null)
InitbatteryImageList();
if (isCharge)
{
image = batteryImageList.Images[ChargeBattery];
}
else
{
if (curBattery < min)
image = batteryImageList.Images[LowBattery];
else if (curBattery < max)
image = batteryImageList.Images[CommonBattery];
else
image = batteryImageList.Images[FullBattery];
}
return new object[] { string.Format("{0}%",curBattery), image };
}
/// <summary>
/// 设置小车状态
/// </summary>
/// <param name="curState"></param>
public static object[] SetAGVState(string curState)
{
Image image;
if (stateImageList == null)
InitStateImageList();
if(stateImageList.Images.ContainsKey(curState))
image = stateImageList.Images[curState];
else
image = stateImageList.Images[UNKNOWN];
return new object[] { curState, image };
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("AGVStatus")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AGVStatus")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("c6d2fc09-46f7-4ec5-a877-15ea06342e4f")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace AGV_UI.Properties {
using System;
/// <summary>
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// 返回此类使用的缓存的 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AGV_UI.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性
/// 重写当前线程的 CurrentUICulture 属性。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap Aborted {
get {
object obj = ResourceManager.GetObject("Aborted", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap charge {
get {
object obj = ResourceManager.GetObject("charge", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap common {
get {
object obj = ResourceManager.GetObject("common", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap emergency {
get {
object obj = ResourceManager.GetObject("emergency", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap Error {
get {
object obj = ResourceManager.GetObject("Error", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap Executing {
get {
object obj = ResourceManager.GetObject("Executing", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap full {
get {
object obj = ResourceManager.GetObject("full", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap low {
get {
object obj = ResourceManager.GetObject("low", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap manual {
get {
object obj = ResourceManager.GetObject("manual", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap offline {
get {
object obj = ResourceManager.GetObject("offline", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap online {
get {
object obj = ResourceManager.GetObject("online", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap pause {
get {
object obj = ResourceManager.GetObject("pause", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap ready {
get {
object obj = ResourceManager.GetObject("ready", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap task {
get {
object obj = ResourceManager.GetObject("task", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap Unknown {
get {
object obj = ResourceManager.GetObject("Unknown", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="offline" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\offline.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="task" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\task.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="online" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\online.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Aborted" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\state\Aborted.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="emergency" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\state\emergency.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Error" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\state\Error.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Executing" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\state\Executing.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="manual" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\state\manual.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="pause" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\state\pause.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ready" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\state\ready.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Unknown" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\state\Unknown.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="charge" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\battery\charge.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="common" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\battery\common.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="full" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\battery\full.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="low" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\battery\low.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
\ No newline at end of file \ No newline at end of file
文件属性发生变化
namespace AGV_UI
{
partial class Status
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Status));
this.panelTitle = new System.Windows.Forms.Panel();
this.lblBattery = new System.Windows.Forms.Label();
this.picBxConn = new System.Windows.Forms.PictureBox();
this.lblName = new System.Windows.Forms.Label();
this.panelAGVState = new System.Windows.Forms.Panel();
this.lblAGVState = new System.Windows.Forms.Label();
this.lblTask = new System.Windows.Forms.Label();
this.flowPanelMissionState = new System.Windows.Forms.FlowLayoutPanel();
this.panelTitle.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picBxConn)).BeginInit();
this.panelAGVState.SuspendLayout();
this.SuspendLayout();
//
// panelTitle
//
this.panelTitle.BackColor = System.Drawing.Color.LightBlue;
this.panelTitle.Controls.Add(this.lblBattery);
this.panelTitle.Controls.Add(this.picBxConn);
this.panelTitle.Controls.Add(this.lblName);
this.panelTitle.Dock = System.Windows.Forms.DockStyle.Top;
this.panelTitle.Location = new System.Drawing.Point(0, 0);
this.panelTitle.Name = "panelTitle";
this.panelTitle.Size = new System.Drawing.Size(287, 47);
this.panelTitle.TabIndex = 0;
//
// lblBattery
//
this.lblBattery.Dock = System.Windows.Forms.DockStyle.Right;
this.lblBattery.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblBattery.ForeColor = System.Drawing.Color.Black;
this.lblBattery.Image = ((System.Drawing.Image)(resources.GetObject("lblBattery.Image")));
this.lblBattery.Location = new System.Drawing.Point(249, 0);
this.lblBattery.Name = "lblBattery";
this.lblBattery.Size = new System.Drawing.Size(38, 47);
this.lblBattery.TabIndex = 2;
this.lblBattery.Text = "0%";
this.lblBattery.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// picBxConn
//
this.picBxConn.Dock = System.Windows.Forms.DockStyle.Left;
this.picBxConn.Image = global::AGV_UI.Properties.Resources.offline;
this.picBxConn.Location = new System.Drawing.Point(0, 0);
this.picBxConn.Name = "picBxConn";
this.picBxConn.Size = new System.Drawing.Size(51, 47);
this.picBxConn.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.picBxConn.TabIndex = 1;
this.picBxConn.TabStop = false;
//
// lblName
//
this.lblName.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblName.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblName.ForeColor = System.Drawing.Color.Black;
this.lblName.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.lblName.Location = new System.Drawing.Point(0, 0);
this.lblName.Name = "lblName";
this.lblName.Size = new System.Drawing.Size(287, 47);
this.lblName.TabIndex = 0;
this.lblName.Text = "#号车";
this.lblName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// panelAGVState
//
this.panelAGVState.Controls.Add(this.lblAGVState);
this.panelAGVState.Controls.Add(this.lblTask);
this.panelAGVState.Dock = System.Windows.Forms.DockStyle.Top;
this.panelAGVState.Location = new System.Drawing.Point(0, 47);
this.panelAGVState.Name = "panelAGVState";
this.panelAGVState.Size = new System.Drawing.Size(287, 50);
this.panelAGVState.TabIndex = 1;
//
// lblAGVState
//
this.lblAGVState.Dock = System.Windows.Forms.DockStyle.Right;
this.lblAGVState.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblAGVState.Image = global::AGV_UI.Properties.Resources.Unknown;
this.lblAGVState.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.lblAGVState.Location = new System.Drawing.Point(160, 0);
this.lblAGVState.Name = "lblAGVState";
this.lblAGVState.Size = new System.Drawing.Size(127, 50);
this.lblAGVState.TabIndex = 1;
this.lblAGVState.Text = "None";
this.lblAGVState.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// lblTask
//
this.lblTask.Dock = System.Windows.Forms.DockStyle.Left;
this.lblTask.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblTask.Image = global::AGV_UI.Properties.Resources.task;
this.lblTask.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.lblTask.Location = new System.Drawing.Point(0, 0);
this.lblTask.Name = "lblTask";
this.lblTask.Size = new System.Drawing.Size(216, 50);
this.lblTask.TabIndex = 0;
this.lblTask.Text = "无任务";
this.lblTask.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// flowPanelMissionState
//
this.flowPanelMissionState.BackColor = System.Drawing.Color.LightBlue;
this.flowPanelMissionState.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowPanelMissionState.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.flowPanelMissionState.Location = new System.Drawing.Point(0, 97);
this.flowPanelMissionState.Name = "flowPanelMissionState";
this.flowPanelMissionState.Size = new System.Drawing.Size(287, 230);
this.flowPanelMissionState.TabIndex = 2;
//
// Status
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.flowPanelMissionState);
this.Controls.Add(this.panelAGVState);
this.Controls.Add(this.panelTitle);
this.Name = "Status";
this.Size = new System.Drawing.Size(287, 327);
this.panelTitle.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.picBxConn)).EndInit();
this.panelAGVState.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel panelTitle;
private System.Windows.Forms.Label lblName;
private System.Windows.Forms.PictureBox picBxConn;
private System.Windows.Forms.Label lblBattery;
private System.Windows.Forms.Panel panelAGVState;
private System.Windows.Forms.Label lblTask;
private System.Windows.Forms.Label lblAGVState;
private System.Windows.Forms.FlowLayoutPanel flowPanelMissionState;
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AGV_UI
{
public partial class Status : UserControl
{
public Status(string name, List<string> infos)
{
InitializeComponent();
AGVName = name;
missionShow = new Dictionary<string, Control>();
if (infos != null && infos.Count > 0)
{
foreach (var item in infos)
{
missionShow.Add(item, new Label() { Name = item,
Font = new Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))),
AutoSize = true
});
}
flowPanelMissionState.Controls.AddRange(missionShow.Values.ToArray());
}
}
public Status( List<string> infos)
{
InitializeComponent();
missionShow = new Dictionary<string, Control>();
if (infos != null && infos.Count > 0)
{
foreach (var item in infos)
{
missionShow.Add(item, new Label()
{
Name = item,
Font = new Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))),
AutoSize = true
});
}
flowPanelMissionState.Controls.AddRange(missionShow.Values.ToArray());
}
}
public Status()
{
}
public void Init(string name="")
{
AGVName = name;
foreach (string item in missionShow.Keys)
{
ShowInfo(item, "");
}
SetTitle();
}
public int MaxBattery { get; set; } = 90;
public int MinBattery { get; set; } = 20;
public string AGVName { get; set; }
#region 私有字段
private Dictionary<string, Control> missionShow;
#endregion
void SetTitle()
{
if (!IsHandleCreated)
return;
this.Invoke(new Action(() =>
{
lblName.Text = AGVName;
}
));
}
/// <summary>
/// 设置电量
/// </summary>
/// <param name="curBattery"></param>
/// <param name="isInCharge"></param>
public void SetBattery(int curBattery, bool isInCharge = false)
{
if (!IsHandleCreated)
return;
object[] objs = Manager.SetBattery(curBattery, isInCharge, MinBattery, MaxBattery);
try
{
this.Invoke(new Action(() =>
{
if (curBattery < MinBattery)
lblBattery.ForeColor = Color.White;
else
lblBattery.ForeColor = Color.Black;
lblBattery.Text = objs[0] as string;
lblBattery.Image = objs[1] as Image;
}
));
}
catch { }
}
/// <summary>
/// 设置连接状态
/// </summary>
/// <param name="state"></param>
public void SetConnectState(bool state = false)
{
if (!IsHandleCreated)
return;
Image image = Manager.SetConnState(state);
this.Invoke(new Action(() =>
{
picBxConn.Image = image;
}
));
}
public void ShowInfo(string key, string info)
{
if (!IsHandleCreated)
return;
this.Invoke(new Action(() =>
{
if (missionShow.ContainsKey(key))
missionShow[key].Text = string.Format("{0}:{1}",key, info);
}
));
}
/// <summary>
/// 设置当前任务名称
/// </summary>
/// <param name="taskName"></param>
public void SetCurTask(string taskName)
{
if (!IsHandleCreated)
return;
this.Invoke(new Action(() =>
{
lblTask.Text = taskName;
}
));
}
/// <summary>
/// 设置agv当前状态
/// </summary>
/// <param name="curState"></param>
public void SetCurState(string curState)
{
if (!IsHandleCreated)
return;
object[] objs = Manager.SetAGVState(curState);
this.Invoke(new Action(() =>
{
lblAGVState.Text = objs[0] as string;
lblAGVState.Image = objs[1] as Image;
}
));
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="lblBattery.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABGdBTUEAALGPC/xhBQAAAOZJREFUaEPt
ziEOw1AQxNBcrCT3v1NKDA0CxmrBtzRspbfX6XTadd/382ac/1/2rI3z32QPLQfTZehyMF2GLgfTZehy
MF2GLgfTZehyMF2GLgfTZehyMF2GLgfTZehyMF2GLgfTZehyMF2GLgfTZehyMF2GLgfTZehyMF2GLgfT
ZehyMF2GLgfTZehyMF2GLgfTZehyMF2GLgfTZehyMF2GLgfTZehyMF2GLgfTZehyMF2GLgfTZehyMF2G
LgfTZehyMF2GLgfT9XyupxxMl6HLwXQZuhxMl6HLwXQZuhzM6XR61XV9AQQ5qN/xmUs6AAAAAElFTkSu
QmCC
</value>
</data>
</root>
\ No newline at end of file \ No newline at end of file
文件属性发生变化
文件属性发生变化
文件属性发生变化
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{BAFEAFE6-04E2-48EE-8845-BFC7EA3E3C21}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Common</RootNamespace>
<AssemblyName>Common</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net">
<HintPath>.\log4net.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>.\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="RestSharp">
<HintPath>.\RestSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="util\AppConfigHelper.cs" />
<Compile Include="util\IniFileHelper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SettingString.cs" />
<Compile Include="util\HttpHelper.cs" />
<Compile Include="util\JsonHelper.cs" />
<Compile Include="util\LogUtil.cs" />
<Compile Include="util\MyWebClient.cs">
<SubType>Component</SubType>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file \ No newline at end of file
此文件类型无法预览
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Common")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Common")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("bafeafe6-04e2-48ee-8845-bfc7ea3e3c21")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
文件属性发生变化
此文件类型无法预览
此文件的差异太大,无法显示。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Common
{
public static class SettingString
{
//任务名称
public const string Standby = "Standby";
public const string CheckShelf = "CheckShelf";
public const string PutShelfOn = "PutShelfOn";
public const string TakeShelfOff = "TakeShelfOff";
public const string Temp1 = "Temp1";
public const string Temp2 = "Temp2";
public const string DoorAirOut = "DoorAirOut";
public const string AutoCharge = "AutoCharge";
public const string PlaySound = "PlaySound";
public const string StopSound = "StopSound";
public const string Leave = "Leave";
public const string Enter = "Enter";
public const string Init = "Init";
public const string LIFT_D2 = "LIFT_D2";
public const string LIFT_C1 = "LIFT_C1";
public const string LIFT_C2 = "LIFT_C2";
public const string LIFT_D8 = "LIFT_D8";
//任务状态
public const string Wait = "Wait";
public const string Done = "Done";
public const string Aborted = "Aborted";
public const string Executing = "Executing";
public const string Invalid = "Invalid";
public const string File_AgvInfo = "File_AgvInfo";
public const string File_AgvTaskInfo = "File_AgvTaskInfo";
public const string File_NodeInfo = "File_NodeInfo";
public const string FileName_Missions = "Missions.json";
public const string IsUse = "IsUse";
public const string RFID = "RFID";
public const string Warehouse = "JIGStorage";
public const string Cancel = "Cancel";
public const string ChargeThreshold = "ChargeThreshold";
public const string WaitTimeout = "WaitTimeout";
public const string StandTimeout = "StandTimeout";
public const string _1D = "1D";
public const string _1C = "1C";
public const string _2D = "2D";
public const string _2C = "2C";
public const string _3D = "3D";
public const string _3C = "3C";
public const string _4D = "4D";
public const string _4C = "4C";
#region 配置名
public const string ITS = "ITS";
public const string httpServer ="http.server";
public const string log4net_configname = "log4net_configname";
public const string ITS_UpdateLine = "ITS_UpdateLine";
public const string Lift_GetState = "Lift_GetState";
public const string AppIdentity = "AppIdentity";
public const string Lift_Names = "Lift_Names";
#endregion
}
}
文件属性发生变化
此文件类型无法预览
using System;
using System.Windows.Forms;
using System.Xml;
namespace Common
{
public class AppConfigHelper
{
public static System.Configuration.Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None);
public static string GetValue(string key)
{
if (config.AppSettings.Settings[key] == null)
{
LogUtil.info("未找到配置:" + key + ",请检查配置是否完整!");
return "";
}
else
{
return config.AppSettings.Settings[key].Value;
}
}
public static decimal GetNumValue(string key)
{
decimal a = 0;
//System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
LogUtil.error("未找到配置:" + key + ",请检查配置是否完整!");
return a;
}
else
{
{
Decimal.TryParse(config.AppSettings.Settings[key].Value, out a);
}
}
return a;
}
public static int GetIntValue(string key)
{
int a = 0;
//System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
LogUtil.error("未找到配置:" + key + ",请检查配置是否完整!");
return a;
}
else
{
{
Int32.TryParse(config.AppSettings.Settings[key].Value, out a);
}
}
return a;
}
public static bool GetBoolValue(string key)
{
bool a = false;
//System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
LogUtil.error("未找到配置:" + key + ",请检查配置是否完整!");
return a;
}
else
{
{
bool.TryParse(config.AppSettings.Settings[key].Value, out a);
}
}
return a;
}
public static void SaveValue(string key, int value)
{
SaveValue(key, value.ToString());
}
public static void SaveValue(string key, bool value)
{
SaveValue(key, value.ToString());
}
public static void SaveValue(string key, string value)
{
try
{
if (key.Equals("") || value.Equals(""))
{
return;
}
//增加的内容写在appSettings段下 <add key="RegCode" value="0"/>
//System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
SetValue(key, value);
}
else
{
UpdateConfig(key, value);
}
}
catch (Exception ex)
{
LogUtil.error("SaveValue保存配置出错:AppKey=" + key + ",AppValue=" + value + "," + ex.StackTrace);
}
}
/// <summary>
/// 更新配置文件信息
/// </summary>
/// <param name="name">配置文件字段名称</param>
/// <param name="Xvalue">值</param>
private static void UpdateConfig(string name, string Xvalue)
{
try
{
XmlDocument doc = new XmlDocument();
doc.Load(Application.ExecutablePath + ".config");
XmlNode node = doc.SelectSingleNode(@"//add[@key='" + name + "']");
XmlElement ele = (XmlElement)node;
ele.SetAttribute("value", Xvalue);
doc.Save(Application.ExecutablePath + ".config");
}
catch (Exception ex)
{
LogUtil.error("UpdateConfig保存配置出错:name=" + name + ",Xvalue=" + Xvalue + "," + ex.StackTrace);
}
}
///<summary>
///向.config文件的appKey结写入信息AppValue 保存设置
///</summary>
///<param name="AppKey">节点名</param>
///<param name="AppValue">值</param>
private static void SetValue(String AppKey, String AppValue)
{
try
{
XmlDocument xDoc = new XmlDocument();
xDoc.Load(System.Windows.Forms.Application.ExecutablePath + ".config");
XmlNode xNode;
XmlElement xElem1;
XmlElement xElem2;
xNode = xDoc.SelectSingleNode("//appSettings");
xElem1 = (XmlElement)xNode.SelectSingleNode("//add[@key='" + AppKey + "']");
if (xElem1 != null)
xElem1.SetAttribute("value", AppValue);
else
{
xElem2 = xDoc.CreateElement("add");
xElem2.SetAttribute("key", AppKey);
xElem2.SetAttribute("value", AppValue);
xNode.AppendChild(xElem2);
}
xDoc.Save(System.Windows.Forms.Application.ExecutablePath + ".config");
}
catch (Exception ex)
{
LogUtil.error("SetValue保存配置出错:AppKey=" + AppKey + ",AppValue=" + AppValue + "," + ex.StackTrace);
}
}
}
}
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Collections;
using System.Net;
using System.Net.Security;
using System.Security;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Reflection;
using System.Net.NetworkInformation;
namespace Common
{
public class HttpHelper
{
// public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static string Post(string url, string paramData)
{
return Post(url, paramData, Encoding.UTF8);
}
//public static bool PingURLIP(string url, int ms=100)
//{
// string[] urlArray = url.Split('/');
// if (urlArray.Length > 3)
// {
// string ip = urlArray[2];
// Ping pingSender = new Ping();
// PingReply reply = pingSender.Send(ip, ms);//第一个参数为ip地址,第二个参数为ping的时间
// if (reply.Status == IPStatus.Success)
// {
// //通
// return true;
// }
// else
// {
// //不通
// return false;
// }
// }
// return true;
//}
/// <summary>
///
/// </summary>
/// <param name="url"></param>
/// <param name="operation"></param>
/// <param name="simulate">是否模拟服务器返回结果</param>
/// <returns></returns>
//public static Operation Post(string url, Operation operation, bool simulate)
//{
// try
// {
// ////如果Op=0或者Op=5,先拼Ip,不通不发送
// //if (operation.op < 0 || operation.op.Equals(5))
// //{
// // if (PingURLIP(url, 100).Equals(false))
// // {
// // return null;
// // }
// //}
// if (simulate)
// {//模拟服务器返回
// operation.status = 200;
// operation.data.Clear();
// operation.data.Add("posId", "A001");
// string pos = "D100-111#D102-222#D104-333";
// operation.data.Add("pos", pos);
// if (operation.op == 1 || operation.op == 2)
// {//入库或出库
// string json = JsonHelper.SerializeObject(operation);
// LogUtil.error("模拟HTTP服务器返回出库入库信息:" + json);
// return operation;
// }
// }
// else
// {
// string json = "";
// try
// {
// json = JsonHelper.SerializeObject(operation);
// }
// catch (Exception ex)
// {
// LogUtil.error("JsonHelper.SerializeObject(operation) 出错【operation.op=" + operation.op + "】" + ex);
// }
// string result = Post(url, json);
// if (!string.IsNullOrEmpty(result))
// {
// try
// {
// return JsonHelper.DeserializeJsonToObject<Operation>(result);
// }
// catch (Exception ex)
// {
// LogUtil.error("JsonHelper.DeserializeJsonToObject 出错【result=" + result + "】" + ex);
// }
// }
// }
// }
// catch (Exception ex)
// {
// LogUtil.error("Post 出错【operation.op=" + operation.op + "】:" + ex);
// }
// return null;
//}
public static string LastServerMsg = "";
public static string Post(string url, string paramData, Encoding encoding)
{
//if (PingURLIP(url, 100).Equals(false))
//{
// return null;
//}
if (paramData != "null" && paramData != null)
{
// LogUtil.debug(LOGGER, "HTTP POST to " + url + " \n\t >> " + paramData);
}
string result = "";
if (url.ToLower().IndexOf("https", System.StringComparison.Ordinal) > -1)
{
ServicePointManager.ServerCertificateValidationCallback =
new RemoteCertificateValidationCallback((sender, certificate, chain, errors) => { return true; });
}
try
{
var wc = new MyWebClient(5000);
if (string.IsNullOrEmpty(wc.Headers["Content-Type"]))
wc.Headers.Add("Content-Type", "application/json;charset=UTF-8");
wc.Encoding = encoding;
result = wc.UploadString(url, "POST", paramData);
//LogUtil.info(result);
}
catch (Exception e)
{
LogUtil.error("POST ERROR:" + e.ToString());
}
if (!result.Contains("null") && result.Length != 0)
{
//LogUtil.debug(LOGGER,"receive << " + result);
}
LastServerMsg = DateTime.Now.ToLongTimeString() + " URL:" + url + "\r\n"
+ "发送:" + paramData + "\r\n"
+ "接收:" + result + "\r\n"
;
return result;
}
public static string Get(string url)
{
return Get(url, Encoding.UTF8);
}
public static string Get(string url, Encoding encoding)
{
try
{
LogUtil.debug("HTTP GET FROM: " + url);
var wc = new WebClient { Encoding = encoding };
var readStream = wc.OpenRead(url);
using (var sr = new StreamReader(readStream, encoding))
{
var result = sr.ReadToEnd();
LogUtil.debug("receive << " + result);
return result;
}
}
catch (Exception e)
{
LogUtil.error("HTTP GET ERROR:" +url+ e.Message);
}
return "";
}
}
}
\ No newline at end of file \ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Common
{
public class IniFileHelper
{
[System.Runtime.InteropServices.DllImport("kernel32")]
//section:要读取的段落名
//key: 要读取的键点击打开链接点击打开链接
//defVal: 读取异常的情况下的缺省值
//retVal: key所对应的值,如果该key不存在则返回空值
//size: 值允许的大小
//filePath: INI文件的完整路径和文件名
private static extern int GetPrivateProfileString(string section, string key, string defVal, StringBuilder retVal, int size, string filePath);
[System.Runtime.InteropServices.DllImport("kernel32")]
//section: 要写入的段落名
//key: 要写入的键,如果该key存在则覆盖写入
//val: key所对应的值
//filePath: INI文件的完整路径和文件名
private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
/// <summary>
/// 读取INI文件
/// </summary>
/// <param name="section">项目名称(如 [section] )</param>
/// <param name="skey">键</param>
/// <param name="path">路径</param>
public static string ReadValue(string section, string skey, string path)
{
StringBuilder temp = new StringBuilder(500);
GetPrivateProfileString(section, skey, "", temp, 500, path);
return temp.ToString();
}
/// <summary>
/// 写入ini文件
/// </summary>
/// <param name="section">项目名称</param>
/// <param name="key">键</param>
/// <param name="value">值</param>
/// <param name="path">路径</param>
public static void WriteValue(string section, string key, string value, string path)
{
WritePrivateProfileString(section, key, value, path);
}
}
}
using Newtonsoft.Json;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
namespace Common
{
/// <summary>
/// Json帮助类
/// </summary>
public class JsonHelper
{
/// <summary>
/// 将对象序列化为JSON格式
/// </summary>
/// <param name="o">对象</param>
/// <returns>json字符串</returns>
public static string SerializeObject(object o)
{
string json = JsonConvert.SerializeObject(o);
return json;
}
/// <summary>
/// 解析JSON字符串生成对象实体
/// </summary>
/// <typeparam name="T">对象类型</typeparam>
/// <param name="json">json字符串(eg.{"ID":"112","Name":"石子儿"})</param>
/// <returns>对象实体</returns>
public static T DeserializeJsonToObject<T>(string json) where T : class
{
JsonSerializer serializer = new JsonSerializer();
StringReader sr = new StringReader(json);
object o = serializer.Deserialize(new JsonTextReader(sr), typeof(T));
T t = o as T;
return t;
}
/// <summary>
/// 解析JSON数组生成对象实体集合
/// </summary>
/// <typeparam name="T">对象类型</typeparam>
/// <param name="json">json数组字符串(eg.[{"ID":"112","Name":"石子儿"}])</param>
/// <returns>对象实体集合</returns>
public static List<T> DeserializeJsonToList<T>(string json) where T : class
{
JsonSerializer serializer = new JsonSerializer();
StringReader sr = new StringReader(json);
object o = serializer.Deserialize(new JsonTextReader(sr), typeof(List<T>));
List<T> list = o as List<T>;
return list;
}
/// <summary>
/// 反序列化JSON到给定的匿名对象.
/// </summary>
/// <typeparam name="T">匿名对象类型</typeparam>
/// <param name="json">json字符串</param>
/// <param name="anonymousTypeObject">匿名对象</param>
/// <returns>匿名对象</returns>
public static T DeserializeAnonymousType<T>(string json, T anonymousTypeObject)
{
T t = JsonConvert.DeserializeAnonymousType(json, anonymousTypeObject);
return t;
}
/// <summary>
///写入JSON文件
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="ts"></param>
/// <param name="fileName"></param>
public static void WriteJson<T>(List<T> ts, string fileName) where T : class
{
try
{
string path = fileName + ".json";
string output = JsonConvert.SerializeObject(ts,Formatting.Indented);
File.WriteAllText(path, output);
}
catch (Exception e)
{
LogUtil.error(e.Message + "/r/n" + e.StackTrace);
}
}
/// <summary>
/// 读取JSON文件
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="ts"></param>
/// <param name="fileName"></param>
public static List<T> ReadJson<T>(string fileName) where T : class
{
try
{
string path =fileName + ".json";
StreamReader streamReader = new StreamReader(path);
string jsonStr = streamReader.ReadToEnd();
List<T> jsonObj = DeserializeJsonToList<T>(jsonStr);
streamReader.Close();
return jsonObj;
}
catch (Exception e)
{
LogUtil.error(e.Message + "/r/n" + e.StackTrace);
return null;
}
}
}
///// <summary>
///// 与服务器通信用对象
///// </summary>
//public class Operation
//{
// private string _cid = "";
// public string cid
// {
// get { return _cid; }
// set { _cid = value; }
// }
// public int seq { get; set; }
// public int op { get; set; }
// public int status { get; set; }
// private string _error = "";
// public string error
// {
// get { return _error; }
// set { _error = value; }
// }
// private Dictionary<string, string> _data = new Dictionary<string,string>();
// public Dictionary<string, string> data {
// get { return _data; }
// set { _data = value; }
// }
//}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using log4net;
using System.Reflection;
using System.Drawing;
namespace Common
{
public class LogUtil
{
public static readonly ILog AIOLog = LogManager.GetLogger("AGVDispatch");
private static LogUtil instance = new LogUtil();
public delegate void ShowLog(string msg,Color color);
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static Dictionary<int, DateTime> lastErrorLogTime = new Dictionary<int, DateTime>();
public static System.Windows.Forms.RichTextBox logBox = null;
public static int showCount = 20;
public static bool debug_opened = false;
public static void info(ILog log, string msg)
{
if (log == null)
{
return;
}
log.Info(msg);
AddToBox(msg, Color.Black);
//clear();
}
public static void info(ILog log, string msg, Color color)
{
log.Info(msg);
AddToBox(msg, color);
}
public static void debug(ILog log, string msg, Color color)
{
log.Debug(msg);
if (debug_opened)
{
AddToBox(msg, color);
}
}
public static void debug(ILog log, string msg)
{
log.Debug(msg);
if (debug_opened)
{
AddToBox(msg, Color.Gray);
}
}
public static void error(string errorMsg, int type)
{
if (lastErrorLogTime.ContainsKey(type))
{
TimeSpan span = DateTime.Now - lastErrorLogTime[type];
if (span.TotalSeconds > 10)
{
lastErrorLogTime.Remove(type);
lastErrorLogTime.Add(type, DateTime.Now);
error(LOGGER, errorMsg);
}
}
else
{
lastErrorLogTime.Add(type, DateTime.Now);
error(LOGGER, errorMsg);
}
}
public static void error(ILog log, string errorMsg, Exception ex = null)
{
if (errorMsg.Trim().Equals(""))
{
return;
}
if (ex == null)
{
log.Error(errorMsg);
}
else
{
log.Error(errorMsg, ex);
}
AddToBox(errorMsg, Color.Red);
}
private static void AddToBox(string msg, Color color)
{
try
{
ShowLogPro(msg, color);
}
catch (Exception ex)
{
LOGGER.Error("出错:", ex);
}
}
private static List<string> logList = new List<string>();
public static string LastText = "";
private static void ShowLogPro(string msg, Color color)
{
try
{
if (logList.Count > 0)
{
// logList.RemoveAt(0);
}
if (logList.Count >= showCount)
{
logList.RemoveAt(0);
}
string text = "";
foreach (string str in logList)
{
text += str;
}
System.DateTime now = System.DateTime.Now;
logList.Add(now.ToLongTimeString() + " " + msg + Environment.NewLine);
if (logBox == null)
{
return;
}
LastText = text;
if (logBox.Visible)
{
logBox.Text = text;
// logBox.Focus(); //使文本框获取焦点
logBox.AppendText(now.ToLongTimeString() + " " + msg + Environment.NewLine); //增加文本
TimeSpan span = DateTime.Now - lastTime;
if (span.TotalSeconds > 3000000)
{
lastTime = DateTime.Now;
logBox.Select(logBox.Text.Length, 0); //设置光标的位置到文本尾
logBox.ScrollToCaret(); //滚动到控件光标处
}
}
}
catch (Exception ex)
{
LOGGER.Error("出错:" + ex.ToString());
}
}
private static DateTime lastTime = DateTime.Now;
public static void UpdateLogbox()
{
if (logBox != null && logBox.Visible)
{
logBox.Text = LastText;
TimeSpan span = DateTime.Now - lastTime;
if (span.TotalSeconds > 3000000)
{
lastTime = DateTime.Now;
logBox.Select(logBox.Text.Length, 0); //设置光标的位置到文本尾
logBox.ScrollToCaret(); //滚动到控件光标处
}
}
}
public static void ClearLog()
{
if (logBox != null)
{
LastText = "";
logList.Clear();
logBox.Text = "";
}
}
public static void debug(string msg)
{
debug(LOGGER, msg);
}
public static void error(string errorMsg, Exception ex = null)
{
error(LOGGER, errorMsg, ex);
}
public static void info(string msg)
{
info(LOGGER, msg);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
namespace Common
{
public class MyWebClient:WebClient
{
private int _timeout;
/// <summary>
/// 超时时间(毫秒)
/// </summary>
public int Timeout
{
get
{
return _timeout;
}
set
{
_timeout = value;
}
}
public MyWebClient()
{
this._timeout = 60000;
}
public MyWebClient(int timeout)
{
this._timeout = timeout;
}
protected override WebRequest GetWebRequest(Uri address)
{
var result = base.GetWebRequest(address);
result.Timeout = this._timeout;
return result;
}
}
}
文件属性发生变化
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
using Common;
using System.Threading;
using System.Collections.Concurrent;
using System.Linq;
using DeviceLibrary.manager;
namespace DeviceLibrary
{
/// <summary>
/// AGV服务端,要求每个线体拥有不用的IP,根据IP来查找客户端
/// </summary>
public class AgvServer
{
private static log4net.ILog log = log4net.LogManager.GetLogger("AgvServer");
private bool _loop;
private Socket _server; //服务端
private List<Client> _client; //所有客户端
private Thread tListenClient; //监听客户端连接
private static int PORT = 9501; //端口
/// <summary>
/// AGV服务端
/// </summary>
public AgvServer(int port = 9501)
{
PORT = port;
_client = new List<Client>();
}
/// <summary>
/// 开启服务
/// </summary>
public void Start()
{
try
{
IPEndPoint localEP = new IPEndPoint(IPAddress.Any, PORT);
_server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
_server.Bind(localEP);
_server.Listen(100);
log.Info("Server Start");
_loop = true;
_client = new List<Client>();
tListenClient = new Thread(new ThreadStart(ListenClient));
tListenClient.Start();
}
catch (Exception ex)
{
log.Error("Start()", ex);
}
}
/// <summary>
/// 停止服务
/// </summary>
public void Stop()
{
_loop = false;
for (int i = 0; i < _client.Count; i++)
{
_client[i].Loop = false;
_client[i].IsConn = false;
_client[i].Socket.Close();
}
_server.Close();
_client = null;
Thread.Sleep(50);
log.Info("Server Stop");
}
public Dictionary<string, DateTime> readyEnterTime = new Dictionary<string, DateTime>();
public Dictionary<string, DateTime> readyLeaveTime = new Dictionary<string, DateTime>();
public bool ReadyEnter(string nodeName, string rfid = "")
{
int nodeIdx = NodeManager.nodeInfo.FindIndex(s => s.Name == nodeName);
string ip = NodeManager.nodeInfo[nodeIdx].IP;
int idx = FindClient(ip);
if (idx == -1)
{
log.Error("ReadyEnter 没有找到" + nodeName + " " + ip);
return false;
}
else
{
try
{
if (!readyEnterTime.ContainsKey(nodeName))
{
readyEnterTime.Add(nodeName, DateTime.Now);
}
else
{
TimeSpan timeSpan = DateTime.Now - readyEnterTime[nodeName];
if (timeSpan.TotalSeconds < 15)
{
log.Debug(nodeName + " " + ip + " ReadyEnter 15秒内不重复发送");
return false;
}
else if (timeSpan.TotalSeconds > 30)
{
readyEnterTime[nodeName] = DateTime.Now;
}
}
}
catch (Exception ex) { log.Debug(ex.Message + ";" + ex.StackTrace); }
Node node = new Node(nodeName, rfid, NodeStatus.ReadyEnter);
byte[] buff = Encode(node);
return Send(idx, buff);
}
}
public bool ReadyLeave(string nodeName, string rfid = "")
{
int nodeIdx = NodeManager.nodeInfo.FindIndex(s => s.Name == nodeName);
string ip = NodeManager.nodeInfo[nodeIdx].IP;
int idx = FindClient(ip);
if (idx == -1)
{
log.Error("ReadyLeave 没有找到" + nodeName + " " + ip);
return false;
}
else
{
try
{
if (!readyLeaveTime.ContainsKey(nodeName))
{
readyLeaveTime.Add(nodeName, DateTime.Now);
}
else
{
TimeSpan timeSpan = DateTime.Now - readyLeaveTime[nodeName];
if (timeSpan.TotalSeconds < 45)
{
log.Debug(nodeName + " " + ip + " ReadyLeave 45秒内不重复发送");
return false;
}
else if (timeSpan.TotalMinutes > 1)
{
readyLeaveTime[nodeName] = DateTime.Now;
}
}
}
catch (Exception ex) { log.Debug(ex.Message + ";" + ex.StackTrace); }
Node node = new Node(nodeName, rfid, NodeStatus.ReadyLeave);
byte[] buff = Encode(node);
return Send(idx, buff);
}
}
public bool FinishEnter(string nodeName, string rfid = "")
{
int nodeIdx = NodeManager.nodeInfo.FindIndex(s => s.Name == nodeName);
string ip = NodeManager.nodeInfo[nodeIdx].IP;
int idx = FindClient(ip);
if (idx == -1)
{
log.Error("FinishEnter 没有找到" + nodeName + " " + ip);
return false;
}
else
{
Node node = new Node(nodeName, rfid, NodeStatus.FinishEnter);
byte[] buff = Encode(node);
return Send(idx, buff);
}
}
public bool FinishLeave(string nodeName, string rfid = "")
{
int nodeIdx = NodeManager.nodeInfo.FindIndex(s => s.Name == nodeName);
string ip = NodeManager.nodeInfo[nodeIdx].IP;
int idx = FindClient(ip);
if (idx == -1)
{
log.Error("FinishLeave 没有找到" + nodeName + " " + ip);
return false;
}
else
{
Node node = new Node(nodeName, rfid, NodeStatus.FinishLeave);
byte[] buff = Encode(node);
return Send(idx, buff);
}
}
/// <summary>
/// 监听客户端
/// </summary>
private void ListenClient()
{
while (_loop)
{
try
{
Socket socket = _server.Accept(); //这边会暂停,不需要sleep
IPEndPoint ep = (IPEndPoint)socket.RemoteEndPoint;
Thread listen = new Thread(new ParameterizedThreadStart(ListenNet));
string ip = ep.Address.ToString();
//新的客户端
Client client = new Client
{
IP = ip,
Loop = true,
IsConn = true,
Socket = socket,
ListenNet = listen,
nodeName = new List<string>(),
};
//重连后关闭旧连接
int idx = _client.FindIndex(s => s.IP.Equals(ip));
if (idx > -1)
{
_client[idx].IsConn = false;
_client[idx].nodeName.Clear();
_client[idx].Loop = false;
_client[idx].Socket.Close();
_client.RemoveAt(idx);
}
_client.Add(client);
listen.Start(_client.Count - 1);
log.Info(string.Format("[{0}] 已连接", client.IP));
}
catch (SocketException)
{
//关闭连接,退出阻塞Accept
log.Debug("服务端关闭连接,退出阻塞Accept");
}
catch (Exception ex)
{
log.Error("ListenClient()", ex);
}
}
}
//临时缓存
//线程安全的字典
ConcurrentDictionary<string, byte[]> dic = new ConcurrentDictionary<string, byte[]>();
/// <summary>
/// 客户端数据接收
/// </summary>
/// <param name="obj">索引</param>
private void ListenNet(object obj)
{
int sleep = 50;
Client client = _client[(int)obj];
byte[] temp = new byte[127];
int time = 0;
while (client.Loop)
{
Thread.Sleep(sleep);
try
{
if (!client.Loop) break;
if (client.Socket.Available > 0)
{
time = 0;
byte[] supBuff = null;
int count = client.Socket.Receive(temp);
if (!dic.TryGetValue(client.IP, out supBuff)) //第一次收到开头必须是0xAD开头的字节
{
if (temp[0].Equals(0xAD))
{
supBuff = new byte[count];
Array.Copy(temp, 0, supBuff, 0, count);
//log.Info(string.Format("start with AB receive:{0}", HexBuff(supBuff)));
}
else
{
//log.Info(string.Format("start without AB receive:{0}", HexBuff(temp)));
for (int i = 0; i < count; i++)
{
if (!temp[i].Equals(0xAD))
continue;
supBuff = new byte[count - i];
Array.Copy(temp, i, supBuff, 0, count - i);
//log.Info(string.Format("start without AB receive after filter:{0}", HexBuff(supBuff)));
break;
}
}
dic.TryAdd(client.IP, supBuff);
}
else
{
byte[] tmp = new byte[count];
Array.Copy(temp, 0, tmp, 0, count);
byte[] curBuff = supBuff.Concat(tmp).ToArray();
dic.TryUpdate(client.IP, curBuff, supBuff);
supBuff = curBuff;
//log.Info(string.Format("receive:{0}",HexBuff(tmp)));
//log.Info(string.Format("buff:{0}",HexBuff(supBuff)));
//log.Info(string.Format("curBuf:{0}",HexBuff(curBuff)));
//log.Info(string.Format("dic[0]:{0}", HexBuff(dic[client.IP])));
}
List<byte> buf = new List<byte>();
for (int i = 0; i < supBuff.Length; i++)
{
if (supBuff[i].Equals(0XAD))
{
if (buf.Count > 0)
buf.Clear();
buf.Add(supBuff[i]);
}
else if (supBuff[i].Equals(0XDA))
{
buf.Add(supBuff[i]);
byte[] buff = buf.ToArray();
//Array.Copy(temp, 0, buff, 0, count);
Node node = Decode(client, buff);
if (node == null)
{
log.Debug(client.IP + " 解码失败:" + HexBuff(buff));
}
else
{
if (!node.Name.StartsWith("A") && !node.Name.Equals("S21") && !node.Name.Equals("S22"))
{
log.Info("Receive[" + client.IP + "]:[" + HexBuff(buff) + "],解码内容:" + node.StatetText());
}
log.Debug("Receive[" + client.IP + "]:[" + HexBuff(buff) + "],解码内容:" + node.StatetText());
int idx = client.nodeName.FindIndex(s => s == node.Name);
if (idx == -1) client.nodeName.Add(node.Name);
NodeManager.UpdateNode(node);
}
if (buf.Count > 0)
buf.Clear();
}
else
{
buf.Add(supBuff[i]);
}
}
if (buf.Count > 0)//存在部分包
{
dic.TryUpdate(client.IP, buf.ToArray(), supBuff);
}
else
dic.TryRemove(client.IP, out byte[] bb);
}
else
{
time += sleep;
if (time > 1000 * 60 * 60 * 1)
{
Offline(client);
log.Debug("[" + client.IP + "] 超过1H没有收到数据,关闭连接");
}
}
}
catch (Exception ex)
{
log.Error("ListenNet()", ex);
}
}
}
/// <summary>
/// 编码-定长12字节
/// </summary>
/// <param name="node"></param>
/// <returns></returns>
private byte[] Encode(Node node)
{
int idx = 0;
byte[] buff = new byte[12];
buff[idx++] = 0xAD;
buff[idx++] = (byte)node.Name[0];
buff[idx++] = Convert.ToByte(node.Name.Substring(1));
buff[idx++] = (byte)node.RFID[0];
//buff[idx++] = 0X00;
//buff[idx++] = 0X00;
//buff[idx++] = 0X00;
buff[idx++] = Convert.ToByte(node.RFID.Substring(1));
buff[idx++] = (byte)node.GetState();
buff[idx++] = 0;
idx += 4; //预留
buff[idx] = 0xDA;
return buff;
}
/// <summary>
/// 解码-定长12字节
/// </summary>
/// <param name="buff"></param>
/// <returns></returns>
private Node Decode(Client client, byte[] buff)
{
int idx = 0;
string name = "";
string rfid = "";
if (buff[idx++] != 0xAD) return null;
if (buff[idx] == 0x00 && buff[idx + 1] == 0x00)//收到产线
{
int k = NodeManager.nodeInfo.FindIndex(s => client.IP.Equals(s.IP) && !s.Name.StartsWith("A"));
if (k > -1)
{
name = NodeManager.nodeInfo[k].Name;
rfid = "";
}
idx += 2;
idx += 2;
}
else
{
name = (char)buff[idx] + buff[idx + 1].ToString();
idx += 2;
rfid = (char)buff[idx] + buff[idx + 1].ToString();
idx += 2;
}
NodeStatus action = (NodeStatus)buff[idx++];
ClientLevel level = (ClientLevel)buff[idx++];
idx += 4; //预留
if (buff[idx] != 0xDA) return null;
Node node = new Node(name, rfid, action);
node.ClientLevel = level;
return node;
}
private void Offline(Client client)
{
client.Loop = false;
client.IsConn = false;
client.Socket.Close();
for (int i = 0; i < client.nodeName.Count; i++)
{
Node node = NodeManager.nodeInfo.Find(s => s.Name == client.nodeName[i]);
if (node == null) continue;
node.Offline();
}
client.nodeName.Clear();
}
/// <summary>
/// 16进制
/// </summary>
/// <param name="buff"></param>
/// <returns></returns>
private string HexBuff(byte[] buff)
{
string s = "";
if (buff == null) return s;
for (int i = 0; i < buff.Length; i++)
s += buff[i].ToString("X2") + " ";
return s;
}
/// <summary>
/// 查找客户端
/// </summary>
/// <param ip="ip">ip地址</param>
/// <returns></returns>
private int FindClient(string ip)
{
int index = -1;
if (_client == null) return index;
try
{
foreach (Client item in _client)
{
if (item.IsConn)
{
//Common.log.Info("已连接客户端:" + string.Join("#", item.IP));
if (item.IP.Equals(ip))
{
index = _client.IndexOf(item);
break;
}
//int idx = item.nodeName.FindIndex(a => a == name);
//if (idx != -1)
//{
// index = _client.IndexOf(item);
// break;
//}
}
}
}
catch { };
return index;
}
/// <summary>
/// 发送命令
/// </summary>
/// <param name="idx"></param>
/// <param name="buff"></param>
/// <returns></returns>
private bool Send(int idx, byte[] buff)
{
string ip = "[" + _client[idx].IP + "]";
if (!_client[idx].IsConn)
{
log.Error(ip + " 没有连接");
return false;
}
try
{
if (_client[idx].IsConn)
_client[idx].Socket.Send(buff);
if (buff.Length > 2)
log.Info("SendTo" + ip + ": " + HexBuff(buff));
return true;
}
catch (Exception ex)
{
log.Error("Send Error: " + ip, ex);
return false;
}
}
}
/// <summary>
/// 客户端
/// </summary>
public class Client
{
/// <summary>
/// 循环
/// </summary>
public bool Loop;
/// <summary>
/// IP地址
/// </summary>
public string IP;
/// <summary>
/// 是否连接
/// </summary>
public bool IsConn;
/// <summary>
/// 节点名称集合
/// </summary>
public List<string> nodeName;
/// <summary>
/// 套接字
/// </summary>
public Socket Socket;
/// <summary>
/// 接收数据线程
/// </summary>
public Thread ListenNet;
}
}
\ No newline at end of file \ No newline at end of file
[]
\ No newline at end of file \ No newline at end of file
using Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
namespace DeviceLibrary.manager
{
public class XmlConfigOperation
{
static string File_AgvInfo = AGVManager.CONFIG_PATH + AppConfigHelper.GetValue(SettingString.File_AgvInfo);
static string File_NodeInfo = AGVManager.CONFIG_PATH + AppConfigHelper.GetValue(SettingString.File_NodeInfo);
static string File_AgvTaskInfo = AGVManager.CONFIG_PATH + AppConfigHelper.GetValue(SettingString.File_AgvTaskInfo);
static string File_ChargePileInfo = AGVManager.CONFIG_PATH + "chargeinfos.xml";
static bool isLoadAgv = false;
static bool isLoadNode = false;
public static void LoadAgvInfos(List<AgvInfo> agv_Infos)
{
XmlDocument doc = new XmlDocument();
XmlReaderSettings xmlReaderSettings = new XmlReaderSettings();
xmlReaderSettings.IgnoreComments = true;//忽略文档里面的注释
XmlReader xmlReader = XmlReader.Create(File_AgvInfo, xmlReaderSettings);
doc.Load(xmlReader);
XmlNode xn = doc.SelectSingleNode("agvs");
XmlNodeList xnl = xn.ChildNodes;
foreach (XmlNode node in xnl)
{
AgvInfo agv_Info = new AgvInfo();
// 将节点转换为元素,便于得到节点的属性值
XmlElement xe = (XmlElement)node;
// 得到属性的属性值
agv_Info.ID = xe.GetAttribute("id").ToString();
agv_Info.IP = xe.GetAttribute("ip").ToString();
// 得到节点的所有子节点
XmlNodeList xnl0 = xe.ChildNodes;
agv_Info.Name = xnl0.Item(0).InnerText;
XmlNodeList xnlScope = xnl0.Item(1).ChildNodes;
agv_Info.Scope = new bean.agv.Scope();
agv_Info.Scope.Workshop = xnlScope.Item(0).InnerText;
agv_Info.Scope.Tasks = new List<string>();
XmlNodeList xnlTask = xnlScope.Item(1).ChildNodes;
foreach (XmlNode item in xnlTask)
{
agv_Info.Scope.Tasks.Add(item.InnerText);
}
agv_Info.Scope.Remark = xnlScope.Item(2).InnerText;
agv_Info.Auto = bool.Parse(xnl0.Item(2).InnerText);
agv_Info.UseFleet = bool.Parse(xnl0.Item(3).InnerText);
agv_Info.FleetIP = xnl0.Item(4).InnerText;
agv_Info.Authorization = xnl0.Item(5).InnerText;
XmlNode xnIO = xe.SelectSingleNode("IO_GUIDs");
XmlNodeList xnlios = xnIO.ChildNodes;
foreach (XmlNode item in xnlios)
{
IOInfo iOInfo = new IOInfo();
iOInfo.IOID = item.InnerText;
agv_Info.IOStatus.Add(iOInfo);
}
agv_Infos.Add(agv_Info);
}
xmlReader.Close();
isLoadAgv = true;
LogUtil.info($"加载Agv配置成功{File_AgvInfo}");
}
public static void SetAgvIsUse(AgvInfo agv)
{
if (!isLoadAgv) return;
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(File_AgvInfo);
XmlElement xe = xmlDoc.DocumentElement; // DocumentElement 获取xml文档对象的根XmlElement.
string strPath = string.Format("/agvs/agv[@id=\"{0}\"]", agv.ID);
XmlElement selectXe = (XmlElement)xe.SelectSingleNode(strPath); //selectSingleNode 根据XPath表达式,获得符合条件的第一个节点.
//selectXe.SetAttribute("Type", dgvBookInfo.CurrentRow.Cells[0].Value.ToString());//也可以通过SetAttribute来增加一个属性
selectXe.GetElementsByTagName("IsUse").Item(0).InnerText = agv.Auto.ToString();
xmlDoc.Save(File_AgvInfo);
}
public static void LoadNodeInfos(List<Node> nodes)
{
XmlDocument doc = new XmlDocument();
XmlReaderSettings xmlReaderSettings = new XmlReaderSettings();
xmlReaderSettings.IgnoreComments = true;//忽略文档里面的注释
XmlReader xmlReader = XmlReader.Create(File_NodeInfo, xmlReaderSettings);
doc.Load(xmlReader);
XmlNode xn = doc.SelectSingleNode("nodes");
XmlNodeList xnl = xn.ChildNodes;
foreach (XmlNode xnode in xnl)
{
// nodeInfo.Add(new Node(id, name, ip, alicename, nodeType, area, isUse));
Node node = new Node();
// 将节点转换为元素,便于得到节点的属性值
XmlElement xe = (XmlElement)xnode;
// 得到属性的属性值
node.Id = int.Parse(xe.GetAttribute("id"));
// 得到节点的所有子节点
XmlNodeList xnl0 = xe.ChildNodes;
node.IP = xnl0.Item(0).InnerText;
node.Name = xnl0.Item(1).InnerText;
node.IsUse = bool.Parse(xnl0.Item(2).InnerText);
node.AliceName = xnl0.Item(3).InnerText;
node.Type = (NodeType)Enum.Parse(typeof(NodeType),xnl0.Item(4).InnerText);
node.Workshop =xnl0.Item(5).InnerText;
node.Init();
nodes.Add(node);
}
xmlReader.Close();
isLoadNode = true;
LogUtil.info($"加载节点配置成功{File_NodeInfo}");
}
public static void SetNodeIsUse(Node node)
{
if (!isLoadNode) return;
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(File_NodeInfo);
XmlElement xe = xmlDoc.DocumentElement; // DocumentElement 获取xml文档对象的根XmlElement.
string strPath = string.Format("/nodes/node[@id=\"{0}\"]", node.Id);
XmlElement selectXe = (XmlElement)xe.SelectSingleNode(strPath); //selectSingleNode 根据XPath表达式,获得符合条件的第一个节点.
//selectXe.SetAttribute("Type", dgvBookInfo.CurrentRow.Cells[0].Value.ToString());//也可以通过SetAttribute来增加一个属性
selectXe.GetElementsByTagName("IsUse").Item(0).InnerText = node.IsUse.ToString();
xmlDoc.Save(File_NodeInfo);
}
public static void LoadTaskInfos(List<AgvTask> tasks)
{
XmlDocument doc = new XmlDocument();
XmlReaderSettings xmlReaderSettings = new XmlReaderSettings();
xmlReaderSettings.IgnoreComments = true;//忽略文档里面的注释
XmlReader xmlReader = XmlReader.Create(File_AgvTaskInfo, xmlReaderSettings);
doc.Load(xmlReader);
XmlNode xn = doc.SelectSingleNode("tasks");
XmlNodeList xnl = xn.ChildNodes;
foreach (XmlNode xnode in xnl)
{
// nodeInfo.Add(new Node(id, name, ip, alicename, nodeType, area, isUse));
AgvTask node = new AgvTask();
// 将节点转换为元素,便于得到节点的属性值
XmlElement xe = (XmlElement)xnode;
// 得到属性的属性值
node.Id = int.Parse(xe.GetAttribute("id"));
// 得到节点的所有子节点
XmlNodeList xnl0 = xe.ChildNodes;
node.Name = xnl0.Item(0).InnerText;
node.AliceName = xnl0.Item(1).InnerText;
node.Guid = xnl0.Item(2).InnerText;
node.Type = (TaskType)Enum.Parse(typeof(TaskType), xnl0.Item(3).InnerText);
tasks.Add(node);
}
xmlReader.Close();
LogUtil.info($"加载任务配置成功{File_AgvTaskInfo}");
}
public static void LoadChargePileInfos(bean.ChargePiles chargePiles)
{
XmlDocument doc = new XmlDocument();
XmlReaderSettings xmlReaderSettings = new XmlReaderSettings();
xmlReaderSettings.IgnoreComments = true;//忽略文档里面的注释
XmlReader xmlReader = XmlReader.Create(File_ChargePileInfo, xmlReaderSettings);
doc.Load(xmlReader);
XmlNode xnMin = doc.SelectSingleNode("root/min");
chargePiles.BatteryMin = int.Parse(xnMin.InnerText);
XmlNode xnMid = doc.SelectSingleNode("root/mid");
chargePiles.BatteryMiddle = int.Parse(xnMid.InnerText);
XmlNode xnMax = doc.SelectSingleNode("root/max");
chargePiles.BatteryMax = int.Parse(xnMax.InnerText);
XmlNode xn = doc.SelectSingleNode("root/piles");
XmlNodeList xnl = xn.ChildNodes;
foreach (XmlNode xnode in xnl)
{
bean.ChargePile node = new bean.ChargePile();
// 将节点转换为元素,便于得到节点的属性值
XmlElement xe = (XmlElement)xnode;
// 得到属性的属性值
node.Id = int.Parse(xe.GetAttribute("id"));
// 得到节点的所有子节点
XmlNodeList xnl0 = xe.ChildNodes;
node.Name = xnl0.Item(0).InnerText;
node.AliceName = xnl0.Item(1).InnerText;
node.Guid = xnl0.Item(2).InnerText;
node.Fixed = bool.Parse(xnl0.Item(3).InnerText);
XmlNode xnAgv = xnl0.Item(4);
XmlNodeList xnAgvs = xnAgv.ChildNodes;
foreach (XmlNode item in xnAgvs)
{
node.Agvs.Add(item.InnerText);
}
chargePiles.AddPile(node);
}
xmlReader.Close();
LogUtil.info($"加载充电桩配置成功{File_ChargePileInfo}");
}
}
}
文件属性发生变化
<?xml version="1.0" encoding="utf-8"?>
<agvs>
<agv id="49" ip="10.85.199.81">
<name>1号车</name>
<!--职责范围-->
<Scope>
<Workshop>4D</Workshop>
<!--可执行的任务: 无,
治具,
PCB,
Tray盘,
PCBA,
包材,
静电箱,
半成品,
成品,
台车,
垃圾-->
<Tasks>
<Task>PCB</Task>
<Task>Tray盘</Task>
</Tasks>
<!--使用的电梯,多个电梯使用逗号隔开-->
<Remark>LIFT_D2</Remark>
</Scope>
<!--是否自动-->
<Auto>False</Auto>
<UseFleet>true</UseFleet>
<FleetIp>10.85.199.3</FleetIp>
<Authorization>Basic ZGlzdHJpYnV0b3I6NjJmMmYwZjFlZmYxMGQzMTUyYzk1ZjZmMDU5NjU3NmU0ODJiYjhlNDQ4MDY0MzNmNGNmOTI5NzkyODM0YjAxNA==</Authorization>
<IO_GUIDs>
<IO_GUID index="0">6ad07e3a-e0e9-11eb-a184-0001299981d4</IO_GUID>
</IO_GUIDs>
</agv>
<agv id="50" ip="10.85.199.82">
<name>2号车</name>
<!--职责范围-->
<Scope>
<Workshop>4D</Workshop>
<!--可执行的任务: 无,
治具,
PCB,
Tray盘,
PCBA,
包材,
静电箱,
半成品,
成品,
台车,
垃圾-->
<Tasks>
<Task>PCB</Task>
<Task>Tray盘</Task>
</Tasks>
<!--使用的电梯,多个电梯使用逗号隔开-->
<Remark>LIFT_D2</Remark>
</Scope>
<!--是否自动-->
<Auto>False</Auto>
<UseFleet>true</UseFleet>
<FleetIp>10.85.199.3</FleetIp>
<Authorization>Basic ZGlzdHJpYnV0b3I6NjJmMmYwZjFlZmYxMGQzMTUyYzk1ZjZmMDU5NjU3NmU0ODJiYjhlNDQ4MDY0MzNmNGNmOTI5NzkyODM0YjAxNA==</Authorization>
<IO_GUIDs>
<IO_GUID index="0">6ad07e3a-e0e9-11eb-a184-0001299981d4</IO_GUID>
</IO_GUIDs>
</agv>
</agvs>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="utf-8" ?>
<root>
<!--最小充电电量,小于该电量将不会执行任务-->
<min>20</min>
<!--空闲车辆需要充电的电量-->
<mid>50</mid>
<!--充电完成电量-->
<max>90</max>
<piles>
<pile id ="0">
<!--名称-->
<name>AutoCharge1</name>
<!--别名-->
<alicename>充电位1</alicename>
<guid>40c17cb4-e2f2-11eb-8a99-94c691a7387d</guid>
<!--固定充电桩-->
<fixed>true</fixed>
<!--固定充电桩为true,取第一个;false则判断所有agv.填写AGV编号-->
<agvs>
<agv>49</agv>
</agvs>
</pile>
</piles>
</root>
<?xml version="1.0" encoding="utf-8" ?>
<nodes>
<node id ="0">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>PCBAWarehouse</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>PCBA库房</alicename>
<type>Node</type>
<!--所在车间-->
<Area>1C</Area>
</node>
<node id ="1">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>ToolingWarehouse</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>治具库房</alicename>
<type>Node</type>
<!--所在车间-->
<Area>1C</Area>
</node>
<node id ="2">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>1FPackageArea</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>1F包材区</alicename>
<type>Node</type>
<!--所在车间-->
<Area>1C</Area>
</node>
<node id ="3">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>EmptyCarArea</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>空车区</alicename>
<type>Node</type>
<!--所在车间-->
<Area>1D</Area>
</node>
<node id ="4">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>FinishedProductArea</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>成品区</alicename>
<type>Node</type>
<!--所在车间-->
<Area>1D</Area>
</node>
<node id ="5">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>S3Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>S3线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3D</Area>
</node>
<node id ="6">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>S3Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>S3线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3D</Area>
</node>
<node id ="7">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>S4Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>S4线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3D</Area>
</node>
<node id ="8">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>S4Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>S4线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3D</Area>
</node>
<node id ="9">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>S5Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>S5线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3D</Area>
</node>
<node id ="10">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>S6Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>S6线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3D</Area>
</node>
<node id ="11">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>S6Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>S6线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3D</Area>
</node>
<node id ="12">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>S7Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>S7线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3D</Area>
</node>
<node id ="13">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>S7Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>S7线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3D</Area>
</node>
<node id ="14">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>S8Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>S8线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3D</Area>
</node>
<node id ="15">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>S8Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>S8线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3D</Area>
</node>
<node id ="16">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>S9Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>S9线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3D</Area>
</node>
<node id ="17">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>S9Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>S9线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3D</Area>
</node>
<node id ="18">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>S10Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>S10线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3D</Area>
</node>
<node id ="19">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>S10Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>S10线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3D</Area>
</node>
<node id ="20">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>S11Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>S11线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3D</Area>
</node>
<node id ="21">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>S11Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>S11线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3D</Area>
</node>
<node id ="22">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>S12Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>S12线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3D</Area>
</node>
<node id ="23">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>S12Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>S12线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3D</Area>
</node>
<node id ="24">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>MI1</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>MI1线</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3D</Area>
</node>
<node id ="25">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>MI2</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>MI2线</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3D</Area>
</node>
<node id ="26">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>MI3</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>MI3线</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3D</Area>
</node>
<node id ="27">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>3DPCBABuff</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3DPCBA暂放区</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3D</Area>
</node>
<node id ="28">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>S13Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>S13线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3D</Area>
</node>
<node id ="29">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>S13Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>S13线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3D</Area>
</node>
<node id ="30">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>T1</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>T1线</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="31">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>T2</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>T2线</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="32">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>T3</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>T3线</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="33">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>T4</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>T4线</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="34">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>T5</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>T5线</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="35">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>T6</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>T6线</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="36">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>T7</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>T7线</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="37">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>T8</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>T8线</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="38">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>T9</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>T9线</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="39">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>4DPCBABuff</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>4DPCBA暂放区</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="40">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D1Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D1线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="41">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D1Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D1线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="42">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D1Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D1线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="43">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D1Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D1线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="44">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D2Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D2线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="45">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D2Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D2线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="46">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D3Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D3线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="47">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D3Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D3线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="48">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D4Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D4线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="49">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D4Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D4线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="50">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D5Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D5线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="51">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D5Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D5线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="52">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D6Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D6线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="53">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D6Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D6线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="54">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D7Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D7线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="55">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D7Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D7线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="56">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D8Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D8线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="57">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D8Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D8线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="58">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D9Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D9线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="59">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D9Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D9线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="60">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D10Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D10线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="61">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D10Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D10线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="62">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D11Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D11线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="63">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D11Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D11线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="64">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D12Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D12线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="65">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D12Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D12线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="66">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D13Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D13线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="67">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D13Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D13线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="68">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D14Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D14线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="69">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D14Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D14线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="70">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D15Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D15线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="71">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D15Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D15线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="72">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D16Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D16线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="73">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D16Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D16线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4D</Area>
</node>
<node id ="74">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>3CPackageArea</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3C包材区</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="75">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>3C5EWarehouse</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3C5E库房</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="76">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>3CCarPackageArea</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3C车载包装区</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="77">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>P01</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CP01</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="78">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>P03</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CP03</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="79">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>P05</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CP05</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="80">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>B01</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CB01</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="81">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>B02</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CB02</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="82">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>B03</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CB03</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="83">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>B04</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CB04</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="84">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>B05</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CB05</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="85">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>B06</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CB06</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="86">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>B07</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CB07</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="87">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>B08</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CB08</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="88">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>B09</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CB09</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="89">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>B10</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CB10</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="90">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>B11</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CB11</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="91">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>B12</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CB12</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="92">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>B13</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CB13</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="93">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>B14</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CB14</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="94">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>B15</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CB15</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="95">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>B16</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CB16</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="96">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>B17</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CB17</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="97">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>B18</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CB18</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="98">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>B19</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CB19</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="99">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>B20</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CB20</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="100">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>B21</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CB21</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="101">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>B22</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CB22</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="102">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>B23</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CB23</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="103">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>B24</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CB24</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="104">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>Y20</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CY20</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="105">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>Y21</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CY21</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="106">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>Y25</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CY25</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="107">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>Y26</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CY26</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="108">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>Y27</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CY27</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="109">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>Y30</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CY30</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="110">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>Y31</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CY31</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="111">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>Y32</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CY32</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="112">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>Y35</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CY35</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="113">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>Y37</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CY37</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="114">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>Y38</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CY38</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="115">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>Y39</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CY39</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="116">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>Y40</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CY40</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="117">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>Y41</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CY41</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="118">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>Y42</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>3CY42</alicename>
<type>Node</type>
<!--所在车间-->
<Area>3C</Area>
</node>
<node id ="119">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>C1Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>C1线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4C</Area>
</node>
<node id ="120">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>C1Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>C1线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4C</Area>
</node>
<node id ="121">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>C2Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>C2线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4C</Area>
</node>
<node id ="122">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>C2Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>C2线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4C</Area>
</node>
<node id ="123">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>C3Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>C3线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4C</Area>
</node>
<node id ="124">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>C3Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>C3线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4C</Area>
</node>
<node id ="125">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>C4Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>C4线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4C</Area>
</node>
<node id ="126">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>C4Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>C4线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4C</Area>
</node>
<node id ="127">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>C5Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>C5线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4C</Area>
</node>
<node id ="128">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>C5Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>C5线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4C</Area>
</node>
<node id ="129">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>C6Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>C6线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4C</Area>
</node>
<node id ="130">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>C6Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>C6线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4C</Area>
</node>
<node id ="131">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>C7Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>C7线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4C</Area>
</node>
<node id ="132">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>C7Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>C7线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4C</Area>
</node>
<node id ="133">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>C8Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>C8线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4C</Area>
</node>
<node id ="134">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>C8Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>C8线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4C</Area>
</node>
<node id ="135">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>C9Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>C9线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4C</Area>
</node>
<node id ="136">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>C9Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>C9线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4C</Area>
</node>
<node id ="137">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>C10Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>C10线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4C</Area>
</node>
<node id ="138">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>C10Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>C10线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4C</Area>
</node>
<node id ="139">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>C14Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>C14线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4C</Area>
</node>
<node id ="140">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>C14Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>C14线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4C</Area>
</node>
<node id ="141">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>C15Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>C15线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4C</Area>
</node>
<node id ="142">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>C15Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>C15线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4C</Area>
</node>
<node id ="143">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>C16Head</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>C16线头</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4C</Area>
</node>
<node id ="144">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>C16Tail</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>C16线尾</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4C</Area>
</node>
<node id ="145">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>4CPCBABuff</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>4CPCBA暂放区</alicename>
<type>Node</type>
<!--所在车间-->
<Area>4C</Area>
</node>
<node id ="146">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>LIFT_D2</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>电梯D2</alicename>
<type>Lift</type>
<!--所在车间-->
<Area>D</Area>
</node>
<node id ="147">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>LIFT_C1</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>电梯C1</alicename>
<type>Lift</type>
<!--所在车间-->
<Area>C</Area>
</node>
</nodes>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="utf-8" ?>
<tasks>
<task id ="0">
<name>Init</name>
<alicename>初始化</alicename>
<guid>2bcd29b8-e2f2-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>None</type>
</task>
<task id ="1">
<name>Standby</name>
<alicename>待机位</alicename>
<guid>501522b3-e2f2-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>None</type>
</task>
<task id ="2">
<name>PutShelfOn</name>
<alicename>拾取料车</alicename>
<guid>31a3a69e-e310-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>InOut</type>
</task>
<task id ="3">
<name>TakeShelfOff</name>
<alicename>卸下料车</alicename>
<guid>ba68ea32-e310-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>InOut</type>
</task>
<task id ="4">
<name>LIFT_D2</name>
<alicename>移动到D2电梯口</alicename>
<guid>ba68ea32-e310-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="5">
<name>Leave_LIFT_D2</name>
<alicename>离开D2电梯</alicename>
<guid>ba68ea32-e310-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="5">
<name>LIFT_D2_TakeShelfOff</name>
<alicename>D2电梯放料点</alicename>
<guid>ba68ea32-e310-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="6">
<name>LIFT_D2_PutShelfOn</name>
<alicename>D2电梯取料点</alicename>
<guid>ba68ea32-e310-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="7">
<name>LIFT_D2_Temp1_TakeShelfOff</name>
<alicename>D2电梯临时点1的放料点</alicename>
<guid>ba68ea32-e310-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="8">
<name>LIFT_D2_Temp1_PutShelfOn</name>
<alicename>D2电梯临时点1的取料点</alicename>
<guid>ba68ea32-e310-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="9">
<name>LIFT_D2_Temp2_TakeShelfOff</name>
<alicename>D2电梯临时点2的放料点</alicename>
<guid>ba68ea32-e310-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="10">
<name>LIFT_D2_Temp2_PutShelfOn</name>
<alicename>D2电梯临时点2的取料点</alicename>
<guid>ba68ea32-e310-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="11">
<name>T1_TakeShelfOff</name>
<alicename>T1线的放料点</alicename>
<guid>ba68ea32-e310-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="12">
<name>T1_PutShelfOn</name>
<alicename>T1线的取料点</alicename>
<guid>ba68ea32-e310-11eb-8a99-94c691a7387d</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
</tasks>
\ No newline at end of file \ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using System.Web.Script.Serialization;
using Common;
using log4net.Util;
using RestSharp;
namespace DeviceLibrary
{
public class Control
{
private static log4net.ILog log = log4net.LogManager.GetLogger("Control");
static Dictionary<string, RunInfo> runInfoMap = new Dictionary<string, RunInfo>();
private System.Timers.Timer AgvCallTimer;
private System.Timers.Timer AgvStateTimer;
private System.Timers.Timer NodeStateTimer;
//public List<string> Marks;
private const int REG_STATUS = 20;
//private List<string> shelfLockedNodeNames;
public delegate void AgvChangedEvent(int agvIndex);
public event AgvChangedEvent AgvChanged;
public event AgvChangedEvent AgvOnline;
//public event AgvChangedEvent NodeChangedEvent;
public Control()
{
AgvCallTimer = new System.Timers.Timer
{
Interval = 500,
AutoReset = true,
Enabled = false
};
AgvCallTimer.Elapsed += AgvCallTimer_Elapsed;
AgvStateTimer = new System.Timers.Timer
{
Interval = 5000,
AutoReset = true,
Enabled = false
};
AgvStateTimer.Elapsed += AgvStateTimer_Elapsed;
NodeStateTimer = new System.Timers.Timer
{
Interval = 5000,
AutoReset = true,
Enabled = false
};
NodeStateTimer.Elapsed += NodeStateTimer_Elapsed;
}
public void Start()
{
AgvCallTimer.Enabled = true;
AgvStateTimer.Enabled = true;
NodeStateTimer.Enabled = true;
AgvCallTimer.Start();
AgvStateTimer.Start();
NodeStateTimer.Start();
}
public void Stop()
{
AgvCallTimer.Enabled = false;
AgvStateTimer.Enabled = false;
NodeStateTimer.Enabled = false;
AgvCallTimer.Stop();
AgvStateTimer.Stop();
NodeStateTimer.Stop();
}
private bool NodeStateInProcess = false;
private void NodeStateTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
if (NodeStateInProcess) return;
NodeStateInProcess = true;
NodeStateInProcess = false;
}
private bool AgvStateInProcess = false;
//private eAGVState preAGVState = eAGVState.None;
private void AgvStateTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
bool rtn;
if (AgvStateInProcess) return;
AgvStateInProcess = true;
//List<AlarmMsg> msglist = new List<AlarmMsg>();
for (int i = 0; i < AGVManager.agvInfo.Count; i++)
{
try
{
AGVManager.agvInfo[i].SetKanban();
if (!CheckOnline(i)) continue;
bool change = false;
if (!AGVManager.agvInfo[i].TaskRunState.IsAllocatingTask && AGVManager.agvInfo[i].Auto && AGVManager.agvInfo[i].CurJob != null && AGVManager.agvInfo[i].TaskRunState.TaskID.Equals(-1))
{
if (!MiR_API.Get_MissionByDescrp(AGVManager.agvInfo[i]))
{
AGVManager.agvInfo[i].CurJob.ResendTask(AGVManager.agvInfo[i]);
log.Info($"{AGVManager.agvInfo[i].Name}:Task=-1处理,Fleet无任务,重发任务:{AGVManager.agvInfo[i].TaskRunState.Task.Name}");
}
else
{
log.Info($"{AGVManager.agvInfo[i].Name}:Task=-1处理,Fleet有任务,自动赋值FleetTaskID={AGVManager.agvInfo[i].TaskRunState.TaskID}");
}
}
MiR_API.Get_Task_State(AGVManager.agvInfo[i]);
Thread.Sleep(50);
MiR_API.Get_IO_Status(AGVManager.agvInfo[i]);
//获取AGV状态
rtn = MiR_API.Get_State(AGVManager.agvInfo[i], out eAGVState stateID, out string stateText, out int battery, out string mission_text, out AgvInfo.MirPosition position);
Thread.Sleep(50);
if (rtn) change = AGVManager.agvInfo[i].SetState(stateID, battery, mission_text, position);
// if (change)
{
AgvChanged?.Invoke(i);
}
}
catch (Exception ex)
{
log.Error("AgvStateTimer_" + AGVManager.agvInfo[i].Name + ex.Message + ex.StackTrace);
}
}
manager.UploadManager.UploadAgvState();
AgvStateInProcess = false;
}
/// <summary>
/// 从节点获取任务
/// </summary>
/// <param name="agv_Info"></param>
/// <returns></returns>
public Job GetJob(AgvInfo agv_Info)
{
foreach (JobType jobType in AGVManager.jobTypes)
{
Job job = null;
if (agv_Info.Auto)
job = jobType.GetNewJob(agv_Info);
else
return null;
if (job != null)
{
log.Debug(agv_Info.Name + " GetJob OK " + job.ToString());
return job;
}
}
return null;
}
private bool AgvCallInProcess = false;
private void AgvCallTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
if (AgvCallInProcess) return;
AgvCallInProcess = true;
for (int i = 0; i < AGVManager.agvInfo.Count; i++)
{
try
{
AgvInfo agv = AGVManager.agvInfo[i];
if (!agv.IsCon) continue; //AGV网络连接
if (!AGVManager.agvInfo[i].Auto) continue; //AGV是否可用
//Ready,Pause,Executing,Error
if(AGVManager.agvInfo[i].StateID.Equals(eAGVState.Pause))
{
MiR_API.State_Ready(AGVManager.agvInfo[i]);
continue;
}
if (AGVManager.agvInfo[i].StateID.Equals(eAGVState.Error))
{
MiR_API.Clear_Error(AGVManager.agvInfo[i]);
continue;
}
if (!AGVManager.agvInfo[i].StateID.Equals(eAGVState.Ready)
&& !AGVManager.agvInfo[i].StateID.Equals(eAGVState.Executing) && !AGVManager.agvInfo[i].StateID.Equals(eAGVState.None))
{
log.Warn(string.Format("{0}不能调用 StateID={1}", AGVManager.agvInfo[i].Name, AGVManager.agvInfo[i].StateID.ToString()));
continue;
}
if (agv.TaskRunState.DeWaitTaskQueue(out AgvTask task))
{
if (agv.CurJob != null)
{
agv.CurJob.ResendTask(agv);
}
else
{
agv.TaskRunState.ClearWaitTaskQueue();
}
}
if (agv.CurJob == null)
{
Job job = GetJob(agv);
if (job != null)
{
agv.CurJob = job;
}
}
if (agv.CurJob != null)
{
agv.CurJob = agv.CurJob.Execute(agv);
}
}
catch (Exception ex)
{
log.Error("AgvCall " + ex.Message + ex.StackTrace);
}
}
AgvCallInProcess = false;
}
private bool CheckOnline(int idx)
{
bool rtn = MiR_API.CheckIP(AGVManager.agvInfo[idx].IP);
if (rtn)
{
if (AGVManager.agvInfo[idx].IsCon)
{
log.Debug(AGVManager.agvInfo[idx].Name + " Online");
}
else
{
AGVManager.agvInfo[idx].IsCon = true;
log.Info(AGVManager.agvInfo[idx].Name + " Online");
AgvOnline?.Invoke(idx);
}
}
else
{
if (AGVManager.agvInfo[idx].IsCon)
{
AGVManager.agvInfo[idx].IsCon = false;
log.Info(AGVManager.agvInfo[idx].Name + " Offline");
AgvOnline?.Invoke(idx);
}
else
{
log.Debug(AGVManager.agvInfo[idx].Name + " Offline");
}
}
return rtn;
}
}
}
public class RunInfo
{
/// <summary>
/// AGV编号
/// </summary>
public string AGVNum { get; set; } = "";
/// <summary>
/// 时间
/// </summary>
public string DateTime { get; set; } = "";
/// <summary>
/// 任务信息
/// </summary>
public string MissionInfo { get; set; } = "";
public RunInfo(string AGVNum, string missionInfo)
{
//2006-01-02 15:04:05
DateTime = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
this.AGVNum = AGVNum;
MissionInfo = missionInfo;
}
public RunInfo() { }
public override bool Equals(object obj)
{
if (obj is RunInfo)
{
RunInfo info = (RunInfo)obj;
if (this.MissionInfo.Equals(info.MissionInfo))
return true;
this.MissionInfo = info.MissionInfo;
}
return false;
}
public override string ToString()
{
return JsonHelper.SerializeObject(this);
}
}
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{F9619F07-15F1-4E59-A383-3871952BBB79}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DeviceLibrary</RootNamespace>
<AssemblyName>DeviceLibrary</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<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>
</Reference>
<Reference Include="RestSharp">
<HintPath>.\RestSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.ServiceModel.Activation" />
<Reference Include="System.ServiceModel.Web" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="TcpKPIO">
<HintPath>..\AGVDispatch\dll\TcpKPIO.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="bean\agv\Agv_Info.cs" />
<Compile Include="bean\agv\Scope.cs" />
<Compile Include="bean\ChargePiles.cs" />
<Compile Include="bean\jobType\LineToLineJobType.cs" />
<Compile Include="bean\jobType\StoreToLinesWithBackJobType.cs" />
<Compile Include="bean\job\ChargeJob.cs" />
<Compile Include="bean\job\StoreToLinesWithBackJob.cs" />
<Compile Include="bean\job\LineToLineJob.cs" />
<Compile Include="bean\job\SendToLinesWithBackJob.cs" />
<Compile Include="bean\job\F1LiftToStoreJob.cs" />
<Compile Include="bean\job\F1StoreToLiftJob.cs" />
<Compile Include="bean\JobParam.cs" />
<Compile Include="bean\jobType\F1LiftToStoreJobType.cs" />
<Compile Include="bean\jobType\F1StoreToLiftJobType.cs" />
<Compile Include="bean\TaskRunState.cs" />
<Compile Include="bean\jobType\SendToLinesWithBackJobType.cs" />
<Compile Include="bean\job\StandyJob.cs" />
<Compile Include="bean\Task.cs" />
<Compile Include="bean\Node.cs" />
<Compile Include="bean\RunStep.cs" />
<Compile Include="Control.cs" />
<Compile Include="lift\ClientStatus.cs" />
<Compile Include="lift\LiftContext.cs" />
<Compile Include="lift\LiftStatus.cs" />
<Compile Include="manager\IOManager.cs" />
<Compile Include="manager\NodeManager.cs" />
<Compile Include="manager\OpManager.cs" />
<Compile Include="manager\HttpManager.cs" />
<Compile Include="AgvServer.cs" />
<Compile Include="bean\job\Job.cs" />
<Compile Include="bean\JobStep.cs" />
<Compile Include="bean\jobType\JobType.cs" />
<Compile Include="bean\jobType\ChargeJobType.cs" />
<Compile Include="manager\ChargePileManager.cs" />
<Compile Include="manager\AGVManager.cs" />
<Compile Include="DisplayBoard.cs" />
<Compile Include="bean\MiR_API.cs" />
<Compile Include="Config\XmlConfigOperation.cs" />
<Compile Include="manager\AgvTaskManager.cs" />
<Compile Include="manager\UploadManager.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="service\IService.cs" />
<Compile Include="manager\MissionManager.cs" />
<Compile Include="bean\Shelf.cs" />
<Compile Include="service\model\AgvState.cs" />
<Compile Include="service\model\ConfirmOperation.cs" />
<Compile Include="service\model\DeleteMission.cs" />
<Compile Include="service\model\DoorInfo.cs" />
<Compile Include="service\model\MissionInfo.cs" />
<Compile Include="service\model\SendInInfo.cs" />
<Compile Include="service\model\TransportStatus.cs" />
<Compile Include="service\model\UpdateMission.cs" />
<Compile Include="service\Service.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AGV_UI\AGV_UI.csproj">
<Project>{c6d2fc09-46f7-4ec5-a877-15ea06342e4f}</Project>
<Name>AGV_UI</Name>
</ProjectReference>
<ProjectReference Include="..\Common\Common.csproj">
<Project>{bafeafe6-04e2-48ee-8845-bfc7ea3e3c21}</Project>
<Name>Common</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Config\agvinfos.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Config\chargeinfos.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Config\nodeinfos.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Config\taskinfos.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file \ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
public class DisplayBoard
{
/// <summary>
/// 异常列表
/// </summary>
public List<AlarmMsg> MsgList { get; private set; }
/// <summary>
/// 看板类
/// </summary>
public DisplayBoard()
{
MsgList = new List<AlarmMsg>();
}
/// <summary>
/// 添加上报信息
/// </summary>
/// <param name="name"></param>
/// <param name="key"></param>
/// <param name="value"></param>
/// <param name="type">默认类型是异常,1表示正常信息</param>
public void Add(string name, string key, string value, int type = 0)
{
MsgList.Add(new AlarmMsg(name, key, value, type));
}
private void ClearAlram()
{
if (MsgList != null && MsgList.Count > 0)
MsgList.Clear();
}
public void UpdateAlarmMsg()
{
if (MsgList != null && MsgList.Count > 0)
{
HttpManager.updateDeviceAlarmMsg(MsgList);
ClearAlram();
}
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("DeviceLibrary")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DeviceLibrary")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("f9619f07-15f1-4e59-a383-3871952bbb79")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
此文件类型无法预览
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
namespace DeviceLibrary
{
//public class ScopeLimit
//{
// List<string> agvIPs;
// //不规则图像坐标
// List<Agv_Info.AgvPosition> positions;
// Thread threadPoll;//监控线程
// /// <summary>
// /// 区域是否可用
// /// </summary>
// public bool Available { get; private set; } = true;
// public delegate void ScopeLimitStateChangedEventHandler(string ip, bool state);
// public event ScopeLimitStateChangedEventHandler ScopeLimitStateChangedEvent;
// public ScopeLimit(List<Agv_Info.AgvPosition> positions)
// {
// agvIPs = new List<string>();
// agvIPs.AddRange(new string[]
// {
// "10.85.199.68",
// "10.85.199.69",
// "10.85.199.70",
// "10.85.199.71",
// "10.85.199.72",
// "10.85.199.73",
// "10.85.199.74",
// "10.85.199.80",
// "10.85.199.81",
// "10.85.199.114"
// });
// this.positions = positions;
// threadPoll = new Thread(ScopeDetecting);
// threadPoll.IsBackground = true;
// threadPoll.Start();
// }
// private void ScopeDetecting()
// {
// bool rtn;
// while (true)
// {
// Thread.Sleep(5000);
// List<string> agvs = new List<string>();
// foreach (string ip in agvIPs)
// {
// Thread.Sleep(1000);
// rtn = MiR_API.Get_Position(ip, AGVManager.agvInfo[0].Authorization, out Agv_Info.AgvPosition position);
// if (rtn)
// {
// if (IsInPolygon(position, positions))
// {
// agvs.Add(ip);
// }
// }
// }
// if (agvs.Count > 0)
// {
// Available = false;
// ScopeLimitStateChangedEvent?.Invoke(string.Join(";", agvs), Available);
// }
// else //不在限制区域
// {
// if (!Available)
// {
// Available = true;
// ScopeLimitStateChangedEvent?.Invoke("", Available);
// }
// }
// }
// }
// /// <summary>
// /// 判断点是否在多边形内.
// /// ----------原理----------
// /// 注意到如果从P作水平向左的射线的话,如果P在多边形内部,那么这条射线与多边形的交点必为奇数,
// /// 如果P在多边形外部,则交点个数必为偶数(0也在内)。
// /// </summary>
// /// <param name="checkPoint">要判断的点</param>
// /// <param name="polygonPoints">多边形的顶点</param>
// /// <returns></returns>
// bool IsInPolygon(Agv_Info.AgvPosition checkPoint, List<Agv_Info.AgvPosition> polygonPoints)
// {
// bool inside = false;
// int pointCount = polygonPoints.Count;
// Agv_Info.AgvPosition p1, p2;
// for (int i = 0, j = pointCount - 1; i < pointCount; j = i, i++)//第一个点和最后一个点作为第一条线,之后是第一个点和第二个点作为第二条线,之后是第二个点与第三个点,第三个点与第四个点...
// {
// p1 = polygonPoints[i];
// p2 = polygonPoints[j];
// if (checkPoint.y < p2.y)
// {//p2在射线之上
// if (p1.y <= checkPoint.y)
// {//p1正好在射线中或者射线下方
// if ((checkPoint.y - p1.y) * (p2.x - p1.x) > (checkPoint.x - p1.x) * (p2.y - p1.y))//斜率判断,在P1和P2之间且在P1P2右侧
// {
// //射线与多边形交点为奇数时则在多边形之内,若为偶数个交点时则在多边形之外。
// //由于inside初始值为false,即交点数为零。所以当有第一个交点时,则必为奇数,则在内部,此时为inside=(!inside)
// //所以当有第二个交点时,则必为偶数,则在外部,此时为inside=(!inside)
// inside = (!inside);
// }
// }
// }
// else if (checkPoint.y < p1.y)
// {
// //p2正好在射线中或者在射线下方,p1在射线上
// if ((checkPoint.y - p1.y) * (p2.x - p1.x) < (checkPoint.x - p1.x) * (p2.y - p1.y))//斜率判断,在P1和P2之间且在P1P2右侧
// {
// inside = (!inside);
// }
// }
// }
// return inside;
// }
//}
}
文件属性发生变化
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary.bean
{
public class ChargePiles
{
List<ChargePile> chargePiles;
/// <summary>
/// 充电最大电量
/// </summary>
public int BatteryMax { get; set; } = 90;
/// <summary>
/// 充电最小电量,小于该值直接去充电
/// </summary>
public int BatteryMin { get; set; } = 20;
/// <summary>
/// 空闲车辆充电点量
/// </summary>
public int BatteryMiddle { get; set; } = 50;
public ChargePiles()
{
chargePiles = new List<ChargePile>();
}
public List<ChargePile> GetChargePiles()
{
return chargePiles;
}
public void AddPile(ChargePile pile)
{
chargePiles.Add(pile);
}
public ChargePile GetChargePileByName(string name)
{
return chargePiles.Find(s=>s.Name.Equals(name));
}
public ChargePile GetChargePileById(int id)
{
return chargePiles.Find(s => s.Id.Equals(id));
}
public List<ChargePile> GetChargePilesByAgv(AgvInfo agv)
{
return chargePiles.FindAll(s => s.Agvs.Contains(agv.ID));
}
public ChargePile GetChargePileByAgv(AgvInfo agv)
{
return chargePiles.Find(s => s.Agvs.Contains(agv.ID));
}
}
public class ChargePile
{
/// <summary>
/// 充电桩ID
/// </summary>
public int Id { get; set; } = -1;
/// <summary>
/// 充电桩名称
/// </summary>
public string Name { get; set; } = "";
/// <summary>
/// 充电桩别名
/// </summary>
public string AliceName { get; set; } = "";
public string Guid { get; set; } = "";
/// <summary>
/// 是否是固定充电桩
/// </summary>
public bool Fixed { get; set; } = false;
/// <summary>
/// 是否占用
/// </summary>
public bool Occupied { get; set; } = false;
/// <summary>
/// 占用充电桩的AGV
/// </summary>
public AgvInfo OccupiedAgv { get; set; }
/// <summary>
/// 可以在该处充电的agv列表
/// </summary>
public List<string> Agvs { get; set; }
public ChargePile()
{
Agvs = new List<string>();
}
/// <summary>
/// 是否有空位
/// </summary>
/// <returns></returns>
public bool HasEmpty(AgvInfo agv)
{
if (Fixed)
{
if (agv.ID.Equals(Agvs[0]))
return true;
else
return false;
}
else //多个agv共享充电桩
{
if (Agvs.Contains(agv.ID))
return Occupied;
else
return false;
}
}
/// <summary>
/// 占用充电桩
/// </summary>
/// <param name="agv"></param>
public ChargePile Occupy(AgvInfo agv)
{
Occupied = true;
OccupiedAgv = agv;
return this;
}
/// <summary>
/// 清除充电桩的占用
/// </summary>
public void DelOccupy(AgvInfo agv)
{
if(agv.Equals(OccupiedAgv))
{
Occupied = false;
OccupiedAgv = null;
}
}
}
}
using Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary.bean
{
/// <summary>
/// Job运行参数
/// </summary>
public class JobParam
{
/// <summary>
/// 初始地点
/// </summary>
public Node SrcNode { get; set; }
private service.model.MissionInfo missionInfo;
/// <summary>
/// 任务信息
/// </summary>
public service.model.MissionInfo GetMissionInfo()
{
return missionInfo;
}
/// <summary>
/// 任务信息
/// </summary>
public void SetMissionInfo(service.model.MissionInfo value)
{
missionInfo = value;
}
/// <summary>
/// 当前目标地点
/// </summary>
public Node CurTargetNode { get; set; }
/// <summary>
/// 所有目标点
/// </summary>
public List<Node> TargetNodes { get; set; }
/// <summary>
/// 料车信息
/// </summary>
public Shelf Shelf { get; set; }
public OpType OpType { get; set; } = OpType.ComToLine;
public JobParam(Node srcplace, Node tarplace =null,Shelf shelf=null, service.model.MissionInfo MissionInfo =null)
{
SrcNode = srcplace;
CurTargetNode = tarplace;
Shelf = shelf;
this.missionInfo = MissionInfo;
TargetNodes = new List<Node>();
}
}
/// <summary>
/// 操作类型
/// </summary>
public enum OpType
{
/// <summary>
/// 手动操作
/// </summary>
Mannual,
/// <summary>
/// 访问接口
/// </summary>
RequestAPI,
/// <summary>
/// 与线体通讯
/// </summary>
ComToLine,
/// <summary>
/// 手动或者访问接口
/// </summary>
MaulAndAPI,
}
}

using Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
public class JobStep<T> where T : Enum
{
private T step;
private string msg = "";
public string Msg
{
get { return msg; }
set
{
if (!string.IsNullOrEmpty(value))
{
//不为空,且与上一个消息不一样才打印
if (!value.Equals(msg))
{
LogUtil.info(value);
}
}
msg = value;
}
}
public RunInfo StepRunInfo = new RunInfo();
public DateTime startTime = DateTime.Now;
public JobStep(T initStep)
{
this.step = initStep;
this.msg = "";
}
/// <summary>
/// 当前步骤是否是某个步骤
/// </summary>
/// <param name="step"></param>
/// <returns></returns>
public bool IsStep(T step)
{
return this.step.Equals(step);
}
/// <summary>
/// 是否超时(分钟)
/// </summary>
/// <param name="timeOutMiniutes"></param>
/// <returns></returns>
public bool IsTimeOut(int timeOutMiniutes, out double timeOutValue)
{
TimeSpan span = DateTime.Now - startTime;
timeOutValue = span.TotalMinutes;
if (span.TotalMinutes > timeOutMiniutes)
{
return true;
}
return false;
}
/// <summary>
/// 进入下一个步骤
/// </summary>
/// <param name="nextStep"></param>
public void ToNextStep(T nextStep)
{
AGVManager.RunLogInfo(StepRunInfo);
step = nextStep;
startTime = DateTime.Now;
}
public string CurStep()
{
return step.ToString();
}
public void EndJob()
{
AGVManager.RunLogInfo(StepRunInfo);
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Script.Serialization;
using Common;
using Microsoft.SqlServer.Server;
using RestSharp;
using static DeviceLibrary.AgvInfo;
namespace DeviceLibrary
{
public class MiR_API
{
private const int httpTimeout = 5000;
private static log4net.ILog log = log4net.LogManager.GetLogger("MiR_API");
/// <summary>
/// 获取IO模块guid列表
/// </summary>
/// <param name="info"></param>
/// <param name="guid"></param>
/// <returns></returns>
public static bool Get_IO_Modules(AgvInfo info, out string[] guid)
{
try
{
guid = null;
string url = "http://" + info.IP + "/api/v2.0.0/status?whitelist=state_id,state_text";
string json = HttpGet(url, info.IP, info.Authorization);
if (string.IsNullOrWhiteSpace(json)) return false;
JavaScriptSerializer serializer = new JavaScriptSerializer();
object[] obj = (object[])serializer.DeserializeObject(json);
if (obj == null)
{
log.Error("URL: " + url + "\n" + "Return: " + json);
return false;
}
guid = new string[obj.Length];
for (int i = 0; i < obj.Length; i++)
{
Dictionary<string, object> dic = (Dictionary<string, object>)obj[i];
guid[i] = dic["guid"].ToString();
}
log.Info("URL: " + url + "\n" + "Return: " + json);
return true;
}
catch (Exception ex)
{
guid = null;
log.Error("Get_IO_Modules", ex);
return false;
}
}
/// <summary>
/// 获取IO模块的状态
/// </summary>
/// <param name="info"></param>
/// <param name="input"></param>
/// <param name="output"></param>
/// <returns></returns>
public static void Get_IO_Status(AgvInfo info)
{
foreach (IOInfo io in info.IOStatus)
{
try
{
io.Inputs = null;
io.Outputs = null;
string url = "http://" + info.IP + "/api/v2.0.0/io_modules/" + io.IOID + "/status";
string json = HttpGet(url, info.IP, info.Authorization);
if (string.IsNullOrWhiteSpace(json)) continue;
JavaScriptSerializer serializer = new JavaScriptSerializer();
Dictionary<string, object> dic = (Dictionary<string, object>)serializer.DeserializeObject(json);
if (dic == null)
{
log.Error("URL: " + url + "\n" + "Return: " + json);
}
object[] objInput = (object[])dic["input_state"];
io.Inputs = new bool[objInput.Length];
for (int i = 0; i < io.Inputs.Length; i++)
io.Inputs[i] = Convert.ToBoolean(objInput[i]);
object[] objOutput = (object[])dic["output_state"];
io.Outputs = new bool[objOutput.Length];
for (int i = 0; i < io.Outputs.Length; i++)
io.Outputs[i] = Convert.ToBoolean(objOutput[i]);
}
catch (Exception ex)
{
io.Inputs = null;
io.Outputs = null;
//log.Error("Get_IO_Status", ex);
}
}
}
/// <summary>
/// 获取PLC寄存器的内容
/// </summary>
/// <param name="info"></param>
/// <param name="reg"></param>
/// <param name="regValue"></param>
/// <returns></returns>
public static bool Get_Register(AgvInfo info, int reg, out int regValue)
{
try
{
regValue = -1;
string url = "http://" + info.IP + "/api/v2.0.0/registers/" + reg + "?whitelist=value";
string json = HttpGet(url, info.IP, info.Authorization);
if (string.IsNullOrWhiteSpace(json)) return false;
JavaScriptSerializer serializer = new JavaScriptSerializer();
Dictionary<string, object> dic = (Dictionary<string, object>)serializer.DeserializeObject(json);
if (dic == null)
{
log.Error("URL: " + url + "\n" + "Return: " + json);
return false;
}
string s = dic["value"].ToString();
float f = Convert.ToSingle(s);
regValue = Convert.ToInt32(f);
return true;
}
catch (Exception ex)
{
regValue = -1;
log.Error("Get_Register", ex);
return false;
}
}
/// <summary>
/// 设置PLC寄存器的内容
/// </summary>
/// <param name="info"></param>
/// <param name="reg"></param>
/// <param name="regValue"></param>
/// <returns></returns>
public static bool Set_Register(AgvInfo info, int reg, int regValue)
{
try
{
string url = "http://" + info.IP + "/api/v2.0.0/registers/" + reg;
string body = "{\"value\": " + regValue + "}";
string json = HttpPost(url, info.IP, info.Authorization, body);
if (string.IsNullOrWhiteSpace(json)) return false;
JavaScriptSerializer serializer = new JavaScriptSerializer();
Dictionary<string, object> dic = (Dictionary<string, object>)serializer.DeserializeObject(json);
if (dic == null)
{
log.Error("URL: " + url + "\n" + "Return: " + json);
return false;
}
string s = dic["value"].ToString();
float f = Convert.ToSingle(s);
if (regValue == Convert.ToInt32(f))
return true;
else
return false;
}
catch (Exception ex)
{
log.Error("Set_Register", ex);
return false;
}
}
/// <summary>
/// 添加任务到任务队列
/// </summary>
/// <param name="info"></param>
/// <param name="mission_id"></param>
/// <returns></returns>
public static bool Add_Mission(AgvInfo info)
{
try
{
info.TaskRunState.IsAllocatingTask = true;
info.TaskRunState.ResetInfo();
log.Debug(string.Format("{0} Add_Mission [{1}]", info.Name, info.TaskRunState.Task.Guid));
//删除上一任务
Del_Mission(info);
string url = "http://" + info.IP + "/api/v2.0.0/mission_queue";
//string body = "{\"mission_id\":\"" + info.TaskRunState.Task.Guid + "\"}";
System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(2021, 1, 1, 8, 0, 0)); // 当地时区
long timeStamp = (long)(DateTime.Now - startTime).TotalSeconds; // 相差秒数
info.TaskRunState.TaskTimeStamp = timeStamp.ToString();
string body = "{\"mission_id\":\"" + info.TaskRunState.Task.Guid + "\",\"robot_id\":" + info.ID + ",\"description\":\"" + $"{info.TaskRunState.Task.Name}-{info.TaskRunState.TaskTimeStamp}-{info.ID}" + "\"}";
string json = HttpPost(url, info.IP, info.Authorization, body);
if (string.IsNullOrWhiteSpace(json))
{
info.TaskRunState.IsAllocatingTask = false;
return false;
}
JavaScriptSerializer serializer = new JavaScriptSerializer();
Dictionary<string, object> dic = (Dictionary<string, object>)serializer.DeserializeObject(json);
if (dic == null)
{
info.TaskRunState.IsAllocatingTask = false;
return false;
}
log.Debug("URL: " + url + "\n" + "Return: " + json);
string s = dic["mission_id"].ToString();
string id = dic["id"].ToString();
if (s == info.TaskRunState.Task.Guid && !string.IsNullOrEmpty(id))
{
info.TaskRunState.TaskID = Convert.ToInt32(id);
info.TaskRunState.IsAllocatingTask = false;
log.Debug(string.Format("{0} Add_Mission [{1}]", info.Name, info.TaskRunState.Task.Name));
return true;
}
else
{
info.TaskRunState.IsAllocatingTask = false;
return false;
}
}
catch (Exception ex)
{
log.Error("Add_Mission", ex);
info.TaskRunState.IsAllocatingTask = false;
return false;
}
}
/// <summary>
/// 添加任务到任务队列
/// </summary>
/// <param name="info"></param>
/// <param name="mission_id"></param>
/// <returns></returns>
public static bool Add_Mission_Fleet(AgvInfo info)
{
try
{
info.TaskRunState.IsAllocatingTask = true;
info.TaskRunState.ResetInfo();
//防止上一个任务已执行但返回失败时,删除任务
Del_Mission(info);
System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(2021, 1, 1, 8, 0, 0)); // 当地时区
long timeStamp = (long)(DateTime.Now - startTime).TotalSeconds; // 相差秒数
info.TaskRunState.TaskTimeStamp = timeStamp.ToString();
string ip = info.FleetIP;
string url = "http://" + ip + "/api/v2.0.0/mission_scheduler";
string body = "{\"mission_id\":\"" + info.TaskRunState.Task.Guid + "\",\"robot_id\":" + info.ID + ",\"description\":\"" + $"{info.TaskRunState.Task.Name}-{info.TaskRunState.TaskTimeStamp}-{info.ID}" + "\"}";
string json = HttpPost(url, info.IP, info.Authorization, body);
if (string.IsNullOrWhiteSpace(json))
{
info.TaskRunState.IsAllocatingTask = false;
return false;
}
JavaScriptSerializer serializer = new JavaScriptSerializer();
Dictionary<string, object> dic = (Dictionary<string, object>)serializer.DeserializeObject(json);
if (dic == null)
{
log.Error($"{info.Name} Add_Mission_Fleet Fail URL: " + url + "\n" + "Return: " + json);
info.TaskRunState.IsAllocatingTask = false;
return false;
}
string s = dic["mission_id"].ToString();
string id = dic["id"].ToString();
if (s == info.TaskRunState.Task.Guid && !string.IsNullOrEmpty(id))
{
info.TaskRunState.TaskID = Convert.ToInt32(id);
log.Debug(string.Format("{0} Add_Mission_Fleet [{1}]", info.Name, info.TaskRunState.Task.Name));
info.TaskRunState.IsAllocatingTask = false;
return true;
}
else
{
info.TaskRunState.IsAllocatingTask = false;
return false;
}
}
catch (Exception ex)
{
log.Error("Add_Mission_Fleet", ex);
info.TaskRunState.IsAllocatingTask = false;
return false;
}
}
/// <summary>
/// 获取所有任务列表
/// </summary>
/// <param name="info"></param>
/// <param name="mission">任务(名称,guid)</param>
/// <returns></returns>
public static bool Get_Mission(AgvInfo info, out Dictionary<string, string> mission)
{
mission = null;
try
{
string url = "http://" + info.IP + "/api/v2.0.0/missions/search?whitelist=guid,name";
// string body = "{\"filters\" :[]}";
string body = "{\"filters\" : [{\"fieldname\": \"description\", \"operator\": \"LIKE\", \"value\": \"" + info.TaskRunState.Task.Name + "-" + info.TaskRunState.TaskTimeStamp + "-" + info.ID + "\"}]}";
string json = HttpPost(url, info.IP, info.Authorization, body);
if (string.IsNullOrWhiteSpace(json)) return false;
JavaScriptSerializer serializer = new JavaScriptSerializer();
object[] obj = (object[])serializer.DeserializeObject(json);
if (obj == null) return false;
mission = new Dictionary<string, string>();
for (int i = 0; i < obj.Length; i++)
{
Dictionary<string, object> dic = (Dictionary<string, object>)obj[i];
mission.Add(dic["name"].ToString(), dic["guid"].ToString());
}
return true;
}
catch (Exception ex)
{
log.Error("Get_Mission", ex);
return false;
}
}
public static bool Get_MissionByDescrp(AgvInfo info)
{
if (info.UseFleet)
return Get_Fleet_Mission_Info(info);
else
return Get_Mission(info);
}
/// <summary>
/// 获取所有任务列表
/// </summary>
/// <param name="info"></param>
/// <param name="mission">任务(名称,guid)</param>
/// <returns></returns>
public static bool Get_Mission(AgvInfo info)
{
try
{
string url = "http://" + info.IP + "/api/v2.0.0/missions/search?whitelist=guid,name";
// string body = "{\"filters\" :[]}";
string body = "{\"filters\" : [{\"fieldname\": \"description\", \"operator\": \"LIKE\", \"value\": \"" + info.TaskRunState.Task.Name + "-" + info.TaskRunState.TaskTimeStamp + "-" + info.ID + "\"}]}";
string json = HttpPost(url, info.IP, info.Authorization, body);
if (string.IsNullOrWhiteSpace(json)) return false;
JavaScriptSerializer serializer = new JavaScriptSerializer();
object[] obj = (object[])serializer.DeserializeObject(json);
if (obj == null) return false;
Dictionary<string, object> dic;
if (obj.Length > 0)
{
dic = (Dictionary<string, object>)obj[0];
info.TaskRunState.TaskID = long.Parse(dic["id"].ToString());
if (info.TaskRunState.TaskID == -1)
return false;
return true;
}
return false;
}
catch (Exception ex)
{
log.Error("Get_Mission", ex);
return false;
}
}
/// <summary>
/// 获取Fleet任务队列
/// </summary>
/// <param name="info"></param>
/// <param name="mission"></param>
/// <returns></returns>
public static bool Get_Fleet_Mission_Info(AgvInfo info)
{
try
{
string ip = info.FleetIP;
string url = "http://" + ip + "/api/v2.0.0/mission_scheduler/search";
string body = "{\"filters\" : [{\"fieldname\": \"description\", \"operator\": \"LIKE\", \"value\": \"" + info.TaskRunState.Task.Name + "-" + info.TaskRunState.TaskTimeStamp + "-" + info.ID + "\"}]}";
string json = HttpPost(url, info.IP, info.Authorization, body);
if (string.IsNullOrWhiteSpace(json)) return false;
JavaScriptSerializer serializer = new JavaScriptSerializer();
object[] obj = (object[])serializer.DeserializeObject(json);
if (obj == null) return false;
Dictionary<string, object> dic;
if (obj.Length > 0)
{
dic = (Dictionary<string, object>)obj[0];
info.TaskRunState.TaskID = long.Parse(dic["id"].ToString());
if (info.TaskRunState.TaskID == -1)
return false;
return true;
}
return false;
}
catch (Exception ex)
{
log.Error("Get_Fleet_Mission_Info", ex);
return false;
}
}
/// <summary>
/// 获取当前任务队列guid
/// </summary>
/// <param name="info"></param>
/// <param name="mission"></param>
/// <returns></returns>
public static bool Get_Mission_Queue(AgvInfo info, out List<string> mission)
{
mission = null;
try
{
string url = "http://" + info.IP + "/api/v2.0.0/mission_queue/search";
string body = "{\"filters\" : [{\"fieldname\": \"state\", \"operator\": \"IN\", \"value\": [\"Pending\", \"Executing\"]}]}";
string json = HttpPost(url, info.IP, info.Authorization, body);
if (string.IsNullOrWhiteSpace(json)) return false;
JavaScriptSerializer serializer = new JavaScriptSerializer();
object[] obj = (object[])serializer.DeserializeObject(json);
if (obj == null) return false;
mission = new List<string>();
Dictionary<string, object> dic;
for (int i = 0; i < obj.Length; i++)
{
dic = (Dictionary<string, object>)obj[i];
mission.Add(dic["id"].ToString());
}
for (int i = 0; i < mission.Count; i++)
{
url = "http://" + info.IP + "/api/v2.0.0/mission_queue/" + mission[i];
json = HttpGet(url, info.IP, info.Authorization);
serializer = new JavaScriptSerializer();
dic = (Dictionary<string, object>)serializer.DeserializeObject(json);
mission[i] = dic["mission_id"].ToString();
}
return true;
}
catch (Exception ex)
{
log.Error("Get_Mission_Queue", ex);
return false;
}
}
/// <summary>
/// 删除当前所有任务
/// </summary>
/// <param name="info"></param>
public static void Del_Mission(AgvInfo info)
{
try
{
string url = "http://" + info.IP + "/api/v2.0.0/mission_queue";
HttpDel(url, info.IP, info.Authorization);
}
catch (Exception ex)
{
log.Error("Del_Mission", ex);
}
}
/// <summary>
/// 删除Fleet尽快中指定id的任务,已运行的无法删除
/// </summary>
/// <param name="authorization"></param>
/// <param name="id"></param>
public static void Del_Mission_Fleet(AgvInfo agv)
{
try
{
string ip = agv.FleetIP;
string url = "http://" + ip + "/api/v2.0.0/mission_scheduler/" + agv.TaskRunState.Task.Guid;
HttpDel(url, ip, agv.Authorization);
}
catch (Exception ex)
{
log.Error(ex);
}
}
/// <summary>
/// 获取Fleet任务状态
/// </summary>
/// <param name="CurTaskID"></param>
/// <param name="stateStr"></param>
/// <returns></returns>
public static bool Get_Task_State(AgvInfo agv)
{
try
{
if (agv.TaskRunState.TaskID == -1)
return true;
if (agv.UseFleet)
{
string ip = agv.FleetIP;
string url = "http://" + ip + "/api/v2.0.0/mission_scheduler/" + agv.TaskRunState.TaskID;
string json = HttpGet(url, ip, AGVManager.agvInfo[0].Authorization);
log.Debug("URL: " + url + "\n" + "Return: " + json);
if (string.IsNullOrWhiteSpace(json)) return false;
JavaScriptSerializer serializer = new JavaScriptSerializer();
Dictionary<string, object> dic = (Dictionary<string, object>)serializer.DeserializeObject(json);
if (dic == null) return false;
// "mission_id": "2e433130-c045-11ea-9a66-94c691a7387d",
// "id": 7178,
// "state": "Done"
string s = dic["id"].ToString();
if (s.Equals(agv.TaskRunState.TaskID.ToString()))
{
agv.TaskRunState.TaskState = dic["state"].ToString();
return true;
}
}
else
{
string url = "http://" + agv.IP + "/api/v2.0.0/mission_queue/" + agv.TaskRunState.TaskID;
string json = HttpGet(url, agv.IP, agv.Authorization);
//log.Debug("URL: " + url + "\n" + "Return: " + json);
if (string.IsNullOrWhiteSpace(json)) return false;
JavaScriptSerializer serializer = new JavaScriptSerializer();
Dictionary<string, object> dic = (Dictionary<string, object>)serializer.DeserializeObject(json);
if (dic == null) return false;
// "mission_id": "2e433130-c045-11ea-9a66-94c691a7387d",
// "id": 7178,
// "state": "Done"
string s = dic["id"].ToString();
if (s.Equals(agv.TaskRunState.TaskID.ToString()))
{
agv.TaskRunState.TaskState = dic["state"].ToString();
return true;
}
}
return false;
}
catch (Exception ex)
{
log.Error("Get_Task_State", ex);
return false;
}
}
/// <summary>
/// 获取当前小车状态
/// </summary>
/// <param name="info"></param>
/// <param name="stateID"></param>
/// <param name="stateText"></param>
/// <param name="battery"></param>
/// <param name="mission_text"></param>
/// <returns></returns>
public static bool Get_State(AgvInfo info, out eAGVState stateID, out string stateText, out int battery, out string mission_text, out MirPosition position)
{
stateID = eAGVState.UNKNOWN;
stateText = "";
battery = 0;
mission_text = "";
position = new MirPosition();
try
{
string url = "http://" + info.IP + "/api/v2.0.0/status?whitelist=state_id,state_text,battery_percentage,mission_text,position";
string json = HttpGet(url, info.IP, info.Authorization);
if (string.IsNullOrWhiteSpace(json)) return false;
JavaScriptSerializer serializer = new JavaScriptSerializer();
Dictionary<string, object> dic = (Dictionary<string, object>)serializer.DeserializeObject(json);
if (dic == null) return false;
//state_id不存在:{"args":{},"error_code":"service_unavailable","error_human":"\u670d\u52a1\u4e0d\u53ef\u7528\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5"}
//log.Debug("Get_State URL:" + url + " Return" + json);
try
{
stateID = (eAGVState)(Convert.ToInt32(dic["state_id"].ToString()));
}
catch
{
log.Error("获取状态失败:" + info.IP + " " + json);
return false;
}
stateID = (eAGVState)(Convert.ToInt32(dic["state_id"].ToString()));
stateText = dic["state_text"].ToString();
mission_text = dic["mission_text"].ToString();
string s = dic["battery_percentage"].ToString();
float f = Convert.ToSingle(s);
battery = Convert.ToInt32(f);
Dictionary<string, object> posDic = (Dictionary<string, object>)dic["position"];
if (posDic == null) return false;
position.orientation = Convert.ToSingle(posDic["orientation"].ToString());
position.Point.X = Convert.ToSingle(posDic["x"]);
position.Point.Y = Convert.ToSingle(posDic["y"]);
return true;
}
catch (Exception ex)
{
log.Error("Get_State: ", ex);
return false;
}
}
/// <summary>
/// 小车状态改为Ready
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
public static bool State_Ready(AgvInfo info)
{
try
{
string url = "http://" + info.IP + "/api/v2.0.0/status?whitelist=state_id,state_text";
string body = "{\"state_id\": 3}";
string json = HttpPut(url, info.IP, info.Authorization, body);
if (string.IsNullOrWhiteSpace(json)) return false;
JavaScriptSerializer serializer = new JavaScriptSerializer();
Dictionary<string, object> dic = (Dictionary<string, object>)serializer.DeserializeObject(json);
if (dic == null) return false;
string s = dic["state_id"].ToString();
if (s == "3")
return true;
else
return false;
}
catch (Exception ex)
{
log.Error("State_Ready", ex);
return false;
}
}
/// <summary>
/// 小车状态改为Pause
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
public static bool State_Pause(AgvInfo info)
{
try
{
string url = "http://" + info.IP + "/api/v2.0.0/status?whitelist=state_id,state_text";
string body = "{\"state_id\": 4}";
string json = HttpPut(url, info.IP, info.Authorization, body);
if (string.IsNullOrWhiteSpace(json)) return false;
JavaScriptSerializer serializer = new JavaScriptSerializer();
Dictionary<string, object> dic = (Dictionary<string, object>)serializer.DeserializeObject(json);
if (dic == null) return false;
string s = dic["state_id"].ToString();
if (s == "4")
return true;
else
return false;
}
catch (Exception ex)
{
log.Error("State_Pause", ex);
return false;
}
}
/// <summary>
/// 清除错误
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
public static bool Clear_Error(AgvInfo info)
{
try
{
string url = "http://" + info.IP + "/api/v2.0.0/status";
string body = "{\"clear_error\": true}";
string json = HttpPut(url, info.IP, info.Authorization, body);
if (string.IsNullOrWhiteSpace(json)) return false;
return true;
}
catch (Exception ex)
{
log.Error("Clear_Error", ex);
return false;
}
}
/// <summary>
/// 检查IP地址
/// </summary>
/// <param name="ip"></param>
/// <returns></returns>
public static bool CheckIP(string ip)
{
//IP合法
string pattern = @"^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$";
bool rtn = System.Text.RegularExpressions.Regex.IsMatch(ip, pattern);
if (!rtn)
{
log.Error("非法的IP地址" + ip);
return false;
}
//Ping服务端
try
{
System.Net.NetworkInformation.Ping ping = new System.Net.NetworkInformation.Ping();
System.Net.NetworkInformation.PingReply result = ping.Send(ip, 2000);
ping.Dispose();
if (result.Status != System.Net.NetworkInformation.IPStatus.Success)
{
// log.Debug("Ping " + ip + " 请求没有响应");
return false;
}
return true;
}
catch (Exception ex)
{
log.Error("CheckIP", ex);
return false;
}
}
#region HTTP GET POST PUT DEL
private static string HttpGet(string url, string ip, string authorization)
{
RestClient client = new RestClient(url) { Timeout = httpTimeout };
RestRequest request = new RestRequest(Method.GET);
request.AddHeader("Host", ip);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Accept-Language", "zh_CN");
request.AddHeader("Authorization", authorization);
IRestResponse response = client.Execute(request);
string s = response.Content;
s = s.Replace("\n", "");
s = s.Replace(" ", "");
log.Debug("HttpGet URL: " + url + " Return: " + s);
return s;
}
private static string HttpPost(string url, string ip, string authorization, string body)
{
var client = new RestClient(url) { Timeout = httpTimeout };
var request = new RestRequest(Method.POST);
request.Timeout =10000;
request.AddHeader("Host", ip);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Accept-Language", "zh_CN");
request.AddHeader("Authorization", authorization);
request.AddParameter("application/json", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
string s = response.Content;
s = s.Replace("\n", "");
s = s.Replace(" ", "");
log.Info(string.Format("HttpPost URL: {0}; Body: {1} Return: {2} [StatusCode={3},ResponseStatus={4}]", url, body, s, response.StatusCode, response.ResponseStatus));
return s;
}
private static string HttpPut(string url, string ip, string authorization, string body)
{
RestClient client = new RestClient(url) { Timeout = httpTimeout };
RestRequest request = new RestRequest(Method.PUT);
request.AddHeader("Host", ip);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Accept-Language", "zh_CN");
request.AddHeader("Authorization", authorization);
request.AddParameter("application/json", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
string s = response.Content;
s = s.Replace("\n", "");
s = s.Replace(" ", "");
log.Debug(string.Format("HttpPut URL: {0}; Body: {1} Return: {2}", url, body, s));
return s;
}
private static void HttpDel(string url, string ip, string authorization)
{
RestClient client = new RestClient(url) { Timeout = httpTimeout };
RestRequest request = new RestRequest(Method.DELETE);
request.AddHeader("Host", ip);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", authorization);
request.AddHeader("Accept-Language", "zh_CN");
request.AddParameter("application/json", "", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
string s = response.Content;
log.Debug("HttpDel URL: " + url);
}
#endregion
}
/// <summary>
/// MIR 状态,与状态ID对应
/// </summary>
public enum eAGVState
{
None = 0,
Starting,
ShuttingDown,
Ready,
Pause,
Executing,
Aborted,
Completed,
Docked,
Docking,
EmergencyStop,
ManualControl,
Error,
UNKNOWN
}
}
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Threading;
using System.Windows.Forms;
using DeviceLibrary.manager;
using TcpKPIO;
namespace DeviceLibrary
{
public class Node
{
/// <summary>
/// 节点ID
/// </summary>
public int Id { get; set; }
/// <summary>
/// 节点名称
/// </summary>
public string Name { get; set; }
public NodeType Type { get; set; }
/// <summary>
/// 所属车间
/// </summary>
public string Workshop { get; set; }
/// <summary>
/// 节点IP
/// </summary>
public string IP { get; set; }
/// <summary>
/// 在线状态
/// </summary>
public bool Online { get; set; }
public string IOState
{
get
{
if (IP.Equals(""))
return "";
else
return IOManager.GetDI(IP);
}
}
/// <summary>
/// 是否可调用
/// </summary>
public bool IsUse
{
set
{
if (!isuse.Equals(value))
{
isuse = value;
XmlConfigOperation.SetNodeIsUse(this);
}
}
get { return isuse; }
}
private bool isuse;
/// <summary>
/// 节点状态
/// </summary>
public NodeStatus nodeStatus { get; set; }
protected string rfid = "00";
public ExtendEquip ExtendEquip { get; set; }
/// <summary>
/// RFID
/// </summary>
public string RFID
{
set
{
if (value.Length < 2)
rfid = value.PadLeft(2, '0');
else
rfid = value;
}
get
{
return rfid;
}
}
public ClientLevel ClientLevel { get; set; } = ClientLevel.Low;
/// <summary>
/// 别名
/// </summary>
public string AliceName { get; set; }
/// <summary>
/// 警告信息
/// </summary>
public string WarnMsg { get; set; } = "";
/// <summary>
/// 状态比较
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public bool StateEquals(NodeStatus obj)
{
return nodeStatus.Equals(obj);
}
/// <summary>
/// 获取当前状态
/// </summary>
/// <returns></returns>
public NodeStatus GetState()
{
return nodeStatus;
}
/// <summary>
/// 更新节点状态
/// </summary>
/// <param name="status"></param>
public void UpdateNodeStatus(NodeStatus status)
{
nodeStatus = status;
}
/// <summary>
/// 客户端节点
/// </summary>
/// <param name="name"></param>
/// <param name="rfid"></param>
/// <param name="action"></param>
/// <param name="level"></param>
public Node(string name, string rfid = "", NodeStatus status = NodeStatus.None)
{
Name = name;
RFID = rfid;
nodeStatus = status;
}
public Node() { }
Thread tPingClient; //ping
public void Init()
{
ExtendEquip = new ExtendEquip(IP);
tPingClient = new Thread(new ThreadStart(KeepLiveClient));
tPingClient.IsBackground = true;
tPingClient.Start();
}
string nodeIostate = "";
/// <summary>
/// 节点改变事件
/// </summary>
/// <param name="nodeIndex"></param>
public delegate void NodeChangedEvent(Node node);
/// <summary>
/// 节点改变
/// </summary>
public event NodeChangedEvent NodeChanged;
/// <summary>
/// 节点在线
/// </summary>
public event NodeChangedEvent NodeOnline;
private void KeepLiveClient()
{
while (true)
{
try
{
if (!isuse)
continue;
Thread.Sleep(300);
if (!string.IsNullOrEmpty(IP))
{
bool check = HttpManager.CheckIP(Name, IP);
if (Online != check)
{
Online = check;
NodeOnline?.Invoke(this);
}
}
else
{
if (Online == false)
{
Online = true;
NodeOnline?.Invoke(this);
}
}
if (!nodeIostate.Equals(IOState))
{
nodeIostate = IOState;
NodeChanged?.Invoke(this);
}
}
catch (Exception e)
{
Common.LogUtil.error("KeepLiveClient:" + Name, e);
}
}
}
/// <summary>
/// 节点状态的文本形式
/// </summary>
/// <returns></returns>
public string StatetText()
{
string s = string.Format("[Name={0}, NodeStatus={1}, RFID={2},ClientLevel ={3}]", Name, nodeStatus.ToString(), RFID, ClientLevel.ToString());
return s;
}
public override string ToString()
{
return string.Format("[Name={0},AliceName={1},Workshop={2}]", Name,AliceName,Workshop);
}
/// <summary>
/// 脱机
/// </summary>
public void Offline()
{
RFID = "00";
nodeStatus = NodeStatus.None;
Online = false;
NodeOnline?.Invoke(this);
}
public Node ToCopy()
{
PropertyInfo[] infos = this.GetType().GetProperties();
Node node = new Node();
PropertyInfo[] infos2 = node.GetType().GetProperties();
for (int i = 0; i < infos2.Length; i++)
{
infos2[i].SetValue(node, Convert.ChangeType(infos[i].GetValue(this), infos[i].PropertyType));
}
return node;
}
public override bool Equals(object obj)
{
Node node = obj as Node;
if (node == null)
return false;
if (!node.StateEquals(GetState()) || node.RFID != RFID || node.ClientLevel != ClientLevel)
return true;
return false;
}
public void UpdateNode(Node node)
{
UpdateNodeStatus(node.GetState());
ClientLevel = node.ClientLevel;
RFID = node.RFID;
Common.LogUtil.info("节点更新 " + StatetText());
NodeChanged?.Invoke(this);
}
}
public class ExtendEquip
{
public string IP { get; set; }
/// <summary>
/// 确认按钮
/// </summary>
public bool ButtonConfirmSig
{
get
{
if (CanConfirm)
{
if (IP.Equals(""))
return false;
else
return IOManager.GetDI(IP, 0);
}
else
{
return false;
}
}
}
/// <summary>
/// Api确认
/// </summary>
public bool ApiConfirmSig
{
get
{
if (CanConfirm)
{
return apiconfirmSig;
}
else
{
return false;
}
}
set
{
if (CanConfirm)
{
apiconfirmSig = value;
}
}
}
private bool apiconfirmSig = false;
public bool CanConfirm { get; private set; }
public ExtendEquip(string ip)
{
IP = ip;
}
/// <summary>
/// 允许确认
/// </summary>
public void AllowConfirm()
{
CanConfirm = true;
}
public void Reset()
{
CanConfirm = false;
}
}
/// <summary>
/// 节点状态
/// </summary>
public enum NodeStatus : byte
{
/// <summary>
/// 没有动作
/// </summary>
None = 0,
/// <summary>
/// 需要7寸D料车
/// </summary>
NeedD = 1,
/// <summary>
/// 需要大尺寸C料车
/// </summary>
NeedC = 2,
/// <summary>
/// 需要进入料车
/// </summary>
NeedEnter = 3,
/// <summary>
/// 需要出去料车
/// </summary>
NeedLeave = 4,
/// <summary>
/// 需要进入离开料车
/// </summary>
NeedEnterLeave = 5,
/// <summary>
/// 准备进入料车,服务器发送
/// </summary>
ReadyEnter = 6,
/// <summary>
/// 可以进入料车
/// </summary>
MayEnter = 7,
/// <summary>
/// 完成进入料车
/// </summary>
FinishEnter = 8,
/// <summary>
/// 准备离开料车,服务器发送
/// </summary>
ReadyLeave = 9,
/// <summary>
/// 可以出去料车
/// </summary>
MayLeave = 10,
/// <summary>
/// 完成出去料车
/// </summary>
FinishLeave = 11,
}
/// <summary>
/// 客户端的优先级
/// </summary>
public enum ClientLevel : byte
{
/// <summary>
/// 低
/// </summary>
Low = 0,
/// <summary>
/// 中等
/// </summary>
Middle = 1,
/// <summary>
/// 高
/// </summary>
High = 2
}
public enum NodeType
{
AutoCharge,
Standby,
Node,
Lift
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary.bean
{
public enum RunStep
{
/// <summary>
/// 等待
/// </summary>
NONE,
#region 通用步骤
#endregion
#region 充电任务
/// <summary>
/// 等待AGV到达充电位
/// </summary>
CHARGE_WAIT_REACH_CHARGE,
/// <summary>
/// 等待充电完成
/// </summary>
CHARGE_WAIT_CHARGE_OK,
#endregion
#region 待机任务
/// <summary>
/// 等待AGV到达待机位
/// </summary>
STANDBY_WAIT_REACH_STANDBY,
#endregion
#region 1F 电梯到库房
/// <summary>
/// 去电梯口
/// </summary>
S1F_LiftToStore_01_ToLift,
/// <summary>
/// 等待电梯门开
/// </summary>
S1F_LiftToStore_02_01_WaitLiftDoorOpen,
/// <summary>
///
/// </summary>
S1F_LiftToStore_02_02_EnterLift,
/// <summary>
/// 顶起料车
/// </summary>
S1F_LiftToStore_03_PutShelfOn,
/// <summary>
/// 离开电梯
/// </summary>
S1F_LiftToStore_04_LeaveLift,
/// <summary>
/// 关闭电梯门
/// </summary>
S1F_LiftToStore_05_CloseLiftDoor,
/// <summary>
/// 去库房
/// </summary>
S1F_LiftToStore_06_ToStore,
/// <summary>
/// 放下料车
/// </summary>
S1F_LiftToStore_07_TakeShelfOff,
#endregion
#region 1F库房到电梯
S1F_StoreToLift_01_ToStore,
S1F_StoreToLift_02_PutShelfOn,
S1F_StoreToLift_03_ToLift,
S1F_StoreToLift_04_CheckLiftStatus,
#region 电梯内有料车
S1F_StoreToLift_05_01_ToTemp1,
S1F_StoreToLift_05_02_TakeShelfOffAtTemp1,
S1F_StoreToLift_05_03_ToLift,
S1F_StoreToLift_05_04_EnterLift,
S1F_StoreToLift_05_05_PutShelfOn,
S1F_StoreToLift_05_06_LeaveLift,
S1F_StoreToLift_05_07_ToTemp2,
S1F_StoreToLift_05_08_TakeShelfOffAtTemp2,
S1F_StoreToLift_05_09_ToTemp1,
S1F_StoreToLift_05_10_PutTemp1ShelfOn,
S1F_StoreToLift_05_11_ToLift,
S1F_StoreToLift_05_12_EnterLift,
S1F_StoreToLift_05_13_TakeShelfOffAtLift,
S1F_StoreToLift_05_14_LeaveLift,
S1F_StoreToLift_05_15_ToTemp2,
S1F_StoreToLift_05_16_PutTemp2ShelfOn,
S1F_StoreToLift_05_17_ToStore,
S1F_StoreToLift_05_18_TakeShelfOff,
#endregion
#region 电梯内无料车
S1F_StoreToLift_06_01_EnterLift,
S1F_StoreToLift_06_02_TakeShelfOffAtLift,
S1F_StoreToLift_06_03_LeaveLift,
#endregion
#endregion
#region 电梯到线体 产品分发 最后空料料架返回
/// <summary>
/// 去电梯口
/// </summary>
SD_LiftToLine_01_ToLift,
/// <summary>
/// 等待电梯门开
/// </summary>
SD_LiftToLine_02_WaitLiftDoorOpen,
/// <summary>
/// 到电梯取料点
/// </summary>
SD_LiftToLine_03_EnterLift,
/// <summary>
/// 顶起料车
/// </summary>
SD_LiftToLine_04_PutShelfOn,
/// <summary>
/// 离开电梯
/// </summary>
SD_LiftToLine_05_LeaveLift,
/// <summary>
/// 关闭电梯门
/// </summary>
SD_LiftToLine_06_CloseLiftDoor,
/// <summary>
/// 去线体
/// </summary>
SD_LiftToLine_07_ToLine,
/// <summary>
/// 到达线体,上报位置
/// </summary>
SD_LiftToLine_08_UpdateLocation,
/// <summary>
/// 等待线体确认
/// </summary>
SD_LiftToLine_09_WaitConfirm,
/// <summary>
/// 检查是否有下一个线体
/// </summary>
SD_LiftToLine_10_CheckNextLine,
/// <summary>
/// 线体运行结束,返回电梯
/// </summary>
SD_LiftToLine_11_BackToLift,
/// <summary>
/// 等待电梯门开启
/// </summary>
SD_LiftToLine_12_WaitDoorOpen,
/// <summary>
/// 检查电梯状态
/// </summary>
SD_LiftToLine_13_CheckLiftStatus,
#region 电梯内有料车
SD_LiftToLine_14_01_ToTemp1,
/// <summary>
/// 电梯内有料车,将待送的料车放到临时点1
/// </summary>
SD_LiftToLine_14_02_TakeShelfOffAtTemp1,
/// <summary>
/// 电梯内有料车,去电梯口
/// </summary>
SD_LiftToLine_14_03_ToLift,
SD_LiftToLine_14_04_EnterLift,
/// <summary>
/// 电梯内有料车,提取电梯内的料车
/// </summary>
SD_LiftToLine_14_05_PutLiftShelfOn,
/// <summary>
/// 电梯内有料车,离开电梯
/// </summary>
SD_LiftToLine_14_06_LeaveLift,
SD_LiftToLine_14_07_ToTemp2,
/// <summary>
/// 电梯内有料车,将电梯内的料车卸到临时点2
/// </summary>
SD_LiftToLine_14_08_TakeShelfOffAtTemp2,
SD_LiftToLine_14_09_ToTemp1,
/// <summary>
/// 电梯内有料车,提取临时点1的料车
/// </summary>
SD_LiftToLine_14_10_PutTemp1ShelfOn,
/// <summary>
/// 电梯内有料车,去电梯口
/// </summary>
SD_LiftToLine_14_11_ToLift,
SD_LiftToLine_14_12_EnterLift,
/// <summary>
/// 电梯内有料车,将料车放到电梯内
/// </summary>
SD_LiftToLine_14_13_TakeShelfOffAtLift,
/// <summary>
/// 电梯内有料车,离开电梯
/// </summary>
SD_LiftToLine_14_14_LeaveLift,
/// <summary>
/// 电梯内有料车,关闭电梯门
/// </summary>
SD_LiftToLine_14_15_CloseLiftDoor,
SD_LiftToLine_14_16_ToTemp2,
/// <summary>
/// 电梯内有料车,将临时点2的料车提取,线体目的地参数填充,准备去线体SD_LiftToLine_06_ToLine
/// </summary>
SD_LiftToLine_14_17_PutTemp2ShelfOn,
#endregion
#region 电梯内无料车
SD_LiftToLine_14_01_EnterLift,
/// <summary>
/// 电梯内无料车,将车上料车放到电梯内
/// </summary>
SD_LiftToLine_14_02_TakeShelfOffAtLift,
/// <summary>
/// 离开电梯
/// </summary>
SD_LiftToLine_14_03_LeaveLift,
/// <summary>
/// 关闭电梯门,任务结束
/// </summary>
SD_LiftToLine_14_04_CloseLiftDoor,
#endregion
#endregion
#region 车间里线体到线体运送,到目的地卸料车
/// <summary>
/// 去取料车位置
/// </summary>
SD_LineToLine_01_ToPickUpPosition,
/// <summary>
/// 顶起料车
/// </summary>
SD_LineToLine_02_PutShelfOn,
/// <summary>
/// 去线体
/// </summary>
SD_LineToLine_03_ToLine,
/// <summary>
/// 到达线体,上报位置
/// </summary>
SD_LineToLine_04_UpdateLocation,
/// <summary>
/// 放下料架
/// </summary>
SD_LineToLine_05_TakeShelfOff,
#endregion
#region 车间里库房到多线体运送
/// <summary>
/// 去取料车位置
/// </summary>
SD_StoreToLine_01_ToPickUpPosition,
/// <summary>
/// 顶起料车
/// </summary>
SD_StoreToLine_02_PutShelfOn,
/// <summary>
/// 去线体
/// </summary>
SD_StoreToLine_03_ToLine,
/// <summary>
/// 到达线体,上报位置
/// </summary>
SD_StoreToLine_04_UpdateLocation,
/// <summary>
/// 等待确认
/// </summary>
SD_StoreToLine_05_WaitConfirm,
/// <summary>
/// 检查下一线体
/// </summary>
SD_StoreToLine_06_CheckNextLine,
/// <summary>
/// 返回至取料位置
/// </summary>
SD_StoreToLine_07_BackToPickUpPosition,
/// <summary>
/// 放下料车
/// </summary>
SD_StoreToLine_08_TakeShelfOff,
#endregion
/// <summary>
/// 结束
/// </summary>
END
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
public enum ShelfType
{
None,
Big,
Small,
Pack,
Reel
}
public class Shelf
{
/// <summary>
/// 料车rfid
/// </summary>
public string RFID { get; set; }
/// <summary>
/// 料车类型
/// </summary>
public ShelfType Type { get; set; }
/// <summary>
/// 料车是否有料
/// </summary>
public bool IsFull { get; set; }
public Shelf(string rfid="",bool isFull=false,ShelfType type = ShelfType.None)
{
RFID = rfid;
Type = type;
IsFull = isFull;
}
public Shelf ToCopy()
{
PropertyInfo[] infos = this.GetType().GetProperties();
Shelf shelf = new Shelf();
PropertyInfo[] infos2 = shelf.GetType().GetProperties();
for (int i = 0; i < infos2.Length; i++)
{
infos2[i].SetValue(shelf, infos[i].GetValue(this));
}
return shelf;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
/// <summary>
/// AGV任务
/// </summary>
public class AgvTask
{
/// <summary>
/// 任务ID
/// </summary>
public int Id { get; set; } = -1;
/// <summary>
/// 任务名称
/// </summary>
public string Name { set; get; }
/// <summary>
/// 任务别名
/// </summary>
public string AliceName { set; get; }
/// <summary>
/// 任务guid
/// </summary>
public string Guid { set; get; }
/// <summary>
/// 任务类型
/// </summary>
public TaskType Type { get; set; }
/// <summary>
/// 任务
/// </summary>
/// <param name="name">任务名称</param>
/// <param name="aliceName">任务别名</param>
/// <param name="targetName">目的地名</param>
/// <param name="targetAliceName">目的地别名</param>
/// <param name="guid">任务guid</param>
public AgvTask(string name,string aliceName,string guid,TaskType type= TaskType.Move)
{
Name = name;
AliceName = aliceName;
Guid = guid;
Type = type;
}
public AgvTask() { }
public TaskType GetTaskType()
{
return Type;
}
public override bool Equals(object obj)
{
AgvTask task = obj as AgvTask;
if(task !=null)
{
return this.Guid.Equals(task.Guid);
}
return false;
}
public AgvTask ToCopy()
{
AgvTask task = new AgvTask();
PropertyInfo[] info1 = this.GetType().GetProperties();
PropertyInfo[] info2 = task.GetType().GetProperties();
for (int i = 0; i < info1.Length; i++)
{
if (info1[i].Name.Equals("Id"))
continue;
info2[i].SetValue(task, info1[i].GetValue(this));
}
return task;
}
}
/// <summary>
/// AGV任务类型
/// </summary>
public enum TaskType
{
None,
/// <summary>
/// 移动
/// </summary>
Move,
/// <summary>
/// 停靠
/// </summary>
Dock,
/// <summary>
/// 进出料
/// </summary>
InOut
}
}
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Common;
namespace DeviceLibrary
{
/// <summary>
/// AGV任务运行信息
/// </summary>
public class TaskRunState
{
/// <summary>
/// AGV任务ID
/// </summary>
public long TaskID { get; set; } = -1;
/// <summary>
/// 任务开始时间戳
/// </summary>
public string TaskTimeStamp { get; set; }
/// <summary>
/// 正在分配任务
/// </summary>
public bool IsAllocatingTask = false;
/// <summary>
/// AGV任务
/// </summary>
public AgvTask Task { get; set; } = new AgvTask();
/// <summary>
/// 等待任务执行队列
/// </summary>
public ConcurrentQueue<AgvTask> WaitExecuteTask = new ConcurrentQueue<AgvTask>();
/// <summary>
/// 任务状态
/// </summary>
public string TaskState { get; set; } = SettingString.Wait;
/// <summary>
/// 重置
/// </summary>
public void ResetInfo()
{
TaskID = -1;
ResetState();
}
/// <summary>
/// 重置状态
/// </summary>
public void ResetState()
{
TaskState = SettingString.Wait;
}
/// <summary>
/// 检查任务是否分配成功,分配成功时任务id!=-1且能获取到任务状态
/// </summary>
/// <returns></returns>
public bool CheckAllocateOk()
{
return !TaskID.Equals(-1) && !TaskState.Equals(SettingString.Wait);
}
public bool CheckTaskFinished(string name = "")
{
LogUtil.debug(name + " 检查任务是否结束: " + ToTaskState());
return TaskState.Equals(SettingString.Done);
}
public void EnWaitTaskQueue(AgvTask task)
{
if (string.IsNullOrEmpty(task.Name) || task.Type.Equals(TaskType.InOut))
return;
WaitExecuteTask.Enqueue(task);
}
public bool DeWaitTaskQueue(out AgvTask task)
{
task = null;
if (WaitExecuteTask.Count > 0)
{
if (WaitExecuteTask.TryDequeue(out task))
{
return true;
}
}
return false;
}
public void ClearWaitTaskQueue()
{
System.Threading.Tasks.Task.Factory.StartNew(new Action(() =>
{
while (WaitExecuteTask.Count > 0)
{
WaitExecuteTask.TryDequeue(out AgvTask task);
}
}));
}
public string ToTaskInfo()
{
return $" [{Task.AliceName}] [{TaskID}] ";
}
public string ToTaskShowInfo()
{
return $" [{Task.AliceName}]\r\n[{TaskID}] ";
}
public string ToTaskState()
{
return $"[{Task.AliceName}] [{TaskID}] [{TaskState}]";
}
}
}
文件属性发生变化
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using Common;
using DeviceLibrary.bean.agv;
using DeviceLibrary.manager;
namespace DeviceLibrary
{
public class AgvInfo
{
/// <summary>
/// 小车名称
/// </summary>
public string Name { set; get; }
/// <summary>
/// 小车在FLEET中的ID号
/// </summary>
public string ID { set; get; }
/// <summary>
/// IP地址
/// </summary>
public string IP { set; get; }
/// <summary>
/// IO模块GUID
/// </summary>
/// <summary>
/// 授权码
/// </summary>
public string Authorization { set; get; }
/// <summary>
/// 责任范围
/// </summary>
public Scope Scope{ get; set; }
/// <summary>
/// 是否在线
/// </summary>
public bool IsCon
{
set
{
if (!value.Equals(isCon))
{
isCon = value;
StateKanban.SetConnectState(isCon);
}
}
get { return isCon; }
}
private bool isCon = false;
public bool IsInCharge { get; set; }
/// <summary>
/// 是否可用
/// </summary>
private bool _IsUse = true;
public bool Auto
{
set
{
if (!value.Equals(_IsUse))
{
_IsUse = value;
XmlConfigOperation.SetAgvIsUse(this);
}
}
get { return _IsUse; }
}
/// <summary>
/// 地点
/// </summary>
public Node Place { set; get; }
/// <summary>
/// 小车的状态ID,(从小车获取)
/// </summary>
public eAGVState StateID { set; get; }
/// <summary>
/// 负载
/// </summary>
public bool IsExistShelf { set; get; } = false;
/// <summary>
/// 电量百分比,(从小车获取)
/// </summary>
public int Battery { set; get; }
/// <summary>
/// 当前任务文本,(从小车获取)
/// </summary>
public string MissionText { set; get; } = "";
public class MirPosition
{
public float orientation { get; set; }
public PointF Point;
}
/// <summary>
/// 当前位置
/// </summary>
public MirPosition Position;
/// <summary>
/// 任务内容
/// </summary>
public string Msg
{
get;
set;
} = "";
/// <summary>
/// 当前任务
/// </summary>
public Job CurJob { get; set; }
/// <summary>
/// 使用Fleet发任务
/// </summary>
public bool UseFleet { get; set; }
public string FleetIP { get; set; }
/// <summary>
/// 任务运行状态
/// </summary>
public TaskRunState TaskRunState;
/// <summary>
/// 错误消息
/// </summary>
public string ErrorMsg { get; set; } = "";
public string ErrorLastTime { get; set; } = "";
public List<IOInfo> IOStatus;
/// <summary>
/// Agv是否空闲
/// </summary>
/// <returns></returns>
public bool IsIdle()
{
if (Battery <= ChargePileManager.GetChargePiles().BatteryMin)
{
return false;
}
else
{
if (CurJob == null || ((CurJob is ChargeJob || CurJob is StandyJob) && !IsExistShelf))
return true;
else
return false;
}
}
/// <summary>
/// 任务期间是否有错误
/// </summary>
public bool HasError { get; set; } = false;
public DateTime errStartTime = DateTime.Now;
public void SetErrorMsg(string msg, string lastTime)
{
if (ErrorMsg.Equals(""))
{
ErrorMsg = msg;
ErrorLastTime = lastTime;
errStartTime = DateTime.Now;
}
}
public void ClearErrorMsg()
{
ErrorLastTime = "";
ErrorMsg = "";
}
/// <summary>
/// 任务重发
/// </summary>
public void Resend()
{
if (CurJob != null)
{
CurJob.ResendTask(this);
}
}
public override bool Equals(object obj)
{
AgvInfo agv = obj as AgvInfo;
if (agv == null)
return false;
else
{
if (this.ID.Equals(agv.ID))
return true;
}
return false;
}
/// <summary>
/// 停在同一处超时
/// </summary>
public bool StandTimeOut { get; set; } = false;
public AGV_UI.Status StateKanban;
public AgvInfo(string id, string name, string ip, string authorization, bool isUse)
{
ID = id;
Name = name;
IP = ip;
Authorization = authorization;
IsCon = false;
_IsUse = isUse;
Place = new Node();
Msg = "";
Position = new MirPosition();
RunInfos = new List<string>() { "状态", "目的地", "RFID", "负载", "运行模式", "任务信息", "AGV运行信息" };
StateKanban = new AGV_UI.Status(name, RunInfos);
}
public AgvInfo()
{
Place = new Node();
Msg = "";
Position = new MirPosition();
RunInfos = new List<string>() { "状态", "目的地", "RFID", "负载", "运行模式", "任务信息", "AGV运行信息" };
StateKanban = new AGV_UI.Status(RunInfos);
IOStatus = new List<IOInfo>();
TaskRunState = new TaskRunState();
}
public List<string> RunInfos;
DateTime IoStartTime = DateTime.MaxValue;
int IoLastTime = 5000;
int StandLastTimeMinute = AppConfigHelper.GetIntValue(SettingString.StandTimeout);
public DateTime StandStartTime = DateTime.MaxValue;
public bool SetState(eAGVState stateID, int battery, string missionText, MirPosition position)
{
bool isChange = false;
bool preShelfState = IsExistShelf;
bool reachIoValue = GetInput(0, 3).Equals(true);
if (reachIoValue)
{
//满足给定的IO值,计算持续时间
if (IoStartTime == DateTime.MaxValue)
{
IoStartTime = DateTime.Now;
}
if (IoLastTime > 0)
{
//持续时间
TimeSpan lastTimeSpan = DateTime.Now - IoStartTime;
IsExistShelf = (lastTimeSpan.TotalMilliseconds >= IoLastTime);
}
else
{
IsExistShelf = false;
}
}
else
{
//重新计时
IoStartTime = DateTime.MinValue;
IsExistShelf = false;
}
if (!StateID.Equals(stateID) || !Battery.Equals(battery)
|| !MissionText.Equals(missionText) || !IsExistShelf.Equals(preShelfState))
isChange = true;
if (!StateID.Equals(stateID))
{
StateID = stateID;
StateKanban.ShowInfo("状态", stateID.ToString());
}
StateKanban.SetCurState(TaskRunState.TaskState);
if (!Battery.Equals(battery))
{
Battery = battery;
StateKanban.SetBattery(battery, IsInCharge);
}
if (!IsExistShelf.Equals(preShelfState))
{
StateKanban.ShowInfo("负载", IsExistShelf ? "满载" : "空载");
}
if (!MissionText.Equals(missionText))
{
MissionText = missionText;
StateKanban.ShowInfo("AGV运行信息", missionText);
}
CheckErrorState();
CheckOfflineTimeOut();
CheckStandTimeOut(position);
UpdateDisplayBoard();
return isChange;
}
public void SetKanban()
{
StateKanban.ShowInfo("目的地", Place == null ? "" : Place.AliceName);
StateKanban.ShowInfo("运行模式", Auto ? "自动" : "手动");
if (CurJob != null && CurJob.JobParam.Shelf != null)
StateKanban.ShowInfo("RFID", CurJob.JobParam.Shelf.RFID);
if (this.CurJob != null)
{
Msg = this.CurJob.runInfo;
StateKanban.ShowInfo("任务信息", this.CurJob.RunInfo);
}
}
DateTime agvErrorStartTime = DateTime.MaxValue;
DateTime offlineStartTime = DateTime.MaxValue;
bool errorState = false;
int OfflineLastTimeSeconds = 30;
/// <summary>
/// 检查小车是否报错
/// </summary>
/// <returns></returns>
private void CheckErrorState()
{
if (StateID.Equals(eAGVState.Error) || StateID.Equals(eAGVState.EmergencyStop) || StateID.Equals(eAGVState.Pause))
{
//满足条件,计算持续时间
if (agvErrorStartTime == DateTime.MaxValue)
{
agvErrorStartTime = DateTime.Now;
}
TimeSpan lastTimeSpan = DateTime.Now - agvErrorStartTime;
errorState = (lastTimeSpan.TotalSeconds >= OfflineLastTimeSeconds);
}
else
{
errorState = false;
if ((DateTime.Now - agvErrorStartTime).TotalSeconds > OfflineLastTimeSeconds)
agvErrorStartTime = DateTime.Now;
}
}
/// <summary>
/// 离线超时
/// </summary>
private bool offlineTimeOut = false;
/// <summary>
/// 检查小车是否离线超时
/// </summary>
/// <returns></returns>
private void CheckOfflineTimeOut()
{
if (CurJob != null && !(CurJob is ChargeJob) && !IsCon)
{
//满足条件,计算持续时间
if (offlineStartTime == DateTime.MaxValue)
{
offlineStartTime = DateTime.Now;
}
TimeSpan lastTimeSpan = DateTime.Now - offlineStartTime;
offlineTimeOut = (lastTimeSpan.TotalSeconds >= OfflineLastTimeSeconds);
}
else
{
offlineTimeOut = false;
if ((DateTime.Now - offlineStartTime).TotalSeconds > OfflineLastTimeSeconds)
//LogUtil.error(string.Format("{0} 在{1}离线{2}秒", Name, PlaceAliceName, (DateTime.Now - offlineStartTime).TotalSeconds.ToString("f2")));
offlineStartTime = DateTime.Now;
}
}
/// <summary>
/// 获取IO输入状态
/// </summary>
/// <param name="ioidx">IO序号</param>
/// <param name="port">IO端口</param>
/// <returns></returns>
public bool GetInput(int ioidx, int port)
{
if (ioidx >= IOStatus.Count)
return false;
if (IOStatus[ioidx] == null || IOStatus[ioidx].Inputs == null)
return false;
if (port >= IOStatus[ioidx].Inputs.Length)
return false;
return IOStatus[ioidx].Inputs[port];
}
/// <summary>
/// 获取IO输出状态
/// </summary>
/// <param name="ioidx">IO序号</param>
/// <param name="port">IO端口</param>
/// <returns></returns>
public bool GetOutput(int ioidx, int port)
{
if (ioidx >= IOStatus.Count)
return false;
if (IOStatus[ioidx] == null || IOStatus[ioidx].Outputs == null)
return false;
if (port >= IOStatus[ioidx].Outputs.Length)
return false;
return IOStatus[ioidx].Outputs[port];
}
/// <summary>
/// 检查小车是否在原地停留超时
/// </summary>
/// <returns></returns>
private void CheckStandTimeOut(MirPosition position)
{
if (this.Place.Type.Equals(NodeType.AutoCharge) || this.Place.Type.Equals(NodeType.Standby))
{
StandTimeOut = false;
StandStartTime = DateTime.Now;
}
else
{
if (Auto && CurJob != null)
{
if (Math.Abs(position.Point.X - Position.Point.X) < 0.5 && Math.Abs(position.Point.Y - Position.Point.Y) < 0.5)
{
//满足条件,计算持续时间
if (StandStartTime == DateTime.MaxValue)
{
StandStartTime = DateTime.Now;
}
TimeSpan lastTimeSpan = DateTime.Now - StandStartTime;
StandTimeOut = (lastTimeSpan.TotalMinutes >= StandLastTimeMinute);
}
else
{
//重新计时
StandStartTime = DateTime.Now;
StandTimeOut = false;
}
}
else
{
StandTimeOut = false;
StandStartTime = DateTime.Now;
}
}
Position = position;
}
private void UpdateDisplayBoard()
{
bool isAlarm = false;
List<AlarmMsg> msglist = new List<AlarmMsg>();
try
{
if (offlineTimeOut)
{
isAlarm = true;
SetErrorMsg("在" + Place.AliceName + "离线", (DateTime.Now - offlineStartTime).TotalMinutes.ToString("f2"));
msglist.Add(new AlarmMsg(Name, "lineAgv." + Name + ".Msg", "在" + Place.AliceName + "离线" + (DateTime.Now - offlineStartTime).TotalSeconds.ToString("f2") + "秒"));
}
if (!isAlarm && errorState)
{
isAlarm = true;
SetErrorMsg("状态:" + StateID.ToString(), (DateTime.Now - offlineStartTime).TotalMinutes.ToString("f2"));
msglist.Add(new AlarmMsg(Name, "lineAgv." + Name + ".Msg", "状态:" + StateID.ToString()));
}
if (!isAlarm && StandTimeOut)
{
isAlarm = true;
SetErrorMsg("在" + Place.AliceName + "停留超时", (DateTime.Now - StandStartTime).TotalMinutes.ToString("f2"));
msglist.Add(new AlarmMsg(Name, "lineAgv." + Name + ".Msg", "在" + Place.AliceName + "停留超时" + (DateTime.Now - StandStartTime).TotalMinutes.ToString("f2") + "分钟"));
}
else if (!isAlarm && HasError)
{
isAlarm = true;
msglist.Add(new AlarmMsg(Name, "lineAgv." + Name + ".Msg", Msg));
}
if (!isAlarm)
{
try
{
if (!ErrorMsg.Equals(""))//异常消除后正常,打印异常
{
AGVManager.ErrorLogRecord(new ErrorInfo(this));
ClearErrorMsg();
}
if ((Place.Type.Equals(NodeType.Standby) || Place.Type.Equals(NodeType.AutoCharge)))
{
msglist.Add(new AlarmMsg(Name, "lineAgv." + Name + ".Place", Place.Type.ToString(), 1));
}
else
{
msglist.Add(new AlarmMsg(Name, "lineAgv." + Name + ".Msg", Msg, 1));
}
}
catch (Exception ex)
{
Common.LogUtil.error(Name + "上报小车运行步骤失败" + ex.Message + ex.StackTrace);
}
}
HttpManager.updateDeviceAlarmMsg(msglist);
}
catch (Exception ex)
{
LogUtil.error(Name + "上报小车信息失败" + ex.Message + ex.StackTrace);
}
}
}
public class IOInfo
{
public string IOID { set; get; }
public bool[] Inputs;
public bool[] Outputs;
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary.bean.agv
{
/// <summary>
/// Agv职责类
/// </summary>
public class Scope
{
/// <summary>
/// 工作车间
/// </summary>
public string Workshop { get; set; }
/// <summary>
/// 楼层
/// </summary>
public int Floor { get {
try
{
return int.Parse(Workshop.Substring(0,1));
}
catch {
return 0;
}
} }
/// <summary>
/// 可执行的任务
/// </summary>
public List<string> Tasks { get; set; }
/// <summary>
/// 备注使用的电梯
/// </summary>
public string Remark { get; set; }
/// <summary>
/// 任务系统标识
/// </summary>
public string client { get { return Workshop; } }
/// <summary>
/// 是否有空料车在电梯中准备送出
/// </summary>
/// <param name="liftname"></param>
/// <returns></returns>
public bool HasEmptyShelfInLift(out string liftname,out lift.LiftStatus liftStatus)
{
liftname = "";
liftStatus = null;
string[] lifts = Remark.Split(',');
foreach (string item in lifts)
{
if(lift.LiftContext.HasShelfNeedLeave(item,client,out liftStatus))
{
liftname = item;
return true;
}
}
return false;
}
}
}
using Common;
using DeviceLibrary.bean;
namespace DeviceLibrary
{
/// <summary>
/// 充电任务
/// </summary>
public class ChargeJob : Job
{
/// <summary>
/// 充电任务
/// </summary>
/// <param name="agvPlae">小车当前位置</param>
public ChargeJob(JobParam jobParam) : base(jobParam)
{
JobName = "充电任务";
}
int BatteryMax = ChargePileManager.GetChargePiles().BatteryMax;
int BatteryMin = ChargePileManager.GetChargePiles().BatteryMin;
/// <summary>
/// 充电任务
/// </summary>
/// <param name="agv"></param>
public override Job Run(AgvInfo agv)
{
if (JobRunStep.IsStep(RunStep.NONE))
{
if (!ChargePileManager.HasEmpty(agv, out ChargePile charge))
{
runInfo = $"无空闲充电桩,从" + JobParam.SrcNode + "回到待机位";
JobRunStep.Msg = runInfo;
return new StandyJob(new JobParam(JobParam.CurTargetNode.ToCopy(), manager.NodeManager.GetNodeByType(NodeType.Standby)));
}
else
{
JobRunStep.ToNextStep(RunStep.CHARGE_WAIT_REACH_CHARGE);
runInfo = $"当前电量{agv.Battery}小于最大电量{BatteryMax},从{JobParam.SrcNode}去充电桩{charge.AliceName}";
JobRunStep.Msg = runInfo;
AllocateTask(agv, charge.Guid);
ChargePileManager.StartCharge(agv, charge.Name);
}
}
else if (JobRunStep.IsStep(RunStep.CHARGE_WAIT_REACH_CHARGE))
{
if (agv.TaskRunState.CheckAllocateOk())
{
JobRunStep.ToNextStep(RunStep.CHARGE_WAIT_CHARGE_OK);
runInfo = "开始充电";
JobRunStep.Msg = runInfo;
}
}
else if (JobRunStep.IsStep(RunStep.CHARGE_WAIT_CHARGE_OK))
{
if (CheckRandomCharge(agv))
{
if (agv.Battery >= BatteryMax)
{
runInfo = "电量充足,回待机位";
JobRunStep.Msg = runInfo;
ChargePileManager.StopCharge(agv);
JobRunStep.EndJob();
return new StandyJob(new JobParam(JobParam.SrcNode.ToCopy()));
}
else if (agv.Battery >= BatteryMin)
{
Job job = AGVManager.control.GetJob(agv);
if (job != null && ((job is ChargeJob) || (job is StandyJob)))
{
}
else if (job != null)
{
ChargePileManager.StopCharge(agv);
runInfo = "充电过程检测到任务,电量" + agv.Battery + "%大于最小电量" + BatteryMin + "%,中断充电执行任务";
JobRunStep.Msg = runInfo;
JobRunStep.EndJob();
return job;
}
}
}
else//固定充电桩
{
if (agv.Battery >= ChargePileManager.GetChargePiles().BatteryMax)
{
runInfo = "充电完成";
JobRunStep.Msg = runInfo;
JobRunStep.EndJob();
return new StandyJob(new JobParam(JobParam.CurTargetNode.ToCopy()));
}
else if (agv.Battery >= ChargePileManager.GetChargePiles().BatteryMin)
{
Job job = AGVManager.control.GetJob(agv);
if (job != null && ((job is ChargeJob) || (job is StandyJob)))
{
}
else if (job != null)
{
ChargePileManager.StopCharge(agv);
runInfo = "充电过程检测到任务,电量" + agv.Battery + "%大于最小电量" + BatteryMin + "%,中断充电执行任务";
JobRunStep.Msg = runInfo;
JobRunStep.EndJob();
return job;
}
}
}
}
else if (JobRunStep.IsStep(RunStep.END))
{
JobRunStep.EndJob();
return null;
}
return this;
}
/// <summary>
/// 检查当前小车是否是共用充电桩的小车
/// </summary>
/// <returns></returns>
private bool CheckRandomCharge(AgvInfo agv)
{
if (ChargePileManager.CheckIsRandom(agv))
{
return true;
}
else
{
return false;
}
}
}
}
using Common;
using DeviceLibrary.manager;
namespace DeviceLibrary.bean.job
{
/// <summary>
/// 1F,电梯到库房,中间一个电梯(空架返回)
/// </summary>
public class F1LiftToStoreJob : Job
{
/// <summary>
/// 1F空架返回任务
/// </summary>
public F1LiftToStoreJob(JobParam jobParam) : base(jobParam)
{
}
public override Job Run(AgvInfo agv)
{
if (JobRunStep.IsStep(RunStep.NONE))
{
JobRunStep.ToNextStep(RunStep.S1F_LiftToStore_01_ToLift);
runInfo = $"任务开始:去{JobParam.SrcNode.AliceName}";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{JobParam.SrcNode.Name}");
}
else if (JobRunStep.IsStep(RunStep.S1F_LiftToStore_01_ToLift))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.S1F_LiftToStore_02_01_WaitLiftDoorOpen);
runInfo = $"到达{JobParam.SrcNode.AliceName},等待门开启";
JobRunStep.Msg = runInfo;
}
}
else if (JobRunStep.IsStep(RunStep.S1F_LiftToStore_02_01_WaitLiftDoorOpen))
{
if (lift.LiftContext.IsDoorOpen(JobParam.SrcNode.Name,JobParam.GetMissionInfo().destinationFloor))
{
JobRunStep.ToNextStep(RunStep.S1F_LiftToStore_02_02_EnterLift);
runInfo = $"{JobParam.SrcNode.AliceName}门已开启,去取料点";
JobRunStep.Msg = runInfo;
//任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.返回电梯到达, out string msg);
AllocateTask(agv,$"{JobParam.SrcNode.Name}_{SettingString.PutShelfOn}");
}
}
else if(JobRunStep.IsStep(RunStep.S1F_LiftToStore_02_02_EnterLift))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.S1F_LiftToStore_03_PutShelfOn);
runInfo = $"到达{JobParam.SrcNode.AliceName}取料点,开始取料车";
JobRunStep.Msg = runInfo;
AllocateTask(agv,SettingString.PutShelfOn);
}
}
else if (JobRunStep.IsStep(RunStep.S1F_LiftToStore_03_PutShelfOn))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.S1F_LiftToStore_04_LeaveLift);
runInfo = $"在{JobParam.SrcNode.AliceName}取料车完成,准备离开";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{SettingString.Leave}_{JobParam.SrcNode.Name}");
}
}
else if (JobRunStep.IsStep(RunStep.S1F_LiftToStore_04_LeaveLift))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.S1F_LiftToStore_05_CloseLiftDoor);
runInfo = $"离开{JobParam.SrcNode.AliceName},关闭电梯门";
//任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.返回离开电梯, out string msg);
JobRunStep.Msg = runInfo;
//关门
lift.LiftContext.CloseDoor(JobParam.SrcNode.Name);
}
}
else if (JobRunStep.IsStep(RunStep.S1F_LiftToStore_05_CloseLiftDoor))
{
JobRunStep.ToNextStep(RunStep.S1F_LiftToStore_06_ToStore);
runInfo = $"关闭{JobParam.SrcNode.AliceName}门完成,去{JobParam.CurTargetNode.AliceName}放料点";
JobRunStep.Msg = runInfo;
//任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.返回起始地, out string msg);
AllocateTask(agv, $"{JobParam.CurTargetNode.Name}_{SettingString.TakeShelfOff}");
}
else if (JobRunStep.IsStep(RunStep.S1F_LiftToStore_06_ToStore))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.S1F_LiftToStore_07_TakeShelfOff);
runInfo = $"到达{JobParam.CurTargetNode.AliceName}放料点,卸下料车";
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.TakeShelfOff);
}
}
else if (JobRunStep.IsStep(RunStep.S1F_LiftToStore_07_TakeShelfOff))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.END);
runInfo = $"任务结束:在{JobParam.CurTargetNode.AliceName}卸下料车完成";
//任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.完成, out string msg);
JobRunStep.Msg = runInfo;
}
}
else if (JobRunStep.IsStep(RunStep.END))
{
JobRunStep.EndJob();
return null;
}
return this;
}
}
}
using Common;
using DeviceLibrary.bean;
using DeviceLibrary.manager;
using System;
namespace DeviceLibrary
{
/// <summary>
/// 1F,库房到电梯(满料运送)
/// </summary>
public class F1StoreToLiftJob : Job
{
/// <summary>
/// 1F满架运送任务
/// </summary>
public F1StoreToLiftJob(JobParam jobParam) : base(jobParam)
{
}
lift.LiftStatus liftStatus;
public override Job Run(AgvInfo agv)
{
if (JobRunStep.IsStep(RunStep.NONE))
{
JobRunStep.ToNextStep(RunStep.S1F_StoreToLift_01_ToStore);
runInfo = $"任务开始:去{JobParam.SrcNode.AliceName}取料点";
JobRunStep.Msg = runInfo;
//任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.接料, out string msg);
AllocateTask(agv, $"{JobParam.SrcNode.Name}_{SettingString.PutShelfOn}");
}
else if (JobRunStep.IsStep(RunStep.S1F_StoreToLift_01_ToStore))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.S1F_StoreToLift_02_PutShelfOn);
runInfo = $"到达{JobParam.SrcNode.AliceName}取料点,拾取料车";
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.PutShelfOn);
}
}
else if (JobRunStep.IsStep(RunStep.S1F_StoreToLift_02_PutShelfOn))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.S1F_StoreToLift_03_ToLift);
runInfo = $"在{JobParam.SrcNode.AliceName}拾取料车完成,去{JobParam.CurTargetNode.AliceName}";
JobRunStep.Msg = runInfo;
//任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.前往电梯, out string msg);
//开始请求电梯
lift.LiftContext.Request(JobParam.CurTargetNode.Name, JobParam.GetMissionInfo());
AllocateTask(agv, JobParam.CurTargetNode.Name);
}
}
else if (JobRunStep.IsStep(RunStep.S1F_StoreToLift_03_ToLift))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.S1F_StoreToLift_04_CheckLiftStatus);
runInfo = $"到达{JobParam.CurTargetNode.AliceName},等待开门";
JobRunStep.Msg = runInfo;
}
}
else if (JobRunStep.IsStep(RunStep.S1F_StoreToLift_04_CheckLiftStatus))
{
if (lift.LiftContext.IsDoorOpen(JobParam.CurTargetNode.Name,JobParam.GetMissionInfo().sourceFloor))
{
if (lift.LiftContext.HasShelfNeedLeave(JobParam.CurTargetNode.Name, agv.Scope.client, out lift.LiftStatus liftStatus))
{
JobRunStep.ToNextStep(RunStep.S1F_StoreToLift_05_01_ToTemp1);
runInfo = $"{JobParam.CurTargetNode.AliceName}已开门。电梯内有料车,去临时点1的卸料点,准备卸下车上料车";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{JobParam.CurTargetNode.Name}_{SettingString.Temp1}_{SettingString.TakeShelfOff}");
service.model.MissionInfo missionInfo = manager.MissionManager.GetMission(liftStatus.missionId);
if(missionInfo!=null)
{
//任务状态变更
MissionManager.SetMissionState(missionInfo.missionId, service.model.MissionState.返回电梯到达, out string msg);
}
}
else
{
JobRunStep.ToNextStep(RunStep.S1F_StoreToLift_06_01_EnterLift);
runInfo = $"{JobParam.CurTargetNode.AliceName}已开门,到放料点";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{JobParam.CurTargetNode.Name}_{SettingString.TakeShelfOff}");
}
}
else if (!lift.LiftContext.CheckIfRequestOk(JobParam.CurTargetNode.Name, JobParam.GetMissionInfo()))
{
//请求电梯
lift.LiftContext.Request(JobParam.CurTargetNode.Name, JobParam.GetMissionInfo());
System.Threading.Thread.Sleep(2000);
}
}
#region 电梯内有料车
else if (JobRunStep.IsStep(RunStep.S1F_StoreToLift_05_01_ToTemp1))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.S1F_StoreToLift_05_02_TakeShelfOffAtTemp1);
runInfo = $"到达{JobParam.CurTargetNode.AliceName}的临时点1,将车上料车卸下";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{SettingString.TakeShelfOff}");
}
}
else if (JobRunStep.IsStep(RunStep.S1F_StoreToLift_05_02_TakeShelfOffAtTemp1))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.S1F_StoreToLift_05_03_ToLift);
runInfo = $"在{JobParam.CurTargetNode.AliceName}将车上料车卸在临时点1完成,去电梯口";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{JobParam.CurTargetNode.Name}");
}
}
else if (JobRunStep.IsStep(RunStep.S1F_StoreToLift_05_03_ToLift))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.S1F_StoreToLift_05_04_EnterLift);
runInfo = $"到{JobParam.CurTargetNode.AliceName}的取料点";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{JobParam.CurTargetNode.Name}_{SettingString.PutShelfOn}");
}
}
else if (JobRunStep.IsStep(RunStep.S1F_StoreToLift_05_04_EnterLift))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.S1F_StoreToLift_05_05_PutShelfOn);
runInfo = $"到达{JobParam.CurTargetNode.AliceName}的取料点,准备拾取料车";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{SettingString.PutShelfOn}");
}
}
else if (JobRunStep.IsStep(RunStep.S1F_StoreToLift_05_05_PutShelfOn))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.S1F_StoreToLift_05_06_LeaveLift);
runInfo = $"拾取{JobParam.CurTargetNode.AliceName}的料车完成,准备离开";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{SettingString.Leave}_{JobParam.CurTargetNode.Name}");
}
}
else if (JobRunStep.IsStep(RunStep.S1F_StoreToLift_05_06_LeaveLift))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.S1F_StoreToLift_05_07_ToTemp2);
runInfo = $"离开{JobParam.CurTargetNode.AliceName}完成,前往临时点2的放料点";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{JobParam.CurTargetNode.Name}_{SettingString.Temp2}_{SettingString.TakeShelfOff}");
//电梯空,切换电梯控制权
lift.LiftContext.SwitchControl(JobParam.CurTargetNode.Name,JobParam.GetMissionInfo());
}
}
else if (JobRunStep.IsStep(RunStep.S1F_StoreToLift_05_07_ToTemp2))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.S1F_StoreToLift_05_08_TakeShelfOffAtTemp2);
runInfo = $"到达{JobParam.CurTargetNode.AliceName}临时点2,准备放下料车";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{SettingString.TakeShelfOff}");
}
}
else if (JobRunStep.IsStep(RunStep.S1F_StoreToLift_05_08_TakeShelfOffAtTemp2))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.S1F_StoreToLift_05_09_ToTemp1);
runInfo = $"将料车放到{JobParam.CurTargetNode.AliceName}的临时点2完成,去临时点1的取料点";
JobRunStep.Msg = runInfo;
service.model.MissionInfo missionInfo = manager.MissionManager.GetMission(liftStatus.missionId);
if (missionInfo != null)
{
//任务状态变更
MissionManager.SetMissionState(missionInfo.missionId, service.model.MissionState.返回离开电梯, out string msg);
}
AllocateTask(agv, $"{JobParam.CurTargetNode.Name}_{SettingString.Temp1}_{SettingString.PutShelfOn}");
}
}
else if (JobRunStep.IsStep(RunStep.S1F_StoreToLift_05_09_ToTemp1))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.S1F_StoreToLift_05_10_PutTemp1ShelfOn);
runInfo = $"到达{JobParam.CurTargetNode.AliceName}的临时点1的取料点,准备取料";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{SettingString.PutShelfOn}");
}
}
else if (JobRunStep.IsStep(RunStep.S1F_StoreToLift_05_10_PutTemp1ShelfOn))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.S1F_StoreToLift_05_11_ToLift);
runInfo = $"取临时点1的料车完成,去{JobParam.CurTargetNode.AliceName}";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{JobParam.CurTargetNode.Name}");
}
}
else if (JobRunStep.IsStep(RunStep.S1F_StoreToLift_05_11_ToLift))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.S1F_StoreToLift_05_12_EnterLift);
runInfo = $"到达{JobParam.CurTargetNode.AliceName},准备到放料点";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{JobParam.CurTargetNode.Name}_{SettingString.TakeShelfOff}");
}
}
else if (JobRunStep.IsStep(RunStep.S1F_StoreToLift_05_12_EnterLift))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.S1F_StoreToLift_05_13_TakeShelfOffAtLift);
runInfo = $"到达{JobParam.CurTargetNode.AliceName}的放料点,准备卸下";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{SettingString.TakeShelfOff}");
}
}
else if (JobRunStep.IsStep(RunStep.S1F_StoreToLift_05_13_TakeShelfOffAtLift))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.S1F_StoreToLift_05_14_LeaveLift);
runInfo = $"料车在{JobParam.CurTargetNode.AliceName}卸下完成,离开电梯";
JobRunStep.Msg = runInfo;
//任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.到达电梯, out string msg);
AllocateTask(agv, $"{SettingString.Leave}_{JobParam.CurTargetNode.Name}");
}
}
else if (JobRunStep.IsStep(RunStep.S1F_StoreToLift_05_14_LeaveLift))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.S1F_StoreToLift_05_15_ToTemp2);
runInfo = $"离开{JobParam.CurTargetNode.AliceName}完成,去临时点2的取料点";
JobRunStep.Msg = runInfo;
//关电梯门
//lift.LiftContext.CloseDoor(JobParam.CurTargetNode.Name);
//去指定层
lift.LiftContext.RunTo(JobParam.CurTargetNode.Name, int.Parse(JobParam.GetMissionInfo().destinationWorkshop.Substring(0, 1)));
//任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.电梯运行, out string msg);
AllocateTask(agv, $"{JobParam.CurTargetNode.Name}_{SettingString.Temp2}_{SettingString.PutShelfOn}");
}
}
else if (JobRunStep.IsStep(RunStep.S1F_StoreToLift_05_15_ToTemp2))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.S1F_StoreToLift_05_16_PutTemp2ShelfOn);
runInfo = $"到达{JobParam.CurTargetNode.AliceName}的临时点2,准备拾取料车";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{SettingString.PutShelfOn}");
}
}
else if (JobRunStep.IsStep(RunStep.S1F_StoreToLift_05_16_PutTemp2ShelfOn))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
Node node = NodeManager.GetNode(liftStatus.destinationPoint);
if (node != null)
{
JobRunStep.ToNextStep(RunStep.S1F_StoreToLift_05_17_ToStore);
JobParam.SrcNode = node;
runInfo = $"拾取{JobParam.CurTargetNode.AliceName}临时点2的料车完成,将该料车送回{JobParam.SrcNode.AliceName}的放料点";
JobRunStep.Msg = runInfo;
service.model.MissionInfo missionInfo = manager.MissionManager.GetMission(liftStatus.missionId);
if (missionInfo != null)
{
//任务状态变更
MissionManager.SetMissionState(missionInfo.missionId, service.model.MissionState.返回起始地, out string msg);
}
AllocateTask(agv, $"{JobParam.SrcNode.Name}_{SettingString.TakeShelfOff}");
}
else
{
runInfo = $"拾取{JobParam.CurTargetNode.AliceName}临时点2的料车完成,获取料车目的地不存在:{liftStatus.destinationPoint}";
JobRunStep.Msg = runInfo;
}
}
}
else if (JobRunStep.IsStep(RunStep.S1F_StoreToLift_05_17_ToStore))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.S1F_StoreToLift_05_18_TakeShelfOff);
runInfo = $"到达{JobParam.SrcNode.AliceName}的放料点,准备卸下料车";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{SettingString.TakeShelfOff}");
}
}
else if (JobRunStep.IsStep(RunStep.S1F_StoreToLift_05_18_TakeShelfOff))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.END);
runInfo = $"任务结束:在{JobParam.SrcNode.AliceName}卸下料车完成";
service.model.MissionInfo missionInfo = manager.MissionManager.GetMission(liftStatus.missionId);
if (missionInfo != null)
{
//任务状态变更
MissionManager.SetMissionState(missionInfo.missionId, service.model.MissionState.完成, out string msg);
}
JobRunStep.Msg = runInfo;
}
}
#endregion
#region 电梯内无料车
else if (JobRunStep.IsStep(RunStep.S1F_StoreToLift_06_01_EnterLift))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.S1F_StoreToLift_06_02_TakeShelfOffAtLift);
runInfo = $"到达{JobParam.CurTargetNode.AliceName}放料点,准备卸下料车";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{SettingString.TakeShelfOff}");
}
}
else if (JobRunStep.IsStep(RunStep.S1F_StoreToLift_06_02_TakeShelfOffAtLift))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.S1F_StoreToLift_06_03_LeaveLift);
runInfo = $"料车在{JobParam.CurTargetNode.AliceName}卸下完成,准备离开";
JobRunStep.Msg = runInfo;
//任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.到达电梯, out string msg);
AllocateTask(agv, $"{SettingString.Leave}_{JobParam.CurTargetNode.Name}");
}
}
else if (JobRunStep.IsStep(RunStep.S1F_StoreToLift_06_03_LeaveLift))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.END);
runInfo = $"任务结束:离开{JobParam.CurTargetNode.AliceName}完成";
JobRunStep.Msg = runInfo;
lift.LiftContext.RunTo(JobParam.CurTargetNode.Name,JobParam.GetMissionInfo().destinationFloor);
}
}
#endregion
else if (JobRunStep.IsStep(RunStep.END))
{
JobRunStep.EndJob();
return null;
}
return this;
}
}
}
using Common;
using DeviceLibrary.bean;
using DeviceLibrary.manager;
using System;
namespace DeviceLibrary
{
public abstract class Job
{
public Job(JobParam jobParam)
{
JobParam = jobParam;
if (jobParam != null && jobParam.GetMissionInfo() != null)
JobName = jobParam.GetMissionInfo().JobName;
}
public JobParam JobParam { get; private set; }
public JobStep<RunStep> JobRunStep = new JobStep<RunStep>(RunStep.NONE);
/// <summary>
/// Job里的agv任务信息
/// </summary>
public AgvTask Task { get; set; }
/// <summary>
/// 运行信息
/// </summary>
public string RunInfo { get { return $"{JobName}{TaskStateInfo}{FixInfo}:{runInfo}"; } }
/// <summary>
/// agv任务状态信息
/// </summary>
public string TaskStateInfo = "";
public string FixInfo = "";
public string runInfo = "";
/// <summary>
/// 等待人员操作超时时间
/// </summary>
public int WaitTimeOut = AppConfigHelper.GetIntValue(SettingString.WaitTimeout);
/// <summary>
/// 根据任务状态继续执行任务
/// </summary>
public Job Execute(AgvInfo agv)
{
SetRunInfo(agv);
return Run(agv);
}
public abstract Job Run(AgvInfo agv);
/// <summary>
/// 设置相关运行信息
/// </summary>
/// <param name="agv"></param>
public void SetRunInfo(AgvInfo agv)
{
JobRunStep.StepRunInfo.SetInfo(agv.Name.PadLeft(4, '0'), JobName, agv.Place.AliceName, JobRunStep.CurStep(), runInfo, StartJobTime, DateTime.Now);
TaskStateInfo = agv.TaskRunState.ToTaskInfo();
//FixInfo = JobParam.FixMissionInfo != null ? JobParam.FixMissionInfo.ToTxt():"";
StartJobTime = JobRunStep.startTime;
}
/// <summary>
/// Job开始时间
/// </summary>
public DateTime StartJobTime { get; set; } = DateTime.Now;
/// <summary>
/// Job名称
/// </summary>
public string JobName { get; set; } = "";
protected void AllocateTask(AgvInfo agv, string taskName)
{
Task = AgvTaskManager.GetTaskByName(taskName);
AgvTaskManager.AssignMission(agv, taskName);
}
/// <summary>
/// 设置PLC值
/// </summary>
/// <param name="agv"></param>
/// <param name="port"></param>
/// <param name="val"></param>
protected void SetPlc(AgvInfo agv, int port, int val)
{
int times = 0;
while (!MiR_API.Set_Register(agv, port, val))
{
if (times > 5)
break;
}
}
/// <summary>
/// 入库类型-1
/// </summary>
/// <param name="agv"></param>
protected void SetPlcWithToInstore(AgvInfo agv)
{
SetPlc(agv, 51, 1);
}
/// <summary>
/// 出库类型-2
/// </summary>
/// <param name="agv"></param>
protected void SetPlcWithToOutstore(AgvInfo agv)
{
SetPlc(agv, 51, 2);
}
protected void CloseSound(AgvInfo agv)
{
SetPlc(agv, 51, 0);
}
/// <summary>
/// 任务重发
/// </summary>
/// <returns></returns>
public bool ResendTask(AgvInfo agv)
{
bool rtn = false;
if (!agv.TaskRunState.Task.Equals(Task))//agv运行的任务与Job任务不同
{
rtn = AgvTaskManager.AssignMission(agv, Task.Name);
if (rtn)
{
return true;
}
}
else if (!agv.TaskRunState.TaskID.Equals(-1))
{
if (agv.TaskRunState.TaskState.Equals(SettingString.Aborted) || agv.TaskRunState.TaskState.Equals(SettingString.Invalid))
{
rtn = AgvTaskManager.AssignMission(agv, Task.Name);
if (rtn)
{
return true;
}
}
}
else if (agv.TaskRunState.TaskID.Equals(-1))//任务发送失败,重新发送
{
rtn = AgvTaskManager.AssignMission(agv, Task.Name);
if (rtn)
{
return true;
}
}
return false;
}
}
}
using Common;
using DeviceLibrary.manager;
namespace DeviceLibrary.bean.job
{
/// <summary>
/// 同一层间线体到线体
/// </summary>
public class LineToLineJob : Job
{
/// <summary>
/// 料车取送任务
/// </summary>
public LineToLineJob(JobParam jobParam) : base(jobParam)
{
}
lift.LiftStatus liftStatus;
public override Job Run(AgvInfo agv)
{
if (JobRunStep.IsStep(RunStep.NONE))
{
JobRunStep.ToNextStep(RunStep.SD_LineToLine_01_ToPickUpPosition);
runInfo = $"{JobName}开始:去{JobParam.SrcNode.AliceName}的取料点";
JobRunStep.Msg = runInfo;
//任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.接料, out string msg);
AllocateTask(agv, $"{JobParam.SrcNode.Name}_{SettingString.PutShelfOn}");
}
else if (JobRunStep.IsStep(RunStep.SD_LineToLine_01_ToPickUpPosition))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_LineToLine_02_PutShelfOn);
runInfo = $"到达{JobParam.SrcNode.AliceName}的取料点,准备拾取料车";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{SettingString.PutShelfOn}");
}
}
else if (JobRunStep.IsStep(RunStep.SD_LineToLine_02_PutShelfOn))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_LineToLine_03_ToLine);
runInfo = $"在{JobParam.SrcNode.AliceName}拾取料车完成,准备去线体{JobParam.CurTargetNode.Name}的放料点";
JobRunStep.Msg = runInfo;
//任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.送料, out string msg);
AllocateTask(agv, $"{JobParam.CurTargetNode.Name}_{SettingString.TakeShelfOff}");
}
}
else if (JobRunStep.IsStep(RunStep.SD_LineToLine_03_ToLine))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_LineToLine_04_UpdateLocation);
runInfo = $"到达{JobParam.CurTargetNode.AliceName}的放料点,上报位置";
JobRunStep.Msg = runInfo;
//上报位置
manager.UploadManager.UploadPosition(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 }"));
System.Threading.Thread.Sleep(2000);
}
}
else if (JobRunStep.IsStep(RunStep.SD_LineToLine_04_UpdateLocation))
{
JobRunStep.ToNextStep(RunStep.SD_LineToLine_05_TakeShelfOff);
runInfo = $"将料车在{JobParam.CurTargetNode.AliceName}卸下";
JobRunStep.Msg = runInfo;
AllocateTask(agv,$"{SettingString.TakeShelfOff}");
}
else if (JobRunStep.IsStep(RunStep.SD_LineToLine_05_TakeShelfOff))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.END);
//任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.完成, out string msg);
runInfo = $"料车在{JobParam.CurTargetNode.AliceName}卸下完成,任务结束";
JobRunStep.Msg = runInfo;
}
}
else if (JobRunStep.IsStep(RunStep.END))
{
JobRunStep.EndJob();
return null;
}
return this;
}
}
}
using Common;
using DeviceLibrary.manager;
namespace DeviceLibrary.bean.job
{
/// <summary>
/// 电梯到线体,(空架返回)
/// </summary>
public class SendToLinesWithBackJob : Job
{
/// <summary>
/// 满料车任务
/// </summary>
public SendToLinesWithBackJob(JobParam jobParam) : base(jobParam)
{
}
lift.LiftStatus liftStatus;
public override Job Run(AgvInfo agv)
{
if (JobRunStep.IsStep(RunStep.NONE))
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_01_ToLift);
runInfo = $"任务开始:去{JobParam.SrcNode.AliceName}";
JobRunStep.Msg = runInfo;
AllocateTask(agv, JobParam.SrcNode.Name);
}
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_01_ToLift))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_02_WaitLiftDoorOpen);
runInfo = $"到达{JobParam.SrcNode.AliceName},等待门开启";
JobRunStep.Msg = runInfo;
}
}
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_02_WaitLiftDoorOpen))
{
if (lift.LiftContext.IsDoorOpen(JobParam.SrcNode.Name,JobParam.GetMissionInfo().destinationFloor))
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_03_EnterLift);
runInfo = $"{JobParam.SrcNode.AliceName}门已开启,进电梯取料点";
//任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.电梯到达, out string msg);
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{JobParam.SrcNode.Name}_{SettingString.PutShelfOn}");
}
}
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_03_EnterLift))
{
if (lift.LiftContext.IsDoorOpen(JobParam.SrcNode.Name, JobParam.GetMissionInfo().destinationFloor))
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_04_PutShelfOn);
runInfo = $"到达{JobParam.SrcNode.AliceName}取料点,准备拾取料车";
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.PutShelfOn);
}
}
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_04_PutShelfOn))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_05_LeaveLift);
runInfo = $"在{JobParam.SrcNode.AliceName}拾取料车完成,准备离开";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{SettingString.Leave}_{JobParam.SrcNode.Name}");
}
}
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_05_LeaveLift))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_06_CloseLiftDoor);
runInfo = $"离开{JobParam.SrcNode.AliceName},关闭门";
JobRunStep.Msg = runInfo;
//任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.离开电梯, out string msg);
//关门
lift.LiftContext.CloseDoor(JobParam.SrcNode.Name);
}
}
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_06_CloseLiftDoor))
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_07_ToLine);
runInfo = $"关闭{JobParam.SrcNode.AliceName}门完成,去{JobParam.CurTargetNode.AliceName}的放料点";
JobRunStep.Msg = runInfo;
//任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.送料, out string msg);
AllocateTask(agv, $"{JobParam.CurTargetNode.Name}_{SettingString.TakeShelfOff}");
}
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_07_ToLine))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
//确认按钮生效
JobParam.CurTargetNode.ExtendEquip.AllowConfirm();
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_08_UpdateLocation);
runInfo = $"到达{JobParam.CurTargetNode.AliceName},上报位置给ITS";
JobRunStep.Msg = runInfo;
//上报位置
manager.UploadManager.UploadPosition(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 }"));
System.Threading.Thread.Sleep(2000);
}
}
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_08_UpdateLocation))
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_09_WaitConfirm);
runInfo = $"等待{JobParam.CurTargetNode.AliceName}的人员确认";
JobRunStep.Msg = runInfo;
manager.UploadManager.UploadPosition(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId,
service.model.TransportStatus.TypeStr.status, agv.Name, agv.Place.Name, service.model.TransportStatus.ModeStr.agvButton,
$"等待{ JobParam.CurTargetNode.Name }确认"));
System.Threading.Thread.Sleep(2000);
}
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_09_WaitConfirm))
{
if (OpManager.WaitConfirm.Line(JobParam.CurTargetNode))
{
//关闭按钮确认
JobParam.CurTargetNode.ExtendEquip.Reset();
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_10_CheckNextLine);
runInfo = $"{JobParam.CurTargetNode.AliceName}的人员确认完成";
JobRunStep.Msg = runInfo;
}
else if (JobRunStep.IsTimeOut(WaitTimeOut, out double timeoutval))
{
//报警,$"等待{JobParam.CurTargetNode.AliceName}的人员确认超时{timeoutval}分"
manager.UploadManager.UploadPosition(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId,
service.model.TransportStatus.TypeStr.error, agv.Name, agv.Place.Name, service.model.TransportStatus.ModeStr.agvButton,
$"等待{ JobParam.CurTargetNode.Name }确认超时{timeoutval}分"));
System.Threading.Thread.Sleep(2000);
}
}
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_10_CheckNextLine))
{
if (JobParam.TargetNodes.Count > 0)
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_07_ToLine);
JobParam.CurTargetNode = JobParam.TargetNodes[0];
JobParam.TargetNodes.RemoveAt(0);
System.Threading.Thread.Sleep(1000);
runInfo = $"去下一线体{JobParam.CurTargetNode.AliceName}的放料点";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{JobParam.CurTargetNode.Name}_{SettingString.TakeShelfOff}");
}
else
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_11_BackToLift);
runInfo = $"{JobParam.CurTargetNode.AliceName}是最后一个线体,分发结束,返回电梯口";
//任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.返回电梯, out string msg);
//请求电梯
lift.LiftContext.Request(JobParam.SrcNode.Name,JobParam.GetMissionInfo());
JobRunStep.Msg = runInfo;
AllocateTask(agv, JobParam.SrcNode.Name);
}
}
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_11_BackToLift))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_12_WaitDoorOpen);
runInfo = $"到达{JobParam.SrcNode.AliceName},等待电梯门开";
JobRunStep.Msg = runInfo;
//上报位置
System.Threading.Thread.Sleep(1000);
}
}
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_12_WaitDoorOpen))
{
if (lift.LiftContext.IsDoorOpen(JobParam.SrcNode.Name,JobParam.GetMissionInfo().sourceFloor))
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_13_CheckLiftStatus);
runInfo = $"{JobParam.SrcNode.AliceName}门已开,检查电梯内该层是否有料车";
JobRunStep.Msg = runInfo;
//上报位置
System.Threading.Thread.Sleep(1000);
}
}
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_13_CheckLiftStatus))
{
if (lift.LiftContext.IsDoorOpen(JobParam.CurTargetNode.Name, JobParam.GetMissionInfo().sourceFloor))
{
if (lift.LiftContext.HasShelfNeedLeave(JobParam.SrcNode.Name, agv.Scope.client, out liftStatus))
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_14_01_ToTemp1);
runInfo = $"{JobParam.SrcNode.AliceName}内有料车,去临时点1放料点";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{JobParam.SrcNode.Name}_{SettingString.Temp1}_{SettingString.TakeShelfOff}");
service.model.MissionInfo missionInfo = manager.MissionManager.GetMission(liftStatus.missionId);
if (missionInfo != null)
{
//任务状态变更
MissionManager.SetMissionState(missionInfo.missionId, service.model.MissionState.返回电梯到达, out string msg);
}
}
else
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_14_01_EnterLift);
runInfo = $"{JobParam.SrcNode.AliceName}无料车,去放料点";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{JobParam.SrcNode.Name}_{SettingString.TakeShelfOff}");
}
}
else if (!lift.LiftContext.CheckIfRequestOk(JobParam.CurTargetNode.Name, JobParam.GetMissionInfo()))
{
//请求电梯
lift.LiftContext.Request(JobParam.CurTargetNode.Name, JobParam.GetMissionInfo());
System.Threading.Thread.Sleep(2000);
}
}
#region 电梯内无料车
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_14_01_EnterLift))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_14_02_TakeShelfOffAtLift);
runInfo = $"到达{JobParam.SrcNode.AliceName}放料点,准备卸下料车";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{SettingString.TakeShelfOff}");
}
}
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_14_02_TakeShelfOffAtLift))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_14_03_LeaveLift);
runInfo = $"在{JobParam.SrcNode.AliceName}卸下料车完成,准备离开";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{SettingString.Leave}_{JobParam.SrcNode.Name}");
}
}
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_14_03_LeaveLift))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_14_04_CloseLiftDoor);
runInfo = $"离开{JobParam.SrcNode.AliceName},关门";
JobRunStep.Msg = runInfo;
lift.LiftContext.CloseDoor(JobParam.SrcNode.Name);
System.Threading.Thread.Sleep(1000);
}
}
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_14_04_CloseLiftDoor))
{
if (!lift.LiftContext.IsDoorOpen(JobParam.SrcNode.Name,JobParam.GetMissionInfo().sourceFloor))
{
JobRunStep.ToNextStep(RunStep.END);
runInfo = $"{JobName}结束:{JobParam.SrcNode.AliceName}已关门";
JobRunStep.Msg = runInfo;
}
else if (JobRunStep.IsTimeOut(1, out double time))
{
lift.LiftContext.CloseDoor(JobParam.SrcNode.Name);
System.Threading.Thread.Sleep(1000);
}
}
#endregion
#region 电梯内有料车
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_14_01_ToTemp1))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_14_02_TakeShelfOffAtTemp1);
runInfo = $"到达{JobParam.SrcNode.AliceName}的临时点1的放料点,准备卸料";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{SettingString.TakeShelfOff}");
}
}
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_14_02_TakeShelfOffAtTemp1))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_14_03_ToLift);
runInfo = $"料车卸到临时点1完成,去{JobParam.SrcNode.AliceName}";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{JobParam.SrcNode.Name}");
}
}
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_14_03_ToLift))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_14_04_EnterLift);
runInfo = $"到达{JobParam.SrcNode.AliceName},去取料点";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{JobParam.SrcNode.Name}_{SettingString.PutShelfOn}");
}
}
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_14_04_EnterLift))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_14_05_PutLiftShelfOn);
runInfo = $"到达{JobParam.SrcNode.AliceName}取料点,准备拾取料车";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{SettingString.PutShelfOn}");
}
}
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_14_05_PutLiftShelfOn))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_14_06_LeaveLift);
runInfo = $"拾取料车完成,离开{JobParam.SrcNode.AliceName}";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{SettingString.Leave}_{JobParam.SrcNode.Name}");
}
}
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_14_06_LeaveLift))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_14_07_ToTemp2);
runInfo = $"离开{JobParam.SrcNode.AliceName}完成,去临时点2放料点";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{JobParam.SrcNode.Name}_{SettingString.Temp2}_{SettingString.TakeShelfOff}");
//电梯空,切换电梯控制权
lift.LiftContext.SwitchControl(JobParam.CurTargetNode.Name,JobParam.GetMissionInfo());
}
}
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_14_07_ToTemp2))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_14_08_TakeShelfOffAtTemp2);
runInfo = $"到达{JobParam.SrcNode.AliceName}的临时点2放料点,准备卸下料车";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{SettingString.TakeShelfOff}");
}
}
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_14_08_TakeShelfOffAtTemp2))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_14_09_ToTemp1);
runInfo = $"将{JobParam.SrcNode.AliceName}料车放到临时点2完成,去临时点1取料点";
JobRunStep.Msg = runInfo;
service.model.MissionInfo missionInfo = manager.MissionManager.GetMission(liftStatus.missionId);
if (missionInfo != null)
{
//任务状态变更
MissionManager.SetMissionState(missionInfo.missionId, service.model.MissionState.返回离开电梯, out string msg);
}
AllocateTask(agv, $"{JobParam.SrcNode.Name}_{SettingString.Temp1}_{SettingString.PutShelfOn}");
}
}
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_14_09_ToTemp1))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_14_10_PutTemp1ShelfOn);
runInfo = $"到达{JobParam.SrcNode.AliceName}临时点1的取料点,准备拾取料车";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{SettingString.PutShelfOn}");
}
}
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_14_10_PutTemp1ShelfOn))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_14_11_ToLift);
runInfo = $"拾取{JobParam.SrcNode.AliceName}临时点1的料车完成,去电梯口";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{JobParam.SrcNode.Name}");
}
}
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_14_11_ToLift))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_14_12_EnterLift);
runInfo = $"到达{JobParam.SrcNode.AliceName},准备去放料点";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{JobParam.SrcNode.Name}_{SettingString.TakeShelfOff}");
}
}
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_14_12_EnterLift))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_14_13_TakeShelfOffAtLift);
runInfo = $"到达{JobParam.SrcNode.AliceName}的放料点,准备卸下料车";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{SettingString.TakeShelfOff}");
}
}
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_14_13_TakeShelfOffAtLift))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_14_14_LeaveLift);
runInfo = $"料车在{JobParam.SrcNode.AliceName}卸下完成,准备离开";
JobRunStep.Msg = runInfo;
//任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.到达电梯, out string msg);
AllocateTask(agv, $"{SettingString.Leave}_{JobParam.SrcNode.Name}");
}
}
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_14_14_LeaveLift))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_14_15_CloseLiftDoor);
runInfo = $"离开{JobParam.SrcNode.AliceName}完成,关门";
JobRunStep.Msg = runInfo;
//关电梯门
//lift.LiftContext.CloseDoor(JobParam.CurTargetNode.Name);
//去指定层
lift.LiftContext.RunTo(JobParam.CurTargetNode.Name, int.Parse(JobParam.GetMissionInfo().destinationWorkshop.Substring(0, 1)));
//任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.电梯运行, out string msg);
System.Threading.Thread.Sleep(1000);
}
}
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_14_15_CloseLiftDoor))
{
if (!lift.LiftContext.IsDoorOpen(JobParam.SrcNode.Name,JobParam.GetMissionInfo().sourceFloor))
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_14_16_ToTemp2);
runInfo = $"已关门,去{JobParam.SrcNode.AliceName}的临时点2取料点";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{JobParam.SrcNode.Name}_{SettingString.Temp2}_{SettingString.PutShelfOn}");
}
else if (JobRunStep.IsTimeOut(1, out double time))
{
lift.LiftContext.CloseDoor(JobParam.SrcNode.Name);
System.Threading.Thread.Sleep(1000);
}
}
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_14_16_ToTemp2))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_14_17_PutTemp2ShelfOn);
runInfo = $"到达{JobParam.SrcNode.AliceName}的临时点2的取料点,准备拾取";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{SettingString.PutShelfOn}");
}
}
else if (JobRunStep.IsStep(RunStep.SD_LiftToLine_14_17_PutTemp2ShelfOn))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_07_ToLine);
string[] nodes = liftStatus.destinationPoint.Split(',');
JobParam.CurTargetNode = manager.NodeManager.GetNode(nodes[0]);
JobParam.TargetNodes.Clear();
JobParam.SetMissionInfo(manager.MissionManager.GetReceiveMission(agv));
if (nodes.Length > 1)
{
for (int i = 1; i < nodes.Length; i++)
{
Node node = manager.NodeManager.GetNode(nodes[i]);
if (node != null)
JobParam.TargetNodes.Add(node);
}
}
runInfo = $"去{JobParam.CurTargetNode.AliceName}的放料点";
JobRunStep.Msg = runInfo;
service.model.MissionInfo missionInfo = manager.MissionManager.GetMission(liftStatus.missionId);
if (missionInfo != null)
{
//任务状态变更
MissionManager.SetMissionState(missionInfo.missionId, service.model.MissionState.送料, out string msg);
}
AllocateTask(agv, $"{JobParam.CurTargetNode.Name}_{SettingString.TakeShelfOff}");
}
}
#endregion
else if (JobRunStep.IsStep(RunStep.END))
{
JobRunStep.EndJob();
return null;
}
return this;
}
}
}
using Common;
using DeviceLibrary.bean;
namespace DeviceLibrary
{
/// <summary>
/// 待机任务
/// </summary>
public class StandyJob : Job
{
/// <summary>
/// 待机任务
/// </summary>
/// <param name="agvPlae">小车当前位置,空表示在待机位</param>
public StandyJob(JobParam jobParam) : base(jobParam)
{
JobName = "待机任务";
}
int BatteryMax = ChargePileManager.GetChargePiles().BatteryMax;
int BatteryMin = ChargePileManager.GetChargePiles().BatteryMin;
int BatteryMid = ChargePileManager.GetChargePiles().BatteryMiddle;
/// <summary>
/// 待机任务
/// </summary>
/// <param name="agv"></param>
public override Job Run(AgvInfo agv)
{
if (JobRunStep.IsStep(RunStep.NONE))
{
{
{
JobRunStep.ToNextStep(RunStep.STANDBY_WAIT_REACH_STANDBY);
runInfo = "从" + JobParam.SrcNode + "回到待机位";
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.Standby);
}
}
}
else if (JobRunStep.IsStep(RunStep.STANDBY_WAIT_REACH_STANDBY))
{
//if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.END);
// runInfo = "到达待机位";
//JobRunStep.Msg = runInfo;
}
}
else if (JobRunStep.IsStep(RunStep.END))
{
Job job = AGVManager.control.GetJob(agv);
if (job != null && !(job is StandyJob))
{
if (job is ChargeJob && agv.Battery > BatteryMid)
return this;
runInfo = "在待机位检测到任务,执行任务";
JobRunStep.Msg = runInfo;
JobRunStep.EndJob();
return job;
}
}
return this;
}
}
}
using Common;
using DeviceLibrary.manager;
namespace DeviceLibrary.bean.job
{
/// <summary>
/// 库房到线体,(空架返回)
/// </summary>
public class StoreToLinesWithBackJob : Job
{
/// <summary>
/// 库房分发料任务
/// </summary>
public StoreToLinesWithBackJob(JobParam jobParam) : base(jobParam)
{
}
lift.LiftStatus liftStatus;
public override Job Run(AgvInfo agv)
{
if (JobRunStep.IsStep(RunStep.NONE))
{
JobRunStep.ToNextStep(RunStep.SD_StoreToLine_01_ToPickUpPosition);
runInfo = $"任务开始,去{JobParam.SrcNode.AliceName}的取料点";
JobRunStep.Msg = runInfo;
//任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.接料, out string msg);
AllocateTask(agv, $"{JobParam.SrcNode.Name}_{SettingString.PutShelfOn}");
}
else if (JobRunStep.IsStep(RunStep.SD_StoreToLine_01_ToPickUpPosition))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_StoreToLine_02_PutShelfOn);
runInfo = $"到达{JobParam.SrcNode.AliceName}的取料点,准备拾取料车";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{SettingString.PutShelfOn}");
}
}
else if (JobRunStep.IsStep(RunStep.SD_StoreToLine_02_PutShelfOn))
{
JobRunStep.ToNextStep(RunStep.SD_StoreToLine_03_ToLine);
runInfo = $"在{JobParam.SrcNode.AliceName}拾取料车完成,去{JobParam.CurTargetNode.AliceName}的放料点";
JobRunStep.Msg = runInfo;
//任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.送料, out string msg);
AllocateTask(agv,$"{JobParam.CurTargetNode.Name}_{SettingString.TakeShelfOff}");
}
else if (JobRunStep.IsStep(RunStep.SD_StoreToLine_03_ToLine))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
//确认按钮生效
JobParam.CurTargetNode.ExtendEquip.AllowConfirm();
JobRunStep.ToNextStep(RunStep.SD_StoreToLine_04_UpdateLocation);
runInfo = $"到达{JobParam.CurTargetNode.AliceName}的放料点,上报位置给ITS";
JobRunStep.Msg = runInfo;
//上报位置
manager.UploadManager.UploadPosition(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 }"));
System.Threading.Thread.Sleep(2000);
}
}
else if (JobRunStep.IsStep(RunStep.SD_StoreToLine_04_UpdateLocation))
{
JobRunStep.ToNextStep(RunStep.SD_StoreToLine_05_WaitConfirm);
runInfo = $"等待{JobParam.CurTargetNode.AliceName}的人员确认";
JobRunStep.Msg = runInfo;
manager.UploadManager.UploadPosition(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId,
service.model.TransportStatus.TypeStr.status, agv.Name, agv.Place.Name, service.model.TransportStatus.ModeStr.agvButton,
$"等待{ JobParam.CurTargetNode.Name }确认"));
System.Threading.Thread.Sleep(2000);
}
else if (JobRunStep.IsStep(RunStep.SD_StoreToLine_05_WaitConfirm))
{
if (OpManager.WaitConfirm.Line(JobParam.CurTargetNode))
{
//关闭按钮确认
JobParam.CurTargetNode.ExtendEquip.Reset();
JobRunStep.ToNextStep(RunStep.SD_LiftToLine_10_CheckNextLine);
runInfo = $"{JobParam.CurTargetNode.AliceName}的人员确认完成";
JobRunStep.Msg = runInfo;
}
else if (JobRunStep.IsTimeOut(WaitTimeOut, out double timeoutval))
{
//报警,$"等待{JobParam.CurTargetNode.AliceName}的人员确认超时{timeoutval}分"
manager.UploadManager.UploadPosition(new service.model.TransportStatus(agv.CurJob.JobParam.GetMissionInfo().missionId,
service.model.TransportStatus.TypeStr.error, agv.Name, agv.Place.Name, service.model.TransportStatus.ModeStr.agvButton,
$"等待{ JobParam.CurTargetNode.Name }确认超时{timeoutval}分"));
System.Threading.Thread.Sleep(2000);
}
}
else if (JobRunStep.IsStep(RunStep.SD_StoreToLine_06_CheckNextLine))
{
if (JobParam.TargetNodes.Count > 0)
{
JobRunStep.ToNextStep(RunStep.SD_StoreToLine_03_ToLine);
JobParam.CurTargetNode = JobParam.TargetNodes[0];
JobParam.TargetNodes.RemoveAt(0);
System.Threading.Thread.Sleep(1000);
runInfo = $"去下一线体{JobParam.CurTargetNode.AliceName}的放料点";
JobRunStep.Msg = runInfo;
AllocateTask(agv, $"{JobParam.CurTargetNode.Name}_{SettingString.TakeShelfOff}");
}
else
{
JobRunStep.ToNextStep(RunStep.SD_StoreToLine_07_BackToPickUpPosition);
runInfo = $"{JobParam.CurTargetNode.AliceName}是最后一个线体,分发结束,返回{JobParam.SrcNode.Name}的放料点";
JobRunStep.Msg = runInfo;
//任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.返回起始地, out string msg);
AllocateTask(agv, $"{JobParam.SrcNode.Name}_{SettingString.TakeShelfOff}");
}
}
else if (JobRunStep.IsStep(RunStep.SD_StoreToLine_07_BackToPickUpPosition))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SD_StoreToLine_08_TakeShelfOff);
runInfo = $"到达{JobParam.SrcNode.AliceName}的放料点,准备卸下料车";
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.TakeShelfOff);
}
}
else if (JobRunStep.IsStep(RunStep.SD_StoreToLine_08_TakeShelfOff))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.END);
runInfo = $"料车在{JobParam.SrcNode.AliceName}放下完成,任务结束";
//任务状态变更
MissionManager.SetMissionState(JobParam.GetMissionInfo().missionId, service.model.MissionState.完成, out string msg);
JobRunStep.Msg = runInfo;
}
}
else if (JobRunStep.IsStep(RunStep.END))
{
JobRunStep.EndJob();
return null;
}
return this;
}
}
}

namespace DeviceLibrary
{
/// <summary>
/// 充电任务
/// </summary>
public class ChargeJobType : JobType
{
/// <summary>
/// 充电任务
/// </summary>
/// <param name="currentAgv"></param>
/// <returns></returns>
public override Job GetNewJob(AgvInfo agv)
{
if (agv.Battery < ChargePileManager.GetChargePiles().BatteryMax && ChargePileManager.HasEmpty(agv,out bean.ChargePile charge))
{
return new ChargeJob(new bean.JobParam(agv.Place, manager.NodeManager.GetNodeByType(NodeType.AutoCharge)));
}
else
return new StandyJob(new bean.JobParam(agv.Place, manager.NodeManager.GetNodeByType(NodeType.Standby)));
}
}
}
using Common;
using DeviceLibrary.bean.job;
namespace DeviceLibrary.bean.jobType
{
/// <summary>
/// 1F,电梯到库房
/// </summary>
public class F1LiftToStoreJobType : JobType
{
public override Job GetNewJob(AgvInfo agv)
{
if (!agv.IsIdle())
return null;
else
{
if(agv.Scope.Floor.Equals(1) && agv.Scope.HasEmptyShelfInLift(out string liftname, out lift.LiftStatus lift))
{
service.model.MissionInfo missionInfo = manager.MissionManager.GetReceiveMission(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);
return new F1LiftToStoreJob(jobParam);
}
}
}
return null;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary.bean.jobType
{
/// <summary>
/// 取料并送入电梯内
/// </summary>
public class F1StoreToLiftJobType:JobType
{
public override Job GetNewJob(AgvInfo agv)
{
if (!agv.IsIdle())
return null;
else
{
service.model.MissionInfo missionInfo = manager.MissionManager.GetDeliverMission(agv,out string liftname);
if(missionInfo!=null)
{
Node src = manager.NodeManager.GetNode(missionInfo.sourcePoint, NodeType.Node);
Node dest = manager.NodeManager.GetNode(liftname, NodeType.Lift);
JobParam jobParam = new JobParam(src, dest, null, missionInfo);
return new F1StoreToLiftJob(jobParam);
}
}
return null;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
public class JobType
{
public JobType()
{
}
public virtual Job GetNewJob(AgvInfo agv)
{
return null;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary.bean.jobType
{
public class LineToLineJobType:JobType
{
public override Job GetNewJob(AgvInfo agv)
{
if (!agv.IsIdle())
return null;
else
{
service.model.MissionInfo missionInfo = manager.MissionManager.GetLineToLineMission(agv);
if (missionInfo != null)
{
Node src = manager.NodeManager.GetNode(missionInfo.sourcePoint, NodeType.Node);
Node dest = manager.NodeManager.GetNode(missionInfo.destinationPoint, NodeType.Node);
JobParam jobParam = new JobParam(src, dest, null, missionInfo);
return new F1StoreToLiftJob(jobParam);
}
}
return null;
}
}
}

using Common;
using System.Collections.Generic;
using System.Linq;
using DeviceLibrary.manager;
using DeviceLibrary.bean;
using DeviceLibrary.bean.job;
namespace DeviceLibrary
{
/// <summary>
/// 将料车从电梯送到多条线并空车返回任务
/// </summary>
public class SendToLinesWithBackJobType : JobType
{
/// <summary>
/// 将料从电梯送到线上任务
/// </summary>
/// <param name="currentAgv"></param>
/// <returns></returns>
public override Job GetNewJob(AgvInfo agv)
{
if (!agv.IsIdle())
return null;
else
{
if (!agv.Scope.Floor.Equals(1) && agv.Scope.HasEmptyShelfInLift(out string liftname, out lift.LiftStatus lift))
{
service.model.MissionInfo missionInfo = manager.MissionManager.GetReceiveMission(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);
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 SendToLinesWithBackJob(jobParam);
}
}
}
return null;
}
}
}
using Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary.bean.jobType
{
public class StoreToLinesWithBackJobType : JobType
{
public override Job GetNewJob(AgvInfo agv)
{
if (!agv.IsIdle())
return null;
else
{
service.model.MissionInfo missionInfo = manager.MissionManager.GetStoreToLinesMission(agv);
if (missionInfo != null)
{
Node src = manager.NodeManager.GetNode(missionInfo.sourcePoint, NodeType.Node);
string[] dests = missionInfo.destinationPoint.Split(',');
Node dest = manager.NodeManager.GetNode(dests.Length > 1 ? dests[0] : missionInfo.destinationPoint, NodeType.Node);
JobParam jobParam = new JobParam(src, dest, null, missionInfo);
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 F1StoreToLiftJob(jobParam);
}
}
return null;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary.lift
{
/// <summary>
/// AGV调度系统的状态信息
/// </summary>
public class ClientStatus
{
/// <summary>
/// 电梯标识
/// </summary>
public string liftId { get; set; }
/// <summary>
/// 任务来源系统标识
/// </summary>
public string sourceClient { get; set; }
/// <summary>
/// 是否有空闲AGV可用
/// </summary>
public bool hasIdleAgv { get; set; }
public override string ToString()
{
return $"liftId={liftId},sourceClient={sourceClient},hasIdleAgv={hasIdleAgv}";
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary.lift
{
public class LiftContext
{
/// <summary>
/// 所有电梯
/// </summary>
static Dictionary<string, LiftStatus> lifts = new Dictionary<string, LiftStatus>();
public static void Init()
{
string[] names = Common.AppConfigHelper.GetValue(Common.SettingString.Lift_Names).Split(',');
foreach (var item in names)
{
lifts.Add(item, new LiftStatus());
}
Common.LogUtil.info($"加载电梯信息完成:{string.Join(",",names)}");
}
/// <summary>
/// 电梯是否开门
/// </summary>
/// <param name="liftId"></param>
/// <returns></returns>
public static bool IsDoorOpen(string liftId,int floor)
{
LiftStatus liftStatus = GetLiftStatus(liftId);
if (liftStatus.door.Equals("opened") && liftStatus.floor.Equals(floor))
return true;
return false;
}
/// <summary>
/// 电梯关门
/// </summary>
/// <param name="liftId"></param>
public static void CloseDoor(string liftId)
{
}
/// <summary>
/// 请求使用电梯
/// </summary>
/// <param name="liftId"></param>
public static void Request(string liftId,service.model.MissionInfo missionInfo)
{
}
public static void SwitchControl(string liftId, service.model.MissionInfo missionInfo)
{
}
/// <summary>
/// 电梯开门
/// </summary>
/// <param name="liftId"></param>
public static void OpenDoor(string liftId)
{
}
/// <summary>
/// 运行到指定楼层
/// </summary>
/// <param name="liftId"></param>
/// <param name="floor"></param>
public static void RunTo(string liftId,int floor)
{
}
/// <summary>
/// 有架子需要离开电梯
/// </summary>
/// <param name="liftId"></param>
/// <returns></returns>
public static bool HasShelfNeedLeave(string liftId,string client,out LiftStatus liftStatus)
{
liftStatus = GetLiftStatus(liftId);
if (liftStatus.destinationClient.Equals(client))
return true;
return false;
}
/// <summary>
/// 检查该任务agv是否获得电梯控制权
/// </summary>
/// <param name="liftId"></param>
/// <param name="missionId"></param>
/// <returns></returns>
public static bool CheckIfRequestOk(string liftId,service.model.MissionInfo mission)
{
LiftStatus liftStatus = GetLiftStatus(liftId);
if (liftStatus.missionId.Equals(mission.missionId))
return true;
return false;
}
/// <summary>
/// 获取电梯状态
/// </summary>
/// <param name="liftId"></param>
/// <returns></returns>
static LiftStatus GetLiftStatus(string liftId)
{
if (lifts.ContainsKey(liftId))
{
return lifts[liftId];
}
else
return new LiftStatus();
}
public static string[] GetLiftNames()
{
return lifts.Keys.ToArray();
}
static void UpdateStatus(ClientStatus status)
{
try
{
LiftStatus lift = HttpManager.UpdateStatusToLift(status);
if(lift!=null)
{
lifts[status.liftId] = lift;
}
}
catch(Exception e)
{
Common.LogUtil.error($"上报状态给电梯失败:{status.ToString()}",e);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary.lift
{
public class LiftStatus
{
/// <summary>
/// 当前电梯处于哪一层
/// </summary>
public int floor { get; set; } = 0;
/// <summary>
/// 电梯门是否打开,打开=opened,关闭=closed
/// </summary>
public string door { get; set; } = "";
/// <summary>
/// 任务ID
/// </summary>
public string missionId { get; set; } = "";
/// <summary>
/// 任务来源系统标识:系统标识+车间+类型
/// </summary>
public string sourceClient { get; set; } = "";
/// <summary>
/// 架子来源楼层
/// </summary>
public int sourceFloor { get; set; } = 0;
/// <summary>
/// 架子来源点位
/// </summary>
public string sourcePoint { get; set; } = "";
/// <summary>
/// 任务目的地系统标识
/// </summary>
public string destinationClient { get; set; } = "";
/// <summary>
/// 目的地楼层
/// </summary>
public int destinationFloor { get; set; } = 0;
/// <summary>
/// 目的地点位
/// </summary>
public string destinationPoint { get; set; } = "";
}
}
此文件类型无法预览
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using DeviceLibrary.bean.jobType;
using Common;
using DeviceLibrary.manager;
using static DeviceLibrary.AgvInfo;
namespace DeviceLibrary
{
public static class AGVManager
{
static log4net.ILog log = log4net.LogManager.GetLogger("AGVManager");
/// <summary>
/// 小车信息
/// </summary>
public static List<AgvInfo> agvInfo;
public static AgvServer server;
public static Control control;
public static List<JobType> jobTypes;
public static readonly string CONFIG_PATH = AppDomain.CurrentDomain.BaseDirectory + "Config\\";
#region 任务日志
static log4net.ILog runLog = log4net.LogManager.GetLogger("RunLog");
static Dictionary<string, RunInfo> runInfoMap = new Dictionary<string, RunInfo>();
public static void RunLogInfo(RunInfo info)
{
if (runInfoMap == null)
return;
if (runInfoMap.Keys.Contains(info.AGVNum))
{
if (!runInfoMap[info.AGVNum].Equals(info))
{
runLog.Info(info.ToString());
}
}
else
{
runInfoMap.Add(info.AGVNum, info);
runLog.Info(info.ToString());
}
}
public static void ErrorLogRecord(ErrorInfo errorInfo)
{
runLog.Info(errorInfo.ToString());
}
#endregion
/// <summary>
/// 初始化配置
/// </summary>
public static void Init()
{
jobTypes = new List<JobType>();
jobTypes.Add(new SendToLinesWithBackJobType());
jobTypes.Add(new F1LiftToStoreJobType());
jobTypes.Add(new F1StoreToLiftJobType());
jobTypes.Add(new ChargeJobType());
InitAgv();
//任务加载
AgvTaskManager.InitAgvTask();
}
static void InitAgv()
{
agvInfo = new List<AgvInfo>();
XmlConfigOperation.LoadAgvInfos(agvInfo);
}
}
public class RunInfo
{
/// <summary>
/// AGV编号
/// </summary>
public string AGVNum { get; set; } = "";
public string DeviceName { get; set; } = "";
/// <summary>
/// 任务名称
/// </summary>
public string TaskName { get; set; } = "";
/// <summary>
/// 目的地
/// </summary>
public string TargetPlace { get; set; } = "";
/// <summary>
/// 任务步骤
/// </summary>
public string TaskStep { get; set; } = "";
/// <summary>
/// 任务内容
/// </summary>
public string MissionInfo { get; set; } = "";
/// <summary>
/// 开始时间
/// </summary>
public string DateTime { get; set; } = "";
/// <summary>
/// 结束时间
/// </summary>
public string EndDateTime { get; set; } = "";
/// <summary>
/// 任务运行时长
/// </summary>
public string TaskRunTime { get; set; } = "";
/// <summary>
/// 类型
/// </summary>
public string Type { get; set; } = "Task";
public void SetInfo(string AGVNum, string jobName, string targetPlace, string taskStep, string missionInfo, DateTime startTime, DateTime endTime)
{
//开始时间 2006-01-02 15:04:05
DateTime = startTime.ToString("yyyy-MM-dd HH:mm:ss");
EndDateTime = endTime.ToString("yyyy-MM-dd HH:mm:ss");
this.AGVNum = AGVNum;
MissionInfo = missionInfo;
TaskName = jobName;
TaskRunTime = (endTime - startTime).TotalMinutes.ToString("f2");
TargetPlace = targetPlace;
TaskStep = taskStep;
}
public RunInfo() { }
public override bool Equals(object obj)
{
if (obj is RunInfo)
{
RunInfo info = (RunInfo)obj;
if (this.MissionInfo.Equals(info.MissionInfo))
return true;
this.MissionInfo = info.MissionInfo;
}
return false;
}
public override string ToString()
{
return JsonHelper.SerializeObject(this);
}
}
public class ErrorInfo
{
/// <summary>
/// AGV编号
/// </summary>
public string AGVNum
{
get { return agvname; }
set
{
agvname = value.PadLeft(4, '0');
}
}
private string agvname = "";
public string DeviceName { get; set; } = "";
/// <summary>
/// 开始时间
/// </summary>
public string DateTime { get; set; } = "";
/// <summary>
/// 结束时间
/// </summary>
public string EndDateTime { get; set; } = "";
/// <summary>
/// 异常信息
/// </summary>
public string ErrorMsg { get; set; } = "";
public string ErrorLastTime { get; set; } = "";
/// <summary>
/// 任务名称
/// </summary>
public string TaskName { get; set; } = "";
/// <summary>
/// AGV的当前任务
/// </summary>
public string AGVMissionName { get; set; } = "";
public string MissionInfo { get; set; } = "";
/// <summary>
/// 目的地
/// </summary>
public string TargetPlace { get; set; } = "";
/// <summary>
/// 类型
/// </summary>
public string Type { get; set; } = "Error";
public ErrorInfo(AgvInfo agv)
{
DateTime = agv.errStartTime.ToString("yyyy-MM-dd HH:mm:ss");
AGVNum = agv.Name;
EndDateTime = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
ErrorMsg = agv.ErrorMsg;
ErrorLastTime = (System.DateTime.Now - agv.errStartTime).TotalMinutes.ToString("f2");
if (agv.CurJob != null)
{
TaskName = agv.CurJob.JobName;
MissionInfo = agv.CurJob.runInfo;
}
AGVMissionName = agv.TaskRunState.Task.AliceName;
TargetPlace = agv.Place.Name;
}
public override string ToString()
{
return JsonHelper.SerializeObject(this);
}
}
public static class Window_API
{
[DllImport("user32.dll", EntryPoint = "ShowWindow", CharSet = CharSet.Auto)]
public static extern int ShowWindow(IntPtr hwnd, int nCmdShow);
[DllImport("user32.dll ", SetLastError = true)]
public static extern void SwitchToThisWindow(IntPtr hWnd, bool fAltTab);
public const int SW_RESTORE = 9;
}
}
\ No newline at end of file \ No newline at end of file
using Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DeviceLibrary
{
/// <summary>
/// AGV任务管理
/// </summary>
public class AgvTaskManager
{
/// <summary>
/// 任务列表
/// </summary>
public static List<AgvTask> AgvTasks;
/// <summary>
/// 加载任务
/// </summary>
public static void InitAgvTask()
{
try
{
AgvTasks = new List<AgvTask>();
manager.XmlConfigOperation.LoadTaskInfos(AgvTasks);
}
catch (Exception ex)
{
LogUtil.error("加载AGV任务失败", ex);
}
}
public static void InitView(ComboBox comboBox)
{
comboBox.DisplayMember = "AliceName";
comboBox.ValueMember = "Id";
foreach (AgvTask mission in AgvTaskManager.AgvTasks)
{
comboBox.Items.Add(mission);
}
comboBox.SelectedItem = GetTaskByName(SettingString.Init);
}
/// <summary>
/// 根据id获取任务
/// </summary>
/// <param name="taskName"></param>
/// <returns></returns>
public static AgvTask GetTaskById(int id)
{
AgvTask task = AgvTasks.Find(s => s.Id.Equals(id));
if (task != null)
return task;
else
LogUtil.error(string.Format("任务Id={0}不存在,请检查配置文件!", id));
return new AgvTask();
}
/// <summary>
/// 根据任务名获取任务
/// </summary>
/// <returns></returns>
public static AgvTask GetTaskByName(string name)
{
AgvTask task = AgvTasks.Find(s => s.Name.Equals(name));
if (task != null)
return task.ToCopy();
else
LogUtil.error(string.Format("任务名{0}不存在,请检查配置文件!", name));
return new AgvTask();
}
public static AgvTask GetTaskByAliceName(string aliceName)
{
AgvTask mission = AgvTasks.Find(s => s.AliceName.Equals(aliceName));
if (mission != null)
return mission;
else
LogUtil.error(string.Format("任务[{0}]不存在,请检查!", aliceName));
return new AgvTask();
}
/// <summary>
/// 向小车发送任务
/// </summary>
/// <returns></returns>
public static bool AssignMission(AgvInfo agv, string taskname)
{
bool rtn = false;
AgvTask task = GetTaskByName(taskname);
Node node = manager.NodeManager.GetNodeByName(taskname);
if (task !=null)
{
agv.TaskRunState.Task = task;
if (node != null)
agv.Place = node;
if (!agv.IsCon)
{
agv.TaskRunState.ResetInfo();
agv.TaskRunState.EnWaitTaskQueue(task);
LogUtil.info(string.Format("{0} 离线,任务{1}加入等待队列 ", agv.Name, task.AliceName));
return false;
}
if (agv.UseFleet)
{
rtn = MiR_API.Add_Mission_Fleet(agv);
MiR_API.State_Ready(agv);
if (rtn)
{
LogUtil.info(string.Format("{0} Add_Mission_Fleet {1} Success", agv.Name, agv.TaskRunState.ToTaskInfo()));
}
else
{
LogUtil.info(string.Format("{0} Add_Mission_Fleet {1} Fail", agv.Name, agv.TaskRunState.ToTaskInfo()));
}
}
else
{
rtn = MiR_API.Add_Mission(agv);
MiR_API.State_Ready(agv);
if (rtn)
{
LogUtil.info(string.Format("{0} Add_Mission {1} Success", agv.Name, agv.TaskRunState.ToTaskInfo()));
}
else
{
LogUtil.info(string.Format("{0} Add_Mission {1} Fail", agv.Name, agv.TaskRunState.ToTaskInfo()));
}
}
agv.StateKanban.SetCurTask(agv.TaskRunState.ToTaskShowInfo());
if (!rtn)
agv.TaskRunState.EnWaitTaskQueue(task);
}
return rtn;
}
/// <summary>
/// 删除任务
/// </summary>
/// <returns></returns>
public static void DelMission(AgvInfo agv)
{
if (agv.UseFleet)
{
MiR_API.Del_Mission_Fleet(agv);
}
else
{
MiR_API.Del_Mission(agv);
}
LogUtil.info(string.Format("{0} DelMission [{1}] OK", agv.Name, agv.TaskRunState.ToTaskInfo()));
}
}
}
using Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Concurrent;
using DeviceLibrary.bean;
namespace DeviceLibrary
{
public class ChargePileManager
{
static ChargePiles ChargePiles;
public static void Init()
{
ChargePiles = new ChargePiles();
manager.XmlConfigOperation.LoadChargePileInfos(ChargePiles);
CheckPileDulp();
}
/// <summary>
/// 检查是否存在一台agv占用多个充电桩
/// </summary>
public static void CheckPileDulp()
{
List<ChargePile> cps;
foreach (AgvInfo item in AGVManager.agvInfo)
{
cps = ChargePiles.GetChargePilesByAgv(item);
if (cps != null && cps.Count > 1)
{
foreach (ChargePile cp in cps)
{
if (cp.Fixed)
{
System.Windows.Forms.MessageBox.Show($"{item.Name} 有固定充电桩 {cp.AliceName},不允许在其他充电桩上配置该车,请检查配置文件{"chargeinfos.xml"}", "警告");
return;
}
}
}
}
}
public static ChargePiles GetChargePiles()
{
return ChargePiles;
}
static object loc = new object();
/// <summary>
/// 是否有充电桩用于充电
/// </summary>
/// <param name="agv"></param>
/// <returns>充电任务结果</returns>
public static bool HasEmpty(AgvInfo agv, out ChargePile charge)
{
charge=null;
lock (loc)
{
List<ChargePile> cps = ChargePiles.GetChargePilesByAgv(agv);
{
foreach (ChargePile item in cps)
{
if (item.HasEmpty(agv))
{
charge = item;
return true;
}
}
}
}
return false;
}
public static void StartCharge(AgvInfo agv, string chargename)
{
ChargePiles.GetChargePileByName(chargename).Occupy(agv);
agv.IsInCharge = true;
}
public static void StopCharge(AgvInfo agv)
{
List<ChargePile> cps = ChargePiles.GetChargePilesByAgv(agv);
foreach (ChargePile item in cps)
{
if(agv.Equals(item.OccupiedAgv))
{
item.DelOccupy(agv);
agv.IsInCharge = false;
return;
}
}
}
public static bool CheckIsRandom(AgvInfo agv)
{
bool isRandom = true;
ChargePile cp = ChargePiles.GetChargePileByAgv(agv);
if(cp !=null)
{
isRandom = !cp.Fixed;
}
return isRandom;
}
}
}
using Common;
using RestSharp;
using System;
using System.Collections.Generic;
using System.Drawing;
namespace DeviceLibrary
{
public class HttpManager
{
public static bool CheckIP(string name, string ip)
{
//IP合法
string pattern = @"^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$";
bool rtn = System.Text.RegularExpressions.Regex.IsMatch(ip, pattern);
if (!rtn)
{
log.Error("非法的IP地址" + ip);
return false;
}
//Ping服务端
try
{
System.Net.NetworkInformation.Ping ping = new System.Net.NetworkInformation.Ping();
System.Net.NetworkInformation.PingReply result = ping.Send(ip, 2000);
ping.Dispose();
if (result.Status != System.Net.NetworkInformation.IPStatus.Success)
{
log.Error(name + " Ping " + ip + " 请求没有响应");
return false;
}
return true;
}
catch (Exception ex)
{
log.Error("CheckIP", ex);
return false;
}
}
private static log4net.ILog log = log4net.LogManager.GetLogger("HttpManager");
/// <summary>
/// 大料车接口回复
/// </summary>
public class Msg
{
public string msg { get; set; }
}
private static string Addr_updateDeviceAlarmMsg = "/rest/api/qisda/device/updateDeviceAlarmMsg";
/// <summary>
/// 异常看板
/// </summary>
/// <param name="msgList"></param>
/// <returns></returns>
public static string updateDeviceAlarmMsg(List<AlarmMsg> msgList)
{
string msg = "";
try
{
if (msgList.Count.Equals(0)) return "";
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 = "【" + 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.httpServer);
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 static string updateStatus = AppConfigHelper.GetValue(SettingString.Lift_GetState);
public static lift.LiftStatus UpdateStatusToLift(lift.ClientStatus clientStatus)
{
try
{
string resultStr = HttpHelper.Post(updateStatus, JsonHelper.SerializeObject(clientStatus));
StatusResult data = JsonHelper.DeserializeJsonToObject<StatusResult>(resultStr);
if (data == null)
{
return null;
}
else
{
return data.data;
}
}
catch (Exception e)
{
log.Error("UpdateStatusToLift", e);
return null;
}
}
public static bool DoorOperation(service.model.DoorInfo doorInfo)
{
try
{
string resultStr = HttpHelper.Post(updateStatus, JsonHelper.SerializeObject(doorInfo));
Result data = JsonHelper.DeserializeJsonToObject<Result>(resultStr);
if (data == null)
{
log.Warn($"DoorOperation fail:{JsonHelper.SerializeObject(doorInfo)}");
return false;
}
else
{
if(data.code.Equals(0))
{
log.Info($"DoorOperation info:{JsonHelper.SerializeObject(doorInfo)},result:code={data.code},msg={data.msg},data={data.data}");
return true;
}
else
{
log.Warn($"DoorOperation info:{JsonHelper.SerializeObject(doorInfo)},result:code={data.code},msg={data.msg},data={data.data}");
return false;
}
}
}
catch (Exception e)
{
log.Error("DoorOperation", e);
}
return false;
}
}
public class StatusResult
{
/// <summary>
/// 状态码。0为正常。其他为异常。
/// </summary>
public int code { get; set; } = 0;
/// <summary>
/// 提示消息
/// </summary>
public string msg { get; set; } = "ok";
/// <summary>
/// 返回数据
/// </summary>
public lift.LiftStatus data { get; set; }
}
public class AlarmMsg
{
//>>>name : 异常位置名称
public string name = "";
//>>>msgKey : 异常信息唯一标识
public string msgKey = "";
//>>>msgValue : 异常信息
public string msgValue = "";
//0:异常;1:正常显示
public int type = 0;
/// <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; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TcpKPIO;
namespace DeviceLibrary.manager
{
public class IOManager
{
static int diCount = 2;
public static void Start(int port=6000)
{
bool rtn = KPIOServer.StartServer(port);
IOLogUtil.info($"开启IO模块:{rtn}");
}
public static bool GetDI(string ip,int idx)
{
return KPIOServer.GetDI(ip, idx)==0?false:true;
}
public static void Stop()
{
KPIOServer.StopServer();
}
public static string GetDI(string ip)
{
try
{
return string.Format("DI0={0},DI1={1}",KPIOServer.GetDI(ip,0), KPIOServer.GetDI(ip, 1));
}
catch
{
return "";
}
}
}
}
using Common;
using DeviceLibrary.service.model;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using DeviceLibrary.service.model;
namespace DeviceLibrary.manager
{
public class MissionManager
{
public delegate void MissionChangedEventHandler();
public static event MissionChangedEventHandler MissionChangedEvent;
static List<MissionInfo> MissionInfos = new List<MissionInfo>();
static Service web = new Service();
static object lockObj = new object();
static log4net.ILog Log = log4net.LogManager.GetLogger("MissionManager");
public static void InitMission()
{
string path = AGVManager.CONFIG_PATH + SettingString.FileName_Missions;
if (!System.IO.File.Exists(path))
return;
string txt = System.IO.File.ReadAllText(path, Encoding.GetEncoding("utf-8"));
MissionInfos = JsonHelper.DeserializeJsonToList<MissionInfo>(txt);
}
static void WriteMission()
{
string path = AGVManager.CONFIG_PATH + SettingString.FileName_Missions;
string txt = JsonHelper.SerializeObject(MissionInfos);
try
{
System.IO.File.WriteAllText(path, txt);
}
catch (Exception e)
{
Log.Error("WriteMission 失败", e);
}
}
public static void InitView(DataGridView dataGridView)
{
// Set up the DataGridView.
dataGridView.Dock = DockStyle.Fill;
// Automatically generate the DataGridView columns.
dataGridView.AutoGenerateColumns = true;
foreach (DataGridViewColumn item in dataGridView.Columns)
{
item.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
}
dataGridView.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
dataGridView.AllowUserToAddRows = false;
BindingSource bindingSource = new BindingSource();
bindingSource.DataSource = MissionInfos.ToList<MissionInfo>();
dataGridView.DataSource = bindingSource;
}
public static void UpdateDataSource(DataGridView dataGridView)
{
BindingSource bindingSource = new BindingSource();
bindingSource.DataSource = MissionInfos.ToList<MissionInfo>();
dataGridView.DataSource = bindingSource;
}
public static bool IsOpen()
{
return web.State;
}
public static void Open()
{
web.Open(AppConfigHelper.GetValue("WebService"));
}
public static void Close()
{
web.Close();
}
public static bool Contains(MissionInfo MissionInfo)
{
int id = MissionInfos.FindIndex(s => s.missionId.Equals(MissionInfo.missionId));
if (id > -1)
return true;
return false;
}
public static bool Contains(string missionId)
{
int id = MissionInfos.FindIndex(s => s.missionId.Equals(missionId));
if (id > -1)
return true;
return false;
}
public static List<MissionInfo> GetMissions()
{
return MissionInfos;
}
public static MissionInfo GetMission(string missionId)
{
int id = MissionInfos.FindIndex(s => s.missionId.Equals(missionId));
if (id > -1)
return MissionInfos[id];
return null;
}
public static void Add(MissionInfo mission)
{
try
{
if (Monitor.TryEnter(lockObj, 1000))
{
MissionInfos.Add(mission);
Log.Info($"新建任务 {JsonHelper.SerializeObject(mission)}");
WriteMission();
}
}
catch (Exception e)
{
Log.Error("操作 fixMissionInfos 超时");
}
finally
{
Monitor.Exit(lockObj);
}
MissionChangedEvent?.Invoke();
}
public static void DeleteById(string missioId)
{
try
{
MissionInfo missionInfo = null;
if (Monitor.TryEnter(lockObj, 1000))
{
missionInfo = MissionInfos.Find(s => s.missionId.Equals(missioId));
MissionInfos.Remove(missionInfo);
Log.Info($"删除任务 {JsonHelper.SerializeObject(missionInfo)}");
WriteMission();
}
}
catch (Exception e)
{
Log.Error("操作 fixMissionInfos 超时", e);
}
finally
{
Monitor.Exit(lockObj);
}
MissionChangedEvent?.Invoke();
}
/// <summary>
/// 获取送料任务,以准备执行
/// </summary>
/// <param name="missionType"></param>
/// <returns></returns>
public static MissionInfo GetDeliverMission(AgvInfo agv, out string liftname)
{
MissionInfo missionInfo = null;
liftname = "";
try
{
if (Monitor.TryEnter(lockObj, 1000))
{
missionInfo = MissionInfos.Find(s => s.sourceWorkshop.Equals(agv.Scope.Workshop) && s.State.Equals(MissionState.创建) &&
agv.Scope.Tasks.Contains(s.projectType.ToString()));
if (missionInfo != null)
{
liftname = GetLiftName(missionInfo);
SetMissionState(missionInfo, MissionState.接料);
Log.Info($"执行任务[{agv.Name}][起始地] {JsonHelper.SerializeObject(missionInfo)}");
WriteMission();
}
}
}
catch (Exception e)
{
Log.Error("操作 fixMissionInfos 超时", e);
}
finally
{
Monitor.Exit(lockObj);
}
MissionChangedEvent?.Invoke();
return missionInfo;
}
/// <summary>
/// 获取接收料任务,以准备执行
/// </summary>
/// <param name="missionType"></param>
/// <returns></returns>
public static MissionInfo GetReceiveMission(AgvInfo agv)
{
MissionInfo missionInfo = null;
try
{
if (Monitor.TryEnter(lockObj, 1000))
{
missionInfo = MissionInfos.Find(s => s.destinationWorkshop.Equals(agv.Scope.Workshop) &&
(s.State >= MissionState.前往电梯 && s.State <= MissionState.电梯到达) && agv.Scope.Tasks.Contains(s.projectType.ToString()));
if (missionInfo != null)
{
Log.Info($"执行任务[{agv.Name}][目的地] {JsonHelper.SerializeObject(missionInfo)}");
}
}
}
catch (Exception e)
{
Log.Error("操作 fixMissionInfos 超时", e);
}
finally
{
Monitor.Exit(lockObj);
}
MissionChangedEvent?.Invoke();
return missionInfo;
}
/// <summary>
/// 获取同一层任务:点到点,以准备执行
/// </summary>
/// <param name="missionType"></param>
/// <returns></returns>
public static MissionInfo GetLineToLineMission(AgvInfo agv)
{
MissionInfo missionInfo = null;
try
{
if (Monitor.TryEnter(lockObj, 1000))
{
missionInfo = MissionInfos.Find(s => s.destinationWorkshop.Equals(agv.Scope.Workshop) &&
s.sourceWorkshop.Equals(agv.Scope.Workshop) && s.projectType.Equals(ProjectType.半成品领用) &&
(s.State >= MissionState.创建) && agv.Scope.Tasks.Contains(s.projectType.ToString()));
if (missionInfo != null)
{
Log.Info($"执行任务[{agv.Name}][目的地] {JsonHelper.SerializeObject(missionInfo)}");
}
}
}
catch (Exception e)
{
Log.Error("操作 fixMissionInfos 超时", e);
}
finally
{
Monitor.Exit(lockObj);
}
MissionChangedEvent?.Invoke();
return missionInfo;
}
/// <summary>
/// 获取同一层任务:一对多,以准备执行
/// </summary>
/// <param name="missionType"></param>
/// <returns></returns>
public static MissionInfo GetStoreToLinesMission(AgvInfo agv)
{
MissionInfo missionInfo = null;
try
{
if (Monitor.TryEnter(lockObj, 1000))
{
missionInfo = MissionInfos.Find(s => s.destinationWorkshop.Equals(agv.Scope.Workshop) &&
s.sourceWorkshop.Equals(agv.Scope.Workshop) &&
(s.projectType.Equals(ProjectType.PCB领用) || s.projectType.Equals(ProjectType.包材领用))
&&
(s.State >= MissionState.创建) && agv.Scope.Tasks.Contains(s.projectType.ToString()));
if (missionInfo != null)
{
Log.Info($"执行任务[{agv.Name}][目的地] {JsonHelper.SerializeObject(missionInfo)}");
}
}
}
catch (Exception e)
{
Log.Error("操作 fixMissionInfos 超时", e);
}
finally
{
Monitor.Exit(lockObj);
}
MissionChangedEvent?.Invoke();
return missionInfo;
}
/// <summary>
/// 获取电梯内的任务信息
/// </summary>
/// <param name="missionType"></param>
/// <returns></returns>
public static MissionInfo GetMissionInLift(AgvInfo agv)
{
MissionInfo missionInfo = null;
try
{
if (Monitor.TryEnter(lockObj, 1000))
{
missionInfo = MissionInfos.Find(s => s.destinationWorkshop.Equals(agv.Scope.Workshop) &&
(s.State >= MissionState.电梯运行 && s.State <= MissionState.电梯到达) && agv.Scope.Tasks.Contains(s.projectType.ToString()));
if (missionInfo != null)
{
Log.Info($"执行任务[{agv.Name}][目的地] {JsonHelper.SerializeObject(missionInfo)}");
}
}
}
catch (Exception e)
{
Log.Error("操作 fixMissionInfos 超时", e);
}
finally
{
Monitor.Exit(lockObj);
}
MissionChangedEvent?.Invoke();
return missionInfo;
}
/// <summary>
/// 设置任务状态
/// </summary>
/// <param name="missionId"></param>
public static void SetMissionState(string missionId, MissionState missionState, out string msg)
{
MissionInfo missionInfo = null;
msg = "ok";
try
{
if (Monitor.TryEnter(lockObj, 1000))
{
missionInfo = MissionInfos.Find(s => s.missionId.Equals(missionId));
if (missionInfo == null)
{
msg = $"设置任务{missionId}状态为{missionState}失败,原因为不存在该任务Id";
return;
}
else
{
SetMissionState(missionInfo, missionState);
if (CanMissionDelete(missionState))
{
MissionInfos.Remove(missionInfo);
Log.Info($"删除任务 {JsonHelper.SerializeObject(missionInfo)}");
}
}
WriteMission();
}
}
catch (Exception e)
{
Log.Error("操作 fixMissionInfos 超时");
}
finally
{
Monitor.Exit(lockObj);
}
MissionChangedEvent?.Invoke();
}
public static void SetMissionState(MissionInfo missionInfo,MissionState missionState)
{
missionInfo.SetState(missionState);
Log.Info($"设置任务{missionInfo.missionId}状态为{missionState}成功");
}
/// <summary>
/// 任务能否被删除
/// </summary>
/// <param name="missionState"></param>
/// <returns></returns>
static bool CanMissionDelete(MissionState missionState)
{
if (missionState.Equals(MissionState.中止) || missionState.Equals(MissionState.取消))
return true;
return false;
}
/// <summary>
/// 根据任务信息得到电梯名称
/// </summary>
/// <param name="missionInfo"></param>
/// <returns></returns>
static string GetLiftName(MissionInfo missionInfo)
{
string liftname = "";
try
{
switch (missionInfo.projectType)
{
case ProjectType.PCB领用:
if (missionInfo.sourceWorkshop.StartsWith("1"))
{
if (missionInfo.destinationWorkshop.Equals(SettingString._3D))
{
liftname = SettingString.LIFT_D2;
}
else if (missionInfo.destinationWorkshop.Equals(SettingString._4C))
{
liftname = SettingString.LIFT_C1;
}
else if (missionInfo.destinationWorkshop.Equals(SettingString._4D))
{
liftname = SettingString.LIFT_D2;
}
}
break;
case ProjectType.Tray领用:
if (missionInfo.sourceWorkshop.StartsWith("1"))
{
if (missionInfo.destinationWorkshop.Equals(SettingString._4D))
{
liftname = SettingString.LIFT_D2;
}
}
else if(missionInfo.sourceWorkshop.Equals(SettingString._3C))
{
if (missionInfo.destinationWorkshop.Equals(SettingString._4C))
{
liftname = SettingString.LIFT_C2;
}
}
break;
case ProjectType.包材领用:
if (missionInfo.sourceWorkshop.StartsWith("-1"))
{
if (missionInfo.destinationWorkshop.Equals(SettingString._4D)||
missionInfo.destinationWorkshop.Equals(SettingString._3D))
{
liftname = SettingString.LIFT_D8;
}
}
break;
case ProjectType.半成品入库:
break;
case ProjectType.半成品入库与领用:
break;
case ProjectType.半成品领用:
break;
case ProjectType.垃圾清运:
break;
case ProjectType.成品入库:
break;
case ProjectType.空台车归还:
if (missionInfo.destinationWorkshop.StartsWith("1"))
{
if (missionInfo.sourceWorkshop.Equals(SettingString._4D) ||
missionInfo.sourceWorkshop.Equals(SettingString._3D))
{
liftname = SettingString.LIFT_D2;
}
else if (missionInfo.sourceWorkshop.Equals(SettingString._4C))
{
liftname = SettingString.LIFT_C1;
}
}
break;
case ProjectType.空台车领用:
if (missionInfo.sourceWorkshop.StartsWith("1"))
{
if (missionInfo.destinationWorkshop.Equals(SettingString._4D)||
missionInfo.destinationWorkshop.Equals(SettingString._3D))
{
liftname = SettingString.LIFT_D2;
}
else if (missionInfo.destinationWorkshop.Equals(SettingString._4C))
{
liftname = SettingString.LIFT_C1;
}
}
break;
case ProjectType.静电箱领用:
if (missionInfo.sourceWorkshop.Equals(SettingString._3C))
{
if (missionInfo.destinationWorkshop.Equals(SettingString._4C))
{
liftname = SettingString.LIFT_C2;
}
}
break;
}
}
catch (Exception e)
{
LogUtil.error("GetLiftName:" + missionInfo.missionId, e);
}
missionInfo.liftName = liftname;
return "";
}
}
}
using Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DeviceLibrary.manager;
using System.Windows.Forms;
using System.Drawing;
using static DeviceLibrary.Node;
namespace DeviceLibrary.manager
{
public class NodeManager
{
/// <summary>
/// 节点信息
/// </summary>
public static List<Node> nodeInfo;
public static void InitNodesInfos()
{
nodeInfo = new List<Node>();
XmlConfigOperation.LoadNodeInfos(nodeInfo);
WriteAllNodeInfos();
}
public static void InitView(DataGridView DgvNode)
{
BindingSource bindingSource = new BindingSource();
foreach (Node node in NodeManager.nodeInfo)
{
//if (!node.Type.Equals(NodeType.Node))
// continue;
bindingSource.Add(node);
}
DgvNode.AutoGenerateColumns = false;
DgvNode.AutoSize = true;
DgvNode.DataSource = bindingSource;
DgvNode.RowPostPaint += delegate {
DgvNode.RowsDefaultCellStyle.BackColor = Color.White;
DgvNode.AlternatingRowsDefaultCellStyle.BackColor = Color.LightBlue;
};
DgvNode.Columns.Add(new DataGridViewCheckBoxColumn() { HeaderText = "启用", DataPropertyName = "IsUse" });
DgvNode.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "编号", DataPropertyName = "Id" });
DgvNode.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "名称", DataPropertyName = "Name" });
DgvNode.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "别名", DataPropertyName = "AliceName" });
DgvNode.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "车间", DataPropertyName = "Workshop" });
DgvNode.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "IP", DataPropertyName = "IP" });
DgvNode.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "动作", DataPropertyName = "nodeStatus" });
DgvNode.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "等级", DataPropertyName = "ClientLevel" });
DgvNode.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "RFID", DataPropertyName = "RFID" });
DgvNode.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "IO", DataPropertyName = "IOState" });
DgvNode.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "状态", DataPropertyName = "Online" });
DgvNode.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
//int n;
//DgvNode.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "名称"});
//DgvNode.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "IP" });
//DgvNode.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "动作" });
//DgvNode.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "等级" });
//DgvNode.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "RFID" });
//DgvNode.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "连接" });
//DgvNode.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "IO" });
//DgvNode.Columns.Add(new DataGridViewButtonColumn() { HeaderText = "启用" });
//DgvNode.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
//for (int i = 0; i < NodeManager.nodeInfo.Count; i++)
//{
// //if (!NodeManager.nodeInfo[i].Type.Equals(NodeType.Node))
// // continue;
// n = DgvNode.Rows.Add(NodeManager.nodeInfo[i].ToRow());
// DgvNode.Rows[n].HeaderCell.Value = (n + 1).ToString();
// if (i % 2 == 0)
// DgvNode.Rows[n].DefaultCellStyle.BackColor = Color.LightBlue;
// if (!NodeManager.nodeInfo[i].Online)
// DgvNode.Rows[n].DefaultCellStyle.ForeColor = Color.Red;
//}
}
public static void UpdateDataSource(DataGridView dataGridView)
{
BindingSource bindingSource = new BindingSource();
foreach (Node node in NodeManager.nodeInfo)
{
//if (!node.Type.Equals(NodeType.Node))
// continue;
bindingSource.Add(node);
}
dataGridView.DataSource = bindingSource;
}
public static Node GetNodeById(int id)
{
return nodeInfo.Find(s => s.Id.Equals(id));
}
public static Node GetNodeByName(string name)
{
return nodeInfo.Find(s => s.Name.Equals(name));
}
public static Node GetNodeByType(NodeType nodeType = NodeType.AutoCharge)
{
return nodeInfo.Find(s => s.Type.Equals(nodeType));
}
public static Node GetNode(string name, NodeType nodeType = NodeType.Node)
{
return nodeInfo.Find(s => s.Name.Equals(name) && s.Type.Equals(nodeType));
}
public static bool CheckNode(string nodename)
{
Node node = nodeInfo.Find(s => s.Name.Equals(nodename));
if (node == null)
return false;
else
return true;
}
public static bool CheckNodes(string nodenames,out string names)
{
string[] nodes = nodenames.Split(',');
names = "";
foreach (string item in nodes)
{
Node node = nodeInfo.Find(s => s.Name.Equals(item));
if (node == null)
{
names += item + ",";
}
}
if (names.Equals(""))
return true;
return false;
}
/// <summary>
/// 是否存在节点
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
public static bool HasNode(string name)
{
int idx = nodeInfo.FindIndex(s => s.Name.Equals(name));
return idx == -1 ? false : true;
}
public static void UpdateNode(Node node)
{
Node node1 = NodeManager.nodeInfo.Find(s => s.Name == node.Name);
if (node1 == null)
{
Common.LogUtil.error("UpdateNode: " + node.Name + " 不存在");
return;
}
if (!node1.Equals(node))
{
node1.UpdateNode(node);
}
}
public static void RegisEvent(NodeChangedEvent changedEvent, NodeChangedEvent onlineEvent)
{
foreach (Node node in nodeInfo)
{
node.NodeChanged += changedEvent;
node.NodeOnline += onlineEvent;
}
}
public static void UnRegisEvent(NodeChangedEvent changedEvent, NodeChangedEvent onlineEvent)
{
foreach (Node node in nodeInfo)
{
node.NodeChanged -= changedEvent;
node.NodeOnline -= onlineEvent;
}
}
public static void WriteAllNodeInfos()
{
//foreach (Node item in nodeInfo)
//{
// LogUtil.info(item.ToString());
//}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
/// <summary>
/// 操作管理
/// </summary>
public class OpManager
{
public class WaitConfirm
{
public static bool Line(Node node)
{
return LineApi(node) || LineButton(node);
}
public static bool LineButton(Node node)
{
return node.ExtendEquip.ButtonConfirmSig;
}
public static bool LineApi(Node node)
{
return node.ExtendEquip.ApiConfirmSig;
}
}
public class ServerToClient
{
/// <summary>
/// 请求料车进入
/// </summary>
public static void ReadyEnter(string nodename="",string rfid="")
{
//AGVManager.server.ReadyEnter(nodename,rfid);
}
/// <summary>
/// 请求料车出
/// </summary>
public static void ReadyLeave(string nodename = "", string rfid = "")
{
//AGVManager.server.ReadyLeave(nodename, rfid);
}
/// <summary>
/// 完成进入/出去
/// </summary>
public static void Complete()
{
}
}
public class ClientToSMDServer
{
public static void RemoveRfidBufInfo(string rfid)
{
//HttpManager.AgvRemoveRfid(rfid);
}
}
public class Info
{
public static bool GetUnlock(string rfid)
{
return false;
}
public static bool GetTransfer(out string target)
{
target = "";
//Common.LogUtil.debug($"GetTransfer [name={manager.WarehouseSigManager.TargetWithFix.Name},target={manager.WarehouseSigManager.TargetWithFix.Target}]");
//if (!string.IsNullOrEmpty(manager.WarehouseSigManager.TargetWithFix.Target))
//{
// target= manager.WarehouseSigManager.TargetWithFix.Target;
// return true;
//}
return false;
}
public static bool UpdateShelfStatus(string rfid,string place)
{
return true;
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace DeviceLibrary.manager
{
public class UploadManager
{
#region 上传到ITS
static object locupdate = new object();
/// <summary>
/// 上传AGV状态,每10秒上传一次
/// </summary>
public static void UploadAgvState()
{
if (Monitor.TryEnter(locupdate, 2000))
{
try
{
List<service.model.AgvState> agvStates = new List<service.model.AgvState>();
foreach (AgvInfo item in AGVManager.agvInfo)
{
service.model.AgvState agvState = new service.model.AgvState()
{
agvNum = item.Name,
workshop = item.Scope.Workshop,
battery = item.Battery,
position = item.Position,
/// <summary>
/// 当前状态:执行任务/归位中/充电中/故障中
/// </summary>
state = item.StateID.ToString(),
curTarget = item.Place.Name,
statusTxt = item.MissionText
};
if (item.CurJob != null && item.CurJob.JobParam != null && item.CurJob.JobParam.GetMissionInfo() != null)
{
agvState.missionId = item.CurJob.JobParam.GetMissionInfo().missionId;
agvState.remark = item.CurJob.JobParam.GetMissionInfo().Remark;
}
agvStates.Add(agvState);
}
string txt = Common.JsonHelper.SerializeObject(agvStates);
Common.LogUtil.info(txt);
}
finally
{
Monitor.Exit(locupdate);
}
}
}
/// <summary>
/// 运输状态上报
/// </summary>
/// <param name="transportStatus"></param>
public static void UploadPosition(service.model.TransportStatus transportStatus)
{
try
{
string txt = Common.JsonHelper.SerializeObject(transportStatus);
Common.LogUtil.info(txt);
}
catch { }
}
#endregion
}
}
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.12" targetFramework="net472" />
</packages>
\ No newline at end of file \ No newline at end of file
using System.ServiceModel;
using System.ServiceModel.Web;
using System.IO;
using System.Runtime.Serialization;
using System.Collections.Generic;
using DeviceLibrary.service.model;
namespace DeviceLibrary
{
[ServiceContract(Name = "Service")]
internal interface IService
{
[OperationContract]
[WebInvoke(UriTemplate = "/missions/create", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Result Create(Stream stream);
[OperationContract]
[WebInvoke(UriTemplate = "/missions/update", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Result Update(Stream stream);
[OperationContract]
[WebInvoke(UriTemplate = "/missions/delete", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Result Delete(Stream stream);
[OperationContract]
[WebInvoke(UriTemplate = "/missions/readAll", Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
MissionResult ReadAll();
[OperationContract]
[WebInvoke(UriTemplate = "/missions/operationFinish", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
Result OperationFinish(Stream stream);
}
[DataContract]
internal class Result
{
/// <summary>
/// 状态码,0为正常
/// </summary>
[DataMember]
public int code { get; set; } = 0;
/// <summary>
/// 返回数据
/// </summary>
[DataMember]
public string data { get; set; } = "";
/// <summary>
/// 提示信息
/// </summary>
[DataMember]
public string msg { get; set; } = "ok";
}
[DataContract]
internal class MissionResult
{
/// <summary>
/// 状态码,0为正常
/// </summary>
[DataMember]
public int code { get; set; } = 0;
/// <summary>
/// 返回数据
/// </summary>
[DataMember]
public List<MissionInfo> data { get; set; }
/// <summary>
/// 提示信息
/// </summary>
[DataMember]
public string msg { get; set; } = "ok";
}
}
using System.ServiceModel;
using System.ServiceModel.Web;
using System.ServiceModel.Activation;
using System;
using System.IO;
using System.Runtime.Serialization;
using Common;
using DeviceLibrary.service.model;
using DeviceLibrary.manager;
namespace DeviceLibrary
{
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Single, IncludeExceptionDetailInFaults = true)]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
internal class WebService : IService
{
static log4net.ILog Log = log4net.LogManager.GetLogger("WebService");
public Result Create(Stream stream)
{
Result result = new Result();
StreamReader sr = new StreamReader(stream);
string s = sr.ReadToEnd();
MissionInfo createMissionInfo = JsonHelper.DeserializeJsonToObject<MissionInfo>(s);
if (createMissionInfo == null)
{
result.code = -1;
result.msg = $"解析失败:{s}";
Log.Error(result.msg);
}
else
{
MissionManager.SetMissionState(createMissionInfo.missionId, MissionState.创建, out string msg);
if (!NodeManager.CheckNode(createMissionInfo.sourcePoint))
{
result.code = -1;
result.msg = $"不存在的节点:{createMissionInfo.sourcePoint}";
Log.Error(result.msg);
}
else if(!NodeManager.CheckNodes(createMissionInfo.destinationPoint,out string nodenames))
{
result.code = -1;
result.msg = $"不存在的节点:{nodenames}";
Log.Error(result.msg);
}
else if (!MissionManager.Contains(createMissionInfo))
{
MissionManager.Add(createMissionInfo);
Log.Info($"Create mission from API:{s}");
}
else
{
result.code = -1;
result.msg = $"已存在该任务id:{createMissionInfo.missionId}";
Log.Error(result.msg);
}
}
return result;
}
public Result Update(Stream stream)
{
Result result = new Result();
StreamReader sr = new StreamReader(stream);
string s = sr.ReadToEnd();
UpdateMission updateMission = JsonHelper.DeserializeJsonToObject<UpdateMission>(s);
if (updateMission == null)
{
result.code = -1;
result.msg = $"解析失败:{s}";
Log.Error(result.msg);
}
else
{
result.code = -1;
result.msg = $"该接口未开放,请联系管理员";
Log.Error(result.msg);
}
return result;
}
public Result Delete(Stream stream)
{
Result result = new Result();
StreamReader sr = new StreamReader(stream);
string s = sr.ReadToEnd();
DeleteMission deleteMission = JsonHelper.DeserializeJsonToObject<DeleteMission>(s);
if (deleteMission == null)
{
result.code = -1;
result.msg = $"解析失败:{s}";
Log.Error(result.msg);
}
else
{
if(MissionManager.Contains(deleteMission.missionId))
{
MissionInfo missionInfo = MissionManager.GetMission(deleteMission.missionId);
if(missionInfo ==null)
{
result.code = -1;
result.msg = $"不存在该任务id:{deleteMission.missionId}";
Log.Error(result.msg);
}
else
{
if (missionInfo.State.Equals(MissionState.创建))
{
MissionManager.SetMissionState(missionInfo, MissionState.取消);
}
else
{
MissionManager.SetMissionState(missionInfo, MissionState.中止);
}
MissionManager.DeleteById(deleteMission.missionId);
}
}
else
{
result.code = -1;
result.msg = $"不存在该任务id:{deleteMission.missionId}";
Log.Error(result.msg);
}
}
return result;
}
public Result OperationFinish(Stream stream)
{
Result result = new Result();
StreamReader sr = new StreamReader(stream);
string s = sr.ReadToEnd();
ConfirmOperation operationFinish = JsonHelper.DeserializeJsonToObject<ConfirmOperation>(s);
if (operationFinish == null)
{
result.code = -1;
result.msg = $"解析失败:{s}";
Log.Error(result.msg);
}
else
{
Node node = NodeManager.GetNode(operationFinish.line);
if(node==null)
{
result.code = -1;
result.msg = $"不存在的线体名:{operationFinish.line}";
Log.Error(result.msg);
}
else
{
if(node.ExtendEquip.CanConfirm)
{
node.ExtendEquip.ApiConfirmSig=true;
Log.Info($"线体[{operationFinish.line}]被调用确认接口");
}
else
{
result.code = -1;
result.msg = $"线体[{operationFinish.line}]附近无小车,不允许调用该接口";
Log.Warn(result.msg);
}
}
}
return result;
}
public MissionResult ReadAll()
{
MissionResult missionResult = new MissionResult();
missionResult.data = MissionManager.GetMissions();
return missionResult;
}
}
public class Service
{
private WebServiceHost _serviceHost;
public bool State = false;
public void Open(string url)
{
try
{
WebService service = new WebService();
_serviceHost = new WebServiceHost(service, new Uri(url));//service, new Uri(url)
_serviceHost.Open();
State = true;
LogUtil.info("Web服务已开启");
}
catch (Exception ex)
{
State = false;
LogUtil.error("Web服务开启", ex);
}
}
public void Close()
{
try
{
if (_serviceHost != null)//判断服务是否关闭
_serviceHost.Close();//关闭服务
State = false;
LogUtil.info("Web服务已关闭");
}
catch (Exception ex)
{
LogUtil.error("Web服务关闭", ex);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static DeviceLibrary.AgvInfo;
namespace DeviceLibrary.service.model
{
/// <summary>
/// Agv状态
/// </summary>
public class AgvState
{
/// <summary>
/// 编号
/// </summary>
public string agvNum { get; set; }
/// <summary>
/// 车间
/// </summary>
public string workshop { get; set; }
/// <summary>
/// 电量
/// </summary>
public int battery { get; set; }
/// <summary>
/// 坐标位置
/// </summary>
public MirPosition position { get; set; }
/// <summary>
/// 当前状态:执行任务/归位中/充电中/故障中
/// </summary>
public string state { get; set; }
/// <summary>
/// 任务id
/// </summary>
public string missionId { get; set; }
/// <summary>
/// 备注
/// </summary>
public string remark { get; set; }
/// <summary>
/// 当前目的地
/// </summary>
public string curTarget { get; set; }
/// <summary>
/// 状态的详细信息
/// </summary>
public string statusTxt { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary.service.model
{
public class ConfirmOperation
{
/// <summary>
/// 线体名
/// </summary>
public string line { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary.service.model
{
public class DeleteMission
{
/// <summary>
/// 任务标识
/// </summary>
public string missionId { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary.service.model
{
public class DoorInfo
{
/// <summary>
/// 电梯标识
/// </summary>
public string liftId { get; set; } = "";
/// <summary>
/// 任务来源AGV系统标识
/// </summary>
public string sourceClient { get; set; } = "";
/// <summary>
/// 架子来源层
/// </summary>
public int sourceFloor { get; set; } = 0;
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary.service.model
{
/// <summary>
/// 任务信息
/// </summary>
public class MissionInfo
{
/// <summary>
/// 任务编号
/// </summary>
public string missionId { get; set; }
/// <summary>
/// 使用的电梯名称
/// </summary>
public string liftName { get; set; }
/// <summary>
/// 优先级。3最高,1最低
/// </summary>
public int Priority { get; set; } = 1;
/// <summary>
/// 是否可合并
/// </summary>
public bool canMerge { get; set; }
/// <summary>
/// 任务状态
/// </summary>
public MissionState State { get; set; }
/// <summary>
/// 取车的车间
/// </summary>
public string sourceWorkshop
{
get
{
try
{
string node = sourcePoint.Split(',')[0];
return manager.NodeManager.GetNode(node).Workshop;
}
catch { }
return "";
}
}
public int sourceFloor
{
get
{
try
{
return int.Parse(sourceWorkshop.Substring(0, 1));
}
catch
{
return -1;
}
}
}
public int destinationFloor
{
get
{
try
{
return int.Parse(destinationWorkshop.Substring(0, 1));
}
catch
{
return -1;
}
}
}
/// <summary>
/// 取车的位置
/// </summary>
public string sourcePoint { get; set; }
/// <summary>
/// 目标车间
/// </summary>
public string destinationWorkshop
{
get
{
try
{
string node = destinationPoint.Split(',')[0];
return manager.NodeManager.GetNode(node).Workshop;
}
catch { }
return "";
}
}
/// <summary>
/// 目标点位,多个点位使用逗号分割
/// </summary>
public string destinationPoint { get; set; }
/// <summary>
/// 空架子是否需要返回
/// </summary>
public bool needBack { get; set; }
/// <summary>
/// 产品类型
/// </summary>
public ProjectType projectType
{
get
{
int id = int.Parse(missionId.Substring(1, 2));
try
{
return (ProjectType)id;
}
catch
{
return ProjectType.;
}
}
}
public void SetState(MissionState missionState)
{
State = missionState;
}
public string Remark { get; set; }
public string JobName { get { return string.Format("{0}->{1} {2}任务", sourceWorkshop, destinationWorkshop, projectType.ToString()); } }
}
public enum MissionState
{
/// <summary>
/// 创建
/// </summary>
创建,
/// <summary>
/// 接料
/// </summary>
接料,
/// <summary>
/// 前往电梯
/// </summary>
前往电梯,
/// <summary>
/// 在电梯内
/// </summary>
到达电梯,
/// <summary>
/// 电梯运行
/// </summary>
电梯运行,
/// <summary>
/// 电梯运行
/// </summary>
电梯到达,
/// <summary>
/// 离开电梯
/// </summary>
离开电梯,
/// <summary>
/// 送料
/// </summary>
送料,
返回电梯,
返回到达电梯内,
返回电梯运行,
返回电梯到达,
返回离开电梯,
返回起始地,
/// <summary>
/// 暂停
/// </summary>
暂停,
/// <summary>
/// 中止:已执行,但未结束
/// </summary>
中止,
/// <summary>
/// 取消,未执行被取消
/// </summary>
取消,
/// <summary>
/// 完成
/// </summary>
完成
}
/// <summary>
/// 项目类型
/// </summary>
public enum ProjectType
{
,
PCB领用 = 1,
Tray领用 = 2,
包材领用 = 4,
半成品领用,
静电箱领用,
空台车领用,
空台车归还,
成品入库,
半成品入库,
半成品入库与领用,
垃圾清运
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary.service.model
{
/// <summary>
/// 架子进入电梯请求信息
/// </summary>
public class SendInInfo
{
/// <summary>
/// 电梯标识
/// </summary>
public string liftId { get; set; }
/// <summary>
/// 任务来源AGV系统标识
/// </summary>
public string sourceClient { get; set; }
/// <summary>
/// 架子来源层
/// </summary>
public int sourceFloor { get; set; }
/// <summary>
/// 架子来源点位
/// </summary>
public string sourcePoint { get; set; }
/// <summary>
/// 任务目的地AGV系统标识
/// </summary>
public string destinationClient { get; set; }
/// <summary>
/// 目的楼层
/// </summary>
public int destinationFloor { get; set; }
/// <summary>
/// 目的地点位
/// </summary>
public string destinationPoint { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary.service.model
{
/// <summary>
/// 运输状态,上报给its
/// </summary>
public class TransportStatus
{
/// <summary>
/// 任务编号
/// </summary>
public string missionId { get; set; }
/// <summary>
/// 类型:状态报告/异常报告
/// </summary>
public string type { get; set; }
/// <summary>
/// AGV编号
/// </summary>
public string agvNum { get; set; }
/// <summary>
/// 报告位置:对应运输任务中的位置
/// </summary>
public string curPlace { get; set; }
/// <summary>
/// 报告方式:自动/AGV按钮
/// </summary>
public string mode { get; set; }
/// <summary>
/// 报告消息
/// </summary>
public string msg { get; set; }
/// <summary>
/// 消息类型
/// </summary>
public int msgCode { get; set; }
/// <summary>
/// 运输状态
/// </summary>
/// <param name="missionId">任务id</param>
/// <param name="type">状态类型</param>
/// <param name="agvnum">agv编号</param>
/// <param name="curplace">位置</param>
/// <param name="mode">方式</param>
/// <param name="msg">报告消息</param>
/// <param name="msgCode">消息类型</param>
public TransportStatus(string missionId,string type,string agvnum,string curplace,string mode,string msg,int msgCode=0)
{
this.missionId = missionId;
this.type = type;
this.agvNum = agvnum;
this.curPlace = curplace;
this.mode = mode;
this.msg = msg;
this.msgCode = msgCode;
}
public class TypeStr
{
public const string status = "status";
public const string error = "error";
}
public class ModeStr
{
public const string auto = "auto";
public const string agvButton = "agvButton";
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary.service.model
{
public class UpdateMission
{
/// <summary>
/// 任务标识
/// </summary>
public string missionId { get; set; }
/// <summary>
/// 优先级。3最高,1最低
/// </summary>
public int Priority { get; set; }
/// <summary>
/// 状态,只接收Pause/Canceled
/// </summary>
public string State { get; set; }
}
}
文件属性发生变化
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!