Commit 3fbe1f2e 张东亮

1217

1 个父辈 88824370
正在显示 101 个修改的文件 包含 3405 行增加558 行删除
......@@ -7,7 +7,7 @@
<ProjectGuid>{E1C3207D-C67D-4B46-A9DB-D182F2074CCB}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>AGV_3D_Line</RootNamespace>
<AssemblyName>AGV_3D_Line</AssemblyName>
<AssemblyName>AGV-3D-Line</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
......@@ -69,39 +69,12 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="bean\Agv_Info.cs" />
<Compile Include="bean\Job.cs" />
<Compile Include="bean\JobStep.cs" />
<Compile Include="bean\job\ChargeJob.cs" />
<Compile Include="bean\job\EnterLeaveShelfJob.cs" />
<Compile Include="bean\job\SendFullShelfToLineJob.cs" />
<Compile Include="bean\job\GoFullShelfStationJob.cs" />
<Compile Include="bean\job\EmptyShelfBackJob.cs" />
<Compile Include="bean\job\EmptyAGVBackJob.cs" />
<Compile Include="bean\job\GoEmptyShelfLineJob.cs" />
<Compile Include="bean\Node.cs" />
<Compile Include="bean\node\ClientNode.cs" />
<Compile Include="bean\node\DoubleLineNodeFor4D.cs" />
<Compile Include="bean\node\DoubleLineNodeFor4C.cs" />
<Compile Include="BLL\AGVManager.cs" />
<Compile Include="BLL\AgvServer.cs" />
<Compile Include="BLL\Common.cs" />
<Compile Include="BLL\ConfigAppSettings.cs" />
<Compile Include="BLL\Control.cs" />
<Compile Include="BLL\HttpHelper.cs" />
<Compile Include="BLL\IniHelper.cs" />
<Compile Include="BLL\JsonHelper.cs" />
<Compile Include="BLL\MyWebClient.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="BLL\LineWebService.cs" />
<Compile Include="FrmMain.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmMain.Designer.cs">
<DependentUpon>FrmMain.cs</DependentUpon>
</Compile>
<Compile Include="BLL\MiR_API.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="FrmMain.resx">
......

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30104.148
VisualStudioVersion = 16.0.30523.141
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AGV_3D_Line", "AGV_3D_Line\AGV_3D_Line.csproj", "{E1C3207D-C67D-4B46-A9DB-D182F2074CCB}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AGV-3D-Line", "AGV-3D-Line.csproj", "{E1C3207D-C67D-4B46-A9DB-D182F2074CCB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AgvClient", "AgvClient\AgvClient.csproj", "{D9154766-67B0-4082-AF8B-DCC7C4CFB5A2}"
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}") = "AgvClientTest", "AgvClientTest\AgvClientTest.csproj", "{E1C0827A-FA12-49A9-AC71-6D3E6518754A}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "..\Common\Common.csproj", "{BAFEAFE6-04E2-48EE-8845-BFC7EA3E3C21}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebServiceHost", "WebServiceTest\WebServiceHost.csproj", "{A89F6EC4-457A-4998-ACDC-F1ADC22C8BF8}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeviceLibrary", "..\DeviceLibrary\DeviceLibrary.csproj", "{F9619F07-15F1-4E59-A383-3871952BBB79}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
......@@ -21,23 +21,23 @@ Global
{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
{D9154766-67B0-4082-AF8B-DCC7C4CFB5A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D9154766-67B0-4082-AF8B-DCC7C4CFB5A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D9154766-67B0-4082-AF8B-DCC7C4CFB5A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D9154766-67B0-4082-AF8B-DCC7C4CFB5A2}.Release|Any CPU.Build.0 = Release|Any CPU
{E1C0827A-FA12-49A9-AC71-6D3E6518754A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E1C0827A-FA12-49A9-AC71-6D3E6518754A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E1C0827A-FA12-49A9-AC71-6D3E6518754A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E1C0827A-FA12-49A9-AC71-6D3E6518754A}.Release|Any CPU.Build.0 = Release|Any CPU
{A89F6EC4-457A-4998-ACDC-F1ADC22C8BF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A89F6EC4-457A-4998-ACDC-F1ADC22C8BF8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A89F6EC4-457A-4998-ACDC-F1ADC22C8BF8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A89F6EC4-457A-4998-ACDC-F1ADC22C8BF8}.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 = {6958A655-C82F-4C09-951F-24E629575E89}
SolutionGuid = {C1E472B0-A5EF-4CB3-834D-7643344D6FD9}
EndGlobalSection
EndGlobal
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C6D2FC09-46F7-4EC5-A877-15EA06342E4F}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>AGV_UI</RootNamespace>
<AssemblyName>AGV_UI</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Status.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Status.Designer.cs">
<DependentUpon>Status.cs</DependentUpon>
</Compile>
<Compile Include="Manager.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Service Include="{94E38DFF-614B-4cbd-B67C-F211BB35CE8B}" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Status.resx">
<DependentUpon>Status.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Content Include="battery\charge.png" />
<None Include="state\Unknown.png" />
<None Include="state\ready.png" />
<None Include="state\pause.png" />
<None Include="state\manual.png" />
<None Include="state\Executing.png" />
<None Include="state\Error.png" />
<None Include="state\emergency.png" />
<None Include="state\Aborted.png" />
<None Include="task.png" />
<None Include="online.png" />
<None Include="battery\full.png" />
<None Include="battery\common.png" />
<None Include="battery\low.png" />
<None Include="offline.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
......@@ -18,13 +18,17 @@
</layout>
</appender>
<appender name="LineWebService" type="log4net.Appender.RollingFileAppender">
<file value="logs/LineWebService.log"/>
<file value="logs/UnlockInfo.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<param name="MaxSizeRollBackups" value="10" />
<!-- 切割最多文件数 -->
<param name="MaximumFileSize" value="100MB" />
<!-- 每个文件的大小 -->
<param name="RollingStyle" value="Size" />
<param name="StaticLogFileName" value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t][%c:%L]%-5p %m%n"/>
<conversionPattern value="[%date]%-5p %m%n"/>
</layout>
</appender>
<logger name ="LineWebService">
......@@ -43,7 +47,8 @@
<add key="FLEET" value="10.85.199.3" />
<add key="AutoCharge" value="True" />
<add key="ChargeWait" value="1" />
<add key="ChargeThreshold" value="20,70" />
<add key="ChargeThreshold" value="20,90" />
<add key="IP_4D_Light" value="10.85.196.40:8088" />
<add key="IP_4C_Light" value="10.85.197.40:8088" />
</appSettings>
</configuration>
\ No newline at end of file
产线任务名称,任务名称,任务GUID
下料区(A5),MoveA5,679f2ca1-b520-11ea-b6ad-00012998f5a0
上料区(A6),MoveA6,7e5e9dc2-b521-11ea-b6ad-00012998f5a0
4D-1线,MoveD1,73bcddb3-b513-11ea-b6ad-00012998f5a0
4D-2线,MoveD2,9bacf16b-b515-11ea-b6ad-00012998f5a0
4D-3线,MoveD3,f84313b5-b515-11ea-b6ad-00012998f5a0
4D-4线,MoveD4,5683db0e-b516-11ea-b6ad-00012998f5a0
4D-5线,MoveD5,9c04b71b-b516-11ea-b6ad-00012998f5a0
4D-6线,MoveD6,f46be62a-b516-11ea-b6ad-00012998f5a0
4D-8线,MoveD8,41dccfcf-b517-11ea-b6ad-00012998f5a0
4D-9线,MoveD9,7fc3ec2f-b517-11ea-b6ad-00012998f5a0
4D-10线,MoveD10,e7c0ad9c-b517-11ea-b6ad-00012998f5a0
4D-11线,MoveD11,2e23a510-b518-11ea-b6ad-00012998f5a0
4D-12线,MoveD12,6efb37bc-b519-11ea-b6ad-00012998f5a0
4D-14线,MoveD14,b03043fd-b519-11ea-b6ad-00012998f5a0
4D-15线,MoveD15,f3f9a668-b519-11ea-b6ad-00012998f5a0
4D-16线,MoveD16,5ec0f64a-b51a-11ea-b6ad-00012998f5a0
4D-FeedeerIn,MoveD4FeederIn,37401585-b51b-11ea-b6ad-00012998f5a0
4D-FeederOut,MoveD4FeederOut,a4846723-b51b-11ea-b6ad-00012998f5a0
4D-4C门,MoveDoorDToC,fd6e26ac-c1bf-11ea-9a66-94c691a7387d
4C-4D门,MoveDoorCToD,d67f31c8-ca7e-11ea-9a66-94c691a7387d
4C-1线,MoveC1,94a15e2c-cda7-11ea-a3e4-94c691a7387d
4C-2线,MoveC2,cece230b-cda7-11ea-a3e4-94c691a7387d
4C-3线,MoveC3,e393e846-cda7-11ea-a3e4-94c691a7387d
4C-4线,MoveC4,0b297e08-cda8-11ea-a3e4-94c691a7387d
4C-5线,MoveC5,1d3512ae-cda8-11ea-a3e4-94c691a7387d
4C-6线,MoveC6,33c8d629-cda8-11ea-a3e4-94c691a7387d
4C-7线,MoveC7,56c5a660-cda8-11ea-a3e4-94c691a7387d
4C-8线,MoveC8,6873fd7f-cda8-11ea-a3e4-94c691a7387d
4C-9线,MoveC9,8ba46b72-cda8-11ea-a3e4-94c691a7387d
4C-10线,MoveC10,c0b75c41-ca7d-11ea-9a66-94c691a7387d
4C-FeedeerIn,MoveC4FeederIn,0a657afd-ca9d-11ea-9a66-94c691a7387d
4C-FeedeerOut,MoveC4FeederOut,83b9ba6d-cdb2-11ea-a3e4-94c691a7387d
4C-14线,MoveC14,2baac336-d0d4-11ea-a3e4-94c691a7387d
4C-15线,MoveC15,41cc7a90-d0d4-11ea-a3e4-94c691a7387d
4C-AirIn,MoveDoorAirIn,2dc71db5-d0cb-11ea-a3e4-94c691a7387d
4C-AirOut,MoveDoorAirOut,9bc63eaa-d0d3-11ea-a3e4-94c691a7387d
小车进料,Enter,51233d8c-c044-11ea-9a66-94c691a7387d
小车出料,Leave,2e433130-c045-11ea-9a66-94c691a7387d
3号充电桩,AutoCharge3,b7371c5f-c045-11ea-9a66-94c691a7387d
4号充电桩,AutoCharge4,1296084c-c046-11ea-9a66-94c691a7387d
5号充电桩,AutoCharge5,40c8f44e-c046-11ea-9a66-94c691a7387d
6号充电桩,AutoCharge6,56cca0a3-c046-11ea-9a66-94c691a7387d
小车初始化,Init,adcb7a04-b525-11ea-b6ad-00012998f5a0
待机位,MoveStandby,ae6e4f12-c050-11ea-9a66-94c691a7387d
4C临时停车位1,MoveC4_STANDBY1,d5fc690b-f1a5-11ea-a03e-94c691a7387d
4C临时停车位2,MoveC4_STANDBY2,90f4399f-f1a6-11ea-a03e-94c691a7387d
临时停车位,MoveStandbyTemp,d6c32ad3-d64e-11ea-a3e4-94c691a7387d
检查料架情况,CheckShelf,f3e46a3e-d734-11ea-a3e4-94c691a7387d
\ No newline at end of file
Fleet ID,agv,IP,Ȩ,IOID
7,MiR_R1763,10.85.199.71,Basic ZGlzdHJpYnV0b3I6NjJmMmYwZjFlZmYxMGQzMTUyYzk1ZjZmMDU5NjU3NmU0ODJiYjhlNDQ4MDY0MzNmNGNmOTI5NzkyODM0YjAxNA==,007615a5-2220-11ea-99f2-94c691a73b53
8,MiR_R1764,10.85.199.72,Basic ZGlzdHJpYnV0b3I6NjJmMmYwZjFlZmYxMGQzMTUyYzk1ZjZmMDU5NjU3NmU0ODJiYjhlNDQ4MDY0MzNmNGNmOTI5NzkyODM0YjAxNA==,007615a5-2220-11ea-99f2-94c691a73b53
9,MiR_R1767,10.85.199.73,Basic ZGlzdHJpYnV0b3I6NjJmMmYwZjFlZmYxMGQzMTUyYzk1ZjZmMDU5NjU3NmU0ODJiYjhlNDQ4MDY0MzNmNGNmOTI5NzkyODM0YjAxNA==,007615a5-2220-11ea-99f2-94c691a73b53
10,MiR_R1768,10.85.199.74,Basic ZGlzdHJpYnV0b3I6NjJmMmYwZjFlZmYxMGQzMTUyYzk1ZjZmMDU5NjU3NmU0ODJiYjhlNDQ4MDY0MzNmNGNmOTI5NzkyODM0YjAxNA==,007615a5-2220-11ea-99f2-94c691a73b53
2,MiR_R1579,10.85.199.80,Basic ZGlzdHJpYnV0b3I6NjJmMmYwZjFlZmYxMGQzMTUyYzk1ZjZmMDU5NjU3NmU0ODJiYjhlNDQ4MDY0MzNmNGNmOTI5NzkyODM0YjAxNA==,007615a5-2220-11ea-99f2-94c691a73b53
1,MiR_R1580,10.85.199.81,Basic ZGlzdHJpYnV0b3I6NjJmMmYwZjFlZmYxMGQzMTUyYzk1ZjZmMDU5NjU3NmU0ODJiYjhlNDQ4MDY0MzNmNGNmOTI5NzkyODM0YjAxNA==,007615a5-2220-11ea-99f2-94c691a73b53
产线名,节点名,IP,产线别名,位置名称,位置guid
A5,A5,10.85.199.20,下料区(A5),PA5,7ed952c3-b520-11ea-b6ad-00012998f5a0
A6,A6,10.85.199.20,上料区(A6),PA6,929eb1c2-b520-11ea-b6ad-00012998f5a0
D1,D1,10.85.199.42,4D-1线,DL1,3b823fe4-b368-11ea-a1a5-00012999830e
D2,D2,10.85.199.90,4D-2线,DL2,ede15fcb-b367-11ea-a1a5-00012999830e
D3,D3,10.85.199.91,4D-3线,DL3,43855a9b-b365-11ea-a1a5-00012999830e
D4,D4,10.85.199.92,4D-4线,DL4,73c8b98c-b368-11ea-a1a5-00012999830e
D5,D5,10.85.199.93,4D-5线,DL5,5436efd7-b432-11ea-a1a5-00012999830e
D6,D6,10.85.199.94,4D-6线,DL6,6b7710c1-b432-11ea-a1a5-00012999830e
D8,D8,10.85.199.95,4D-8线,DL8,8f039d2e-b432-11ea-a1a5-00012999830e
D9,D9,10.85.199.180,4D-9线,DL9,9e0b64ab-b432-11ea-a1a5-00012999830e
D10,D10,10.85.199.181,4D-10线,DL10,aec7da80-b432-11ea-a1a5-00012999830e
D11,D11,10.85.199.182,4D-11线,DL11,c10984c9-b432-11ea-a1a5-00012999830e
D12,D12,10.85.199.183,4D-12线,DL12,d6e0b92a-b432-11ea-a1a5-00012999830e
D14,D14,10.85.199.184,4D-14线,DL14,efb04c55-b432-11ea-a1a5-00012999830e
D15,D15,10.85.199.185,4D-15线,DL15,fd6b1f95-b432-11ea-a1a5-00012999830e
D16,D16,10.85.199.96,4D-16线,line_16,ac6c413e-895e-11ea-9374-000129922ca6
FeederIn,FeederIn,10.85.199.1,4D-FeedeerIn,FI,1e546c3a-8abe-11ea-ab63-000129922ca6
FeederOut,FeederOut,10.85.199.1,4D-FeederOut,FO,431649a4-8abe-11ea-ab63-000129922ca6
C1,C1,10.85.199.50,4C-1线,G1,d402fbc2-cdac-11ea-a3e4-94c691a7387d
C2,C2,10.85.199.51,4C-2线,G2,ce0d60e9-cdac-11ea-a3e4-94c691a7387d
C3,C3,10.85.199.52,4C-3线,G3,c768170a-cdac-11ea-a3e4-94c691a7387d
C4,C4,10.85.199.53,4C-4线,G4,c2de9745-cdac-11ea-a3e4-94c691a7387d
C5,C5,10.85.199.54,4C-5线,G5,be468ef4-cdac-11ea-a3e4-94c691a7387d
C6,C6,10.85.199.55,4C-6线,G6,b9117881-cdac-11ea-a3e4-94c691a7387d
C7,C7,10.85.199.56,4C-7线,G7,b3cda9db-cdac-11ea-a3e4-94c691a7387d
C8,C8,10.85.199.57,4C-8线,G8,ae09fc56-cdac-11ea-a3e4-94c691a7387d
C9,C9,10.85.199.62,4C-9线,G9,a64bdbbb-cdac-11ea-a3e4-94c691a7387d
C10,C10,10.85.199.59,4C-10线,G10,604b1c3c-ca4e-11ea-810b-00012999830e
C14,C14,10.85.199.60,4C-14线,G14,07841fc6-d0d4-11ea-a3e4-94c691a7387d
C15,C15,10.85.199.61,4C-15线,G15,0efca2c6-d0d4-11ea-a3e4-94c691a7387d
4CFeederIn,4CFeederIn,10.85.199.1,4C-FeederIn,G21,cb7f117b-ca88-11ea-9b28-0001299981d4
4CFeederOut,4CFeederOut,10.85.199.1,4C-FeederOut,G22,0fcf606c-d417-11ea-9b6b-0001299981d4
产线名,节点名,IP,产线别名,位置名称,位置guid
A5,A5,10.85.199.20,下料区(A5),PA5,7ed952c3-b520-11ea-b6ad-00012998f5a0
A6,A6,10.85.199.20,上料区(A6),PA6,929eb1c2-b520-11ea-b6ad-00012998f5a0
D3,D3,10.85.199.91,3D-3线,DL3,43855a9b-b365-11ea-a1a5-00012999830e
D4,D4,10.85.199.92,3D-4线,DL4,73c8b98c-b368-11ea-a1a5-00012999830e
D5,D5,10.85.199.93,3D-5线,DL5,5436efd7-b432-11ea-a1a5-00012999830e
D6,D6,10.85.199.94,3D-6线,DL6,6b7710c1-b432-11ea-a1a5-00012999830e
D7,D7,10.85.199.94,3D-7线,DL6,6b7710c1-b432-11ea-a1a5-00012999830e
D8,D8,10.85.199.95,3D-8线,DL8,8f039d2e-b432-11ea-a1a5-00012999830e
D9,D9,10.85.199.180,3D-9线,DL9,9e0b64ab-b432-11ea-a1a5-00012999830e
D10,D10,10.85.199.181,3D-10线,DL10,aec7da80-b432-11ea-a1a5-00012999830e
D11,D11,10.85.199.182,3D-11线,DL11,c10984c9-b432-11ea-a1a5-00012999830e
D12,D12,10.85.199.183,3D-12线,DL12,d6e0b92a-b432-11ea-a1a5-00012999830e
FeederIn,FeederIn,10.85.199.1,3D-FeedeerIn,FI,1e546c3a-8abe-11ea-ab63-000129922ca6
FeederOut,FeederOut,10.85.199.1,3D-FeederOut,FO,431649a4-8abe-11ea-ab63-000129922ca6
......@@ -42,11 +42,10 @@ namespace AGVControl
}
//Common.logTextBox = new TextBox();
//Common.missionView = new DataGridView();
Common.missionManager = new MissionManager();
Common.log = log4net.LogManager.GetLogger("AgvServer");
Common.log.Info("=====程序开始=====");
ReadConfig();
Common.ReadLinePlace();
//Common.ReadUnlockLineInfo();
Common.mir = new MiR_API();
Common.control = new BLL.Control();
......
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

