设备编辑管理界面

This commit is contained in:
2026-06-22 14:29:38 +08:00
parent ffb22e1f20
commit cba9af2892
42 changed files with 4419 additions and 17 deletions
+48
View File
@@ -0,0 +1,48 @@
using Common.Attributes;
using DeviceCommand.Base;
using NModbus;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DeviceCommand.Device
{
[ADPCommand]
public class IOBoard : ModbusTcp
{
//只有两个,八台产品公用两两分组各用一个
public IOBoard(string Ip地址, int 端口, int 发送超时, int 接收超时)
{
ConfigureDevice(Ip地址, 端口, 发送超时, 接收超时);
}
public async Task 写输出开关(byte 站号, ushort 开始地址, bool data)
{
await Modbus.WriteSingleCoilAsync(站号, 开始地址, data);
}
public async Task 批量写输出开关(byte 站号, ushort 开始地址, bool[] datas)
{
var 批量写入 = await Modbus.ReadCoilsAsync(1, 0, 16);
for (int i = 0; i < datas.Length; i++)
{
if (开始地址 + i < 批量写入.Length)
{
批量写入[开始地址 + i] = datas[i];
}
}
await Modbus.WriteMultipleCoilsAsync(站号, 0, 批量写入);
}
public async Task 读输出开关(byte 站号, ushort 开始地址)
{
await Modbus.ReadCoilsAsync(站号, 开始地址, 1);
}
public async Task<bool[]> 批量读输出开关(byte 站号, ushort 开始地址,ushort 数量)
{
return await Modbus.ReadCoilsAsync(站号, 开始地址, 数量);
}
}
}
+1
View File
@@ -11,6 +11,7 @@ namespace DeviceCommand.Device
[ADPCommand]
public class IT7800E : Tcp
{
//只有一个,八台产品一起用一个
// 根据通用 SCPI 指令规范,使用换行符 (ASCII 字符 LF,即 \n) 作为标准结束符
private const string ScpiDelimiter = "\n";
+1
View File
@@ -11,6 +11,7 @@ namespace DeviceCommand.Device
[ADPCommand]
public class N36200 : Tcp
{
//只有一个,八台产品一起用一个
// 手册第 9 页 2.2.4 明确规定:命令结束符为换行符 (ASCII 字符 LF,即 \n)
private const string ScpiDelimiter = "\n";
+1
View File
@@ -11,6 +11,7 @@ namespace DeviceCommand.Device
[ADPCommand]
public class SDS2000X_HD : Tcp
{
//只有两个,八台产品公用两两分组各用一个
// 示波器底层 Socket 字符串命令通常以换行符 \n 结束
private const string ScpiDelimiter = "\n";
+1
View File
@@ -11,6 +11,7 @@ namespace DeviceCommand.Device
[ADPCommand]
public class SPAW7000 : Tcp
{
//只有两个,八台产品公用两两分组各用一个
// 根据通用 SCPI 与远宽指令规范,使用换行符 (ASCII 字符 LF,即 \n) 作为标准结束符
private const string ScpiDelimiter = "\n";