增加Fanuc CNC驱动

This commit is contained in:
iioter 2022-06-02 14:47:53 +08:00
parent 525042d18e
commit 14ba01b13c
48 changed files with 1135 additions and 0 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -41,6 +41,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DriverSiemensS7", "Plugins\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DriverOmronFins", "Plugins\Drivers\DriverOmronFins\DriverOmronFins.csproj", "{FE2BFDBD-E021-45EA-B327-C56F6114D7A1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DriverFanuc", "Plugins\Drivers\DriverFanuc\DriverFanuc.csproj", "{EA652A3B-5F4A-47FE-A5DA-98A0EFC4F842}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -111,6 +113,10 @@ Global
{FE2BFDBD-E021-45EA-B327-C56F6114D7A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FE2BFDBD-E021-45EA-B327-C56F6114D7A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FE2BFDBD-E021-45EA-B327-C56F6114D7A1}.Release|Any CPU.Build.0 = Release|Any CPU
{EA652A3B-5F4A-47FE-A5DA-98A0EFC4F842}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EA652A3B-5F4A-47FE-A5DA-98A0EFC4F842}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EA652A3B-5F4A-47FE-A5DA-98A0EFC4F842}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EA652A3B-5F4A-47FE-A5DA-98A0EFC4F842}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -129,6 +135,7 @@ Global
{AAC81E6C-C62E-4F52-85B5-1EA8D54AE9F6} = {D05CFF72-D58C-418A-8F52-B06848DAC4F1}
{28FEF3AF-4CAA-4B5C-B16F-E74BAD70BCE2} = {D05CFF72-D58C-418A-8F52-B06848DAC4F1}
{FE2BFDBD-E021-45EA-B327-C56F6114D7A1} = {D05CFF72-D58C-418A-8F52-B06848DAC4F1}
{EA652A3B-5F4A-47FE-A5DA-98A0EFC4F842} = {D05CFF72-D58C-418A-8F52-B06848DAC4F1}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {1F219808-E6E8-4C1D-B846-41F2F7CF20FA}

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<OutputPath>../../../IoTGateway/bin/Debug/net6.0/drivers</OutputPath>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<None Remove="HslCommunication.dll" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="HslCommunication" Version="11.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\PluginInterface\PluginInterface.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="HslCommunication">
<HintPath>HslCommunication.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

View File

@ -0,0 +1,863 @@

