From 36d608033fc92a6e815b3c64b5bb6fd0836df202 Mon Sep 17 00:00:00 2001 From: SoulStar Date: Tue, 6 May 2025 15:51:14 +0800 Subject: [PATCH] =?UTF-8?q?fix=20-=20=E4=BC=98=E5=8C=96RFID=E8=AF=BB?= =?UTF-8?q?=E5=86=99=E7=BB=93=E6=9E=84=EF=BC=8C=E6=B7=BB=E5=8A=A0=E5=BF=83?= =?UTF-8?q?=E8=B7=B3=E6=A3=80=E6=B5=8B=E6=96=AD=E7=BA=BF=E9=87=8D=E8=BF=9E?= =?UTF-8?q?=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HighWayIot.Log4net/config/log4net.config | 2 +- HighWayIot.Plc/HighWayIot.Plc.csproj | 4 - HighWayIot.Plc/PlcConnect.cs | 2 +- HighWayIot.Plc/PlcHelper/RecipeParaHelper.cs | 2 +- HighWayIot.Plc/PlcHelper/TransferSingal.cs | 6 +- HighWayIot.Plc/PlcHelper/WorkStationHelper.cs | 4 - .../HighWayIot.Repository.csproj | 3 + .../domain/MonitorDataSource.cs | 75 +++++++ .../domain/ZxDailyReportEntity.cs | 123 ++++++++++++ .../service/ZxDailyReportService.cs | 104 ++++++++++ .../service/ZxMaterialService.cs | 1 + .../service/ZxMesPlanTransferService.cs | 1 + HighWayIot.Rfid/BaseRFIDDataAnalyse.cs | 2 +- HighWayIot.Rfid/Entity/BFHEntity.cs | 29 +++ HighWayIot.Rfid/HighWayIot.Rfid.csproj | 1 + HighWayIot.Rfid/RfidDataAnalyse.cs | 59 ++++-- .../TouchSocketTcpClient.cs | 55 +++-- HighWayIot.Winform/Business/GeneralUtils.cs | 24 ++- .../Business/RecipeSendBusiness.cs | 26 ++- .../Business/TCPClientFactory.cs | 189 ++++++++++++++++++ .../Business/WorkStationBusiness.cs | 109 +++------- HighWayIot.Winform/HighWayIot.Winform.csproj | 1 + HighWayIot.Winform/MainForm/BaseForm.cs | 2 +- .../LogPages/OperateConfigPage.Designer.cs | 98 +-------- .../LogPages/OperateConfigPage.cs | 9 +- .../LogPages/OperateConfigPage.resx | 9 - .../MaterialConfigPages/MaterialConfigPage.cs | 2 +- .../MonitorMainPages/MonitorMainPage.cs | 5 + .../MonitorMainPages/MonitorMainPage.resx | 3 + .../RecipeConfigPages/RecipeConfigPage.cs | 8 +- .../UserControlPages/TestPage.cs | 6 +- 31 files changed, 700 insertions(+), 264 deletions(-) create mode 100644 HighWayIot.Repository/domain/MonitorDataSource.cs create mode 100644 HighWayIot.Repository/domain/ZxDailyReportEntity.cs create mode 100644 HighWayIot.Repository/service/ZxDailyReportService.cs create mode 100644 HighWayIot.Rfid/Entity/BFHEntity.cs create mode 100644 HighWayIot.Winform/Business/TCPClientFactory.cs diff --git a/HighWayIot.Log4net/config/log4net.config b/HighWayIot.Log4net/config/log4net.config index c1deac9..5e92e01 100644 --- a/HighWayIot.Log4net/config/log4net.config +++ b/HighWayIot.Log4net/config/log4net.config @@ -31,7 +31,7 @@ - + diff --git a/HighWayIot.Plc/HighWayIot.Plc.csproj b/HighWayIot.Plc/HighWayIot.Plc.csproj index 9bb10b6..9a1084d 100644 --- a/HighWayIot.Plc/HighWayIot.Plc.csproj +++ b/HighWayIot.Plc/HighWayIot.Plc.csproj @@ -32,10 +32,6 @@ 4 - - False - ..\HighWayIot.Library\HslCommunication.dll - diff --git a/HighWayIot.Plc/PlcConnect.cs b/HighWayIot.Plc/PlcConnect.cs index 96287e9..99c164b 100644 --- a/HighWayIot.Plc/PlcConnect.cs +++ b/HighWayIot.Plc/PlcConnect.cs @@ -53,7 +53,7 @@ namespace HighWayIot.Plc IsPersistentConnection = true, }; var reslt = plc.ConnectServer(); - logHelper.Info($"Plc连接 信息:[{reslt.Message}] 是否成功:[{(reslt.IsSuccess ? "成功" : "失败")}] 错误代码:[{reslt.ErrorCode}]"); + logHelper.Info($"[{ip}] Plc连接 信息:[{reslt.Message}] 是否成功:[{(reslt.IsSuccess ? "成功" : "失败")}] 错误代码:[{reslt.ErrorCode}]"); if (!reslt.IsSuccess) { logHelper.Info("链接失败:"+reslt.Message); diff --git a/HighWayIot.Plc/PlcHelper/RecipeParaHelper.cs b/HighWayIot.Plc/PlcHelper/RecipeParaHelper.cs index 7e00e48..1d8e8e8 100644 --- a/HighWayIot.Plc/PlcHelper/RecipeParaHelper.cs +++ b/HighWayIot.Plc/PlcHelper/RecipeParaHelper.cs @@ -257,7 +257,7 @@ namespace HighWayIot.Plc.PlcHelper for (int i = 1; i <= 10; i++) { var prop = entity.GetType().GetProperty($"E{i}"); - prop.SetValue(entity, (int)PlcConnect.MelsecInstance1.ByteTransform.TransInt16(data, add * 2)); + prop.SetValue(entity, (int)PlcConnect.MelsecInstance2.ByteTransform.TransInt16(data, add * 2)); add++; } diff --git a/HighWayIot.Plc/PlcHelper/TransferSingal.cs b/HighWayIot.Plc/PlcHelper/TransferSingal.cs index 3aaa6f8..5d8496e 100644 --- a/HighWayIot.Plc/PlcHelper/TransferSingal.cs +++ b/HighWayIot.Plc/PlcHelper/TransferSingal.cs @@ -86,7 +86,7 @@ namespace HighWayIot.Plc.PlcHelper /// 第一个Byte数组是第二个Byte数组是开始横裁信号,第三个是结束横裁信号 public bool[][] ReadDrumReadyAndCountReadySignal() { - OperateResult operateResult = PlcConnect.MelsecInstance1.Read("B980", 3); + OperateResult operateResult = PlcConnect.MelsecInstance2.Read("B980", 3); if (!operateResult.IsSuccess) { @@ -123,7 +123,7 @@ namespace HighWayIot.Plc.PlcHelper /// public bool[][] ReadMonitorSingal() { - OperateResult operateResult = PlcConnect.MelsecInstance1.Read("B9B1", 5); + OperateResult operateResult = PlcConnect.MelsecInstance2.Read("B9B1", 5); if (!operateResult.IsSuccess) { @@ -150,7 +150,7 @@ namespace HighWayIot.Plc.PlcHelper /// public List ReadStationRecipeInfo() { - OperateResult operateResult = PlcConnect.MelsecInstance1.Read("W950", 80); + OperateResult operateResult = PlcConnect.MelsecInstance2.Read("W950", 80); if (!operateResult.IsSuccess) { diff --git a/HighWayIot.Plc/PlcHelper/WorkStationHelper.cs b/HighWayIot.Plc/PlcHelper/WorkStationHelper.cs index c7a6580..690f766 100644 --- a/HighWayIot.Plc/PlcHelper/WorkStationHelper.cs +++ b/HighWayIot.Plc/PlcHelper/WorkStationHelper.cs @@ -54,10 +54,6 @@ namespace HighWayIot.Plc.PlcHelper result[i] = data[dataCount].GetBoolByIndex(indexCount); } } - else - { - return null; - } return result; } diff --git a/HighWayIot.Repository/HighWayIot.Repository.csproj b/HighWayIot.Repository/HighWayIot.Repository.csproj index 528eac3..822bb27 100644 --- a/HighWayIot.Repository/HighWayIot.Repository.csproj +++ b/HighWayIot.Repository/HighWayIot.Repository.csproj @@ -52,12 +52,14 @@ + + @@ -72,6 +74,7 @@ + diff --git a/HighWayIot.Repository/domain/MonitorDataSource.cs b/HighWayIot.Repository/domain/MonitorDataSource.cs new file mode 100644 index 0000000..5b96170 --- /dev/null +++ b/HighWayIot.Repository/domain/MonitorDataSource.cs @@ -0,0 +1,75 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HighWayIot.Repository.domain +{ + public class MonitorDataSource + { + /// + /// 编号 + /// + public int No { get; set; } + /// + /// 备 注:硫化机位 + /// 默认值: + /// + public string VulcanizationNo { get; set; } = string.Empty; + + /// + /// 备 注:开始时间 + /// 默认值: + /// + public string StartTime { get; set; } = string.Empty; + + /// + /// 备 注:成品代号 + /// 默认值: + /// + public string RecipeName { get; set; } = string.Empty; + + /// + /// 备 注:标称尺度 + /// 默认值: + /// + public string SpecName { get; set; } = string.Empty; + + /// + /// 备 注:SPEC编号 + /// 默认值: + /// + public string SpecCode { get; set; } = string.Empty; + + /// + /// 备 注:小车编号 + /// 默认值: + /// + public int? DeviceNo { get; set; } + + /// + /// 备 注:生胎重量 + /// 默认值: + /// + public int? RawTireWeight { get; set; } + + /// + /// 基部胶耗时 + /// + public string BaseRubTimeSpan { get; set; } = string.Empty; + + /// + /// 中层胶耗时 + /// + public string MidRubTimeSpan { get; set; } = string.Empty; + + /// + /// 胎面胶耗时 + /// + public string FaceRubTimeSpan { get; set; } = string.Empty; + + + } +} diff --git a/HighWayIot.Repository/domain/ZxDailyReportEntity.cs b/HighWayIot.Repository/domain/ZxDailyReportEntity.cs new file mode 100644 index 0000000..a4ff6b3 --- /dev/null +++ b/HighWayIot.Repository/domain/ZxDailyReportEntity.cs @@ -0,0 +1,123 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using SqlSugar; +namespace HighWayIot.Repository.domain +{ + /// + /// + /// + [SugarTable("zx_daily_report")] + public class ZxDailyReportEntity + { + + + /// + /// 备 注: + /// 默认值: + /// + [SugarColumn(ColumnName = "uuid", IsPrimaryKey = true)] + public string Uuid { get; set; } + + /// + /// 备 注:硫化机位 + /// 默认值: + /// + [SugarColumn(ColumnName = "vulcanization_no")] + public string VulcanizationNo { get; set; } = string.Empty; + + /// + /// 备 注:开始时间 + /// 默认值: + /// + [SugarColumn(ColumnName = "start_time")] + public DateTime? StartTime { get; set; } + + /// + /// 备 注:成品代号 + /// 默认值: + /// + [SugarColumn(ColumnName = "recipe_name")] + public string RecipeName { get; set; } = string.Empty; + + /// + /// 备 注:标称尺度 + /// 默认值: + /// + [SugarColumn(ColumnName = "spec_name")] + public string SpecName { get; set; } = string.Empty; + + /// + /// 备 注:SPEC编号 + /// 默认值: + /// + [SugarColumn(ColumnName = "spec_code")] + public string SpecCode { get; set; } = string.Empty; + + /// + /// 备 注:小车编号 + /// 默认值: + /// + [SugarColumn(ColumnName = "device_no")] + public int? DeviceNo { get; set; } + + /// + /// 备 注:生胎重量 + /// 默认值: + /// + [SugarColumn(ColumnName = "raw_tire_weight")] + public int? RawTireWeight { get; set; } + + /// + /// 备 注:基部胶开始 + /// 默认值: + /// + [SugarColumn(ColumnName = "base_start_time")] + public DateTime? BaseStartTime { get; set; } + + /// + /// 备 注:基部胶结束 + /// 默认值: + /// + [SugarColumn(ColumnName = "base_end_time")] + public DateTime? BaseEndTime { get; set; } + + /// + /// 备 注:中层胶开始 + /// 默认值: + /// + [SugarColumn(ColumnName = "mid_start_time")] + public DateTime? MidStartTime { get; set; } + + /// + /// 备 注:中层胶结束 + /// 默认值: + /// + [SugarColumn(ColumnName = "mid_end_time")] + public DateTime? MidEndTime { get; set; } + + /// + /// 备 注:胎面胶开始 + /// 默认值: + /// + [SugarColumn(ColumnName = "face_start_time")] + public DateTime? FaceStartTime { get; set; } + + /// + /// 备 注:胎面胶结束(生胎完成) + /// 默认值: + /// + [SugarColumn(ColumnName = "face_end_time")] + public DateTime? FaceEndTime { get; set; } + + /// + /// 备 注:是否已完成(0未完成 1完成 2中止) + /// 默认值: + /// + [SugarColumn(ColumnName = "is_done")] + public int? IsDone { get; set; } + + + } + +} \ No newline at end of file diff --git a/HighWayIot.Repository/service/ZxDailyReportService.cs b/HighWayIot.Repository/service/ZxDailyReportService.cs new file mode 100644 index 0000000..f61d88f --- /dev/null +++ b/HighWayIot.Repository/service/ZxDailyReportService.cs @@ -0,0 +1,104 @@ +using HighWayIot.Log4net; +using HighWayIot.Repository.domain; +using Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Text; +using System.Threading.Tasks; + +namespace HighWayIot.Repository.service +{ + /// + /// 报表服务类 + /// + public class ZxDailyReportService + { + private static readonly Lazy lazy = new Lazy(() => new ZxDailyReportService()); + + public static ZxDailyReportService Instance + { + get + { + return lazy.Value; + } + } + + private LogHelper log = LogHelper.Instance; + Repository _repository => new Repository("sqlserver"); + + /// + /// 查询报表信息 + /// + /// + public List Get50DailyReportInfos() + { + try + { + List entity = _repository.GetList().Take(50).ToList(); + return entity; + } + catch (Exception ex) + { + log.Error("配方信息获取异常", ex); + return null; + } + } + + /// + /// 根据条件查询报表信息 + /// + /// + /// + public List GetDailyReportInfos(Expression> whereExpression) + { + try + { + List entity = _repository.GetList(whereExpression); + return entity; + } + catch(Exception ex) + { + log.Error("配发信息获取异常", ex); + return null; + } + } + + /// + /// 新增报表信息 + /// + /// + /// + public bool InsertDailyReportInfo(ZxDailyReportEntity entity) + { + try + { + return _repository.Insert(entity); + } + catch (Exception ex) + { + log.Error("报表信息添加异常", ex); + return false; + } + } + + /// + /// 删除报表信息 + /// + /// + /// + public bool UpdateDailyReportInfo(ZxDailyReportEntity entity) + { + try + { + return _repository.Update(entity); + } + catch (Exception ex) + { + log.Error("报表信息修改异常", ex); + return false; + } + } + } +} diff --git a/HighWayIot.Repository/service/ZxMaterialService.cs b/HighWayIot.Repository/service/ZxMaterialService.cs index 9fa348d..beba836 100644 --- a/HighWayIot.Repository/service/ZxMaterialService.cs +++ b/HighWayIot.Repository/service/ZxMaterialService.cs @@ -84,6 +84,7 @@ namespace HighWayIot.Repository.service } catch (Exception ex) { + log.Error("物料信息获取异常", ex); return null; } } diff --git a/HighWayIot.Repository/service/ZxMesPlanTransferService.cs b/HighWayIot.Repository/service/ZxMesPlanTransferService.cs index 39199c1..f2477ef 100644 --- a/HighWayIot.Repository/service/ZxMesPlanTransferService.cs +++ b/HighWayIot.Repository/service/ZxMesPlanTransferService.cs @@ -95,6 +95,7 @@ namespace HighWayIot.Repository.service } catch (Exception ex) { + log.Error("配方同步基准信息标识获取异常", ex); return true; } } diff --git a/HighWayIot.Rfid/BaseRFIDDataAnalyse.cs b/HighWayIot.Rfid/BaseRFIDDataAnalyse.cs index c2a5422..d04e47b 100644 --- a/HighWayIot.Rfid/BaseRFIDDataAnalyse.cs +++ b/HighWayIot.Rfid/BaseRFIDDataAnalyse.cs @@ -54,7 +54,7 @@ namespace HighWayIot.Rfid } if(xor != data[data.Length - 2]) { - _logHelper.Error("数据校验和未通过"); + //_logHelper.Error("数据校验和未通过"); return null; } diff --git a/HighWayIot.Rfid/Entity/BFHEntity.cs b/HighWayIot.Rfid/Entity/BFHEntity.cs new file mode 100644 index 0000000..d2ff58b --- /dev/null +++ b/HighWayIot.Rfid/Entity/BFHEntity.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HighWayIot.Rfid.Entity +{ + /// + /// 心跳设置包 + /// + public class BFHSendEntity + { + /// + /// 返回模式(00严格按时间 01空闲返回) + /// + public byte Mode { get; set; } + + /// + /// 返回时间(单位秒) + /// + public byte Time { get; set; } + + /// + /// 保留(一直等于01就行) + /// + public byte Rev { get; set; } + } +} diff --git a/HighWayIot.Rfid/HighWayIot.Rfid.csproj b/HighWayIot.Rfid/HighWayIot.Rfid.csproj index 558330b..bced274 100644 --- a/HighWayIot.Rfid/HighWayIot.Rfid.csproj +++ b/HighWayIot.Rfid/HighWayIot.Rfid.csproj @@ -48,6 +48,7 @@ + diff --git a/HighWayIot.Rfid/RfidDataAnalyse.cs b/HighWayIot.Rfid/RfidDataAnalyse.cs index 17b61a0..9961d5a 100644 --- a/HighWayIot.Rfid/RfidDataAnalyse.cs +++ b/HighWayIot.Rfid/RfidDataAnalyse.cs @@ -32,24 +32,18 @@ namespace HighWayIot.Rfid /// /// 接受02H盘点数据 (默认EPC 4位) /// - /// + /// 数据体 /// - public Receive02HEntity Receive02H(byte[] bytes) + public Receive02HEntity Receive02H(byte[] data) { - BaseReciveDataEntity recive = BaseRFIDDataAnalyse.BaseReceiveAnalyse(bytes); - if (recive == null) - { - return null; - } - byte[] DataBytes = recive.Data; - Receive02HEntity entity = new Receive02HEntity(); int index = 0; - if (DataBytes.Length != 0) + + if (data.Length != 0) { //取读到多少个标签 - entity.TagCount = DataBytes[index]; + entity.TagCount = data[index]; entity.Data = new List(); index++; } @@ -64,27 +58,27 @@ namespace HighWayIot.Rfid Single02HReceive EPCData = new Single02HReceive(); //取单个标签读取的次数 - EPCData.Count = DataBytes[index]; + EPCData.Count = data[index]; index++; //取信号强度 - EPCData.RSSI = DataBytes[index]; + EPCData.RSSI = data[index]; index++; //取天线端口 - EPCData.Ant = DataBytes[index]; + EPCData.Ant = data[index]; index++; //取EPC区域 EPCData.PC = new byte[2]; - Array.Copy(DataBytes, index, EPCData.PC, 0, 2); + Array.Copy(data, index, EPCData.PC, 0, 2); index += 2; //取读到标签的EPC EPCData.EPC = new byte[12]; try { - Array.Copy(DataBytes, index, EPCData.EPC, 0, 12); + Array.Copy(data, index, EPCData.EPC, 0, 12); } catch { @@ -97,5 +91,38 @@ namespace HighWayIot.Rfid return entity; } + + /// + /// 发送心跳配置包 + /// + /// + public byte[] SendBFH(ushort second) + { + byte[] data = new byte[3]; + data[0] = 0x00; + data[1] = 0x05; + data[2] = 0x01; + + BaseSendDataEntity entity = new BaseSendDataEntity() + { + Code = 0xBF, + Data = data + }; + + byte[] result = BaseRFIDDataAnalyse.BaseSendDataAnalyse(entity); + + + return result; + } + + /// + /// 接收心跳包 + /// + /// + public uint ReceiveBFH(byte[] data) + { + uint result = BitConverter.ToUInt32(data, 0); + return result; + } } } diff --git a/HighWayIot.TouchSocket/TouchSocketTcpClient.cs b/HighWayIot.TouchSocket/TouchSocketTcpClient.cs index 57f842b..dc73eb7 100644 --- a/HighWayIot.TouchSocket/TouchSocketTcpClient.cs +++ b/HighWayIot.TouchSocket/TouchSocketTcpClient.cs @@ -33,7 +33,7 @@ namespace HighWayIot.TouchSocket public Action GetMessageAction; - public async Task CreateTcpClient(string ip, string port) + public bool CreateTcpClient(string ip, string port) { TcpClient tcpClient = new TcpClient(); @@ -53,15 +53,13 @@ namespace HighWayIot.TouchSocket { return EasyTask.CompletedTask; };//有客户端断开连接 - tcpClient.Received = async (client, e) => + tcpClient.Received = (client, e) => { - await Task.Run(() => - { - GetMessageAction.Invoke(e.ByteBlock.Span.ToArray(), client.IP); - }); + GetMessageAction.Invoke(e.ByteBlock.Span.ToArray(), client.IP); + return EasyTask.CompletedTask; }; //接收信号 - await tcpClient.SetupAsync(new TouchSocketConfig() + tcpClient.SetupAsync(new TouchSocketConfig() .SetRemoteIPHost($"{ip}:{port}") .ConfigureContainer(a => { @@ -74,20 +72,23 @@ namespace HighWayIot.TouchSocket }) ); - Result result = Result.Default; //不断尝试重连 do { - await Task.Run(async () => - { - _logHelper.Info($"连接{ip}:{port}"); - result = await tcpClient.TryConnectAsync(); - await Task.Delay(2000); - }); + _logHelper.Info($"连接{ip}:{port}"); + result = tcpClient.TryConnect(); } while (!result.IsSuccess); - _logHelper.Info($"{ip}:{port}连接成功 {++ClientsCount}/17"); - Clients.Add(ip, tcpClient); + _logHelper.Info($"{ip}:{port}连接成功 {++ClientsCount}"); + if (Clients.ContainsKey(ip)) + { + Clients.Remove(ip); + Clients.Add(ip, tcpClient); + } + else + { + Clients.Add(ip, tcpClient); + } return true; } @@ -101,7 +102,14 @@ namespace HighWayIot.TouchSocket { try { - await Clients[ip].SendAsync(message); + if (Clients.ContainsKey(ip)) + { + await Clients[ip].SendAsync(message); + } + else + { + return false; + } return true; } catch (Exception e) @@ -120,9 +128,16 @@ namespace HighWayIot.TouchSocket { try { - await Clients[ip].CloseAsync(); - Clients[ip].Dispose(); - Clients.Remove(ip); + if (Clients.ContainsKey(ip)) + { + await Clients[ip].CloseAsync(); + Clients[ip].Dispose(); + Clients.Remove(ip); + } + else + { + return false; + } return true; } catch (Exception e) diff --git a/HighWayIot.Winform/Business/GeneralUtils.cs b/HighWayIot.Winform/Business/GeneralUtils.cs index 947af99..9bbb840 100644 --- a/HighWayIot.Winform/Business/GeneralUtils.cs +++ b/HighWayIot.Winform/Business/GeneralUtils.cs @@ -5,6 +5,7 @@ using System.ComponentModel; using System.Linq; using System.Net; using System.Reflection; +using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; @@ -117,6 +118,27 @@ namespace HighWayIot.Winform.Business return descriptionAttribute.Description; } - + /// + /// 将DateTime间隔转换为字符串格式 + /// + /// + /// + public string DateTimeToString(DateTime dateTimeStart, DateTime dateTimeEnd) + { + TimeSpan span = dateTimeEnd - dateTimeStart; + string result; + if (span > TimeSpan.FromSeconds(60)) + { + int spanMinutes = (int)span.TotalMinutes; + int spanSeconds = (int)span.TotalSeconds % 60; + result = $"{spanMinutes} 分 {spanSeconds} 秒"; + } + else + { + result = span.ToString("ss 秒"); + } + return result; + } + } } diff --git a/HighWayIot.Winform/Business/RecipeSendBusiness.cs b/HighWayIot.Winform/Business/RecipeSendBusiness.cs index 6cf0823..811622e 100644 --- a/HighWayIot.Winform/Business/RecipeSendBusiness.cs +++ b/HighWayIot.Winform/Business/RecipeSendBusiness.cs @@ -54,12 +54,14 @@ namespace HighWayIot.Winform.Business if (item.Value) { var schedulingInfo = zxSchedulingService.GetSchedulingInfo(); - + string recipeNo; + ZxRecipeParaEntity recipeParaInfo; + List zxRecipePositionParaEntities; if ((item.Key + 1) < 63) { - string recipeNo = schedulingInfo.Single(x => x.Id == item.Key + 1).RecipeNo1; - ZxRecipeParaEntity recipeParaInfo = zxRecipeParaService.GetRecipeParaInfoByRecipeCode(recipeNo).FirstOrDefault(); - List zxRecipePositionParaEntities = zxRecipePositionParaService.GetRecipePositionParaInfos(x => x.RecipeCode == recipeNo); + recipeNo = schedulingInfo.Single(x => x.Id == item.Key + 1).RecipeNo1; + recipeParaInfo = zxRecipeParaService.GetRecipeParaInfoByRecipeCode(recipeNo).FirstOrDefault(); + zxRecipePositionParaEntities = zxRecipePositionParaService.GetRecipePositionParaInfos(x => x.RecipeCode == recipeNo); if (recipeParaInfo == null) { LogHelper.Instance.Error("配方信息获取失败"); @@ -68,13 +70,14 @@ namespace HighWayIot.Winform.Business if (recipeParaHelper.UploadToPLC(recipeParaInfo, zxRecipePositionParaEntities)) { PlcConnect.PlcWrite2($"B{(item.Key + 0x901).ToString("X")}", false, DataTypeEnum.Bool); + MonitorInsert(recipeNo); } } else { - string recipeNo = schedulingInfo.Single(x => x.Id == item.Key + 1).RecipeNo2; - ZxRecipeParaEntity recipeParaInfo = zxRecipeParaService.GetRecipeParaInfoByRecipeCode(recipeNo).FirstOrDefault(); - List zxRecipePositionParaEntities = zxRecipePositionParaService.GetRecipePositionParaInfos(x => x.RecipeCode == recipeNo); + recipeNo = schedulingInfo.Single(x => x.Id == item.Key + 1).RecipeNo2; + recipeParaInfo = zxRecipeParaService.GetRecipeParaInfoByRecipeCode(recipeNo).FirstOrDefault(); + zxRecipePositionParaEntities = zxRecipePositionParaService.GetRecipePositionParaInfos(x => x.RecipeCode == recipeNo); if (recipeParaInfo == null) { LogHelper.Instance.Error("配方信息获取失败"); @@ -83,11 +86,20 @@ namespace HighWayIot.Winform.Business if (recipeParaHelper.UploadToPLC(recipeParaInfo, zxRecipePositionParaEntities)) { PlcConnect.PlcWrite2($"B{(item.Key + 0x941).ToString("X")}", false, DataTypeEnum.Bool); + MonitorInsert(recipeNo); } } return; } } } + + /// + /// 监控画面信息插入 + /// + public void MonitorInsert(string recipeCode) + { + + } } } diff --git a/HighWayIot.Winform/Business/TCPClientFactory.cs b/HighWayIot.Winform/Business/TCPClientFactory.cs new file mode 100644 index 0000000..5365cb1 --- /dev/null +++ b/HighWayIot.Winform/Business/TCPClientFactory.cs @@ -0,0 +1,189 @@ +using HighWayIot.Log4net; +using HighWayIot.Plc.PlcHelper; +using HighWayIot.Repository.domain; +using HighWayIot.Repository.service; +using HighWayIot.Rfid; +using HighWayIot.Rfid.Entity; +using HighWayIot.TouchSocket; +using HighWayIot.Winform.Properties; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace HighWayIot.Winform.Business +{ + /// + /// TCP数据工厂类 + /// + public class TCPClientFactory + { + /// + /// 标签服务类 + /// + private ZxTagSettingService _tagrService = ZxTagSettingService.Instance; + + /// + /// 标签实体类 + /// + private List _tagSetting; + + /// + /// 读写器服务类 + /// + private ZxReaderSettingService _readerService = ZxReaderSettingService.Instance; + + /// + /// 读写器实体类 + /// + private List _readerSetting; + + /// + /// RFID数据分析 + /// + private RfidDataAnalyse _RfidDataAnalyse = new RfidDataAnalyse(); + + /// + /// PLC + /// + private WorkStationHelper _workStationHelper = new WorkStationHelper(); + + /// + /// TCP客户端 + /// + private TouchSocketTcpClient _touchSocketTcpClient = TouchSocketTcpClient.Instance; + + /// + /// 心跳检测 + /// + private Dictionary _heartBeatRecord = new Dictionary(); + + /// + /// Timer + /// + private Timer _heartbeatTimer; + + public TCPClientFactory() + { + _tagSetting = _tagrService.GetTagInfos(); + _readerSetting = _readerService.GetReaderInfos(); + _heartbeatTimer = new Timer(new TimerCallback(HeartbeatJudge), null, 0, 10000); + } + + /// + /// 对接收到的数据进行初步解析分发到各个报文类型的解析类中 + /// + public void ReciveDataRoute(byte[] bytes, string ip) + { + BaseReciveDataEntity reciveData = BaseRFIDDataAnalyse.BaseReceiveAnalyse(bytes); + if(reciveData == null) + { + return; + } + switch (reciveData.Code) + { + case 0x02: //盘点结果 + Receive02HEntity data02Hentity = _RfidDataAnalyse.Receive02H(reciveData.Data); + if (data02Hentity == null || data02Hentity.Data == null) + { + return; + } + ReciveRFIDSingal(data02Hentity, ip); + ReciveHeartBeatSignal(ip); + break; + case 0xBF: //心跳信号 + ReciveHeartBeatSignal(ip); + break; + default: + LogHelper.Instance.Error($"接收到未知报文,识别代码[{reciveData.Code.ToString("X2")}]"); + return; + + } + } + + /// + /// 接收信息的信号 + /// + /// + public void ReciveRFIDSingal(Receive02HEntity entity, string ip) + { + //找到读取次数最大的标签EPC + byte[] epcData = entity.Data.Where(x => x.Count == entity.Data.Max(y => y.Count)).First().EPC; + + //标签号byte数组转换成字符串 + string epcResult = string.Join(" ", epcData.Select(x => x.ToString("X2"))); + + //根据IP和标签EPC获取工位和对应设备号 + string deviceNo = _tagSetting.Where(x => x.RfidEpc == epcResult).FirstOrDefault().DeviceNo; + string workstationNo = _readerSetting.Where(x => x.RfidIp == ip).FirstOrDefault().WorkstationNo; + + if (string.IsNullOrEmpty(deviceNo)) + { + LogHelper.Instance.Error($"未查询到 [{epcResult}] 标签相关的信息!"); + return; + } + if (string.IsNullOrEmpty(workstationNo)) + { + LogHelper.Instance.Error($"未查询到 [{ip}] 读写器相关的信息!"); + return; + } + + try + { + ///写入对应的PLC信号 + _workStationHelper.WriteStationSingal(int.Parse(workstationNo), int.Parse(deviceNo)); + LogHelper.Instance.RfidLog($"{workstationNo}工位, {deviceNo}号车"); + } + catch (Exception ex) + { + LogHelper.Instance.Error("数值转换发生错误", ex); + } + } + + /// + /// 心跳信号接收 + /// + public void ReciveHeartBeatSignal(string ip) + { + //if(entity.Status != 0x00) + //{ + // string workstationNo = _readerService.GetWorkstateNoByIp(ip); + // LogHelper.Instance.Error($"读写器编号[{workstationNo}]心跳返回异常,异常代码[{entity.Status.ToString("X2")}],系统时间[{entity.Systick}]"); + //} + + //初次心跳处理 + if (!_heartBeatRecord.ContainsKey(ip)) + { + LogHelper.Instance.RfidLog($"[{ip}] 初次心跳"); + _heartBeatRecord.Add(ip, DateTime.Now); + return; + } + else //不是初次就更新 + { + _heartBeatRecord[ip] = DateTime.Now; + } + + //心跳异常处理 + } + + public void HeartbeatJudge(object o) + { + foreach (var kvp in _heartBeatRecord.ToArray()) + { + DateTime lastTime = kvp.Value; + TimeSpan timeSpan = DateTime.Now - lastTime; + if (timeSpan > TimeSpan.FromSeconds(16)) + { + LogHelper.Instance.RfidLog($"[{kvp.Key}] 可能掉线,准备重连"); + _heartBeatRecord.Remove(kvp.Key); + _touchSocketTcpClient.DisposeClient(kvp.Key).GetAwaiter().GetResult(); + _touchSocketTcpClient.CreateTcpClient(kvp.Key, "20108"); + _touchSocketTcpClient.Send(kvp.Key, _RfidDataAnalyse.SendBFH(5)).GetAwaiter().GetResult(); + } + } + + } + } +} diff --git a/HighWayIot.Winform/Business/WorkStationBusiness.cs b/HighWayIot.Winform/Business/WorkStationBusiness.cs index 8e8f9f5..93b2a23 100644 --- a/HighWayIot.Winform/Business/WorkStationBusiness.cs +++ b/HighWayIot.Winform/Business/WorkStationBusiness.cs @@ -42,26 +42,21 @@ namespace HighWayIot.Winform.Business /// private List _readerSetting; - /// - /// 标签服务类 - /// - private ZxTagSettingService _tagrService = ZxTagSettingService.Instance; - - /// - /// 标签实体类 - /// - private List _tagSetting; - /// /// RFID数据分析 /// - private RfidDataAnalyse _rfidDataAnalyse = new RfidDataAnalyse(); + private RfidDataAnalyse _RfidDataAnalyse = new RfidDataAnalyse(); /// /// TCP客户端 /// private TouchSocketTcpClient _touchSocketTcpClient = TouchSocketTcpClient.Instance; + /// + /// TCP客户端工厂 + /// + private TCPClientFactory tcpClientFactory = new TCPClientFactory(); + /// /// 刷新器 /// @@ -76,10 +71,27 @@ namespace HighWayIot.Winform.Business { _readerSetting = _readerService.GetReaderInfos(); this.CreateAllRFIDClient(); - _touchSocketTcpClient.GetMessageAction += ReciveRFIDSingal; + _touchSocketTcpClient.GetMessageAction += tcpClientFactory.ReciveDataRoute; timer = new Timer(new System.Threading.TimerCallback(SingalMonitor), null, 0, 1000); } + /// + /// 创建所有RFID客户端 + /// + public void CreateAllRFIDClient() + { + foreach (var setting in _readerSetting) + { + Task.Run(() => + { + _touchSocketTcpClient.CreateTcpClient(setting.RfidIp, "20108"); + _touchSocketTcpClient.Send(setting.RfidIp, _RfidDataAnalyse.SendBFH(5)).GetAwaiter().GetResult(); + }); + } + + IsAllConnected = true; + } + /// /// 自动监视 获取PLC信号 /// @@ -102,23 +114,7 @@ namespace HighWayIot.Winform.Business } } } - - /// - /// 创建所有RFID客户端 - /// - public async void CreateAllRFIDClient() - { - foreach (var setting in _readerSetting) - { - await Task.Run(() => - { - _touchSocketTcpClient.CreateTcpClient(setting.RfidIp, "20108"); - }); - } - - IsAllConnected = true; - } - + /// /// 向指定RFID读写器发送读信号 /// @@ -138,6 +134,7 @@ namespace HighWayIot.Winform.Business if (setting == null) { + LogHelper.Instance.Error($"找不到第[{no}]个读写器"); return; } @@ -145,7 +142,7 @@ namespace HighWayIot.Winform.Business bool result = false; do { - result = await _touchSocketTcpClient.Send(setting.RfidIp, _rfidDataAnalyse.Send02H(1000)); + result = await _touchSocketTcpClient.Send(setting.RfidIp, _RfidDataAnalyse.Send02H(1000)); i++; } while (i < 3 && result == false); @@ -156,57 +153,5 @@ namespace HighWayIot.Winform.Business } } } - - - - /// - /// 接收信息的信号 - /// - /// - public void ReciveRFIDSingal(byte[] bytes, string ip) - { - Receive02HEntity entity = _rfidDataAnalyse.Receive02H(bytes); - if (entity == null || entity.Data == null) - { - return ; - } - //if(entity.TagCount != 1) - //{ - // _logHelper.Error("返回多标签!"); - // return; - //} - - //找到读取次数最大的标签EPC - byte[] data = entity.Data.Where(x => x.Count == entity.Data.Max(y => y.Count)).First().EPC; - - //标签号byte数组转换成字符串 - string result = string.Join(" ", data.Select(x => x.ToString("X2"))); - - //根据IP和标签EPC获取工位和对应设备号 - string deviceNo = _tagrService.GetTagDeviceNoByEPC(result); - string workstationNo = _readerService.GetWorkstateNoByIp(ip); - - if (string.IsNullOrEmpty(deviceNo)) - { - _logHelper.Error($"没有查询到 [{result}] 标签相关的信息!"); - return; - } - if (string.IsNullOrEmpty(workstationNo)) - { - _logHelper.Error($"没有查询到 [{ip}] 读写器相关的信息!"); - return; - } - - try - { - ///写入对应的PLC信号 - _workStationHelper.WriteStationSingal(int.Parse(workstationNo), int.Parse(deviceNo)); - LogHelper.Instance.Info($"{workstationNo}工位, {deviceNo}号车"); - } - catch (Exception ex) - { - _logHelper.Error("数值转换发生错误", ex); - } - } } } diff --git a/HighWayIot.Winform/HighWayIot.Winform.csproj b/HighWayIot.Winform/HighWayIot.Winform.csproj index 6f99d74..1b51e9b 100644 --- a/HighWayIot.Winform/HighWayIot.Winform.csproj +++ b/HighWayIot.Winform/HighWayIot.Winform.csproj @@ -57,6 +57,7 @@ + diff --git a/HighWayIot.Winform/MainForm/BaseForm.cs b/HighWayIot.Winform/MainForm/BaseForm.cs index 34ca398..16f6eed 100644 --- a/HighWayIot.Winform/MainForm/BaseForm.cs +++ b/HighWayIot.Winform/MainForm/BaseForm.cs @@ -166,7 +166,7 @@ namespace HighWayIot.Winform.MainForm UserPanelSwitch(typeof(DailyReportPage), button.Text); break; case "机台物料信息绑定": - UserPanelSwitch(typeof(EquipMaterialBindingPage), button.Text); + UserPanelSwitch(typeof(EquipParamSettingPage), button.Text); break; case "硫化机配方参数配置": UserPanelSwitch(typeof(ProductionScheduling), button.Text); diff --git a/HighWayIot.Winform/UserControlPages/LogPages/OperateConfigPage.Designer.cs b/HighWayIot.Winform/UserControlPages/LogPages/OperateConfigPage.Designer.cs index 93bb95e..900f34a 100644 --- a/HighWayIot.Winform/UserControlPages/LogPages/OperateConfigPage.Designer.cs +++ b/HighWayIot.Winform/UserControlPages/LogPages/OperateConfigPage.Designer.cs @@ -33,12 +33,6 @@ namespace HighWayIot.Winform.UserControlPages { this.SelectRole = new System.Windows.Forms.Button(); this.ButtonPanel = new System.Windows.Forms.Panel(); - this.P3TextBox = new System.Windows.Forms.TextBox(); - this.label7 = new System.Windows.Forms.Label(); - this.P2TextBox = new System.Windows.Forms.TextBox(); - this.label6 = new System.Windows.Forms.Label(); - this.P1TextBox = new System.Windows.Forms.TextBox(); - this.label5 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.SelectLogEndTime = new System.Windows.Forms.DateTimePicker(); this.SelectLogBeginTime = new System.Windows.Forms.DateTimePicker(); @@ -53,9 +47,6 @@ namespace HighWayIot.Winform.UserControlPages this.Text = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.LogTime = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Operator = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.P1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.P2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.P3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.ButtonPanel.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.LogDataGridView)).BeginInit(); this.SuspendLayout(); @@ -75,12 +66,6 @@ namespace HighWayIot.Winform.UserControlPages // this.ButtonPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.ButtonPanel.Controls.Add(this.P3TextBox); - this.ButtonPanel.Controls.Add(this.label7); - this.ButtonPanel.Controls.Add(this.P2TextBox); - this.ButtonPanel.Controls.Add(this.label6); - this.ButtonPanel.Controls.Add(this.P1TextBox); - this.ButtonPanel.Controls.Add(this.label5); this.ButtonPanel.Controls.Add(this.label4); this.ButtonPanel.Controls.Add(this.SelectLogEndTime); this.ButtonPanel.Controls.Add(this.SelectLogBeginTime); @@ -97,54 +82,6 @@ namespace HighWayIot.Winform.UserControlPages this.ButtonPanel.Size = new System.Drawing.Size(1162, 61); this.ButtonPanel.TabIndex = 4; // - // P3TextBox - // - this.P3TextBox.Location = new System.Drawing.Point(943, 32); - this.P3TextBox.Name = "P3TextBox"; - this.P3TextBox.Size = new System.Drawing.Size(53, 21); - this.P3TextBox.TabIndex = 26; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(902, 36); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(35, 12); - this.label7.TabIndex = 25; - this.label7.Text = "字段3"; - // - // P2TextBox - // - this.P2TextBox.Location = new System.Drawing.Point(843, 32); - this.P2TextBox.Name = "P2TextBox"; - this.P2TextBox.Size = new System.Drawing.Size(53, 21); - this.P2TextBox.TabIndex = 24; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(802, 36); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(35, 12); - this.label6.TabIndex = 23; - this.label6.Text = "字段2"; - // - // P1TextBox - // - this.P1TextBox.Location = new System.Drawing.Point(743, 32); - this.P1TextBox.Name = "P1TextBox"; - this.P1TextBox.Size = new System.Drawing.Size(53, 21); - this.P1TextBox.TabIndex = 22; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(702, 36); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(35, 12); - this.label5.TabIndex = 21; - this.label5.Text = "字段1"; - // // label4 // this.label4.AutoSize = true; @@ -236,10 +173,7 @@ namespace HighWayIot.Winform.UserControlPages this.Id, this.Text, this.LogTime, - this.Operator, - this.P1, - this.P2, - this.P3}); + this.Operator}); this.LogDataGridView.Location = new System.Drawing.Point(0, 65); this.LogDataGridView.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.LogDataGridView.Name = "LogDataGridView"; @@ -280,27 +214,6 @@ namespace HighWayIot.Winform.UserControlPages this.Operator.Name = "Operator"; this.Operator.ReadOnly = true; // - // P1 - // - this.P1.DataPropertyName = "P1"; - this.P1.HeaderText = "字段1"; - this.P1.Name = "P1"; - this.P1.ReadOnly = true; - // - // P2 - // - this.P2.DataPropertyName = "P2"; - this.P2.HeaderText = "字段2"; - this.P2.Name = "P2"; - this.P2.ReadOnly = true; - // - // P3 - // - this.P3.DataPropertyName = "P3"; - this.P3.HeaderText = "字段3"; - this.P3.Name = "P3"; - this.P3.ReadOnly = true; - // // OperateConfigPage // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); @@ -330,19 +243,10 @@ namespace HighWayIot.Winform.UserControlPages private DateTimePicker SelectLogBeginTime; private CheckBox IsCheckByLogTime; private Label label3; - private TextBox P3TextBox; - private Label label7; - private TextBox P2TextBox; - private Label label6; - private TextBox P1TextBox; - private Label label5; private DataGridView LogDataGridView; private DataGridViewTextBoxColumn Id; private DataGridViewTextBoxColumn Text; private DataGridViewTextBoxColumn LogTime; private DataGridViewTextBoxColumn Operator; - private DataGridViewTextBoxColumn P1; - private DataGridViewTextBoxColumn P2; - private DataGridViewTextBoxColumn P3; } } diff --git a/HighWayIot.Winform/UserControlPages/LogPages/OperateConfigPage.cs b/HighWayIot.Winform/UserControlPages/LogPages/OperateConfigPage.cs index 03cb5f4..b75af9c 100644 --- a/HighWayIot.Winform/UserControlPages/LogPages/OperateConfigPage.cs +++ b/HighWayIot.Winform/UserControlPages/LogPages/OperateConfigPage.cs @@ -37,11 +37,7 @@ namespace HighWayIot.Winform.UserControlPages private void SelectRole_Click(object sender, EventArgs e) { List list = sysLogService.GetLogInfos(); - - int? p1 = GeneralUtils.StringNullOrToInt(P1TextBox.Text); - int? p2 = GeneralUtils.StringNullOrToInt(P2TextBox.Text); - int? p3 = GeneralUtils.StringNullOrToInt(P3TextBox.Text); - + string logText = LogTextTextBox.Text.Trim(); string operatorName = OperatorNameTextBox.Text.Trim(); bool logTimeChecked = IsCheckByLogTime.Checked; @@ -51,9 +47,6 @@ namespace HighWayIot.Winform.UserControlPages Lists = list.Where(x => (string.IsNullOrEmpty(logText) || x.Text.Contains(logText)) && (string.IsNullOrEmpty(operatorName) || x.Operator == operatorName) && - (!p1.HasValue || x.P1 == p1.Value) && - (!p2.HasValue || x.P2 == p2.Value) && - (!p3.HasValue || x.P3 == p3.Value) && (!logTimeChecked || (x.LogTime >= logBeginTime && x.LogTime <= logEndTime)) ).ToList(); diff --git a/HighWayIot.Winform/UserControlPages/LogPages/OperateConfigPage.resx b/HighWayIot.Winform/UserControlPages/LogPages/OperateConfigPage.resx index e86d420..0aace97 100644 --- a/HighWayIot.Winform/UserControlPages/LogPages/OperateConfigPage.resx +++ b/HighWayIot.Winform/UserControlPages/LogPages/OperateConfigPage.resx @@ -129,13 +129,4 @@ True - - True - - - True - - - True - \ No newline at end of file diff --git a/HighWayIot.Winform/UserControlPages/MaterialConfigPages/MaterialConfigPage.cs b/HighWayIot.Winform/UserControlPages/MaterialConfigPages/MaterialConfigPage.cs index 19499d6..76b7633 100644 --- a/HighWayIot.Winform/UserControlPages/MaterialConfigPages/MaterialConfigPage.cs +++ b/HighWayIot.Winform/UserControlPages/MaterialConfigPages/MaterialConfigPage.cs @@ -101,7 +101,7 @@ namespace HighWayIot.Winform.UserControlPages } catch (Exception ex) { - MessageBox.Show("物料更新ID转换发生错误"); + MessageBox.Show("物料更新ID转换发生错误" + ex.Message); } entity.MaterialCode = MaterialDataGridView.Rows[a].Cells["MaterialCode"].Value.ToString(); entity.MaterialName = MaterialDataGridView.Rows[a].Cells["MaterialName"].Value.ToString(); diff --git a/HighWayIot.Winform/UserControlPages/MonitorMainPages/MonitorMainPage.cs b/HighWayIot.Winform/UserControlPages/MonitorMainPages/MonitorMainPage.cs index 73b589c..05e9a66 100644 --- a/HighWayIot.Winform/UserControlPages/MonitorMainPages/MonitorMainPage.cs +++ b/HighWayIot.Winform/UserControlPages/MonitorMainPages/MonitorMainPage.cs @@ -60,5 +60,10 @@ namespace HighWayIot.Winform.UserControlPages NowDateProductNumLabel.Text = DateTime.Now.ToString("MM 月 dd 日 产量"); } + + private void BindData() + { + + } } } diff --git a/HighWayIot.Winform/UserControlPages/MonitorMainPages/MonitorMainPage.resx b/HighWayIot.Winform/UserControlPages/MonitorMainPages/MonitorMainPage.resx index 7520e01..f0a99eb 100644 --- a/HighWayIot.Winform/UserControlPages/MonitorMainPages/MonitorMainPage.resx +++ b/HighWayIot.Winform/UserControlPages/MonitorMainPages/MonitorMainPage.resx @@ -153,4 +153,7 @@ 17, 17 + + 44 + \ No newline at end of file diff --git a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.cs b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.cs index 770780a..8c309ec 100644 --- a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.cs +++ b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.cs @@ -233,7 +233,7 @@ namespace HighWayIot.Winform.UserControlPages } catch (Exception ex) { - MessageBox.Show("ID转换发生错误"); + MessageBox.Show("ID转换发生错误" + ex.Message); return; } @@ -303,7 +303,7 @@ namespace HighWayIot.Winform.UserControlPages } catch (Exception ex) { - MessageBox.Show("数据格式错误!"); + MessageBox.Show("数据格式错误!" + ex.Message); return; } @@ -377,7 +377,7 @@ namespace HighWayIot.Winform.UserControlPages } catch (Exception ex) { - MessageBox.Show("ID转换发生错误"); + MessageBox.Show("ID转换发生错误" + ex.Message); return; } @@ -439,7 +439,7 @@ namespace HighWayIot.Winform.UserControlPages } catch (Exception ex) { - MessageBox.Show("数据格式错误!"); + MessageBox.Show("数据格式错误!" + ex.Message); return; } diff --git a/HighWayIot.Winform/UserControlPages/TestPage.cs b/HighWayIot.Winform/UserControlPages/TestPage.cs index a831210..9c3731b 100644 --- a/HighWayIot.Winform/UserControlPages/TestPage.cs +++ b/HighWayIot.Winform/UserControlPages/TestPage.cs @@ -32,7 +32,7 @@ namespace HighWayIot.Winform.UserControlPages /// /// RFID数据分析 /// - private RfidDataAnalyse _rfidDataAnalyse = new RfidDataAnalyse(); + private RfidDataAnalyse _RfidDataAnalyse = new RfidDataAnalyse(); XmlUtil xmlUtil = new XmlUtil(); @@ -63,7 +63,7 @@ namespace HighWayIot.Winform.UserControlPages /// private void button1_Click(object sender, EventArgs e) { - OperateResult PlcResult = PlcConnect.MelsecInstance1.Read("B230", 2); + OperateResult PlcResult = PlcConnect.MelsecInstance2.Read("B230", 2); if (PlcResult.IsSuccess) { @@ -96,7 +96,7 @@ namespace HighWayIot.Winform.UserControlPages /// private async void button2_Click(object sender, EventArgs e) { - var a = await _touchSocketTcpClient.Send($"10.20.48.{RFIDtext.Text}", _rfidDataAnalyse.Send02H(1000)); + var a = await _touchSocketTcpClient.Send($"10.20.48.{RFIDtext.Text}", _RfidDataAnalyse.Send02H(1000)); LogHelper.Instance.Info($"10.20.48.{RFIDtext.Text} 发送" + (a ? "成功" : "失败")); }