using AGVControl;
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 AGVControl
{
/// <summary>
/// 空车返回待机位任务
/// </summary>
public class EmptyAGVBackJob : Job
{
/// <summary>
/// 出完满料后-空车返回任务
/// </summary>
/// <param name="agvPlae">小车当前位置,空表示在待机位</param>
/// <param name="palce">空料架位置点</param>
public EmptyAGVBackJob(string agvPlae)
{
this.agvPlace = agvPlae;
}
/// <summary>
/// 接收任务时,agv的位置
/// </summary>
private string agvPlace { get; set; }
private string runInfo = "";
/// <summary>
/// 运行信息
/// </summary>
public override string RunInfo
{
get { return runInfo; }
}
private JobStep<EMPTY_AGV_BACK_STEP> EmptyAGVBackStep = new JobStep<EMPTY_AGV_BACK_STEP>(EMPTY_AGV_BACK_STEP.NONE);
/// <summary>
/// 空车返回执行
/// </summary>
/// <param name="agv"></param>
public override Job Execute(Agv_Info agv)
{
string msg = agv.Name + " ";
bool rtn = false;
agv.Msg = runInfo;
//if (!CurTaskID.Equals(-1) && Common.mir.Get_Task_State(CurTaskID, out string st))
// CurTaskState = st;
CurTaskState = Common.GetTakJobState(CurTaskID);
if (EmptyAGVBackStep.IsStep(EMPTY_AGV_BACK_STEP.NONE))
{
if (Common.FindEmptyShelfNode(agv, out string nodeName, true))
{
int i = Common.agvInfo.FindIndex(s => s.CurJob is GoEmptyShelfLineJob && ((GoEmptyShelfLineJob)s.CurJob).EmptyShelfPlace.Equals(nodeName));
if(i==-1)
{
runInfo= "小车在产线 " + agvPlace + " 准备返回时检测到 " + nodeName + " 有空料架";
msg += runInfo;
EmptyAGVBackStep.Msg = msg;
return new GoEmptyShelfLineJob(agvPlace, nodeName);
}
else
{
if (agvPlace.StartsWith(SettingString.C4_Name_Prefix))
{
EmptyAGVBackStep.ToNextStep(EMPTY_AGV_BACK_STEP.WAIT_AGV_REACH_4D_DOOR);
runInfo= "从产线" + agvPlace + "回待机位,先到4D门";
msg += runInfo;
EmptyAGVBackStep.Msg = msg;
Common.DoorMission(agv, SettingString.DoorCToD);
UpdateJobTaskInfo(agv.CurTaskName, agv.CurTaskID);
}
else
{
EmptyAGVBackStep.ToNextStep(EMPTY_AGV_BACK_STEP.WAIT_REACH_STANDBY);
runInfo= "从产线" + agvPlace + "回待机位";
msg += runInfo;
EmptyAGVBackStep.Msg = msg;
Common.MoveToNode(agv, SettingString.Standby);
UpdateJobTaskInfo(agv.CurTaskName, agv.CurTaskID);
}
}
//EmptyAGVBackStep.ToNextStep(EMPTY_AGV_BACK_STEP.END);
}
else
{
if (agvPlace.StartsWith(SettingString.C4_Name_Prefix))
{
EmptyAGVBackStep.ToNextStep(EMPTY_AGV_BACK_STEP.WAIT_AGV_REACH_4D_DOOR);
runInfo= "从产线" + agvPlace + "回待机位,先到4D门";
msg += runInfo;
EmptyAGVBackStep.Msg = msg;
Common.DoorMission(agv, SettingString.DoorCToD);
UpdateJobTaskInfo(agv.CurTaskName, agv.CurTaskID);
}
else
{
EmptyAGVBackStep.ToNextStep(EMPTY_AGV_BACK_STEP.WAIT_REACH_STANDBY);
runInfo= "从产线" + agvPlace + "回待机位";
msg += runInfo;
EmptyAGVBackStep.Msg = msg;
Common.MoveToNode(agv, SettingString.Standby);
UpdateJobTaskInfo(agv.CurTaskName, agv.CurTaskID);
}
}
}
else if (EmptyAGVBackStep.IsStep(EMPTY_AGV_BACK_STEP.WAIT_REACH_STANDBY))
{
CurTaskState = Common.GetTakJobState(CurTaskID);
if (Common.CheckTaskFinished(agv, SettingString.Standby,CurTaskState))
{
Job job = Common.control.GetJob(agv);
if (job == null && agv.Battery < Common.chargeStatus.chargeMax)
{
runInfo= "到达待机位,电量[" + agv.Battery + "]小于最大电量[" + Common.chargeStatus.chargeMax + "],暂无任务,去充电";
msg += runInfo;
EmptyAGVBackStep.Msg = msg;
return new ChargeJob("");
}
else
{
runInfo= "到达待机位,检测到新任务,执行任务";
msg += runInfo;
EmptyAGVBackStep.Msg = msg;
return job;
}
}
else
{
if (Common.FindFullShelfTask(agv))
{
runInfo= "从产线" + agvPlace + "回待机位过程中,检测到A6出满料,去A6";
msg += runInfo;
EmptyAGVBackStep.Msg = msg;
return new GoFullShelfStationJob(SettingString.Standby);
}
//else
//{
// msg = "从产线" + agvPlace + "到达4D门,暂无任务,去充电位";
// EmptyAGVBackStep.Msg = msg;
// return new ChargeJob(SettingString.D4_DOOR_Name);
//}
}
}
//else if (EmptyAGVBackStep.IsStep(EMPTY_AGV_BACK_STEP.WAIT_AGV_REACH_4D_DOOR))
//{
// CurTaskState = Common.GetTakJobState(CurTaskID);
// if (Common.CheckTaskFinished(agv, SettingString.DoorCToD, CurTaskState))
// {
// EmptyAGVBackStep.ToNextStep(EMPTY_AGV_BACK_STEP.WAIT_REACH_STANDBY);
// runInfo = "从产线" + agvPlace + "回待机位";
// msg += runInfo;
// EmptyAGVBackStep.Msg = msg;
// }
//}
else if (EmptyAGVBackStep.IsStep(EMPTY_AGV_BACK_STEP.WAIT_AGV_REACH_4D_DOOR))
{
CurTaskState = Common.GetTakJobState(CurTaskID);
if (Common.CheckTaskFinished(agv, SettingString.DoorCToD, CurTaskState))
{
if (Common.FindFullShelfTask(agv))
{
runInfo = "从产线" + agvPlace + "到达4D门,检测到A6出满料,去A6";
msg += runInfo;
EmptyAGVBackStep.Msg = msg;
return new GoFullShelfStationJob(SettingString.DoorCToD);
}
else
{
runInfo = "从产线" + agvPlace + "到达4D门,暂无任务,去充电位";
msg += runInfo;
EmptyAGVBackStep.Msg = msg;
return new ChargeJob(SettingString.DoorCToD);
}
}
}
return this;
}
/// <summary>
/// AGV回收空料架流程
/// </summary>
private enum EMPTY_AGV_BACK_STEP
{
/// <summary>
/// 查询任务
/// </summary>
NONE,
/// <summary>
/// 等待到达4D门
/// </summary>
WAIT_AGV_REACH_4D_DOOR,
/// <summary>
/// 等待恒邑反馈
/// </summary>
WAIT_HY_RESPONSE,
/// <summary>
/// 等待AGV到达待机位
/// </summary>
WAIT_REACH_STANDBY,
/// <summary>
///
/// </summary>
END
}
}
}
此文件类型无法预览
<?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
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 Pause = "Pause";
static string Executing = "Executing";
static string Aborted = "Aborted";
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(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);
}
/// <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
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;
}
}
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;
}
));
}
}
}
<?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
<?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
此文件类型无法预览
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 int AGVCNT = 6;
//任务名称
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 Wait = "Wait";
public const string Done = "Done";
public const string Aborted = "Aborted";
public const string Executing = "Executing";
public const string Invalid = "Invalid";
public static List<string> RandomCharge_IPs = new List<string>() { "10.85.199.81" };
public const string DoubleLine_Name_Prefix = "A";
public const string FileName_AGV = "AgvName.csv";
public const string FileName_AgvMission = "AgvMission.csv";
public const string FileName_AgvProductionLine = "AgvProductionLine.csv";
public const string FileName_tempData = "tempData.ini";
public const string IsUse = "IsUse";
public const string RFID = "RFID";
public const string EmptyShelfCnt = "EmptyShelfCnt";
public const string EmptyShelfRFIDs = "EmptyShelfRFIDs";
public const string C4_STANDBY1 = "C4_STANDBY1";
public const string C4_STANDBY2 = "C4_STANDBY2";
public const string RoomCFeederIn = "C21";
public const string RoomDFeederIn = "D21";
public const string RoomCFeederOut = "C22";
public const string RoomDFeederOut = "D22";
public const string ChargeThreshold = "ChargeThreshold";
//双层线
public const string A6 = "A6";
public const string A5 = "A5";
public const string RoomD_Name_Prefix = "D";
public const string RoomC_Name_Prefix = "C";
public const string BigShelf_Prefix = "C";
public const string SmallShelf_Prefix = "D";
public const string RoomC_Name = "3C";
public const string RoomD_Name= "3D";
public const string IP_4D_Light = "IP_4D_Light";
public const string IP_4C_Light = "IP_4C_Light";
public static List<string> Lines_In_Air_Door = new List<string>() { "C100" };
public static List<string> RoomC_AGV_IPs = new List<string>() { "10.85.199.666"};
public static List<string> FixedCharge_AGV_IPs = new List<string>() { "10.85.199.666" };
#region 配置名
public const string ITS = "ITS";
public const string httpServer ="http.server";
public const string FLEET = "FLEET";
#endregion
}
}
此文件类型无法预览
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Threading;
using System.Xml;
using System.Windows.Forms;
using AGVControl;
namespace BLL
using System.Xml;
namespace Common
{
public class ConfigAppSettings
public class AppConfigHelper
{
public static System.Configuration.Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None);
public static string GetValue(string key)
{
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
Common.LogInfo("未找到配置:" + key + ",请检查配置是否完整!");
LogUtil.info("未找到配置:" + key + ",请检查配置是否完整!");
return "";
}
else
......@@ -29,10 +24,10 @@ namespace BLL
public static decimal GetNumValue(string key)
{
decimal a = 0;
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
//System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
Common.log.Error("未找到配置:" + key + ",请检查配置是否完整!");
LogUtil.error("未找到配置:" + key + ",请检查配置是否完整!");
return a;
}
else
......@@ -46,23 +41,45 @@ namespace BLL
public static int GetIntValue(string key)
{
int a = 0;
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
//System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
Common.log.Info("未找到配置:" + key + ",请检查配置是否完整!");
return a;
LogUtil.error("未找到配置:" + key + ",请检查配置是否完整!");
return a;
}
else
{
{
Int32.TryParse(config.AppSettings.Settings[key].Value, out a);
}
} return 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
......@@ -72,7 +89,7 @@ namespace BLL
return;
}
//增加的内容写在appSettings段下 <add key="RegCode" value="0"/>
System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
//System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
if (config.AppSettings.Settings[key] == null)
{
SetValue(key, value);
......@@ -84,7 +101,7 @@ namespace BLL
}
catch (Exception ex)
{
Common.log.Error( "SaveValue保存配置出错:AppKey=" + key + ",AppValue=" + value + "," + ex.StackTrace);
LogUtil.error("SaveValue保存配置出错:AppKey=" + key + ",AppValue=" + value + "," + ex.StackTrace);
}
}
......@@ -106,7 +123,7 @@ namespace BLL
}
catch (Exception ex)
{
Common.log.Error( "UpdateConfig保存配置出错:name=" + name + ",Xvalue=" + Xvalue + "," + ex.StackTrace);
LogUtil.error("UpdateConfig保存配置出错:name=" + name + ",Xvalue=" + Xvalue + "," + ex.StackTrace);
}
}
///<summary>
......@@ -138,8 +155,11 @@ namespace BLL
}
catch (Exception ex)
{
Common.log.Error( "SetValue保存配置出错:AppKey=" + AppKey + ",AppValue=" + AppValue + "," + ex.StackTrace);
LogUtil.error("SetValue保存配置出错:AppKey=" + AppKey + ",AppValue=" + AppValue + "," + ex.StackTrace);
}
}
}
}
......@@ -12,10 +12,8 @@ using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Reflection;
using System.Net.NetworkInformation;
using BLL;
using AGVControl;
namespace BLL
namespace Common
{
public class HttpHelper
{
......@@ -140,11 +138,11 @@ namespace BLL
wc.Encoding = encoding;
result = wc.UploadString(url, "POST", paramData);
//Common.LogInfo(result);
//LogUtil.info(result);
}
catch (Exception e)
{
Common.log.Error("POST ERROR:" + e.ToString());
LogUtil.error("POST ERROR:" + e.ToString());
}
if (!result.Contains("null") && result.Length != 0)
{
......@@ -166,19 +164,19 @@ namespace BLL
{
try
{
Common.log.Debug("HTTP GET FROM: " + url);
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();
Common.log.Debug("receive << " + result);
LogUtil.debug("receive << " + result);
return result;
}
}
catch (Exception e)
{
Common.log.Error("HTTP GET ERROR:" + e.Message);
LogUtil.error("HTTP GET ERROR:" + e.Message);
}
return "";
}
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace AGVControl
namespace Common
{
class IniHelper
public class IniFileHelper
{
[DllImport("kernel32")]
[System.Runtime.InteropServices.DllImport("kernel32")]
//section:要读取的段落名
//key: 要读取的键点击打开链接点击打开链接
//defVal: 读取异常的情况下的缺省值
......@@ -18,7 +17,7 @@ namespace AGVControl
//filePath: INI文件的完整路径和文件名
private static extern int GetPrivateProfileString(string section, string key, string defVal, StringBuilder retVal, int size, string filePath);
[DllImport("kernel32")]
[System.Runtime.InteropServices.DllImport("kernel32")]
//section: 要写入的段落名
//key: 要写入的键,如果该key存在则覆盖写入
//val: key所对应的值
......@@ -50,4 +49,5 @@ namespace AGVControl
WritePrivateProfileString(section, key, value, path);
}
}
}
using AGVControl;
using Newtonsoft.Json;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
namespace BLL
namespace Common
{
/// <summary>
/// Json帮助类
......@@ -74,14 +73,14 @@ namespace BLL
{
try
{
string path = Common.CONFIG_PATH + fileName + ".json";
string path = fileName + ".json";
string output = JsonConvert.SerializeObject(ts,Formatting.Indented);
File.WriteAllText(path, output);
}
catch (Exception e)
{
Common.log.Error(e.Message + "/r/n" + e.StackTrace);
LogUtil.error(e.Message + "/r/n" + e.StackTrace);
}
}
/// <summary>
......@@ -94,7 +93,7 @@ namespace BLL
{
try
{
string path = Common.CONFIG_PATH + fileName + ".json";
string path =fileName + ".json";
StreamReader streamReader = new StreamReader(path);
string jsonStr = streamReader.ReadToEnd();
List<T> jsonObj = DeserializeJsonToList<T>(jsonStr);
......@@ -103,7 +102,7 @@ namespace BLL
}
catch (Exception e)
{
Common.log.Error(e.Message + "/r/n" + e.StackTrace);
LogUtil.error(e.Message + "/r/n" + e.StackTrace);
return null;
}
}
......
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_SMD");
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);
}
}
}
......@@ -4,7 +4,7 @@ using System.Linq;
using System.Net;
using System.Text;
namespace BLL
namespace Common
{
public class MyWebClient:WebClient
{
......
using AGVControl;
using System;
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
using Common;
using System.Threading;
namespace BLL
namespace DeviceLibrary
{
/// <summary>
/// AGV服务端
/// </summary>
public class AgvServer
{
private static log4net.ILog log = log4net.LogManager.GetLogger("AgvServer");
private bool _loop;
private Socket _server; //服务端
private List<Client> _client; //所有客户端
......@@ -51,7 +52,7 @@ namespace BLL
_server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
_server.Bind(localEP);
_server.Listen(100);
Common.log.Info("Server Start");
log.Info("Server Start");
_loop = true;
_client = new List<Client>();
tListenClient = new Thread(new ThreadStart(ListenClient));
......@@ -61,7 +62,7 @@ namespace BLL
}
catch (Exception ex)
{
Common.log.Error("Start()", ex);
log.Error("Start()", ex);
}
}
......@@ -80,11 +81,11 @@ namespace BLL
_server.Close();
_client = null;
Thread.Sleep(50);
Common.LogInfo("Server Stop");
log.Info("Server Stop");
}
public Dictionary<string, DateTime> readyEnterTime = new Dictionary<string, DateTime>();
public Dictionary<string, DateTime> readyLeaveTime = new Dictionary<string, DateTime>();
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 = Common.nodeInfo.FindIndex(s => s.Name == nodeName);
......@@ -117,7 +118,7 @@ namespace BLL
}
}
}
catch(Exception ex) { Common.log.Debug(ex.Message +";"+ex.StackTrace); }
catch (Exception ex) { Common.log.Debug(ex.Message + ";" + ex.StackTrace); }
ClientNode node = new ClientNode(nodeName, rfid, eNodeStatus.ReadyEnter);
byte[] buff = Encode(node);
......@@ -502,7 +503,7 @@ namespace BLL
if (!Common.nodeInfo[idx].StateEquals(node.GetState()) ||
Common.nodeInfo[idx].RFID != node.RFID || Common.nodeInfo[idx].ClientLevel != node.ClientLevel)
{
Common.nodeInfo[idx].UpdateNodeStatus(node.GetState());
Common.nodeInfo[idx].ClientLevel = node.ClientLevel;
Common.nodeInfo[idx].RFID = node.RFID;
......@@ -611,4 +612,36 @@ namespace BLL
}
/// <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
using Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
public class ChargeManager
{
/// <summary>
/// 充电站
/// </summary>
public Dictionary<string, string> Station;
public const string AutoCharge1 = "AutoCharge1";
public const string AutoCharge2 = "AutoCharge2";
/// <summary>
/// 充电最大电量,小于该值或大于等待指定时间去充电
/// </summary>
public int BatteryMax { get; set; } = 90;
/// <summary>
/// 充电最小电量,小于该值直接去充电
/// </summary>
public int BatteryMin { get; set; } = 20;
/// <summary>
/// 自动充电
/// </summary>
private bool _autoCharge = true;
/// <summary>
/// 自动充电
/// </summary>
public bool AutoCharge
{
set
{
_autoCharge = value;
AppConfigHelper.SaveValue(SettingString.AutoCharge, value);
}
get
{
return _autoCharge;
}
}
public ChargeManager()
{
Station = new Dictionary<string, string>();
Station.Add(AutoCharge1, "");
Station.Add(AutoCharge2, "");
_autoCharge = AppConfigHelper.GetBoolValue(SettingString.AutoCharge);
string s = AppConfigHelper.GetValue(SettingString.ChargeThreshold);
string[] arr = s.Split(',');
BatteryMin = Convert.ToInt32(arr[0]);
BatteryMax = Convert.ToInt32(arr[1]);
}
/// <summary>
/// 在空的充电桩添加占用小车
/// </summary>
/// <param name="chargeName">占用充电桩的名称</param>
/// <returns></returns>
public bool AddOccupyInfo(string chargeName,string agvName)
{
if (agvName.Equals(""))
return false;
if (Station.Keys.Contains(chargeName))
{
Station[chargeName] = agvName;
return true;
}
return false;
}
private static object loc = new object();
/// <summary>
/// 清除占用信息
/// </summary>
/// <param name="chargeName"></param>
/// <returns></returns>
public bool DelOccupyInfo(string agvName)
{
lock(loc)
{
if (Station.Values.Contains(agvName))
{
foreach (string item in Station.Keys)
{
if (Station[item].Equals(agvName))
{
Station[item] = "";
return true;
}
}
}
}
return false;
}
/// <summary>
/// 清除agv占用信息
/// </summary>
/// <param name="chargeName"></param>
/// <returns></returns>
public void DelOccupyInfoByAGV(Agv_Info agv)
{
lock(loc)
{
foreach (string item in Station.Keys)
{
if (Station[item].Equals(agv.Name))
{
Station[item] = "";
break;
}
}
}
}
public void ClearAllOccupyInfo()
{
lock(loc)
{
if (Station != null && Station.Count > 0)
{
foreach (var item in Station.Keys)
{
Station[item] = "";
}
}
}
}
public bool HasEmptyChargeStation(Agv_Info agv)
{
lock(loc)
{
if (SettingString.FixedCharge_AGV_IPs.Contains(agv.IP))//固定充电小车
return true;
else
{
if (Station[AutoCharge2].Equals(""))
{
return true;
}
}
//foreach (string item in Station.Keys)
//{
// if (Station[item].Equals(""))
// {
// return true;
// }
//}
}
return false;
}
/// <summary>
/// 开始充电任务
/// </summary>
/// <param name="agv"></param>
/// <returns>充电任务结果</returns>
public bool StartCharge(Agv_Info agv)
{
bool rtn;
string log;
agv.Place = "";
lock(loc)
{
foreach (string chargeStation in Station.Keys)
{
if (Station[chargeStation].Equals(""))
{
rtn = MissionSys.AssignMission(agv, chargeStation);
if (rtn)
{
Station[chargeStation] = agv.Name;
agv.Place = SettingString.AutoCharge;
log = string.Format("{0} {1}", agv.Name, chargeStation);
LogUtil.info(log);
MiR_API.State_Ready(agv);
}
else
{
Station[chargeStation] = "";
log = string.Format("{0} {1}失败", agv.Name, chargeStation);
LogUtil.info(log);
}
return true;
}
}
}
return false;
}
}
}
任务别称,任务名称,任务GUID
移动到VMI出口,MoveA1,eec1eed4-2a04-11ea-9c84-94c691a734f1
移动到VMI入口,MoveA2,f68f18db-2f89-11ea-9ee4-94c691a734f1
移动到包装线入口,MoveA3,979d10eb-2f9d-11ea-9ee4-94c691a734f1
移动到包装线出口,MoveA4,df6d991a-2f9d-11ea-9ee4-94c691a734f1
移动到分盘线出口,MoveA7,71e01c6d-de10-11ea-a3e4-94c691a7387d
移动到分盘线入口,MoveA8,cd0544f8-de10-11ea-a3e4-94c691a7387d
移动到包装仓10-1,MoveB1,86a6ab06-261e-11ea-a30e-94c691a73861
移动到包装仓10-2,MoveB2,55fcfdc5-2623-11ea-a30e-94c691a73861
移动到包装仓11-1,MoveB3,905399c8-2623-11ea-a30e-94c691a73861
移动到包装仓11-2,MoveB4,aa33e13a-2623-11ea-a30e-94c691a73861
移动到包装仓12-2,MoveB5,2cd36cde-2624-11ea-a30e-94c691a73861
移动到包装仓12-1,MoveB6,3e713e8b-2624-11ea-a30e-94c691a73861
停靠到包装仓10-1,DockB1,339d1830-261f-11ea-a30e-94c691a73861
停靠到包装仓10-2,DockB2,a6d6f52a-2624-11ea-a30e-94c691a73861
停靠到包装仓11-1,DockB3,b66f0714-2624-11ea-a30e-94c691a73861
停靠到包装仓11-2,DockB4,d01443f2-2624-11ea-a30e-94c691a73861
停靠到包装仓12-2,DockB5,f50dd02b-2624-11ea-a30e-94c691a73861
停靠到包装仓12-1,DockB6,0e5503f2-2625-11ea-a30e-94c691a73861
移动到料串入口C1,MoveC1,a6e36b4c-2fa0-11ea-9ee4-94c691a734f1
移动到料串出口C2,MoveC2,6c6829de-2624-11ea-a30e-94c691a73861
移动到料串入口C3,MoveC3,3ffe309f-2ae6-11ea-a6cf-94c691a734f1
移动到料串出口C4,MoveC4,2ef71347-2ae7-11ea-a6cf-94c691a734f1
移动到料串入口C5,MoveC5,34ec2f1f-2ae8-11ea-a6cf-94c691a734f1
移动到料串出口C6,MoveC6,52f37677-2f96-11ea-9ee4-94c691a734f1
移动到紧急入料口,MoveC7,bcd0e389-2ab7-11ea-a6cf-94c691a734f1
移动到紧急出料口,MoveC8,8a48301d-2624-11ea-a30e-94c691a73861
移动到点料机D1口,MoveD1,931f7c6c-a97d-11ea-b91f-94c691a7387d
移动到点料机D2口,MoveD2,ae09ca1e-a97f-11ea-b91f-94c691a7387d
移动到点料机D3口,MoveD3,97b77df3-edfb-11ea-a03e-94c691a7387d
移动到点料机D4口,MoveD4,37961cd0-edfd-11ea-a03e-94c691a7387d
移动到退料线入口,MoveG23,5dc60886-ee00-11ea-a03e-94c691a7387d
移动到退料线出口,MoveG24,9a965176-ee00-11ea-a03e-94c691a7387d
移动到待机位,MoveStandby,4eb9641a-3439-11ea-984a-94c691a734f1
移动到充电位1,AutoCharge1,9e1b33c0-2886-11ea-a0d6-94c691a734f1
移动到充电位2,AutoCharge2,d756f63d-2886-11ea-a0d6-94c691a734f1
小车进料,Enter,2eadcb87-239a-11ea-8343-94c691a73861
小车出料,Leave,80943220-239a-11ea-8343-94c691a73861
小车初始化,Init,cd51e039-34eb-11ea-b4fe-94c691a734f1
Fleet ID,agv名称,IP,授权码,IOID
1,1号车,10.85.199.67,Basic ZGlzdHJpYnV0b3I6NjJmMmYwZjFlZmYxMGQzMTUyYzk1ZjZmMDU5NjU3NmU0ODJiYjhlNDQ4MDY0MzNmNGNmOTI5NzkyODM0YjAxNA==,007615a5-2220-11ea-99f2-94c691a73b53
2,2号车,10.85.199.68,Basic ZGlzdHJpYnV0b3I6NjJmMmYwZjFlZmYxMGQzMTUyYzk1ZjZmMDU5NjU3NmU0ODJiYjhlNDQ4MDY0MzNmNGNmOTI5NzkyODM0YjAxNA==,007615a5-2220-11ea-99f2-94c691a73b53
3,3号车,10.85.199.69,Basic ZGlzdHJpYnV0b3I6NjJmMmYwZjFlZmYxMGQzMTUyYzk1ZjZmMDU5NjU3NmU0ODJiYjhlNDQ4MDY0MzNmNGNmOTI5NzkyODM0YjAxNA==,007615a5-2220-11ea-99f2-94c691a73b53
4,4号车,10.85.199.70,Basic ZGlzdHJpYnV0b3I6NjJmMmYwZjFlZmYxMGQzMTUyYzk1ZjZmMDU5NjU3NmU0ODJiYjhlNDQ4MDY0MzNmNGNmOTI5NzkyODM0YjAxNA==,007615a5-2220-11ea-99f2-94c691a73b53
\ No newline at end of file
节点名,别名,佳世达线名
A1,A1,VMI-A1出口
A2,A2,VMI-A2入口
A7,A7,分盘线-A7出口
A8,A8,分盘线-A8入口
T1_1,T1_1,入料T1入口
T1_2,T1_2,入料T1出口
T2_1,T2_1,入料T2入口
T2_2,T2_2,入料T2出口
T3_1,T3_1,入料T3入口
T3_2,T3_2,入料T3出口
T5_1,T5_1,入料T5入口
T5_2,T5_2,入料T5出口
T4_1,T4_1,紧急料T4入口
T4_2,T4_2,紧急料T4出口
D1,D1,点料机-D1入口
D2,D2,点料机-D2出口
D3,D3,点料机-D3口
D4,D4,点料机-D4口
\ 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.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\job\ChargeJob.cs" />
<Compile Include="bean\job\EmptyAGVBackJob.cs" />
<Compile Include="bean\job\EmptyShelfBackJob.cs" />
<Compile Include="bean\job\EnterLeaveShelfJob.cs" />
<Compile Include="bean\job\GoEmptyShelfLineJob.cs" />
<Compile Include="bean\job\GoFullShelfStationJob.cs" />
<Compile Include="bean\job\jobType\JobForRoomC.cs" />
<Compile Include="bean\job\jobType\JobForRoomD.cs" />
<Compile Include="bean\job\SendFullShelfToLineJob.cs" />
<Compile Include="bean\Mission.cs" />
<Compile Include="bean\node\ClientNode.cs" />
<Compile Include="bean\Node.cs" />
<Compile Include="Control.cs" />
<Compile Include="manager\HttpManager.cs" />
<Compile Include="AgvServer.cs" />
<Compile Include="bean\Job.cs" />
<Compile Include="bean\JobStep.cs" />
<Compile Include="bean\JobType.cs" />
<Compile Include="bean\job\jobType\ChargeJobType.cs" />
<Compile Include="Charge.cs" />
<Compile Include="manager\AGVManager.cs" />
<Compile Include="DisplayBoard.cs" />
<Compile Include="bean\MiR_API.cs" />
<Compile Include="MissionSys.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ScopeLimit.cs" />
<Compile Include="Shelf.cs" />
<Compile Include="Standby.cs" />
<Compile Include="unlock\LineWebService.cs" />
<Compile Include="unlock\UnlockedShelf.cs" />
<Compile Include="unlock\UnlockMissionManager.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 />
<ItemGroup>
<None Include="Config\AgvMission.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Config\AgvName.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Config\AgvProductionLine.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ 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 Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
/// <summary>
/// 任务系统
/// </summary>
public class MissionSys
{
/// <summary>
/// 任务列表
/// </summary>
public static List<Mission> Missions;
/// <summary>
/// 根据任务名获取guid号
/// </summary>
/// <param name="taskName"></param>
/// <returns></returns>
public static string GetMissionGuidByName(string taskName)
{
Mission mission = Missions.Find(s => s.Name.Equals(taskName));
return mission.Guid;
}
/// <summary>
/// 向小车发送任务
/// </summary>
/// <returns></returns>
public static bool AssignMission(Agv_Info agv,string missionName)
{
bool rtn = false;
string guid = GetMissionGuidByName(missionName);
if (!guid.Equals(""))
{
if (agv.UseFleet)
{
rtn = MiR_API.Add_Mission_Fleet(agv, guid);
MiR_API.State_Ready(agv);
if (rtn)
{
LogUtil.info(string.Format("{0} Add_Mission_Fleet [{1}] OK", agv.Name, missionName));
}
else
{
LogUtil.info(string.Format("{0} Add_Mission_Fleet [{1}] Fail", agv.Name, missionName));
}
}
else
{
rtn = MiR_API.Add_Mission(agv, guid);
MiR_API.State_Ready(agv);
if (rtn)
{
LogUtil.info(string.Format("{0} Add_Mission [{1}] OK", agv.Name, missionName));
}
else
{
LogUtil.info(string.Format("{0} Add_Mission [{1}] Fail", agv.Name, missionName));
}
}
}
return rtn;
}
/// <summary>
/// 删除任务
/// </summary>
/// <returns></returns>
public static void DelMission(Agv_Info agv)
{
if (agv.UseFleet)
{
MiR_API.Del_Mission_Fleet(agv, agv.CurTaskGUID);
}
else
{
MiR_API.Del_Mission(agv);
}
LogUtil.info(string.Format("{0} DelMission [{1}] OK", agv.Name, agv.CurTaskName));
}
/// <summary>
/// 检查当前任务是否结束
/// </summary>
/// <param name="taskName">任务名称</param>
/// <param name="taskGUID">任务GUID</param>
/// <returns></returns>
public static bool CheckTaskFinished(Agv_Info agv,string taskName, string curTaskState)
{
LogUtil.debug(agv.Name + " 检查当前任务是否结束: " + taskName + " " + curTaskState);
return GetMissionGuidByName(taskName).Equals(agv.CurTaskGUID) && curTaskState.Equals(SettingString.Done);
}
/// <summary>
/// 检查当前是否分配成功
/// </summary>
/// <param name="taskName">任务名称</param>
/// <param name="taskGUID">任务GUID</param>
/// <returns></returns>
public static bool CheckTaskIsOK(Agv_Info agv, string taskName, string curTaskState)
{
return GetMissionGuidByName(taskName).Equals(agv.CurTaskGUID) && curTaskState.Equals(SettingString.Executing);
}
/// <summary>
/// 获取Fleet Job任务状态
/// </summary>
/// <param name="CurTaskID"></param>
/// <returns></returns>
public static string GetTakJobState(int CurTaskID)
{
if (!CurTaskID.Equals(-1) && MiR_API.Get_Task_State(CurTaskID, out string st))
return st;
return SettingString.Wait;
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("DeviceLibrary")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DeviceLibrary")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("f9619f07-15f1-4e59-a383-3871952bbb79")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
此文件类型无法预览
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
namespace DeviceLibrary
{
//public class ScopeLimit
//{
// List<string> agvIPs;
// //不规则图像坐标
// List<Agv_Info.AgvPosition> positions;
// Thread threadPoll;//监控线程
// /// <summary>
// /// 区域是否可用
// /// </summary>
// public bool Available { get; private set; } = true;
// public delegate void ScopeLimitStateChangedEventHandler(string ip, bool state);
// public event ScopeLimitStateChangedEventHandler ScopeLimitStateChangedEvent;
// public ScopeLimit(List<Agv_Info.AgvPosition> positions)
// {
// agvIPs = new List<string>();
// agvIPs.AddRange(new string[]
// {
// "10.85.199.68",
// "10.85.199.69",
// "10.85.199.70",
// "10.85.199.71",
// "10.85.199.72",
// "10.85.199.73",
// "10.85.199.74",
// "10.85.199.80",
// "10.85.199.81",
// "10.85.199.114"
// });
// this.positions = positions;
// threadPoll = new Thread(ScopeDetecting);
// threadPoll.IsBackground = true;
// threadPoll.Start();
// }
// private void ScopeDetecting()
// {
// bool rtn;
// while (true)
// {
// Thread.Sleep(5000);
// List<string> agvs = new List<string>();
// foreach (string ip in agvIPs)
// {
// Thread.Sleep(1000);
// rtn = MiR_API.Get_Position(ip, AGVManager.agvInfo[0].Authorization, out Agv_Info.AgvPosition position);
// if (rtn)
// {
// if (IsInPolygon(position, positions))
// {
// agvs.Add(ip);
// }
// }
// }
// if (agvs.Count > 0)
// {
// Available = false;
// ScopeLimitStateChangedEvent?.Invoke(string.Join(";", agvs), Available);
// }
// else //不在限制区域
// {
// if (!Available)
// {
// Available = true;
// ScopeLimitStateChangedEvent?.Invoke("", Available);
// }
// }
// }
// }
// /// <summary>
// /// 判断点是否在多边形内.
// /// ----------原理----------
// /// 注意到如果从P作水平向左的射线的话,如果P在多边形内部,那么这条射线与多边形的交点必为奇数,
// /// 如果P在多边形外部,则交点个数必为偶数(0也在内)。
// /// </summary>
// /// <param name="checkPoint">要判断的点</param>
// /// <param name="polygonPoints">多边形的顶点</param>
// /// <returns></returns>
// bool IsInPolygon(Agv_Info.AgvPosition checkPoint, List<Agv_Info.AgvPosition> polygonPoints)
// {
// bool inside = false;
// int pointCount = polygonPoints.Count;
// Agv_Info.AgvPosition p1, p2;
// for (int i = 0, j = pointCount - 1; i < pointCount; j = i, i++)//第一个点和最后一个点作为第一条线,之后是第一个点和第二个点作为第二条线,之后是第二个点与第三个点,第三个点与第四个点...
// {
// p1 = polygonPoints[i];
// p2 = polygonPoints[j];
// if (checkPoint.y < p2.y)
// {//p2在射线之上
// if (p1.y <= checkPoint.y)
// {//p1正好在射线中或者射线下方
// if ((checkPoint.y - p1.y) * (p2.x - p1.x) > (checkPoint.x - p1.x) * (p2.y - p1.y))//斜率判断,在P1和P2之间且在P1P2右侧
// {
// //射线与多边形交点为奇数时则在多边形之内,若为偶数个交点时则在多边形之外。
// //由于inside初始值为false,即交点数为零。所以当有第一个交点时,则必为奇数,则在内部,此时为inside=(!inside)
// //所以当有第二个交点时,则必为偶数,则在外部,此时为inside=(!inside)
// inside = (!inside);
// }
// }
// }
// else if (checkPoint.y < p1.y)
// {
// //p2正好在射线中或者在射线下方,p1在射线上
// if ((checkPoint.y - p1.y) * (p2.x - p1.x) < (checkPoint.x - p1.x) * (p2.y - p1.y))//斜率判断,在P1和P2之间且在P1P2右侧
// {
// inside = (!inside);
// }
// }
// }
// return inside;
// }
//}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
public enum eShelfType
{
BigShelf,
SmallShelf
}
class Shelf
{
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
public class Standby
{
/// <summary>
/// 待机位
/// </summary>
public List<string> Station;
private const int Station_CNT = 4;
public Standby()
{
Station = new List<string>();
Station.AddRange(new string[Station_CNT]);
}
/// <summary>
/// 在空的待机位添加占用小车
/// </summary>
/// <param name="standName">占用待机位的名称</param>
/// <returns></returns>
public bool AddOccupyInfo(string standName)
{
if (standName.Equals(""))
return false;
int i = Station.FindIndex(s => (s == null || s.Equals("")));
if (i > -1)
{
Station[i] = standName;
return true;
}
return false;
}
/// <summary>
/// 清除占用信息
/// </summary>
/// <param name="standName"></param>
/// <returns></returns>
public bool DelOccupyInfo(string standName)
{
if (standName.Equals(""))
return false;
int i = Station.FindIndex(s => s != null && s.Equals(standName));
if (i > -1)
{
Station[i] = "";
return true;
}
return false;
}
public void ClearAllInfo()
{
if (Station != null && Station.Count > 0)
{
Station.Clear();
Station = new List<string>();
Station.AddRange(new string[Station_CNT]);
}
}
public string GetInfoByID(int index)
{
if (Station ==null ||index<0 || index >= Station_CNT || Station[index] ==null)
return "";
else
return Station[index];
}
}
}
using AGVControl;
using System;
using System.Collections.Generic;
namespace AGVControl
using Common;
namespace DeviceLibrary
{
public abstract class Job
{
......@@ -40,8 +37,7 @@ namespace AGVControl
{
CurTaskID = curTaskId;
CurTaskName = curTaskName;
//CurTaskState = SettingString.Wait;
CurTaskState = Common.GetTakJobState(CurTaskID);
CurTaskState = MissionSys.GetTakJobState(CurTaskID);
}
/// <summary>
/// 任务重发
......@@ -50,11 +46,11 @@ namespace AGVControl
public bool ResendTask(Agv_Info agv)
{
bool rtn = false;
if (!CurTaskID.Equals(-1) && Common.mir.Get_Task_State(CurTaskID, out string stateStr))
if (!CurTaskID.Equals(-1) && MiR_API.Get_Task_State(CurTaskID, out string stateStr))
{
if (stateStr.Equals(SettingString.Aborted))
if (stateStr.Equals(SettingString.Aborted) || stateStr.Equals(SettingString.Invalid))
{
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission[CurTaskName]);
rtn = MissionSys.AssignMission(agv, CurTaskName);
if (rtn)
{
UpdateJobTaskInfo(agv.CurTaskName, agv.CurTaskID);
......@@ -63,9 +59,9 @@ namespace AGVControl
}
}
else if (!CurTaskName.Equals("") && !Common.agvMission[CurTaskName].Equals(agv.CurTaskGUID))//Job的当前任务与agv最新任务不一致
else if (!CurTaskName.Equals("") && !MissionSys.GetMissionGuidByName(CurTaskName).Equals(agv.CurTaskGUID))//Job的当前任务与agv最新任务不一致
{
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission[CurTaskName]);
rtn = MissionSys.AssignMission(agv, CurTaskName);
if (rtn)
{
UpdateJobTaskInfo(agv.CurTaskName, agv.CurTaskID);
......@@ -74,7 +70,7 @@ namespace AGVControl
}
else if (CurTaskID.Equals(-1))//任务发送失败,重新发送
{
rtn = Common.mir.Add_Mission_Fleet(agv, Common.agvMission[CurTaskName]);
rtn = MissionSys.AssignMission(agv, CurTaskName);
if (rtn)
{
UpdateJobTaskInfo(agv.CurTaskName, agv.CurTaskID);
......
using AGVControl;

using Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AGVControl
namespace DeviceLibrary
{
public class JobStep<T> where T : Enum
{
......@@ -18,11 +19,10 @@ namespace AGVControl
{
if (!string.IsNullOrEmpty(value))
{
value = step.ToString() + ":" + value;
//不为空,且与上一个消息不一样才打印
if (!value.Equals(msg))
{
Common.LogInfo(value);
LogUtil.info(value);
}
}
msg = value;
......@@ -75,6 +75,10 @@ namespace AGVControl
startTime = DateTime.Now;
}
public void ResetStartTime()
{
startTime = DateTime.Now;
}
public string CurStep()
{
return step.ToString();
......
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.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
public class Mission
{
/// <summary>
/// 任务名称
/// </summary>
public string Name { private set; get; }
/// <summary>
/// 任务别名
/// </summary>
public string AliceName { private set; get; }
/// <summary>
/// 目的地名称(节点名)
/// </summary>
public string TargetName { private set; get; }
/// <summary>
/// 任务guid
/// </summary>
public string Guid { private set; get; }
public Mission(string name,string aliceName,string targetName,string guid)
{
Name = name;
AliceName = aliceName;
TargetName = targetName;
Guid = guid;
}
}
}
......@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Windows.Forms;
namespace AGVControl
namespace DeviceLibrary
{
public abstract class Node
{
......@@ -41,7 +41,11 @@ namespace AGVControl
{
Name = name;
}
/// <summary>
/// 状态比较
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public bool StateEquals(eNodeStatus obj)
{
return nodeStatus.Equals(obj);
......

namespace DeviceLibrary
{
/// <summary>
/// 待机任务
/// </summary>
public class ChargeJobType : JobType
{
/// <summary>
/// 待机任务
/// </summary>
/// <param name="currentAgv"></param>
/// <returns></returns>
public override Job GetNewJob(Agv_Info currentAgv)
{
if (currentAgv.Battery < AGVManager.Charge.BatteryMax - 10 && AGVManager.Charge.HasEmptyChargeStation(currentAgv))
{
return new ChargeJob(currentAgv.Place);
}
else
{
return new StandyJob(currentAgv.Place);
}
}
}
}
......@@ -3,18 +3,14 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AGVControl
using Common;
namespace DeviceLibrary
{
/// <summary>
/// 双层线有料料架出口
/// C车间任务
/// </summary>
public class DoubleLineNodeFor4C : ClientNode
public class JobForRoomC : JobType
{
public DoubleLineNodeFor4C(string name, string ip, string aliceName, string lineName, string pos_name, string pos_guid, bool isUse, int emptyCnt) : base(name, ip, aliceName, lineName, pos_name, pos_guid, isUse, emptyCnt)
{
}
/// <summary>
/// 双层线任务
/// </summary>
......@@ -22,35 +18,34 @@ namespace AGVControl
/// <returns></returns>
public override Job GetNewJob(Agv_Info currentAgv)
{
if (!SettingString.C4_AGV_IPs.Contains(currentAgv.IP))
if (!SettingString.RoomC_AGV_IPs.Contains(currentAgv.IP))
return null;
if (!Common.CheckCanExecuteMission(currentAgv))
if (!AGVManager.CheckCanExecuteMission(currentAgv))
return null;
if (!Common.CheckAGVStatusNone(currentAgv))
if (!AGVManager.CheckAGVStatusNone(currentAgv))
return null;
string rfid = "";
List<Agv_Info> agvs = AGVManager.agvInfo.FindAll(s => SettingString.RoomC_AGV_IPs.Contains(s.IP) && (s.CurJob is GoEmptyShelfLineJob || (s.CurJob is EmptyShelfBackJob)));
//执行空料架任务的小车数量
int emptyJobCnt = 0;
foreach (Agv_Info agv in Common.agvInfo)
{
if (!SettingString.C4_AGV_IPs.Contains(agv.IP))
continue;
if (agv.CurJob is GoEmptyShelfLineJob || agv.CurJob is EmptyShelfBackJob)
{
emptyJobCnt++;
}
}
if ((SettingString.AGVCNT - emptyJobCnt).Equals(2))//保留2辆小车出满料架
{
return null;
}
int emptyJobCnt = agvs.Count;
//foreach (Agv_Info agv in AGVManager.agvInfo)
//{
// if (!SettingString.RoomC_AGV_IPs.Contains(agv.IP))
// continue;
// if (agv.CurJob is GoEmptyShelfLineJob || (agv.CurJob is EmptyShelfBackJob))
// {
// emptyJobCnt++;
// }
//}
//出工单料的目的地是否有空料架
if (Common.FindEmptyShelfBeforeSendFullShelf(out string nodeName))
if (AGVManager.FindEmptyShelfBeforeSendFullShelf(out string nodeName))
{
if (nodeName.StartsWith(SettingString.C4_Name_Prefix) && SettingString.C4_AGV_IPs.Contains(currentAgv.IP))
if (nodeName.StartsWith(SettingString.RoomC_Name_Prefix) && SettingString.RoomC_AGV_IPs.Contains(currentAgv.IP))
{
ClientNode clientNode = Common.nodeInfo.Find(s => s.Name.Equals(nodeName));
ClientNode clientNode = AGVManager.nodeInfo.Find(s => s.Name.Equals(nodeName));
int cnt = 0;
foreach (Agv_Info agv in Common.agvInfo)
foreach (Agv_Info agv in AGVManager.agvInfo)
{
if (agv.CurJob is GoEmptyShelfLineJob)
{
......@@ -60,36 +55,71 @@ namespace AGVControl
}
if (cnt < clientNode.EmptyShelfCnt)
{
return new GoEmptyShelfLineJob(currentAgv.Place, nodeName);
if (AGVManager.CheckStationState(clientNode, out rfid) && CanEmptyTask(emptyJobCnt))
return new GoEmptyShelfLineJob(currentAgv.Place, nodeName, rfid);
}
}
}
//回收空料架
if (Common.FindEmptyShelfNode(currentAgv, out string emptyNodeName))
if (AGVManager.FindEmptyShelfNode(currentAgv, out string emptyNodeName))
{
if (SettingString.C4_AGV_IPs.Contains(currentAgv.IP))
if (SettingString.RoomC_AGV_IPs.Contains(currentAgv.IP))
{
int i = Common.agvInfo.FindIndex(s => s.CurJob is GoEmptyShelfLineJob && ((GoEmptyShelfLineJob)s.CurJob).EmptyShelfPlace.Equals(emptyNodeName));
int i = AGVManager.agvInfo.FindIndex(s => s.CurJob is GoEmptyShelfLineJob && ((GoEmptyShelfLineJob)s.CurJob).EmptyShelfPlace.Equals(emptyNodeName));
if (i == -1)
return new GoEmptyShelfLineJob(currentAgv.Place, emptyNodeName);
{
ClientNode clientNode = AGVManager.nodeInfo.Find(s => s.Name.Equals(emptyNodeName));
if (AGVManager.CheckStationState(clientNode, out rfid) && CanEmptyTask(emptyJobCnt))
return new GoEmptyShelfLineJob(currentAgv.Place, emptyNodeName, rfid);
}
}
}
//出满料
if (Common.FindFullShelfTask(currentAgv))
if (AGVManager.FindFullShelfTask(currentAgv))
{
if (SettingString.C4_AGV_IPs.Contains(currentAgv.IP))
if (SettingString.RoomC_AGV_IPs.Contains(currentAgv.IP))
{
int i = Common.agvInfo.FindIndex(s => s.CurJob is GoFullShelfStationJob && !s.IP.Equals(currentAgv.IP));
if (i == -1)
return new GoFullShelfStationJob(currentAgv.Place);
ClientNode node = AGVManager.nodeInfo.Find(s => s.Name.Equals(SettingString.A6)
&& (s.StateEquals(eNodeStatus.NeedLeave) || s.StateEquals(eNodeStatus.NeedEnterLeave)) && !s.RFID.Equals("00"));
if (node != null && node.Name.Equals(SettingString.A6))
{
if (HttpManager.FindFullShelfTarget(node.RFID, out HttpManager.BoxDestInfo boxDestInfo))
{
if (boxDestInfo != null)
{
ClientNode clientNode = AGVManager.nodeInfo.Find(s => s.Name.Equals(boxDestInfo.location));
if (!AGVManager.CheckStationState(clientNode))
{
return null;
}
}
}
}
int i = AGVManager.agvInfo.FindIndex(s => s.CurJob is GoFullShelfStationJob && !s.IP.Equals(currentAgv.IP));
if (i == -1)
return new GoFullShelfStationJob(currentAgv.Place);
}
}
return null;
}
/// <summary>
/// 控制出空架小车数量
/// </summary>
/// <param name="emptytASKAGV"></param>
/// <returns></returns>
private bool CanEmptyTask(int emptytASKAGV)
{
if ((SettingString.AGVCNT / 2 - emptytASKAGV).Equals(2))//保留1辆小车出满料架
{
return false;
}
return true;
}
}
}
using BLL;
using log4net.Util;
using System;

using Common;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AGVControl
namespace DeviceLibrary
{
/// <summary>
///
/// D车间任务
/// </summary>
public class DoubleLineNodeFor4D : ClientNode
public class JobForRoomD : JobType
{
public DoubleLineNodeFor4D(string name, string ip, string aliceName, string lineName, string pos_name, string pos_guid, bool isUse, int emptyCnt) : base(name, ip, aliceName, lineName, pos_name, pos_guid, isUse, emptyCnt)
{
}
/// <summary>
/// 双层线任务
......@@ -25,37 +19,35 @@ namespace AGVControl
/// <returns></returns>
public override Job GetNewJob(Agv_Info currentAgv)
{
if (SettingString.C4_AGV_IPs.Contains(currentAgv.IP))
if (SettingString.RoomC_AGV_IPs.Contains(currentAgv.IP))
return null;
if (!Common.CheckCanExecuteMission(currentAgv))
if (!AGVManager.CheckCanExecuteMission(currentAgv))
return null;
if (!Common.CheckAGVStatusNone(currentAgv))
if (!AGVManager.CheckAGVStatusNone(currentAgv))
return null;
string rfid = "";
//foreach (Agv_Info agv in Common.agvInfo)
//{
// if (SettingString.RoomC_AGV_IPs.Contains(agv.IP))
// continue;
// if (agv.CurJob is GoEmptyShelfLineJob || agv.CurJob is EmptyShelfBackJob)//
// {
// emptyJobCnt++;
// }
//}
List<Agv_Info> agvs = AGVManager.agvInfo.FindAll(s => !SettingString.RoomC_AGV_IPs.Contains(s.IP) && (s.CurJob is GoEmptyShelfLineJob || (s.CurJob is EmptyShelfBackJob)));
//执行空料架任务的小车数量
int emptyJobCnt = 0;
foreach (Agv_Info agv in Common.agvInfo)
{
if (SettingString.C4_AGV_IPs.Contains(agv.IP))
continue;
if (agv.CurJob is GoEmptyShelfLineJob || agv.CurJob is EmptyShelfBackJob)
{
emptyJobCnt++;
}
}
if ((SettingString.AGVCNT / 2 - emptyJobCnt).Equals(1))//保留1辆小车出满料架
{
return null;
}
int emptyJobCnt = agvs.Count;
//出工单料的目的地是否有空料架
if (Common.FindEmptyShelfBeforeSendFullShelf(out string nodeName))
if (AGVManager.FindEmptyShelfBeforeSendFullShelf(out string nodeName))
{
if (nodeName.StartsWith(SettingString.D4_Name_Prefix) && !SettingString.C4_AGV_IPs.Contains(currentAgv.IP))
if (nodeName.StartsWith(SettingString.RoomD_Name_Prefix) && !SettingString.RoomC_AGV_IPs.Contains(currentAgv.IP))
{
ClientNode clientNode = Common.nodeInfo.Find(s => s.Name.Equals(nodeName));
ClientNode clientNode = AGVManager.nodeInfo.Find(s => s.Name.Equals(nodeName));
int cnt = 0;
foreach (Agv_Info agv in Common.agvInfo)
foreach (Agv_Info agv in AGVManager.agvInfo)
{
if (SettingString.C4_AGV_IPs.Contains(agv.IP))
if (SettingString.RoomC_AGV_IPs.Contains(agv.IP))
continue;
if (agv.CurJob is GoEmptyShelfLineJob)
{
......@@ -65,42 +57,53 @@ namespace AGVControl
}
if (cnt < clientNode.EmptyShelfCnt)
{
return new GoEmptyShelfLineJob(currentAgv.Place, nodeName);
if (AGVManager.CheckStationState(clientNode, out rfid) && CanEmptyTask(emptyJobCnt))
return new GoEmptyShelfLineJob(currentAgv.Place, nodeName, rfid);
}
}
}
//回收空料架
if (Common.FindEmptyShelfNode(currentAgv, out string emptyNodeName))
if (AGVManager.FindEmptyShelfNode(currentAgv, out string emptyNodeName))
{
if (!SettingString.C4_AGV_IPs.Contains(currentAgv.IP))
if (!SettingString.RoomC_AGV_IPs.Contains(currentAgv.IP))
{
int i = Common.agvInfo.FindIndex(s => s.CurJob is GoEmptyShelfLineJob && ((GoEmptyShelfLineJob)s.CurJob).EmptyShelfPlace.Equals(emptyNodeName));
int i = AGVManager.agvInfo.FindIndex(s => s.CurJob is GoEmptyShelfLineJob && ((GoEmptyShelfLineJob)s.CurJob).EmptyShelfPlace.Equals(emptyNodeName));
if (i == -1)
return new GoEmptyShelfLineJob(currentAgv.Place, emptyNodeName);
{
ClientNode clientNode = AGVManager.nodeInfo.Find(s => s.Name.Equals(emptyNodeName));
if (AGVManager.CheckStationState(clientNode, out rfid) && CanEmptyTask(emptyJobCnt))
return new GoEmptyShelfLineJob(currentAgv.Place, emptyNodeName, rfid);
}
}
}
//出满料
if (Common.FindFullShelfTask(currentAgv))
if (AGVManager.FindFullShelfTask(currentAgv))
{
if (!SettingString.C4_AGV_IPs.Contains(currentAgv.IP))
if (!SettingString.RoomC_AGV_IPs.Contains(currentAgv.IP))
{
int i = Common.agvInfo.FindIndex(s => s.CurJob is GoFullShelfStationJob && !s.IP.Equals(currentAgv.IP));
int i = AGVManager.agvInfo.FindIndex(s => s.CurJob is GoFullShelfStationJob && !s.IP.Equals(currentAgv.IP));
if (i > -1)
{
return null;
}
ClientNode node = Common.nodeInfo.Find(s => s.Name.Equals(SettingString.A6)
ClientNode node = AGVManager.nodeInfo.Find(s => s.Name.Equals(SettingString.A6)
&& (s.StateEquals(eNodeStatus.NeedLeave) || s.StateEquals(eNodeStatus.NeedEnterLeave)) && !s.RFID.Equals("00"));
if (node != null && node.Name.Equals(SettingString.A6))
{
if (AGVManager.FindFullShelfTarget(node.RFID, out AGVManager.BoxDestInfo boxDestInfo))
if (HttpManager.FindFullShelfTarget(node.RFID, out HttpManager.BoxDestInfo boxDestInfo))
{
if (boxDestInfo != null)
{
i = Common.agvInfo.FindIndex(s => s.CurJob is SendFullShelfToLineJob && !s.IP.Equals(currentAgv.IP)
ClientNode clientNode = AGVManager.nodeInfo.Find(s => s.Name.Equals(boxDestInfo.location));
if (!AGVManager.CheckStationState(clientNode))
{
return null;
}
i = AGVManager.agvInfo.FindIndex(s => s.CurJob is SendFullShelfToLineJob && !s.IP.Equals(currentAgv.IP)
&& ((SendFullShelfToLineJob)s.CurJob).FullShelfPlace.Equals(boxDestInfo.location));
if (i > -1)
return null;
......@@ -114,5 +117,18 @@ namespace AGVControl
return null;
}
/// <summary>
/// 控制出空架小车数量
/// </summary>
/// <param name="emptytASKAGV"></param>
/// <returns></returns>
private bool CanEmptyTask(int emptytASKAGV)
{
if ((SettingString.AGVCNT / 2 - emptytASKAGV).Equals(1))//保留1辆小车出满料架
{
return false;
}
return true;
}
}
}
......@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AGVControl
namespace DeviceLibrary
{
/// <summary>
/// 客户端的节点
......@@ -32,11 +32,6 @@ namespace AGVControl
}
/// <summary>
/// 小车名称
/// </summary>
public string AgvName { set; get; }
/// <summary>
/// 线体名(佳世达)
/// </summary>
public string LineName { set; get; }
......@@ -54,24 +49,20 @@ namespace AGVControl
/// 节点位置坐标
/// </summary>
public PositionStru position;
/// <summary>
/// 空料架数量
/// 料架数量信息
/// </summary>
public int EmptyShelfCnt
public int EmptyShelfCnt
{
get { return _EmptyShelfCnt; }
set
get
{
EmptyShelfCnt = _EmptyShelfCnt;
}
if(Common.missionManager !=null && Common.missionManager.GetUnlockInfo(Name) !=null)
{
return Common.missionManager.GetUnlockCnt(Name);
}
return 0;
}
}
/// <summary>
/// 空架子的RFID
/// </summary>
public List<string> EmptyShelfRFIDs;
private int _EmptyShelfCnt = 0;
public string AliceName { get; set; }
/// <summary>
/// 客户端节点
......@@ -79,21 +70,18 @@ namespace AGVControl
/// <param name="name"></param>
/// <param name="ip"></param>
/// <param name="isUse"></param>
public ClientNode(string name, string ip, string aliceName,string lineName, string pos_name, string pos_guid, bool isUse,int emptyCnt) : base(name, ip, isUse)
public ClientNode(string name, string ip, string aliceName, string lineName, string pos_name, string pos_guid, bool isUse, int emptyCnt) : base(name, ip, isUse)
{
AliceName = aliceName;
RFID = rfid;
AgvName = "";
Online = false;
IsUse = isUse;
_EmptyShelfCnt = emptyCnt;
this.Pos_name = pos_name;
this.Pos_guid = pos_guid;
LineName = lineName;
EmptyShelfRFIDs = new List<string>();
}
public string WarnMsg { get; set; } = "";
/// <summary>
/// 客户端节点
/// </summary>
......@@ -106,41 +94,8 @@ namespace AGVControl
RFID = rfid;
nodeStatus = status;
AgvName = "";
}
/// <summary>
///空料架数量增加,如果RFID相同,不增加数量
/// </summary>
public void IncreEmptyShelfCnt(string rfid="")
{
if(!rfid.Equals("") && !EmptyShelfRFIDs.Contains(rfid))
{
System.Threading.Interlocked.Increment(ref _EmptyShelfCnt);
EmptyShelfRFIDs.Add(rfid);
Common.WriteIni(Name, SettingString.EmptyShelfCnt,_EmptyShelfCnt.ToString());
}
else if(rfid.Equals(""))
{
System.Threading.Interlocked.Increment(ref _EmptyShelfCnt);
Common.WriteIni(Name, SettingString.EmptyShelfCnt, _EmptyShelfCnt.ToString());
}
}
/// <summary>
/// 空料架数量减少1
/// </summary>
public void DecreEmptyShelfCnt()
{
if (_EmptyShelfCnt > 0)
{
System.Threading.Interlocked.Decrement(ref _EmptyShelfCnt);
Common.WriteIni(Name, SettingString.EmptyShelfCnt, _EmptyShelfCnt.ToString());
}
if(_EmptyShelfCnt.Equals(0) && EmptyShelfRFIDs.Count>0)
{
EmptyShelfRFIDs.Clear();
}
}
/// <summary>
/// 节点状态的文本形式
/// </summary>
......@@ -163,11 +118,11 @@ namespace AGVControl
s[3] = nodeStatus.ToString();
s[4] = ClientLevel.ToString();
s[5] = RFID;
// s[5] = AgvName;
// s[5] = AgvName;
// }
s[6] = Online ? "在线" : "离线";
s[7] = IsUse ? "是" : "否";
// s[8] = "清除";
// s[8] = "清除";
return s;
}
......@@ -178,7 +133,6 @@ namespace AGVControl
{
RFID = "00";
nodeStatus = eNodeStatus.None;
AgvName = "";
Online = false;
}
......
此文件类型无法预览
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Runtime.Serialization;
using System.ServiceModel.Activation;
using System;
using AGVControl;
using System.IO;
using System.Xml;
using System.Text;
using System.Runtime.Serialization;
using Common;
namespace BLL
namespace DeviceLibrary
{
[ServiceContract(Name = "Services")]
......@@ -20,7 +18,7 @@ namespace BLL
//?emptyStation={line}
[OperationContract]
[WebInvoke(UriTemplate = "CreateEmptyRecycleTask?emptyStation={line}&rfid={RFID}", Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Xml)]
string CreateEmptyRecycleTaskGET(string line,string RFID="");
string CreateEmptyRecycleTaskGET(string line, string RFID = "");
}
......@@ -64,73 +62,77 @@ namespace BLL
{
emptyStation = "FeederOut";
}
else if (emptyStation.Equals("4CFeeder"))
else if (emptyStation.Equals("3CFeeder"))
{
emptyStation = "4CFeederOut";
emptyStation = "3CFeederOut";
}
if (Common.GetNodeNameByLineName(emptyStation, out string value))
if (AGVManager.GetNodeNameByLineName(emptyStation, out string value))
{
if (!Common.AddEmptyShelfTask(value))
if (rfid == null)
{
Common.log.Error("CreateEmptyRecycleTask(POST) 节点[" + value + "]不存在");
res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "CreateEmptyRecycleTask failed: " + emptyStation };
res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "rfid=null" };
Log.Error(string.Format("Unlock Request(POST) Failed [emptyStation={0},rfid=null]", emptyStation));
}
else
{
if (rfid == null)
res = new Result() { Succeed = true, ResultData = rfid, ErrorMessage = "" };
Log.Debug(string.Format("Unlock Request(POST) [emptyStation={0},rfid={1}]", emptyStation, rfid.ToUpper()));
if (!AGVManager.unlockManager.AddMission(value, rfid.ToUpper()))
{
res = new Result() { Succeed = true, ResultData = null, ErrorMessage = "" };
Log.Info(string.Format("WebService Request(POST) emptyStation={0},rfid=null", emptyStation));
Common.LogInfo("任务[POST]:" + value + " 出空料架 [" + emptyStation + "]");
if(rfid.Equals(""))
{
Log.Error(string.Format("添加空架任务失败 节点[{0}] RFID=null", value));
res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "CreateEmptyRecycleTask failed: emptyStation=" + emptyStation + " rfid=" + rfid };
}
else
{
Log.Error(string.Format("添加空架任务失败 节点[{0}]RFID={1} 重复", value,rfid.ToUpper()));
res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "CreateEmptyRecycleTask failed due it has been created: emptyStation=" + emptyStation + " rfid=" + rfid};
}
}
else
{
res = new Result() { Succeed = true, ResultData = rfid, ErrorMessage = "" };
Log.Info(string.Format("WebService Request(POST) emptyStation={0},rfid={1}", emptyStation, rfid));
Common.LogInfo("任务[POST]:" + value + " 出空料架 [location=" + emptyStation + ",rfid=" + rfid + "]");
}
Log.Info("任务[POST]:" + value + " 出空料架 [location=" + emptyStation + ",rfid=" + rfid.ToUpper() + "]");
}
// AGVControl.Common.log.Debug("WebService POST Response OK");
// AGVControl.Common.log.Debug("WebService POST Response OK");
}
else
{
res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "Not find " + emptyStation };
AGVControl.Common.log.Error("WebService POST Response false " + "Not find " + emptyStation);
Log.Error("Unlock POST Response false:" + "Not find " + emptyStation);
}
}
return JsonHelper.SerializeObject(res);
}
public string CreateEmptyRecycleTaskGET(string line,string RFID)
public string CreateEmptyRecycleTaskGET(string line, string RFID)
{
Result res;
if (line.Equals("Feeder"))
{
line = "FeederOut";
}
else if (line.Equals("4CFeeder"))
else if (line.Equals("3CFeeder"))
{
line = "4CFeederOut";
line = "3CFeederOut";
}
if (Common.GetNodeNameByLineName(line, out string value))
if (AGVManager.GetNodeNameByLineName(line, out string value))
{
if (!Common.AddEmptyShelfTask(value))
Log.Debug(string.Format("Unlock Request(GET) [emptyStation={0},rfid={1}]", line, RFID.ToUpper()));
if (!AGVManager.unlockManager.AddMission(value,RFID.ToUpper()))
{
Common.log.Error("CreateEmptyRecycleTask 节点[" + value + "]不存在");
res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "CreateEmptyRecycleTask failed: " + line };
}
Log.Error(string.Format("添加空架任务失败 节点[{0}]RFID={1} 重复", value, RFID.ToUpper()));
res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "CreateEmptyRecycleTask failed due it has been created: emptyStation=" + line + " rfid=" + RFID };
}
else
{
res = new Result() { Succeed = true, ResultData = RFID, ErrorMessage = "" };
Log.Info(string.Format("WebService Request(GET) emptyStation={0},rfid={1}", line, RFID));
Common.LogInfo("任务[GET]:" + value + " 出空料架 [emptyStation=" + line + ",rfid="+RFID+"]");
Log.Info("任务[GET]:" + value + " 出空料架 [emptyStation=" + line + ",rfid=" + RFID.ToUpper() + "]");
}
}
else
{
res = new Result() { Succeed = false, ResultData = null, ErrorMessage = "Not find " + line };
AGVControl.Common.LogInfo("WebService GET Response false " + "Not find " + line);
Log.Error("Unlock GET Response false " + "Not find " + line);
}
//Log.Info(string.Format("WebService GET Request emptyStation={0},rfid={1}", line, RFID));
return JsonHelper.SerializeObject(res);
......@@ -148,11 +150,11 @@ namespace BLL
ClsWebService service = new ClsWebService();
_serviceHost = new WebServiceHost(service, new Uri(url));//service, new Uri(url)
_serviceHost.Open();
AGVControl.Common.LogInfo("Web服务已开启");
LogUtil.info("Web服务已开启");
}
catch (Exception ex)
{
AGVControl.Common.log.Error("Open", ex);
LogUtil.error("Web服务开启", ex);
}
}
......@@ -162,40 +164,15 @@ namespace BLL
{
if (_serviceHost != null)//判断服务是否关闭
_serviceHost.Close();//关闭服务
Common.log.Info("Web服务已关闭");
LogUtil.info("Web服务已关闭");
}
catch (Exception ex)
{
Common.log.Error("Close", ex);
LogUtil.error("Web服务关闭", ex);
}
}
//public void RecycleTask(string lineName)
//{
// if (AGVControl.Common.agvProductionLine.TryGetValue(lineName, out string value))
// {
// AGVControl.Common.LogInfo("WebService Response OK");
// //加到任务
// //int idx = AGVControl.Common.nodeInfo.FindIndex(s => s.Name == value);
// //if (idx > -1)
// // AGVControl.Common.linePlace.Add(value);
// //else
// // AGVControl.Common.log.Error("CreateEmptyRecycleTask " + value + "不存在");
// if (!Common.AddLinePlace(value))
// Common.log.Error("CreateEmptyRecycleTask 节点【" + value + "】不存在");
// else
// {
// Common.LogInfo("任务:" + value + " 出空料架 【" + lineName + "】");
// }
// //System.IO.File.WriteAllLines(Common.CONFIG_PATH + "LinePlace.txt", Common.linePlace);
// }
// else
// {
// AGVControl.Common.LogInfo("WebService Response false");
// }
//}
}
......
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceLibrary
{
/// <summary>
///解绑料架任务管理
/// </summary>
public class UnlockMissionManager
{
public delegate void MissionChangedHandler(Dictionary<string, UnlockInfo> pairs);
public event MissionChangedHandler MissionChanged;
/// <summary>
/// 任务列表
/// </summary>
public Dictionary<string, UnlockedShelf> NodeUnlockMissions { get; private set; }
Dictionary<string, UnlockInfo> UnlockMissions;
public UnlockMissionManager(List<ClientNode> clientNodes)
{
NodeUnlockMissions = new Dictionary<string, UnlockedShelf>();
UnlockMissions = new Dictionary<string, UnlockInfo>();
foreach (ClientNode item in clientNodes)
{
if (item.Name.StartsWith("A") || item.Name.Equals(SettingString.D4FeederIn) || item.Name.Equals(SettingString.C4FeederIn))
continue;
NodeUnlockMissions.Add(item.Name, new UnlockedShelf());
UnlockMissions = new Dictionary<string, UnlockInfo>();
}
}
public UnlockMissionManager()
{
NodeUnlockMissions = new Dictionary<string, UnlockedShelf>();
UnlockMissions = new Dictionary<string, UnlockInfo>();
}
public void Init()
{
foreach (var item in NodeUnlockMissions.Keys)
{
UnlockMissions.Add(item, new UnlockInfo(item, NodeUnlockMissions[item].EmptyCnt, NodeUnlockMissions[item].GetRfidWithTime()));
}
MissionChanged?.Invoke(UnlockMissions);
}
public UnlockedShelf GetUnlockInfo(string nodeName)
{
if (NodeUnlockMissions.ContainsKey(nodeName))
{
return NodeUnlockMissions[nodeName];
}
return null;
}
public int GetUnlockCnt(string nodeName)
{
if (NodeUnlockMissions.ContainsKey(nodeName))
{
return NodeUnlockMissions[nodeName].EmptyCnt;
}
return -1;
}
public List<string> GetUnlockRfids(string nodeName)
{
if (NodeUnlockMissions.ContainsKey(nodeName))
{
return NodeUnlockMissions[nodeName].GetRfids();
}
return new List<string>();
}
public bool AddMission(string nodeName, string rfid)
{
bool rtn = NodeUnlockMissions[nodeName].Add(rfid);
if (rtn)
{
UnlockMissions[nodeName] = new UnlockInfo(nodeName, NodeUnlockMissions[nodeName].EmptyCnt, NodeUnlockMissions[nodeName].GetRfidWithTime());
WriteUnlockLineInfo();
Common.WriteIni(nodeName, SettingString.EmptyShelfCnt, NodeUnlockMissions[nodeName].EmptyCnt.ToString());
Common.LogInfo(string.Format("{0}解绑任务添加成功:RFID={1}", nodeName, rfid));
MissionChanged?.Invoke(UnlockMissions);
}
else
Common.LogInfo(string.Format("{0}解绑任务添加失败:RFID={1}", nodeName, rfid));
return rtn;
}
public bool DelMission(string nodeName, string rfid)
{
bool rtn = NodeUnlockMissions[nodeName].Delete(rfid);
if (rtn)
{
UnlockMissions[nodeName] = new UnlockInfo(nodeName, NodeUnlockMissions[nodeName].EmptyCnt, NodeUnlockMissions[nodeName].GetRfidWithTime());
WriteUnlockLineInfo();
Common.WriteIni(nodeName, SettingString.EmptyShelfCnt, NodeUnlockMissions[nodeName].EmptyCnt.ToString());
Common.LogInfo(string.Format("{0}解绑任务删除成功:RFID={1}", nodeName, rfid));
MissionChanged?.Invoke(UnlockMissions);
}
else
Common.LogInfo(string.Format("{0}解绑任务删除失败:RFID={1}", nodeName, rfid));
return rtn;
}
/// <summary>
/// 保存料架解绑信息
/// </summary>
void WriteUnlockLineInfo()
{
using (System.IO.StreamWriter file = new System.IO.StreamWriter(Common.CONFIG_PATH + "UnlockInfo.json"))
{
string s = JsonHelper.SerializeObject(this);
file.WriteLine(s);
}
}
}
public class UnlockInfo
{
public string Line { get; set; }
public int Count { get; set; }
public string RFID { get; set; }
public List<UnlockRfid> UnlockRfids { get; private set; }
public UnlockInfo(string nodeName, int count, Dictionary<string, string> rfids)
{
if (Common.GetLineNameByNodeName(nodeName, out string line))
{
Line = line;
}
else
{
Line = nodeName;
}
Count = count;
RFID = string.Join(",", rfids.Keys);
UnlockRfids = new List<UnlockRfid>();
foreach (var item in rfids.Keys)
{
UnlockRfids.Add(new UnlockRfid(nodeName, rfids[item], item));
}
}
}
public class UnlockRfid
{
public String Line { get; set; }
public string RFID { get; set; }
public string Time { get; set; }
public UnlockRfid(string line, string time, string rfid)
{
Time = time;
RFID = rfid;
Line = line;
}
}
}
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!