using PluginInterface;
using System;
using System.Text;
using HslCommunication.CNC.Fanuc;
using HslCommunication;
namespace DriverFanuc
{
[DriverSupported("Fanuc-0i")]
[DriverInfoAttribute("Fanuc-0i", "V11.0.0", "Copyright HSL ")]
public class Fanuc : IDriver
{
private FanucSeries0i fanuc;
#region
[ConfigParameter("设备Id")]
public Guid DeviceId { get; set; }
[ConfigParameter("IP地址")]
public string IpAddress { get; set; } = "127.0.0.1";
[ConfigParameter("端口号")]
public int Port { get; set; } = 8193;
[ConfigParameter("超时时间ms")]
public int Timeout { get; set; } = 3000;
[ConfigParameter("最小通讯周期ms")]
public uint MinPeriod { get; set; } = 3000;
#endregion
public Fanuc(Guid deviceId)
{
// 授权示例 Authorization example
if (!Authorization.SetAuthorizationCode("输入你的授权号"))
{
//return; // 激活失败应该退出系统
}
DeviceId = deviceId;
}
public bool IsConnected
{
get
{
if (fanuc == null)
return false;
else
{
OperateResult<int[]> read = fanuc.ReadProgramList();
if (read.IsSuccess)
{
return true;
}
else
{
return false;
}
}
}
}
public bool Connect()
{
try
{
fanuc?.ConnectClose();
fanuc = new FanucSeries0i(IpAddress, Port);
return fanuc.ConnectServer().IsSuccess;
}
catch (Exception)
{
return false;
}
return IsConnected;
}
public bool Close()
{
try
{
fanuc.ConnectClose();
return !IsConnected;
}
catch (Exception)
{
return false;
}
}
public void Dispose()
{
}
[Method("Fanuc", description: "读系统状态")]
public DriverReturnValueModel ReadSysStatusInfo(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<SysStatusInfo> read = fanuc.ReadSysStatusInfo();
if (read.IsSuccess)
ret.Value = Newtonsoft.Json.JsonConvert.SerializeObject(read.Content);
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "读报警信息")]
public DriverReturnValueModel ReadSystemAlarm(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<SysAlarm[]> read = fanuc.ReadSystemAlarm();
if (read.IsSuccess)
ret.Value = Newtonsoft.Json.JsonConvert.SerializeObject(read.Content);
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "坐标数据")]
public DriverReturnValueModel ReadSysAllCoors(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<SysAllCoors> read = fanuc.ReadSysAllCoors();
if (read.IsSuccess)
ret.Value = Newtonsoft.Json.JsonConvert.SerializeObject(read.Content);
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "程序列表")]
public DriverReturnValueModel ReadProgramList(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<int[]> read = fanuc.ReadProgramList();
if (read.IsSuccess)
ret.Value = read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "当前程序名")]
public DriverReturnValueModel ReadSystemProgramCurrent(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<string, int> read = fanuc.ReadSystemProgramCurrent();
if (read.IsSuccess)
ret.Value = Newtonsoft.Json.JsonConvert.SerializeObject(
new Dictionary<string, object>() { { "ProgramName", read.Content1 }, { "ProgramNo", read.Content2 } }
);
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "主轴转进速")]
public DriverReturnValueModel ReadSpindleSpeedAndFeedRate(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<double, double> read = fanuc.ReadSpindleSpeedAndFeedRate();
if (read.IsSuccess)
ret.Value = Newtonsoft.Json.JsonConvert.SerializeObject(
new Dictionary<string, object>() { { "SpindleSpeed", read.Content1 }, { "FeedRate", read.Content2 } }
);
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "伺服负载")]
public DriverReturnValueModel ReadFanucAxisLoad(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<double[]> read = fanuc.ReadFanucAxisLoad();
if (read.IsSuccess)
ret.Value = read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "道具补偿")]
public DriverReturnValueModel ReadCutterInfos(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<CutterInfo[]> read = fanuc.ReadCutterInfos();
if (read.IsSuccess)
ret.Value = Newtonsoft.Json.JsonConvert.SerializeObject(read.Content);
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "程序路径")]
public DriverReturnValueModel ReadCurrentForegroundDir(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<string> read = fanuc.ReadCurrentForegroundDir();
if (read.IsSuccess)
ret.Value = read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "工件尺寸")]
public DriverReturnValueModel ReadDeviceWorkPiecesSize(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<double[]> read = fanuc.ReadDeviceWorkPiecesSize();
if (read.IsSuccess)
ret.Value = read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "报警代号")]
public DriverReturnValueModel ReadAlarmStatus(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<int> read = fanuc.ReadAlarmStatus();
if (read.IsSuccess)
ret.Value = read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "机床时间")]
public DriverReturnValueModel ReadCurrentDateTime(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<DateTime> read = fanuc.ReadCurrentDateTime();
if (read.IsSuccess)
ret.Value = read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "已加工数量")]
public DriverReturnValueModel ReadCurrentProduceCount(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<int> read = fanuc.ReadCurrentProduceCount();
if (read.IsSuccess)
ret.Value = read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "总加工数量")]
public DriverReturnValueModel ReadExpectProduceCount(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<int> read = fanuc.ReadExpectProduceCount();
if (read.IsSuccess)
ret.Value = read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "系统语言")]
public DriverReturnValueModel ReadLanguage(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<ushort> read = fanuc.ReadLanguage();
if (read.IsSuccess)
ret.Value = (LanguageType)read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "当前程序")]
public DriverReturnValueModel ReadCurrentProgram(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<string> read = fanuc.ReadCurrentProgram();
if (read.IsSuccess)
ret.Value = read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "开机时间")]
public DriverReturnValueModel ReadOnLineTime(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<long> read = fanuc.ReadTimeData(0);
if (read.IsSuccess)
ret.Value = read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "运行时间")]
public DriverReturnValueModel ReadRunTime(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<long> read = fanuc.ReadTimeData(1);
if (read.IsSuccess)
ret.Value = read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "切割时间")]
public DriverReturnValueModel ReadCuttingTime(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<long> read = fanuc.ReadTimeData(2);
if (read.IsSuccess)
ret.Value = read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "空闲时间")]
public DriverReturnValueModel ReadIdleTime(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<long> read = fanuc.ReadTimeData(3);
if (read.IsSuccess)
ret.Value = read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "当前道具号")]
public DriverReturnValueModel ReadCutterNumber(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
OperateResult<int> read = fanuc.ReadCutterNumber();
if (read.IsSuccess)
ret.Value = read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "读宏变量")]
public DriverReturnValueModel ReadSystemMacroValue(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
if (!int.TryParse(Ioarg.Address, out int address))
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"宏变量地址错误";
}
else
{
OperateResult<double> read = fanuc.ReadSystemMacroValue(address);
if (read.IsSuccess)
ret.Value = read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
[Method("Fanuc", description: "读取程序")]
public DriverReturnValueModel ReadProgramAsync(DriverAddressIoArgModel Ioarg)
{
var ret = new DriverReturnValueModel { StatusType = VaribaleStatusTypeEnum.Good };
if (IsConnected)
{
try
{
if (!int.TryParse(Ioarg.Address, out int address))
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"程序号错误";
}
else
{
OperateResult<string> read = fanuc.ReadProgram(address);
if (read.IsSuccess)
ret.Value = read.Content;
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败";
}
}
}
catch (Exception ex)
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = $"读取失败,{ex.Message}";
}
}
else
{
ret.StatusType = VaribaleStatusTypeEnum.Bad;
ret.Message = "连接失败";
}
return ret;
}
public async Task<RpcResponse> WriteAsync(string RequestId, string Method, DriverAddressIoArgModel Ioarg)
{
RpcResponse rpcResponse = new() { IsSuccess = false, Description = "设备驱动内未实现写入功能" };
return rpcResponse;
}
public DriverReturnValueModel Read(DriverAddressIoArgModel Ioarg)
{
throw new NotImplementedException();
}
private enum LanguageType
{
= 0,
= 1,
= 2,
= 3,
= 4,
= 6,
= 15,
= 16,
= 17
}
}
}

