Commit c94edc52 顾剑亮

软件重构

1 个父辈 4a17d764
......@@ -13,6 +13,16 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AgvServer", "AgvServer\AgvS
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AgvClientProduction", "AgvClientProduction\AgvClientProduction.csproj", "{ADB09B8F-1560-4038-B6CE-A0F876DC1AA0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BLL", "BLL\BLL.csproj", "{27E4CF12-F299-4439-9D58-C32F97DE6179}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Model", "Model\Model.csproj", "{CB525EC1-745D-44D4-AE49-B0D16744600B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UI", "UI\UI.csproj", "{B2384612-3693-4BFD-AD71-078FB1704566}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Clinet", "Clinet\Clinet.csproj", "{284B40AD-DD3E-4BC5-9FDC-016490AF17AE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClientTest", "ClientTest\ClientTest.csproj", "{ABCA001E-D223-4FFD-B9E9-3E47E0F5DB7A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -39,6 +49,26 @@ Global
{ADB09B8F-1560-4038-B6CE-A0F876DC1AA0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ADB09B8F-1560-4038-B6CE-A0F876DC1AA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ADB09B8F-1560-4038-B6CE-A0F876DC1AA0}.Release|Any CPU.Build.0 = Release|Any CPU
{27E4CF12-F299-4439-9D58-C32F97DE6179}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{27E4CF12-F299-4439-9D58-C32F97DE6179}.Debug|Any CPU.Build.0 = Debug|Any CPU
{27E4CF12-F299-4439-9D58-C32F97DE6179}.Release|Any CPU.ActiveCfg = Release|Any CPU
{27E4CF12-F299-4439-9D58-C32F97DE6179}.Release|Any CPU.Build.0 = Release|Any CPU
{CB525EC1-745D-44D4-AE49-B0D16744600B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CB525EC1-745D-44D4-AE49-B0D16744600B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CB525EC1-745D-44D4-AE49-B0D16744600B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CB525EC1-745D-44D4-AE49-B0D16744600B}.Release|Any CPU.Build.0 = Release|Any CPU
{B2384612-3693-4BFD-AD71-078FB1704566}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B2384612-3693-4BFD-AD71-078FB1704566}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B2384612-3693-4BFD-AD71-078FB1704566}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B2384612-3693-4BFD-AD71-078FB1704566}.Release|Any CPU.Build.0 = Release|Any CPU
{284B40AD-DD3E-4BC5-9FDC-016490AF17AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{284B40AD-DD3E-4BC5-9FDC-016490AF17AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{284B40AD-DD3E-4BC5-9FDC-016490AF17AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{284B40AD-DD3E-4BC5-9FDC-016490AF17AE}.Release|Any CPU.Build.0 = Release|Any CPU
{ABCA001E-D223-4FFD-B9E9-3E47E0F5DB7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ABCA001E-D223-4FFD-B9E9-3E47E0F5DB7A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ABCA001E-D223-4FFD-B9E9-3E47E0F5DB7A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ABCA001E-D223-4FFD-B9E9-3E47E0F5DB7A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
此文件类型无法预览
<?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>{27E4CF12-F299-4439-9D58-C32F97DE6179}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BLL</RootNamespace>
<AssemblyName>BLL</AssemblyName>
<TargetFrameworkVersion>v4.6</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>
<LangVersion>preview</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Job\ChargeJob.cs" />
<Compile Include="Control.cs" />
<Compile Include="Job\MissionJob.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Job\RecycleJob.cs" />
<Compile Include="Job\SendFullJob.cs" />
<Compile Include="Server.cs" />
<Compile Include="Job\StandbyJob.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Model\Model.csproj">
<Project>{cb525ec1-745d-44d4-ae49-b0d16744600b}</Project>
<Name>Model</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
using System;
using System.Diagnostics;
using System.Threading;
using Model;
namespace BLL
{
public class Control
{
private Timer timerCall;
public delegate void AgvChangedEvent(int agvIndex);
public event AgvChangedEvent AgvChanged;
public event AgvChangedEvent AgvOnline;
public Control()
{
ThreadPool.SetMaxThreads(5, 5); //线程池最大数量
}
public void Start()
{
timerCall = new Timer(CallProcess, null, 0, 2000);
}
public void Stop()
{
if (timerCall != null)
timerCall.Dispose();
}
private void CallProcess(object obj)
{
for (int i = 0; i < Common.agvInfos.Count; i++)
{
AgvInfo info = Common.agvInfos[i];
if (info.IsCall) continue;
try
{
info.IsCall = true;
CheckAgvOnline(ref info);
if (!info.IsOnline) continue; //脱机
GetAgvState(ref info);
if (!info.IsAuto) continue; //手动
if (info.StateID == (int)StateID.Pause)
MiR_API.State_Ready(info.IP, info.Authorization);
if (info.CurrentJob == null)
info.CurrentJob = new StandbyJob();
else
info.CurrentJob = info.CurrentJob.Execute(info);
}
catch (Exception ex)
{
LogOut.Error("CallProcess " + info.Name, ex);
}
finally
{
info.IsCall = false;
}
}
}
private void GetAgvState(ref AgvInfo info)
{
if (!info.IsOnline) return;
bool rtn = MiR_API.Get_State(info.IP, info.Authorization, out int stateID, out string stateText, out int battery, out string missionText, out System.Drawing.PointF position);
//Common.log.Debug(string.Format("{1} GetAgvState[return={0}] stateID={2}, stateText={3}, battery={4}, missionText={5}, position={6}", rtn, info.FullName, stateID, stateText, battery, missionText, position));
if (rtn)
{
info.StateID = stateID;
info.StateText = stateText;
info.Battery = battery;
info.MissionText = missionText;
info.Position = position;
string ip = info.IP;
int idx = Common.agvInfos.FindIndex(s => s.IP == ip);
if (idx > -1) AgvChanged?.Invoke(idx);
}
}
private void CheckAgvOnline(ref AgvInfo info)
{
bool rtn = MiR_API.CheckIP(info.IP);
if (rtn)
{
if (!info.IsOnline)
{
info.IsOnline = true;
string ip = info.IP;
int idx = Common.agvInfos.FindIndex(s => s.IP == ip);
if (idx > -1) AgvOnline?.Invoke(idx);
//rtn = Common.mir.Get_IO_Modules(info.IP, info.Authorization, out string[] guid);
//if (rtn) info.IOGuid = guid[0];
}
}
else
{
if (info.IsOnline)
{
info.IsOnline = false;
string ip = info.IP;
int idx = Common.agvInfos.FindIndex(s => s.IP == ip);
if (idx > -1) AgvOnline?.Invoke(idx);
}
LogOut.Debug(string.Format("{0}[{1}] 脱机", info.Name, info.IP));
}
}
private enum StateID : int
{
None,
Starting,
ShuttingDown,
Ready,
Pause,
Executing,
Aborted,
Completed,
Docked,
Docking,
EmergencyStop,
ManualControl,
Error
}
}
}
\ No newline at end of file
using System;
using Model;
namespace BLL
{
public class ChargeJob : IJob
{
private AgvInfo _info;
private MissionJob move;
private string mission;
private JobStep<ChargeStep> chargeStep;
private int currBattery;
public ChargeJob()
{
chargeStep = new JobStep<ChargeStep>(ChargeStep.None);
LogOut.Debug("加载ChargeJob");
}
public bool IsEnd { get; private set; }
public IJob Execute(AgvInfo info)
{
_info = info;
if (chargeStep.Equals(ChargeStep.None))
{
currBattery = _info.Battery;
if (_info.IsWorkshop4D)
SendCharge();
else
PassDoor4D();
}
else if (chargeStep.Equals(ChargeStep.PassDoor))
{
move.Execute(_info);
if (move.IsEnd)
SendCharge();
}
else if (chargeStep.Equals(ChargeStep.MoveStation))
{
move.Execute(_info);
MoveStation();
}
else if (chargeStep.Equals(ChargeStep.Charging))
{
if (_info.Battery == _info.BatteryMax)
{
chargeStep.Msg = _info.Name + "电量达到" + _info.BatteryMax;
chargeStep.NextStep(ChargeStep.End);
}
else if (_info.Battery > _info.BatteryMin)
{
//IJob job = SteelManage.GetSteelJob(_info);
//if (job != null)
//{
// Common.mir.Del_Mission(_info.IP, _info.Authorization);
// return job;
//}
}
}
else if (chargeStep.Equals(ChargeStep.End))
{
MiR_API.Del_Mission(_info.IP, _info.Authorization);
chargeStep.Msg = _info.Name + "充电工作结束,回待机位";
return new StandbyJob();
}
return this;
}
/// <summary>
/// 发送充电任务
/// </summary>
private void SendCharge()
{
mission = Common.MISSION_CHARGE + _info.Name;
_info.Place = mission;
move = new MissionJob(mission);
move.Execute(_info);
chargeStep.NextStep(ChargeStep.MoveStation);
chargeStep.Msg = _info.Name + "发送任务" + mission;
}
/// <summary>
/// 过车间门去4D
/// </summary>
private void PassDoor4D()
{
mission = Common.MISSION_PASS_DOOR_4D;
_info.Place = mission;
move = new MissionJob(mission);
move.Execute(_info);
chargeStep.NextStep(ChargeStep.PassDoor);
chargeStep.Msg = _info.Name + "发送任务" + mission;
}
/// <summary>
/// 移动到充电桩
/// </summary>
private void MoveStation()
{
if (_info.Battery > currBattery)
{
chargeStep.Msg = _info.Name + "到达充电位,准备充电";
chargeStep.NextStep(ChargeStep.Charging);
}
}
private enum ChargeStep
{
None,
End,
PassDoor,
MoveStation,
Charging
}
}
}
/*
* 这是一个子job,只运行一个小车任务,需要其他job来调用
*
*/
using System;
using Model;
namespace BLL
{
public class MissionJob : IJob
{
private string _id;
private string _mission;
private bool _fleetSend;
private AgvInfo _info;
private int _times; //发送次数
private DateTime _getTime; //用于调用API的间隔时间
private JobStep<MissionStep> missionStep;
public MissionJob(string mission)
{
_times = 0;
IsEnd = false;
_mission = mission;
_fleetSend = Common.fleetSend;
missionStep = new JobStep<MissionStep>(MissionStep.Send);
}
public bool IsEnd { get; private set; }
public IJob Execute(AgvInfo info)
{
_info = info;
if (missionStep.Equals(MissionStep.Send))
Send();
else if (missionStep.Equals(MissionStep.Working))
Working();
else if (missionStep.Equals(MissionStep.Error))
Error();
else if (missionStep.Equals(MissionStep.End))
IsEnd = true;
return this;
}
private void Send()
{
bool rtn;
string log;
if (_fleetSend)
rtn = MiR_API.Add_Mission_Fleet(_info.FleetID, _info.Authorization, _mission, out _id);
else
rtn = MiR_API.Add_Mission(_info.IP, _info.Authorization, _mission, out _id);
if (rtn)
{
_times = 0;
log = string.Format("MissionJob To:{0},[{1}]发送成功", _info.Name, _mission);
LogOut.Debug(log);
_getTime = DateTime.Now;
missionStep.NextStep(MissionStep.Working);
}
else
{
_times++;
log = string.Format("MissionJob To:{0},[{1}]发送失败{2}次", _info.Name, _mission, _times);
LogOut.Warn(log);
}
}
private void Working()
{
TimeSpan span = DateTime.Now - _getTime;
if (span.TotalMilliseconds >= 5000) //间隔5s取一次任务状态
{
bool rtn;
string state;
string log;
if (_fleetSend)
rtn = MiR_API.Get_MissionState_Fleet(_info.Authorization, _id, out state);
else
rtn = MiR_API.Get_MissionState(_info.IP, _info.Authorization, _id, out state);
if (rtn)
{
log = string.Format("MissionJob To:{0},[{1}]任务状态{2}", _info.Name, _mission, state);
LogOut.Debug(log);
if (state == MissionState.Done.ToString())
missionStep.NextStep(MissionStep.End);
else if (state == MissionState.Aborted.ToString())
missionStep.NextStep(MissionStep.Error);
else if (state == MissionState.Executing.ToString())
_getTime = DateTime.Now;
else if (state == MissionState.Pending.ToString())
_getTime = DateTime.Now;
}
else
{
log = string.Format("MissionJob To:{0},[{1}]获取状态失败", _info.Name, _mission);
LogOut.Warn(log);
}
}
}
private void Error()
{
LogOut.Debug(string.Format("MissionJob To:{0},[{1}]重新发送", _info.Name, _mission));
MiR_API.Clear_Error(_info.IP, _info.Authorization);
MiR_API.Del_Mission(_info.IP, _info.Authorization);
missionStep.NextStep(MissionStep.Send);
}
private enum MissionStep
{
Send,
Working,
Error,
End
}
private enum MissionState
{
/// <summary>
/// 异常
/// </summary>
Aborted,
/// <summary>
/// 正在执行
/// </summary>
Executing,
/// <summary>
/// 未发送(fleet收到任务,还未分配给小车)
/// </summary>
Pending,
/// <summary>
/// 完成
/// </summary>
Done
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
class RecycleJob
{
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
class SendFullJob
{
}
}
using System;
using Model;
namespace BLL
{
public class StandbyJob : IJob
{
private AgvInfo _info;
private MissionJob move;
private string mission;
private JobStep<StandbyStep> standbyStep;
private DateTime _getTime;
public StandbyJob()
{
standbyStep = new JobStep<StandbyStep>(StandbyStep.None);
LogOut.Debug("加载StandbyJob");
}
public bool IsEnd { get; private set; }
public IJob Execute(AgvInfo info)
{
_info = info;
if (standbyStep.Equals(StandbyStep.None))
{
if (_info.IsWorkshop4D)
SendStandby();
else
PassDoor4D();
}
else if (standbyStep.Equals(StandbyStep.PassDoor))
{
move.Execute(_info);
if (move.IsEnd)
SendStandby();
}
else if (standbyStep.Equals(StandbyStep.MoveStandby))
{
move.Execute(_info);
if (move.IsEnd)
{
standbyStep.NextStep(StandbyStep.End);
standbyStep.Msg = _info.Name + "到达待机位";
_getTime = DateTime.Now;
}
}
else if (standbyStep.Equals(StandbyStep.End))
{
if (_info.Battery <= _info.BatteryMin)
{
standbyStep.Msg = _info.Name + "电量小于" + _info.BatteryMin + ",执行充电任务";
return new ChargeJob();
}
else
{
TimeSpan span = DateTime.Now - _getTime;
if (span.TotalMinutes >= 2)
{
standbyStep.Msg = _info.Name + "在待机位停留超过2分钟,执行充电任务";
return new ChargeJob();
}
else
{
//IJob job = SteelManage.GetSteelJob(info);
//if (job != null) return job;
}
}
}
return this;
}
/// <summary>
/// 发送待机位任务
/// </summary>
private void SendStandby()
{
mission = Common.MISSION_STANDBY + _info.Name;
_info.Place = mission;
move = new MissionJob(mission);
move.Execute(_info);
standbyStep.NextStep(StandbyStep.MoveStandby);
standbyStep.Msg = _info.Name + "发送任务" + mission;
}
/// <summary>
/// 过车间门去4D
/// </summary>
private void PassDoor4D()
{
mission = Common.MISSION_PASS_DOOR_4D;
_info.Place = mission;
move = new MissionJob(mission);
move.Execute(_info);
standbyStep.NextStep(StandbyStep.PassDoor);
standbyStep.Msg = _info.Name + "发送任务" + mission;
}
private enum StandbyStep
{
None,
End,
PassDoor,
MoveStandby
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("BLL")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BLL")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("27e4cf12-f299-4439-9d58-c32f97de6179")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [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.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web.Script.Serialization;
using Model;
namespace BLL
{
public class Server
{
private string _ip; //本地IP地址
private Socket _server; //服务端
private List<Client> _client; //所有客户端
private Timer timerListenClient;
private const int PORT = 12000; //端口
public Server(string localIP)
{
_ip = localIP;
_client = new List<Client>();
Common.nodeInfos = new List<ClientNode>();
ThreadPool.SetMaxThreads(20, 20); //线程池最大数量
}
/// <summary>
/// 开启服务
/// </summary>
public void Start()
{
try
{
IPEndPoint localEP = new IPEndPoint(IPAddress.Any, PORT);
_server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
_server.Bind(localEP);
_server.Listen(100);
_client = new List<Client>();
timerListenClient = new Timer(ListenClient, null, 50, Timeout.Infinite);
LogOut.Info("AGV服务启动");
}
catch (Exception ex)
{
LogOut.Error("Start", ex);
}
}
/// <summary>
/// 停止服务
/// </summary>
public void Stop()
{
for (int i = 0; i < _client.Count; i++)
_client[i].Clear();
if (timerListenClient != null)
timerListenClient.Dispose();
LogOut.Info("AGV服务关闭");
}
/// <summary>
/// 更新节点界面
/// </summary>
/// <param name="nodeIndex"></param>
public void NodeRefresh(int nodeIndex)
{
//NodeChanged?.Invoke(nodeIndex);
}
///// <summary>
///// 小车到达
///// </summary>
///// <param name="info"></param>
///// <returns></returns>
//public bool Arrive(Agv_Info info)
//{
// //int idx;
// //int n = 0;
// //do
// //{
// // idx = FindClient(info.Place);
// // if (idx == -1)
// // {
// // Common.log.Info("没有找到" + info.Place);
// // Thread.Sleep(500);
// // n++;
// // }
// // else
// // {
// // n = 10;
// // }
// //} while (n < 4);
// //if (idx == -1) return false;
// //ClientNode node = new ClientNode(info.Place, info.RFID, ClientAction.Arrive);
// //Common.log.Info("SendTo " + info.Place + " " + ClientAction.Arrive);
// //byte[] buff = Encode(node);
// //return Send(idx, buff);
//}
///// <summary>
///// 小车已准备好
///// </summary>
///// <param name="info"></param>
///// <returns></returns>
//public bool Ready(Agv_Info info)
//{
// //int idx;
// //int n = 0;
// //do
// //{
// // idx = FindClient(info.Place);
// // if (idx == -1)
// // {
// // Common.log.Info("没有找到" + info.Place);
// // Thread.Sleep(500);
// // n++;
// // }
// // else
// // {
// // n = 10;
// // }
// //} while (n < 4);
// //if (idx == -1) return false;
// //ClientNode node = new ClientNode(info.Place, info.RFID, ClientAction.Ready);
// //Common.log.Info("SendTo " + info.Place + " " + ClientAction.Ready);
// //byte[] buff = Encode(node);
// //return Send(idx, buff);
//}
///// <summary>
///// 关门
///// </summary>
///// <param name="info"></param>
///// <returns></returns>
//public bool CloseDoor(Agv_Info info)
//{
// //int idx;
// //int n = 0;
// //do
// //{
// // idx = FindClient(info.Place);
// // if (idx == -1)
// // {
// // Common.log.Info("没有找到" + info.Place);
// // Thread.Sleep(500);
// // n++;
// // }
// // else
// // {
// // n = 10;
// // }
// //} while (n < 4);
// //if (idx == -1) return false;
// //ClientNode node = new ClientNode(info.Place, info.RFID, ClientAction.CloseDoor);
// //Common.log.Info("SendTo " + info.Place + " " + ClientAction.CloseDoor);
// //byte[] buff = Encode(node);
// //return Send(idx, buff);
//}
///// <summary>
///// 需要进入料架
///// </summary>
///// <param name="info"></param>
///// <returns></returns>
//public bool EnterShelf(Agv_Info info)
//{
// //int idx;
// //int n = 0;
// //do
// //{
// // idx = FindClient(info.Place);
// // if (idx == -1)
// // {
// // Common.log.Info("没有找到" + info.Place);
// // Thread.Sleep(500);
// // n++;
// // }
// // else
// // {
// // n = 10;
// // }
// //} while (n < 4);
// //if (idx == -1) return false;
// //ClientNode node = new ClientNode(info.Place, info.RFID, ClientAction.EnterShelf);
// //Common.log.Info("SendTo " + info.Place + " " + ClientAction.EnterShelf);
// //byte[] buff = Encode(node);
// //return Send(idx, buff);
//}
/// <summary>
/// 监听客户端
/// </summary>
private void ListenClient(object obj)
{
try
{
Socket socket = _server.Accept();
IPEndPoint ep = (IPEndPoint)socket.RemoteEndPoint;
string ip = ep.Address.ToString();
if (ip == _ip) ip += ":" + ep.Port;
//重连后关闭旧连接
int idx = _client.FindIndex(s => s.IP == ip);
if (idx > -1)
{
_client[idx].Clear();
_client.RemoveAt(idx);
}
//新的客户端
Client client = new Client { IP = ip, IsConn = true, Socket = socket };
_client.Add(client);
client.ListenNet = new Timer(ListenNet, _client.Count - 1, 100, 100);
LogOut.Info(string.Format("[{0}] 已连接", client.IP));
}
catch (SocketException)
{
//关闭连接,退出阻塞Accept
}
catch (Exception ex)
{
LogOut.Error("ListenClient", ex);
}
}
/// <summary>
/// 客户端数据接收
/// </summary>
/// <param name="obj">索引</param>
private void ListenNet(object obj)
{
Client client = _client[(int)obj];
byte[] temp = new byte[200];
int time = 0;
try
{
if (client.Socket.Available > 0)
{
time = 0;
int count = client.Socket.Receive(temp);
byte[] buff = new byte[count];
Array.Copy(temp, 0, buff, 0, count);
ClientNode node = Decode(buff);
if (node == null)
LogOut.Info("命令解析失败: " + HexBuff(buff));
else
LogOut.Info("From Server: " + node.ToText());
UpdateNode(client, node);
}
else
{
time += 100;
if (time > 10000)
{
Offline(client);
LogOut.Info("[" + client.IP + "] 超过10s没有收到数据,关闭连接");
}
}
}
catch (Exception ex)
{
LogOut.Error("ListenNet", ex);
}
}
private byte[] Encode(ClientNode node)
{
List<string> arr = new List<string>
{
"name:\"" + node.Name + "\"",
"mark:\"" + node.Mark + "\"",
"rfid:\"" + node.RFID + "\"",
"action:\"" + node.Action.ToString() + "\"",
"level:\"" + node.Level.ToString() + "\""
};
string s = "{" + string.Join(",", arr) + "}";
byte[] buff = Encoding.UTF8.GetBytes(s);
return buff;
}
private ClientNode Decode(byte[] buff)
{
string json = Encoding.UTF8.GetString(buff);
JavaScriptSerializer serializer = new JavaScriptSerializer();
Dictionary<string, object> dic = (Dictionary<string, object>)serializer.DeserializeObject(json);
if (dic == null) return null;
ClientNode node = new ClientNode();
if (dic.TryGetValue("name", out object value))
node.Name = value.ToString();
if (dic.TryGetValue("mark", out value))
node.Mark = value.ToString();
if (dic.TryGetValue("rfid", out value))
node.RFID = value.ToString();
if (dic.TryGetValue("action", out value))
{
if (Enum.TryParse(value.ToString(), out ClientAction action))
node.Action = action;
}
if (dic.TryGetValue("level", out value))
{
if (Enum.TryParse(value.ToString(), out ClientLevel level))
node.Level = level;
}
return node;
}
private string HexBuff(byte[] buff)
{
string s = "";
if (buff == null) return s;
for (int i = 0; i < buff.Length; i++)
s += buff[i].ToString("X2") + " ";
return s;
}
private void UpdateNode(Client client, ClientNode node)
{
if (node == null) return;
int idx = client.NodeName.FindIndex(s => s == node.Name);
if (idx == -1) client.NodeName.Add(node.Name);
idx = Common.nodeInfos.FindIndex(s => s.Name == node.Name);
//int idx = Common.nodeInfo.FindIndex(s => s.Name == node.Name);
//if (idx == -1)
//{
// Common.log.Info(node.Name + " 不存在");
// return;
//}
//if (!Common.nodeInfo[idx].Online)
//{
// Common.nodeInfo[idx].Online = true;
// NodeOnline?.Invoke(idx);
// NodeChanged?.Invoke(idx);
//}
//if (Common.nodeInfo[idx].Mark != node.Mark ||
// Common.nodeInfo[idx].Action != node.Action ||
// Common.nodeInfo[idx].Level != node.Level ||
// Common.nodeInfo[idx].RFID != node.RFID)
//{
// Common.nodeInfo[idx].Mark = node.Mark;
// Common.nodeInfo[idx].Action = node.Action;
// Common.nodeInfo[idx].Level = node.Level;
// Common.nodeInfo[idx].RFID = node.RFID;
// Common.log.Info(node.Name + "更新 " + node.ToText());
// NodeChanged?.Invoke(idx);
//}
}
private void Offline(Client client)
{
//client.Loop = false;
//client.IsConn = false;
//client.Socket.Close();
//for (int i = 0; i < client.nodeName.Count; i++)
//{
// int idx = AGVControl.Common.nodeInfo.FindIndex(s => s.Name == client.nodeName[i]);
// if (idx == -1) continue;
// AGVControl.Common.nodeInfo[idx].Offline();
// NodeChanged(idx);
// NodeOnline(idx);
//}
//client.nodeName.Clear();
}
private class Client
{
public string IP;
public bool IsConn;
public List<string> NodeName;
public Socket Socket;
public Timer ListenNet;
public Client()
{
IP = "";
IsConn = false;
NodeName = new List<string>();
}
public void Clear()
{
IP = "";
IsConn = false;
NodeName.Clear();
Socket.Close();
ListenNet.Dispose();
}
}
}
}
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup>
</configuration>
\ 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>{ABCA001E-D223-4FFD-B9E9-3E47E0F5DB7A}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>ClientTest</RootNamespace>
<AssemblyName>ClientTest</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<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.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="FrmMain.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmMain.Designer.cs">
<DependentUpon>FrmMain.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="FrmMain.resx">
<DependentUpon>FrmMain.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Clinet\Clinet.csproj">
<Project>{284b40ad-dd3e-4bc5-9fdc-016490af17ae}</Project>
<Name>Clinet</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
namespace ClientTest
{
partial class FrmMain
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.TxtName1 = new System.Windows.Forms.TextBox();
this.TxtMark1 = new System.Windows.Forms.TextBox();
this.TxtRfid1 = new System.Windows.Forms.TextBox();
this.CboAction1 = new System.Windows.Forms.ComboBox();
this.CboLevel1 = new System.Windows.Forms.ComboBox();
this.BtnAdd1 = new System.Windows.Forms.Button();
this.BtnAdd2 = new System.Windows.Forms.Button();
this.CboLevel2 = new System.Windows.Forms.ComboBox();
this.TxtName2 = new System.Windows.Forms.TextBox();
this.CboAction2 = new System.Windows.Forms.ComboBox();
this.label6 = new System.Windows.Forms.Label();
this.TxtRfid2 = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.TxtMark2 = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.BtnAdd3 = new System.Windows.Forms.Button();
this.CboLevel3 = new System.Windows.Forms.ComboBox();
this.TxtName3 = new System.Windows.Forms.TextBox();
this.CboAction3 = new System.Windows.Forms.ComboBox();
this.label11 = new System.Windows.Forms.Label();
this.TxtRfid3 = new System.Windows.Forms.TextBox();
this.label12 = new System.Windows.Forms.Label();
this.TxtMark3 = new System.Windows.Forms.TextBox();
this.label13 = new System.Windows.Forms.Label();
this.label14 = new System.Windows.Forms.Label();
this.label15 = new System.Windows.Forms.Label();
this.BtnAdd4 = new System.Windows.Forms.Button();
this.CboLevel4 = new System.Windows.Forms.ComboBox();
this.TxtName4 = new System.Windows.Forms.TextBox();
this.CboAction4 = new System.Windows.Forms.ComboBox();
this.label16 = new System.Windows.Forms.Label();
this.TxtRfid4 = new System.Windows.Forms.TextBox();
this.label17 = new System.Windows.Forms.Label();
this.TxtMark4 = new System.Windows.Forms.TextBox();
this.label18 = new System.Windows.Forms.Label();
this.label19 = new System.Windows.Forms.Label();
this.label20 = new System.Windows.Forms.Label();
this.BtnAdd5 = new System.Windows.Forms.Button();
this.CboLevel5 = new System.Windows.Forms.ComboBox();
this.TxtName5 = new System.Windows.Forms.TextBox();
this.CboAction5 = new System.Windows.Forms.ComboBox();
this.label21 = new System.Windows.Forms.Label();
this.TxtRfid5 = new System.Windows.Forms.TextBox();
this.label22 = new System.Windows.Forms.Label();
this.TxtMark5 = new System.Windows.Forms.TextBox();
this.label23 = new System.Windows.Forms.Label();
this.label24 = new System.Windows.Forms.Label();
this.label25 = new System.Windows.Forms.Label();
this.BtnAdd6 = new System.Windows.Forms.Button();
this.CboLevel6 = new System.Windows.Forms.ComboBox();
this.TxtName6 = new System.Windows.Forms.TextBox();
this.CboAction6 = new System.Windows.Forms.ComboBox();
this.label26 = new System.Windows.Forms.Label();
this.TxtRfid6 = new System.Windows.Forms.TextBox();
this.label27 = new System.Windows.Forms.Label();
this.TxtMark6 = new System.Windows.Forms.TextBox();
this.label28 = new System.Windows.Forms.Label();
this.label29 = new System.Windows.Forms.Label();
this.label30 = new System.Windows.Forms.Label();
this.BtnAdd7 = new System.Windows.Forms.Button();
this.CboLevel7 = new System.Windows.Forms.ComboBox();
this.TxtName7 = new System.Windows.Forms.TextBox();
this.CboAction7 = new System.Windows.Forms.ComboBox();
this.label31 = new System.Windows.Forms.Label();
this.TxtRfid7 = new System.Windows.Forms.TextBox();
this.label32 = new System.Windows.Forms.Label();
this.TxtMark7 = new System.Windows.Forms.TextBox();
this.label33 = new System.Windows.Forms.Label();
this.label34 = new System.Windows.Forms.Label();
this.label35 = new System.Windows.Forms.Label();
this.BtnAdd8 = new System.Windows.Forms.Button();
this.CboLevel8 = new System.Windows.Forms.ComboBox();
this.TxtName8 = new System.Windows.Forms.TextBox();
this.CboAction8 = new System.Windows.Forms.ComboBox();
this.label36 = new System.Windows.Forms.Label();
this.TxtRfid8 = new System.Windows.Forms.TextBox();
this.label37 = new System.Windows.Forms.Label();
this.TxtMark8 = new System.Windows.Forms.TextBox();
this.label38 = new System.Windows.Forms.Label();
this.label39 = new System.Windows.Forms.Label();
this.label40 = new System.Windows.Forms.Label();
this.BtnAdd9 = new System.Windows.Forms.Button();
this.CboLevel9 = new System.Windows.Forms.ComboBox();
this.TxtName9 = new System.Windows.Forms.TextBox();
this.CboAction9 = new System.Windows.Forms.ComboBox();
this.label41 = new System.Windows.Forms.Label();
this.TxtRfid9 = new System.Windows.Forms.TextBox();
this.label42 = new System.Windows.Forms.Label();
this.TxtMark9 = new System.Windows.Forms.TextBox();
this.label43 = new System.Windows.Forms.Label();
this.label44 = new System.Windows.Forms.Label();
this.label45 = new System.Windows.Forms.Label();
this.BtnAdd10 = new System.Windows.Forms.Button();
this.CboLevel10 = new System.Windows.Forms.ComboBox();
this.TxtName10 = new System.Windows.Forms.TextBox();
this.CboAction10 = new System.Windows.Forms.ComboBox();
this.label46 = new System.Windows.Forms.Label();
this.TxtRfid10 = new System.Windows.Forms.TextBox();
this.label47 = new System.Windows.Forms.Label();
this.TxtMark10 = new System.Windows.Forms.TextBox();
this.label48 = new System.Windows.Forms.Label();
this.label49 = new System.Windows.Forms.Label();
this.label50 = new System.Windows.Forms.Label();
this.TxtLog = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 15);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(29, 12);
this.label1.TabIndex = 0;
this.label1.Text = "Name";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(153, 15);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(29, 12);
this.label2.TabIndex = 1;
this.label2.Text = "Mark";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(294, 15);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(29, 12);
this.label3.TabIndex = 2;
this.label3.Text = "RFID";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(435, 15);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(41, 12);
this.label4.TabIndex = 3;
this.label4.Text = "Action";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(609, 15);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(35, 12);
this.label5.TabIndex = 4;
this.label5.Text = "Level";
//
// TxtName1
//
this.TxtName1.Location = new System.Drawing.Point(47, 12);
this.TxtName1.Name = "TxtName1";
this.TxtName1.Size = new System.Drawing.Size(100, 21);
this.TxtName1.TabIndex = 5;
this.TxtName1.Text = "A1";
//
// TxtMark1
//
this.TxtMark1.Location = new System.Drawing.Point(188, 12);
this.TxtMark1.Name = "TxtMark1";
this.TxtMark1.Size = new System.Drawing.Size(100, 21);
this.TxtMark1.TabIndex = 6;
//
// TxtRfid1
//
this.TxtRfid1.Location = new System.Drawing.Point(329, 12);
this.TxtRfid1.Name = "TxtRfid1";
this.TxtRfid1.Size = new System.Drawing.Size(100, 21);
this.TxtRfid1.TabIndex = 7;
//
// CboAction1
//
this.CboAction1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CboAction1.FormattingEnabled = true;
this.CboAction1.Location = new System.Drawing.Point(482, 12);
this.CboAction1.Name = "CboAction1";
this.CboAction1.Size = new System.Drawing.Size(121, 20);
this.CboAction1.TabIndex = 8;
//
// CboLevel1
//
this.CboLevel1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CboLevel1.FormattingEnabled = true;
this.CboLevel1.Location = new System.Drawing.Point(650, 13);
this.CboLevel1.Name = "CboLevel1";
this.CboLevel1.Size = new System.Drawing.Size(121, 20);
this.CboLevel1.TabIndex = 9;
//
// BtnAdd1
//
this.BtnAdd1.Location = new System.Drawing.Point(777, 11);
this.BtnAdd1.Name = "BtnAdd1";
this.BtnAdd1.Size = new System.Drawing.Size(75, 23);
this.BtnAdd1.TabIndex = 10;
this.BtnAdd1.Text = "Add";
this.BtnAdd1.UseVisualStyleBackColor = true;
this.BtnAdd1.Click += new System.EventHandler(this.BtnAdd_Click);
//
// BtnAdd2
//
this.BtnAdd2.Location = new System.Drawing.Point(777, 38);
this.BtnAdd2.Name = "BtnAdd2";
this.BtnAdd2.Size = new System.Drawing.Size(75, 23);
this.BtnAdd2.TabIndex = 21;
this.BtnAdd2.Text = "Add";
this.BtnAdd2.UseVisualStyleBackColor = true;
this.BtnAdd2.Click += new System.EventHandler(this.BtnAdd_Click);
//
// CboLevel2
//
this.CboLevel2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CboLevel2.FormattingEnabled = true;
this.CboLevel2.Location = new System.Drawing.Point(650, 40);
this.CboLevel2.Name = "CboLevel2";
this.CboLevel2.Size = new System.Drawing.Size(121, 20);
this.CboLevel2.TabIndex = 20;
//
// TxtName2
//
this.TxtName2.Location = new System.Drawing.Point(47, 39);
this.TxtName2.Name = "TxtName2";
this.TxtName2.Size = new System.Drawing.Size(100, 21);
this.TxtName2.TabIndex = 16;
this.TxtName2.Text = "A2";
//
// CboAction2
//
this.CboAction2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CboAction2.FormattingEnabled = true;
this.CboAction2.Location = new System.Drawing.Point(482, 39);
this.CboAction2.Name = "CboAction2";
this.CboAction2.Size = new System.Drawing.Size(121, 20);
this.CboAction2.TabIndex = 19;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(12, 42);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(29, 12);
this.label6.TabIndex = 11;
this.label6.Text = "Name";
//
// TxtRfid2
//
this.TxtRfid2.Location = new System.Drawing.Point(329, 39);
this.TxtRfid2.Name = "TxtRfid2";
this.TxtRfid2.Size = new System.Drawing.Size(100, 21);
this.TxtRfid2.TabIndex = 18;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(153, 42);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(29, 12);
this.label7.TabIndex = 12;
this.label7.Text = "Mark";
//
// TxtMark2
//
this.TxtMark2.Location = new System.Drawing.Point(188, 39);
this.TxtMark2.Name = "TxtMark2";
this.TxtMark2.Size = new System.Drawing.Size(100, 21);
this.TxtMark2.TabIndex = 17;
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(294, 42);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(29, 12);
this.label8.TabIndex = 13;
this.label8.Text = "RFID";
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(435, 42);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(41, 12);
this.label9.TabIndex = 14;
this.label9.Text = "Action";
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(609, 42);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(35, 12);
this.label10.TabIndex = 15;
this.label10.Text = "Level";
//
// BtnAdd3
//
this.BtnAdd3.Location = new System.Drawing.Point(777, 65);
this.BtnAdd3.Name = "BtnAdd3";
this.BtnAdd3.Size = new System.Drawing.Size(75, 23);
this.BtnAdd3.TabIndex = 32;
this.BtnAdd3.Text = "Add";
this.BtnAdd3.UseVisualStyleBackColor = true;
this.BtnAdd3.Click += new System.EventHandler(this.BtnAdd_Click);
//
// CboLevel3
//
this.CboLevel3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CboLevel3.FormattingEnabled = true;
this.CboLevel3.Location = new System.Drawing.Point(650, 67);
this.CboLevel3.Name = "CboLevel3";
this.CboLevel3.Size = new System.Drawing.Size(121, 20);
this.CboLevel3.TabIndex = 31;
//
// TxtName3
//
this.TxtName3.Location = new System.Drawing.Point(47, 66);
this.TxtName3.Name = "TxtName3";
this.TxtName3.Size = new System.Drawing.Size(100, 21);
this.TxtName3.TabIndex = 27;
this.TxtName3.Text = "B1";
//
// CboAction3
//
this.CboAction3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CboAction3.FormattingEnabled = true;
this.CboAction3.Location = new System.Drawing.Point(482, 66);
this.CboAction3.Name = "CboAction3";
this.CboAction3.Size = new System.Drawing.Size(121, 20);
this.CboAction3.TabIndex = 30;
//
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(12, 69);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(29, 12);
this.label11.TabIndex = 22;
this.label11.Text = "Name";
//
// TxtRfid3
//
this.TxtRfid3.Location = new System.Drawing.Point(329, 66);
this.TxtRfid3.Name = "TxtRfid3";
this.TxtRfid3.Size = new System.Drawing.Size(100, 21);
this.TxtRfid3.TabIndex = 29;
//
// label12
//
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(153, 69);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(29, 12);
this.label12.TabIndex = 23;
this.label12.Text = "Mark";
//
// TxtMark3
//
this.TxtMark3.Location = new System.Drawing.Point(188, 66);
this.TxtMark3.Name = "TxtMark3";
this.TxtMark3.Size = new System.Drawing.Size(100, 21);
this.TxtMark3.TabIndex = 28;
//
// label13
//
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(294, 69);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(29, 12);
this.label13.TabIndex = 24;
this.label13.Text = "RFID";
//
// label14
//
this.label14.AutoSize = true;
this.label14.Location = new System.Drawing.Point(435, 69);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(41, 12);
this.label14.TabIndex = 25;
this.label14.Text = "Action";
//
// label15
//
this.label15.AutoSize = true;
this.label15.Location = new System.Drawing.Point(609, 69);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(35, 12);
this.label15.TabIndex = 26;
this.label15.Text = "Level";
//
// BtnAdd4
//
this.BtnAdd4.Location = new System.Drawing.Point(777, 92);
this.BtnAdd4.Name = "BtnAdd4";
this.BtnAdd4.Size = new System.Drawing.Size(75, 23);
this.BtnAdd4.TabIndex = 43;
this.BtnAdd4.Text = "Add";
this.BtnAdd4.UseVisualStyleBackColor = true;
this.BtnAdd4.Click += new System.EventHandler(this.BtnAdd_Click);
//
// CboLevel4
//
this.CboLevel4.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CboLevel4.FormattingEnabled = true;
this.CboLevel4.Location = new System.Drawing.Point(650, 94);
this.CboLevel4.Name = "CboLevel4";
this.CboLevel4.Size = new System.Drawing.Size(121, 20);
this.CboLevel4.TabIndex = 42;
//
// TxtName4
//
this.TxtName4.Location = new System.Drawing.Point(47, 93);
this.TxtName4.Name = "TxtName4";
this.TxtName4.Size = new System.Drawing.Size(100, 21);
this.TxtName4.TabIndex = 38;
this.TxtName4.Text = "B2";
//
// CboAction4
//
this.CboAction4.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CboAction4.FormattingEnabled = true;
this.CboAction4.Location = new System.Drawing.Point(482, 93);
this.CboAction4.Name = "CboAction4";
this.CboAction4.Size = new System.Drawing.Size(121, 20);
this.CboAction4.TabIndex = 41;
//
// label16
//
this.label16.AutoSize = true;
this.label16.Location = new System.Drawing.Point(12, 96);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(29, 12);
this.label16.TabIndex = 33;
this.label16.Text = "Name";
//
// TxtRfid4
//
this.TxtRfid4.Location = new System.Drawing.Point(329, 93);
this.TxtRfid4.Name = "TxtRfid4";
this.TxtRfid4.Size = new System.Drawing.Size(100, 21);
this.TxtRfid4.TabIndex = 40;
//
// label17
//
this.label17.AutoSize = true;
this.label17.Location = new System.Drawing.Point(153, 96);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(29, 12);
this.label17.TabIndex = 34;
this.label17.Text = "Mark";
//
// TxtMark4
//
this.TxtMark4.Location = new System.Drawing.Point(188, 93);
this.TxtMark4.Name = "TxtMark4";
this.TxtMark4.Size = new System.Drawing.Size(100, 21);
this.TxtMark4.TabIndex = 39;
//
// label18
//
this.label18.AutoSize = true;
this.label18.Location = new System.Drawing.Point(294, 96);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(29, 12);
this.label18.TabIndex = 35;
this.label18.Text = "RFID";
//
// label19
//
this.label19.AutoSize = true;
this.label19.Location = new System.Drawing.Point(435, 96);
this.label19.Name = "label19";
this.label19.Size = new System.Drawing.Size(41, 12);
this.label19.TabIndex = 36;
this.label19.Text = "Action";
//
// label20
//
this.label20.AutoSize = true;
this.label20.Location = new System.Drawing.Point(609, 96);
this.label20.Name = "label20";
this.label20.Size = new System.Drawing.Size(35, 12);
this.label20.TabIndex = 37;
this.label20.Text = "Level";
//
// BtnAdd5
//
this.BtnAdd5.Location = new System.Drawing.Point(777, 119);
this.BtnAdd5.Name = "BtnAdd5";
this.BtnAdd5.Size = new System.Drawing.Size(75, 23);
this.BtnAdd5.TabIndex = 54;
this.BtnAdd5.Text = "Add";
this.BtnAdd5.UseVisualStyleBackColor = true;
this.BtnAdd5.Click += new System.EventHandler(this.BtnAdd_Click);
//
// CboLevel5
//
this.CboLevel5.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CboLevel5.FormattingEnabled = true;
this.CboLevel5.Location = new System.Drawing.Point(650, 121);
this.CboLevel5.Name = "CboLevel5";
this.CboLevel5.Size = new System.Drawing.Size(121, 20);
this.CboLevel5.TabIndex = 53;
//
// TxtName5
//
this.TxtName5.Location = new System.Drawing.Point(47, 120);
this.TxtName5.Name = "TxtName5";
this.TxtName5.Size = new System.Drawing.Size(100, 21);
this.TxtName5.TabIndex = 49;
this.TxtName5.Text = "C1";
//
// CboAction5
//
this.CboAction5.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CboAction5.FormattingEnabled = true;
this.CboAction5.Location = new System.Drawing.Point(482, 120);
this.CboAction5.Name = "CboAction5";
this.CboAction5.Size = new System.Drawing.Size(121, 20);
this.CboAction5.TabIndex = 52;
//
// label21
//
this.label21.AutoSize = true;
this.label21.Location = new System.Drawing.Point(12, 123);
this.label21.Name = "label21";
this.label21.Size = new System.Drawing.Size(29, 12);
this.label21.TabIndex = 44;
this.label21.Text = "Name";
//
// TxtRfid5
//
this.TxtRfid5.Location = new System.Drawing.Point(329, 120);
this.TxtRfid5.Name = "TxtRfid5";
this.TxtRfid5.Size = new System.Drawing.Size(100, 21);
this.TxtRfid5.TabIndex = 51;
//
// label22
//
this.label22.AutoSize = true;
this.label22.Location = new System.Drawing.Point(153, 123);
this.label22.Name = "label22";
this.label22.Size = new System.Drawing.Size(29, 12);
this.label22.TabIndex = 45;
this.label22.Text = "Mark";
//
// TxtMark5
//
this.TxtMark5.Location = new System.Drawing.Point(188, 120);
this.TxtMark5.Name = "TxtMark5";
this.TxtMark5.Size = new System.Drawing.Size(100, 21);
this.TxtMark5.TabIndex = 50;
//
// label23
//
this.label23.AutoSize = true;
this.label23.Location = new System.Drawing.Point(294, 123);
this.label23.Name = "label23";
this.label23.Size = new System.Drawing.Size(29, 12);
this.label23.TabIndex = 46;
this.label23.Text = "RFID";
//
// label24
//
this.label24.AutoSize = true;
this.label24.Location = new System.Drawing.Point(435, 123);
this.label24.Name = "label24";
this.label24.Size = new System.Drawing.Size(41, 12);
this.label24.TabIndex = 47;
this.label24.Text = "Action";
//
// label25
//
this.label25.AutoSize = true;
this.label25.Location = new System.Drawing.Point(609, 123);
this.label25.Name = "label25";
this.label25.Size = new System.Drawing.Size(35, 12);
this.label25.TabIndex = 48;
this.label25.Text = "Level";
//
// BtnAdd6
//
this.BtnAdd6.Location = new System.Drawing.Point(777, 146);
this.BtnAdd6.Name = "BtnAdd6";
this.BtnAdd6.Size = new System.Drawing.Size(75, 23);
this.BtnAdd6.TabIndex = 65;
this.BtnAdd6.Text = "Add";
this.BtnAdd6.UseVisualStyleBackColor = true;
this.BtnAdd6.Click += new System.EventHandler(this.BtnAdd_Click);
//
// CboLevel6
//
this.CboLevel6.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CboLevel6.FormattingEnabled = true;
this.CboLevel6.Location = new System.Drawing.Point(650, 148);
this.CboLevel6.Name = "CboLevel6";
this.CboLevel6.Size = new System.Drawing.Size(121, 20);
this.CboLevel6.TabIndex = 64;
//
// TxtName6
//
this.TxtName6.Location = new System.Drawing.Point(47, 147);
this.TxtName6.Name = "TxtName6";
this.TxtName6.Size = new System.Drawing.Size(100, 21);
this.TxtName6.TabIndex = 60;
this.TxtName6.Text = "C2";
//
// CboAction6
//
this.CboAction6.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CboAction6.FormattingEnabled = true;
this.CboAction6.Location = new System.Drawing.Point(482, 147);
this.CboAction6.Name = "CboAction6";
this.CboAction6.Size = new System.Drawing.Size(121, 20);
this.CboAction6.TabIndex = 63;
//
// label26
//
this.label26.AutoSize = true;
this.label26.Location = new System.Drawing.Point(12, 150);
this.label26.Name = "label26";
this.label26.Size = new System.Drawing.Size(29, 12);
this.label26.TabIndex = 55;
this.label26.Text = "Name";
//
// TxtRfid6
//
this.TxtRfid6.Location = new System.Drawing.Point(329, 147);
this.TxtRfid6.Name = "TxtRfid6";
this.TxtRfid6.Size = new System.Drawing.Size(100, 21);
this.TxtRfid6.TabIndex = 62;
//
// label27
//
this.label27.AutoSize = true;
this.label27.Location = new System.Drawing.Point(153, 150);
this.label27.Name = "label27";
this.label27.Size = new System.Drawing.Size(29, 12);
this.label27.TabIndex = 56;
this.label27.Text = "Mark";
//
// TxtMark6
//
this.TxtMark6.Location = new System.Drawing.Point(188, 147);
this.TxtMark6.Name = "TxtMark6";
this.TxtMark6.Size = new System.Drawing.Size(100, 21);
this.TxtMark6.TabIndex = 61;
//
// label28
//
this.label28.AutoSize = true;
this.label28.Location = new System.Drawing.Point(294, 150);
this.label28.Name = "label28";
this.label28.Size = new System.Drawing.Size(29, 12);
this.label28.TabIndex = 57;
this.label28.Text = "RFID";
//
// label29
//
this.label29.AutoSize = true;
this.label29.Location = new System.Drawing.Point(435, 150);
this.label29.Name = "label29";
this.label29.Size = new System.Drawing.Size(41, 12);
this.label29.TabIndex = 58;
this.label29.Text = "Action";
//
// label30
//
this.label30.AutoSize = true;
this.label30.Location = new System.Drawing.Point(609, 150);
this.label30.Name = "label30";
this.label30.Size = new System.Drawing.Size(35, 12);
this.label30.TabIndex = 59;
this.label30.Text = "Level";
//
// BtnAdd7
//
this.BtnAdd7.Location = new System.Drawing.Point(777, 173);
this.BtnAdd7.Name = "BtnAdd7";
this.BtnAdd7.Size = new System.Drawing.Size(75, 23);
this.BtnAdd7.TabIndex = 76;
this.BtnAdd7.Text = "Add";
this.BtnAdd7.UseVisualStyleBackColor = true;
this.BtnAdd7.Click += new System.EventHandler(this.BtnAdd_Click);
//
// CboLevel7
//
this.CboLevel7.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CboLevel7.FormattingEnabled = true;
this.CboLevel7.Location = new System.Drawing.Point(650, 175);
this.CboLevel7.Name = "CboLevel7";
this.CboLevel7.Size = new System.Drawing.Size(121, 20);
this.CboLevel7.TabIndex = 75;
//
// TxtName7
//
this.TxtName7.Location = new System.Drawing.Point(47, 174);
this.TxtName7.Name = "TxtName7";
this.TxtName7.Size = new System.Drawing.Size(100, 21);
this.TxtName7.TabIndex = 71;
this.TxtName7.Text = "D1";
//
// CboAction7
//
this.CboAction7.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CboAction7.FormattingEnabled = true;
this.CboAction7.Location = new System.Drawing.Point(482, 174);
this.CboAction7.Name = "CboAction7";
this.CboAction7.Size = new System.Drawing.Size(121, 20);
this.CboAction7.TabIndex = 74;
//
// label31
//
this.label31.AutoSize = true;
this.label31.Location = new System.Drawing.Point(12, 177);
this.label31.Name = "label31";
this.label31.Size = new System.Drawing.Size(29, 12);
this.label31.TabIndex = 66;
this.label31.Text = "Name";
//
// TxtRfid7
//
this.TxtRfid7.Location = new System.Drawing.Point(329, 174);
this.TxtRfid7.Name = "TxtRfid7";
this.TxtRfid7.Size = new System.Drawing.Size(100, 21);
this.TxtRfid7.TabIndex = 73;
//
// label32
//
this.label32.AutoSize = true;
this.label32.Location = new System.Drawing.Point(153, 177);
this.label32.Name = "label32";
this.label32.Size = new System.Drawing.Size(29, 12);
this.label32.TabIndex = 67;
this.label32.Text = "Mark";
//
// TxtMark7
//
this.TxtMark7.Location = new System.Drawing.Point(188, 174);
this.TxtMark7.Name = "TxtMark7";
this.TxtMark7.Size = new System.Drawing.Size(100, 21);
this.TxtMark7.TabIndex = 72;
//
// label33
//
this.label33.AutoSize = true;
this.label33.Location = new System.Drawing.Point(294, 177);
this.label33.Name = "label33";
this.label33.Size = new System.Drawing.Size(29, 12);
this.label33.TabIndex = 68;
this.label33.Text = "RFID";
//
// label34
//
this.label34.AutoSize = true;
this.label34.Location = new System.Drawing.Point(435, 177);
this.label34.Name = "label34";
this.label34.Size = new System.Drawing.Size(41, 12);
this.label34.TabIndex = 69;
this.label34.Text = "Action";
//
// label35
//
this.label35.AutoSize = true;
this.label35.Location = new System.Drawing.Point(609, 177);
this.label35.Name = "label35";
this.label35.Size = new System.Drawing.Size(35, 12);
this.label35.TabIndex = 70;
this.label35.Text = "Level";
//
// BtnAdd8
//
this.BtnAdd8.Location = new System.Drawing.Point(777, 200);
this.BtnAdd8.Name = "BtnAdd8";
this.BtnAdd8.Size = new System.Drawing.Size(75, 23);
this.BtnAdd8.TabIndex = 87;
this.BtnAdd8.Text = "Add";
this.BtnAdd8.UseVisualStyleBackColor = true;
this.BtnAdd8.Click += new System.EventHandler(this.BtnAdd_Click);
//
// CboLevel8
//
this.CboLevel8.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CboLevel8.FormattingEnabled = true;
this.CboLevel8.Location = new System.Drawing.Point(650, 202);
this.CboLevel8.Name = "CboLevel8";
this.CboLevel8.Size = new System.Drawing.Size(121, 20);
this.CboLevel8.TabIndex = 86;
//
// TxtName8
//
this.TxtName8.Location = new System.Drawing.Point(47, 201);
this.TxtName8.Name = "TxtName8";
this.TxtName8.Size = new System.Drawing.Size(100, 21);
this.TxtName8.TabIndex = 82;
this.TxtName8.Text = "D2";
//
// CboAction8
//
this.CboAction8.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CboAction8.FormattingEnabled = true;
this.CboAction8.Location = new System.Drawing.Point(482, 201);
this.CboAction8.Name = "CboAction8";
this.CboAction8.Size = new System.Drawing.Size(121, 20);
this.CboAction8.TabIndex = 85;
//
// label36
//
this.label36.AutoSize = true;
this.label36.Location = new System.Drawing.Point(12, 204);
this.label36.Name = "label36";
this.label36.Size = new System.Drawing.Size(29, 12);
this.label36.TabIndex = 77;
this.label36.Text = "Name";
//
// TxtRfid8
//
this.TxtRfid8.Location = new System.Drawing.Point(329, 201);
this.TxtRfid8.Name = "TxtRfid8";
this.TxtRfid8.Size = new System.Drawing.Size(100, 21);
this.TxtRfid8.TabIndex = 84;
//
// label37
//
this.label37.AutoSize = true;
this.label37.Location = new System.Drawing.Point(153, 204);
this.label37.Name = "label37";
this.label37.Size = new System.Drawing.Size(29, 12);
this.label37.TabIndex = 78;
this.label37.Text = "Mark";
//
// TxtMark8
//
this.TxtMark8.Location = new System.Drawing.Point(188, 201);
this.TxtMark8.Name = "TxtMark8";
this.TxtMark8.Size = new System.Drawing.Size(100, 21);
this.TxtMark8.TabIndex = 83;
//
// label38
//
this.label38.AutoSize = true;
this.label38.Location = new System.Drawing.Point(294, 204);
this.label38.Name = "label38";
this.label38.Size = new System.Drawing.Size(29, 12);
this.label38.TabIndex = 79;
this.label38.Text = "RFID";
//
// label39
//
this.label39.AutoSize = true;
this.label39.Location = new System.Drawing.Point(435, 204);
this.label39.Name = "label39";
this.label39.Size = new System.Drawing.Size(41, 12);
this.label39.TabIndex = 80;
this.label39.Text = "Action";
//
// label40
//
this.label40.AutoSize = true;
this.label40.Location = new System.Drawing.Point(609, 204);
this.label40.Name = "label40";
this.label40.Size = new System.Drawing.Size(35, 12);
this.label40.TabIndex = 81;
this.label40.Text = "Level";
//
// BtnAdd9
//
this.BtnAdd9.Location = new System.Drawing.Point(777, 227);
this.BtnAdd9.Name = "BtnAdd9";
this.BtnAdd9.Size = new System.Drawing.Size(75, 23);
this.BtnAdd9.TabIndex = 98;
this.BtnAdd9.Text = "Add";
this.BtnAdd9.UseVisualStyleBackColor = true;
this.BtnAdd9.Click += new System.EventHandler(this.BtnAdd_Click);
//
// CboLevel9
//
this.CboLevel9.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CboLevel9.FormattingEnabled = true;
this.CboLevel9.Location = new System.Drawing.Point(650, 229);
this.CboLevel9.Name = "CboLevel9";
this.CboLevel9.Size = new System.Drawing.Size(121, 20);
this.CboLevel9.TabIndex = 97;
//
// TxtName9
//
this.TxtName9.Location = new System.Drawing.Point(47, 228);
this.TxtName9.Name = "TxtName9";
this.TxtName9.Size = new System.Drawing.Size(100, 21);
this.TxtName9.TabIndex = 93;
//
// CboAction9
//
this.CboAction9.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CboAction9.FormattingEnabled = true;
this.CboAction9.Location = new System.Drawing.Point(482, 228);
this.CboAction9.Name = "CboAction9";
this.CboAction9.Size = new System.Drawing.Size(121, 20);
this.CboAction9.TabIndex = 96;
//
// label41
//
this.label41.AutoSize = true;
this.label41.Location = new System.Drawing.Point(12, 231);
this.label41.Name = "label41";
this.label41.Size = new System.Drawing.Size(29, 12);
this.label41.TabIndex = 88;
this.label41.Text = "Name";
//
// TxtRfid9
//
this.TxtRfid9.Location = new System.Drawing.Point(329, 228);
this.TxtRfid9.Name = "TxtRfid9";
this.TxtRfid9.Size = new System.Drawing.Size(100, 21);
this.TxtRfid9.TabIndex = 95;
//
// label42
//
this.label42.AutoSize = true;
this.label42.Location = new System.Drawing.Point(153, 231);
this.label42.Name = "label42";
this.label42.Size = new System.Drawing.Size(29, 12);
this.label42.TabIndex = 89;
this.label42.Text = "Mark";
//
// TxtMark9
//
this.TxtMark9.Location = new System.Drawing.Point(188, 228);
this.TxtMark9.Name = "TxtMark9";
this.TxtMark9.Size = new System.Drawing.Size(100, 21);
this.TxtMark9.TabIndex = 94;
//
// label43
//
this.label43.AutoSize = true;
this.label43.Location = new System.Drawing.Point(294, 231);
this.label43.Name = "label43";
this.label43.Size = new System.Drawing.Size(29, 12);
this.label43.TabIndex = 90;
this.label43.Text = "RFID";
//
// label44
//
this.label44.AutoSize = true;
this.label44.Location = new System.Drawing.Point(435, 231);
this.label44.Name = "label44";
this.label44.Size = new System.Drawing.Size(41, 12);
this.label44.TabIndex = 91;
this.label44.Text = "Action";
//
// label45
//
this.label45.AutoSize = true;
this.label45.Location = new System.Drawing.Point(609, 231);
this.label45.Name = "label45";
this.label45.Size = new System.Drawing.Size(35, 12);
this.label45.TabIndex = 92;
this.label45.Text = "Level";
//
// BtnAdd10
//
this.BtnAdd10.Location = new System.Drawing.Point(777, 254);
this.BtnAdd10.Name = "BtnAdd10";
this.BtnAdd10.Size = new System.Drawing.Size(75, 23);
this.BtnAdd10.TabIndex = 109;
this.BtnAdd10.Text = "Add";
this.BtnAdd10.UseVisualStyleBackColor = true;
this.BtnAdd10.Click += new System.EventHandler(this.BtnAdd_Click);
//
// CboLevel10
//
this.CboLevel10.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CboLevel10.FormattingEnabled = true;
this.CboLevel10.Location = new System.Drawing.Point(650, 256);
this.CboLevel10.Name = "CboLevel10";
this.CboLevel10.Size = new System.Drawing.Size(121, 20);
this.CboLevel10.TabIndex = 108;
//
// TxtName10
//
this.TxtName10.Location = new System.Drawing.Point(47, 255);
this.TxtName10.Name = "TxtName10";
this.TxtName10.Size = new System.Drawing.Size(100, 21);
this.TxtName10.TabIndex = 104;
//
// CboAction10
//
this.CboAction10.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CboAction10.FormattingEnabled = true;
this.CboAction10.Location = new System.Drawing.Point(482, 255);
this.CboAction10.Name = "CboAction10";
this.CboAction10.Size = new System.Drawing.Size(121, 20);
this.CboAction10.TabIndex = 107;
//
// label46
//
this.label46.AutoSize = true;
this.label46.Location = new System.Drawing.Point(12, 258);
this.label46.Name = "label46";
this.label46.Size = new System.Drawing.Size(29, 12);
this.label46.TabIndex = 99;
this.label46.Text = "Name";
//
// TxtRfid10
//
this.TxtRfid10.Location = new System.Drawing.Point(329, 255);
this.TxtRfid10.Name = "TxtRfid10";
this.TxtRfid10.Size = new System.Drawing.Size(100, 21);
this.TxtRfid10.TabIndex = 106;
//
// label47
//
this.label47.AutoSize = true;
this.label47.Location = new System.Drawing.Point(153, 258);
this.label47.Name = "label47";
this.label47.Size = new System.Drawing.Size(29, 12);
this.label47.TabIndex = 100;
this.label47.Text = "Mark";
//
// TxtMark10
//
this.TxtMark10.Location = new System.Drawing.Point(188, 255);
this.TxtMark10.Name = "TxtMark10";
this.TxtMark10.Size = new System.Drawing.Size(100, 21);
this.TxtMark10.TabIndex = 105;
//
// label48
//
this.label48.AutoSize = true;
this.label48.Location = new System.Drawing.Point(294, 258);
this.label48.Name = "label48";
this.label48.Size = new System.Drawing.Size(29, 12);
this.label48.TabIndex = 101;
this.label48.Text = "RFID";
//
// label49
//
this.label49.AutoSize = true;
this.label49.Location = new System.Drawing.Point(435, 258);
this.label49.Name = "label49";
this.label49.Size = new System.Drawing.Size(41, 12);
this.label49.TabIndex = 102;
this.label49.Text = "Action";
//
// label50
//
this.label50.AutoSize = true;
this.label50.Location = new System.Drawing.Point(609, 258);
this.label50.Name = "label50";
this.label50.Size = new System.Drawing.Size(35, 12);
this.label50.TabIndex = 103;
this.label50.Text = "Level";
//
// TxtLog
//
this.TxtLog.Location = new System.Drawing.Point(12, 282);
this.TxtLog.Multiline = true;
this.TxtLog.Name = "TxtLog";
this.TxtLog.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.TxtLog.Size = new System.Drawing.Size(839, 162);
this.TxtLog.TabIndex = 110;
//
// FrmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(863, 456);
this.Controls.Add(this.TxtLog);
this.Controls.Add(this.BtnAdd10);
this.Controls.Add(this.CboLevel10);
this.Controls.Add(this.TxtName10);
this.Controls.Add(this.CboAction10);
this.Controls.Add(this.label46);
this.Controls.Add(this.TxtRfid10);
this.Controls.Add(this.label47);
this.Controls.Add(this.TxtMark10);
this.Controls.Add(this.label48);
this.Controls.Add(this.label49);
this.Controls.Add(this.label50);
this.Controls.Add(this.BtnAdd9);
this.Controls.Add(this.CboLevel9);
this.Controls.Add(this.TxtName9);
this.Controls.Add(this.CboAction9);
this.Controls.Add(this.label41);
this.Controls.Add(this.TxtRfid9);
this.Controls.Add(this.label42);
this.Controls.Add(this.TxtMark9);
this.Controls.Add(this.label43);
this.Controls.Add(this.label44);
this.Controls.Add(this.label45);
this.Controls.Add(this.BtnAdd8);
this.Controls.Add(this.CboLevel8);
this.Controls.Add(this.TxtName8);
this.Controls.Add(this.CboAction8);
this.Controls.Add(this.label36);
this.Controls.Add(this.TxtRfid8);
this.Controls.Add(this.label37);
this.Controls.Add(this.TxtMark8);
this.Controls.Add(this.label38);
this.Controls.Add(this.label39);
this.Controls.Add(this.label40);
this.Controls.Add(this.BtnAdd7);
this.Controls.Add(this.CboLevel7);
this.Controls.Add(this.TxtName7);
this.Controls.Add(this.CboAction7);
this.Controls.Add(this.label31);
this.Controls.Add(this.TxtRfid7);
this.Controls.Add(this.label32);
this.Controls.Add(this.TxtMark7);
this.Controls.Add(this.label33);
this.Controls.Add(this.label34);
this.Controls.Add(this.label35);
this.Controls.Add(this.BtnAdd6);
this.Controls.Add(this.CboLevel6);
this.Controls.Add(this.TxtName6);
this.Controls.Add(this.CboAction6);
this.Controls.Add(this.label26);
this.Controls.Add(this.TxtRfid6);
this.Controls.Add(this.label27);
this.Controls.Add(this.TxtMark6);
this.Controls.Add(this.label28);
this.Controls.Add(this.label29);
this.Controls.Add(this.label30);
this.Controls.Add(this.BtnAdd5);
this.Controls.Add(this.CboLevel5);
this.Controls.Add(this.TxtName5);
this.Controls.Add(this.CboAction5);
this.Controls.Add(this.label21);
this.Controls.Add(this.TxtRfid5);
this.Controls.Add(this.label22);
this.Controls.Add(this.TxtMark5);
this.Controls.Add(this.label23);
this.Controls.Add(this.label24);
this.Controls.Add(this.label25);
this.Controls.Add(this.BtnAdd4);
this.Controls.Add(this.CboLevel4);
this.Controls.Add(this.TxtName4);
this.Controls.Add(this.CboAction4);
this.Controls.Add(this.label16);
this.Controls.Add(this.TxtRfid4);
this.Controls.Add(this.label17);
this.Controls.Add(this.TxtMark4);
this.Controls.Add(this.label18);
this.Controls.Add(this.label19);
this.Controls.Add(this.label20);
this.Controls.Add(this.BtnAdd3);
this.Controls.Add(this.CboLevel3);
this.Controls.Add(this.TxtName3);
this.Controls.Add(this.CboAction3);
this.Controls.Add(this.label11);
this.Controls.Add(this.TxtRfid3);
this.Controls.Add(this.label12);
this.Controls.Add(this.TxtMark3);
this.Controls.Add(this.label13);
this.Controls.Add(this.label14);
this.Controls.Add(this.label15);
this.Controls.Add(this.BtnAdd2);
this.Controls.Add(this.CboLevel2);
this.Controls.Add(this.TxtName2);
this.Controls.Add(this.CboAction2);
this.Controls.Add(this.label6);
this.Controls.Add(this.TxtRfid2);
this.Controls.Add(this.label7);
this.Controls.Add(this.TxtMark2);
this.Controls.Add(this.label8);
this.Controls.Add(this.label9);
this.Controls.Add(this.label10);
this.Controls.Add(this.BtnAdd1);
this.Controls.Add(this.CboLevel1);
this.Controls.Add(this.TxtName1);
this.Controls.Add(this.CboAction1);
this.Controls.Add(this.label1);
this.Controls.Add(this.TxtRfid1);
this.Controls.Add(this.label2);
this.Controls.Add(this.TxtMark1);
this.Controls.Add(this.label3);
this.Controls.Add(this.label4);
this.Controls.Add(this.label5);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "FrmMain";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Form1";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmMain_FormClosing);
this.Load += new System.EventHandler(this.FrmMain_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button BtnAdd1;
private System.Windows.Forms.ComboBox CboLevel1;
private System.Windows.Forms.ComboBox CboAction1;
private System.Windows.Forms.TextBox TxtRfid1;
private System.Windows.Forms.TextBox TxtMark1;
private System.Windows.Forms.TextBox TxtName1;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button BtnAdd2;
private System.Windows.Forms.ComboBox CboLevel2;
private System.Windows.Forms.TextBox TxtName2;
private System.Windows.Forms.ComboBox CboAction2;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.TextBox TxtRfid2;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox TxtMark2;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Button BtnAdd3;
private System.Windows.Forms.ComboBox CboLevel3;
private System.Windows.Forms.TextBox TxtName3;
private System.Windows.Forms.ComboBox CboAction3;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.TextBox TxtRfid3;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.TextBox TxtMark3;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.Button BtnAdd4;
private System.Windows.Forms.ComboBox CboLevel4;
private System.Windows.Forms.TextBox TxtName4;
private System.Windows.Forms.ComboBox CboAction4;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.TextBox TxtRfid4;
private System.Windows.Forms.Label label17;
private System.Windows.Forms.TextBox TxtMark4;
private System.Windows.Forms.Label label18;
private System.Windows.Forms.Label label19;
private System.Windows.Forms.Label label20;
private System.Windows.Forms.Button BtnAdd5;
private System.Windows.Forms.ComboBox CboLevel5;
private System.Windows.Forms.TextBox TxtName5;
private System.Windows.Forms.ComboBox CboAction5;
private System.Windows.Forms.Label label21;
private System.Windows.Forms.TextBox TxtRfid5;
private System.Windows.Forms.Label label22;
private System.Windows.Forms.TextBox TxtMark5;
private System.Windows.Forms.Label label23;
private System.Windows.Forms.Label label24;
private System.Windows.Forms.Label label25;
private System.Windows.Forms.Button BtnAdd6;
private System.Windows.Forms.ComboBox CboLevel6;
private System.Windows.Forms.TextBox TxtName6;
private System.Windows.Forms.ComboBox CboAction6;
private System.Windows.Forms.Label label26;
private System.Windows.Forms.TextBox TxtRfid6;
private System.Windows.Forms.Label label27;
private System.Windows.Forms.TextBox TxtMark6;
private System.Windows.Forms.Label label28;
private System.Windows.Forms.Label label29;
private System.Windows.Forms.Label label30;
private System.Windows.Forms.Button BtnAdd7;
private System.Windows.Forms.ComboBox CboLevel7;
private System.Windows.Forms.TextBox TxtName7;
private System.Windows.Forms.ComboBox CboAction7;
private System.Windows.Forms.Label label31;
private System.Windows.Forms.TextBox TxtRfid7;
private System.Windows.Forms.Label label32;
private System.Windows.Forms.TextBox TxtMark7;
private System.Windows.Forms.Label label33;
private System.Windows.Forms.Label label34;
private System.Windows.Forms.Label label35;
private System.Windows.Forms.Button BtnAdd8;
private System.Windows.Forms.ComboBox CboLevel8;
private System.Windows.Forms.TextBox TxtName8;
private System.Windows.Forms.ComboBox CboAction8;
private System.Windows.Forms.Label label36;
private System.Windows.Forms.TextBox TxtRfid8;
private System.Windows.Forms.Label label37;
private System.Windows.Forms.TextBox TxtMark8;
private System.Windows.Forms.Label label38;
private System.Windows.Forms.Label label39;
private System.Windows.Forms.Label label40;
private System.Windows.Forms.Button BtnAdd9;
private System.Windows.Forms.ComboBox CboLevel9;
private System.Windows.Forms.TextBox TxtName9;
private System.Windows.Forms.ComboBox CboAction9;
private System.Windows.Forms.Label label41;
private System.Windows.Forms.TextBox TxtRfid9;
private System.Windows.Forms.Label label42;
private System.Windows.Forms.TextBox TxtMark9;
private System.Windows.Forms.Label label43;
private System.Windows.Forms.Label label44;
private System.Windows.Forms.Label label45;
private System.Windows.Forms.Button BtnAdd10;
private System.Windows.Forms.ComboBox CboLevel10;
private System.Windows.Forms.TextBox TxtName10;
private System.Windows.Forms.ComboBox CboAction10;
private System.Windows.Forms.Label label46;
private System.Windows.Forms.TextBox TxtRfid10;
private System.Windows.Forms.Label label47;
private System.Windows.Forms.TextBox TxtMark10;
private System.Windows.Forms.Label label48;
private System.Windows.Forms.Label label49;
private System.Windows.Forms.Label label50;
private System.Windows.Forms.TextBox TxtLog;
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Clinet;
namespace ClientTest
{
public partial class FrmMain : Form
{
private AgvClient client;
public FrmMain()
{
InitializeComponent();
}
private void FrmMain_Load(object sender, EventArgs e)
{
client = new AgvClient("127.0.0.1");
client.Log += Client_Log;
client.Connect();
}
private void Client_Log(string s)
{
TxtLog.AppendText(s + "\r\n");
}
private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
{
client.Close();
}
private void BtnAdd_Click(object sender, EventArgs e)
{
string idx = (sender as Button).Name.Substring(6, 1);
string name = Controls["TxtName" + idx].Text;
string mark = Controls["TxtMark" + idx].Text;
string rfid = Controls["TxtRfid" + idx].Text;
ClientAction action = (ClientAction)((ComboBox)Controls["CboAction" + idx]).SelectedIndex;
ClientLevel level = (ClientLevel)((ComboBox)Controls["CboLevel" + idx]).SelectedIndex;
client.SetStatus(name, mark, rfid, action, level);
}
}
}
<?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>
</root>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ClientTest
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FrmMain());
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("ClientTest")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ClientTest")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("abca001e-d223-4ffd-b9e9-3e47e0f5db7a")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [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 ClientTest.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.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 ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ClientTest.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 覆盖当前线程的 CurrentUICulture 属性
/// 使用此强类型的资源类的资源查找。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
<?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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ClientTest.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Web.Script.Serialization;
namespace Clinet
{
public class AgvClient
{
private string _ip; //远程IP地址
private Socket client; //客户端
private int countRecon; //重连次数
private Timer timerRecon;
private Timer timerSend;
private Timer timerListen;
private List<ClientNode> _node;
private const int PORT = 12000; //端口
public delegate void LogEvent(string s);
public event LogEvent Log;
/// <summary>
/// 小车动作事件
/// </summary>
public delegate void ActionEvent(string name, string rfid);
/// <summary>
/// 小车到达,仅包装料仓
/// </summary>
public event ActionEvent Arrive;
/// <summary>
/// 小车已准备,对接完成
/// </summary>
public event ActionEvent Ready;
/// <summary>
/// 关门,仅包装料仓
/// </summary>
public event ActionEvent CloseDoor;
/// <summary>
/// 准备进入料架不能出料,仅包装料仓
/// </summary>
public event ActionEvent EnterShelf;
public AgvClient(string serverIP)
{
_ip = serverIP;
_node = new List<ClientNode>();
ThreadPool.SetMaxThreads(6, 6); //线程池最大数量
}
public bool IsConn { private set; get; } = false;
public void Connect()
{
countRecon = 0;
IsConn = false;
timerRecon = new Timer(Reconnect, null, 0, 5000);
}
public void Close()
{
if (timerRecon != null)
timerRecon.Dispose();
if (timerSend != null)
timerSend.Dispose();
if (timerListen != null)
timerListen.Dispose();
Log?.Invoke("AGV客户端关闭");
}
public void SetStatus(string name, string mark = "", string rfid = "", ClientAction action = ClientAction.None, ClientLevel level = ClientLevel.Low)
{
int idx = _node.FindIndex(s => s.Name == name);
if (idx == -1)
{
ClientNode node = new ClientNode(name, mark, rfid, action, level);
_node.Add(node);
Log?.Invoke("SetStatus " + node.ToText());
}
else
{
_node[idx].Mark = mark;
_node[idx].RFID = rfid;
_node[idx].Action = action;
_node[idx].Level = level;
Log?.Invoke("SetStatus " + _node[idx].ToText());
}
}
public void SetStatus(ClientNode node)
{
int idx = _node.FindIndex(s => s.Name == node.Name);
if (idx == -1)
{
_node.Add(node.ToCopy());
Log?.Invoke("SetStatus " + node.ToText());
}
else
{
_node[idx].Mark = node.Mark;
_node[idx].RFID = node.RFID;
_node[idx].Action = node.Action;
_node[idx].Level = node.Level;
Log?.Invoke("SetStatus " + _node[idx].ToText());
}
}
private void Reconnect(object obj)
{
if (IsConn) return;
Open();
if (IsConn)
{
countRecon = 0;
Log?.Invoke("连接AGV服务器成功");
timerSend = new Timer(SendStatus, null, 50, 2000);
timerListen = new Timer(ListenNet, null, 50, 100);
}
else
{
Log?.Invoke("连接服务器失败" + ++countRecon + "次");
}
}
private void Open()
{
IsConn = false;
try
{
if (CheckIP(_ip))
{
client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, 2000);
client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, 2000);
client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.NoDelay, 1);
client.Connect(IPAddress.Parse(_ip), PORT);
IsConn = true;
}
}
catch (Exception ex)
{
Log?.Invoke(ex.Message);
}
}
private void ListenNet(object obj)
{
byte[] temp = new byte[200];
try
{
if (client.Available > 0)
{
int count = client.Receive(temp);
byte[] buff = new byte[count];
Array.Copy(temp, 0, buff, 0, count);
ClientNode node = Decode(buff);
if (node == null)
Log?.Invoke("命令解析失败: " + HexBuff(buff));
else
Log?.Invoke("From Server: " + node.ToText());
Resolve(node);
}
}
catch (Exception ex)
{
IsConn = false;
Log?.Invoke(ex.Message);
}
}
private void SendStatus(object obj)
{
for (int i = 0; i < _node.Count; i++)
{
if (!IsConn) break;
Thread.Sleep(50);
byte[] buff = Encode(_node[i]);
bool bln = Send(buff);
if (!bln) IsConn = false;
}
}
private void Resolve(ClientNode node)
{
if (node == null) return;
switch (node.Action)
{
case ClientAction.Arrive:
Log?.Invoke("触发Arrive事件");
Arrive?.Invoke(node.Name, node.RFID);
break;
case ClientAction.Ready:
Log?.Invoke("触发Ready事件");
Ready?.Invoke(node.Name, node.RFID);
break;
case ClientAction.CloseDoor:
Log?.Invoke("触发CloseDoor事件");
CloseDoor?.Invoke(node.Name, node.RFID);
break;
case ClientAction.EnterShelf:
Log?.Invoke("触发EnterShelf事件");
EnterShelf?.Invoke(node.Name, node.RFID);
break;
}
}
private bool Send(byte[] buff)
{
if (!IsConn)
{
Log?.Invoke("Send 服务器没有连接");
return false;
}
try
{
//Log?.Invoke("Send: " + HexBuff(buff));
client.Send(buff);
return true;
}
catch (Exception ex)
{
Log?.Invoke(ex.Message);
return false;
}
}
//private byte[] Encode(ClientNode node)
//{
// byte[] name = Encoding.UTF8.GetBytes(node.Name);
// byte[] mark = Encoding.UTF8.GetBytes(node.Mark);
// byte[] rfid = Encoding.UTF8.GetBytes(node.RFID);
// int count = name.Length + mark.Length + rfid.Length + 7;
// int idx = 0;
// byte[] buff = new byte[count];
// buff[idx++] = 0xAB;
// buff[idx++] = Convert.ToByte(name.Length);
// Array.Copy(name, 0, buff, idx, name.Length);
// idx += name.Length;
// buff[idx++] = Convert.ToByte(mark.Length);
// Array.Copy(mark, 0, buff, idx, mark.Length);
// idx += mark.Length;
// buff[idx++] = Convert.ToByte(rfid.Length);
// Array.Copy(rfid, 0, buff, idx, rfid.Length);
// idx += rfid.Length;
// buff[idx++] = (byte)node.Action;
// buff[idx++] = Convert.ToByte(node.Level);
// buff[idx++] = 0xBA;
// return buff;
//}
private byte[] Encode(ClientNode node)
{
List<string> arr = new List<string>
{
"name:\"" + node.Name + "\"",
"mark:\"" + node.Mark + "\"",
"rfid:\"" + node.RFID + "\"",
"action:\"" + node.Action.ToString() + "\"",
"level:\"" + node.Level.ToString() + "\""
};
string s = "{" + string.Join(",", arr) + "}";
byte[] buff = Encoding.UTF8.GetBytes(s);
return buff;
}
//private ClientNode Decode(byte[] buff)
//{
// int idx = 0;
// if (buff[idx++] != 0xAB) return null;
// byte[] temp1 = new byte[buff[idx++]];
// Array.Copy(buff, idx, temp1, 0, temp1.Length);
// string name = Encoding.UTF8.GetString(temp1);
// idx += temp1.Length;
// temp1 = new byte[buff[idx++]];
// Array.Copy(buff, idx, temp1, 0, temp1.Length);
// string mark = Encoding.UTF8.GetString(temp1);
// idx += temp1.Length;
// temp1 = new byte[buff[idx++]];
// Array.Copy(buff, idx, temp1, 0, temp1.Length);
// string rfid = Encoding.UTF8.GetString(temp1);
// idx += temp1.Length;
// ClientAction action = (ClientAction)buff[idx++];
// ClientLevel level = (ClientLevel)buff[idx++];
// ClientNode node = new ClientNode(name, mark, rfid, action, level);
// if (buff[idx] != 0xBA)
// return null;
// return node;
//}
private ClientNode Decode(byte[] buff)
{
string json = Encoding.UTF8.GetString(buff);
JavaScriptSerializer serializer = new JavaScriptSerializer();
Dictionary<string, object> dic = (Dictionary<string, object>)serializer.DeserializeObject(json);
if (dic == null) return null;
ClientNode node = new ClientNode();
if (dic.TryGetValue("name", out object value))
node.Name = value.ToString();
if (dic.TryGetValue("mark", out value))
node.Mark = value.ToString();
if (dic.TryGetValue("rfid", out value))
node.RFID = value.ToString();
if (dic.TryGetValue("action", out value))
{
if (Enum.TryParse(value.ToString(), out ClientAction action))
node.Action = action;
}
if (dic.TryGetValue("level", out value))
{
if (Enum.TryParse(value.ToString(), out ClientLevel level))
node.Level = level;
}
return node;
}
private string HexBuff(byte[] buff)
{
string s = "";
if (buff == null) return s;
for (int i = 0; i < buff.Length; i++)
s += buff[i].ToString("X2") + " ";
return s;
}
private bool CheckIP(string ip)
{
//IP合法
string pattern = @"^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$";
bool rtn = System.Text.RegularExpressions.Regex.IsMatch(ip, pattern);
if (!rtn)
{
Log?.Invoke("非法的IP地址" + ip);
return false;
}
//Ping服务端
try
{
System.Net.NetworkInformation.Ping ping = new System.Net.NetworkInformation.Ping();
System.Net.NetworkInformation.PingReply result = ping.Send(ip, 2000);
ping.Dispose();
if (result.Status != System.Net.NetworkInformation.IPStatus.Success)
{
Log?.Invoke("Ping " + ip + " 请求没有响应");
return false;
}
return true;
}
catch (Exception ex)
{
Log?.Invoke(ex.Message);
return false;
}
}
}
/// <summary>
/// 客户端的动作
/// </summary>
public enum ClientAction : byte
{
/// <summary>
/// 没有动作
/// </summary>
None = 0,
/// <summary>
/// 包装料仓关门
/// </summary>
CloseDoor = 1,
/// <summary>
/// 可以进入料架,Arrive事件使用,让小车开始对接
/// </summary>
MayEnter = 2,
/// <summary>
/// 可以出去料架,Arrive事件使用,让小车开始对接
/// </summary>
MayLeave = 3,
/// <summary>
/// 需要进入料架
/// </summary>
NeedEnter = 4,
/// <summary>
/// 需要出去料架
/// </summary>
NeedLeave = 5,
/// <summary>
/// 完成进入料架
/// </summary>
FinishEnter = 6,
/// <summary>
/// 完成出去料架
/// </summary>
FinishLeave = 7,
/// <summary>
/// 小车到达,到达包装料仓门口,等待开门
/// </summary>
Arrive = 8,
/// <summary>
/// 小车已准备,已对接上流水线
/// </summary>
Ready = 9,
/// <summary>
/// 包装料仓只能入料不能出料
/// </summary>
EnterShelf = 10,
/// <summary>
/// 不允许
/// </summary>
MayNot = 11
}
/// <summary>
/// 客户端的优先级
/// </summary>
public enum ClientLevel : byte
{
/// <summary>
/// 低
/// </summary>
Low = 0,
/// <summary>
/// 中等
/// </summary>
Middle = 1,
/// <summary>
/// 高
/// </summary>
High = 2
}
public class ClientNode
{
/// <summary>
/// 节点名称
/// </summary>
public string Name { set; get; }
/// <summary>
/// 标记,用于包装料仓
/// </summary>
public string Mark { set; get; }
/// <summary>
/// 当前架子的RFID
/// </summary>
public string RFID { set; get; }
/// <summary>
/// 动作
/// </summary>
public ClientAction Action { set; get; }
/// <summary>
/// 优先级
/// </summary>
public ClientLevel Level { set; get; }
public ClientNode()
{
}
public ClientNode(string name, string mark, string rfid, ClientAction action, ClientLevel level)
{
Name = name;
Mark = mark;
RFID = rfid;
Action = action;
Level = level;
}
/// <summary>
/// 所有属性的文本形式
/// </summary>
/// <returns></returns>
public string ToText()
{
string s = string.Format("Name={0}, Action={1}, Level={2}, Mark={3}, RFID={4}", Name, Action, Level, Mark, RFID);
return s;
}
public ClientNode ToCopy()
{
ClientNode node = new ClientNode(Name, Mark, RFID, Action, Level);
return node;
}
}
}
<?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>{284B40AD-DD3E-4BC5-9FDC-016490AF17AE}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Clinet</RootNamespace>
<AssemblyName>Clinet</AssemblyName>
<TargetFrameworkVersion>v4.6</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="System" />
<Reference Include="System.Core" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AgvClient.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</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("Clinet")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Clinet")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("284b40ad-dd3e-4bc5-9fdc-016490af17ae")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [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;
namespace Model
{
public class AgvInfo
{
/// <summary>
/// 小车名称
/// </summary>
public string Name { set; get; } = "";
/// <summary>
/// 在Fleet中的ID
/// </summary>
public string FleetID { set; get; } = "";
/// <summary>
/// 小车IP地址
/// </summary>
public string IP { set; get; } = "";
/// <summary>
/// 授权码
/// </summary>
public string Authorization { set; get; } = "";
/// <summary>
/// 是否自动使用
/// </summary>
public bool IsAuto { set; get; } = false;
/// <summary>
/// 是否在线
/// </summary>
public bool IsOnline { set; get; } = false;
/// <summary>
/// 电量百分比
/// </summary>
public int Battery { set; get; } = 0;
/// <summary>
/// AGV最大充电电量
/// </summary>
public int BatteryMax { set; get; } = 0;
/// <summary>
/// AGV最低电量,小于此值必须充电
/// </summary>
public int BatteryMin { set; get; } = 0;
/// <summary>
/// 状态ID号
/// </summary>
public int StateID { set; get; } = -1;
/// <summary>
/// 状态文本
/// </summary>
public string StateText { set; get; } = "";
/// <summary>
/// 任务文本
/// </summary>
public string MissionText { set; get; } = "";
/// <summary>
/// 小车坐标位置
/// </summary>
public System.Drawing.PointF Position { set; get; }
/// <summary>
/// 是否正在被调用
/// </summary>
public bool IsCall { set; get; } = false;
/// <summary>
/// 当前的工作
/// </summary>
public IJob CurrentJob { set; get; } = null;
/// <summary>
/// 当前位置
/// </summary>
public string Place { set; get; } = "";
public AgvInfo()
{
}
public bool IsWorkshop4D
{
get
{
//小车地图中的Y坐标
if (Position.Y < 55)
return true;
else if (Position.Y > 62)
return false;
else
return false;
}
}
public string[] ToGridRow()
{
string[] arr = new string[] { Name, Place, StateText, Battery.ToString(), IsOnline.ToString(), IsAuto.ToString(), "清除" };
return arr;
}
public string ToMissionState()
{
string s = Name + " [" + IP + "]\r\n\r\n" + MissionText;
return s;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
/// <summary>
/// 客户端的动作
/// </summary>
public enum ClientAction : byte
{
/// <summary>
/// 没有动作
/// </summary>
None = 0,
/// <summary>
/// 包装料仓关门
/// </summary>
CloseDoor = 1,
/// <summary>
/// 可以进入料架,Arrive事件使用,让小车开始对接
/// </summary>
MayEnter = 2,
/// <summary>
/// 可以出去料架,Arrive事件使用,让小车开始对接
/// </summary>
MayLeave = 3,
/// <summary>
/// 需要进入料架
/// </summary>
NeedEnter = 4,
/// <summary>
/// 需要出去料架
/// </summary>
NeedLeave = 5,
/// <summary>
/// 完成进入料架
/// </summary>
FinishEnter = 6,
/// <summary>
/// 完成出去料架
/// </summary>
FinishLeave = 7,
/// <summary>
/// 小车到达,到达包装料仓门口,等待开门
/// </summary>
Arrive = 8,
/// <summary>
/// 小车已准备,已对接上流水线
/// </summary>
Ready = 9,
/// <summary>
/// 包装料仓只能入料不能出料
/// </summary>
EnterShelf = 10,
/// <summary>
/// 不允许
/// </summary>
MayNot = 11
}
/// <summary>
/// 客户端的优先级
/// </summary>
public enum ClientLevel : byte
{
/// <summary>
/// 低
/// </summary>
Low = 0,
/// <summary>
/// 中等
/// </summary>
Middle = 1,
/// <summary>
/// 高
/// </summary>
High = 2
}
public class ClientNode
{
/// <summary>
/// 节点名称
/// </summary>
public string Name { set; get; }
/// <summary>
/// 标记,用于包装料仓
/// </summary>
public string Mark { set; get; }
/// <summary>
/// 当前架子的RFID
/// </summary>
public string RFID { set; get; }
/// <summary>
/// 动作
/// </summary>
public ClientAction Action { set; get; }
/// <summary>
/// 优先级
/// </summary>
public ClientLevel Level { set; get; }
public ClientNode()
{
}
public ClientNode(string name, string mark, string rfid, ClientAction action, ClientLevel level)
{
Name = name;
Mark = mark;
RFID = rfid;
Action = action;
Level = level;
}
/// <summary>
/// 所有属性的文本形式
/// </summary>
/// <returns></returns>
public string ToText()
{
string s = string.Format("Name={0}, Action={1}, Level={2}, Mark={3}, RFID={4}", Name, Action, Level, Mark, RFID);
return s;
}
public ClientNode ToCopy()
{
ClientNode node = new ClientNode(Name, Mark, RFID, Action, Level);
return node;
}
}
}
using System;
using System.Collections.Generic;
namespace Model
{
public static class Common
{
public static List<AgvInfo> agvInfos;
public static bool fleetSend;
public static List<ClientNode> nodeInfos;
public const string MISSION_CHARGE = "AutoCharge";
public const string MISSION_STANDBY = "MoveStandby";
public const string MISSION_PASS_DOOR = "PassDoorInto";
public const string MISSION_PASS_DOOR_4D = "PassDoorInto4D";
public const string MISSION_PASS_DOOR_4C = "PassDoorInto4C";
}
}
using System;
namespace Model
{
public interface IJob
{
public bool IsEnd { get; }
public IJob Execute(AgvInfo info);
}
}
using System;
namespace Model
{
public class JobStep<T>
{
private T _step;
private DateTime _time;
private string _msg;
public JobStep(T step)
{
_step = step;
_time = DateTime.Now;
_msg = "";
}
public bool Equals(T step)
{
return _step.Equals(step);
}
public bool TimeOut(int ms)
{
TimeSpan span = DateTime.Now - _time;
if (span.TotalMilliseconds > ms)
return true;
else
return false;
}
public void NextStep(T step)
{
_step = step;
_time = DateTime.Now;
_msg = "";
}
public string Msg
{
get
{
return _msg;
}
set
{
if (!string.IsNullOrEmpty(value) && !_msg.Equals(value))
{
_msg = value;
string s = string.Format("{0} (step={1})", _msg, _step.ToString());
//LogOut.Info(s);
LogOut.UIShow(s);
}
}
}
}
}
using System;
namespace Model
{
public static class LogOut
{
private static log4net.ILog LOG;
public static System.Windows.Forms.TextBox LogBox { set; get; }
public static void Init(string name)
{
LOG = log4net.LogManager.GetLogger(name);
}
public static void UIShow(string s)
{
if (LogBox == null) return;
string time = string.Format("[{0:HH:mm:ss}] ", DateTime.Now);
LogBox.AppendText(time + s + "\r\n");
LogBox.ScrollToCaret();
}
public static void Error(string s, Exception ex)
{
LOG.Error(s, ex);
}
public static void Debug(string s)
{
LOG.Debug(s);
}
public static void Info(string s)
{
LOG.Info(s);
}
public static void Fatal(string s, Exception ex)
{
LOG.Fatal(s, ex);
}
public static void Warn(string s)
{
LOG.Warn(s);
}
}
}
using System;
using System.Collections.Generic;
using System.Web.Script.Serialization;
using RestSharp;
namespace Model
{
/// <summary>
/// MiR小车API
/// </summary>
public static class MiR_API
{
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger("MiR_API");
private const int httpTimeout = 10000;
/// <summary>
/// Fleet的IP地址
/// </summary>
public static string FleetIP { set; get; }
/// <summary>
/// 任务列表
/// </summary>
public static Dictionary<string, string> MissionList { set; get; }
/// <summary>
/// 获取IO模块guid列表
/// </summary>
/// <param name="ip"></param>
/// <param name="authorization"></param>
/// <param name="guid"></param>
/// <returns></returns>
public static bool Get_IO_Modules(string ip, string authorization, out string[] guid)
{
guid = null;
try
{
string url = "http://" + ip + "/api/v2.0.0/io_modules";
string json = HttpGet(url, ip, authorization);
if (string.IsNullOrWhiteSpace(json)) return false;
JavaScriptSerializer serializer = new JavaScriptSerializer();
object[] obj = (object[])serializer.DeserializeObject(json);
if (obj == null) return false;
guid = new string[obj.Length];
for (int i = 0; i < obj.Length; i++)
{
Dictionary<string, object> dic = (Dictionary<string, object>)obj[i];
guid[i] = dic["guid"].ToString();
}
return true;
}
catch (Exception ex)
{
LOG.Error(ex);
return false;
}
}
/// <summary>
/// 获取IO模块的状态
/// </summary>
/// <param name="ip"></param>
/// <param name="authorization"></param>
/// <param name="guid"></param>
/// <param name="input"></param>
/// <param name="output"></param>
/// <returns></returns>
public static bool Get_IO_Status(string ip, string authorization, string guid, out bool[] input, out bool[] output)
{
input = null;
output = null;
try
{
string url = "http://" + ip + "/api/v2.0.0/io_modules/" + guid + "/status";
string json = HttpGet(url, ip, authorization);
if (string.IsNullOrWhiteSpace(json)) return false;
JavaScriptSerializer serializer = new JavaScriptSerializer();
Dictionary<string, object> dic = (Dictionary<string, object>)serializer.DeserializeObject(json);
if (dic == null) return false;
object[] objInput = (object[])dic["input_state"];
input = new bool[objInput.Length];
for (int i = 0; i < input.Length; i++)
input[i] = Convert.ToBoolean(objInput[i]);
object[] objOutput = (object[])dic["output_state"];
output = new bool[objOutput.Length];
for (int i = 0; i < output.Length; i++)
output[i] = Convert.ToBoolean(objOutput[i]);
return true;
}
catch (Exception ex)
{
LOG.Error(ex);
return false;
}
}
/// <summary>
/// 获取任务状态
/// </summary>
/// <param name="authorization"></param>
/// <param name="id"></param>
/// <param name="state"></param>
/// <returns></returns>
public static bool Get_MissionState_Fleet(string authorization, string id, out string state)
{
state = null;
try
{
string url = "http://" + FleetIP + "/api/v2.0.0/mission_scheduler/" + id;
string json = HttpGet(url, FleetIP, authorization);
if (string.IsNullOrWhiteSpace(json)) return false;
JavaScriptSerializer serializer = new JavaScriptSerializer();
Dictionary<string, object> dic = (Dictionary<string, object>)serializer.DeserializeObject(json);
if (dic == null) return false;
state = dic["state"].ToString();
return true;
}
catch (Exception ex)
{
LOG.Error(ex);
return false;
}
}
/// <summary>
/// 获取任务状态
/// </summary>
/// <param name="ip"></param>
/// <param name="authorization"></param>
/// <param name="id"></param>
/// <param name="state"></param>
/// <returns></returns>
public static bool Get_MissionState(string ip, string authorization, string id, out string state)
{
state = null;
try
{
string url = "http://" + ip + "/api/v2.0.0/mission_queue/" + id;
string json = HttpGet(url, FleetIP, authorization);
if (string.IsNullOrWhiteSpace(json)) return false;
JavaScriptSerializer serializer = new JavaScriptSerializer();
Dictionary<string, object> dic = (Dictionary<string, object>)serializer.DeserializeObject(json);
if (dic == null) return false;
state = dic["state"].ToString();
return true;
}
catch (Exception ex)
{
LOG.Error(ex);
return false;
}
}
/// <summary>
/// 获取PLC寄存器的内容
/// </summary>
/// <param name="ip"></param>
/// <param name="authorization"></param>
/// <param name="reg"></param>
/// <param name="regValue"></param>
/// <returns></returns>
public static bool Get_Register(string ip, string authorization, int reg, out int regValue)
{
regValue = -1;
try
{
string url = "http://" + ip + "/api/v2.0.0/registers/" + reg + "?whitelist=value";
string json = HttpGet(url, ip, authorization);
if (string.IsNullOrWhiteSpace(json)) return false;
JavaScriptSerializer serializer = new JavaScriptSerializer();
Dictionary<string, object> dic = (Dictionary<string, object>)serializer.DeserializeObject(json);
if (dic == null) return false;
string s = dic["value"].ToString();
float f = Convert.ToSingle(s);
regValue = Convert.ToInt32(f);
return true;
}
catch (Exception ex)
{
LOG.Error(ex);
return false;
}
}
/// <summary>
/// 设置PLC寄存器的内容
/// </summary>
/// <param name="ip"></param>
/// <param name="authorization"></param>
/// <param name="reg"></param>
/// <param name="regValue"></param>
/// <returns></returns>
public static bool Set_Register(string ip, string authorization, int reg, int regValue)
{
try
{
string url = "http://" + ip + "/api/v2.0.0/registers/" + reg;
string body = "{\"value\": " + regValue + "}";
string json = HttpPost(url, ip, authorization, body);
if (string.IsNullOrWhiteSpace(json)) return false;
JavaScriptSerializer serializer = new JavaScriptSerializer();
Dictionary<string, object> dic = (Dictionary<string, object>)serializer.DeserializeObject(json);
if (dic == null) return false;
string s = dic["value"].ToString();
float f = Convert.ToSingle(s);
if (regValue == Convert.ToInt32(f))
return true;
else
return false;
}
catch (Exception ex)
{
LOG.Error(ex);
return false;
}
}
/// <summary>
/// 添加任务到小车自身任务队列
/// </summary>
/// <param name="ip"></param>
/// <param name="authorization"></param>
/// <param name="missionName"></param>
/// <param name="id"></param>
/// <returns></returns>
public static bool Add_Mission(string ip, string authorization, string missionName, out string id)
{
id = null;
try
{
string url = "http://" + ip + "/api/v2.0.0/mission_queue";
string body = "{\"mission_id\":\"" + MissionList[missionName] + "\"}";
LOG.Info(string.Format("URL:{0} Body:{1}", url, body));
string json = HttpPost(url, ip, authorization, body);
LOG.Info("Return:" + json);
if (string.IsNullOrWhiteSpace(json)) return false;
JavaScriptSerializer serializer = new JavaScriptSerializer();
Dictionary<string, object> dic = (Dictionary<string, object>)serializer.DeserializeObject(json);
if (dic == null) return false;
id = dic["id"].ToString();
string missionId = dic["mission_id"].ToString();
if (missionId == MissionList[missionName])
return true;
else
return false;
}
catch (Exception ex)
{
LOG.Error(ex);
return false;
}
}
/// <summary>
/// 添加任务到Fleet任务队列
/// </summary>
/// <param name="fleetID"></param>
/// <param name="authorization"></param>
/// <param name="missionName"></param>
/// <param name="id"></param>
/// <returns></returns>
public static bool Add_Mission_Fleet(string fleetID, string authorization, string missionName, out string id)
{
id = null;
try
{
string url = "http://" + FleetIP + "/api/v2.0.0/mission_scheduler";
string body = "{\"mission_id\":\"" + MissionList[missionName] + "\",\"robot_id\":" + fleetID + "}";
LOG.Info(string.Format("URL:{0} Body:{1}", url, body));
string json = HttpPost(url, FleetIP, authorization, body);
LOG.Info("Return:" + json);
if (string.IsNullOrWhiteSpace(json)) return false;
JavaScriptSerializer serializer = new JavaScriptSerializer();
Dictionary<string, object> dic = (Dictionary<string, object>)serializer.DeserializeObject(json);
if (dic == null) return false;
id = dic["id"].ToString();
string missionId = dic["mission_id"].ToString();
if (missionId == MissionList[missionName])
return true;
else
return false;
}
catch (Exception ex)
{
LOG.Error(ex);
return false;
}
}
// /// <summary>
// /// 获取所有任务列表
// /// </summary>
// /// <param name="info"></param>
// /// <param name="mission">任务(名称,guid)</param>
// /// <returns></returns>
// public static bool Get_Mission(AgvInfo info, out Dictionary<string, string> mission)
// {
// try
// {
// mission = null;
// string url = "http://" + info.IP + "/api/v2.0.0/missions/search?whitelist=guid,name";
// string body = "{\"filters\" :[]}";
// string json = HttpPost(url, info.IP, info.Authorization, body);
// Common.log.Info(string.Format("URL: {0}; Body: {1}", url, body)+"\n"+"Return: " + json);
// if (string.IsNullOrWhiteSpace(json)) return false;
// JavaScriptSerializer serializer = new JavaScriptSerializer();
// object[] obj = (object[])serializer.DeserializeObject(json);
// if (obj == null) return false;
// mission = new Dictionary<string, string>();
// for (int i = 0; i < obj.Length; i++)
// {
// Dictionary<string, object> dic = (Dictionary<string, object>)obj[i];
// mission.Add(dic["name"].ToString(), dic["guid"].ToString());
// }
// return true;
// }
// catch (Exception ex)
// {
// mission = null;
// Common.log.Error(ex);
// return false;
// }
// }
// /// <summary>
// /// 获取当前任务队列guid
// /// </summary>
// /// <param name="info"></param>
// /// <param name="mission"></param>
// /// <returns></returns>
// public static bool Get_Mission_Queue(AgvInfo info, out List<string> mission)
// {
// try
// {
// mission = null;
// string url = "http://" + info.IP + "/api/v2.0.0/mission_queue/search";
// string body = "{\"filters\" : [{\"fieldname\": \"state\", \"operator\": \"IN\", \"value\": [\"Pending\", \"Executing\"]}]}";
// string json = HttpPost(url, info.IP, info.Authorization, body);
// Common.log.Info(string.Format("URL: {0}; Body: {1}", url, body)+"\n"+"Return: " + json);
// if (string.IsNullOrWhiteSpace(json)) return false;
// JavaScriptSerializer serializer = new JavaScriptSerializer();
// object[] obj = (object[])serializer.DeserializeObject(json);
// if (obj == null) return false;
// mission = new List<string>();
// Dictionary<string, object> dic;
// for (int i = 0; i < obj.Length; i++)
// {
// dic = (Dictionary<string, object>)obj[i];
// mission.Add(dic["id"].ToString());
// }
// for (int i = 0; i < mission.Count; i++)
// {
// url = "http://" + info.IP + "/api/v2.0.0/mission_queue/" + mission[i];
// json = HttpGet(url, info.IP, info.Authorization);
// serializer = new JavaScriptSerializer();
// dic = (Dictionary<string, object>)serializer.DeserializeObject(json);
// mission[i] = dic["mission_id"].ToString();
// }
// return true;
// }
// catch (Exception ex)
// {
// mission = null;
// Common.log.Error(ex);
// return false;
// }
// }
/// <summary>
/// 删除小车所有任务
/// </summary>
/// <param name="ip"></param>
/// <param name="authorization"></param>
public static void Del_Mission(string ip, string authorization)
{
try
{
string url = "http://" + ip + "/api/v2.0.0/mission_queue";
HttpDel(url, ip, authorization);
}
catch (Exception ex)
{
LOG.Error(ex);
}
}
/// <summary>
/// 删除Fleet尽快中指定id的任务,已运行的无法删除
/// </summary>
/// <param name="authorization"></param>
/// <param name="id"></param>
public static void Del_Mission_Fleet(string authorization, string id)
{
try
{
string url = "http://" + FleetIP + "/api/v2.0.0/mission_scheduler/" + id;
HttpDel(url, FleetIP, authorization);
}
catch (Exception ex)
{
LOG.Error(ex);
}
}
/// <summary>
/// 获取当前小车状态
/// </summary>
/// <param name="ip"></param>
/// <param name="authorization"></param>
/// <param name="stateID"></param>
/// <param name="stateText"></param>
/// <param name="battery"></param>
/// <param name="missionText"></param>
/// <param name="position"></param>
/// <returns></returns>
public static bool Get_State(string ip, string authorization, out int stateID, out string stateText, out int battery, out string missionText, out System.Drawing.PointF position)
{
stateID = -1;
stateText = "";
battery = 0;
missionText = "";
position = new System.Drawing.PointF();
try
{
string url = "http://" + ip + "/api/v2.0.0/status?whitelist=state_id,state_text,battery_percentage,mission_text,position";
string json = HttpGet(url, ip, authorization);
if (string.IsNullOrWhiteSpace(json)) return false;
JavaScriptSerializer serializer = new JavaScriptSerializer();
Dictionary<string, object> dic = (Dictionary<string, object>)serializer.DeserializeObject(json);
if (dic == null) return false;
stateID = Convert.ToInt32(dic["state_id"].ToString());
stateText = dic["state_text"].ToString();
missionText = dic["mission_text"].ToString();
Dictionary<string, object> tt = (Dictionary<string, object>)dic["position"];
position.X = Convert.ToSingle(tt["x"]);
position.Y = Convert.ToSingle(tt["y"]);
string s = dic["battery_percentage"].ToString();
float f = Convert.ToSingle(s);
battery = Convert.ToInt32(f);
return true;
}
catch (Exception ex)
{
LOG.Error(ex);
return false;
}
}
/// <summary>
/// 小车状态改为Ready
/// </summary>
/// <param name="ip"></param>
/// <param name="authorization"></param>
/// <returns></returns>
public static bool State_Ready(string ip, string authorization)
{
try
{
string url = "http://" + ip + "/api/v2.0.0/status?whitelist=state_id,state_text";
string body = "{\"state_id\": 3}";
string json = HttpPut(url, ip, authorization, body);
if (string.IsNullOrWhiteSpace(json)) return false;
JavaScriptSerializer serializer = new JavaScriptSerializer();
Dictionary<string, object> dic = (Dictionary<string, object>)serializer.DeserializeObject(json);
if (dic == null) return false;
string s = dic["state_id"].ToString();
if (s == "3")
return true;
else
return false;
}
catch (Exception ex)
{
LOG.Error(ex);
return false;
}
}
/// <summary>
/// 小车状态改为Pause
/// </summary>
/// <param name="ip"></param>
/// <param name="authorization"></param>
/// <returns></returns>
public static bool State_Pause(string ip, string authorization)
{
try
{
string url = "http://" + ip + "/api/v2.0.0/status?whitelist=state_id,state_text";
string body = "{\"state_id\": 4}";
string json = HttpPut(url, ip, authorization, body);
if (string.IsNullOrWhiteSpace(json)) return false;
JavaScriptSerializer serializer = new JavaScriptSerializer();
Dictionary<string, object> dic = (Dictionary<string, object>)serializer.DeserializeObject(json);
if (dic == null) return false;
string s = dic["state_id"].ToString();
if (s == "4")
return true;
else
return false;
}
catch (Exception ex)
{
LOG.Error(ex);
return false;
}
}
/// <summary>
/// 清除错误
/// </summary>
/// <param name="ip"></param>
/// <param name="authorization"></param>
/// <returns></returns>
public static bool Clear_Error(string ip, string authorization)
{
try
{
string url = "http://" + ip + "/api/v2.0.0/status";
string body = "{\"clear_error\": true}";
string json = HttpPut(url, ip, authorization, body);
if (string.IsNullOrWhiteSpace(json)) return false;
return true;
}
catch (Exception ex)
{
LOG.Error(ex);
return false;
}
}
/// <summary>
/// 检查IP地址
/// </summary>
/// <param name="ip"></param>
/// <returns></returns>
public static bool CheckIP(string ip)
{
//IP合法
string pattern = @"^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$";
bool rtn = System.Text.RegularExpressions.Regex.IsMatch(ip, pattern);
if (!rtn)
{
LOG.Info("非法的IP地址" + ip);
return false;
}
//Ping服务端
try
{
System.Net.NetworkInformation.Ping ping = new System.Net.NetworkInformation.Ping();
System.Net.NetworkInformation.PingReply result = ping.Send(ip, 2000);
ping.Dispose();
if (result.Status != System.Net.NetworkInformation.IPStatus.Success)
{
LOG.Info("Ping " + ip + " 请求没有响应");
return false;
}
return true;
}
catch (Exception ex)
{
LOG.Error(ex);
return false;
}
}
// public static bool GetResourcePosition(AgvInfo info, out Dictionary<string, string> res)
// {
// res = new Dictionary<string, string>();
// string ip = Common.appConfig.AppSettings.Settings["FLEET"].Value;
// string url = "http://" + ip + "/api/v2.0.0/resources/positions";
// string json = HttpGet(url, info.IP, info.Authorization);
// Common.log.Info("URL: " + url + "\n" + "Return: " + json);
// if (string.IsNullOrWhiteSpace(json)) return false;
// JavaScriptSerializer serializer = new JavaScriptSerializer();
// object[] obj = (object[])serializer.DeserializeObject(json);
// if (obj == null) return false;
// for (int i = 0; i < obj.Length; i++)
// {
// string key;
// Dictionary<string, object> dic = (Dictionary<string, object>)obj[i];
// if (dic.TryGetValue("name", out object value))
// key = value.ToString();
// else
// continue;
// if (res.ContainsKey(key))
// continue;
// else
// res.Add(key, "");
// if (dic.TryGetValue("queue", out value))
// {
// object[] temp = (object[])value;
// if (temp.Length == 0) continue;
// string[] robotName = new string[temp.Length];
// for (int j = 0; j < temp.Length; j++)
// {
// if (GetRobot(info, temp[j].ToString(), out string name))
// robotName[j] = name;
// }
// res[key] = string.Join(",", robotName);
// }
// }
// return true;
// }
// public static bool GetResourceArea(AgvInfo info, out Dictionary<string, string> res)
// {
// res = new Dictionary<string, string>();
// string ip = Common.appConfig.AppSettings.Settings["FLEET"].Value;
// string url = "http://" + ip + "/api/v2.0.0/resources/areas";
// string json = HttpGet(url, info.IP, info.Authorization);
// Common.log.Info("URL: " + url + "\n" + "Return: " + json);
// if (string.IsNullOrWhiteSpace(json)) return false;
// JavaScriptSerializer serializer = new JavaScriptSerializer();
// object[] obj = (object[])serializer.DeserializeObject(json);
// if (obj == null) return false;
// for (int i = 0; i < obj.Length; i++)
// {
// string key;
// Dictionary<string, object> dic = (Dictionary<string, object>)obj[i];
// if (dic.TryGetValue("name", out object value))
// key = value.ToString();
// else
// continue;
// if (res.ContainsKey(key))
// continue;
// else
// res.Add(key, "");
// if (dic.TryGetValue("queue", out value))
// {
// object[] temp = (object[])value;
// if (temp.Length == 0) continue;
// string[] robotName = new string[temp.Length];
// for (int j = 0; j < temp.Length; j++)
// {
// if (GetRobot(info, temp[j].ToString(), out string name))
// robotName[j] = name;
// }
// res[key] = string.Join(",", robotName);
// }
// }
// return true;
// }
// public static bool GetRobot(AgvInfo info, string id, out string name)
// {
// name = "";
// string ip = Common.appConfig.AppSettings.Settings["FLEET"].Value;
// string url = "http://" + ip + "/api/v2.0.0/robots/" + id;
// string json = HttpGet(url, info.IP, info.Authorization);
// Common.log.Info("URL: " + url + "\n" + "Return: " + json);
// if (string.IsNullOrWhiteSpace(json)) return false;
// JavaScriptSerializer serializer = new JavaScriptSerializer();
// Dictionary<string, object> dic = (Dictionary<string, object>)serializer.DeserializeObject(json);
// if (dic.TryGetValue("status", out object value))
// {
// Dictionary<string, object> dic2 = (Dictionary<string, object>)value;
// if (dic2.TryGetValue("robot_name", out object robotName))
// {
// name = robotName.ToString();
// return true;
// }
// else
// {
// return false;
// }
// }
// else
// {
// return false;
// }
// }
private static string HttpGet(string url, string ip, string authorization)
{
LOG.Info("[GET]URL:" + url);
RestClient client = new RestClient(url) { Timeout = httpTimeout };
RestRequest request = new RestRequest(Method.GET);
request.AddHeader("Host", ip);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Accept-Language", "zh_CN");
request.AddHeader("Authorization", authorization);
IRestResponse response = client.Execute(request);
string s = response.Content;
if (string.IsNullOrWhiteSpace(s))
{
s = "";
}
else
{
s = s.Replace("\n", "");
s = s.Replace("\r", "");
while (s.IndexOf(" ") >= 0)
s = s.Replace(" ", " ");
}
LOG.Info("Return:" + s);
return s;
}
private static string HttpPost(string url, string ip, string authorization, string body)
{
LOG.Info("[POST]URL:" + url + " Body:" + body);
RestClient client = new RestClient(url) { Timeout = httpTimeout };
RestRequest request = new RestRequest(Method.POST);
request.AddHeader("Host", ip);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", authorization);
request.AddParameter("application/json", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
string s = response.Content;
if (string.IsNullOrWhiteSpace(s))
{
s = "";
}
else
{
s = s.Replace("\n", "");
s = s.Replace("\r", "");
while (s.IndexOf(" ") >= 0)
s = s.Replace(" ", " ");
}
LOG.Info("Return:" + s);
return s;
}
private static string HttpPut(string url, string ip, string authorization, string body)
{
LOG.Info("[PUT]URL:" + url + " Body:" + body);
RestClient client = new RestClient(url) { Timeout = httpTimeout };
RestRequest request = new RestRequest(Method.PUT);
request.AddHeader("Host", ip);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", authorization);
request.AddParameter("application/json", body, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
string s = response.Content;
if (string.IsNullOrWhiteSpace(s))
{
s = "";
}
else
{
s = s.Replace("\n", "");
s = s.Replace("\r", "");
while (s.IndexOf(" ") >= 0)
s = s.Replace(" ", " ");
}
LOG.Info("Return:" + s);
return s;
}
private static void HttpDel(string url, string ip, string authorization)
{
LOG.Info("[DELETE]URL:" + url);
RestClient client = new RestClient(url) { Timeout = httpTimeout };
RestRequest request = new RestRequest(Method.DELETE);
request.AddHeader("Host", ip);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", authorization);
request.AddParameter("application/json", "", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
string s = response.Content;
if (string.IsNullOrWhiteSpace(s))
{
s = "";
}
else
{
s = s.Replace("\n", "");
s = s.Replace("\r", "");
while (s.IndexOf(" ") >= 0)
s = s.Replace(" ", " ");
}
LOG.Info("Return:" + s);
}
}
}
<?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>{CB525EC1-745D-44D4-AE49-B0D16744600B}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Model</RootNamespace>
<AssemblyName>Model</AssemblyName>
<TargetFrameworkVersion>v4.6</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>
<LangVersion>preview</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=2.0.11.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.11\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="RestSharp, Version=106.11.7.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
<HintPath>..\packages\RestSharp.106.11.7\lib\net452\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="AgvInfo.cs" />
<Compile Include="Client.cs" />
<Compile Include="IJob.cs" />
<Compile Include="JobStep.cs" />
<Compile Include="LogOut.cs" />
<Compile Include="MiR_API.cs" />
<Compile Include="Common.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="log4net.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
</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("Model")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Model")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("cb525ec1-745d-44d4-ae49-b0d16744600b")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)]
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<log4net>
<logger name="AGVControl_SMD">
<level value="Debug"/>
<appender-ref ref="smd"/>
</logger>
<logger name="MiR_API">
<level value="Debug"/>
<appender-ref ref="api"/>
</logger>
<appender name="smd" type="log4net.Appender.RollingFileAppender">
<param name="File" value="Log\\AGVControl_SMD.log" />
<param name="Encoding" value="UTF-8"/>
<param name="AppendToFile" value="true" />
<param name="RollingStyle" value="Date" />
<param name="DatePattern" value="yyyy-MM-dd" />
<param name="MaxSizeRollBackups" value="100" />
<param name="MaxFileSize" value="10240" />
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="[%d][%t][%c:%L]%-5p %m%n" />
</layout>
</appender>
<appender name="api" type="log4net.Appender.RollingFileAppender">
<param name="File" value="Log\\MiR_API.log" />
<param name="Encoding" value="UTF-8"/>
<param name="AppendToFile" value="true" />
<param name="RollingStyle" value="Date" />
<param name="DatePattern" value="yyyy-MM-dd" />
<param name="MaxSizeRollBackups" value="100" />
<param name="MaxFileSize" value="10240" />
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="[%d][%t][%c:%L]%-5p %m%n" />
</layout>
</appender>
</log4net>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.11" targetFramework="net46" />
<package id="RestSharp" version="106.11.7" targetFramework="net46" />
</packages>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup>
</configuration>
\ No newline at end of file
namespace AGVControl
{
partial class FrmMain
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.TxtLog = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// TxtLog
//
this.TxtLog.Location = new System.Drawing.Point(22, 12);
this.TxtLog.Multiline = true;
this.TxtLog.Name = "TxtLog";
this.TxtLog.ReadOnly = true;
this.TxtLog.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.TxtLog.Size = new System.Drawing.Size(212, 211);
this.TxtLog.TabIndex = 0;
//
// FrmMain
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.TxtLog);
this.Name = "FrmMain";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Form1";
this.Load += new System.EventHandler(this.FrmMain_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox TxtLog;
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Model;
namespace AGVControl
{
public partial class FrmMain : Form
{
public FrmMain()
{
InitializeComponent();
}
private void FrmMain_Load(object sender, EventArgs e)
{
LogOut.LogBox = TxtLog;
}
}
}
<?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>
</root>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AGVControl
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
Application.ThreadException += Application_ThreadException;
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Model.LogOut.Init("AGVControl_SMD");
Model.LogOut.Info("=====程序开始=====");
Application.Run(new FrmMain());
Model.LogOut.Info("=====程序结束=====\r\n");
}
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Model.LogOut.Error("CurrentDomain_UnhandledException", (Exception)e.ExceptionObject);
}
private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
{
Model.LogOut.Error("Application_ThreadException", e.Exception);
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("UI")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UI")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("b2384612-3693-4bfd-ad71-078fb1704566")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace AGVControl.Properties {
using System;
/// <summary>
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// 返回此类使用的缓存的 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AGVControl.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;
}
}
}
}
<?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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace AGVControl.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.7.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
<?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>{B2384612-3693-4BFD-AD71-078FB1704566}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>AGVControl</RootNamespace>
<AssemblyName>AGVControl</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<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.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="FrmMain.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmMain.Designer.cs">
<DependentUpon>FrmMain.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="FrmMain.resx">
<DependentUpon>FrmMain.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Model\Model.csproj">
<Project>{cb525ec1-745d-44d4-ae49-b0d16744600b}</Project>
<Name>Model</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!