Commit 112cb683 顾剑亮

添加json日志

1 个父辈 91b4f973
正在显示 126 个修改的文件 包含 529 行增加2510 行删除
......@@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30413.136
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AGVControl_Steel(old)", "AGVControl_Steel\AGVControl_Steel(old).csproj", "{BE830571-6737-4FA7-A75B-0242B07E011C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{752A054D-58EC-460A-A936-F5483B1BC8B2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BLL", "BLL\BLL.csproj", "{C547FEDD-0B62-4AC3-96E7-C86DD38C670B}"
......@@ -21,10 +19,6 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BE830571-6737-4FA7-A75B-0242B07E011C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BE830571-6737-4FA7-A75B-0242B07E011C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BE830571-6737-4FA7-A75B-0242B07E011C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BE830571-6737-4FA7-A75B-0242B07E011C}.Release|Any CPU.Build.0 = Release|Any CPU
{752A054D-58EC-460A-A936-F5483B1BC8B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{752A054D-58EC-460A-A936-F5483B1BC8B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{752A054D-58EC-460A-A936-F5483B1BC8B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
......
<?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>{BE830571-6737-4FA7-A75B-0242B07E011C}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>AGVControl_Steel</RootNamespace>
<AssemblyName>AGVControl_Steel</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<LangVersion>preview</LangVersion>
</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>
<DocumentationFile>
</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>图标.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="ClassFormParent">
<HintPath>..\..\ClassFormParent\ClassFormParent\bin\Debug\ClassFormParent.dll</HintPath>
</Reference>
<Reference Include="log4net">
<HintPath>..\..\..\..\DLL\log4net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="RestSharp, Version=106.11.4.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
<HintPath>..\packages\RestSharp.106.11.4\lib\net452\RestSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.ServiceModel.Web" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="BLL\Control.cs" />
<Compile Include="BLL\Common.cs" />
<Compile Include="Job\MissionMoveJob.cs" />
<Compile Include="Model\MissionState.cs" />
<Compile Include="Model\MiR_API.cs" />
<Compile Include="Job\TakeOldJob.cs" />
<Compile Include="Job\ChargeJob.cs" />
<Compile Include="Model\AgvInfo.cs" />
<Compile Include="Job\SendNewJob.cs" />
<Compile Include="Job\StorageJob.cs" />
<Compile Include="UI\FrmMain.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\FrmMain.Designer.cs">
<DependentUpon>FrmMain.cs</DependentUpon>
</Compile>
<Compile Include="Model\JobStep.cs" />
<Compile Include="Model\Job.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Job\StandbyJob.cs" />
<Compile Include="BLL\WebService.cs" />
<Compile Include="Model\SteelWork.cs" />
<Compile Include="BLL\SteelManage.cs" />
<Compile Include="Job\WashPointJob.cs" />
<EmbeddedResource Include="UI\FrmMain.resx">
<DependentUpon>FrmMain.cs</DependentUpon>
<SubType>Designer</SubType>
</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="bin\Debug\AGVControl_Steel.exe.config" />
<None Include="bin\Debug\Config\AgvMission.csv" />
<None Include="bin\Debug\Config\AgvName.csv" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Content Include="bin\Debug\AGVControl_Steel.exe" />
<Content Include="bin\Debug\AGVControl_Steel.pdb" />
<Content Include="bin\Debug\AGVControl_Steel.xml" />
<Content Include="bin\Debug\log4net.dll" />
<Content Include="bin\Debug\RestSharp.dll" />
<Content Include="bin\Debug\RestSharp.xml" />
<Content Include="图标.ico" />
</ItemGroup>
<ItemGroup>
<Folder Include="bin\Debug\Logs\" />
<Folder Include="bin\Release\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<log4net>
<appender name="AGVControl_Steel" type="log4net.Appender.RollingFileAppender">
<file value="Logs/AGVControl_Steel.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t][%c:%L]%-5p %m%n"/>
</layout>
</appender>
<appender name="MiR_API" type="log4net.Appender.RollingFileAppender">
<file value="Logs/MiR_API.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t][%c:%L]%-5p %m%n"/>
</layout>
</appender>
<logger name="AGVControl_Steel">
<level value="Debug"/>
<appender-ref ref="AGVControl_Steel"/>
</logger>
<logger name="MiR_API">
<level value="Debug"/>
<appender-ref ref="MiR_API"/>
</logger>
</log4net>
<appSettings>
<add key="FLEET_IP" value="10.85.199.3"/>
<add key="FLEET_Send" value="true"/>
<add key="WebService" value="http://10.85.196.40:8089/"/>
<!--<add key="WebService" value="http://10.211.55.23:8089/"/>-->
<add key="AGV_BATTERY_MAX" value="100"/>
<add key="AGV_BATTERY_MIN" value="40"/>
<add key="Use_32" value="false"/>
<add key="Use_25" value="false"/>
<add key="Work_32" value="4C"/>
<add key="Work_25" value="4D"/>
<add key="PlaceName" value="D1,D2,D3,D4,D5,D6,D7,D8,D9,D10,D11,D12,D13,D14,D15,D16,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,4Cwash,4Dwash,storage"/>
</appSettings>
</configuration>
\ No newline at end of file
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
namespace AGVControl_Steel
{
/// <summary>
/// 公共类
/// </summary>
public static class Common
{
public static System.Windows.Forms.TextBox txtLog;
public static System.Windows.Forms.ListBox lstOldSteel;
public static System.Windows.Forms.ListBox lstNewSteel;
public static System.Windows.Forms.ListBox lstStorage;
public static System.Windows.Forms.Label lblStorageIO;
public static List<AgvInfo> agvInfos;
public static Dictionary<string, string> agvMissions;
public static MiR_API mir;
public static BLL.Control control;
public static BLL.SteelManage steelManage;
public static System.Configuration.Configuration appConfig;
public static log4net.ILog log;
public static string[] PLACE_NAME;
public static bool FLEET_SEND;
public static bool StorageDockFinish = false;
public static bool StorageDockAlway = false;
public const int AGV_CALL_SLEEP = 2000;
public const string STORAGE_ENTER_4C = "4C_enter";
public const string STORAGE_ENTER_4D = "4D_enter";
public const string STORAGE_LEAVE = "leave";
public const string STORAGE_IO_ON = "di_on";
public const string STORAGE_IO_OFF = "di_off";
public const string MISSION_TAKE_OFF_SHELF = "Placeqisdashelf";
public const string MISSION_TAKE_ON_SHELF = "Pickupqisdashelf";
public const string MISSION_PASS_DOOR_INTO = "PassDoorInto";
public const string MISSION_CHARGE = "AutoCharge";
public const string MISSION_STANDBY = "MoveStandby";
public const string MISSION_MOVE_WASH = "MoveWash";
public const string MISSION_MOVE_STORAGE = "MoveSteelstorage";
public const string MISSION_MOVE_D1 = "MoveSteelD1";
public const string MISSION_MOVE_D2 = "MoveSteelD2";
public const string MISSION_MOVE_D3 = "MoveSteelD3";
public const string MISSION_MOVE_D4 = "MoveSteelD4";
public const string MISSION_MOVE_D5 = "MoveSteelD5";
public const string MISSION_MOVE_D6 = "MoveSteelD6";
public const string MISSION_MOVE_D8 = "MoveSteelD8";
public const string MISSION_MOVE_D9 = "MoveSteelD9";
public const string MISSION_MOVE_D10 = "MoveSteelD10";
public const string MISSION_MOVE_D11 = "MoveSteelD11";
public const string MISSION_MOVE_D12 = "MoveSteelD12";
public const string MISSION_MOVE_D14 = "MoveSteelD14";
public const string MISSION_MOVE_D15 = "MoveSteelD15";
public const string MISSION_MOVE_D16 = "MoveSteelD16";
public const string MISSION_MOVE_C1 = "MoveSteelC1";
public const string MISSION_MOVE_C2 = "MoveSteelC2";
public const string MISSION_MOVE_C3 = "MoveSteelC3";
public const string MISSION_MOVE_C4 = "MoveSteelC4";
public const string MISSION_MOVE_C5 = "MoveSteelC5";
public const string MISSION_MOVE_C6 = "MoveSteelC6";
public const string MISSION_MOVE_C7 = "MoveSteelC7";
public const string MISSION_MOVE_C8 = "MoveSteelC8";
public const string MISSION_MOVE_C9 = "MoveSteelC9";
public const string MISSION_MOVE_C10 = "MoveSteelC10";
public static readonly string PATH_AGV_NAME = Environment.CurrentDirectory + "\\Config\\AgvName.csv";
public static readonly string PATH_AGV_MISSION = Environment.CurrentDirectory + "\\Config\\AgvMission.csv";
public static readonly string PATH_NEW_STEEL_WORK = Environment.CurrentDirectory + "\\Config\\NewSteelWork.txt";
public static readonly string PATH_OLD_STEEL_WORK = Environment.CurrentDirectory + "\\Config\\OldSteelWork.txt";
public static readonly string PATH_STORAGE_WORK = Environment.CurrentDirectory + "\\Config\\StorageWork.txt";
}
}
using System;
using System.Collections.Generic;
using System.Threading;
using AGVControl_Steel;
using Model;
namespace BLL
{
/// <summary>
/// 控制类
/// </summary>
public class Control
{
private Timer timerCall;
public delegate void AgvChangedEvent(int agvIndex);
public event AgvChangedEvent AgvChanged;
public event AgvChangedEvent AgvOnline;
/// <summary>
/// 控制类
/// </summary>
public Control()
{
ThreadPool.SetMaxThreads(5, 5); //线程池最大数量
}
/// <summary>
/// 打开服务
/// </summary>
public void Start()
{
timerCall = new Timer(CallProcess, null, 0, Common.AGV_CALL_SLEEP);
}
/// <summary>
/// 关闭服务
/// </summary>
public void Stop()
{
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 == 4) //Pause
Common.mir.State_Ready(info.IP, info.Authorization);
if (info.CurrentJob == null)
info.CurrentJob = new StandbyJob();
else
info.CurrentJob = info.CurrentJob.Execute(info);
}
catch (Exception ex)
{
Common.log.Error("CallProcess " + info.FullName, ex);
}
finally
{
info.IsCall = false;
}
}
}
/// <summary>
/// 获取小车的状态
/// </summary>
/// <param name="info"></param>
private void GetAgvState(ref AgvInfo info)
{
if (!info.IsOnline) return;
bool rtn = Common.mir.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);
}
}
/// <summary>
/// 检查小车是否在线
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
private bool CheckAgvOnline(ref AgvInfo info)
{
bool rtn = Common.mir.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];
}
//Common.log.Debug(string.Format("{0}[{1}] 在线", info.Name, info.IP));
}
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);
}
Common.log.Debug(string.Format("{0}[{1}] 脱机", info.Name, info.IP));
}
return rtn;
}
}
}
\ No newline at end of file
using System;
using AGVControl_Steel;
namespace Model
{
/// <summary>
/// 充电工作
/// </summary>
public class ChargeJob : Job
{
private string id;
private JobStep<ChargeStep> chargeStep;
private const int CHARGE_PLACE_PLC = 20;
/// <summary>
/// 充电工作
/// </summary>
public ChargeJob()
{
chargeStep = new JobStep<ChargeStep>(ChargeStep.None);
Common.log.Debug("进入ChargeJob任务");
}
/// <summary>
/// 任务执行
/// </summary>
/// <param name="info"></param>
public override Job Execute(AgvInfo info)
{
if (chargeStep.IsEqual(ChargeStep.None))
{
if (info.IsSelfWorkshop())
MoveCharge(info);
else
MoveDoor(info);
}
else if (chargeStep.IsEqual(ChargeStep.WaitWorkshopDoor))
{
rtn = Common.mir.Get_MissionState_Fleet(info.Authorization, id, out string state);
if (rtn)
{
if (state == MissionState.Done.ToString())
MoveCharge(info);
else if (state == MissionState.Aborted.ToString())
chargeStep.Msg = info.FullName + "任务状态" + MissionState.Aborted.ToString();
}
else
{
chargeStep.Msg = info.FullName + "获取任务状态id[" + id + "]失败";
}
}
else if (chargeStep.IsEqual(ChargeStep.WaitChargeStation))
{
rtn = Common.mir.Get_Register(info.IP, info.Authorization, CHARGE_PLACE_PLC, out int value);
if (rtn)
{
if (value == 1)
{
chargeStep.Msg = info.FullName + "到达充电位,准备充电";
chargeStep.NextStep(ChargeStep.Charging);
}
}
else
{
chargeStep.Msg = info.FullName + "获取PLC" + CHARGE_PLACE_PLC + "失败";
}
}
else if (chargeStep.IsEqual(ChargeStep.Charging))
{
if (info.Battery == info.BatteryMax)
{
chargeStep.Msg = info.FullName + "电量达到" + info.BatteryMax + ",充电工作结束";
chargeStep.NextStep(ChargeStep.End);
}
else if (info.Battery > info.BatteryMin)
{
Job job = Common.steelManage.GetSteelJob(info);
if (job != null)
{
Common.mir.Del_Mission(info.IP, info.Authorization);
return job;
}
}
}
else if (chargeStep.IsEqual(ChargeStep.End))
{
Common.mir.Del_Mission(info.IP, info.Authorization);
Common.log.Info(info.FullName + "ChargeJob结束,切换StandbyJob");
return new StandbyJob();
}
return this;
}
private void MoveDoor(AgvInfo info)
{
mission = Common.MISSION_PASS_DOOR_INTO + info.Workshop;
if (Common.FLEET_SEND)
rtn = Common.mir.Add_Mission_Fleet(info.FleetID, info.Authorization, mission, out id);
else
rtn = Common.mir.Add_Mission(info.IP, info.Authorization, mission, out id);
if (rtn)
{
chargeStep.Msg = info.FullName + "在" + info.Workshop + "车间,先过车间门";
chargeStep.NextStep(ChargeStep.WaitWorkshopDoor);
}
else
{
chargeStep.Msg = info.FullName + "发送" + mission + "任务失败";
}
}
private void MoveCharge(AgvInfo info)
{
mission = Common.MISSION_CHARGE + info.Workshop;
if (Common.FLEET_SEND)
rtn = Common.mir.Add_Mission_Fleet(info.FleetID, info.Authorization, mission, out id);
else
rtn = Common.mir.Add_Mission(info.IP, info.Authorization, mission, out id);
if (rtn)
{
info.Place = "充电位";
chargeStep.Msg = info.FullName + "在" + info.Workshop + "车间去充电位," + mission;
chargeStep.NextStep(ChargeStep.WaitChargeStation);
}
else
{
chargeStep.Msg = info.FullName + "发送" + mission + "任务失败";
}
}
/// <summary>
/// 充电步骤
/// </summary>
private enum ChargeStep
{
/// <summary>
/// 无
/// </summary>
None,
/// <summary>
/// 充电结束
/// </summary>
End,
/// <summary>
/// 移动到车间门口
/// </summary>
WaitWorkshopDoor,
/// <summary>
/// 移动到充电位置
/// </summary>
WaitChargeStation,
/// <summary>
/// 移动到待机位
/// </summary>
WaitStandby,
/// <summary>
/// 充电中
/// </summary>
Charging,
/// <summary>
/// 发送任务
/// </summary>
SendMission
}
}
}
\ No newline at end of file
using AGVControl_Steel;
namespace Model
{
public class MissionMoveJob : Job
{
private string id;
private int getStateTime = 0;
private JobStep<MissionMoveStep> missionMoveStep;
public MissionMoveJob(string missionName)
{
IsEnd = false;
mission = missionName;
missionMoveStep = new JobStep<MissionMoveStep>(MissionMoveStep.None);
Common.log.Debug("进入MissionMoveJob任务");
}
public override Job Execute(AgvInfo info)
{
if (missionMoveStep.IsEqual(MissionMoveStep.None))
{
if (Common.FLEET_SEND)
rtn = Common.mir.Add_Mission_Fleet(info.FleetID, info.Authorization, mission, out id);
else
rtn = Common.mir.Add_Mission(info.IP, info.Authorization, mission, out id);
if (rtn)
{
getStateTime = 0;
missionMoveStep.NextStep(MissionMoveStep.Moving);
}
else
{
missionMoveStep.Msg = info.FullName + "发送 " + mission + " 失败";
Common.mir.Del_Mission(info.IP, info.Authorization);
}
}
else if (missionMoveStep.IsEqual(MissionMoveStep.Moving))
{
getStateTime += Common.AGV_CALL_SLEEP;
if (getStateTime >= 2000) //每2s获取一次状态
{
getStateTime = 0;
rtn = Common.mir.Get_MissionState_Fleet(info.Authorization, id, out string state);
if (rtn)
{
if (state == MissionState.Done.ToString())
{
missionMoveStep.NextStep(MissionMoveStep.End);
}
else if (state == MissionState.Aborted.ToString())
{
missionMoveStep.Msg = info.FullName + "任务状态" + MissionState.Aborted.ToString() + ",重新发送";
missionMoveStep.NextStep(MissionMoveStep.None);
}
}
else
{
missionMoveStep.Msg = info.FullName + "获取任务状态id[" + id + "]失败";
}
}
}
else if (missionMoveStep.IsEqual(MissionMoveStep.End))
{
IsEnd = true;
}
return this;
}
private enum MissionMoveStep
{
None,
Moving,
End
}
}
}
\ No newline at end of file
using AGVControl_Steel;
namespace Model
{
public class SendNewJob : Job
{
private string id;
private int dockTime;
private int delayGetSignal;
private JobStep<SendNewStep> sendNewStep;
public SendNewJob()
{
sendNewStep = new JobStep<SendNewStep>(SendNewStep.None);
Common.log.Debug("进入SendNewJob任务");
}
public override Job Execute(AgvInfo info)
{
if (sendNewStep.IsEqual(SendNewStep.None))
{
dockTime = 0;
sendNewStep.Msg = info.FullName + "等待任务";
sendNewStep.NextStep(SendNewStep.FindLine);
}
else if (sendNewStep.IsEqual(SendNewStep.WaitWorkshopDoor))
{
rtn = Common.mir.Get_MissionState_Fleet(info.Authorization, id, out string state);
if (rtn)
{
if (state == MissionState.Done.ToString())
{
sendNewStep.Msg = info.FullName + "已过车间门,开始执行任务";
sendNewStep.NextStep(SendNewStep.FindLine);
}
else if (state == MissionState.Aborted.ToString())
{
sendNewStep.Msg = info.FullName + "任务状态" + MissionState.Aborted.ToString();
}
}
else
{
sendNewStep.Msg = info.FullName + "获取任务状态id[" + id + "]失败";
}
}
else if (sendNewStep.IsEqual(SendNewStep.FindLine))
{
rtn = Common.steelManage.FindNewSteelWork(info, out string place);
if (rtn)
{
if (place == "storage")
{
if (info.Is4DWorkshop())
{
info.Place = place;
mission = "MoveSteel" + info.Place;
if (Common.FLEET_SEND)
Common.mir.Add_Mission_Fleet(info.FleetID, info.Authorization, mission, out id);
else
Common.mir.Add_Mission(info.IP, info.Authorization, mission, out id);
sendNewStep.Msg = info.FullName + " 发送任务 " + mission;
sendNewStep.NextStep(SendNewStep.MoveLine);
}
else
{
MoveDoor4D(info);
}
}
else
{
if (info.IsSelfWorkshop())
{
info.Place = place;
mission = "MoveSteel" + info.Place;
if (Common.FLEET_SEND)
Common.mir.Add_Mission_Fleet(info.FleetID, info.Authorization, mission, out id);
else
Common.mir.Add_Mission(info.IP, info.Authorization, mission, out id);
sendNewStep.Msg = info.FullName + " 发送任务 " + mission;
sendNewStep.NextStep(SendNewStep.MoveLine);
info.SteelCountAdd();
}
else
{
MoveDoor(info);
}
}
}
else
{
sendNewStep.Msg = info.FullName + "没有后续新钢板任务";
sendNewStep.NextStep(SendNewStep.End);
}
}
else if (sendNewStep.IsEqual(SendNewStep.MoveLine))
{
rtn = Common.mir.Get_MissionState_Fleet(info.Authorization, id, out string state);
if (rtn)
{
if (state == MissionState.Done.ToString())
{
sendNewStep.Msg = info.FullName + "完成" + mission;
if (info.Place == "storage")
{
delayGetSignal = 0;
sendNewStep.Msg = info.FullName + "等待到位信号";
sendNewStep.NextStep(SendNewStep.GetSingle);
}
else
{
Common.steelManage.NewSteelWorkDel(info.SteelFrom, info.Place);
sendNewStep.NextStep(SendNewStep.FindLine);
}
}
else if (state == MissionState.Aborted.ToString())
{
sendNewStep.Msg = info.FullName + "任务状态" + MissionState.Aborted.ToString();
}
}
else
{
sendNewStep.Msg = info.FullName + "获取任务状态id[" + id + "]失败";
}
}
else if (sendNewStep.IsEqual(SendNewStep.GetSingle))
{
if (Common.StorageDockFinish)
{
//入库的同时又有出库,需要删除出库任务。
if (info.Workshop == "4C")
Common.steelManage.StorageWorkDel(Common.STORAGE_ENTER_4C);
else if (info.Workshop == "4D")
Common.steelManage.StorageWorkDel(Common.STORAGE_ENTER_4D);
Common.steelManage.NewSteelWorkDel(info.SteelFrom, info.Place);
sendNewStep.Msg = info.FullName + "已到位,等待离开信号";
sendNewStep.NextStep(SendNewStep.WaitStorageLeave);
}
else
{
if (delayGetSignal >= 2)
{
if (dockTime >= 3)
{
sendNewStep.Msg = info.FullName + "对接仓库连续3次信号没有到位";
sendNewStep.NextStep(SendNewStep.Error);
dockTime = 0;
//小车报警任务
}
else
{
dockTime++;
mission = "MoveSteel" + info.Place;
if (Common.FLEET_SEND)
Common.mir.Add_Mission_Fleet(info.FleetID, info.Authorization, mission, out id);
else
Common.mir.Add_Mission(info.IP, info.Authorization, mission, out id);
sendNewStep.Msg = info.FullName + "信号没有到位,第" + dockTime + "次重发任务" + mission;
sendNewStep.NextStep(SendNewStep.MoveLine);
}
}
delayGetSignal++;
}
}
else if (sendNewStep.IsEqual(SendNewStep.WaitStorageLeave))
{
if (Common.steelManage.FindStorageWorkLeave())
{
Common.steelManage.StorageWorkDelLeave();
sendNewStep.Msg = info.FullName + "收到离开信号";
sendNewStep.NextStep(SendNewStep.FindLine);
}
}
else if (sendNewStep.IsEqual(SendNewStep.End))
{
info.SteelFrom = "";
info.ClearSteelCount();
Job job = Common.steelManage.GetSteelJob(info);
if (job == null)
return new StandbyJob();
else
return job;
}
else if (sendNewStep.IsEqual(SendNewStep.Error))
{
}
return this;
}
private void MoveDoor(AgvInfo info)
{
mission = Common.MISSION_PASS_DOOR_INTO + info.Workshop;
if (Common.FLEET_SEND)
rtn = Common.mir.Add_Mission_Fleet(info.FleetID, info.Authorization, mission, out id);
else
rtn = Common.mir.Add_Mission(info.IP, info.Authorization, mission, out id);
if (rtn)
{
sendNewStep.Msg = info.FullName + "在其他车间,先过车间门";
sendNewStep.NextStep(SendNewStep.WaitWorkshopDoor);
}
else
{
sendNewStep.Msg = info.FullName + "发送" + mission + "任务失败";
}
}
private void MoveDoor4D(AgvInfo info)
{
mission = Common.MISSION_PASS_DOOR_INTO + "4D";
if (Common.FLEET_SEND)
rtn = Common.mir.Add_Mission_Fleet(info.FleetID, info.Authorization, mission, out id);
else
rtn = Common.mir.Add_Mission(info.IP, info.Authorization, mission, out id);
if (rtn)
{
sendNewStep.Msg = info.FullName + "在其他车间,先过车间门";
sendNewStep.NextStep(SendNewStep.WaitWorkshopDoor);
}
else
{
sendNewStep.Msg = info.FullName + "发送" + mission + "任务失败";
}
}
private enum SendNewStep
{
None,
//FindMission,
WaitWorkshopDoor,
FindLine,
MoveLine,
GetSingle,
WaitStorageLeave,
End,
Error
}
}
}
\ No newline at end of file
using AGVControl_Steel;
namespace Model
{
public class StandbyJob : Job
{
private string id;
private int standingTime; //在待机位停留时间
private JobStep<StandbyStep> standbyStep;
private const int STANDBY_TIMEOUT = 2 * 60; //待机位停留超时时间,秒
public StandbyJob()
{
standbyStep = new JobStep<StandbyStep>(StandbyStep.None);
Common.log.Debug("进入StandbyJob任务");
}
public override Job Execute(AgvInfo info)
{
if (standbyStep.IsEqual(StandbyStep.None))
{
info.ClearSteelCount();
if (info.IsSelfWorkshop())
MoveStandby(info);
else
MoveDoor(info);
}
else if (standbyStep.IsEqual(StandbyStep.WaitWorkshopDoor))
{
rtn = Common.mir.Get_MissionState_Fleet(info.Authorization, id, out string state);
if (rtn)
{
if (state == MissionState.Done.ToString())
MoveStandby(info);
else if (state == MissionState.Aborted.ToString())
standbyStep.Msg = info.FullName + "任务状态" + MissionState.Aborted.ToString();
}
else
{
standbyStep.Msg = info.FullName + "获取任务状态id[" + id + "]失败";
}
}
else if (standbyStep.IsEqual(StandbyStep.WaitStandby))
{
rtn = Common.mir.Get_MissionState_Fleet(info.Authorization, id, out string state);
if (rtn)
{
if (state == MissionState.Done.ToString())
{
standingTime = 0;
standbyStep.Msg = info.FullName + "已在待机位";
standbyStep.NextStep(StandbyStep.End);
}
else if (state == MissionState.Aborted.ToString())
{
standbyStep.Msg = info.FullName + "任务状态" + MissionState.Aborted.ToString();
}
}
else
{
standbyStep.Msg = info.FullName + "获取任务状态id[" + id + "]失败";
}
}
else if (standbyStep.IsEqual(StandbyStep.End))
{
standingTime += Common.AGV_CALL_SLEEP;
if (standingTime > STANDBY_TIMEOUT * 1000)
{
if (info.Battery < info.BatteryMax)
{
standbyStep.Msg = info.FullName + "在待机位停留超过2分钟,执行充电任务";
return new ChargeJob();
}
}
else if (info.Battery <= info.BatteryMin)
{
standbyStep.Msg = info.FullName + "电量小于" + info.BatteryMin + ",执行充电任务";
return new ChargeJob();
}
else
{
Job job = Common.steelManage.GetSteelJob(info);
if (job != null) return job;
}
}
return this;
}
private void MoveDoor(AgvInfo info)
{
mission = Common.MISSION_PASS_DOOR_INTO + info.Workshop;
if (Common.FLEET_SEND)
rtn = Common.mir.Add_Mission_Fleet(info.FleetID, info.Authorization, mission, out id);
else
rtn = Common.mir.Add_Mission(info.IP, info.Authorization, mission, out id);
if (rtn)
{
standbyStep.Msg = info.FullName + "在其他车间,先过车间门";
standbyStep.NextStep(StandbyStep.WaitWorkshopDoor);
}
else
{
standbyStep.Msg = info.FullName + "发送" + mission + "任务失败";
}
}
private void MoveStandby(AgvInfo info)
{
mission = Common.MISSION_STANDBY + info.Workshop;
if (Common.FLEET_SEND)
rtn = Common.mir.Add_Mission_Fleet(info.FleetID, info.Authorization, mission, out id);
else
rtn = Common.mir.Add_Mission(info.IP, info.Authorization, mission, out id);
if (rtn)
{
info.Place = "待机位";
standbyStep.Msg = info.FullName + "回待机位," + mission;
standbyStep.NextStep(StandbyStep.WaitStandby);
}
else
{
standbyStep.Msg = info.FullName + "发送" + mission + "任务失败";
}
}
private enum StandbyStep
{
None,
WaitWorkshopDoor,
WaitStandby,
End
}
}
}
\ No newline at end of file
using AGVControl_Steel;
namespace Model
{
public class StorageJob : Job
{
private string id;
private int delayGetSignal; //延迟获取信号
private int dockTime; //停靠次数
private JobStep<StorageStep> storageStep;
public StorageJob()
{
storageStep = new JobStep<StorageStep>(StorageStep.None);
Common.log.Debug("进入StorageJob任务");
}
public override Job Execute(AgvInfo info)
{
if (storageStep.IsEqual(StorageStep.None))
{
dockTime = 0;
if (info.Is4DWorkshop())
storageStep.NextStep(StorageStep.GoStorage);
else
MoveDoor(info);
}
else if (storageStep.IsEqual(StorageStep.WaitWorkshopDoor))
{
rtn = Common.mir.Get_MissionState_Fleet(info.Authorization, id, out string state);
if (rtn)
{
if (state == MissionState.Done.ToString())
{
storageStep.Msg = info.FullName + "已过车间门";
storageStep.NextStep(StorageStep.GoStorage);
}
else if (state == MissionState.Aborted.ToString())
{
storageStep.Msg = info.FullName + "任务状态" + MissionState.Aborted.ToString();
}
}
else
{
storageStep.Msg = info.FullName + "获取任务状态id[" + id + "]失败";
}
}
else if (storageStep.IsEqual(StorageStep.GoStorage))
{
Common.steelManage.FindStorageWork(info, out string place);
info.Place = place;
if (Common.FLEET_SEND)
rtn = Common.mir.Add_Mission_Fleet(info.FleetID, info.Authorization, Common.MISSION_MOVE_STORAGE, out id);
else
rtn = Common.mir.Add_Mission(info.IP, info.Authorization, Common.MISSION_MOVE_STORAGE, out id);
if (rtn)
{
storageStep.Msg = info.FullName + "去4D仓库";
storageStep.NextStep(StorageStep.WaitStorage);
}
else
{
storageStep.Msg = info.FullName + "发送" + mission + "任务失败";
}
}
else if (storageStep.IsEqual(StorageStep.WaitStorage))
{
rtn = Common.mir.Get_MissionState_Fleet(info.Authorization, id, out string state);
if (rtn)
{
if (state == MissionState.Done.ToString())
{
storageStep.Msg = info.FullName + "已在仓库";
delayGetSignal = 0;
storageStep.NextStep(StorageStep.GetSingle);
}
else if (state == MissionState.Aborted.ToString())
{
storageStep.Msg = info.FullName + "任务状态" + MissionState.Aborted.ToString();
}
}
else
{
storageStep.Msg = info.FullName + "获取任务状态id[" + id + "]失败";
}
}
else if (storageStep.IsEqual(StorageStep.GetSingle))
{
if (Common.StorageDockFinish)
{
Common.steelManage.StorageWorkDel(info.Place);
storageStep.Msg = info.FullName + "已到位,等待离开信号";
storageStep.NextStep(StorageStep.WaitStorageLeave);
}
else
{
if (delayGetSignal >= 3)
{
if (dockTime >= 3)
{
storageStep.Msg = info.FullName + "对接仓库连续3次信号没有到位";
storageStep.NextStep(StorageStep.Error);
dockTime = 0;
//小车报警任务
}
else
{
dockTime++;
mission = "MoveSteel" + info.Place;
if (Common.FLEET_SEND)
Common.mir.Add_Mission_Fleet(info.FleetID, info.Authorization, mission, out id);
else
Common.mir.Add_Mission(info.IP, info.Authorization, mission, out id);
storageStep.Msg = info.FullName + "信号没有到位,第" + dockTime + "次重发任务" + mission;
storageStep.NextStep(StorageStep.GoStorage);
}
}
delayGetSignal++;
}
}
else if (storageStep.IsEqual(StorageStep.WaitStorageLeave))
{
if (Common.steelManage.FindStorageWorkLeave())
{
Common.steelManage.StorageWorkDelLeave();
storageStep.Msg = info.FullName + "收到离开信号";
return new StandbyJob();
}
else if (Common.steelManage.FindNewSteelWork(info))
{
return new SendNewJob();
}
}
else if (storageStep.IsEqual(StorageStep.End))
{
}
else if (storageStep.IsEqual(StorageStep.Error))
{
}
return this;
}
private void MoveDoor(AgvInfo info)
{
string name = Common.MISSION_PASS_DOOR_INTO;
if (info.Workshop.Substring(1, 1) == "C")
name += info.Workshop.Substring(0, 1) + "D";
else
name += info.Workshop;
if (Common.FLEET_SEND)
rtn = Common.mir.Add_Mission_Fleet(info.FleetID, info.Authorization, name, out id);
else
rtn = Common.mir.Add_Mission(info.IP, info.Authorization, name, out id);
if (rtn)
{
storageStep.Msg = info.FullName + "在" + info.Workshop + "车间,先过车间门";
storageStep.NextStep(StorageStep.WaitWorkshopDoor);
}
else
{
storageStep.Msg = info.FullName + "发送" + mission + "任务失败";
}
}
private enum StorageStep
{
None,
WaitWorkshopDoor,
GoStorage,
WaitStorage,
GetSingle,
WaitStorageLeave,
Error,
End
}
}
}
using AGVControl_Steel;
namespace Model
{
public class TakeOldJob : Job
{
private string id;
private string name = null;
private JobStep<TakeOldStep> takeOldStep;
public TakeOldJob()
{
takeOldStep = new JobStep<TakeOldStep>(TakeOldStep.None);
Common.log.Debug("进入TakeOldJob任务");
}
public override Job Execute(AgvInfo info)
{
if (takeOldStep.IsEqual(TakeOldStep.None))
{
info.ClearSteelCount();
takeOldStep.NextStep(TakeOldStep.FindLine);
}
else if (takeOldStep.IsEqual(TakeOldStep.FindLine))
{
if (info.IsSteelFull())
{
takeOldStep.Msg = info.FullName + "钢板已满";
takeOldStep.NextStep(TakeOldStep.GoWashPoint);
}
else
{
FindLine(info);
if (!rtn)
{
takeOldStep.Msg = info.FullName + "没有后续旧钢板任务";
takeOldStep.NextStep(TakeOldStep.GoWashPoint);
}
}
}
else if (takeOldStep.IsEqual(TakeOldStep.MoveLine))
{
rtn = Common.mir.Get_MissionState_Fleet(info.Authorization, id, out string state);
if (rtn)
{
if (state == MissionState.Done.ToString())
{
Common.steelManage.OldSteelWorkDel(name);
takeOldStep.Msg = info.FullName + "完成" + mission;
takeOldStep.NextStep(TakeOldStep.FindLine);
}
else if (state == MissionState.Aborted.ToString())
{
takeOldStep.Msg = info.FullName + "任务状态" + MissionState.Aborted.ToString();
}
}
else
{
takeOldStep.Msg = info.FullName + "获取任务状态id[" + id + "]失败";
}
}
else if (takeOldStep.IsEqual(TakeOldStep.GoWashPoint))
{
mission = Common.MISSION_MOVE_WASH + info.Workshop;
if (Common.FLEET_SEND)
rtn = Common.mir.Add_Mission_Fleet(info.FleetID, info.Authorization, mission, out id);
else
rtn = Common.mir.Add_Mission(info.IP, info.Authorization, mission, out id);
if (rtn)
{
info.Place = "4D清洗点";
takeOldStep.Msg = info.FullName + "去" + info.Workshop + "清洗点";
takeOldStep.NextStep(TakeOldStep.WaitWashPoint);
}
else
{
takeOldStep.Msg = info.FullName + "发送" + mission + "任务失败";
}
}
else if (takeOldStep.IsEqual(TakeOldStep.WaitWashPoint))
{
rtn = Common.mir.Get_MissionState_Fleet(info.Authorization, id, out string state);
if (rtn)
{
if (state == MissionState.Done.ToString())
{
takeOldStep.Msg = info.FullName + "已在清洗点";
takeOldStep.NextStep(TakeOldStep.End);
}
else if (state == MissionState.Aborted.ToString())
{
takeOldStep.Msg = info.FullName + "任务状态" + MissionState.Aborted.ToString();
}
}
else
{
takeOldStep.Msg = info.FullName + "获取任务状态id[" + id + "]失败";
}
}
else if (takeOldStep.IsEqual(TakeOldStep.End))
{
info.ClearSteelCount();
Job job = Common.steelManage.GetSteelJob(info);
if (job == null)
return new StandbyJob();
else
return job;
}
return this;
}
private void FindLine(AgvInfo info)
{
rtn = Common.steelManage.FindOldSteelWork(info, out string place);
if (rtn)
{
name = place;
info.Place = name;
mission = "MoveSteel" + name;
if (Common.FLEET_SEND)
Common.mir.Add_Mission_Fleet(info.FleetID, info.Authorization, mission, out id);
else
Common.mir.Add_Mission(info.IP, info.Authorization, mission, out id);
takeOldStep.Msg = info.FullName + " 发送任务 " + mission;
takeOldStep.NextStep(TakeOldStep.MoveLine);
info.SteelCountAdd();
}
}
private enum TakeOldStep
{
None,
FindLine,
MoveLine,
GoWashPoint,
WaitWashPoint,
End
}
}
}
using AGVControl_Steel;
namespace Model
{
public class WashPointJob : Job
{
private string id;
private JobStep<WashPointStep> washPointStep;
public WashPointJob()
{
washPointStep = new JobStep<WashPointStep>(WashPointStep.None);
Common.log.Debug("进入WashPointJob任务");
}
public override Job Execute(AgvInfo info)
{
if (washPointStep.IsEqual(WashPointStep.None))
{
washPointStep.NextStep(WashPointStep.GoWashPoint);
}
else if (washPointStep.IsEqual(WashPointStep.GoWashPoint))
{
mission = Common.MISSION_MOVE_WASH + info.Workshop;
if (Common.FLEET_SEND)
rtn = Common.mir.Add_Mission_Fleet(info.FleetID, info.Authorization, mission, out id);
else
rtn = Common.mir.Add_Mission(info.IP, info.Authorization, mission, out id);
if (rtn)
{
washPointStep.Msg = info.FullName + "去" + info.Workshop + "清洗点";
washPointStep.NextStep(WashPointStep.WaitWashPoint);
}
else
{
washPointStep.Msg = info.FullName + "发送" + mission + "任务失败";
}
}
else if (washPointStep.IsEqual(WashPointStep.WaitWashPoint))
{
rtn = Common.mir.Get_MissionState_Fleet(info.Authorization, id, out string state);
if (rtn)
{
if (state == MissionState.Done.ToString())
{
Common.steelManage.NewSteelWorkDel(info.SteelFrom, info.SteelFrom);
washPointStep.Msg = info.FullName + "已在清洗点";
washPointStep.NextStep(WashPointStep.End);
}
else if (state == MissionState.Aborted.ToString())
{
washPointStep.Msg = info.FullName + "任务状态" + MissionState.Aborted.ToString();
}
}
else
{
washPointStep.Msg = info.FullName + "获取任务状态id[" + id + "]失败";
}
}
else if (washPointStep.IsEqual(WashPointStep.End))
{
return new SendNewJob();
}
return this;
}
private enum WashPointStep
{
None,
GoWashPoint,
WaitWashPoint,
End
}
}
}
using System;
using AGVControl_Steel;
namespace Model
{
/// <summary>
/// 小车信息
/// </summary>
public class AgvInfo
{
private int currSteelCount = 0;
private const int STEEL_MAX = 5;
/// <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>
/// 带IP的完整名称
/// </summary>
public string FullName
{
get
{
return string.Format("{0}[{1}] ", Name, IP);
}
}
/// <summary>
/// 授权码
/// </summary>
public string Authorization { set; get; } = "";
/// <summary>
/// 当前位置
/// </summary>
public string Place { set; get; } = "";
public string SteelFrom { set; get; } = "";
/// <summary>
/// 车间
/// </summary>
public string Workshop { 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>
/// 小车坐标位置
/// </summary>
public System.Drawing.PointF Position { set; get; }
/// <summary>
/// 任务发送
/// </summary>
public string TaskSend { set; get; } = "";
/// <summary>
/// 状态ID号
/// </summary>
public int StateID { set; get; } = -1;
/// <summary>
/// 状态文本
/// </summary>
public string StateText { set; get; } = "";
/// <summary>
/// 任务文本
/// </summary>
public string MissionText { set; get; } = "";
/// <summary>
/// IO模块的guid
/// </summary>
public string IOGuid { set; get; } = "";
/// <summary>
/// 是否正在被调用
/// </summary>
public bool IsCall { set; get; } = false;
/// <summary>
/// 当前的工作
/// </summary>
public Job CurrentJob { set; get; } = null;
/// <summary>
/// 表格行显示
/// </summary>
/// <returns></returns>
public string[] ToRow()
{
string[] arr = new string[] { Name, Place, StateText, Battery.ToString(), IsOnline.ToString(), IsAuto.ToString(), "清除" };
return arr;
}
public string ToMissionState()
{
string s = FullName + "\r\n\r\n" + MissionText;
return s;
}
/// <summary>
/// 是否在自己的车间里面
/// </summary>
/// <returns></returns>
public bool IsSelfWorkshop()
{
if (Position.Y < 55)
{
if (Workshop.IndexOf('D') > 0)
return true;
else if (Workshop.IndexOf('C') > 0)
return false;
}
else if (Position.Y > 62)
{
if (Workshop.IndexOf('D') > 0)
return false;
else if (Workshop.IndexOf('C') > 0)
return true;
}
return false;
}
/// <summary>
/// 是否在4D车间
/// </summary>
/// <returns></returns>
public bool Is4DWorkshop()
{
if (Position.Y < 55)
return true;
else if (Position.Y > 62)
return false;
else
return false;
}
/// <summary>
/// 钢板是否已放满
/// </summary>
/// <returns></returns>
public bool IsSteelFull()
{
if (currSteelCount >= STEEL_MAX)
return true;
else
return false;
}
/// <summary>
/// 钢板是否取空
/// </summary>
/// <returns></returns>
public bool IsSteelEmpty()
{
if (currSteelCount <= 0)
return true;
else
return false;
}
/// <summary>
/// 钢板数量增加
/// </summary>
public void SteelCountAdd()
{
currSteelCount++;
}
/// <summary>
/// 钢板数量清零
/// </summary>
public void ClearSteelCount()
{
currSteelCount = 0;
}
/// <summary>
/// 钢板数量放满
/// </summary>
public void FillSteelCount()
{
currSteelCount = STEEL_MAX;
}
}
}
\ No newline at end of file

namespace Model
{
/// <summary>
/// 小车的工作
/// </summary>
public abstract class Job
{
/// <summary>
/// 任务是否执行
/// </summary>
public bool IsProcess { set; get; }
/// <summary>
/// 任务是否结束
/// </summary>
public bool IsEnd { set; get; }
/// <summary>
/// 任务运行信息
/// </summary>
public string RunInfo { set; get; }
/// <summary>
/// 任务执行
/// </summary>
/// <param name="info"></param>
public abstract Job Execute(AgvInfo info);
internal bool rtn;
internal string mission;
}
}
using System;
using AGVControl_Steel;
namespace Model
{
/// <summary>
/// 小车工作步骤
/// </summary>
/// <typeparam name="T"></typeparam>
public class JobStep<T>
{
private T _step;
private DateTime _time;
private string _msg = "";
/// <summary>
/// 小车工作步骤
/// </summary>
/// <param name="step"></param>
public JobStep(T step)
{
_step = step;
_time = DateTime.Now;
}
/// <summary>
/// 步骤是否相等
/// </summary>
/// <param name="step"></param>
/// <returns></returns>
public bool IsEqual(T step)
{
return _step.Equals(step);
}
/// <summary>
/// 是否超时
/// </summary>
/// <param name="timeOutMilliseconds"></param>
/// <returns></returns>
public bool IsTimeOut(int timeOutMilliseconds)
{
TimeSpan span = DateTime.Now - _time;
if (span.TotalMilliseconds > timeOutMilliseconds)
return true;
else
return false;
}
/// <summary>
/// 下一个步骤
/// </summary>
/// <param name="step"></param>
public void NextStep(T step)
{
_step = step;
_time = DateTime.Now;
}
/// <summary>
/// 当前信息
/// </summary>
public string Msg
{
get
{
return _msg;
}
set
{
if (!string.IsNullOrEmpty(value))
{
//与上一个消息不一样才打印
if (!value.Equals(_msg))
{
Common.log.Info(_step.ToString() + ":" + value);
if (Common.txtLog != null)
{
string time = string.Format("[{0:HH:mm:ss}] ", DateTime.Now);
Common.txtLog.AppendText(time + value + "\r\n");
Common.txtLog.SelectionStart = Common.txtLog.Text.Length;
Common.txtLog.ScrollToCaret();
}
}
}
_msg = value;
}
}
}
}
\ No newline at end of file

namespace AGVControl_Steel
{
/// <summary>
/// 任务执行的状态
/// </summary>
public enum MissionState
{
/// <summary>
/// 终止
/// </summary>
Aborted,
/// <summary>
/// 执行中
/// </summary>
Executing,
/// <summary>
/// 已完成
/// </summary>
Done
}
public enum StateID
{
None = 0,
Starting,
ShuttingDown,
Ready,
Pause,
Executing,
Aborted,
Completed,
Docked,
Docking,
EmergencyStop,
ManualControl,
Error
}
}
\ No newline at end of file
using System;
namespace AGVControl_Steel
{
public class SteelWork
{
public string From { set; get; }
public string Place { set; get; }
public DateTime DateTime { set; get; }
public SteelWork()
{
DateTime = DateTime.Now;
}
}
}
\ No newline at end of file
using System;
using System.Windows.Forms;
namespace AGVControl_Steel
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
log4net.Config.XmlConfigurator.Configure();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
if (Asa.WindowsForm.IsRun())
{
MessageBox.Show("IsRun");
return;
}
if (!Asa.WindowsForm.IsAdmin())
{
Asa.WindowsForm.AdminRun();
return;
}
Common.appConfig = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None);
Common.log = log4net.LogManager.GetLogger("AGVControl_Steel");
Common.log.Info("=====程序开始=====");
ReadConfig();
Common.steelManage = new BLL.SteelManage();
Common.control = new BLL.Control();
Common.mir = new Model.MiR_API { FleetIP = Common.appConfig.AppSettings.Settings["FLEET_IP"].Value, MissionList = Common.agvMissions };
Application.Run(new FrmMain());
Common.control.Stop();
Common.log.Info("=====程序结束=====\r\n");
}
private static void ReadConfig()
{
try
{
//AGV小车信息
Common.agvInfos = new System.Collections.Generic.List<Model.AgvInfo>();
string[] lines = System.IO.File.ReadAllLines(Common.PATH_AGV_NAME, System.Text.Encoding.UTF8);
for (int i = 0; i < lines.Length; i++)
{
string[] str = lines[i].Split(',');
if (str.Length != 4) continue;
string isUse = "false";
string key = "Use_" + str[0];
if (Common.appConfig.AppSettings.Settings[key] == null)
{
Common.appConfig.AppSettings.Settings.Add(key, "false");
Common.appConfig.Save();
System.Configuration.ConfigurationManager.RefreshSection("appSettings");
}
else
{
isUse = Common.appConfig.AppSettings.Settings[key].Value;
}
key = "Work_" + str[0];
Model.AgvInfo info = new Model.AgvInfo
{
FleetID = str[0],
Name = str[1],
IP = str[2],
Authorization = str[3],
IsAuto = Convert.ToBoolean(isUse),
BatteryMax = Convert.ToInt32(Common.appConfig.AppSettings.Settings["AGV_BATTERY_MAX"].Value),
BatteryMin = Convert.ToInt32(Common.appConfig.AppSettings.Settings["AGV_BATTERY_MIN"].Value),
Workshop = Common.appConfig.AppSettings.Settings[key].Value
};
Common.agvInfos.Add(info);
}
Common.log.Info("读取配置文件 " + Common.PATH_AGV_NAME);
//AGV任务ID号
Common.agvMissions = new System.Collections.Generic.Dictionary<string, string>();
lines = System.IO.File.ReadAllLines(Common.PATH_AGV_MISSION, System.Text.Encoding.UTF8);
for (int i = 0; i < lines.Length; i++)
{
string[] str = lines[i].Split(',');
if (str.Length != 2) continue;
Common.agvMissions.Add(str[0], str[1]);
}
Common.log.Info("读取配置文件 " + Common.PATH_AGV_MISSION);
Common.PLACE_NAME = Common.appConfig.AppSettings.Settings["PlaceName"].Value.Split(',');
Common.FLEET_SEND = Convert.ToBoolean(Common.appConfig.AppSettings.Settings["FLEET_Send"].Value);
//string id = Common.appConfig.AppSettings.Settings["4D_AGV"].Value;
//int idx = Common.agvInfos.FindIndex(match => match.FleetID == id);
//if (idx > -1) Common.agvInfos[idx].Workshop = Common.WORKSHOP_4D;
//id = Common.appConfig.AppSettings.Settings["4C_AGV"].Value;
//idx = Common.agvInfos.FindIndex(match => match.FleetID == id);
//if (idx > -1) Common.agvInfos[idx].Workshop = Common.WORKSHOP_4C;
}
catch (Exception ex)
{
Common.log.Error("ReadConfig()", ex);
}
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("AGVControl_Steel")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AGVControl_Steel")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("be830571-6737-4fa7-a75b-0242b07e011c")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.1.0")]
[assembly: AssemblyFileVersion("1.1.1.0")]
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace AGVControl_Steel.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("AGVControl_Steel.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 AGVControl_Steel.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>
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<log4net>
<appender name="AGVControl_Steel" type="log4net.Appender.RollingFileAppender">
<file value="Logs/AGVControl_Steel.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t][%c:%L]%-5p %m%n"/>
</layout>
</appender>
<appender name="MiR_API" type="log4net.Appender.RollingFileAppender">
<file value="Logs/MiR_API.log"/>
<param name="Encoding" value="UTF-8"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyy-MM-dd"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%date][%t][%c:%L]%-5p %m%n"/>
</layout>
</appender>
<logger name="AGVControl_Steel">
<level value="Debug"/>
<appender-ref ref="AGVControl_Steel"/>
</logger>
<logger name="MiR_API">
<level value="Debug"/>
<appender-ref ref="MiR_API"/>
</logger>
</log4net>
<appSettings>
<add key="FLEET_IP" value="10.85.199.3"/>
<add key="FLEET_Send" value="true"/>
<add key="WebService" value="http://10.85.196.40:8089/"/>
<!--<add key="WebService" value="http://10.211.55.23:8089/"/>-->
<add key="AGV_BATTERY_MAX" value="100"/>
<add key="AGV_BATTERY_MIN" value="40"/>
<add key="Use_32" value="false"/>
<add key="Use_25" value="false"/>
<add key="Work_32" value="4C"/>
<add key="Work_25" value="4D"/>
<add key="PlaceName" value="D1,D2,D3,D4,D5,D6,D7,D8,D9,D10,D11,D12,D13,D14,D15,D16,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,C16,4Cwash,4Dwash,storage"/>
</appSettings>
</configuration>
\ No newline at end of file
MoveSteelC1,77a02463-f387-11ea-8452-94c691a7387d
MoveSteelC2,b2dc4ed9-f387-11ea-8452-94c691a7387d
MoveSteelC3,c7f598c1-f387-11ea-8452-94c691a7387d
MoveSteelC4,ddfd5992-f387-11ea-8452-94c691a7387d
MoveSteelC5,f0a4498e-f387-11ea-8452-94c691a7387d
MoveSteelC6,037a7f67-f388-11ea-8452-94c691a7387d
MoveSteelC7,1b361828-f388-11ea-8452-94c691a7387d
MoveSteelC8,2aec8e6c-f388-11ea-8452-94c691a7387d
MoveSteelC9,3cad8c7d-f388-11ea-8452-94c691a7387d
MoveSteelC10,4cc3d656-f388-11ea-8452-94c691a7387d
MoveSteelD1,e9ed94bf-f2ac-11ea-8452-94c691a7387d
MoveSteelD2,04e5690f-f2ad-11ea-8452-94c691a7387d
MoveSteelD3,1d3f9b5a-f2ad-11ea-8452-94c691a7387d
MoveSteelD4,55bf620d-f2ad-11ea-8452-94c691a7387d
MoveSteelD5,6c1fe859-f2ad-11ea-8452-94c691a7387d
MoveSteelD6,8498ea0b-f2ad-11ea-8452-94c691a7387d
MoveSteelD8,ba683168-f2ad-11ea-8452-94c691a7387d
MoveSteelD9,de7f8051-f2ad-11ea-8452-94c691a7387d
MoveSteelD10,f81944b7-f2ad-11ea-8452-94c691a7387d
MoveSteelD11,0a0b0df1-f2ae-11ea-8452-94c691a7387d
MoveSteelD12,201e368d-f2ae-11ea-8452-94c691a7387d
MoveSteelD14,445106a1-f2ae-11ea-8452-94c691a7387d
MoveSteelD15,002b3e45-f105-11ea-a03e-94c691a7387d
MoveSteelD16,15a766ac-f2a2-11ea-8452-94c691a7387d
MoveWash4C,691e75ab-f2b0-11ea-8452-94c691a7387d
MoveWash4D,e52ae766-f2ab-11ea-8452-94c691a7387d
MoveStandby4C,2dd387ce-f2b0-11ea-8452-94c691a7387d
MoveStandby4D,21ca7ffe-f29e-11ea-8452-94c691a7387d
AutoCharge4C,8ed7b459-f2b0-11ea-8452-94c691a7387d
AutoCharge4D,2f0a31b1-f2ab-11ea-8452-94c691a7387d
PassDoorInto4D,d67f31c8-ca7e-11ea-9a66-94c691a7387d
PassDoorInto4C,fd6e26ac-c1bf-11ea-9a66-94c691a7387d
MoveSteelstorage,418c9064-f2ac-11ea-8452-94c691a7387d
Pickupqisdashelf,f2acdcae-e524-11ea-b003-0001299a3f0e
Placeqisdashelf,4001120d-e525-11ea-b003-0001299a3f0e
\ No newline at end of file
32,11号_4C,10.85.199.82,Basic ZGlzdHJpYnV0b3I6NjJmMmYwZjFlZmYxMGQzMTUyYzk1ZjZmMDU5NjU3NmU0ODJiYjhlNDQ4MDY0MzNmNGNmOTI5NzkyODM0YjAxNA==
25,13号_4D,10.85.199.84,Basic ZGlzdHJpYnV0b3I6NjJmMmYwZjFlZmYxMGQzMTUyYzk1ZjZmMDU5NjU3NmU0ODJiYjhlNDQ4MDY0MzNmNGNmOTI5NzkyODM0YjAxNA==
\ No newline at end of file
[2020-09-24 09:41:50,372][1][AGVControl_Steel:32]INFO =====程序开始=====
[2020-09-24 09:41:50,401][1][AGVControl_Steel:83]INFO 读取配置文件 D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\bin\Debug\Config\AgvName.csv
[2020-09-24 09:41:50,402][1][AGVControl_Steel:94]INFO 读取配置文件 D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\bin\Debug\Config\AgvMission.csv
[2020-09-24 09:41:50,672][1][AGVControl_Steel:299]INFO Web服务已开启
[2020-09-24 09:42:45,691][1][AGVControl_Steel:32]INFO =====程序开始=====
[2020-09-24 09:42:45,713][1][AGVControl_Steel:83]INFO 读取配置文件 D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\bin\Debug\Config\AgvName.csv
[2020-09-24 09:42:45,713][1][AGVControl_Steel:94]INFO 读取配置文件 D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\bin\Debug\Config\AgvMission.csv
[2020-09-24 09:42:45,882][1][AGVControl_Steel:299]INFO Web服务已开启
[2020-09-24 09:43:36,766][1][AGVControl_Steel:32]INFO =====程序开始=====
[2020-09-24 09:43:36,786][1][AGVControl_Steel:83]INFO 读取配置文件 D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\bin\Debug\Config\AgvName.csv
[2020-09-24 09:43:36,787][1][AGVControl_Steel:94]INFO 读取配置文件 D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\bin\Debug\Config\AgvMission.csv
[2020-09-24 09:43:38,228][1][AGVControl_Steel:299]INFO Web服务已开启
[2020-09-24 09:43:38,346][9][AGVControl_Steel:58]ERROR CallProcess 11号_4C[10.85.199.82]
System.InvalidOperationException: 线程间操作无效: 从不是创建控件“TxtAgvMission0”的线程访问它。
在 System.Windows.Forms.Control.get_Handle()
在 System.Windows.Forms.Control.set_WindowText(String value)
在 System.Windows.Forms.TextBoxBase.set_WindowText(String value)
在 System.Windows.Forms.Control.set_Text(String value)
在 System.Windows.Forms.TextBoxBase.set_Text(String value)
在 System.Windows.Forms.TextBox.set_Text(String value)
在 AGVControl_Steel.FrmMain.Control_AgvOnline(Int32 agvIndex) 位置 D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\UI\FrmMain.cs:行号 33
在 BLL.Control.CheckAgvOnline(AgvInfo& info) 位置 D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\BLL\Control.cs:行号 122
在 BLL.Control.CallProcess(Object obj) 位置 D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\BLL\Control.cs:行号 58
[2020-09-24 09:43:38,440][9][AGVControl_Steel:58]ERROR CallProcess 13号_4D[10.85.199.84]
System.InvalidOperationException: 线程间操作无效: 从不是创建控件“TxtAgvMission1”的线程访问它。
在 System.Windows.Forms.Control.get_Handle()
在 System.Windows.Forms.Control.set_WindowText(String value)
在 System.Windows.Forms.TextBoxBase.set_WindowText(String value)
在 System.Windows.Forms.Control.set_Text(String value)
在 System.Windows.Forms.TextBoxBase.set_Text(String value)
在 System.Windows.Forms.TextBox.set_Text(String value)
在 AGVControl_Steel.FrmMain.Control_AgvOnline(Int32 agvIndex) 位置 D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\UI\FrmMain.cs:行号 33
在 BLL.Control.CheckAgvOnline(AgvInfo& info) 位置 D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\BLL\Control.cs:行号 122
在 BLL.Control.CallProcess(Object obj) 位置 D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\BLL\Control.cs:行号 58
[2020-09-24 09:43:40,466][9][AGVControl_Steel:60]ERROR CallProcess 11号_4C[10.85.199.82]
System.InvalidOperationException: 线程间操作无效: 从不是创建控件“TxtAgvMission0”的线程访问它。
在 System.Windows.Forms.Control.get_Handle()
在 System.Windows.Forms.Control.set_WindowText(String value)
在 System.Windows.Forms.TextBoxBase.set_WindowText(String value)
在 System.Windows.Forms.Control.set_Text(String value)
在 System.Windows.Forms.TextBoxBase.set_Text(String value)
在 System.Windows.Forms.TextBox.set_Text(String value)
在 AGVControl_Steel.FrmMain.Control_AgvChanged(Int32 agvIndex) 位置 D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\UI\FrmMain.cs:行号 26
在 BLL.Control.GetAgvState(AgvInfo& info) 位置 D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\BLL\Control.cs:行号 102
在 BLL.Control.CallProcess(Object obj) 位置 D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\BLL\Control.cs:行号 60
[2020-09-24 09:43:40,539][9][AGVControl_Steel:60]ERROR CallProcess 13号_4D[10.85.199.84]
System.InvalidOperationException: 线程间操作无效: 从不是创建控件“TxtAgvMission1”的线程访问它。
在 System.Windows.Forms.Control.get_Handle()
在 System.Windows.Forms.Control.set_WindowText(String value)
在 System.Windows.Forms.TextBoxBase.set_WindowText(String value)
在 System.Windows.Forms.Control.set_Text(String value)
在 System.Windows.Forms.TextBoxBase.set_Text(String value)
在 System.Windows.Forms.TextBox.set_Text(String value)
在 AGVControl_Steel.FrmMain.Control_AgvChanged(Int32 agvIndex) 位置 D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\UI\FrmMain.cs:行号 26
在 BLL.Control.GetAgvState(AgvInfo& info) 位置 D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\BLL\Control.cs:行号 102
在 BLL.Control.CallProcess(Object obj) 位置 D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\BLL\Control.cs:行号 60
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.6.1", FrameworkDisplayName = ".NET Framework 4.6.1")]
D:\OneDrive - 上海挚锦科技有限公司\SMD\AGVControl_Steel\AGVControl_Steel\bin\Debug\AGVControl_Steel.exe.config
D:\OneDrive - 上海挚锦科技有限公司\SMD\AGVControl_Steel\AGVControl_Steel\bin\Debug\AGVControl_Steel.xml
D:\OneDrive - 上海挚锦科技有限公司\SMD\AGVControl_Steel\AGVControl_Steel\bin\Debug\AGVControl_Steel.exe
D:\OneDrive - 上海挚锦科技有限公司\SMD\AGVControl_Steel\AGVControl_Steel\bin\Debug\AGVControl_Steel.pdb
D:\OneDrive - 上海挚锦科技有限公司\SMD\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.FrmMain.resources
D:\OneDrive - 上海挚锦科技有限公司\SMD\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.Properties.Resources.resources
D:\OneDrive - 上海挚锦科技有限公司\SMD\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.csproj.GenerateResource.cache
D:\OneDrive - 上海挚锦科技有限公司\SMD\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.csproj.CoreCompileInputs.cache
D:\OneDrive - 上海挚锦科技有限公司\SMD\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.exe
D:\OneDrive - 上海挚锦科技有限公司\SMD\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.pdb
D:\OneDrive - 上海挚锦科技有限公司\SMD\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.csproj.CopyComplete
D:\OneDrive - 上海挚锦科技有限公司\SMD\AGVControl_Steel\AGVControl_Steel\bin\Debug\ClassFormParent.dll
D:\OneDrive - 上海挚锦科技有限公司\SMD\AGVControl_Steel\AGVControl_Steel\bin\Debug\ClassFormParent.pdb
D:\OneDrive - 上海挚锦科技有限公司\SMD\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.csprojAssemblyReference.cache
D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\bin\Debug\AGVControl_Steel.exe.config
D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\bin\Debug\AGVControl_Steel.exe
D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\bin\Debug\AGVControl_Steel.pdb
D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\bin\Debug\ClassFormParent.dll
D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\bin\Debug\ClassFormParent.pdb
D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.FrmMain.resources
D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.Properties.Resources.resources
D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.csproj.GenerateResource.cache
D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.csproj.CoreCompileInputs.cache
D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.csproj.CopyComplete
D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.exe
D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.pdb
D:\OneDrive\SMD\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.csprojAssemblyReference.cache
D:\Neotel\AGVControl_Steel\AGVControl_Steel\bin\Debug\AGVControl_Steel.exe.config
D:\Neotel\AGVControl_Steel\AGVControl_Steel\bin\Debug\AGVControl_Steel.exe
D:\Neotel\AGVControl_Steel\AGVControl_Steel\bin\Debug\AGVControl_Steel.pdb
D:\Neotel\AGVControl_Steel\AGVControl_Steel\bin\Debug\ClassFormParent.dll
D:\Neotel\AGVControl_Steel\AGVControl_Steel\bin\Debug\ClassFormParent.pdb
D:\Neotel\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.csprojAssemblyReference.cache
D:\Neotel\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.FrmMain.resources
D:\Neotel\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.Properties.Resources.resources
D:\Neotel\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.csproj.GenerateResource.cache
D:\Neotel\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.csproj.CoreCompileInputs.cache
D:\Neotel\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.csproj.CopyComplete
D:\Neotel\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.exe
D:\Neotel\AGVControl_Steel\AGVControl_Steel\obj\Debug\AGVControl_Steel.pdb
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="RestSharp" version="106.11.4" targetFramework="net461" />
</packages>
\ No newline at end of file
此文件类型无法预览
......@@ -10,8 +10,9 @@ namespace BLL
public class Control
{
private Timer timerCall;
private PointF[] position;
private DateTime[] timeout;
private PointF[] position;
private DateTime errorTime;
public delegate void AgvChangedEvent(int agvIndex);
public event AgvChangedEvent AgvChanged;
......@@ -20,13 +21,14 @@ namespace BLL
public Control()
{
ThreadPool.SetMaxThreads(5, 5); //线程池最大数量
position = new PointF[Common.agvInfos.Count];
for (int i = 0; i < position.Length; i++)
position[i] = new PointF();
}
public void Start()
{
position = new PointF[Common.agvInfos.Count];
for (int i = 0; i < position.Length; i++)
position[i] = new PointF();
timeout = new DateTime[Common.agvInfos.Count];
for (int i = 0; i < timeout.Length; i++)
timeout[i] = DateTime.Now;
......@@ -85,7 +87,7 @@ namespace BLL
private void GetAgvState(ref AgvInfo info)
{
if (!info.IsOnline) return;
bool rtn = Common.mir.Get_State(info.IP, info.Authorization, out int stateID, out string stateText, out int battery, out string missionText, out System.Drawing.PointF position);
bool rtn = Common.mir.Get_State(info.IP, info.Authorization, out int stateID, out string stateText, out int battery, out string missionText, out PointF pos);
//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)
......@@ -94,7 +96,7 @@ namespace BLL
info.StateText = stateText;
info.Battery = battery;
info.MissionText = missionText;
info.Position = position;
info.Position = pos;
string ip = info.IP;
int idx = Common.agvInfos.FindIndex(s => s.IP == ip);
......@@ -136,48 +138,91 @@ namespace BLL
{
for (int i = 0; i < Common.agvInfos.Count; i++)
{
if (Common.agvInfos[i].CurrentJob == null)
AgvInfo agv = Common.agvInfos[i];
if (agv.CurrentJob == null)
{
timeout[i] = DateTime.Now;
continue;
}
agv.LogJson.OutputLog();
string name = "";
if (Common.agvInfos[i].Name.IndexOf("11") >= 0)
name = "11号车";
else if (Common.agvInfos[i].Name.IndexOf("13") >= 0)
name = "13号车";
if (int.TryParse(agv.Name.Substring(0, 2), out int result))
name = result + "号车";
//if (agv.Name.IndexOf("11") >= 0)
// name = "11号车";
//else if (agv.Name.IndexOf("13") >= 0)
// name = "13号车";
//else if (agv.Name.IndexOf("21") >= 0)
// name = "21号车";
if (Math.Abs(Common.agvInfos[i].Position.X - position[i].X) < 2 && Math.Abs(Common.agvInfos[i].Position.Y - position[i].Y) < 2)
if (!agv.IsOnline && agv.IsAuto) //自动+离线
{
DisplayBoard.Add(name, "lineAgv." + name + ".Msg", "离线", 0);
//agv.LogJson.SetErrorInfo(agv.TaskName, "离线");
continue;
}
if (!agv.IsOnline && !agv.IsAuto) //手动+离线
{
DisplayBoard.Add(name, "lineAgv." + name + ".Msg", "停用", 0);
//agv.LogJson.SetErrorInfo(agv.TaskName, "停用");
continue;
}
if (agv.IsOnline && !agv.IsAuto) //手动+在线
{
DisplayBoard.Add(name, "lineAgv." + name + ".Msg", "正常", 1);
continue;
}
//自动在线,显示当前状态
if (Math.Abs(agv.Position.X - position[i].X) < 1 && Math.Abs(agv.Position.Y - position[i].Y) < 1)
{
TimeSpan span = DateTime.Now - timeout[i];
if (span.TotalMinutes >= Common.BoardTimeout)
int tt = Convert.ToInt32(span.TotalMinutes - Common.BoardTimeout);
if (tt > 0)
{
if (Common.agvInfos[i].CurrentJob is ChargeJob)
if (agv.CurrentJob is ChargeJob)
{
DisplayBoard.Add(name, "lineAgv." + name + ".Place", "AutoCharge", 1);
}
else if (Common.agvInfos[i].CurrentJob is StandbyJob)
else if (agv.CurrentJob is StandbyJob)
{
DisplayBoard.Add(name, "lineAgv." + name + ".Place", "Standby", 1);
}
else if (agv.CurrentJob is StorageJob && agv.CurrentJob.Msg.IndexOf("等待离开信号") > 0)
{
string value = string.Format("在仓储等待离开信号超时{0:F}分钟", tt);
DisplayBoard.Add(name, "lineAgv." + name + ".StandTimeOut", value, 0);
Common.log.Info(agv.Name + " 上传报告 " + value);
agv.LogJson.SetErrorStart(agv.TaskName, value);
}
else
{
string value = string.Format("在{0}停留超时{1:F}分钟", Common.agvInfos[i].Place, span.TotalMinutes);
string value = string.Format("在去{0}途中停留超时{1:F}分钟,{2}", agv.Place, tt, agv.MissionText);
DisplayBoard.Add(name, "lineAgv." + name + ".StandTimeOut", value, 0);
Common.log.Info(agv.Name + " 上传报告 " + value);
agv.LogJson.SetErrorStart(agv.TaskName, value);
}
}
else
{
DisplayBoard.Add(name, "lineAgv." + name + ".Msg", Common.agvInfos[i].CurrentJob.Msg, 1);
DisplayBoard.Add(name, "lineAgv." + name + ".Msg", agv.CurrentJob.Msg, 1);
}
}
else
{
DisplayBoard.Add(name, "lineAgv." + name + ".Msg", Common.agvInfos[i].CurrentJob.Msg, 1);
DisplayBoard.Add(name, "lineAgv." + name + ".Msg", agv.CurrentJob.Msg, 1);
timeout[i] = DateTime.Now;
position[i] = new PointF(Common.agvInfos[i].Position.X, Common.agvInfos[i].Position.Y);
position[i] = new PointF(agv.Position.X, agv.Position.Y);
agv.LogJson.SetErrorOver();
}
}
DisplayBoard.UpdateAlarmMsg();
......
......@@ -26,7 +26,7 @@ namespace BLL
return chargeStep.Msg;
}
}
public IJob Execute(AgvInfo info)
{
_info = info;
......@@ -34,6 +34,9 @@ namespace BLL
{
_info.From = "";
_info.Place = "";
_info.LogJson.SetMissionStart("充电任务", "充电桩");
_info.LogJson.SetMissionStep("开始执行任务", ChargeStep.None.ToString());
if (_info.IsWorkspace())
MoveWash();
else
......@@ -43,35 +46,47 @@ namespace BLL
{
move.Execute(_info);
if (move.IsEnd)
{
MoveWash();
_info.LogJson.SetMissionStep("已过门", ChargeStep.PassDoor.ToString());
}
}
else if (chargeStep.Equals(ChargeStep.WaitWashPoint))
{
move.Execute(_info);
if (move.IsEnd)
{
_info.LogJson.SetMissionStep("到达" + _info.Workshop + "清洗房", ChargeStep.WaitWashPoint.ToString());
MoveCharge();
}
}
else if (chargeStep.Equals(ChargeStep.MoveStation))
{
move.Execute(_info);
MoveStation();
}
else if (chargeStep.Equals(ChargeStep.Charging))
{
Common.log.Debug(_info.Name + " 当前电量" + _info.Battery);
//_info.LogJson.SetMissionStep("正在充电中", ChargeStep.Charging.ToString());
Common.log.Info(string.Format("充电中 当前{0} 最小{1} 最大{2}", _info.Battery, _info.BatteryMin, _info.BatteryMax));
move.Execute(_info);
if (_info.Battery == _info.BatteryMax)
{
chargeStep.Msg = _info.Name + " 电量达到" + _info.BatteryMax;
chargeStep.NextStep(ChargeStep.End);
_info.LogJson.SetMissionStep("结束充电", ChargeStep.Charging.ToString());
}
else if (_info.Battery > _info.BatteryMin)
{
IJob job = SteelManage.GetSteelJob(_info);
if (job != null)
{
_info.LogJson.SetMissionStep("结束充电", ChargeStep.Charging.ToString());
Common.mir.Del_Mission(_info.IP, _info.Authorization);
Common.log.Info("结束充电,接收到任务" + job.ToString());
return job;
}
}
......@@ -79,6 +94,8 @@ namespace BLL
else if (chargeStep.Equals(ChargeStep.End))
{
_info.Place = "充电结束";
//_info.LogJson.SetMissionStep("充电任务结束", ChargeStep.End.ToString());
Common.mir.Del_Mission(_info.IP, _info.Authorization);
chargeStep.Msg = _info.Name + " 充电工作结束,回待机位";
return new StandbyJob();
......@@ -123,12 +140,6 @@ namespace BLL
private void MoveStation()
{
//if (_info.Battery > currBattery)
//{
// chargeStep.Msg = _info.Name + " 到达充电位,准备充电";
// chargeStep.NextStep(ChargeStep.Charging);
//}
bool rtn = Common.mir.Get_Register(_info.IP, _info.Authorization, CHARGE_PLC, out int value);
if (rtn)
{
......@@ -137,6 +148,8 @@ namespace BLL
_info.Place = "充电中";
chargeStep.Msg = _info.Name + " 到达充电位,准备充电";
chargeStep.NextStep(ChargeStep.Charging);
_info.LogJson.SetMissionStep("到达充电位", ChargeStep.MoveStation.ToString());
}
}
}
......
......@@ -38,7 +38,10 @@ namespace BLL
else if (moveStep.Equals(MoveStep.Error))
Error();
else if (moveStep.Equals(MoveStep.End))
{
IsEnd = true;
//_info.LogJson.SetTaskOver();
}
return this;
}
......@@ -49,6 +52,8 @@ namespace BLL
private void Send()
{
//_info.LogJson.SetTaskStart(_mission);
bool rtn;
if (Common.FLEET_SEND)
rtn = Common.mir.Add_Mission_Fleet(_info.FleetID, _info.Authorization, _mission, out _id);
......@@ -56,6 +61,7 @@ namespace BLL
rtn = Common.mir.Add_Mission(_info.IP, _info.Authorization, _mission, out _id);
if (rtn)
{
_info.TaskName = _mission;
Common.log.Debug("MoveJob To:" + _info.Name + ", " + _mission + " 发送成功");
moveStep.NextStep(MoveStep.Working);
_getTime = DateTime.Now;
......@@ -68,34 +74,34 @@ namespace BLL
private void Working()
{
//TimeSpan span = DateTime.Now - _getTime;
//if (span.TotalMilliseconds > 5000)
//{
bool rtn;
string state;
if (Common.FLEET_SEND)
rtn = Common.mir.Get_MissionState_Fleet(_info.Authorization, _id, out state);
else
rtn = Common.mir.Get_MissionState(_info.IP, _info.Authorization, _id, out state);
if (rtn)
{
Common.log.Debug("MoveJob To:" + _info.Name + ", " + _mission + ", " + state.ToString());
if (state == MissionState.Done.ToString())
moveStep.NextStep(MoveStep.End);
else if (state == MissionState.Aborted.ToString())
moveStep.NextStep(MoveStep.Error);
else if (state == MissionState.Executing.ToString())
_getTime = DateTime.Now;
}
else
{
Common.log.Warn("MoveJob To:" + _info.Name + ", " + _mission + " 获取状态失败");
}
//}
//_info.LogJson.SetTaskInfo(_info.MissionText);
bool rtn;
string state;
if (Common.FLEET_SEND)
rtn = Common.mir.Get_MissionState_Fleet(_info.Authorization, _id, out state);
else
rtn = Common.mir.Get_MissionState(_info.IP, _info.Authorization, _id, out state);
if (rtn)
{
Common.log.Debug("MoveJob To:" + _info.Name + ", " + _mission + ", " + state.ToString());
if (state == MissionState.Done.ToString())
moveStep.NextStep(MoveStep.End);
else if (state == MissionState.Aborted.ToString())
moveStep.NextStep(MoveStep.Error);
else if (state == MissionState.Executing.ToString())
_getTime = DateTime.Now;
}
else
{
Common.log.Warn("MoveJob To:" + _info.Name + ", " + _mission + " 获取状态失败");
}
}
private void Error()
{
//_info.LogJson.SetTaskOver();
Common.log.Debug("MoveJob To:" + _info.Name + ", " + _mission + " 重新发送");
Common.mir.Clear_Error(_info.IP, _info.Authorization);
System.Threading.Thread.Sleep(100);
......
......@@ -33,6 +33,9 @@ namespace BLL
if (sendNewStep.Equals(SendNewStep.None))
{
_info.Place = "";
_info.LogJson.SetMissionStart("查找送新钢板任务", "产线");
_info.LogJson.SetMissionStep("开始执行任务", SendNewStep.None.ToString());
if (_info.IsWorkspace())
sendNewStep.NextStep(SendNewStep.FindLine);
else
......@@ -43,11 +46,13 @@ namespace BLL
move.Execute(_info);
if (move.IsEnd)
{
_info.LogJson.SetMissionStep("已过门", SendNewStep.PassDoor.ToString());
sendNewStep.NextStep(SendNewStep.FindLine);
}
}
else if (sendNewStep.Equals(SendNewStep.FindLine))
{
//_info.LogJson.SetMissionStep("查找任务", SendNewStep.FindLine.ToString());
bool rtn = SteelManage.FindNewSteelWork(_info, out string place);
if (rtn)
{
......@@ -112,13 +117,16 @@ namespace BLL
{
sendNewStep.Msg = _info.Name + " 已进入4C无尘室";
MoveLine(airPlace);
_info.LogJson.SetMissionStep("已进入无尘室", SendNewStep.EnterAirRoom.ToString());
}
}
else if (sendNewStep.Equals(SendNewStep.LeaveAirRoom))
{
move.Execute(_info);
if (move.IsEnd)
{
_info.LogJson.SetMissionStep("已离开无尘室", SendNewStep.LeaveAirRoom.ToString());
sendNewStep.Msg = _info.Name + " 已离开4C无尘室";
if (airPlace == "$WASH")
{
......@@ -137,30 +145,36 @@ namespace BLL
}
else if (sendNewStep.Equals(SendNewStep.MoveLine))
{
move.Execute(_info);
if (move.IsEnd)
{
SteelManage.NewSteelWorkDel(_info.From, _info.Place);
sendNewStep.Msg = _info.Name + " 到达 " + _info.Place;
sendNewStep.Msg = _info.Name + " 到达" + _info.Place;
sendNewStep.NextStep(SendNewStep.FindLine);
_info.LogJson.SetMissionStep("到达" + _info.Place, SendNewStep.MoveLine.ToString());
}
}
else if (sendNewStep.Equals(SendNewStep.GoWashPoint))
{
//_info.LogJson.SetMissionStep("去清洗房", SendNewStep.GoWashPoint.ToString());
MoveWash();
}
else if (sendNewStep.Equals(SendNewStep.WaitWashPoint))
{
move.Execute(_info);
if (move.IsEnd)
{
_info.Place = "";
sendNewStep.NextStep(SendNewStep.End);
sendNewStep.Msg = _info.Name + " 到达" + _info.Workshop + "清洗点";
sendNewStep.Msg = _info.Name + " 到达" + _info.Workshop + "清洗房";
_info.LogJson.SetMissionStep("到达清洗房", SendNewStep.WaitWashPoint.ToString());
}
}
else if (sendNewStep.Equals(SendNewStep.End))
{
//_info.LogJson.SetMissionStep("送新钢板任务结束", SendNewStep.End.ToString());
IJob job = SteelManage.GetSteelJob(info);
if (job == null)
return new StandbyJob();
......
......@@ -8,7 +8,6 @@ namespace BLL
private AgvInfo _info;
private MoveJob move;
private string mission;
//private DateTime _getTime;
private JobStep<StandbyStep> standbyStep;
public StandbyJob()
......@@ -34,16 +33,23 @@ namespace BLL
{
_info.From = "";
_info.Place = "";
_info.LogJson.SetMissionStart("回待机点任务", "待机位");
if (_info.IsWorkspace())
MoveStandby();
else
PassDoor();
_info.LogJson.SetMissionStep("开始执行任务", StandbyStep.None.ToString());
}
else if (standbyStep.Equals(StandbyStep.PassDoor))
{
move.Execute(_info);
if (move.IsEnd)
{
MoveStandby();
_info.LogJson.SetMissionStep("已过门", StandbyStep.PassDoor.ToString());
}
}
else if (standbyStep.Equals(StandbyStep.MoveStandby))
{
......@@ -53,10 +59,13 @@ namespace BLL
_info.Place = "待机位";
standbyStep.NextStep(StandbyStep.End);
standbyStep.Msg = _info.Name + " 到达待机位";
_info.LogJson.SetMissionStep("已到达待机位", StandbyStep.MoveStandby.ToString());
}
}
else if (standbyStep.Equals(StandbyStep.End))
{
//_info.LogJson.SetMissionStep("回待机点任务结束", StandbyStep.End.ToString());
if (_info.Battery <= _info.BatteryMin)
{
standbyStep.Msg = _info.Name + " 电量小于" + _info.BatteryMin + ",执行充电任务";
......@@ -64,17 +73,6 @@ namespace BLL
}
else
{
//if (_info.Battery <= 80)
//{
// standbyStep.Msg = _info.Name + " 电量小于80%,执行充电任务";
// return new ChargeJob();
//}
//else
//{
// IJob job = SteelManage.GetSteelJob(info);
// if (job != null) return job;
//}
IJob job = SteelManage.GetSteelJob(info);
if (job == null)
{
......
......@@ -35,6 +35,9 @@ namespace BLL
{
_info.From = "STORAGE";
_info.Place = "";
_info.LogJson.SetMissionStart("去仓库任务", "仓库");
_info.LogJson.SetMissionStep("开始执行任务", StorageStep.None.ToString());
dockTime = 0;
if (_info.Is4DWorkshop())
MoveStorage();
......@@ -45,7 +48,10 @@ namespace BLL
{
move.Execute(_info);
if (move.IsEnd)
{
MoveStorage();
_info.LogJson.SetMissionStep("已过门", StorageStep.PassDoor.ToString());
}
}
else if (storageStep.Equals(StorageStep.MoveStorage))
{
......@@ -56,10 +62,13 @@ namespace BLL
_info.Place = "到达仓库";
storageStep.Msg = info.Name + " 已到位,等待对接信号";
storageStep.NextStep(StorageStep.GetSingle);
_info.LogJson.SetMissionStep("到达仓库", StorageStep.MoveStorage.ToString());
}
}
else if (storageStep.Equals(StorageStep.GetSingle))
{
//_info.LogJson.SetMissionStep("等待离开信号", StorageStep.GetSingle.ToString());
if (Common.StorageDockAlway || Common.StorageDockFinish)
{
SteelManage.StorageWorkDel(_info.Workshop + "_ENTER");
......@@ -76,7 +85,7 @@ namespace BLL
storageStep.Msg = info.Name + " 对接仓库连续3次信号没有到位";
storageStep.NextStep(StorageStep.Error);
dockTime = 0;
//小车报警任务
_info.LogJson.SetMissionStep("对接仓库连续3次信号没有到位", StorageStep.GetSingle.ToString());
}
else
{
......@@ -90,25 +99,36 @@ namespace BLL
}
else if (storageStep.Equals(StorageStep.WaitStorageLeave))
{
if (SteelManage.FindStorageWorkLeave())
{
SteelManage.StorageWorkDelLeave();
storageStep.Msg = info.Name + " 收到离开信号";
_info.LogJson.SetMissionStep("收到离开信号", StorageStep.WaitStorageLeave.ToString());
if (_info.IsWorkspace())
storageStep.NextStep(StorageStep.FindJob);
else
PassDoor4C();
}
else
{
}
}
else if (storageStep.Equals(StorageStep.BackDoor))
{
move.Execute(_info);
if (move.IsEnd)
{
storageStep.NextStep(StorageStep.FindJob);
_info.LogJson.SetMissionStep("已过门", StorageStep.BackDoor.ToString());
}
}
else if (storageStep.Equals(StorageStep.Error))
{
//_info.LogJson.SetMissionStep("信号没有到位", StorageStep.Error.ToString());
if (SteelManage.FindStorageWorkLeave())
{
SteelManage.StorageWorkDelLeave();
......@@ -122,6 +142,7 @@ namespace BLL
}
else if (storageStep.Equals(StorageStep.FindJob))
{
//_info.LogJson.SetMissionStep("查找任务", StorageStep.FindJob.ToString());
IJob job = SteelManage.GetNewSteelJob(info);
if (job == null)
{
......@@ -137,6 +158,8 @@ namespace BLL
}
else if(storageStep.Equals(StorageStep.GoWashPoint))
{
//_info.LogJson.SetMissionStep("去清洗房", StorageStep.GoWashPoint.ToString());
mission = Common.MISSION_MOVE_WASH + _info.Workshop;
_info.Place = string.Format("去{0}清洗点", _info.Workshop);
move = new MoveJob(mission);
......@@ -151,13 +174,14 @@ namespace BLL
{
_info.Place = "";
storageStep.NextStep(StorageStep.End);
storageStep.Msg = _info.Name + " 到达" + _info.Workshop + "清洗点";
storageStep.Msg = _info.Name + " 到达" + _info.Workshop + "清洗房";
_info.LogJson.SetMissionStep("到达清洗房", StorageStep.WaitWashPoint.ToString());
}
}
else if (storageStep.Equals(StorageStep.End))
{
//_info.LogJson.SetMissionStep("去仓库任务结束", StorageStep.End.ToString());
return new StandbyJob();
}
return this;
......
......@@ -36,11 +36,16 @@ namespace BLL
_info.From = "";
_info.Place = "";
_info.OldSteel = 0;
_info.LogJson.SetMissionStart("查找回收钢板任务", "产线");
_info.LogJson.SetMissionStep("开始执行任务", TakeOldStep.None.ToString());
takeOldStep.Msg = _info.Name + " 查找回收钢板任务";
takeOldStep.NextStep(TakeOldStep.FindLine);
}
else if (takeOldStep.Equals(TakeOldStep.FindLine))
{
//_info.LogJson.SetMissionStep("判断钢板数量", TakeOldStep.FindLine.ToString());
if (_info.OldSteel == 5)
{
takeOldStep.Msg = _info.Name + " 回收钢板已满";
......@@ -61,18 +66,22 @@ namespace BLL
}
else if (takeOldStep.Equals(TakeOldStep.EnterAirRoom))
{
move.Execute(_info);
if (move.IsEnd)
{
_info.LogJson.SetMissionStep("已进入无尘室", TakeOldStep.EnterAirRoom.ToString());
takeOldStep.Msg = _info.Name + " 已进入4C无尘室";
MoveLine(airPlace);
}
}
else if (takeOldStep.Equals(TakeOldStep.LeaveAirRoom))
{
move.Execute(_info);
if (move.IsEnd)
{
_info.LogJson.SetMissionStep("已离开无尘室", TakeOldStep.LeaveAirRoom.ToString());
takeOldStep.Msg = _info.Name + " 已离开4C无尘室";
if (airPlace == "$WASH")
MoveWash();
......@@ -89,10 +98,12 @@ namespace BLL
SteelManage.OldSteelWorkDel(_info.Place);
takeOldStep.NextStep(TakeOldStep.FindLine);
takeOldStep.Msg = _info.Name + " 到达" + _info.Place;
_info.LogJson.SetMissionStep("到达" + _info.Place, TakeOldStep.MoveLine.ToString());
}
}
else if (takeOldStep.Equals(TakeOldStep.GoWashPoint))
{
//_info.LogJson.SetMissionStep("判断回收钢板数量", TakeOldStep.GoWashPoint.ToString());
if (_info.OldSteel == 0)
{
takeOldStep.NextStep(TakeOldStep.End);
......@@ -100,14 +111,6 @@ namespace BLL
}
else
{
//if (_info.In4CAirRoom())
//{
// takeOldStep.Msg = _info.Name + " 先暂停" + place;
// LeaveAirAccess();
//}
//else
// MoveLine(place);
MoveWash();
}
}
......@@ -117,12 +120,15 @@ namespace BLL
if (move.IsEnd)
{
takeOldStep.NextStep(TakeOldStep.End);
takeOldStep.Msg = _info.Name + " 到达" + _info.Workshop + "清洗点";
takeOldStep.Msg = _info.Name + " 到达" + _info.Workshop + "清洗房";
_info.LogJson.SetMissionStep("到达" + _info.Workshop + "清洗房", TakeOldStep.WaitWashPoint.ToString());
}
}
else if (takeOldStep.Equals(TakeOldStep.End))
{
//_info.LogJson.SetMissionStep("回收钢板任务结束", TakeOldStep.End.ToString());
_info.OldSteel = 0;
IJob job = SteelManage.GetSteelJob(_info);
if (job == null)
return new StandbyJob();
......@@ -139,6 +145,7 @@ namespace BLL
if (rtn)
{
airPlace = place;
if (SteelManage.IsAirLines(place))
{
if (_info.In4CAirRoom())
......
......@@ -33,6 +33,9 @@ namespace BLL
{
_info.From = "";
_info.Place = "";
_info.LogJson.SetMissionStart("去清洗房任务", "清洗房");
_info.LogJson.SetMissionStep("开始执行任务", WashPointStep.None.ToString());
SteelManage.NewSteelWorkDelAll(_info.Workshop);
if (_info.IsWorkspace())
MoveWash();
......@@ -43,21 +46,29 @@ namespace BLL
{
move.Execute(_info);
if (move.IsEnd)
{
MoveWash();
_info.LogJson.SetMissionStep("已过门", WashPointStep.PassDoor.ToString());
}
}
else if (washPointStep.Equals(WashPointStep.MoveWash))
{
move.Execute(_info);
if (move.IsEnd)
{
SteelManage.NewSteelWorkDel(_info.From, _info.From);
washPointStep.NextStep(WashPointStep.End);
washPointStep.Msg = _info.Name + " 到达清洗点";
washPointStep.Msg = _info.Name + " 到达清洗房";
_info.LogJson.SetMissionStep("已到达清洗房", WashPointStep.MoveWash.ToString());
}
}
else if (washPointStep.Equals(WashPointStep.End))
{
_info.Place = "";
//_info.LogJson.SetMissionStep("到达清洗房", WashPointStep.End.ToString());
IJob job = SteelManage.GetNewSteelJob(info);
if (job == null)
{
......
......@@ -27,11 +27,11 @@ namespace BLL
notifyMenu = new ContextMenuStrip();
items = new ToolStripItem[4];
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetEntryAssembly();
string text = assembly.GetName().Version.ToString();
text = frm.Text + (frm.Text.Contains(text) ? "" : " " + text);
//System.Reflection.Assembly assembly = System.Reflection.Assembly.GetEntryAssembly();
//string text = assembly.GetName().Version.ToString();
//text = frm.Text + text;
items[0] = new ToolStripMenuItem(text) { Font = new Font("微软雅黑", 11f, FontStyle.Bold), Image = frm.Icon.ToBitmap() };
items[0] = new ToolStripMenuItem(frm.Text) { Font = new Font("微软雅黑", 11f, FontStyle.Bold), Image = frm.Icon.ToBitmap() };
items[1] = new ToolStripSeparator();
items[2] = new ToolStripMenuItem("显示") { Font = new Font("微软雅黑", 11f) };
items[3] = new ToolStripMenuItem("退出") { Font = new Font("微软雅黑", 11f) };
......
......@@ -16,7 +16,7 @@ namespace BLL
WebWork service = new WebWork();
_serviceHost = new WebServiceHost(service, new Uri(url));
_serviceHost.Open();
Model.Common.log.Info("Web服务已开启");
Model.Common.log.Info("Web服务已开启,URL=" + url);
IsOpen = true;
}
catch (Exception ex)
......
......@@ -2,13 +2,18 @@
<configuration>
<log4net>
<logger name="AGVControl_Steel">
<level value="Debug"/>
<level value="Info"/>
<appender-ref ref="AGVControl_Steel"/>
</logger>
<logger name="MiR_API">
<level value="Debug"/>
<level value="Info"/>
<appender-ref ref="api"/>
</logger>
<logger name="RunLog">
<level value="Info"/>
<appender-ref ref="RunLog"/>
</logger>
<appender name="AGVControl_Steel" type="log4net.Appender.RollingFileAppender">
<param name="File" value="Log\\AGVControl_Steel.log" />
<param name="Encoding" value="UTF-8"/>
......@@ -33,5 +38,18 @@
<param name="ConversionPattern" value="[%d][%t][%c:%L]%-5p %m%n" />
</layout>
</appender>
<appender name="RunLog" type="log4net.Appender.RollingFileAppender">
<param name="File" value="Log\\RunLog.json" />
<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="%m%n" />
</layout>
</appender>
</log4net>
</configuration>
\ No newline at end of file
......@@ -3,3 +3,8 @@ D:\Neotel_Beta\AGVControl_Steel\DAL\bin\Debug\DAL.pdb
D:\Neotel_Beta\AGVControl_Steel\DAL\obj\Debug\DAL.csproj.CoreCompileInputs.cache
D:\Neotel_Beta\AGVControl_Steel\DAL\obj\Debug\DAL.dll
D:\Neotel_Beta\AGVControl_Steel\DAL\obj\Debug\DAL.pdb
C:\Neotel\Program\AGVControl_Steel\DAL\bin\Debug\DAL.dll
C:\Neotel\Program\AGVControl_Steel\DAL\bin\Debug\DAL.pdb
C:\Neotel\Program\AGVControl_Steel\DAL\obj\Debug\DAL.csproj.CoreCompileInputs.cache
C:\Neotel\Program\AGVControl_Steel\DAL\obj\Debug\DAL.dll
C:\Neotel\Program\AGVControl_Steel\DAL\obj\Debug\DAL.pdb
......@@ -81,7 +81,9 @@ namespace Model
public int NewSteel { set; get; } = 0;
public string TaskName { set; get; } = "";
public LogJson LogJson { set; get; }
......@@ -95,6 +97,17 @@ namespace Model
IP = ip;
Workshop = workshop;
Authorization = authorization;
if (int.TryParse(name.Substring(0, 2), out int result))
LogJson = new LogJson(result + "号车", "RunLog");
//if (name.IndexOf("11") >= 0)
// LogJson = new LogJson("11号车", "RunLog");
//else if (name.IndexOf("13") >= 0)
// LogJson = new LogJson("13号车", "RunLog");
//else if (name.IndexOf("21") >= 0)
// LogJson = new LogJson("21号车", "RunLog");
}
public string[] ToGridRow()
......@@ -115,18 +128,23 @@ namespace Model
/// <returns></returns>
public bool IsWorkspace()
{
//3楼
if (Workshop.ToUpper().IndexOf("3S") > -1)
return true;
//4楼
if (Position.Y < 55)
{
if (Workshop.IndexOf('D') > 0)
if (Workshop.ToUpper().IndexOf("4D") > -1)
return true;
else if (Workshop.IndexOf('C') > 0)
else if (Workshop.ToUpper().IndexOf("4C") > -1)
return false;
}
else if (Position.Y > 62)
{
if (Workshop.IndexOf('D') > 0)
if (Workshop.ToUpper().IndexOf("4D") > -1)
return false;
else if (Workshop.IndexOf('C') > 0)
else if (Workshop.ToUpper().IndexOf("4C") > -1)
return true;
}
......
......@@ -8,11 +8,13 @@ namespace Model
{
public static class DisplayBoard
{
private static List<AlarmMsg> msgList = new List<AlarmMsg>();
private static List<AlarmMsg> msgList = new();
public static void Add(string name, string key, string value, int type = 0)
{
msgList.Add(new AlarmMsg(name, key, value, type));
Common.log.Debug(string.Format("{0}添加监控面板,{1}", name, value));
}
public static string UpdateAlarmMsg()
......@@ -25,6 +27,8 @@ namespace Model
private static string UpdateDeviceAlarmMsg()
{
string msg = "OK";
......
......@@ -8,6 +8,8 @@ namespace Model
public string Msg { get; }
//public DateTime StartTime { get; }
public IJob Execute(AgvInfo info);
}
......
......@@ -48,4 +48,21 @@ namespace Model
}
}
//public class LogRun
//{
// private readonly log4net.ILog LOG;
// public LogRun(string name)
// {
// LOG = log4net.LogManager.GetLogger(name);
// }
// public void Info(string s)
// {
// LOG.Info(s);
// }
//}
}
此文件的差异被折叠, 点击展开。
......@@ -781,7 +781,7 @@ namespace Model
while (s.IndexOf(" ") >= 0)
s = s.Replace(" ", " ");
}
LOG.Info("Return:" + s);
LOG.Info("Return:" + UnicodeToString(s));
return s;
}
......@@ -809,7 +809,7 @@ namespace Model
while (s.IndexOf(" ") >= 0)
s = s.Replace(" ", " ");
}
LOG.Info("Return:" + s);
LOG.Info("Return:" + UnicodeToString(s));
return s;
}
......@@ -837,7 +837,7 @@ namespace Model
while (s.IndexOf(" ") >= 0)
s = s.Replace(" ", " ");
}
LOG.Info("Return:" + s);
LOG.Info("Return:" + UnicodeToString(s));
return s;
}
......@@ -865,8 +865,32 @@ namespace Model
while (s.IndexOf(" ") >= 0)
s = s.Replace(" ", " ");
}
LOG.Info("Return:" + s);
LOG.Info("Return:" + UnicodeToString(s));
}
private static string UnicodeToString(string s)
{
string b = "";
int startIndex = 0;
int idx;
do
{
if (startIndex >= s.Length) break;
idx = s.IndexOf("\\u", startIndex);
if (idx > -1)
{
string tt = s.Substring(idx + 2, 4);
b += s.Substring(startIndex, idx - startIndex);
if (short.TryParse(tt, System.Globalization.NumberStyles.HexNumber, System.Globalization.CultureInfo.InvariantCulture, out short c))
b += (char)c;
startIndex = 6 + idx;
}
}
while (idx > -1);
b += s.Substring(startIndex);
return b;
}
}
}
......@@ -56,6 +56,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="AgvInfo.cs" />
<Compile Include="LogJson.cs" />
<Compile Include="Common.cs" />
<Compile Include="DisplayBoard.cs" />
<Compile Include="IJob.cs" />
......@@ -63,6 +64,7 @@
<Compile Include="MiR_API.cs" />
<Compile Include="MiR_API_Test.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RunInfo.cs" />
<Compile Include="SteelWork.cs" />
<Compile Include="WorkshopLine.cs" />
</ItemGroup>
......
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;
//namespace Model
//{
// public class LogJson
// {
// private readonly string timeFormat = "yyyy-MM-dd HH:mm:ss";
// /// <summary>
// /// 小车名称
// /// </summary>
// public string AGVNum { set; get; } = "";
// /// <summary>
// /// 当前时间
// /// </summary>
// public string DateTime { set; get; } = "";
// /// <summary>
// /// 小车任务名称
// /// </summary>
// public string TaskName { set; get; } = "MoveSteelC1";
// /// <summary>
// /// 小车任务开始时间
// /// </summary>
// public string TaskStartTime { set; get; } = "2020-05-06 12:00:00";
// /// <summary>
// /// 小车任务结束时间
// /// </summary>
// public string TaskEndTime { set; get; } = "2020-05-06 12:20:00";
// /// <summary>
// /// 小车任务信息
// /// </summary>
// public string TaskInfo { set; get; } = "agv任务的当前信息";
// /// <summary>
// /// 软件任务名称
// /// </summary>
// public string MissionName { set; get; } = "到D1送钢板任务";
// /// <summary>
// /// 软件任务开始时间
// /// </summary>
// public string MissionStartTime { set; get; } = "";
// /// <summary>
// /// 软件任务结束时间
// /// </summary>
// public string MissionEndTime { set; get; } = "2020-05-06 12:30:00";
// /// <summary>
// /// 任务持续时间
// /// </summary>
// public string MissionTotalTime { set; get; } = "20";
// /// <summary>
// /// 软件任务信息
// /// </summary>
// public string MissionInfo { set; get; } = "在去D1的途中";
// /// <summary>
// /// 软件任务目的地
// /// </summary>
// public string MissionTarget { set; get; } = "D1";
// /// <summary>
// /// 软件任务步骤
// /// </summary>
// public string MissionStep { set; get; } = "步骤";
// /// <summary>
// /// 错误信息
// /// </summary>
// public string ErrorMessage { set; get; } = "";
// /// <summary>
// /// 错误开始时间
// /// </summary>
// public string ErrorStartTime { set; get; } = "2020-05-06 12:00:00";
// /// <summary>
// /// 错误结束时间
// /// </summary>
// public string ErrorEndTime { set; get; } = "2020-05-06 12:20:00";
// /// <summary>
// /// 错误持续时间
// /// </summary>
// public string ErrorTotalTime { set; get; } = "20";
// public LogJson()
// {
// }
// public void SetDateTime()
// {
// DateTime = string.Format("{0:"+ timeFormat + "}", System.DateTime.Now);
// MissionStartTime = DateTime;
// }
// public void SetTaskEndTime()
// {
// }
// }
// public class RunInfo
// {
// /// <summary>
// /// AGV小车名称
// /// </summary>
// public string AGVNum { get; set; } = "";
// /// <summary>
// /// 小车任务名称
// /// </summary>
// public string AGVMissionName { get; set; } = "";
// /// <summary>
// /// 当前时间
// /// </summary>
// public string DateTime { get; set; } = "";
// /// <summary>
// /// 错误信息
// /// </summary>
// public string ErrorMsg { set; get; } = "";
// /// <summary>
// /// 错误持续时间
// /// </summary>
// public string ErrorLastTime { set; get; } = "";
// /// <summary>
// /// 任务结束时间
// /// </summary>
// public string EndDateTime { set; get; } = "";
// /// <summary>
// /// 任务信息
// /// </summary>
// public string MissionInfo { get; set; } = "";
// /// <summary>
// /// 任务名称
// /// </summary>
// public string TaskName { set; get; } = "";
// /// <summary>
// /// 任务运行时间
// /// </summary>
// public string TaskRunTime { set; get; } = "";
// /// <summary>
// /// 任务步骤
// /// </summary>
// public string TaskStep { set; get; } = "";
// /// <summary>
// /// 目标地点
// /// </summary>
// public string TargetPlace { set; get; } = "";
// /// <summary>
// /// 类型
// /// </summary>
// public string Type { set; get; } = "";
// public RunInfo()
// {
// DateTime = string.Format("{0:yyyy-MM-dd HH:mm:ss}", System.DateTime.Now);
// }
// public override string ToString()
// {
// System.Reflection.PropertyInfo[] infos = GetType().GetProperties();
// string[] lines = new string[infos.Length];
// for (int i = 0; i < infos.Length; i++)
// lines[i] = string.Format("\"{0}\":\"{1}\"", infos[i].Name, infos[i].GetValue(this).ToString());
// return "{" + string.Join(",", lines) + "}";
// }
// }
//}
......@@ -2,13 +2,18 @@
<configuration>
<log4net>
<logger name="AGVControl_Steel">
<level value="Debug"/>
<level value="Info"/>
<appender-ref ref="AGVControl_Steel"/>
</logger>
<logger name="MiR_API">
<level value="Debug"/>
<level value="Info"/>
<appender-ref ref="api"/>
</logger>
<logger name="RunLog">
<level value="Info"/>
<appender-ref ref="RunLog"/>
</logger>
<appender name="AGVControl_Steel" type="log4net.Appender.RollingFileAppender">
<param name="File" value="Log\\AGVControl_Steel.log" />
<param name="Encoding" value="UTF-8"/>
......@@ -33,5 +38,18 @@
<param name="ConversionPattern" value="[%d][%t][%c:%L]%-5p %m%n" />
</layout>
</appender>
<appender name="RunLog" type="log4net.Appender.RollingFileAppender">
<param name="File" value="Log\\RunLog.json" />
<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="%m%n" />
</layout>
</appender>
</log4net>
</configuration>
\ No newline at end of file
......@@ -2,13 +2,18 @@
<configuration>
<log4net>
<logger name="AGVControl_Steel">
<level value="Debug"/>
<level value="Info"/>
<appender-ref ref="AGVControl_Steel"/>
</logger>
<logger name="MiR_API">
<level value="Debug"/>
<level value="Info"/>
<appender-ref ref="api"/>
</logger>
<logger name="RunLog">
<level value="Info"/>
<appender-ref ref="RunLog"/>
</logger>
<appender name="AGVControl_Steel" type="log4net.Appender.RollingFileAppender">
<param name="File" value="Log\\AGVControl_Steel.log" />
<param name="Encoding" value="UTF-8"/>
......@@ -33,5 +38,18 @@
<param name="ConversionPattern" value="[%d][%t][%c:%L]%-5p %m%n" />
</layout>
</appender>
<appender name="RunLog" type="log4net.Appender.RollingFileAppender">
<param name="File" value="Log\\RunLog.json" />
<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="%m%n" />
</layout>
</appender>
</log4net>
</configuration>
\ No newline at end of file
39cd401be94be237b207dee168b5365597548902
e8123f5ce9a38ac9c31fd1f40d7ef073e255e9b1
......@@ -33,4 +33,3 @@ C:\Neotel\Program\AGVControl_Steel\Model\obj\Debug\Model.csproj.CoreCompileInput
C:\Neotel\Program\AGVControl_Steel\Model\obj\Debug\Model.csproj.CopyComplete
C:\Neotel\Program\AGVControl_Steel\Model\obj\Debug\Model.dll
C:\Neotel\Program\AGVControl_Steel\Model\obj\Debug\Model.pdb
C:\Neotel\Program\AGVControl_Steel\Model\obj\Debug\Model.csprojAssemblyReference.cache
620dd80cfa29cf5741e7f5df5db501128828f411
44b04f3188fce75f2babf71fd3ba8b3c9b753caf
......@@ -10,3 +10,16 @@ D:\OneDrive - 上海挚锦科技有限公司\SMD\AGVControl_Steel\Test\obj\Debug
D:\OneDrive - 上海挚锦科技有限公司\SMD\AGVControl_Steel\Test\obj\Debug\Test.csproj.CopyComplete
D:\OneDrive - 上海挚锦科技有限公司\SMD\AGVControl_Steel\Test\obj\Debug\Test.exe
D:\OneDrive - 上海挚锦科技有限公司\SMD\AGVControl_Steel\Test\obj\Debug\Test.pdb
C:\Neotel\Program\AGVControl_Steel\Test\bin\Debug\Test.exe.config
C:\Neotel\Program\AGVControl_Steel\Test\bin\Debug\Test.exe
C:\Neotel\Program\AGVControl_Steel\Test\bin\Debug\Test.pdb
C:\Neotel\Program\AGVControl_Steel\Test\bin\Debug\RestSharp.dll
C:\Neotel\Program\AGVControl_Steel\Test\bin\Debug\RestSharp.xml
C:\Neotel\Program\AGVControl_Steel\Test\obj\Debug\Test.csprojAssemblyReference.cache
C:\Neotel\Program\AGVControl_Steel\Test\obj\Debug\Test.Form1.resources
C:\Neotel\Program\AGVControl_Steel\Test\obj\Debug\Test.Properties.Resources.resources
C:\Neotel\Program\AGVControl_Steel\Test\obj\Debug\Test.csproj.GenerateResource.cache
C:\Neotel\Program\AGVControl_Steel\Test\obj\Debug\Test.csproj.CoreCompileInputs.cache
C:\Neotel\Program\AGVControl_Steel\Test\obj\Debug\Test.csproj.CopyComplete
C:\Neotel\Program\AGVControl_Steel\Test\obj\Debug\Test.exe
C:\Neotel\Program\AGVControl_Steel\Test\obj\Debug\Test.pdb
此文件类型无法预览
此文件类型无法预览
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!