Commit 0c83f472 张东亮

init

0 个父辈
正在显示 127 个修改的文件 包含 12468 行增加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>{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("宋体", 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;
}
}
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 DoorDToC = "DoorDToC";
public const string DoorCToD = "DoorCToD";
public const string DoorAirIn = "DoorAirIn";
public const string DoorAirOut = "DoorAirOut";
public const string AutoCharge = "AutoCharge";
public const string Leave = "Leave";
public const string Enter = "Enter";
public const string Init = "Init";
//任务状态
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 = "Warehouse";
public const string C4_STANDBY1 = "C4_STANDBY1";
public const string C4_STANDBY2 = "C4_STANDBY2";
public const string ChargeThreshold = "ChargeThreshold";
#region 配置名
public const string ITS = "ITS";
public const string httpServer ="http.server";
public const string FLEET = "FLEET";
public const string log4net_configname = "log4net_configname";
#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("AGV_3D_Line");
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; //端口
private Thread tPingClient; //ping
/// <summary>
/// 节点改变事件
/// </summary>
/// <param name="nodeIndex"></param>
public delegate void NodeChangedEvent(Node node);
/// <summary>
/// 节点改变
/// </summary>
public event NodeChangedEvent NodeChanged;
/// <summary>
/// 节点在线
/// </summary>
public event NodeChangedEvent NodeOnline;
/// <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();
tPingClient = new Thread(new ThreadStart(KeepLiveClient));
tPingClient.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);
}
}
private void KeepLiveClient()
{
int n;
while (_loop)
{
n = 0;
while (n < 5000) //所有产线间隔
{
Thread.Sleep(50);
n += 50;
if (!_loop) return;
}
for (int i = 0; i < NodeManager.nodeInfo.Count; i++)
{
try
{
if (!_loop)
break;
Thread.Sleep(1000);
Node node = NodeManager.nodeInfo[i];
if (!string.IsNullOrEmpty(node.IP))
{
node.Online = CheckIP(node.Name, node.IP);
}
else
{
node.Online = true;
}
NodeOnline?.Invoke(node);
}
catch (Exception e)
{
log.Error("PingClient", e);
}
}
}
}
public 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.Debug(name + " Ping " + ip + " 请求没有响应");
return false;
}
return true;
}
catch (Exception ex)
{
log.Error("CheckIP", ex);
return false;
}
}
/// <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);
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 UpdateNode(Node node)
{
int idx = NodeManager.nodeInfo.FindIndex(s => s.Name == node.Name);
if (idx == -1)
{
log.Error("UpdateNode " + node.Name + " 不存在");
return;
}
if (!node.Online)
{
node.Online = true;
NodeOnline?.Invoke(node);
}
if (!node.StateEquals(node.GetState()) ||
node.RFID != node.RFID || node.ClientLevel != node.ClientLevel)
{
node.UpdateNodeStatus(node.GetState());
node.ClientLevel = node.ClientLevel;
node.RFID = node.RFID;
log.Info("节点更新 " + node.StatetText());
NodeChanged?.Invoke(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();
NodeChanged(node);
NodeOnline(node);
}
client.nodeName.Clear();
//_client.Remove(client);
}
/// <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
文件属性发生变化
<?xml version="1.0" encoding="utf-8" ?>
<agvs>
<agv id="12" ip="10.85.199.81">
<name>10号车</name>
<!--负责区域:D,C,Air_C-->
<ResponsAreas>
<Area>D</Area>
</ResponsAreas>
<!--是否调用-->
<IsUse>false</IsUse>
<UseFleet>true</UseFleet>
<Authorization>Basic ZGlzdHJpYnV0b3I6NjJmMmYwZjFlZmYxMGQzMTUyYzk1ZjZmMDU5NjU3NmU0ODJiYjhlNDQ4MDY0MzNmNGNmOTI5NzkyODM0YjAxNA==</Authorization>
<IO_GUID>007615a5-2220-11ea-99f2-94c691a73b53</IO_GUID>
</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>
<!--固定充电桩-->
<fixed>true</fixed>
<!--固定充电桩为true,取第一个;false则判断所有agv.填写AGV编号-->
<agvs>
<agv>12</agv>
</agvs>
</pile>
</piles>
</root>
<?xml version="1.0" encoding="utf-8" ?>
<nodes>
<node id ="0">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>Standby</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>待机位</alicename>
<!--节点类型:Standby,AutoCharge,Node-->
<type>Standby</type>
<!--所属区域:D,C,Air_C-->
<Area>D</Area>
</node>
<node id ="1">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>AutoCharge1</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>充电位1</alicename>
<!--节点类型:Standby,AutoCharge,Node-->
<type>AutoCharge</type>
<!--所属区域:D,C,Air_C-->
<Area>D</Area>
</node>
<node id ="2">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D1</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D1线</alicename>
<!--节点类型:Standby,AutoCharge,Node-->
<type>Node</type>
<!--所属区域:D,C,Air_C-->
<Area>D</Area>
</node>
<node id ="3">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D2</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D2线</alicename>
<!--节点类型:Standby,AutoCharge,Node-->
<type>Node</type>
<!--所属区域:D,C,Air_C-->
<Area>D</Area>
</node>
<node id ="4">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D3</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D3线</alicename>
<!--节点类型:Standby,AutoCharge,Node-->
<type>Node</type>
<!--所属区域:D,C,Air_C-->
<Area>D</Area>
</node>
<node id ="5">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D4</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D4线</alicename>
<!--节点类型:Standby,AutoCharge,Node-->
<type>Node</type>
<!--所属区域:D,C,Air_C-->
<Area>D</Area>
</node>
<node id ="6">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D5</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D5线</alicename>
<!--节点类型:Standby,AutoCharge,Node-->
<type>Node</type>
<!--所属区域:D,C,Air_C-->
<Area>D</Area>
</node>
<node id ="7">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D6</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D6线</alicename>
<!--节点类型:Standby,AutoCharge,Node-->
<type>Node</type>
<!--所属区域:D,C,Air_C-->
<Area>D</Area>
</node>
<node id ="8">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D7</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D7线</alicename>
<!--节点类型:Standby,AutoCharge,Node-->
<type>Node</type>
<!--所属区域:D,C,Air_C-->
<Area>D</Area>
</node>
<node id ="9">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D8</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D8线</alicename>
<!--节点类型:Standby,AutoCharge,Node-->
<type>Node</type>
<!--所属区域:D,C,Air_C-->
<Area>D</Area>
</node>
<node id ="10">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D9</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D9线</alicename>
<!--节点类型:Standby,AutoCharge,Node-->
<type>Node</type>
<!--所属区域:D,C,Air_C-->
<Area>D</Area>
</node>
<node id ="11">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D10</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D10线</alicename>
<!--节点类型:Standby,AutoCharge,Node-->
<type>Node</type>
<!--所属区域:D,C,Air_C-->
<Area>D</Area>
</node>
<node id ="12">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D11</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D11线</alicename>
<!--节点类型:Standby,AutoCharge,Node-->
<type>Node</type>
<!--所属区域:D,C,Air_C-->
<Area>D</Area>
</node>
<node id ="13">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D12</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D12线</alicename>
<!--节点类型:Standby,AutoCharge,Node-->
<type>Node</type>
<!--所属区域:D,C,Air_C-->
<Area>D</Area>
</node>
<node id ="14">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D13</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D13线</alicename>
<!--节点类型:Standby,AutoCharge,Node-->
<type>Node</type>
<!--所属区域:D,C,Air_C-->
<Area>D</Area>
</node>
<node id ="15">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D14</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D14线</alicename>
<!--节点类型:Standby,AutoCharge,Node-->
<type>Node</type>
<!--所属区域:D,C,Air_C-->
<Area>D</Area>
</node>
<node id ="16">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D15</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D15线</alicename>
<!--节点类型:Standby,AutoCharge,Node-->
<type>Node</type>
<!--所属区域:D,C,Air_C-->
<Area>D</Area>
</node>
<node id ="17">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>D16</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>D16线</alicename>
<!--节点类型:Standby,AutoCharge,Node-->
<type>Node</type>
<!--所属区域:D,C,Air_C-->
<Area>D</Area>
</node>
<node id ="18">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>T01</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>T1线</alicename>
<!--节点类型:Standby,AutoCharge,Node-->
<type>Node</type>
<!--所属区域:D,C,Air_C-->
<Area>D</Area>
</node>
<node id ="19">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>T02</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>T2线</alicename>
<!--节点类型:Standby,AutoCharge,Node-->
<type>Node</type>
<!--所属区域:D,C,Air_C-->
<Area>D</Area>
</node>
<node id ="20">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>T03</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>T3线</alicename>
<!--节点类型:Standby,AutoCharge,Node-->
<type>Node</type>
<!--所属区域:D,C,Air_C-->
<Area>D</Area>
</node>
<node id ="21">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>T04</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>T4线</alicename>
<!--节点类型:Standby,AutoCharge,Node-->
<type>Node</type>
<!--所属区域:D,C,Air_C-->
<Area>D</Area>
</node>
<node id ="22">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>T05</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>T5线</alicename>
<!--节点类型:Standby,AutoCharge,Node-->
<type>Node</type>
<!--所属区域:D,C,Air_C-->
<Area>D</Area>
</node>
<node id ="23">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>T06</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>T6线</alicename>
<!--节点类型:Standby,AutoCharge,Node-->
<type>Node</type>
<!--所属区域:D,C,Air_C-->
<Area>D</Area>
</node>
<node id ="24">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>T07</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>T7线</alicename>
<!--节点类型:Standby,AutoCharge,Node-->
<type>Node</type>
<!--所属区域:D,C,Air_C-->
<Area>D</Area>
</node>
<node id ="25">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>T08</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>T8线</alicename>
<!--节点类型:Standby,AutoCharge,Node-->
<type>Node</type>
<!--所属区域:D,C,Air_C-->
<Area>D</Area>
</node>
<node id ="26">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>T09</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>T9线</alicename>
<!--节点类型:Standby,AutoCharge,Node-->
<type>Node</type>
<!--所属区域:D,C,Air_C-->
<Area>D</Area>
</node>
<node id ="27">
<!--节点IP,不需要通讯的设为空-->
<ip></ip>
<!--名称-->
<name>Warehouse</name>
<!--是否调用-->
<IsUse>true</IsUse>
<!--别名-->
<alicename>立库</alicename>
<!--节点类型:Standby,AutoCharge,Node-->
<type>Node</type>
<!--所属区域:D,C,Air_C-->
<Area>D</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>219cd91a-61da-11eb-96a9-0001297a1dca</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>None</type>
</task>
<task id ="1">
<name>Standby</name>
<alicename>待机位</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>None</type>
</task>
<task id ="2">
<name>AutoCharge</name>
<alicename>充电位</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>None</type>
</task>
<task id ="3">
<name>Enter</name>
<alicename>进料</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>InOut</type>
</task>
<task id ="4">
<name>Leave</name>
<alicename>出料</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>InOut</type>
</task>
<task id ="5">
<name>CheckShelf</name>
<alicename>负载检查</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>None</type>
</task>
<task id ="6">
<name>D1</name>
<alicename>移动到D1线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="7">
<name>D2</name>
<alicename>移动到D2线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="8">
<name>D3</name>
<alicename>移动到D3线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="9">
<name>D4</name>
<alicename>移动到D4线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="10">
<name>D5</name>
<alicename>移动到D5线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="11">
<name>D6</name>
<alicename>移动到D6线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="12">
<name>D7</name>
<alicename>移动到D7线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="13">
<name>D8</name>
<alicename>移动到D8线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="14">
<name>D9</name>
<alicename>移动到D9线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="15">
<name>D10</name>
<alicename>移动到D10线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="16">
<name>D11</name>
<alicename>移动到D11线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="17">
<name>D12</name>
<alicename>移动到D12线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="18">
<name>D13</name>
<alicename>移动到D13线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="19">
<name>D14</name>
<alicename>移动到D14线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="20">
<name>D15</name>
<alicename>移动到D15线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="21">
<name>D1</name>
<alicename>移动到D16线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="22">
<name>T01</name>
<alicename>移动到T1线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="23">
<name>T02</name>
<alicename>移动到T2线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="24">
<name>T03</name>
<alicename>移动到T3线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="25">
<name>T04</name>
<alicename>移动到T4线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="26">
<name>T05</name>
<alicename>移动到T5线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="27">
<name>T06</name>
<alicename>移动到T6线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="28">
<name>T07</name>
<alicename>移动到T7线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="29">
<name>T08</name>
<alicename>移动到T8线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</guid>
<!--任务类型:None,Move,Dock,InOut-->
<type>Move</type>
</task>
<task id ="30">
<name>T09</name>
<alicename>移动到T9线</alicename>
<guid>615cef05-61f4-11eb-96a9-0001297a1dca</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 = 300,
AutoReset = true,
Enabled = false
};
AgvCallTimer.Elapsed += AgvCallTimer_Elapsed;
AgvStateTimer = new System.Timers.Timer
{
Interval = 3000,
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;
MiR_API.Get_Task_State(AGVManager.agvInfo[i]);
Thread.Sleep(50);
//获取AGV状态
rtn = MiR_API.Get_State(AGVManager.agvInfo[i], out eAGVState stateID, out string stateText, out int battery, out string mission_text, out Agv_Info.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);
}
}
AgvStateInProcess = false;
}
/// <summary>
/// 从节点获取任务
/// </summary>
/// <param name="agv_Info"></param>
/// <returns></returns>
public Job GetJob(Agv_Info agv_Info)
{
foreach (JobType jobType in AGVManager.jobTypes)
{
Job job = null;
if (agv_Info.IsUse)
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
{
Agv_Info agv = AGVManager.agvInfo[i];
if (!agv.IsCon) continue; //AGV网络连接
if (!AGVManager.agvInfo[i].IsUse) continue; //AGV是否可用
//Ready,Pause,Executing,Error
if (!AGVManager.agvInfo[i].StateID.Equals(eAGVState.Ready) && !AGVManager.agvInfo[i].StateID.Equals(eAGVState.Pause)
&& !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">
<HintPath>.\log4net.dll</HintPath>
</Reference>
<Reference Include="RestSharp">
<HintPath>.\RestSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<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" />
</ItemGroup>
<ItemGroup>
<Compile Include="bean\Agv_Info.cs" />
<Compile Include="bean\ChargePiles.cs" />
<Compile Include="bean\job\ChargeJob.cs" />
<Compile Include="bean\job\EmptyAGVBackJob.cs" />
<Compile Include="bean\job\EmptyShelfBackJob.cs" />
<Compile Include="bean\job\GoEmptyShelfLineJob.cs" />
<Compile Include="bean\job\GoFullShelfStationJob.cs" />
<Compile Include="bean\JobParam.cs" />
<Compile Include="bean\TaskRunState.cs" />
<Compile Include="bean\job\jobType\JobForFixture.cs" />
<Compile Include="bean\job\SendFullShelfToLineJob.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="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\job\jobType\JobType.cs" />
<Compile Include="bean\job\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="manager\XmlConfigOpManager.cs" />
<Compile Include="manager\AgvTaskManager.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="service\FixMissionInfo.cs" />
<Compile Include="manager\FixMissionManager.cs" />
<Compile Include="bean\Shelf.cs" />
<Compile Include="service\FixtureService.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>
<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.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.manager;
namespace DeviceLibrary
{
public class Agv_Info
{
/// <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>
public string IOID { set; get; }
/// <summary>
/// 授权码
/// </summary>
public string Authorization { set; get; }
/// <summary>
/// 责任区域
/// </summary>
public List<Area> ResponsAreas { 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 IsUse
{
set
{
if (!value.Equals(_IsUse))
{
_IsUse = value;
XmlConfigOpManager.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; }
/// <summary>
/// 任务运行状态
/// </summary>
public TaskRunState TaskRunState;
/// <summary>
/// 错误消息
/// </summary>
public string ErrorMsg { get; set; } = "";
public string ErrorLastTime { get; set; } = "";
public bool[] Input;
public bool[] Output;
/// <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)
{
Agv_Info agv = obj as Agv_Info;
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 Agv_Info(string id, string name, string ip, string authorization, string ioID, bool isUse)
{
ID = id;
Name = name;
IP = ip;
Authorization = authorization;
IOID = ioID;
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 Agv_Info()
{
Place = new Node();
Msg = "";
Position = new MirPosition();
RunInfos = new List<string>() { "状态", "目的地", "RFID", "负载", "运行模式", "任务信息", "AGV运行信息" };
StateKanban = new AGV_UI.Status(RunInfos);
TaskRunState = new TaskRunState();
}
public List<string> RunInfos;
DateTime IoStartTime = DateTime.MaxValue;
int IoLastTime = 5000;
int StandLastTimeMinute = 5;
public DateTime StandStartTime = DateTime.MaxValue;
public bool SetState(eAGVState stateID, int battery, string missionText, MirPosition position)
{
bool isChange = false;
bool preShelfState = IsExistShelf;
MiR_API.Get_IO_Status(this, out Input, out Output);
if (Input != null && Input.Length == 4)
{
bool reachIoValue = Input[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("运行模式", IsUse ? "自动" : "手动");
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>
/// 检查小车是否在原地停留超时
/// </summary>
/// <returns></returns>
private void CheckStandTimeOut(MirPosition position)
{
if (IsUse && CurJob != null && (!this.Place.Type.Equals(NodeType.AutoCharge) || !this.Place.Type.Equals(NodeType.Standby)))
{
if (Math.Abs(position.Point.X - Position.Point.X) < 1 && Math.Abs(position.Point.Y - Position.Point.Y) < 1)
{
//满足条件,计算持续时间
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 (!Msg.Equals(""))
{
msglist.Add(new AlarmMsg(Name, "lineAgv." + Name + ".Msg", Msg, 1));
}
else
{
if ((Place.Type.Equals(NodeType.Standby) || Place.Type.Equals(NodeType.AutoCharge)))
{
msglist.Add(new AlarmMsg(Name, "lineAgv." + Name + ".Place", Place.Type.ToString(), 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);
}
}
}
}
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(Agv_Info agv)
{
return chargePiles.FindAll(s => s.Agvs.Contains(agv.ID));
}
public ChargePile GetChargePileByAgv(Agv_Info 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; } = "";
/// <summary>
/// 是否是固定充电桩
/// </summary>
public bool Fixed { get; set; } = false;
/// <summary>
/// 是否占用
/// </summary>
public bool Occupied { get; set; } = false;
/// <summary>
/// 占用充电桩的AGV
/// </summary>
public Agv_Info 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(Agv_Info agv)
{
if (Fixed)
{
if (agv.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(Agv_Info agv)
{
Occupied = true;
OccupiedAgv = agv;
return this;
}
/// <summary>
/// 清除充电桩的占用
/// </summary>
public void DelOccupy(Agv_Info 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; }
/// <summary>
/// 任务信息
/// </summary>
public manager.MissionInfo FixMissionInfo { get; set; }
/// <summary>
/// 目标地点
/// </summary>
public Node TargetNode { 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)
{
SrcNode = srcplace;
TargetNode = tarplace;
Shelf = shelf;
}
}
/// <summary>
/// 节点所属区域
/// </summary>
public enum Area
{
D,
C,
Air
}
/// <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="timeOutMilliseconds"></param>
/// <returns></returns>
public bool IsTimeOut(int timeOutMilliseconds,out TimeSpan timeOutValue)
{
TimeSpan span = DateTime.Now - startTime;
timeOutValue = span;
if (span.TotalMilliseconds > timeOutMilliseconds)
{
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.Agv_Info;
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(Agv_Info 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 bool Get_IO_Status(Agv_Info info, out bool[] input, out bool[] output)
{
try
{
input = null;
output = null;
string url = "http://" + info.IP + "/api/v2.0.0/io_modules/" + info.IOID + "/status";
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;
}
object[] objInput = (object[])dic["input_state"];
input = new bool[objInput.Length];
for (int i = 0; i < input.Length; i++)
input[i] = Convert.ToBoolean(objInput[i]);
object[] objOutput = (object[])dic["output_state"];
output = new bool[objOutput.Length];
for (int i = 0; i < output.Length; i++)
output[i] = Convert.ToBoolean(objOutput[i]);
return true;
}
catch (Exception ex)
{
input = null;
output = null;
//log.Error("Get_IO_Status", ex);
return false;
}
}
/// <summary>
/// 获取PLC寄存器的内容
/// </summary>
/// <param name="info"></param>
/// <param name="reg"></param>
/// <param name="regValue"></param>
/// <returns></returns>
public static bool Get_Register(Agv_Info 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(Agv_Info 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(Agv_Info info)
{
try
{
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 + "\"}";
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)
{
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);
log.Debug(string.Format("{0} Add_Mission [{1}]", info.Name, info.TaskRunState.Task.Name));
return true;
}
else
return false;
}
catch (Exception ex)
{
log.Error("Add_Mission", ex);
return false;
}
}
/// <summary>
/// 添加任务到任务队列
/// </summary>
/// <param name="info"></param>
/// <param name="mission_id"></param>
/// <returns></returns>
public static bool Add_Mission_Fleet(Agv_Info info)
{
try
{
info.TaskRunState.ResetInfo();
//防止上一个任务已执行但返回失败时,删除任务
Del_Mission(info);
string ip = AppConfigHelper.GetValue(SettingString.FLEET);
string url = "http://" + ip + "/api/v2.0.0/mission_scheduler";
string body = "{\"mission_id\":\"" + info.TaskRunState.Task.Guid + "\",\"robot_id\":" + info.ID + "}";
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)
{
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);
log.Debug(string.Format("{0} Add_Mission_Fleet [{1}]", info.Name, info.TaskRunState.Task.Name));
return true;
}
else
return false;
}
catch (Exception ex)
{
log.Error("Add_Mission_Fleet", ex);
return false;
}
}
/// <summary>
/// 获取所有任务列表
/// </summary>
/// <param name="info"></param>
/// <param name="mission">任务(名称,guid)</param>
/// <returns></returns>
public static bool Get_Mission(Agv_Info 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 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;
}
}
/// <summary>
/// 获取当前任务队列guid
/// </summary>
/// <param name="info"></param>
/// <param name="mission"></param>
/// <returns></returns>
public static bool Get_Mission_Queue(Agv_Info 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(Agv_Info 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(Agv_Info agv)
{
try
{
string ip = AppConfigHelper.GetValue(SettingString.FLEET);
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(Agv_Info agv)
{
try
{
if (agv.TaskRunState.TaskID == -1)
return true;
if (agv.UseFleet)
{
string ip = AppConfigHelper.GetValue(SettingString.FLEET);
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(Agv_Info 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(Agv_Info 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(Agv_Info 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(Agv_Info 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.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("HttpPost URL: {0}; Body: {1} Return: {2}", url, body, s));
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.Windows.Forms;
using DeviceLibrary.manager;
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 Area Area { get; set; }
/// <summary>
/// 节点IP
/// </summary>
public string IP { get; set; }
/// <summary>
/// 在线状态
/// </summary>
public bool Online { get; set; }
/// <summary>
/// 是否可调用
/// </summary>
public bool IsUse
{
set
{
if (!isuse.Equals(value))
{
isuse = value;
XmlConfigOpManager.SetNodeIsUse(this);
}
}
get { return isuse; }
}
private bool isuse;
/// <summary>
/// 节点状态
/// </summary>
public NodeStatus nodeStatus { get; set; }
protected string rfid = "00";
/// <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; } = "";
public Node() { }
public Node(int id, string name, string ip, NodeType nodeType, Area area, bool isUse = false)
{
Id = id;
Name = name;
IP = ip;
Online = false;
IsUse = isUse;
Type = nodeType;
Area = area;
nodeStatus = NodeStatus.None;
}
public Node(string name)
{
Name = name;
}
/// <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="ip"></param>
/// <param name="isUse"></param>
public Node(int id, string name, string ip, string aliceName, NodeType nodeType, Area area, bool isUse)
{
Id = id;
Name = name;
IP = ip;
Type = nodeType;
Area = area;
IsUse = isUse;
AliceName = aliceName;
Online = false;
}
/// <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;
}
/// <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 string[] ToRow()
{
//节点,IP,动作,RFID,AGV名称,在线,调用,清除AGV
List<string> vs = new List<string>();
vs.Add(AliceName);
vs.Add(IP);
vs.Add(nodeStatus.ToString());
vs.Add(ClientLevel.ToString());
vs.Add(RFID);
vs.Add(Online ? "在线" : "离线");
vs.Add(IsUse ? "是" : "否");
return vs.ToArray();
}
/// <summary>
/// 脱机
/// </summary>
public void Offline()
{
RFID = "00";
nodeStatus = NodeStatus.None;
Online = false;
}
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 string ToString()
{
return $" {AliceName}[{Area}] ";
}
}
/// <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 Area
{
D,
C,
Air_C,
}
public enum NodeType
{
AutoCharge,
Standby,
Node
}
}
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 通用步骤
/// <summary>
/// 等待出风淋门
/// </summary>
WAIT_OUT_AIR_DOOR,
/// <summary>
/// 等待到达4C风淋门内
/// </summary>
WAIT_IN_AIR_DOOR,
/// <summary>
/// 等待从4C->4D
/// </summary>
WAIT_IN_ROOM_D,
/// <summary>
/// 等待到达4C门
/// </summary>
WAIT_IN_ROOM_C,
#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 空料架回收返回任务
/// <summary>
/// 等待小车到达回收处
/// </summary>
RECY_BACK_WAIT_REACH_RECY_ST,
/// <summary>
/// 等待回收处响应
/// </summary>
RECY_BACK_WAIT_RECY_ST_RESPONSE,
/// <summary>
/// 等待料架进入回收站
/// </summary>
RECY_BACK_WAIT_SHELF_IN_RECY_ST,
/// <summary>
/// 回收处暂时不需要,等待AGV到达待机位
/// </summary>
RECY_BACK_WAIT_REACH_STANDBY,
#endregion
#region 空聊加回收前往任务
/// <summary>
/// 给AGV分配任务
/// </summary>
RECY_TO_ASSIGN_AGV_TASK,
/// <summary>
/// 等待AGV开始执行去取架点任务
/// </summary>
RECY_TO_BACK_WAIT_AGV_START_TASK,
/// <summary>
/// 等待AGV到达取架点
/// </summary>
RECY_TO_WAIT_REACH_PLACE,
/// <summary>
/// 等待AGV到达临时停车位
/// </summary>
RECY_TO_WAIT_REACH_TEMP_PLACE,
RECY_TO_WAIT_Manual_Operation,
/// <summary>
/// 等待产线回应
/// </summary>
RECY_TO_WAIT_LINE_RESPONSE,
/// <summary>
/// 等待料架进入小车
/// </summary>
RECY_TO_WAIT_TAKE_EMPTY_SHELF,
#endregion
#region 送满料到线体
/// <summary>
/// 等待agv到达4C临时待机位
/// </summary>
SF_WAIT_REACH_TEMP_PLACE,
/// <summary>
/// 等待小车到达目的地
/// </summary>
SF_WAIT_AGV_REACH_LINE,
/// <summary>
/// 等待人员操作
/// </summary>
SF_WAIT_Manual_Operation,
/// <summary>
/// 等待AGV载大料架返回双层线
/// </summary>
SF_WAIT_SHELF_BACK_SMD,
/// <summary>
/// 等待AGV到达停车位
/// </summary>
SF_WAIT_SHELF_BACK_STANDYBY,
/// <summary>
/// 等待产线回应
/// </summary>
SF_WAIT_LINE_RESPONSE,
/// <summary>
/// 等待料架进入产线
/// </summary>
SF_WAIT__SHELF_IN_LINE,
#endregion
#region 去云仓接满料
/// <summary>
/// 负载检查结果
/// </summary>
WAIT_CHECK_RESULT,
/// <summary>
/// 等待到达4C风淋门
/// </summary>
WAIT_AGV_REACH_AIR_DOOR,
/// <summary>
/// 等待AGV到达门
/// </summary>
WAIT_AGV_REACH_DOOR,
/// <summary>
/// 等待到达A6
/// </summary>
WAIT_AGV_REACH_A6,
/// <summary>
/// 等待双层线回应
/// </summary>
WAIT_DOUBLE_LINE_RESPONSE,
/// <summary>
/// 等待料架进入小车
/// </summary>
WAIT__FULL_SHELF_IN_AGV,
/// <summary>
/// 等待AGV到达待机位
/// </summary>
WAIT_REACH_STANDBY,
#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++)
{
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 int TaskID { get; set; } = -1;
/// <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))
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 ToTaskState()
{
return $"[{Task.AliceName}] [{TaskID}] [{TaskState}]";
}
}
}
文件属性发生变化
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(Agv_Info agv)
{
if (JobRunStep.IsStep(RunStep.NONE))
{
{
if (JobParam.SrcNode.Area.Equals(Area.Air_C))
{
JobRunStep.ToNextStep(RunStep.WAIT_OUT_AIR_DOOR);
runInfo = string.Format("电量{0}%小于最大电量{1}%,从{2}回到充电位,先过风淋门", agv.Battery, BatteryMax, JobParam.SrcNode);
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.DoorAirOut);
}
else if (JobParam.SrcNode.Area.Equals(Area.C))
{
JobRunStep.ToNextStep(RunStep.WAIT_IN_ROOM_D);
runInfo = string.Format("电量{0}%小于最大电量{1}%,从{2}回到充电位,先过门", agv.Battery, BatteryMax, JobParam.SrcNode.Name);
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.DoorCToD);
}
else
{
if (!ChargePileManager.HasEmpty(agv,out string chargename))
{
runInfo = "充电桩有小车,从" + JobParam.SrcNode + "回到待机位";
JobRunStep.Msg = runInfo;
return new StandyJob(new JobParam(JobParam.TargetNode.ToCopy(),manager.NodeManager.GetNodeByType(NodeType.Standby)));
}
else
{
JobRunStep.ToNextStep(RunStep.CHARGE_WAIT_REACH_CHARGE);
runInfo = "电量" + agv.Battery + "%小于最大电量" + BatteryMax + "%,从" + JobParam.SrcNode + "去充电位";
JobRunStep.Msg = runInfo;
AllocateTask(agv, chargename);
ChargePileManager.StartCharge(agv, chargename);
}
}
}
}
else if (JobRunStep.IsStep(RunStep.WAIT_OUT_AIR_DOOR))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.WAIT_IN_ROOM_D);
runInfo = string.Format("从{1}回到充电位,先过门", agv.Battery, JobParam.SrcNode);
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.DoorCToD);
}
}
else if (JobRunStep.IsStep(RunStep.WAIT_IN_ROOM_D))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
if (!ChargePileManager.HasEmpty(agv, out string chargename))
{
runInfo = "充电桩有小车,从" + JobParam.SrcNode + "回到待机位";
JobRunStep.Msg = runInfo;
JobRunStep.EndJob();
return new StandyJob(new JobParam(JobParam.TargetNode.ToCopy(),manager.NodeManager.GetNodeByType(NodeType.Standby)));
}
else
{
JobRunStep.ToNextStep(RunStep.CHARGE_WAIT_REACH_CHARGE);
runInfo = "电量" + agv.Battery + "%小于最大电量" + BatteryMax + "%,从" + JobParam.SrcNode + "回到充电位";
JobRunStep.Msg = runInfo;
AllocateTask(agv, chargename);
ChargePileManager.StartCharge(agv,chargename);
}
}
}
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.TargetNode.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(Agv_Info agv)
{
if (ChargePileManager.CheckIsRandom(agv))
{
return true;
}
else
{
return false;
}
}
}
}

using Common;
using DeviceLibrary.bean;
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.PeerResolvers;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DeviceLibrary
{
/// <summary>
/// 空车返回任务
/// </summary>
public class EmptyAGVBackJob : Job
{
/// <summary>
/// 空车返回任务
/// </summary>
public EmptyAGVBackJob(JobParam jobParam):base(jobParam)
{
JobName = "返回任务";
}
/// <summary>
/// 空车返回执行
/// </summary>
/// <param name="agv"></param>
public override Job Run(Agv_Info agv)
{
StartJobTime = JobRunStep.startTime;
if (JobRunStep.IsStep(RunStep.NONE))
{
{
JobRunStep.ToNextStep(RunStep.END);
}
}
else if(JobRunStep.IsStep(RunStep.END))
{
JobRunStep.EndJob();
return new ChargeJob(new JobParam(JobParam.SrcNode.ToCopy()));
}
return this;
}
}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.ModelBinding;
using System.Windows.Forms;
using Common;
using DeviceLibrary.bean;
using DeviceLibrary.manager;
namespace DeviceLibrary
{
/// <summary>
/// 料架回收任务
/// </summary>
public class EmptyShelfBackJob : Job
{
/// <summary>
/// 料架回收任务
/// </summary>
public EmptyShelfBackJob(JobParam jobParam) : base(jobParam)
{
JobName = "料架回收返回任务";
}
private int tryTimes = 0;
/// <summary>
/// 料架回收任务
/// </summary>
/// <param name="agv"></param>
public override Job Run(Agv_Info agv)
{
if (JobRunStep.IsStep(RunStep.NONE))
{
if (JobParam.SrcNode.Area.Equals(Area.Air_C))//C车间风淋门
{
JobRunStep.ToNextStep(RunStep.WAIT_OUT_AIR_DOOR);
runInfo = string.Format("从{0}去风淋门", JobParam.SrcNode);
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.DoorAirOut);
}
else if (JobParam.SrcNode.Area.Equals(Area.C))//C车间
{
JobRunStep.ToNextStep(RunStep.WAIT_IN_ROOM_D);
runInfo = string.Format("从{0}过门", JobParam.SrcNode);
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.DoorCToD);
}
else
{
JobRunStep.ToNextStep(RunStep.RECY_BACK_WAIT_REACH_RECY_ST);
runInfo = string.Format("从{0}去{1}", JobParam.SrcNode, JobParam.TargetNode);
JobRunStep.Msg = runInfo;
AllocateTask(agv, JobParam.TargetNode.Name);
}
}
else if (JobRunStep.IsStep(RunStep.WAIT_OUT_AIR_DOOR))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.WAIT_IN_ROOM_D);
runInfo = string.Format("出风淋门,准备过门");
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.DoorCToD);
}
}
else if (JobRunStep.IsStep(RunStep.WAIT_IN_ROOM_D))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.RECY_BACK_WAIT_REACH_RECY_ST);
runInfo = string.Format("进门,送往{0}", JobParam.TargetNode);
JobRunStep.Msg = runInfo;
AllocateTask(agv, JobParam.TargetNode.Name);
}
}
else if (JobRunStep.IsStep(RunStep.RECY_BACK_WAIT_REACH_STANDBY))
{
}
else if (JobRunStep.IsStep(RunStep.RECY_BACK_WAIT_REACH_RECY_ST))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.RECY_BACK_WAIT_RECY_ST_RESPONSE);
runInfo = "AGV到达 " + JobParam.TargetNode + ",并发送入料架请求";
JobRunStep.Msg = runInfo;
OpManager.ServerToClient.ReadyEnter(JobParam.TargetNode.Name, JobParam.Shelf == null ? "" : JobParam.Shelf.RFID);
}
}
else if (JobRunStep.IsStep(RunStep.RECY_BACK_WAIT_RECY_ST_RESPONSE))
{
Node node = NodeManager.GetNodeByName(JobParam.TargetNode.Name);
if (node.StateEquals(NodeStatus.MayEnter))
{
{
JobRunStep.ToNextStep(RunStep.RECY_BACK_WAIT_SHELF_IN_RECY_ST);
runInfo = "收到入料架请求的响应 " + JobParam.TargetNode + "入料架,小车链条运行";
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.Leave);
}
}
else if (JobRunStep.IsTimeOut(15000, out TimeSpan timeOutValue))
{
tryTimes++;
if (tryTimes < 3)
return this;
tryTimes = 0;
JobRunStep.ToNextStep(RunStep.RECY_BACK_WAIT_REACH_RECY_ST);
runInfo = JobParam.TargetNode + "无响应,再次发送请求";
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.Standby);
}
}
else if (JobRunStep.IsStep(RunStep.RECY_BACK_WAIT_SHELF_IN_RECY_ST))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.END);
runInfo = $"料架{(JobParam.Shelf == null ? "" : JobParam.Shelf.RFID)}进入{JobParam.TargetNode}完成";
JobRunStep.Msg = runInfo;
}
else if (JobRunStep.IsTimeOut(60000, out TimeSpan timeOutValue1))
{
runInfo = "空料架在[" + JobParam.TargetNode + "]离开小车超时";
agv.HasError = true;
agv.SetErrorMsg("空料架在[" + JobParam.TargetNode + "]进入小车超时", timeOutValue1.TotalMinutes.ToString("f2"));
}
}
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>
/// 去空料架任务点
/// </summary>
public class GoEmptyShelfLineJob : Job
{
/// <summary>
/// 去空料架任务点
/// </summary>
public GoEmptyShelfLineJob(JobParam jobParam) : base(jobParam)
{
JobName = "料架回收任务";
}
/// <summary>
/// 料架回收任务
/// </summary>
/// <param name="agv"></param>
public override Job Run(Agv_Info agv)
{
Node node = NodeManager.GetNodeByName(JobParam.TargetNode.Name);
if (JobRunStep.IsStep(RunStep.NONE))
{
if (JobParam.SrcNode.Area.Equals(Area.Air_C) && !JobParam.TargetNode.Area.Equals(Area.Air_C))//4C风淋门内->风淋门外
{
JobRunStep.ToNextStep(RunStep.WAIT_OUT_AIR_DOOR);
runInfo = "去" + JobParam.TargetNode + ",先过风淋门";
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.DoorAirOut);
}
else if (!JobParam.SrcNode.Area.Equals(Area.Air_C) && JobParam.TargetNode.Area.Equals(Area.Air_C))//4C风淋门外->风淋门内
{
if (JobParam.SrcNode.Area.Equals(Area.C) && !JobParam.TargetNode.Area.Equals(Area.C))//4C->4C
{
if (AGVManager.CheckRoomCTarget(agv, JobParam.TargetNode.Name))//被占用
{
JobRunStep.ToNextStep(RunStep.RECY_TO_WAIT_REACH_TEMP_PLACE);
runInfo = "目的地" + JobParam.TargetNode + "有小车占用,先到临时待机位";
JobRunStep.Msg = runInfo;
AGVManager.MoveToRoomCStandy(agv);
}
else
{
JobRunStep.ToNextStep(RunStep.WAIT_IN_AIR_DOOR);
runInfo = "去" + JobParam.TargetNode + ",先过风淋门";
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.DoorAirIn);
}
}
else if ((JobParam.SrcNode.Area.Equals(Area.D)) && (JobParam.TargetNode.Area.Equals(Area.C)))//4D->4C
{
JobRunStep.ToNextStep(RunStep.WAIT_IN_ROOM_C);
runInfo = "去" + JobParam.TargetNode + ",先过门";
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.DoorDToC);
}
}
else//起始与目的地在风淋门同一侧
{
if (JobParam.SrcNode.Area.Equals(Area.Air_C) && JobParam.TargetNode.Equals(Area.Air_C))//都在风淋门内
{
if (AGVManager.CheckRoomCTarget(agv, JobParam.TargetNode.Name))//被占用
{
JobRunStep.ToNextStep(RunStep.WAIT_OUT_AIR_DOOR);
runInfo = "目的地" + JobParam.TargetNode + "有小车占用,先过风淋门,再到临时待机位";
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.DoorAirOut);
}
else
{
JobRunStep.ToNextStep(RunStep.RECY_TO_ASSIGN_AGV_TASK);
runInfo = "开始回收任务";
JobRunStep.Msg = runInfo;
}
}
else if (!JobParam.SrcNode.Area.Equals(Area.Air_C) && !JobParam.TargetNode.Area.Equals(Area.Air_C))//都在风淋门外
{
if (JobParam.SrcNode.Area.Equals(Area.C) && JobParam.TargetNode.Area.Equals(Area.C))//4C->4C
{
if (AGVManager.CheckRoomCTarget(agv, JobParam.TargetNode.Name))//被占用
{
JobRunStep.ToNextStep(RunStep.RECY_TO_WAIT_REACH_TEMP_PLACE);
runInfo = "目的地" + JobParam.TargetNode + "有小车占用,先到临时待机位";
JobRunStep.Msg = runInfo;
AGVManager.MoveToRoomCStandy(agv);
}
else
{
JobRunStep.ToNextStep(RunStep.RECY_TO_ASSIGN_AGV_TASK);
runInfo = "开始回收任务";
JobRunStep.Msg = runInfo;
}
}
else if (JobParam.SrcNode.Area.Equals(Area.C) && JobParam.TargetNode.Area.Equals(Area.D))//4C->4D
{
JobRunStep.ToNextStep(RunStep.WAIT_IN_ROOM_D);
runInfo = "去" + JobParam.TargetNode + ",先过门";
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.DoorCToD);
}
else if (JobParam.SrcNode.Area.Equals(Area.D) && JobParam.TargetNode.Area.Equals(Area.C))//4D->4C
{
JobRunStep.ToNextStep(RunStep.WAIT_IN_ROOM_C);
runInfo = "去产线" + JobParam.TargetNode + ",先过门";
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.DoorDToC);
}
else//4D->4D
{
JobRunStep.ToNextStep(RunStep.RECY_TO_ASSIGN_AGV_TASK);
runInfo = "开始回收任务";
JobRunStep.Msg = runInfo;
}
}
}
}
else if (JobRunStep.IsStep(RunStep.WAIT_OUT_AIR_DOOR))
{
if (agv.TaskRunState.CheckTaskFinished())
{
//4C风淋门内->风淋门外,到达风淋门外
if (JobParam.SrcNode.Area.Equals(Area.C) && JobParam.TargetNode.Area.Equals(Area.C))//4C->4C
{
if (AGVManager.CheckRoomCTarget(agv, JobParam.TargetNode.Name))//被占用
{
JobRunStep.ToNextStep(RunStep.RECY_TO_WAIT_REACH_TEMP_PLACE);
runInfo = "到风淋门外,目的地" + JobParam.TargetNode + "有小车占用,先到临时待机位";
JobRunStep.Msg = runInfo;
AGVManager.MoveToRoomCStandy(agv);
}
else
{
JobRunStep.ToNextStep(RunStep.RECY_TO_ASSIGN_AGV_TASK);
runInfo = "到风淋门外,开始回收任务";
JobRunStep.Msg = runInfo;
}
}
else if (JobParam.SrcNode.Area.Equals(Area.C) && JobParam.TargetNode.Area.Equals(Area.D))//4C->4D
{
JobRunStep.ToNextStep(RunStep.WAIT_IN_ROOM_D);
runInfo = "到风淋门外,去" + JobParam.TargetNode + ",先过门";
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.DoorCToD);
}
//都在风淋门内,到达风淋门外
else
{
JobRunStep.ToNextStep(RunStep.RECY_TO_WAIT_REACH_TEMP_PLACE);
runInfo = "到风淋门外,目的地" + JobParam.TargetNode + "有小车占用,先到临时待机位";
JobRunStep.Msg = runInfo;
AGVManager.MoveToRoomCStandy(agv);
}
}
}
else if (JobRunStep.IsStep(RunStep.WAIT_IN_AIR_DOOR))
{
if (agv.TaskRunState.CheckTaskFinished())
{
//4C风淋门外->风淋门内
JobRunStep.ToNextStep(RunStep.RECY_TO_ASSIGN_AGV_TASK);
runInfo = "到达风淋门内,开始回收任务";
JobRunStep.Msg = runInfo;
}
}
else if (JobRunStep.IsStep(RunStep.WAIT_IN_ROOM_C))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
if (AGVManager.CheckRoomCTarget(agv, JobParam.TargetNode.Name))//被占用
{
JobRunStep.ToNextStep(RunStep.RECY_TO_WAIT_REACH_TEMP_PLACE);
runInfo = "目的地" + JobParam.TargetNode + "有小车占用,先到临时待机位";
JobRunStep.Msg = runInfo;
AGVManager.MoveToRoomCStandy(agv);
}
else
{
if (JobParam.TargetNode.Area.Equals(Area.Air_C))
{
JobRunStep.ToNextStep(RunStep.WAIT_IN_AIR_DOOR);
runInfo = "去" + JobParam.TargetNode + ",先过风淋门";
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.DoorAirIn);
}
else
{
JobRunStep.ToNextStep(RunStep.RECY_TO_ASSIGN_AGV_TASK);
runInfo = "开始回收任务";
JobRunStep.Msg = runInfo;
}
}
}
}
else if (JobRunStep.IsStep(RunStep.RECY_TO_WAIT_REACH_TEMP_PLACE))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
if (!AGVManager.CheckRoomCTarget(agv, JobParam.TargetNode.Name))//未占用
{
JobRunStep.ToNextStep(RunStep.RECY_TO_ASSIGN_AGV_TASK);
runInfo = "开始回收任务";
JobRunStep.Msg = runInfo;
//AGVManager.DeleteStandyInfo(agv);
}
}
}
else if (JobRunStep.IsStep(RunStep.WAIT_IN_ROOM_D))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.RECY_TO_ASSIGN_AGV_TASK);
runInfo = "开始回收任务";
JobRunStep.Msg = runInfo;
}
}
else if (JobRunStep.IsStep(RunStep.RECY_TO_ASSIGN_AGV_TASK))
{
if (node != null)
{
JobRunStep.ToNextStep(RunStep.RECY_TO_BACK_WAIT_AGV_START_TASK);
runInfo = "移动到" + JobParam.TargetNode;
JobRunStep.Msg = runInfo;
AllocateTask(agv,JobParam.TargetNode.Name);
}
else
{
runInfo = JobParam.TargetNode + " 不存在或未开启调用";
JobRunStep.Msg = runInfo;
}
}
else if (JobRunStep.IsStep(RunStep.RECY_TO_BACK_WAIT_AGV_START_TASK))
{
if (agv.TaskRunState.CheckAllocateOk())
{
JobRunStep.ToNextStep(RunStep.RECY_TO_WAIT_REACH_PLACE);
}
}
else if (JobRunStep.IsStep(RunStep.RECY_TO_WAIT_REACH_PLACE))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
if (JobParam.OpType.Equals(OpType.ComToLine))
{
JobRunStep.ToNextStep(RunStep.RECY_TO_WAIT_LINE_RESPONSE);
runInfo = "到达 " + JobParam.TargetNode + " 向线体发送出料架请求";
JobRunStep.Msg = runInfo;
if (node == null)
{
runInfo = JobParam.TargetNode + " 未开启调用";
JobRunStep.Msg = runInfo;
return this;
}
OpManager.ServerToClient.ReadyLeave(JobParam.TargetNode.Name, JobParam.Shelf == null ? "" : JobParam.Shelf.RFID);
}
else
{
JobRunStep.ToNextStep(RunStep.RECY_TO_WAIT_Manual_Operation);
runInfo = "到达" + JobParam.TargetNode + ",并等待人员操作";
JobRunStep.Msg = runInfo;
}
}
}
else if (JobRunStep.IsStep(RunStep.RECY_TO_WAIT_Manual_Operation))
{
if (JobParam.OpType.Equals(OpType.Mannual))
{
if (agv.Input != null && agv.Input.Length == 4)
{
if (agv.Input[0].Equals(true))
{
runInfo = "人员在" + JobParam.TargetNode + "操作完成";
JobRunStep.Msg = runInfo;
JobRunStep.EndJob();
return new EmptyShelfBackJob(new JobParam(JobParam.TargetNode, null, JobParam.Shelf.ToCopy()));
}
}
}
else if (JobParam.OpType.Equals(OpType.RequestAPI))
{
if (OpManager.Info.GetUnlock(JobParam.Shelf.RFID))
{
runInfo = "人员在" + JobParam.TargetNode + "操作完成";
JobRunStep.Msg = runInfo;
JobRunStep.EndJob();
return new EmptyShelfBackJob(new JobParam(JobParam.TargetNode, null, JobParam.Shelf.ToCopy()));
}
}
else if (JobParam.OpType.Equals(OpType.MaulAndAPI))
{
if (agv.Input != null && agv.Input.Length == 4)
{
if (agv.Input[0].Equals(true) || OpManager.Info.GetUnlock(JobParam.Shelf.RFID))
{
runInfo = "人员在" + JobParam.TargetNode + "操作完成";
JobRunStep.Msg = runInfo;
JobRunStep.EndJob();
return new EmptyShelfBackJob(new JobParam(JobParam.TargetNode, null, JobParam.Shelf.ToCopy()));
}
}
}
}
else if (JobRunStep.IsStep(RunStep.RECY_TO_WAIT_LINE_RESPONSE))
{
if (node == null)
{
runInfo = JobParam.TargetNode + " 未开启调用";
JobRunStep.Msg = runInfo;
return this;
}
if (node.StateEquals(NodeStatus.MayLeave))
{
agv.HasError = false;
JobRunStep.ToNextStep(RunStep.RECY_TO_WAIT_TAKE_EMPTY_SHELF);
runInfo = "收到线体对出料请求的响应," + JobParam.TargetNode + "出料架";
JobRunStep.Msg = runInfo;
AllocateTask(agv,SettingString.Enter);
}
else if (JobRunStep.IsTimeOut(15000, out TimeSpan timeOutValue))
{
agv.HasError = true;
agv.SetErrorMsg($"线体{JobParam.TargetNode}对出料请求无响应", timeOutValue.TotalMinutes.ToString("f2"));
}
}
else if (JobRunStep.IsStep(RunStep.RECY_TO_WAIT_TAKE_EMPTY_SHELF))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
agv.HasError = false;
JobRunStep.EndJob();
return new EmptyShelfBackJob(new JobParam(JobParam.TargetNode.ToCopy()));
}
else if (JobRunStep.IsTimeOut(60000, out TimeSpan timeOutValue))
{
//链条停止
runInfo = "空料架在[" + JobParam.TargetNode + "]进入小车超时";
agv.HasError = true;
agv.SetErrorMsg("空料架在[" + JobParam.TargetNode + "]进入小车超时", timeOutValue.TotalMinutes.ToString("f2"));
}
}
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>
/// 去云仓接满料
/// </summary>
public class GoFullShelfStationJob : Job
{
/// <summary>
/// 去云仓接满料
/// </summary>
public GoFullShelfStationJob(JobParam jobParam) : base(jobParam)
{
JobName = "接满料任务";
}
bool IsLoadOnAGV = false;
public override Job Run(Agv_Info agv)
{
if (JobRunStep.IsStep(RunStep.NONE))
{
JobRunStep.ToNextStep(RunStep.WAIT_CHECK_RESULT);
runInfo = "检查AGV负载情况";
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.CheckShelf);
}
else if (JobRunStep.IsStep(RunStep.WAIT_CHECK_RESULT))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
if (agv.IsExistShelf)
{
JobRunStep.ToNextStep(RunStep.END);
runInfo = "车上有料架,无法接送满料任务";
JobRunStep.Msg = runInfo;
IsLoadOnAGV = true;
}
else if (!agv.IsExistShelf)
{
if (JobParam.SrcNode.Area.Equals(Area.D))
{
JobRunStep.ToNextStep(RunStep.WAIT_AGV_REACH_A6);
runInfo = $"车上无负载,准备去{JobParam.TargetNode.Name}接料";
JobRunStep.Msg = runInfo;
AllocateTask(agv, JobParam.TargetNode.Name);
}
else if (JobParam.SrcNode.Area.Equals(Area.Air_C))
{
JobRunStep.ToNextStep(RunStep.WAIT_AGV_REACH_AIR_DOOR);
runInfo = "去接料,先过风淋门";
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.DoorAirOut);
}
else if (JobParam.SrcNode.Area.Equals(Area.C))//4C车间
{
JobRunStep.ToNextStep(RunStep.WAIT_AGV_REACH_DOOR);
runInfo = "先过门,再接料";
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.DoorCToD);
}
else
{
JobRunStep.ToNextStep(RunStep.WAIT_AGV_REACH_A6);
runInfo = $"车上无负载,准备去{JobParam.TargetNode.Name}接料";
JobRunStep.Msg = runInfo;
AllocateTask(agv, JobParam.TargetNode.Name);
}
}
}
}
else if (JobRunStep.IsStep(RunStep.WAIT_AGV_REACH_AIR_DOOR))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.WAIT_AGV_REACH_DOOR);
runInfo = $"去{JobParam.TargetNode.Name},先过门";
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.DoorCToD);
}
}
else if (JobRunStep.IsStep(RunStep.WAIT_AGV_REACH_DOOR))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.WAIT_AGV_REACH_A6);
runInfo = $"去{JobParam.TargetNode.Name}接料";
JobRunStep.Msg = runInfo;
AllocateTask(agv, JobParam.TargetNode.Name);
}
}
else if (JobRunStep.IsStep(RunStep.WAIT_AGV_REACH_A6))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.WAIT_DOUBLE_LINE_RESPONSE);
runInfo = "到达 " + JobParam.TargetNode.Name + ",并发送出料架请求";
JobRunStep.Msg = runInfo;
OpManager.ServerToClient.ReadyLeave(JobParam.TargetNode.Name, JobParam.Shelf == null ? "" : JobParam.Shelf.RFID);
}
}
else if (JobRunStep.IsStep(RunStep.WAIT_DOUBLE_LINE_RESPONSE))
{
Node node = NodeManager.GetNodeByName(JobParam.TargetNode.Name);
if (node == null)
{
runInfo = "未找到节点:" + JobParam.TargetNode.Name;
JobRunStep.Msg = runInfo;
return this;
}
if (node.StateEquals(NodeStatus.MayLeave))
{
agv.HasError = false;
JobRunStep.ToNextStep(RunStep.WAIT__FULL_SHELF_IN_AGV);
runInfo = "收到出料架请求的响应," + JobParam.TargetNode.Name + "出料架";
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.Enter);
}
else if (JobRunStep.IsTimeOut(15000, out TimeSpan timeOutValue))
{
//JobRunStep.ToNextStep(RunStep.WAIT_AGV_REACH_A6);
agv.HasError = true;
agv.SetErrorMsg($"{JobParam.TargetNode.Name}回复出料请求超时", timeOutValue.TotalMinutes.ToString("f2"));
}
}
else if (JobRunStep.IsStep(RunStep.WAIT__FULL_SHELF_IN_AGV))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
agv.HasError = false;
//GoFullShelfStationStep.ToNextStep(RunStep.END);
runInfo = JobParam.TargetNode.Name + "料架进入小车完成";
JobRunStep.Msg = runInfo;
JobRunStep.EndJob();
return new SendFullShelfToLineJob(new JobParam(JobParam.TargetNode.ToCopy()));
}
else if (JobRunStep.IsTimeOut(60000, out TimeSpan timeOutValue))
{
//链条停止
runInfo = "满料架在[" + JobParam.TargetNode.Name + "]进入小车超时";
//msg +=runInfo;
//GoFullShelfStationStep.Msg = msg;
agv.HasError = true;
agv.SetErrorMsg("满料架在[" + JobParam.TargetNode.Name + "]进入小车超时", timeOutValue.TotalMinutes.ToString("f2"));
}
}
else if(JobRunStep.IsStep(RunStep.END))
{
JobRunStep.EndJob();
return null;
}
return this;
}
}
}
using Common;
using DeviceLibrary.bean;
using System;
namespace DeviceLibrary
{
public abstract class Job
{
public Job(JobParam jobParam) { JobParam = jobParam; }
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}:{runInfo}"; } }
/// <summary>
/// agv任务状态信息
/// </summary>
public string TaskStateInfo = "";
public string runInfo = "";
/// <summary>
/// 根据任务状态继续执行任务
/// </summary>
public Job Execute(Agv_Info agv)
{
SetRunInfo(agv);
return Run(agv);
}
public abstract Job Run(Agv_Info agv);
/// <summary>
/// 设置相关运行信息
/// </summary>
/// <param name="agv"></param>
public void SetRunInfo(Agv_Info agv)
{
JobRunStep.StepRunInfo.SetInfo(agv.Name.PadLeft(4, '0'), JobName, agv.Place.AliceName, JobRunStep.CurStep(), runInfo, StartJobTime, DateTime.Now);
TaskStateInfo = agv.TaskRunState.ToTaskInfo();
StartJobTime = JobRunStep.startTime;
}
/// <summary>
/// Job开始时间
/// </summary>
public DateTime StartJobTime { get; set; } = DateTime.Now;
/// <summary>
/// Job名称
/// </summary>
public string JobName { get; set; } = "";
protected void AllocateTask(Agv_Info agv, string taskName)
{
Task = AgvTaskManager.GetTaskByName(taskName);
AgvTaskManager.AssignMission(agv, taskName);
}
/// <summary>
/// 任务重发
/// </summary>
/// <returns></returns>
public bool ResendTask(Agv_Info 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.bean;
using DeviceLibrary.manager;
using System;
namespace DeviceLibrary
{
/// <summary>
/// 从云仓向线体运送料任务
/// </summary>
public class SendFullShelfToLineJob : Job
{
/// <summary>
/// 从云仓向线体运送料任务
/// </summary>
public SendFullShelfToLineJob(JobParam jobParam) : base(jobParam)
{
JobName = "送满料任务";
jobParam.OpType = OpType.Mannual;
}
public override Job Run(Agv_Info agv)
{
if (JobRunStep.IsStep(RunStep.NONE))
{
OpManager.ClientToSMDServer.RemoveRfidBufInfo(JobParam.Shelf.RFID);
if (JobParam.TargetNode.Area.Equals(Area.C) || JobParam.TargetNode.Area.Equals(Area.Air_C))
{
JobRunStep.ToNextStep(RunStep.WAIT_IN_ROOM_C);
runInfo = string.Format("前往{0},先过门", JobParam.TargetNode);
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.DoorDToC);
}
else
{
JobRunStep.ToNextStep(RunStep.SF_WAIT_AGV_REACH_LINE);
runInfo = string.Format("前往{0},先过门", JobParam.TargetNode);
JobRunStep.Msg = runInfo;
AllocateTask(agv, JobParam.TargetNode.Name);
}
}
else if (JobRunStep.IsStep(RunStep.WAIT_IN_ROOM_C))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
if (AGVManager.CheckRoomCTarget(agv, JobParam.TargetNode.Name))//被占用
{
JobRunStep.ToNextStep(RunStep.SF_WAIT_REACH_TEMP_PLACE);
runInfo = "目的地" + JobParam.TargetNode + "有小车占用,先到临时待机位";
JobRunStep.Msg = runInfo;
AGVManager.MoveToRoomCStandy(agv);
}
else
{
if (JobParam.TargetNode.Area.Equals(Area.Air_C))
{
JobRunStep.ToNextStep(RunStep.WAIT_IN_AIR_DOOR);
runInfo = "过风淋门,去" + JobParam.TargetNode;
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.DoorAirIn);
}
else
{
JobRunStep.ToNextStep(RunStep.SF_WAIT_AGV_REACH_LINE);
runInfo = "送往" + JobParam.TargetNode;
JobRunStep.Msg = runInfo;
AllocateTask(agv, JobParam.TargetNode.Name);
}
}
}
}
else if (JobRunStep.IsStep(RunStep.WAIT_IN_AIR_DOOR))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.SF_WAIT_AGV_REACH_LINE);
runInfo = "送往" + JobParam.TargetNode;
JobRunStep.Msg = runInfo;
AllocateTask(agv, JobParam.TargetNode.Name);
}
}
else if (JobRunStep.IsStep(RunStep.SF_WAIT_REACH_TEMP_PLACE))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
if (!AGVManager.CheckRoomCTarget(agv, JobParam.TargetNode.Name))//未占用
{
if (JobParam.TargetNode.Area.Equals(Area.Air_C))
{
JobRunStep.ToNextStep(RunStep.WAIT_IN_AIR_DOOR);
runInfo = "到临时待机位,先过风淋门,去" + JobParam.TargetNode;
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.DoorAirIn);
}
else
{
JobRunStep.ToNextStep(RunStep.SF_WAIT_AGV_REACH_LINE);
runInfo = "从临时待机位送往" + JobParam.TargetNode;
JobRunStep.Msg = runInfo;
AllocateTask(agv, JobParam.TargetNode.Name);
}
}
}
}
else if (JobRunStep.IsStep(RunStep.SF_WAIT_AGV_REACH_LINE))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
if (JobParam.OpType.Equals(OpType.ComToLine))
{
JobRunStep.ToNextStep(RunStep.SF_WAIT_LINE_RESPONSE);
runInfo = "到达" + JobParam.TargetNode + ",并发送入料架请求";
JobRunStep.Msg = runInfo;
OpManager.ServerToClient.ReadyEnter(JobParam.TargetNode.Name, JobParam.Shelf == null ? "" : JobParam.Shelf.RFID);
}
else
{
JobRunStep.ToNextStep(RunStep.SF_WAIT_Manual_Operation);
runInfo = "到达" + JobParam.TargetNode + ",并等待人员操作";
JobRunStep.Msg = runInfo;
}
}
}
else if (JobRunStep.IsStep(RunStep.SF_WAIT_Manual_Operation))
{
if (JobParam.OpType.Equals(OpType.Mannual))
{
if (agv.Input != null && agv.Input.Length == 4)
{
if (agv.Input[0].Equals(true))
{
runInfo = "人员在" + JobParam.TargetNode + "操作完成";
JobRunStep.Msg = runInfo;
JobRunStep.EndJob();
return new EmptyShelfBackJob(new JobParam(JobParam.TargetNode, null, JobParam.Shelf.ToCopy()));
}
}
}
else if (JobParam.OpType.Equals(OpType.RequestAPI))
{
if (OpManager.Info.GetUnlock(JobParam.Shelf.RFID))
{
runInfo = "人员在" + JobParam.TargetNode + "操作完成";
JobRunStep.Msg = runInfo;
JobRunStep.EndJob();
return new EmptyShelfBackJob(new JobParam(JobParam.TargetNode, null, JobParam.Shelf.ToCopy()));
}
}
else if (JobParam.OpType.Equals(OpType.MaulAndAPI))
{
if (agv.Input != null && agv.Input.Length == 4)
{
if (agv.Input[0].Equals(true) || OpManager.Info.GetUnlock(JobParam.Shelf.RFID))
{
runInfo = "人员在" + JobParam.TargetNode + "操作完成";
JobRunStep.Msg = runInfo;
JobRunStep.EndJob();
return new EmptyShelfBackJob(new JobParam(JobParam.TargetNode, null, JobParam.Shelf.ToCopy()));
}
}
}
}
else if (JobRunStep.IsStep(RunStep.SF_WAIT_LINE_RESPONSE))
{
Node node = NodeManager.GetNodeByName(JobParam.TargetNode.Name);
System.Threading.Thread.Sleep(50);
if (node.StateEquals(NodeStatus.MayEnter))
{
JobRunStep.ToNextStep(RunStep.SF_WAIT__SHELF_IN_LINE);
runInfo = "收到入料架请求的响应" + JobParam.TargetNode + "入料架";
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.Leave);
}
else if (JobRunStep.IsTimeOut(15000, out TimeSpan timeOutValue))
{
JobRunStep.ToNextStep(RunStep.SF_WAIT_AGV_REACH_LINE);
runInfo = "到达" + JobParam.TargetNode + ",15秒后重新向线体发送入料架请求";
JobRunStep.Msg = runInfo;
agv.HasError = true;
agv.SetErrorMsg("到达 " + JobParam.TargetNode + ",向线体发送入料架请求异常", timeOutValue.TotalMinutes.ToString("f2"));
}
}
else if (JobRunStep.IsStep(RunStep.SF_WAIT__SHELF_IN_LINE))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
agv.HasError = false;
runInfo = "料架进入" + JobParam.TargetNode + "完成";
JobRunStep.Msg = runInfo;
OpManager.Info.UpdateShelfStatus(JobParam.Shelf == null ? "" : JobParam.Shelf.RFID, JobParam.TargetNode.Name);
JobRunStep.EndJob();
return new EmptyAGVBackJob(new JobParam(JobParam.TargetNode.ToCopy()));
}
else if (JobRunStep.IsTimeOut(60000, out TimeSpan timeOutValue))
{
//链条停止
runInfo = "料架在" + JobParam.TargetNode + "离开小车超时";
//msg += string.Format("[{0}] {1}", jobStep.CurStep(),runInfo);
//SendFullShelfStep.Msg = msg;
agv.HasError = true;
agv.SetErrorMsg("满料架在" + JobParam.TargetNode + "离开小车超时", timeOutValue.TotalMinutes.ToString("f2"));
}
}
else if (JobRunStep.IsStep(RunStep.END))
{
}
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(Agv_Info agv)
{
if (JobRunStep.IsStep(RunStep.NONE))
{
{
if (JobParam.SrcNode.Area.Equals(Area.Air_C))
{
JobRunStep.ToNextStep(RunStep.WAIT_OUT_AIR_DOOR);
runInfo = string.Format("电量{0}%小于最大电量{1}%,从{2}回到待机位,先过风淋门", agv.Battery, BatteryMax, JobParam.SrcNode.Name);
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.DoorAirOut);
}
else if (JobParam.SrcNode.Area.Equals(Area.C))
{
JobRunStep.ToNextStep(RunStep.WAIT_IN_ROOM_D);
runInfo = string.Format("电量{0}%小于最大电量{1}%,从{2}回到待机位,先过门", agv.Battery, BatteryMax, JobParam.SrcNode.Name);
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.DoorCToD);
}
else
{
JobRunStep.ToNextStep(RunStep.STANDBY_WAIT_REACH_STANDBY);
runInfo = "从" + JobParam.SrcNode + "回到待机位";
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.Standby);
}
}
}
else if (JobRunStep.IsStep(RunStep.WAIT_OUT_AIR_DOOR))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
JobRunStep.ToNextStep(RunStep.WAIT_IN_ROOM_D);
runInfo = string.Format("从{1}回到待机位,先过门", agv.Battery, JobParam.SrcNode.Name);
JobRunStep.Msg = runInfo;
AllocateTask(agv, SettingString.DoorCToD);
}
}
else if (JobRunStep.IsStep(RunStep.WAIT_IN_ROOM_D))
{
if (agv.TaskRunState.CheckTaskFinished(agv.Name))
{
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 null;
runInfo = "在待机位检测到任务,执行任务";
JobRunStep.Msg = runInfo;
JobRunStep.EndJob();
return job;
}
}
return this;
}
}
}

