From a8029953301875e30b4dfcfc599a6fb4ebcd0c0c Mon Sep 17 00:00:00 2001
From: hwh <332078369@qq.com>
Date: 星期四, 22 八月 2024 14:51:18 +0800
Subject: [PATCH] Merge branch 'hwh'
---
Admin.NET/WCS.Application/Entity/WcsPlc.cs | 6
Admin.NET/WCS.Application/PLC/PLCJob.cs | 40 ++
Web/src/views/wcs/wcsPlc/index.vue | 1
Admin.NET/WCS.Application/PLC/PLCUtil.cs | 246 +++++++++++++++++
Admin.NET/WCS.Application/Enum/PLCEnum.cs | 47 +-
Admin.NET/WCS.Application/Service/WcsPlc/WcsPlcService.cs | 2
Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcInput.cs | 5
Web/src/views/wcs/wcsPlc/component/editDialog.vue | 8
Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcDto.cs | 12
Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcOutput.cs | 5
Admin.NET/WCS.Application/PLC/PLCService.cs | 60 ++++
/dev/null | 12
Admin.NET/WCS.Application/PLC/PLCTaskAction.cs | 126 +++++++++
Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceDto.cs | 218 ++++++++-------
14 files changed, 642 insertions(+), 146 deletions(-)
diff --git a/Admin.NET/WCS.Application/Entity/WcsPlc.cs b/Admin.NET/WCS.Application/Entity/WcsPlc.cs
index e92777f..a80a039 100644
--- a/Admin.NET/WCS.Application/Entity/WcsPlc.cs
+++ b/Admin.NET/WCS.Application/Entity/WcsPlc.cs
@@ -15,6 +15,12 @@
public string IP { get; set; }
/// <summary>
+ /// PLC绔彛鍙�
+ /// </summary>
+ [SugarColumn(ColumnName = "Port", ColumnDescription = "PLC绔彛鍙�")]
+ public int Port { get; set; }
+
+ /// <summary>
/// PLC绫诲瀷
/// </summary>
[Required]
diff --git a/Admin.NET/WCS.Application/Enum/PLCEnum.cs b/Admin.NET/WCS.Application/Enum/PLCEnum.cs
index 7b0d9e4..0677b5e 100644
--- a/Admin.NET/WCS.Application/Enum/PLCEnum.cs
+++ b/Admin.NET/WCS.Application/Enum/PLCEnum.cs
@@ -17,10 +17,10 @@
[Description("杈撻�佺嚎")]
ConveyorLine = 1,
/// <summary>
- /// RGV灏忚溅
+ /// AGV灏忚溅
/// </summary>
- [Description("RGV灏忚溅")]
- RGV = 2,
+ [Description("AGV灏忚溅")]
+ AGV = 2,
/// <summary>
/// 鍙犳媶鎵樻満
/// </summary>
@@ -106,28 +106,31 @@
//Byte
[Description("Byte")]
Byte = 2,
- //Char
- [Description("Char")]
- Char = 3,
- //Word
- [Description("Word")]
- Word = 4,
- //DWord
- [Description("DWord")]
- DWord = 5,
+ //Short
+ [Description("Short")]
+ Short = 3,
+ //UShort
+ [Description("UShort")]
+ UShort = 4,
//Int
[Description("Int")]
- Int = 6,
+ Int = 5,
//DInt
- [Description("DInt")]
- DInt = 7,
- //Real
- [Description("Real")]
- Real = 8,
- //LReal
- [Description("LReal")]
- LReal = 9,
+ [Description("UInt")]
+ UInt = 6,
+ //Long
+ [Description("Long")]
+ Long = 7,
+ //ULong
+ [Description("ULong")]
+ ULong = 8,
+ //Float
+ [Description("Float")]
+ Float = 9,
+ //Double
+ [Description("Double")]
+ Double = 10,
//String
[Description("String")]
- String = 10,
+ String = 11,
}
\ No newline at end of file
diff --git a/Admin.NET/WCS.Application/PLC/PLCJob.cs b/Admin.NET/WCS.Application/PLC/PLCJob.cs
new file mode 100644
index 0000000..3927eca
--- /dev/null
+++ b/Admin.NET/WCS.Application/PLC/PLCJob.cs
@@ -0,0 +1,40 @@
+锘縰sing Furion.Schedule;
+using Microsoft.Extensions.Logging;
+
+namespace WCS.Application;
+/// <summary>
+/// PLC浣滀笟浠诲姟
+/// </summary>
+[JobDetail("job_plc", Description = "PLC浣滀笟浠诲姟", GroupName = "default", Concurrent = false)]
+[Daily(TriggerId = "trigger_plc", Description = "PLC浣滀笟浠诲姟")]
+public class PLCJob : IJob
+{
+ private readonly IServiceScopeFactory _scopeFactory;
+ private readonly ILogger _logger;
+
+ public PLCJob(IServiceScopeFactory scopeFactory, ILoggerFactory loggerFactory)
+ {
+ _scopeFactory = scopeFactory;
+ _logger = loggerFactory.CreateLogger(CommonConst.SysLogCategoryName);
+ }
+
+ public async Task ExecuteAsync(JobExecutingContext context, CancellationToken stoppingToken)
+ {
+ //using var serviceScope = _scopeFactory.CreateScope();
+
+ //var rep = serviceScope.ServiceProvider.GetRequiredService<SqlSugarRepository<SysOnlineUser>>();
+ //await rep.CopyNew().AsDeleteable().ExecuteCommandAsync(stoppingToken);
+
+ PLCTaskAction.Init();
+
+
+ string msg = $"銆恵DateTime.Now}銆慞LC鏈嶅姟鍚姩...";
+ var originColor = Console.ForegroundColor;
+ Console.ForegroundColor = ConsoleColor.Red;
+ Console.WriteLine(msg);
+ Console.ForegroundColor = originColor;
+
+ // 鑷畾涔夋棩蹇�
+ _logger.LogInformation(msg);
+ }
+}
diff --git a/Admin.NET/WCS.Application/PLC/PLCService.cs b/Admin.NET/WCS.Application/PLC/PLCService.cs
new file mode 100644
index 0000000..b9af4a9
--- /dev/null
+++ b/Admin.NET/WCS.Application/PLC/PLCService.cs
@@ -0,0 +1,60 @@
+锘�
+using IoTClient;
+
+namespace WCS.Application;
+public static class PLCService
+{
+
+ public static void OnChangeEvent(object sender, EventArgs e)
+ {
+ var mod = sender as WcsDeviceDto;
+ Console.WriteLine("PLC鍊间负" + mod.Value);
+ switch (mod.Type)
+ {
+ case PLCTypeEnum.StackingMachine:
+ if (mod.Value == 820)
+ {
+ //娴嬭瘯鍐欏叆830
+ var result = mod.PLCUtil.SetPlcDBValue(mod.PosType.Value, mod.DbNumber, mod.PlcPos, "830");
+ //鍐欏叆鏄惁鎴愬姛
+ if (result.IsSucceed)
+ {
+
+ }
+ }
+ else if (mod.Value == 840)
+ {
+ //娴嬭瘯鎵归噺璇诲彇
+ Dictionary<string, PLCDataTypeEnum> listaddress = new Dictionary<string, PLCDataTypeEnum>();
+ foreach (var modStation in mod.listStation)
+ {
+ listaddress.Add(modStation.PlcPos, modStation.PosType.Value);
+ }
+ var result = mod.PLCUtil.GetPlcBatchDBValue(listaddress);
+ if (!result.IsSucceed)
+ {
+ if (result.Value.Count > 0)//鏈夐敊璇殑涔熸湁鎴愬姛鐨�
+ {
+
+ }
+ }
+ }
+ else if (mod.Value == 860)
+ {
+
+ }
+ break;
+ case PLCTypeEnum.ConveyorLine:
+
+ break;
+ case PLCTypeEnum.AGV:
+ break;
+ case PLCTypeEnum.PalletMachine:
+
+ break;
+ default:
+ break;
+ }
+ }
+
+}
diff --git a/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs b/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs
new file mode 100644
index 0000000..ee09096
--- /dev/null
+++ b/Admin.NET/WCS.Application/PLC/PLCTaskAction.cs
@@ -0,0 +1,126 @@
+锘縰sing Admin.NET.Core.Service;
+
+namespace WCS.Application;
+public static class PLCTaskAction
+{
+ private static readonly ISqlSugarClient _db = SqlSugarSetup.ITenant.GetConnectionScope(SqlSugarConst.MainConfigId);
+
+ private static List<WcsPlc> listPlc;
+ private static List<WcsDevice> listPlcDevice;
+ private static List<WcsStation> listPlcStation;
+
+ private static List<PLCUtil> listPlcUtil = new List<PLCUtil>();
+ private static CancellationTokenSource cts = new CancellationTokenSource();//鍙栨秷绾跨▼鏍囪瘑
+
+ public static event EventHandler DeviceValueChangeEvent;
+ static PLCTaskAction()
+ {
+ //璁㈤槄浜嬩欢
+ DeviceValueChangeEvent += PLCService.OnChangeEvent;
+
+ listPlc = _db.Queryable<WcsPlc>().ToList();
+ listPlcDevice = _db.Queryable<WcsDevice>().ToList();
+ listPlcStation = _db.Queryable<WcsStation>().ToList();
+ }
+ /// <summary>
+ /// 鍒濆鍖朠LC杩炴帴
+ /// </summary>
+ public static void Init()
+ {
+ if (listPlcUtil.Count != 0)
+ {
+ cts.Cancel();
+ listPlc = _db.Queryable<WcsPlc>().ToList();
+ listPlcDevice = _db.Queryable<WcsDevice>().ToList();
+ listPlcStation = _db.Queryable<WcsStation>().ToList();
+ //绛夊緟鍑犵閽燂紝鎶婂凡鏈夌嚎绋嬪彇娑堟帀鍐嶈繛鎺�
+ Thread.Sleep(5000);
+ foreach (var modPlcUtil in listPlcUtil)
+ {
+ modPlcUtil.Close();
+ }
+ listPlcUtil.Clear();
+ }
+ foreach (var modPlc in listPlc)
+ {
+ var plc = new PLCUtil(modPlc);
+ listPlcUtil.Add(plc);
+ }
+ cts = new CancellationTokenSource();
+ StartRead();
+ }
+ /// <summary>
+ /// 寮�鍚鍙杙lc绾跨▼
+ /// </summary>
+ public static void StartRead()
+ {
+ foreach (var modPlc in listPlc)
+ {
+ Task.Run(() =>
+ {
+ var _modplc = modPlc;
+ while (true)
+ {
+ //鍙栨秷绾跨▼ 鍏抽棴PLC杩炴帴
+ if (cts.Token.IsCancellationRequested)
+ {
+ foreach (var modPlcUtil in listPlcUtil)
+ {
+ modPlcUtil.Close();
+ }
+ throw new OperationCanceledException();
+ }
+ try
+ {
+ var modPlcUtil = listPlcUtil.FirstOrDefault(s => s.PlcId == modPlc.Id);
+ if (modPlcUtil == null)
+ {
+ modPlcUtil = new PLCUtil(modPlc);
+ listPlcUtil.Add(modPlcUtil);
+ }
+ var listDevice = listPlcDevice.Where(s => s.PlcId == _modplc.Id).ToList();
+ //寰幆璇昏澶�
+ foreach (var modDevice in listDevice)
+ {
+ var b = modPlcUtil.Connected();
+ var (result, value) = modPlcUtil.GetPlcDBValue(modDevice.PosType.Value, modDevice.DbNumber, modDevice.PlcPos);
+ var c = modPlcUtil.Connected();
+ if (result.IsSucceed)
+ {
+ if (value != 0)
+ {
+ var dto = modDevice.Adapt<WcsDeviceDto>();
+ dto.Value = value;
+ dto.Type = _modplc.Type;
+ dto.PLCUtil = modPlcUtil;
+ dto.listStation = listPlcStation.Where(s => s.DeviceId == modDevice.Id).ToList();
+ //杩欓噷瑙﹀彂鍊煎彉鏇翠簨浠�
+ DeviceValueChangeEvent?.Invoke(dto, EventArgs.Empty);
+ }
+ }
+ else
+ {
+ //鍒犻櫎褰撳墠杩炴帴 涓嬩竴娆″惊鐜噸鏂拌繛鎺�
+ modPlcUtil.Close();
+ listPlcUtil.Remove(modPlcUtil);
+ }
+ }
+
+ Thread.Sleep(100);
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
+ }, cts.Token);
+ }
+ }
+ /// <summary>
+ /// 鍋滄鏈嶅姟
+ /// </summary>
+ public static void Stop()
+ {
+ cts.Cancel();
+ }
+}
\ No newline at end of file
diff --git a/Admin.NET/WCS.Application/PLC/PLCUtil.cs b/Admin.NET/WCS.Application/PLC/PLCUtil.cs
new file mode 100644
index 0000000..69442c6
--- /dev/null
+++ b/Admin.NET/WCS.Application/PLC/PLCUtil.cs
@@ -0,0 +1,246 @@
+锘縰sing DocumentFormat.OpenXml.Bibliography;
+using Elastic.Clients.Elasticsearch;
+using IoTClient;
+using IoTClient.Clients.Modbus;
+using IoTClient.Clients.PLC;
+using IoTClient.Common.Enums;
+using IoTClient.Enums;
+using IoTClient.Interfaces;
+
+namespace WCS.Application;
+public class PLCUtil
+{
+ public readonly long PlcId;
+ private SiemensClient _client;
+ private WcsPlc _modPlc;
+
+ public PLCUtil(WcsPlc modPlc)
+ {
+ PlcId = modPlc.Id;
+ _modPlc = modPlc;
+ _client = new SiemensClient((SiemensVersion)modPlc.PLCType, modPlc.IP, modPlc.Port);
+ _client.Open();
+ }
+ public bool Connected()
+ {
+ return _client.Connected;
+ }
+ public IoTClient.Result Open()
+ {
+ return _client.Open();
+ }
+ public IoTClient.Result Close()
+ {
+ return _client.Close();
+ }
+ /// <summary>
+ /// 璇诲彇PLC鍊�
+ /// </summary>
+ /// <param name="DbNumber">DB鍖烘寚瀹氬��</param>
+ /// <param name="PosType">瀛楃绫诲瀷</param>
+ /// <param name="Pos">鍋忕Щ閲�/鍦板潃</param>
+ /// <returns></returns>
+ public (IoTClient.Result, dynamic value) GetPlcDBValue(PLCDataTypeEnum PosType, string DbNumber, string Pos)
+ {
+ string address;
+ if (DbNumber.StartsWith("DB"))
+ address = DbNumber + "." + Pos;
+ else
+ address = DbNumber + Pos;
+ dynamic result = null;
+ switch (PosType)
+ {
+ case PLCDataTypeEnum.Bit:
+ result = _client.ReadBoolean(address);
+ break;
+ case PLCDataTypeEnum.Byte:
+ result = _client.ReadByte(address);
+ break;
+ case PLCDataTypeEnum.Short:
+ result = _client.ReadInt16(address);
+ break;
+ case PLCDataTypeEnum.UShort:
+ result = _client.ReadUInt16(address);
+ break;
+ case PLCDataTypeEnum.Int:
+ result = _client.ReadInt32(address);
+ break;
+ case PLCDataTypeEnum.UInt:
+ result = _client.ReadUInt32(address);
+ break;
+ case PLCDataTypeEnum.Long:
+ result = _client.ReadInt64(address);
+ break;
+ case PLCDataTypeEnum.ULong:
+ result = _client.ReadUInt64(address);
+ break;
+ case PLCDataTypeEnum.Float:
+ result = _client.ReadFloat(address);
+ break;
+ case PLCDataTypeEnum.Double:
+ result = _client.ReadDouble(address);
+ break;
+ default:
+ result = new IoTClient.Result<object>();
+ break;
+ }
+ return (result, result.Value);
+ }
+ /// <summary>
+ /// 鎵归噺璇诲彇PLC鍊�
+ /// </summary>
+ /// <returns></returns>
+ public Result<Dictionary<string, object>> GetPlcBatchDBValue(Dictionary<string, PLCDataTypeEnum> listaddress)
+ {
+ Dictionary<string, DataTypeEnum> addresses = new Dictionary<string, DataTypeEnum>();
+ foreach (var address in listaddress)
+ {
+ switch (address.Value)
+ {
+ case PLCDataTypeEnum.Bit:
+ addresses.Add(address.Key, DataTypeEnum.Bool);
+ break;
+ case PLCDataTypeEnum.Byte:
+ addresses.Add(address.Key, DataTypeEnum.Byte);
+ break;
+ case PLCDataTypeEnum.Short:
+ addresses.Add(address.Key, DataTypeEnum.Int16);
+ break;
+ case PLCDataTypeEnum.UShort:
+ addresses.Add(address.Key, DataTypeEnum.UInt16);
+ break;
+ case PLCDataTypeEnum.Int:
+ addresses.Add(address.Key, DataTypeEnum.Int32);
+ break;
+ case PLCDataTypeEnum.UInt:
+ addresses.Add(address.Key, DataTypeEnum.UInt32);
+ break;
+ case PLCDataTypeEnum.Long:
+ addresses.Add(address.Key, DataTypeEnum.Int64);
+ break;
+ case PLCDataTypeEnum.ULong:
+ addresses.Add(address.Key, DataTypeEnum.UInt64);
+ break;
+ case PLCDataTypeEnum.Float:
+ addresses.Add(address.Key, DataTypeEnum.Float);
+ break;
+ case PLCDataTypeEnum.Double:
+ addresses.Add(address.Key, DataTypeEnum.Double);
+ break;
+ case PLCDataTypeEnum.String:
+ addresses.Add(address.Key, DataTypeEnum.String);
+ break;
+ default:
+ break;
+ }
+ }
+ return _client.BatchRead(addresses);
+ }
+ /// <summary>
+ /// 鍐欏叆PLC鍊�
+ /// </summary>
+ public IoTClient.Result SetPlcDBValue(PLCDataTypeEnum PosType, string DbNumber, string Pos, string Value)
+ {
+ string address;
+ if (DbNumber.StartsWith("DB"))
+ address = DbNumber + "." + Pos;
+ else
+ address = DbNumber + Pos;
+ switch (PosType)
+ {
+ case PLCDataTypeEnum.Bit:
+ if (!bool.TryParse(Value, out bool bit))
+ {
+ if (Value == "0")
+ bit = false;
+ else if (Value == "1")
+ bit = true;
+ else
+ {
+ throw new Exception("鍐欏叆鍊奸敊璇�");
+ }
+ }
+ return _client.Write(address, bit);
+ case PLCDataTypeEnum.Byte:
+ return _client.Write(address, byte.Parse(Value));
+ case PLCDataTypeEnum.Short:
+ return _client.Write(address, short.Parse(Value));
+ case PLCDataTypeEnum.UShort:
+ return _client.Write(address, ushort.Parse(Value));
+ case PLCDataTypeEnum.Int:
+ return _client.Write(address, int.Parse(Value));
+ case PLCDataTypeEnum.UInt:
+ return _client.Write(address, uint.Parse(Value));
+ case PLCDataTypeEnum.Long:
+ return _client.Write(address, long.Parse(Value));
+ case PLCDataTypeEnum.ULong:
+ return _client.Write(address, ulong.Parse(Value));
+ case PLCDataTypeEnum.Float:
+ return _client.Write(address, float.Parse(Value));
+ case PLCDataTypeEnum.Double:
+ return _client.Write(address, float.Parse(Value));
+ default:
+ return new IoTClient.Result();
+ }
+ }
+ /// <summary>
+ /// 鍐欏叆PLC鍊�
+ /// </summary>
+ public IoTClient.Result SetPlcBatchDBValue(Dictionary<string, KeyValuePair<string, PLCDataTypeEnum>> listaddress)
+ {
+ Dictionary<string, object> addresses = new Dictionary<string, object>();
+ foreach (var address in listaddress)
+ {
+ switch (address.Value.Value)
+ {
+ case PLCDataTypeEnum.Bit:
+ if (!bool.TryParse(address.Value.Key, out bool bit))
+ {
+ if (address.Value.Key == "0")
+ bit = false;
+ else if (address.Value.Key == "1")
+ bit = true;
+ else
+ {
+ throw new Exception("鍐欏叆鍊奸敊璇�");
+ }
+ }
+ addresses.Add(address.Key, bit);
+ break;
+ case PLCDataTypeEnum.Byte:
+ addresses.Add(address.Key, byte.Parse(address.Value.Key));
+ break;
+ case PLCDataTypeEnum.Short:
+ addresses.Add(address.Key, short.Parse(address.Value.Key));
+ break;
+ case PLCDataTypeEnum.UShort:
+ addresses.Add(address.Key, ushort.Parse(address.Value.Key));
+ break;
+ case PLCDataTypeEnum.Int:
+ addresses.Add(address.Key, int.Parse(address.Value.Key));
+ break;
+ case PLCDataTypeEnum.UInt:
+ addresses.Add(address.Key, uint.Parse(address.Value.Key));
+ break;
+ case PLCDataTypeEnum.Long:
+ addresses.Add(address.Key, long.Parse(address.Value.Key));
+ break;
+ case PLCDataTypeEnum.ULong:
+ addresses.Add(address.Key, ulong.Parse(address.Value.Key));
+ break;
+ case PLCDataTypeEnum.Float:
+ addresses.Add(address.Key, float.Parse(address.Value.Key));
+ break;
+ case PLCDataTypeEnum.Double:
+ addresses.Add(address.Key, double.Parse(address.Value.Key));
+ break;
+ case PLCDataTypeEnum.String:
+ addresses.Add(address.Key, address.Value.Key);
+ break;
+ default:
+ break;
+ }
+ }
+ return _client.BatchWrite(addresses);
+ }
+}
diff --git a/Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceDto.cs b/Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceDto.cs
index 52b07b4..69db2d1 100644
--- a/Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceDto.cs
+++ b/Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceDto.cs
@@ -1,109 +1,119 @@
锘�
namespace WCS.Application;
+/// <summary>
+/// 璁惧淇℃伅杈撳嚭鍙傛暟
+/// </summary>
+public class WcsDeviceDto
+{
/// <summary>
- /// 璁惧淇℃伅杈撳嚭鍙傛暟
+ /// PlcId
/// </summary>
- public class WcsDeviceDto
- {
- /// <summary>
- /// PlcId
- /// </summary>
- public string PlcIdIP { get; set; }
-
- /// <summary>
- /// 涓婚敭Id
- /// </summary>
- public long Id { get; set; }
-
- /// <summary>
- /// PlcId
- /// </summary>
- public long PlcId { get; set; }
-
- /// <summary>
- /// 璁惧绾у埆
- /// </summary>
- public DeviceLevelEnum Level { get; set; }
-
- /// <summary>
- /// DB鍖哄煙
- /// </summary>
- public string? DbNumber { get; set; }
-
- /// <summary>
- /// 宸ヤ綅鍙�
- /// </summary>
- public string? StationNum { get; set; }
-
- /// <summary>
- /// PLC鍋忕Щ閲�
- /// </summary>
- public string? PlcPos { get; set; }
-
- /// <summary>
- /// WCS鍋忕Щ閲�
- /// </summary>
- public string? WcsPos { get; set; }
-
- /// <summary>
- /// 娴佺▼瀛楃被鍨�
- /// </summary>
- public PLCDataTypeEnum? PosType { get; set; }
-
- /// <summary>
- /// 鏄剧ず灞廼p鍦板潃
- /// </summary>
- public string? LedIP { get; set; }
-
- /// <summary>
- /// 鎻忚堪
- /// </summary>
- public string? Text { get; set; }
-
- /// <summary>
- /// 鍒涘缓鏃堕棿
- /// </summary>
- public DateTime? CreateTime { get; set; }
-
- /// <summary>
- /// 鏇存柊鏃堕棿
- /// </summary>
- public DateTime? UpdateTime { get; set; }
-
- /// <summary>
- /// 鍒涘缓鑰匢d
- /// </summary>
- public long? CreateUserId { get; set; }
-
- /// <summary>
- /// 鍒涘缓鑰呭鍚�
- /// </summary>
- public string? CreateUserName { get; set; }
-
- /// <summary>
- /// 淇敼鑰匢d
- /// </summary>
- public long? UpdateUserId { get; set; }
-
- /// <summary>
- /// 淇敼鑰呭鍚�
- /// </summary>
- public string? UpdateUserName { get; set; }
-
- /// <summary>
- /// 鍒涘缓鑰呴儴闂↖d
- /// </summary>
- public long? CreateOrgId { get; set; }
-
- /// <summary>
- /// 鍒涘缓鑰呴儴闂ㄥ悕绉�
- /// </summary>
- public string? CreateOrgName { get; set; }
-
- /// <summary>
- /// 杞垹闄�
- /// </summary>
- public bool IsDelete { get; set; }
-
- }
+ public string PlcIdIP { get; set; }
+
+ /// <summary>
+ /// 涓婚敭Id
+ /// </summary>
+ public long Id { get; set; }
+
+ /// <summary>
+ /// PlcId
+ /// </summary>
+ public long PlcId { get; set; }
+
+ /// <summary>
+ /// 璁惧绾у埆
+ /// </summary>
+ public DeviceLevelEnum Level { get; set; }
+
+ /// <summary>
+ /// 璁惧绫诲瀷
+ /// </summary>
+ public PLCTypeEnum Type { get; set; }
+
+ /// <summary>
+ /// DB鍖哄煙
+ /// </summary>
+ public string? DbNumber { get; set; }
+
+ /// <summary>
+ /// 宸ヤ綅鍙�
+ /// </summary>
+ public string? StationNum { get; set; }
+
+ /// <summary>
+ /// PLC鍋忕Щ閲�
+ /// </summary>
+ public string? PlcPos { get; set; }
+
+ /// <summary>
+ /// WCS鍋忕Щ閲�
+ /// </summary>
+ public string? WcsPos { get; set; }
+
+ /// <summary>
+ /// 娴佺▼瀛楃被鍨�
+ /// </summary>
+ public PLCDataTypeEnum? PosType { get; set; }
+
+ /// <summary>
+ /// 鏄剧ず灞廼p鍦板潃
+ /// </summary>
+ public string? LedIP { get; set; }
+
+ /// <summary>
+ /// 鎻忚堪
+ /// </summary>
+ public string? Text { get; set; }
+
+ /// <summary>
+ /// 鍒涘缓鏃堕棿
+ /// </summary>
+ public DateTime? CreateTime { get; set; }
+
+ /// <summary>
+ /// 鏇存柊鏃堕棿
+ /// </summary>
+ public DateTime? UpdateTime { get; set; }
+
+ /// <summary>
+ /// 鍒涘缓鑰匢d
+ /// </summary>
+ public long? CreateUserId { get; set; }
+
+ /// <summary>
+ /// 鍒涘缓鑰呭鍚�
+ /// </summary>
+ public string? CreateUserName { get; set; }
+
+ /// <summary>
+ /// 淇敼鑰匢d
+ /// </summary>
+ public long? UpdateUserId { get; set; }
+
+ /// <summary>
+ /// 淇敼鑰呭鍚�
+ /// </summary>
+ public string? UpdateUserName { get; set; }
+
+ /// <summary>
+ /// 鍒涘缓鑰呴儴闂↖d
+ /// </summary>
+ public long? CreateOrgId { get; set; }
+
+ /// <summary>
+ /// 鍒涘缓鑰呴儴闂ㄥ悕绉�
+ /// </summary>
+ public string? CreateOrgName { get; set; }
+
+ /// <summary>
+ /// 杞垹闄�
+ /// </summary>
+ public bool IsDelete { get; set; }
+
+ public dynamic Value { get; set; }
+
+ public PLCUtil PLCUtil { get; set; }
+
+ public List<WcsStation> listStation { get; set; }
+}
diff --git a/Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcDto.cs b/Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcDto.cs
index d2030b3..92fc8e0 100644
--- a/Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcDto.cs
+++ b/Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcDto.cs
@@ -1,9 +1,4 @@
-锘�// Admin.NET 椤圭洰鐨勭増鏉冦�佸晢鏍囥�佷笓鍒╁拰鍏朵粬鐩稿叧鏉冨埄鍧囧彈鐩稿簲娉曞緥娉曡鐨勪繚鎶ゃ�備娇鐢ㄦ湰椤圭洰搴旈伒瀹堢浉鍏虫硶寰嬫硶瑙勫拰璁稿彲璇佺殑瑕佹眰銆�
-//
-// 鏈」鐩富瑕侀伒寰� MIT 璁稿彲璇佸拰 Apache 璁稿彲璇侊紙鐗堟湰 2.0锛夎繘琛屽垎鍙戝拰浣跨敤銆傝鍙瘉浣嶄簬婧愪唬鐮佹爲鏍圭洰褰曚腑鐨� LICENSE-MIT 鍜� LICENSE-APACHE 鏂囦欢銆�
-//
-// 涓嶅緱鍒╃敤鏈」鐩粠浜嬪嵄瀹冲浗瀹跺畨鍏ㄣ�佹壈涔辩ぞ浼氱З搴忋�佷镜鐘粬浜哄悎娉曟潈鐩婄瓑娉曞緥娉曡绂佹鐨勬椿鍔紒浠讳綍鍩轰簬鏈」鐩簩娆″紑鍙戣�屼骇鐢熺殑涓�鍒囨硶寰嬬籂绾峰拰璐d换锛屾垜浠笉鎵挎媴浠讳綍璐d换锛�
-
+锘�
namespace WCS.Application;
/// <summary>
@@ -22,6 +17,11 @@
public string IP { get; set; }
/// <summary>
+ /// PLC绔彛鍙�
+ /// </summary>
+ public int Port { get; set; }
+
+ /// <summary>
/// 璁惧绫诲瀷
/// </summary>
public PLCEnum PLCType { get; set; }
diff --git a/Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcInput.cs b/Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcInput.cs
index 68983b8..015930c 100644
--- a/Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcInput.cs
+++ b/Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcInput.cs
@@ -12,6 +12,11 @@
public virtual string IP { get; set; }
/// <summary>
+ /// PLC绔彛鍙�
+ /// </summary>
+ public virtual int Port { get; set; }
+
+ /// <summary>
/// PLC绫诲瀷
/// </summary>
public virtual PLCEnum PLCType { get; set; }
diff --git a/Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcOutput.cs b/Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcOutput.cs
index 3668e2a..c2d5bf6 100644
--- a/Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcOutput.cs
+++ b/Admin.NET/WCS.Application/Service/WcsPlc/Dto/WcsPlcOutput.cs
@@ -17,6 +17,11 @@
public string IP { get; set; }
/// <summary>
+ /// PLC绔彛鍙�
+ /// </summary>
+ public int Port { get; set; }
+
+ /// <summary>
/// PLC绫诲瀷
/// </summary>
public PLCEnum PLCType { get; set; }
diff --git a/Admin.NET/WCS.Application/Service/WcsPlc/WcsPlcService.cs b/Admin.NET/WCS.Application/Service/WcsPlc/WcsPlcService.cs
index 20f41a3..0c91047 100644
--- a/Admin.NET/WCS.Application/Service/WcsPlc/WcsPlcService.cs
+++ b/Admin.NET/WCS.Application/Service/WcsPlc/WcsPlcService.cs
@@ -107,6 +107,4 @@
-
-
}
diff --git a/Admin.NET/WCS.Application/Util/PLCUtil.cs b/Admin.NET/WCS.Application/Util/PLCUtil.cs
deleted file mode 100644
index ce92a19..0000000
--- a/Admin.NET/WCS.Application/Util/PLCUtil.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-锘縰sing IoTClient.Clients.PLC;
-using IoTClient.Common.Enums;
-
-namespace WCS.Application;
-public class PLCUtil
-{
- public PLCUtil()
- {
- SiemensClient client = new SiemensClient(SiemensVersion.S7_200Smart, "127.0.0.1", 102);
-
- }
-}
diff --git a/Web/src/views/wcs/wcsPlc/component/editDialog.vue b/Web/src/views/wcs/wcsPlc/component/editDialog.vue
index ed2acbf..7464412 100644
--- a/Web/src/views/wcs/wcsPlc/component/editDialog.vue
+++ b/Web/src/views/wcs/wcsPlc/component/editDialog.vue
@@ -21,6 +21,14 @@
</el-col>
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
+ <el-form-item label="PLC绔彛" prop="port">
+ <el-input v-model="ruleForm.port" placeholder="璇疯緭鍏LC绔彛" maxlength="20" show-word-limit
+ clearable />
+
+ </el-form-item>
+
+ </el-col>
+ <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
<el-form-item label="PLC绫诲瀷" prop="plcType">
<el-select clearable v-model="ruleForm.plcType" placeholder="璇烽�夋嫨PLC绫诲瀷">
<el-option v-for="(item, index) in dl('PLCEnum')" :key="index"
diff --git a/Web/src/views/wcs/wcsPlc/index.vue b/Web/src/views/wcs/wcsPlc/index.vue
index 1ef2c39..d8df504 100644
--- a/Web/src/views/wcs/wcsPlc/index.vue
+++ b/Web/src/views/wcs/wcsPlc/index.vue
@@ -59,6 +59,7 @@
@sort-change="sortChange" border="">
<el-table-column type="index" label="搴忓彿" width="55" align="center" />
<el-table-column prop="ip" label="PLCIP鍦板潃" show-overflow-tooltip="" />
+ <el-table-column prop="port" label="PLC绔彛" show-overflow-tooltip="" />
<el-table-column prop="plcType" label="PLC绫诲瀷" show-overflow-tooltip="">
<template #default="scope">
<el-tag :type="dv('PLCEnum', scope.row.plcType)?.tagType"> {{ dv('PLCEnum',
--
Gitblit v1.8.0