View File

@ -0,0 +1,235 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v6.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v6.0": {
"DriverFanuc/1.0.0": {
"dependencies": {
"HslCommunication": "11.0.0",
"Newtonsoft.Json": "13.0.1",
"PluginInterface": "1.0.0"
},
"runtime": {
"DriverFanuc.dll": {}
}
},
"HslCommunication/11.0.0": {
"dependencies": {
"Newtonsoft.Json": "13.0.1",
"System.IO.Ports": "4.7.0"
},
"runtime": {
"lib/netstandard2.1/HslCommunication.dll": {
"assemblyVersion": "11.0.0.0",
"fileVersion": "11.0.0.0"
}
}
},
"Microsoft.NETCore.Platforms/3.1.0": {},
"Microsoft.Win32.Registry/4.7.0": {
"dependencies": {
"System.Security.AccessControl": "4.7.0",
"System.Security.Principal.Windows": "4.7.0"
}
},
"Newtonsoft.Json/13.0.1": {
"runtime": {
"lib/netstandard2.0/Newtonsoft.Json.dll": {
"assemblyVersion": "13.0.0.0",
"fileVersion": "13.0.1.25517"
}
}
},
"runtime.linux-arm.runtime.native.System.IO.Ports/4.7.0": {
"runtimeTargets": {
"runtimes/linux-arm/native/System.IO.Ports.Native.so": {
"rid": "linux-arm",
"assetType": "native",
"fileVersion": "0.0.0.0"
}
}
},
"runtime.linux-arm64.runtime.native.System.IO.Ports/4.7.0": {
"runtimeTargets": {
"runtimes/linux-arm64/native/System.IO.Ports.Native.so": {
"rid": "linux-arm64",
"assetType": "native",
"fileVersion": "0.0.0.0"
}
}
},
"runtime.linux-x64.runtime.native.System.IO.Ports/4.7.0": {
"runtimeTargets": {
"runtimes/linux-x64/native/System.IO.Ports.Native.so": {
"rid": "linux-x64",
"assetType": "native",
"fileVersion": "0.0.0.0"
}
}
},
"runtime.native.System.IO.Ports/4.7.0": {
"dependencies": {
"runtime.linux-arm.runtime.native.System.IO.Ports": "4.7.0",
"runtime.linux-arm64.runtime.native.System.IO.Ports": "4.7.0",
"runtime.linux-x64.runtime.native.System.IO.Ports": "4.7.0",
"runtime.osx-x64.runtime.native.System.IO.Ports": "4.7.0"
}
},
"runtime.osx-x64.runtime.native.System.IO.Ports/4.7.0": {
"runtimeTargets": {
"runtimes/osx-x64/native/System.IO.Ports.Native.dylib": {
"rid": "osx-x64",
"assetType": "native",
"fileVersion": "0.0.0.0"
}
}
},
"System.IO.Ports/4.7.0": {
"dependencies": {
"Microsoft.Win32.Registry": "4.7.0",
"runtime.native.System.IO.Ports": "4.7.0"
},
"runtime": {
"lib/netstandard2.0/System.IO.Ports.dll": {
"assemblyVersion": "4.0.3.0",
"fileVersion": "4.700.19.56404"
}
},
"runtimeTargets": {
"runtimes/linux/lib/netstandard2.0/System.IO.Ports.dll": {
"rid": "linux",
"assetType": "runtime",
"assemblyVersion": "4.0.3.0",
"fileVersion": "4.700.19.56404"
},
"runtimes/osx/lib/netstandard2.0/System.IO.Ports.dll": {
"rid": "osx",
"assetType": "runtime",
"assemblyVersion": "4.0.3.0",
"fileVersion": "4.700.19.56404"
},
"runtimes/win/lib/netstandard2.0/System.IO.Ports.dll": {
"rid": "win",
"assetType": "runtime",
"assemblyVersion": "4.0.3.0",
"fileVersion": "4.700.19.56404"
}
}
},
"System.Security.AccessControl/4.7.0": {
"dependencies": {
"Microsoft.NETCore.Platforms": "3.1.0",
"System.Security.Principal.Windows": "4.7.0"
}
},
"System.Security.Principal.Windows/4.7.0": {},
"PluginInterface/1.0.0": {
"dependencies": {
"Newtonsoft.Json": "13.0.1"
},
"runtime": {
"PluginInterface.dll": {}
}
}
}
},
"libraries": {
"DriverFanuc/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"HslCommunication/11.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-9JcbMka4dQ8251DCXIP9JExrIqmnt6b6/pX1ZFsdQ7/GQsPtfGMshvQDFUuSx8xf9+gADw3sFu5CDcpbFSQpZg==",
"path": "hslcommunication/11.0.0",
"hashPath": "hslcommunication.11.0.0.nupkg.sha512"
},
"Microsoft.NETCore.Platforms/3.1.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-z7aeg8oHln2CuNulfhiLYxCVMPEwBl3rzicjvIX+4sUuCwvXw5oXQEtbiU2c0z4qYL5L3Kmx0mMA/+t/SbY67w==",
"path": "microsoft.netcore.platforms/3.1.0",
"hashPath": "microsoft.netcore.platforms.3.1.0.nupkg.sha512"
},
"Microsoft.Win32.Registry/4.7.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-KSrRMb5vNi0CWSGG1++id2ZOs/1QhRqROt+qgbEAdQuGjGrFcl4AOl4/exGPUYz2wUnU42nvJqon1T3U0kPXLA==",
"path": "microsoft.win32.registry/4.7.0",
"hashPath": "microsoft.win32.registry.4.7.0.nupkg.sha512"
},
"Newtonsoft.Json/13.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==",
"path": "newtonsoft.json/13.0.1",
"hashPath": "newtonsoft.json.13.0.1.nupkg.sha512"
},
"runtime.linux-arm.runtime.native.System.IO.Ports/4.7.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-pCaX07mRrO11GfUb+whjn2AJgCofx26slw0sI3XC9v0pEZO8101iK6q4ymZOiI2M4a9sQxLr2LawAEDvF4RNXg==",
"path": "runtime.linux-arm.runtime.native.system.io.ports/4.7.0",
"hashPath": "runtime.linux-arm.runtime.native.system.io.ports.4.7.0.nupkg.sha512"
},
"runtime.linux-arm64.runtime.native.System.IO.Ports/4.7.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-/J6A4bexUUJciGUwrhtzrFW4tIHqoJYlCsz5RudRmqUaqvuG2tjrbn6bEopOFs7CU4gZqAKWcU9pkp180c3DkQ==",
"path": "runtime.linux-arm64.runtime.native.system.io.ports/4.7.0",
"hashPath": "runtime.linux-arm64.runtime.native.system.io.ports.4.7.0.nupkg.sha512"
},
"runtime.linux-x64.runtime.native.System.IO.Ports/4.7.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-aaaiH4ttfkLizo0OKf++5kPN0yxKbgzcyAD3w52Y3YP96aB/M79fm0r06SedXJGv86Iou6ipj3wUQBMFaL8LnQ==",
"path": "runtime.linux-x64.runtime.native.system.io.ports/4.7.0",
"hashPath": "runtime.linux-x64.runtime.native.system.io.ports.4.7.0.nupkg.sha512"
},
"runtime.native.System.IO.Ports/4.7.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-yidiZEGEIOyGnRkZvoV6XbeqzEBg9L47PyZNBymLIsu9HHseF98wiOxR6RnHmMqQMTBlc/EONfw4NT3pw0S6YQ==",
"path": "runtime.native.system.io.ports/4.7.0",
"hashPath": "runtime.native.system.io.ports.4.7.0.nupkg.sha512"
},
"runtime.osx-x64.runtime.native.System.IO.Ports/4.7.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-c1h87v6gopjfeAu3WhVGguUhzCdpZFqX8oXrevO1ciuH4g/mFrxnzlo5POlp+TtZdQ1i8yu0ZzBMKbmX2bJJ0g==",
"path": "runtime.osx-x64.runtime.native.system.io.ports/4.7.0",
"hashPath": "runtime.osx-x64.runtime.native.system.io.ports.4.7.0.nupkg.sha512"
},
"System.IO.Ports/4.7.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-tNHiZcdskfRpxU7LBBlA69YYgBqWMBE/JDdmrEIDa4iw944VK1u4+B0FeSls1FUm+Pm4X/Fl0fSGqi8MDhb8/Q==",
"path": "system.io.ports/4.7.0",
"hashPath": "system.io.ports.4.7.0.nupkg.sha512"
},
"System.Security.AccessControl/4.7.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-JECvTt5aFF3WT3gHpfofL2MNNP6v84sxtXxpqhLBCcDRzqsPBmHhQ6shv4DwwN2tRlzsUxtb3G9M3763rbXKDg==",
"path": "system.security.accesscontrol/4.7.0",
"hashPath": "system.security.accesscontrol.4.7.0.nupkg.sha512"
},
"System.Security.Principal.Windows/4.7.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-ojD0PX0XhneCsUbAZVKdb7h/70vyYMDYs85lwEI+LngEONe/17A0cFaRFqZU+sOEidcVswYWikYOQ9PPfjlbtQ==",
"path": "system.security.principal.windows/4.7.0",
"hashPath": "system.security.principal.windows.4.7.0.nupkg.sha512"
},
"PluginInterface/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.