namespace DeviceLibrary
{
/// <summary>
/// 充电任务
/// </summary>
public class ChargeJobType : JobType
{
/// <summary>
/// 充电任务
/// </summary>
/// <param name="currentAgv"></param>
/// <returns></returns>
public override Job GetNewJob(Agv_Info agv)
{
if (agv.Battery < ChargePileManager.GetChargePiles().BatteryMax && ChargePileManager.HasEmpty(agv,out string chargename))
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 System.Collections.Generic;
using System.Linq;
using DeviceLibrary.manager;
using DeviceLibrary.bean;
using DeviceLibrary.manager;
namespace DeviceLibrary
{
/// <summary>
/// 呼叫任务
/// </summary>
public class JobForFixture : JobType
{
/// <summary>
/// 产线呼叫任务
/// </summary>
/// <param name="currentAgv"></param>
/// <returns></returns>
public override Job GetNewJob(Agv_Info agv)
{
//if (!agv.IsIdle())
// return null;
if(FixMissionManager.HasNext())
{
MissionInfo fixMissionInfo= manager.FixMissionManager.ExecuteMission();
JobParam jobParam = new JobParam(agv.Place);
jobParam.FixMissionInfo = fixMissionInfo;
jobParam.SrcNode = agv.Place;
jobParam.TargetNode = NodeManager.GetNodeByName(fixMissionInfo.Name);
if (fixMissionInfo.MissionType.Equals(MissionType.Line))
{
jobParam.OpType = OpType.Mannual;
return new GoEmptyShelfLineJob(jobParam);
}
else if(fixMissionInfo.MissionType.Equals(MissionType.Warehouse))
{
return new GoFullShelfStationJob(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(Agv_Info agv)
{
return null;
}
}
}
此文件类型无法预览
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 System.Windows.Forms;
using Common;
using DeviceLibrary.manager;
using static DeviceLibrary.Agv_Info;
namespace DeviceLibrary
{
public static class AGVManager
{
static log4net.ILog log = log4net.LogManager.GetLogger("AGVManager");
/// <summary>
/// 小车信息
/// </summary>
public static List<Agv_Info> 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()
{
//Standby = new StandbyManager();
jobTypes = new List<JobType>();
jobTypes.Add(new JobForFixture());
jobTypes.Add(new ChargeJobType());
InitAgv();
//任务加载
AgvTaskManager.InitAgvTask();
}
public static void InitAgv()
{
agvInfo = new List<Agv_Info>();
XmlConfigOpManager.LoadAgvInfos(agvInfo);
}
/// <summary>
/// 检查4C目的地是否被占用
/// </summary>
/// <param name="agv"></param>
/// <returns></returns>
internal static bool CheckRoomCTarget(Agv_Info agv, string nodeName)
{
return false;
}
/// <summary>
/// 去C车间待机位
/// </summary>
/// <param name="agv"></param>
internal static void MoveToRoomCStandy(Agv_Info agv)
{
throw new NotImplementedException();
}
}
public class RunInfo
{
/// <summary>
/// AGV编号
/// </summary>
public string AGVNum { 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 = "";
/// <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(Agv_Info 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.XmlConfigOpManager.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;
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(Agv_Info agv, string taskname)
{
bool rtn = false;
AgvTask task = GetTaskByName(taskname);
if (task !=null)
{
agv.TaskRunState.Task = task;
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.ToTaskInfo());
if (!rtn)
agv.TaskRunState.EnWaitTaskQueue(task);
}
return rtn;
}
/// <summary>
/// 删除任务
/// </summary>
/// <returns></returns>
public static void DelMission(Agv_Info 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.XmlConfigOpManager.LoadChargePileInfos(ChargePiles);
CheckPileDulp();
}
/// <summary>
/// 检查是否存在一台agv占用多个充电桩
/// </summary>
public static void CheckPileDulp()
{
List<ChargePile> cps;
foreach (Agv_Info 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(Agv_Info agv, out string chargename)
{
chargename = "";
lock (loc)
{
List<ChargePile> cps = ChargePiles.GetChargePilesByAgv(agv);
{
foreach (ChargePile item in cps)
{
if (item.HasEmpty(agv))
{
chargename = item.Name;
return true;
}
}
}
}
return false;
}
public static void StartCharge(Agv_Info agv, string chargename)
{
ChargePiles.GetChargePileByName(chargename).Occupy(agv);
agv.IsInCharge = true;
}
public static void StopCharge(Agv_Info agv)
{
List<ChargePile> cps = ChargePiles.GetChargePilesByAgv(agv);
foreach (ChargePile item in cps)
{
if(agv.Equals(item.OccupiedAgv))
{
item.DelOccupy(agv);
return;
}
}
}
public static bool CheckIsRandom(Agv_Info agv)
{
bool isRandom = true;
ChargePile cp = ChargePiles.GetChargePileByAgv(agv);
if(cp !=null)
{
isRandom = !cp.Fixed;
}
return isRandom;
}
}
}
using Common;
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;
namespace DeviceLibrary.manager
{
public class FixMissionManager
{
public delegate void MissionChangedEventHandler();
public static event MissionChangedEventHandler MissionChangedEvent;
static List<MissionInfo> fixMissionInfos = new List<MissionInfo>();
static WebService web = new WebService();
static object lockObj = new object();
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"));
fixMissionInfos = JsonHelper.DeserializeJsonToList<MissionInfo>(txt);
}
static void WriteMission()
{
string path = AGVManager.CONFIG_PATH + SettingString.FileName_Missions;
string txt = JsonHelper.SerializeObject(fixMissionInfos);
try
{
System.IO.File.WriteAllText(path, txt);
}
catch (Exception e)
{
LogUtil.error("任务保存失败", 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 = fixMissionInfos.ToList<MissionInfo>();
dataGridView.DataSource = bindingSource;
}
public static void UpdateDataSource(DataGridView dataGridView)
{
BindingSource bindingSource = new BindingSource();
bindingSource.DataSource = fixMissionInfos.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 HasNext()
{
if (fixMissionInfos.Count > 0)
return true;
return false;
}
public static bool Contains(MissionInfo fixMissionInfo)
{
int id = fixMissionInfos.FindIndex(s => s.Equals(fixMissionInfo));
if (id > -1)
return true;
return false;
}
public static List<MissionInfo> GetMissions()
{
return fixMissionInfos;
}
public static void Add(MissionInfo fixMission)
{
try
{
if (Monitor.TryEnter(lockObj,1000))
{
fixMissionInfos.Add(fixMission);
}
}
catch(Exception e)
{
LogUtil.error("操作 fixMissionInfos 超时");
}
finally
{
Monitor.Exit(lockObj);
}
WriteMission();
MissionChangedEvent?.Invoke();
}
public static MissionInfo ExecuteMission()
{
MissionInfo missionInfo=null;
try
{
if (Monitor.TryEnter(lockObj, 1000))
{
missionInfo = fixMissionInfos[0];
fixMissionInfos.RemoveAt(0);
}
}
catch (Exception e)
{
LogUtil.error("操作 fixMissionInfos 超时");
}
finally
{
Monitor.Exit(lockObj);
}
WriteMission();
MissionChangedEvent?.Invoke();
return missionInfo;
}
public static void SetMissionState(int id)
{
fixMissionInfos[id].On = !fixMissionInfos[id].On;
if (!fixMissionInfos[id].On)
{
LogUtil.info("取消呼叫任务:" + fixMissionInfos[id].ToString());
try
{
if (Monitor.TryEnter(lockObj, 1000))
{
fixMissionInfos.RemoveAt(id);
}
}
catch (Exception e)
{
LogUtil.error("操作 fixMissionInfos 超时");
}
finally
{
Monitor.Exit(lockObj);
}
}
WriteMission();
MissionChangedEvent?.Invoke();
}
}
}
using Common;
using RestSharp;
using System;
using System.Collections.Generic;
using System.Drawing;
namespace DeviceLibrary
{
public class HttpManager
{
private static log4net.ILog log = log4net.LogManager.GetLogger("HttpManager");
private static string Addr_CurSO = "/rest/api/qisda/device/currentOutLine";
/// <summary>
/// 查询当前出料工单信息
/// </summary>
/// <returns></returns>
public static bool FindCurSO(out WOData woData)
{
woData = null;
try
{
Dictionary<string, string> paramMap = new Dictionary<string, string>();
//paramMap.Add("deviceAlarmList", msgListStr);
string server = GetAddr(Addr_CurSO, paramMap);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Get(server);
log.Debug("当前正在出工单料信息【" + server + "】【" + resultStr + "】");
WorkOrder workOrder = JsonHelper.DeserializeJsonToObject<WorkOrder>(resultStr);
if (workOrder == null)
{
return false;
}
else
{
if (workOrder.data == null)
{
return false;
}
else
{
if (workOrder.data.line != null)
{
string tempLocation = workOrder.data.line;
if (workOrder.data.line.Equals("3DFeeder"))
{
tempLocation = "3DFeederIn";
}
else if (workOrder.data.line.Equals("3CFeeder"))
{
tempLocation = "3CFeederIn";
}
workOrder.data.line = tempLocation;
woData = workOrder.data;
return true;
}
}
}
}
catch (Exception ex)
{
log.Error(ex);
return false;
}
return false;
}
/// <summary>
/// 当前正在出的工单信息
/// </summary>
public class WorkOrder
{
//{"code":0,"msg":"ok","data":{"hSerial":"32622","line":null,"so":"2506287"}}
//{"code":0,"msg":"ok","data":{"hSerial":"32651","line":"D2","so":"2508551"}}
public int code { get; set; }
public string msg { get; set; }
public WOData data { get; set; }
}
public class WOData
{
public string hSerial { get; set; }
public string line { get; set; }
public string so { get; set; }
public string ToTxt(string nodeName)
{
return string.Format("[hSerial={0},line={1}[{3}],so={2}]", hSerial, line, so, nodeName);
}
}
public static string A6_Target = "";
/// <summary>
/// 查找满料架目的地
/// </summary>
/// <param name="rfid"></param>
/// <param name="dest"></param>
/// <returns></returns>
public static bool FindFullShelfTarget(string rfid)
{
return false;
}
public class BoxDestInfo
{
/// <summary>
/// RFID
/// </summary>
public string id { get; set; }
public string SO { get; set; }
public string location { get; set; }
public string ShowInfo(string loc)
{
return string.Format("RFID={0},SO={1},location={2}[{3}]", id, SO, loc, location);
}
}
/// <summary>
/// 获取大料架解绑情况
/// </summary>
/// <param name="rfid"></param>
/// <param name="lineName">产线名称</param>
/// <returns></returns>
public static bool GetRackBy(string rfid, out string lineName)
{
lineName = "";
//GET /ESMTCommonInterface/CommonService.asmx/GetRackBy?id=string HTTP/1.1
//Host: 10.85.17.233
string addr = "http://"+AppConfigHelper.GetValue(SettingString.ITS)+"/ESMTCommonInterface/CommonService.asmx/GetRackBy?id=" + rfid;
//[{"msg":"1OKD1"}]
//[{"msg":"0NGFeeder"}]
try
{
string result = HttpHelper.Get(addr);
if (!result.Equals(""))
{
List<Msg> msgs = JsonHelper.DeserializeJsonToList<Msg>(result);
if (msgs == null || msgs.Count == 0)
return false;
int.TryParse(msgs[0].msg.Substring(0, 1), out int resCode);
string resStr = msgs[0].msg.Substring(1, 2);
lineName = msgs[0].msg.Substring(3);
log.Info(string.Format("[{0}] [{1}]", addr, result));
if (lineName.Equals("").Equals(true))
return false;
if (resStr.Equals("OK") || resCode.Equals(1))
return true;
else
return false;
}
}
catch (Exception ex)
{
log.Error(ex.Message);
return false;
}
return false;
}
public static string GetRackBy(string rfid)
{
//GET /ESMTCommonInterface/CommonService.asmx/GetRackBy?id=string HTTP/1.1
//Host: 10.85.17.233
string addr = "http://10.85.71.25/ESMTCommonInterface/CommonService.asmx/GetRackBy?id=" + rfid;
//[{"msg":"1OKD1"}]
//[{"msg":"0NGFeeder"}]
try
{
string result = HttpHelper.Get(addr);
if (!result.Equals(""))
{
List<Msg> msgs = JsonHelper.DeserializeJsonToList<Msg>(result);
if (msgs == null || msgs.Count == 0)
return "";
return result;
}
}
catch (Exception ex)
{
log.Error(ex.Message);
return "";
}
return "";
}
/// <summary>
/// 大料架接口回复
/// </summary>
public class Msg
{
public string msg { get; set; }
}
public class Msg1
{
//{"Code":0,"Msg":"D14,,D7,D33"}
public int Code { get; set; }
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 Add_emptyMsg = "http://10.85.197.3/BenQMIR/Webservice/AGVService.asmx/CreateEmptyRecycleTask";
//public static string CreateEmptyTask()
//{
// try
// {
// Dictionary<string, string> paramMap = new Dictionary<string, string>();
// paramMap.Add("emptyStation", "D1");
// string path = Add_emptyMsg + "?";
// foreach (string paramName in paramMap.Keys)
// {
// string par = System.Web.HttpUtility.UrlEncode(paramMap[paramName], System.Text.Encoding.UTF8);
// path += paramName + "=" + par + "&";
// }
// path = path.Substring(0, path.Length - 1);
// string resultStr = HttpHelper.Post(path, "");
// log.Debug("【" + path + "】【" + resultStr + "】");
// Result data = JsonHelper.DeserializeJsonToObject<Result>(resultStr);
// if (data == null)
// {
// return " updateDeviceAlarmMsg 没有收到服务器反馈";
// }
// else
// {
// return data.Succeed.ToString();
// }
// }
// catch (Exception e)
// {
// return e.ToString();
// }
//}
private static string Addr_agvRemoveRfid = "/rest/api/qisda/device/agvRemoveRfid";
/// <summary>
/// 根据RFID清理料架的缓存信息
/// </summary>
/// <param name="rfid"></param>
/// <returns></returns>
public static bool AgvRemoveRfid(string rfid)
{
try
{
Dictionary<string, string> paramMap = new Dictionary<string, string>();
paramMap.Add("rfid", rfid.ToUpper());
string server = GetAddr(Addr_agvRemoveRfid, paramMap);
DateTime startTime = DateTime.Now;
string resultStr = HttpHelper.Get(server);
log.Info("清理料架的缓存信息【" + server + "】【" + resultStr + "】");
RfidData rfidData = JsonHelper.DeserializeJsonToObject<RfidData>(resultStr);
if (rfidData == null)
{
return false;
}
else
{
if (rfidData.code.Equals(0))
{
return true;
}
}
}
catch (Exception ex)
{
log.Error(ex);
return false;
}
return false;
}
}
public class ShelfLockInfo
{
//返回: {"code":0,"msg":"ok","data":
//[{"barcode":"S20052301213","cid":"packing-20","rfid":"A12","rfidLoc":"3","lockPos":"4D2001AA0006","lockPosId":"1231"}]}
/// <summary>
/// 返回码,0为正常,其他为异常
/// </summary>
public int code { get; set; }
/// <summary>
/// 消息
/// </summary>
public string msg { get; set; }
public List<ShelfLockData> data { get; set; }
}
public class ShelfLockData
{
/// <summary>
/// 库位中料盘的条码
/// </summary>
public string barcode { get; set; }
/// <summary>
/// 库位中料盘的锁定库位对应的料仓编
/// </summary>
public string cid { get; set; }
/// <summary>
/// 料架RFID
/// </summary>
public string rfid { get; set; }
/// <summary>
/// 料架的库位
/// </summary>
public int rfidLoc { get; set; }
/// <summary>
/// 库位中料盘的锁定库位
/// </summary>
public string lockPos { get; set; }
/// <summary>
/// 料架出库的剩余数量
/// </summary>
public int taskCount { get; set; }
}
/// <summary>
/// 获取料架中的任务数
/// </summary>
public class ShelfTaskCount
{
// {"code":0,"msg":"ok","data":{"taskCount":0,"rfid":"A2"}}
/// <summary>
/// 0为正常,其他为异常
/// </summary>
public int code { get; set; }
/// <summary>
/// 消息
/// </summary>
public string msg { get; set; }
public ShelfTaskData shelfTaskData { get; set; }
}
public struct ShelfTaskData
{
/// <summary>
/// 当前料架剩余任务数(即还有几盘料没放上去)
/// </summary>
public int taskCount { get; set; }
/// <summary>
/// 料架RFID
/// </summary>
public string rfid { get; set; }
}
public class AlarmMsg
{
//>>>name : 异常位置名称
public string name = "";
//>>>msgKey : 异常信息唯一标识
public string msgKey = "";
//>>>msgValue : 异常信息
public string msgValue = "";
//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 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;
namespace DeviceLibrary.manager
{
public class NodeManager
{
/// <summary>
/// 节点信息
/// </summary>
public static List<Node> nodeInfo;
public static void InitNodesInfos()
{
nodeInfo = new List<Node>();
XmlConfigOpManager.LoadNodeInfos(nodeInfo);
}
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.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "名称",DataPropertyName="AliceName" });
//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 = "状态", DataPropertyName = "Online" });
//DgvNode.Columns.Add(new DataGridViewCheckBoxColumn() { HeaderText = "启用", DataPropertyName = "IsUse" });
//DgvNode.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
//for (int n = 0; n < DgvNode.Rows.Count; n++)
//{
// if (n % 2 == 0)
// DgvNode.Rows[n].DefaultCellStyle.BackColor = Color.LightBlue;
//}
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 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 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));
}
/// <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;
}
}
}
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 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 HttpManager.GetRackBy(rfid, out string lineName);
}
public static bool UpdateShelfStatus(string rfid,string place)
{
return true;
}
}
}
}
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 XmlConfigOpManager
{
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<Agv_Info> 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)
{
Agv_Info agv_Info = new Agv_Info();
// 将节点转换为元素,便于得到节点的属性值
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 xeAreas = xnl0.Item(1).ChildNodes;
agv_Info.ResponsAreas = new List<Area>();
foreach (XmlNode item in xeAreas)
{
agv_Info.ResponsAreas.Add((Area)Enum.Parse(typeof(Area), item.InnerText));
}
agv_Info.IsUse = bool.Parse(xnl0.Item(2).InnerText);
agv_Info.UseFleet = bool.Parse(xnl0.Item(3).InnerText);
agv_Info.Authorization = xnl0.Item(4).InnerText;
agv_Info.IOID = xnl0.Item(5).InnerText;
agv_Infos.Add(agv_Info);
}
xmlReader.Close();
isLoadAgv = true;
LogUtil.info($"加载Agv配置成功{File_AgvInfo}");
}
public static void SetAgvIsUse(Agv_Info 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.IsUse.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.Area =(Area)Enum.Parse(typeof(Area),xnl0.Item(5).InnerText);
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.Fixed = bool.Parse(xnl0.Item(2).InnerText);
XmlNode xnAgv = xnl0.Item(3);
XmlNodeList xnAgvs = xnAgv.ChildNodes;
foreach (XmlNode item in xnAgvs)
{
node.Agvs.Add(item.InnerText);
}
chargePiles.AddPile(node);
}
xmlReader.Close();
LogUtil.info($"加载充电桩配置成功{File_ChargePileInfo}");
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary.manager
{
/// <summary>
/// 治具呼叫信息
/// </summary>
public class MissionInfo
{
/// <summary>
/// 请求任务时间
/// </summary>
public DateTime RTime { get; set; }
/// <summary>
/// 呼叫地名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 治具类型
/// </summary>
public FixType Type { get; set; }
/// <summary>
/// 目的地名称
/// </summary>
public string TargetName { get; set; }
/// <summary>
/// 任务类型
/// </summary>
public MissionType MissionType { get; set; }
/// <summary>
/// 任务是否执行
/// </summary>
public bool On { get; set; } = true;
public MissionInfo(string name, FixType fixType, string TargetName, MissionType missionType)
{
RTime = DateTime.Now;
Name = name;
Type = fixType;
this.TargetName = TargetName;
MissionType = missionType;
}
public MissionInfo() { }
public override string ToString()
{
PropertyInfo[] props = this.GetType().GetProperties();
string tmp = "";
foreach (PropertyInfo item in props)
{
tmp += string.Format("{0}:{1} ", item.Name, item.GetValue(this));
}
return tmp;
}
public override bool Equals(object obj)
{
if (obj is MissionInfo)
{
MissionInfo fixMissionInfo = obj as MissionInfo;
if (this.Name.Equals(fixMissionInfo.Name) && this.Type.Equals(fixMissionInfo.Type) && this.TargetName.Equals(fixMissionInfo.TargetName))
return true;
else
return false;
}
else
return false;
}
public MissionInfo ToCopy()
{
PropertyInfo[] propertyInfos = this.GetType().GetProperties();
MissionInfo missionInfo = new MissionInfo();
foreach (PropertyInfo item in propertyInfos)
{
item.SetValue(missionInfo, item);
}
return missionInfo;
}
}
public enum FixType
{
None
}
public enum MissionType
{
Warehouse,
Line
}
}
using System.ServiceModel;
using System.ServiceModel.Web;
using System.ServiceModel.Activation;
using System;
using System.IO;
using System.Runtime.Serialization;
using Common;
using DeviceLibrary.manager;
using DeviceLibrary.manager;
namespace DeviceLibrary
{
[ServiceContract(Name = "FixtureServices")]
internal interface IWebService
{
[OperationContract]
[WebInvoke(UriTemplate = "warehouse", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Xml)]
string WarehouseRequestByPost(Stream stream);
[OperationContract]
[WebInvoke(UriTemplate = "warehouse?name={name}&targetline={targetline}&type={type}", Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Xml)]
string WarehouseRequestByGet(string name, string targetline,int type);
[OperationContract]
[WebInvoke(UriTemplate = "line", Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Xml)]
string LineRequestByPost(Stream stream);
[OperationContract]
[WebInvoke(UriTemplate = "line?name={name}&targetwarehouse={targetwarehouse}&type={type}", Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Xml)]
string LineRequestByGet(string name, string targetwarehouse, int type);
}
[DataContract]
internal class Result
{
/// <summary>
/// 呼叫成功;false:呼叫失败
/// </summary>
[DataMember]
public bool Succeed { get; set; }
/// <summary>
/// 返回对应接口呼叫的参数信息;
/// </summary>
[DataMember]
public string Data { get; set; }
/// <summary>
/// 呼叫成功,为空。呼叫失败会返回原因
/// </summary>
[DataMember]
public string Msg { get; set; }
}
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Single, IncludeExceptionDetailInFaults = true)]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
internal class ClsWebService : IWebService
{
static log4net.ILog Log = log4net.LogManager.GetLogger("FixtureServices");
public string LineRequestByGet(string name, string targetwarehouse, int type)
{
Result res;
name = name.ToUpper();
targetwarehouse = SettingString .Warehouse;
manager.MissionInfo missionInfo = new manager.MissionInfo(name, (manager.FixType)type, targetwarehouse, manager.MissionType.Line);
if (!NodeManager.HasNode(name))
{
res = new Result() { Succeed = false, Data = $"name:{name},targetwarehouse:{targetwarehouse},type:{type}", Msg = $"节点名{name}不存在" };
Log.Error("产线呼叫任务失败[GET](节点不存在):" + missionInfo.ToString());
}
else if(!NodeManager.HasNode(targetwarehouse))
{
res = new Result() { Succeed = false, Data = $"name:{name},targetwarehouse:{targetwarehouse},type:{type}", Msg = $"节点名{targetwarehouse}不存在" };
Log.Error("产线呼叫任务失败[GET](节点不存在):" + missionInfo.ToString());
}
else
{
if (!FixMissionManager.Contains(missionInfo))
{
FixMissionManager.Add(missionInfo);
res = new Result() { Succeed = true, Data = $"name:{name},targetwarehouse:{targetwarehouse},type:{type}", Msg = "" };
Log.Info("产线呼叫任务成功[GET]:" + missionInfo.ToString());
}
else
{
res = new Result() { Succeed = false, Data = $"name:{name},targetwarehouse:{targetwarehouse},type:{type}", Msg = "该任务已存在" };
Log.Error("产线呼叫任务失败[GET](已存在相同任务):" + missionInfo.ToString());
}
}
return JsonHelper.SerializeObject(res);
}
public string LineRequestByPost(Stream stream)
{
Result res;
StreamReader sr = new StreamReader(stream);
string s = sr.ReadToEnd();
System.Collections.Specialized.NameValueCollection nvc = System.Web.HttpUtility.ParseQueryString(s);
string name = nvc["name"].ToUpper();
string targetwarehouse = SettingString.Warehouse;//nvc["targetwarehouse"].ToUpper();
int type = int.Parse(nvc["type"]);
manager.MissionInfo missionInfo = new manager.MissionInfo(name, (manager.FixType)type, targetwarehouse, manager.MissionType.Line);
if (!NodeManager.HasNode(name))
{
res = new Result() { Succeed = false, Data = $"name:{name},targetwarehouse:{targetwarehouse},type:{type}", Msg = $"节点名{name}不存在" };
Log.Error("产线呼叫任务失败[POST](节点不存在):" + missionInfo.ToString());
}
else if (!NodeManager.HasNode(targetwarehouse))
{
res = new Result() { Succeed = false, Data = $"name:{name},targetwarehouse:{targetwarehouse},type:{type}", Msg = $"节点名{targetwarehouse}不存在" };
Log.Error("产线呼叫任务失败[POST](节点不存在):" + missionInfo.ToString());
}
else
{
if (!FixMissionManager.Contains(missionInfo))
{
FixMissionManager.Add(missionInfo);
res = new Result() { Succeed = true, Data = $"name:{name},targetwarehouse:{targetwarehouse},type:{type}", Msg = "" };
Log.Info("产线呼叫任务成功[POST]:" + missionInfo.ToString());
}
else
{
res = new Result() { Succeed = false, Data = $"name:{name},targetwarehouse:{targetwarehouse},type:{type}", Msg = "该任务已存在" };
Log.Error("产线呼叫任务失败[POST](已存在相同任务):" + missionInfo.ToString());
}
}
return JsonHelper.SerializeObject(res);
}
public string WarehouseRequestByGet(string name, string targetline, int type)
{
Result res;
name = SettingString.Warehouse;//name.ToUpper();
targetline = targetline.ToUpper();
manager.MissionInfo missionInfo = new manager.MissionInfo(name, (manager.FixType)type, targetline, manager.MissionType.Warehouse);
if (!NodeManager.HasNode(name))
{
res = new Result() { Succeed = false, Data = $"name:{name},targetwarehouse:{targetline},type:{type}", Msg = $"节点名{name}不存在" };
Log.Error("立库呼叫任务失败[GET](节点不存在):" + missionInfo.ToString());
}
else if (!NodeManager.HasNode(targetline))
{
res = new Result() { Succeed = false, Data = $"name:{name},targetwarehouse:{targetline},type:{type}", Msg = $"节点名{targetline}不存在" };
Log.Error("立库呼叫任务失败[GET](节点不存在):" + missionInfo.ToString());
}
else
{
if (!FixMissionManager.Contains(missionInfo))
{
FixMissionManager.Add(missionInfo);
res = new Result() { Succeed = true, Data = $"name:{name},targetline:{targetline},type:{type}", Msg = "" };
Log.Info("立库呼叫任务成功[GET]:" + missionInfo.ToString());
}
else
{
res = new Result() { Succeed = false, Data = $"name:{name},targetline:{targetline},type:{type}", Msg = "该任务已存在" };
Log.Error("立库呼叫任务失败[GET](已存在相同任务):" + missionInfo.ToString());
}
}
return JsonHelper.SerializeObject(res);
}
public string WarehouseRequestByPost(Stream stream)
{
Result res;
StreamReader sr = new StreamReader(stream);
string s = sr.ReadToEnd();
System.Collections.Specialized.NameValueCollection nvc = System.Web.HttpUtility.ParseQueryString(s);
string name = SettingString.Warehouse;//nvc["name"].ToUpper();
string targetline = nvc["targetline"].ToUpper();
int type = int.Parse(nvc["type"]);
manager.MissionInfo missionInfo = new manager.MissionInfo(name, (manager.FixType)type, targetline, manager.MissionType.Warehouse);
if (!NodeManager.HasNode(name))
{
res = new Result() { Succeed = false, Data = $"name:{name},targetwarehouse:{targetline},type:{type}", Msg = $"节点名{name}不存在" };
Log.Error("立库呼叫任务失败[POST](节点不存在):" + missionInfo.ToString());
}
else if (!NodeManager.HasNode(targetline))
{
res = new Result() { Succeed = false, Data = $"name:{name},targetwarehouse:{targetline},type:{type}", Msg = $"节点名{targetline}不存在" };
Log.Error("立库呼叫任务失败[POST](节点不存在):" + missionInfo.ToString());
}
else
{
if (!FixMissionManager.Contains(missionInfo))
{
FixMissionManager.Add(missionInfo);
res = new Result() { Succeed = true, Data = $"name:{name},targetline:{targetline},type:{type}", Msg = "" };
Log.Info("立库呼叫任务成功[POST]:" + missionInfo.ToString());
}
else
{
res = new Result() { Succeed = false, Data = $"name:{name},targetline:{targetline},type:{type}", Msg = "该任务已存在" };
Log.Error("立库呼叫任务失败[POST](已存在相同任务):" + missionInfo.ToString());
}
}
return JsonHelper.SerializeObject(res);
}
}
public class WebService
{
private WebServiceHost _serviceHost;
public bool State = false;
public void Open(string url)
{
try
{
ClsWebService service = new ClsWebService();
_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);
}
}
}
}
<?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>AGVControl_Fixture</RootNamespace>
<AssemblyName>AGVControl-Fixture</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">
<HintPath>dll\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
<?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>
<add key="ITS" value="10.85.17.233"/>
<add key="WebService" value="http://127.0.0.1:8888/service/agv/request/"/>
<add key="http.server" value="http://10.85.162.124/myproject/"/>
<add key="FLEET" value="10.85.19.3"/>
<add key="log4net_configname" value="log4net.config"/>
<add key="File_AgvInfo" value="agvinfos.xml"/>
<add key="File_AgvTaskInfo" value="taskinfos.xml"/>
<add key="File_NodeInfo" value="nodeinfos.xml"/>
<add key="UseFleet" value="False"/>
<add key="ChargeThreshold" value="20,90"/>
</appSettings>
</configuration>
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.groupBox1 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel5 = new System.Windows.Forms.TableLayoutPanel();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
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.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.groupBox1.SuspendLayout();
this.tableLayoutPanel5.SuspendLayout();
this.groupBox3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
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.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
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 = 2;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 56.39743F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 43.60257F));
this.tableLayoutPanel2.Controls.Add(this.DgvNode, 0, 0);
this.tableLayoutPanel2.Controls.Add(this.groupBox1, 1, 0);
this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 3);
this.tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(2);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 1;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
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(667, 335);
this.DgvNode.TabIndex = 1;
this.DgvNode.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.DgvNode_CellClick);
//
// 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(675, 2);
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(518, 337);
this.groupBox1.TabIndex = 33;
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.groupBox3, 0, 0);
this.tableLayoutPanel5.Controls.Add(this.grpUnlock, 0, 1);
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 = 2;
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 21.42858F));
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 78.57143F));
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel5.Size = new System.Drawing.Size(514, 316);
this.tableLayoutPanel5.TabIndex = 2;
//
// groupBox3
//
this.groupBox3.Controls.Add(this.pictureBox2);
this.groupBox3.Controls.Add(this.pictureBox1);
this.groupBox3.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox3.Location = new System.Drawing.Point(2, 2);
this.groupBox3.Margin = new System.Windows.Forms.Padding(2);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Padding = new System.Windows.Forms.Padding(2);
this.groupBox3.Size = new System.Drawing.Size(510, 63);
this.groupBox3.TabIndex = 0;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "服务开启状态";
//
// pictureBox2
//
this.pictureBox2.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBox2.Image = global::AGVControl_Fixture.Properties.Resources.green1;
this.pictureBox2.Location = new System.Drawing.Point(2, 19);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(506, 42);
this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pictureBox2.TabIndex = 1;
this.pictureBox2.TabStop = false;
this.pictureBox2.Visible = false;
//
// pictureBox1
//
this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBox1.Image = global::AGVControl_Fixture.Properties.Resources.gray2;
this.pictureBox1.Location = new System.Drawing.Point(2, 19);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(506, 42);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// 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, 70);
this.grpUnlock.Name = "grpUnlock";
this.grpUnlock.Size = new System.Drawing.Size(508, 243);
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(502, 221);
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(496, 215);
this.dgvInfos.TabIndex = 0;
this.dgvInfos.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvInfos_CellContentClick);
//
// 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.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;
//
// 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 = "治具调度系统";
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.groupBox1.ResumeLayout(false);
this.tableLayoutPanel5.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
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.GroupBox groupBox1;
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.GroupBox groupBox3;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel5;
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.PictureBox pictureBox1;
private System.Windows.Forms.GroupBox grpUnlock;
private System.Windows.Forms.TableLayoutPanel tblLayoutUnlock;
private System.Windows.Forms.DataGridView dgvInfos;
private System.Windows.Forms.PictureBox pictureBox2;
}
}
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], out bool[] input, out bool[] output);
if (input != null && input.Length == 4)
AGVManager.agvInfo[i].IsExistShelf = input[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.FixMissionManager.InitView(dgvInfos);
DeviceLibrary.manager.FixMissionManager.MissionChangedEvent += FixMissionManager_MissionChangedEvent;
}
private void FixMissionManager_MissionChangedEvent()
{
DeviceLibrary.manager.FixMissionManager.UpdateDataSource(dgvInfos);
}
private void Server_NodeChanged(Node node)
{
Invoke(new Action(() =>
{
for (int i = 0; i < DgvNode.Rows.Count; i++)
{
DgvNode.Rows[i].DefaultCellStyle.ForeColor = NodeManager.nodeInfo[i].Online && NodeManager.nodeInfo[i].IsUse ? Color.Black : Color.Red;
DgvNode.Rows[i].SetValues(NodeManager.nodeInfo[i].ToRow());
}
}));
}
private void Server_NodeOnline(Node node)
{
Invoke(new Action(() =>
{
for (int i = 0; i < DgvNode.Rows.Count; i++)
{
DgvNode.Rows[i].DefaultCellStyle.ForeColor = NodeManager.nodeInfo[i].Online && NodeManager.nodeInfo[i].IsUse ? Color.Black : Color.Red;
DgvNode.Rows[i].SetValues(NodeManager.nodeInfo[i].ToRow());
}
}));
}
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();
AGVManager.server.NodeChanged += Server_NodeChanged;
AGVManager.server.NodeOnline += Server_NodeOnline;
}
private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
{
if (!exit)
{
e.Cancel = true;
Hide();
}
LogUtil.logBox = null;
//showTimer.Enabled = false;
showTimer.Stop();
AGVManager.server.NodeChanged -= Server_NodeChanged;
AGVManager.server.NodeOnline -= Server_NodeOnline;
}
private void DgvNode_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex == -1) return;
int idx = e.RowIndex;
if (e.ColumnIndex == 6) //调用
{
DataGridView dgv = sender as DataGridView;
if(dgv != null)
{
}
NodeManager.nodeInfo[idx].IsUse = !NodeManager.nodeInfo[idx].IsUse;
DgvNode.Rows[idx].DefaultCellStyle.ForeColor = NodeManager.nodeInfo[idx].Online && NodeManager.nodeInfo[idx].IsUse ? Color.Black : Color.Red;
DgvNode.Rows[idx].SetValues(NodeManager.nodeInfo[idx].ToRow());
}
}
bool InShhow = false;
private void ShowTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
//ShowEmptyTask();
if (InShhow)
return;
InShhow = true;
Invoke(new Action(() =>
{
Application.DoEvents();
if (DeviceLibrary.manager.FixMissionManager.IsOpen())
{
pictureBox1.Visible = false;
pictureBox2.Visible = true;
}
else
{
pictureBox1.Visible = true;
pictureBox2.Visible = false;
}
}));
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.FixMissionManager.SetMissionState(e.RowIndex);
DeviceLibrary.manager.FixMissionManager.UpdateDataSource(dgvInfos);
}
}
}
}
<?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
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIetcoKHq3SAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHWfYCWlypz3psmb9nWZ
XyMAAAAAAAAAAAAAAABVQEAMTT82cQAAAAAAAAAAAAAAAI2xe7CUuITYgqpxLQAAAABmmWYFiKx1zYet
dsyAgEAEAAAAAIKobS+Qs4HbZWlQ2ks8PBEAAAAAAAAAAAAAAACSt4LbrNCl/oKla3oAAAAAd5lmD3qg
ZJt6oGSbbaRbDgAAAAB/nmeBeYJp/42vftwAAAAAAAAAAAAAAAAAAAAAgKZpLn2ja3p1nF3Vhqx1paDE
leabwI//m8CP/6DFleSDqG+nXWZG6XaZZn2CpGwtAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAhatxsLTX
rv694Lr/ut22/7rdtv+52rX/fIVt/3+gbbEAAAAAAAAAAAAAAAAAAAAAAAAAAHOcWh+AgEAEeZ5hFZ7D
kue94Lr/veC6/7jbtP+11bD/gIpz/7XVsv+ew5LleaFeE4CAQARznFofAAAAAIeveICnyp32iK93w3uh
ZZOgxZT/ut22/7fasv+Zu4v/cXtf/7HQq/+63LX/oMSU/3ugZJGJr3fFp8qd9outdn2GrXWDpsub84it
dct7oWadnMGP/7rdtv+01K7/cXpe/5a2iP+32rL/ut22/5zAj/96oGSbiK10zKfLnPOHr3aAAAAAAHOc
Wh+AgEAEeZ5hFaHFleW52rX/gIpz/7HQrP+427T/veC6/73guv+hxZXkeaFeE4CAQARznFofAAAAAAAA
AAAAAAAAAAAAAAAAAACDpnCpfIVt/7XVsv+63rb/ut62/73guv+0167+hqx0pQAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAICmaS59nWlwXWZG54CfbLWfw5Pmm8CP/5vAj/+fw5LlhKpwsnWcXdWApm1wgqRsLQAA
AAAAAAAAAAAAAAAAAACSs4LYeYNq/3qZaIAAAAAAdJddFnqgZJt6oGSbeZ5hFQAAAACDqGx7r9Oo/ZO4
hdUAAAAAAAAAAAAAAABVOTkJY2lQ2pGxgdeFpXAwAAAAAFWqVQOIrnfMiK11y1WqVQMAAAAAgKhrMpa6
iNSNsXquAAAAAAAAAAAAAAAATEE2clVAQAwAAAAAAAAAAAAAAAB5ml4mpcqc96bJm/Z4nFwkAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIetcoKGrHOBAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP5/AAD+fwAAznMAAM5jAADwDwAA8A8AAPAPAAAAAQAAAAAAAPAP
AADwDwAA8A8AAMZzAADOcwAA/n8AAP5/AAAoAAAAIAAAAEAAAAABACAAAAAAAIAQAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAdZ9gGHWfYBgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAH2jZ6uFqnHqg6lw636iaagAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAB1m1w9j7J97r3guv+94Lr/jbN87XWcXzsAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAABNQTUrTUA3hwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAHWcXVWav432veC6/73guv+Zvo31dZ1fUwAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAATD43JU1ANtROQDY0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAdp1cJ3yi
ZtZ9pGbtfaJowHeZZg8AAAAAAAAAAAAAAAAAAAAAcZxjEnyiZuanyp3/psqd/3yhZuV4lloRAAAAAAAA
AAAAAAAAAAAAAHCfYBB+o2fBfKNm7nSQX9tOQzfaTkA2NAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAB+pGfSsNSp/73guv+kx5j7fqNnngAAAAAAAAAAAAAAAAAAAAAAAAAAdptbHHifYel5n2Hpdp1iGgAA
AAAAAAAAAAAAAAAAAAAAAAAAf6NnoaPHmfytyKf/XllJ/3OMXNoAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAH6laui94Lr/veC6/7ndtf9+pGfUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAdpxezHac
XswAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB+o2jWqcak/2BbTP+mv5//fqRo6AAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAfqNnwaPHmfy427T/lLmF/3qgY9GAgIACAAAAAAAAAABxqlUJd51eSXuj
Z5V3nl/xd55f8X2jZZN1nGBIcapVCQAAAAAAAAAAVapVA3KPXNtZVET/orua/6PHmfx9o2e/AAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB4lloRfKFnpn2hZdl5oGTXdpxe/3WdX5QA/wACeZ5jZ3yi
ZumRtYHwqMue/4Gobf+BqG3/p8ue/5G1gO98ombpep5jZAD/AAFth1amVE89/2+JWN99oWXZfKJmpXCf
YBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAICAQAR3nF+qdpxe/3qh
ZOKQtYDxuNu0/73guv+94Lr/hqpy/4aqcv+94Lr/veC6/7jbtP+RtYDwcpBc5lRPPf9rglK6gIBABAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGaZ
MwV8oGTpnsOS/73guv+94Lr/veC6/73guv+w06j/r9Op/73guv+94Lr/veC6/63Ip/9aVkX/cYta7GaZ
MwUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAe6FjapK3gvK94Lr/veC6/73guv+94Lr/veC6/73guv+94Lr/veC6/73guv+tyKf/YFtM/6a/
n/+QtYHyeKNiZgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAICqVQZ+o2fnudy1/73guv+94Lr/veC6/73guv+94Lr/veC6/73guv+94Lr/rcin/2Bb
TP+mv5//veC6/7jbtP99omfnZplmBQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHib
YEB3m15PcZxjEgAAAAAAAAAAdZ1fRpK2gu+94Lr/veC6/73guv+94Lr/veC6/7veuP+ozJ//qMyf/6zI
pf9gW0z/pr+f/73guv+94Lr/veC6/5G2ge52nF9DAAAAAAAAAAB5oV4Td5teT3WeXT8AAAAAAAAAAAAA
AAB9o2ipj7R+7ZzAjvd8oWbldZ9gGAAAAAB9omeXqc2g/73guv+94Lr/veC6/73guv+83rj/iKx1/5m9
iv+Nq3//V1JB/6a+nf+94Lr/veC6/73guv+94Lr/qMyf/3ujZ5UAAAAAeplcGXyiZuacwJD3jrN+7X6j
aKYAAAAAdp1iGoSqceq94Lr/veC6/6XJm/95n2PodpxezHeeX/GCqG3/h6x0/6/TqP+94Lr/veC6/6jL
n/+XvIr/rcin/2BbTP+Io3j/qMyf/73guv+94Lr/r9Oo/4arcv+BqG3/d55f8XacXsx5n2Popsmc/73g
uv+94Lr/halw6nWfYBh2nWIahalw6r3guv+94Lr/pcib/3qgY+92nF3ddp1e9n6jaP+CqG7/sNOo/73g
uv+94Lr/qMue/4yqff9gW0z/pr+f/5e7iP+ozJ//veC6/73guv+w06j/gqhu/36jaP92nV72dpxd3Xmf
Y/ClyZv/veC6/73guv+DqnDqdZ9gGAAAAAB+o2asj7N97JrAjvF9o2blcaFeGwAAAAB9o2eZqc2g/73g
uv+94Lr/veC6/73guv+rx6X/V1JB/4qjef+YvYv/iKx1/7zfuP+94Lr/veC6/73guv+94Lr/qMyf/32j
Z5UAAAAAdptbHHyiZuabv43yjrJ97H2kZqoAAAAAAAAAAAAAAAB4m2BAd5teT3GcYxIAAAAAAAAAAHme
YUyUuYTxveC6/73guv+94Lr/rcin/2BbTP+lvp3/qMyf/6jMn/+837j/veC6/73guv+94Lr/veC6/73g
uv+TuIXxdZxgSAAAAAAAAAAAeaFeE3ebXk91nl0/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAgKpVBn2kaOW63bb/veC6/63Ip/9gW0z/pr+f/73guv+94Lr/veC6/73guv+94Lr/veC6/73g
uv+94Lr/ud22/32jaORmmWYFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAe6FjapS6hfGtyKf/YFtM/6a/n/+94Lr/veC6/73guv+94Lr/veC6/73g
uv+94Lr/veC6/73guv+TuITxeKNiZgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/wACc5Fd5ltWRv+mv5//veC6/73guv+94Lr/sNSp/7HU
qv+94Lr/veC6/73guv+94Lr/nsOS/3qgZOIA/wACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP8AAW2GVaJUTz3/cYta75W6hvO73bf/veC6/73g
uv+GqnL/hqpy/73guv+94Lr/ut22/5S5hfN7oWXpdpxe/3WdX5QA/wABAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB4lloRfKFnpnyiZthyj1zTVE89/2yDUr1tkm0He6BjdH2k
Z+aUuITuqMue/4Gobf+BqG3/qMue/5S4hO59o2fme59icoCAVQZ3nF+qdpxe/3mgY858ombYfKJmpXCf
YBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH2jaL2jx5n8rMil/1lUQ/9viljeZplmBQAA
AAAAAAAAcapVCXedXkl7o2eVd55f8XeeX/F9o2WTdZxgSHGqVQkAAAAAAAAAAICAQAR7oGPWlLqG/7zf
uP+jx5n8faRouwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAfqVq6K3Ip/9gW0z/o72b/36j
Z9UAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB2nF7MdpxezAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH2j
aNa53bb/veC6/73guv9+pGjoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB0kV/cXllJ/6a/
n/+kx5j7fKNmowAAAAAAAAAAAAAAAAAAAAAAAAAAdptbHHifYel5n2Hpdp1iGgAAAAAAAAAAAAAAAAAA
AAAAAAAAfaJopaPHmfy94Lr/sNOo/32iZtQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATD43JU5C
N9tyilvdfqVq6H2iaMBwn2AQAAAAAAAAAAAAAAAAAAAAAHeZZg99o2fkp8qd/6bKnf99o2bkbaRbDgAA
AAAAAAAAAAAAAAAAAAB4lloRfqNnwX6lauh8o2jTeZpeJgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEw+
NyVNQDbUTkA2NAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAdpteVJq/jfa94Lr/veC6/5m+
jfV1nV9TAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAATUA3h09DNyoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB2nV5Bj7R+7b3g
uv+94Lr/jrN+7HWeXT8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAB+o2ashapx6oWqcOp9o2ipAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAB1n2AYdZ9gGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///////D////w/+//8P/f4/D8P8H5+D/B+fg/wfD4P+DAMH/8A
AP//gAH//4AB//8AAP//AAD/hgAAYYAAAAGAAAABhgAAYf8AAP//AAD//4AB//+AAf//AAD/+DAMH/B8
Pg/wfn4P8H5+D/D8Px/v/D//3/w////8P///////
</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::AGVControl_Fixture.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::AGVControl_Fixture.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::AGVControl_Fixture.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::AGVControl_Fixture.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::AGVControl_Fixture.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::AGVControl_Fixture.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::AGVControl_Fixture.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::AGVControl_Fixture.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(Agv_Info agv)
{
InitializeComponent();
Agv = agv;
chkBxAuto.Checked = agv.IsUse;
btnReSendTask.Enabled = agv.IsUse;
btnAssignTask.Enabled = !agv.IsUse;
}
Agv_Info 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.Input != null && Agv.Input.Length == 4)
{
for (int i = 0; i < Agv.Input.Length; i++)
{
if (Agv.Input[i])
{
InState[i].Image = AGVControl_Fixture.Properties.Resources.green1;
}
else
{
InState[i].Image = AGVControl_Fixture.Properties.Resources.gray2;
}
}
}
if (Agv.Output != null && Agv.Output.Length == 4)
{
for (int i = 0; i < Agv.Output.Length; i++)
{
if (Agv.Output[i])
{
OutState[i].Image = AGVControl_Fixture.Properties.Resources.green1;
}
else
{
OutState[i].Image = AGVControl_Fixture.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)
{
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)
{
LogUtil.error(string.Format("{0} 车上有负载,无法开启自动模式,请先清空小车负载!", Agv.Name));
return;
}
if (Agv.Place.Equals(SettingString.Standby) || Agv.Place.Equals(SettingString.AutoCharge))
Agv.Place = new Node();
if (Agv.IsCon)
MiR_API.Del_Mission(Agv);
}
Agv.IsUse = chkBxAuto.Checked;
}));
}
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);
LogUtil.info(string.Format("{0} 手动发任务 [{1}]", Agv.Name, cmbBxMission.SelectedItem.ToString()));
}
}
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();
AGVManager.Init();
ChargePileManager.Init();
AGVManager.control = new DeviceLibrary.Control();
//获取节点位置
// AGVManager.GetNodesPosition();
AGVManager.control.Start();
AGVManager.server = new AgvServer();
AGVManager.server.Start();
DeviceLibrary.manager.FixMissionManager.InitMission();
DeviceLibrary.manager.FixMissionManager.Open();
Application.Run(new FrmMain());
AGVManager.control.Stop();
AGVManager.server.Stop();
DeviceLibrary.manager.FixMissionManager.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 AGVControl_Fixture.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("AGVControl_Fixture.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 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 AGVControl_Fixture.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.7.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>
文件属性发生变化

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}") = "AGV-Fixture", "AGV-Fixture.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
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="AGV_3D_Line" 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="10" />
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%m%n"/>
</layout>
</appender>
<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="AGV_3D_Line">
<level value="Info"/>
<appender-ref ref="AGV_3D_Line"/>
</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="RestSharp" version="106.11.4" targetFramework="net461" />
</packages>
\ No newline at end of file \ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!