From 36a7df120dcaf3b918c130aaaad94a4cb2e70345 Mon Sep 17 00:00:00 2001 From: SoulStar Date: Sat, 10 May 2025 09:24:25 +0800 Subject: [PATCH] =?UTF-8?q?feat=20-=20=E9=85=8D=E6=96=B9=E7=B1=BB=E6=9B=B4?= =?UTF-8?q?=E6=94=B9=20=E7=9B=91=E6=8E=A7=E7=94=BB=E9=9D=A2=E5=88=9D?= =?UTF-8?q?=E6=AD=A5=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HighWayIot.Plc/PlcConnect.cs | 662 +++++++++--------- HighWayIot.Plc/PlcHelper/WorkStationHelper.cs | 5 +- .../domain/ZxDailyReportEntity.cs | 2 +- .../domain/ZxMesPlanTransferEntity.cs | 27 + .../domain/ZxSchedulingEntity.cs | 18 +- .../domain/ZxWeightEntity.cs | 16 + .../service/ZxDailyReportService.cs | 2 +- .../service/ZxRecipeService.cs | 21 +- HighWayIot.Rfid/RfidDataAnalyse.cs | 6 +- .../TouchSocketTcpClient.cs | 1 + HighWayIot.Winform/Business/GeneralUtils.cs | 11 +- .../Business/RecipeSendBusiness.cs | 48 +- .../Business/TCPClientFactory.cs | 125 +++- .../Business/WorkStationBusiness.cs | 2 +- HighWayIot.Winform/Business/XmlUtil.cs | 4 + HighWayIot.Winform/Configuration.xml | 3 +- .../MainForm/BaseForm.Designer.cs | 35 +- HighWayIot.Winform/MainForm/BaseForm.cs | 3 - .../MonitorMainPage.Designer.cs | 277 +++++--- .../MonitorMainPages/MonitorMainPage.cs | 46 +- .../MonitorMainPages/MonitorMainPage.resx | 8 +- .../ProductionScheduling.Designer.cs | 106 +-- .../ParamConfigPages/ProductionScheduling.cs | 44 +- .../ProductionScheduling.resx | 8 +- .../AddRecipeForm.Designer.cs | 7 +- .../RecipeConfigPages/AddRecipeForm.cs | 15 +- .../AddWeightForm.Designer.cs | 72 +- .../RecipeConfigPages/AddWeightForm.cs | 35 +- .../RecipeConfigPage.Designer.cs | 402 +++++++---- .../RecipeConfigPages/RecipeConfigPage.cs | 299 ++++++-- .../RecipeConfigPages/RecipeConfigPage.resx | 40 +- .../UserControlPages/TestPage.cs | 84 +-- 32 files changed, 1489 insertions(+), 945 deletions(-) diff --git a/HighWayIot.Plc/PlcConnect.cs b/HighWayIot.Plc/PlcConnect.cs index 99c164b..b50f5f4 100644 --- a/HighWayIot.Plc/PlcConnect.cs +++ b/HighWayIot.Plc/PlcConnect.cs @@ -1,4 +1,5 @@ using System; +using System.Threading.Tasks; using HighWayIot.Log4net; using HslCommunication; using HslCommunication.Profinet.Melsec; @@ -7,28 +8,28 @@ namespace HighWayIot.Plc { public class PlcConnect { - private static readonly Lazy lazy = new Lazy(() => new PlcConnect()); + //private static readonly Lazy lazy = new Lazy(() => new PlcConnect()); - public static PlcConnect Instance - { - get - { - return lazy.Value; - } - } + //public static PlcConnect Instance + //{ + // get + // { + // return lazy.Value; + // } + //} private static LogHelper logHelper = LogHelper.Instance; /// /// 静态懒加载MelsecMcNet1 开炼机CPU /// - public static readonly MelsecMcNet MelsecInstance1 = new PlcConnect().CreateAb("10.20.48.40"); + //public static readonly MelsecMcNet MelsecInstance1 = new PlcConnect().CreateAb("10.20.48.40"); //public static readonly MelsecMcNet MelsecInstance1 = new PlcConnect().CreateAb("127.0.0.1"); /// /// 静态懒加载MelsecMcNet2 成型机CPU /// - public static readonly MelsecMcNet MelsecInstance2 = new PlcConnect().CreateAb("10.20.48.10"); + public static readonly MelsecMcNet MelsecInstance2 = CreateAb("10.20.48.10"); private PlcConnect() { @@ -39,7 +40,7 @@ namespace HighWayIot.Plc /// 初始化三菱的服务器 /// /// - private MelsecMcNet CreateAb(string ip) + private static MelsecMcNet CreateAb(string ip) { //string Ip = ; MelsecMcNet plc = new MelsecMcNet(); @@ -48,16 +49,16 @@ namespace HighWayIot.Plc plc.CommunicationPipe = new HslCommunication.Core.Pipe.PipeTcpNet(ip, 2001) { ConnectTimeOut = 3000, // 连接超时时间,单位毫秒 + ReceiveTimeOut = 2000, // 接收超时时间,单位毫秒 SleepTime = 0, SocketKeepAliveTime = -1, IsPersistentConnection = true, }; - var reslt = plc.ConnectServer(); - logHelper.Info($"[{ip}] Plc连接 信息:[{reslt.Message}] 是否成功:[{(reslt.IsSuccess ? "成功" : "失败")}] 错误代码:[{reslt.ErrorCode}]"); - if (!reslt.IsSuccess) - { - logHelper.Info("链接失败:"+reslt.Message); - } + + OperateResult result; + result = plc.ConnectServer(); + logHelper.Info($"Plc连接 信息:[{result.Message}] 错误代码:[{result.ErrorCode}]"); + } catch (Exception ex) { @@ -67,19 +68,19 @@ namespace HighWayIot.Plc return plc; } - /// - /// plc1 是不是保持链接 - /// - public static bool IsConnect1 - { - get - { - if (MelsecInstance1 == null) return false; - var result = MelsecInstance1.ReadBool("B0").IsSuccess; - logHelper.Info($"PLC[{MelsecInstance1.IpAddress}]连接:[{(result ? "正常" : "异常")}]"); - return result; - } - } + ///// + ///// plc1 是不是保持链接 + ///// + //public static bool IsConnect1 + //{ + // get + // { + // if (MelsecInstance1 == null) return false; + // var result = MelsecInstance1.ReadBool("B0").IsSuccess; + // logHelper.Info($"PLC[{MelsecInstance1.IpAddress}]连接:[{(result ? "正常" : "异常")}]"); + // return result; + // } + //} /// /// plc2 是不是保持链接 @@ -95,68 +96,68 @@ namespace HighWayIot.Plc } } - /// - /// PLC1写入数据 - /// - /// 地址 - /// 值 - /// 数据类型 - /// - public static OperateResult PlcWrite1(string address, object value, DataTypeEnum type) - { - var result = new OperateResult() { IsSuccess = false }; - if(value == null) - { - return result; - } - try - { - switch (type) - { - case DataTypeEnum.Bool: - result = MelsecInstance1.Write(address, Convert.ToBoolean(value)); - break; - //case DataTypeEnum.Byte: - // result = Instance.Write(address, Convert.ToByte(value)); - // break; - case DataTypeEnum.Int16: - result = MelsecInstance1.Write(address, Convert.ToInt16(value)); - break; - case DataTypeEnum.UInt16: - result = MelsecInstance1.Write(address, Convert.ToUInt16(value)); - break; - case DataTypeEnum.Int32: - result = MelsecInstance1.Write(address, Convert.ToInt32(value)); - break; - case DataTypeEnum.UInt32: - result = MelsecInstance1.Write(address, Convert.ToUInt32(value)); - break; - case DataTypeEnum.Int64: - result = MelsecInstance1.Write(address, Convert.ToInt64(value)); - break; - case DataTypeEnum.UInt64: - result = MelsecInstance1.Write(address, Convert.ToUInt64(value)); - break; - case DataTypeEnum.Float: - result = MelsecInstance1.Write(address, Convert.ToSingle(value)); - break; - case DataTypeEnum.Double: - result = MelsecInstance1.Write(address, Convert.ToDouble(value)); - break; - case DataTypeEnum.String: - result = MelsecInstance1.Write(address, Convert.ToString(value)); - break; - default: - throw new ArgumentException($"Unsupported data type: {type}"); - } - logHelper.PlcLog($"Read address:[{address}] value:[{value}] type:[{type.ToString()}] result:[{result.IsSuccess}]"); - } - catch (Exception ex) - { - logHelper.Error("PLC写入数据发生错误!", ex); - } - return result; - } + ///// + ///// PLC1写入数据 + ///// + ///// 地址 + ///// 值 + ///// 数据类型 + ///// + //public static OperateResult PlcWrite1(string address, object value, DataTypeEnum type) + //{ + // var result = new OperateResult() { IsSuccess = false }; + // if (value == null) + // { + // return result; + // } + // try + // { + // switch (type) + // { + // case DataTypeEnum.Bool: + // result = MelsecInstance1.Write(address, Convert.ToBoolean(value)); + // break; + // //case DataTypeEnum.Byte: + // // result = Instance.Write(address, Convert.ToByte(value)); + // // break; + // case DataTypeEnum.Int16: + // result = MelsecInstance1.Write(address, Convert.ToInt16(value)); + // break; + // case DataTypeEnum.UInt16: + // result = MelsecInstance1.Write(address, Convert.ToUInt16(value)); + // break; + // case DataTypeEnum.Int32: + // result = MelsecInstance1.Write(address, Convert.ToInt32(value)); + // break; + // case DataTypeEnum.UInt32: + // result = MelsecInstance1.Write(address, Convert.ToUInt32(value)); + // break; + // case DataTypeEnum.Int64: + // result = MelsecInstance1.Write(address, Convert.ToInt64(value)); + // break; + // case DataTypeEnum.UInt64: + // result = MelsecInstance1.Write(address, Convert.ToUInt64(value)); + // break; + // case DataTypeEnum.Float: + // result = MelsecInstance1.Write(address, Convert.ToSingle(value)); + // break; + // case DataTypeEnum.Double: + // result = MelsecInstance1.Write(address, Convert.ToDouble(value)); + // break; + // case DataTypeEnum.String: + // result = MelsecInstance1.Write(address, Convert.ToString(value)); + // break; + // default: + // throw new ArgumentException($"Unsupported data type: {type}"); + // } + // logHelper.PlcLog($"Read address:[{address}] value:[{value}] type:[{type.ToString()}] result:[{result.IsSuccess}]"); + // } + // catch (Exception ex) + // { + // logHelper.Error("PLC写入数据发生错误!", ex); + // } + // return result; + //} /// @@ -218,33 +219,246 @@ namespace HighWayIot.Plc return result; } + ///// + ///// 字符串读取1 + ///// + ///// + ///// + ///// + //public static string ReadString1(string address, ushort length) + //{ + // OperateResult result = new OperateResult(); + // try + // { + // result = MelsecInstance1.ReadString(address, length); + // } + // catch (Exception ex) + // { + // logHelper.Error($"PLC1读取String发生错误!address:[{address}]", ex); + // return default; + // } + // if (!result.IsSuccess) + // { + // return default; + // } + // return result.Content; + //} + ///// + ///// 读取bool + ///// + ///// + ///// + //public static bool ReadBool1(string address) + //{ + // OperateResult result = new OperateResult(); + // try + // { + // result = MelsecInstance1.ReadBool(address); + // } + // catch (Exception ex) + // { + // logHelper.Error($"PLC读取Bool发生错误!address:[{address}]", ex); + // return default; + // } + // if (!result.IsSuccess) + // { + // return default; + // } + // return result.Content; + //} + ///// + ///// 读取Int16 + ///// + ///// + ///// + //public static short ReadInt161(string address) + //{ + // OperateResult result = new OperateResult(); + // try + // { + // result = MelsecInstance1.ReadInt16(address); + // } + // catch (Exception ex) + // { + // logHelper.Error($"PLC读取Int16发生错误!address:[{address}]", ex); + // return default; + // } + // if (!result.IsSuccess) + // { + // return default; + // } + // return result.Content; + //} - /// - /// 字符串读取1 - /// - /// - /// - /// - public static string ReadString1(string address, ushort length) - { - OperateResult result = new OperateResult(); - try - { - result = MelsecInstance1.ReadString(address, length); - } - catch (Exception ex) - { - logHelper.Error($"PLC1读取String发生错误!address:[{address}]", ex); - return default; - } - if (!result.IsSuccess) - { - return default; - } - return result.Content; - } + ///// + ///// 读取UInt16 + ///// + ///// + ///// + //public static ushort ReadUInt161(string address) + //{ + // OperateResult result = new OperateResult(); + // try + // { + // result = MelsecInstance1.ReadUInt16(address); + // } + // catch (Exception ex) + // { + // logHelper.Error($"PLC读取Int16发生错误!address:[{address}]", ex); + // return default; + // } + // if (!result.IsSuccess) + // { + // return default; + // } + // return result.Content; + //} + + ///// + ///// 读取Int32 + ///// + ///// + ///// + //public static int ReadInt321(string address) + //{ + // OperateResult result = new OperateResult(); + // try + // { + // result = MelsecInstance1.ReadInt32(address); + // } + // catch (Exception ex) + // { + // logHelper.Error($"PLC读取Int16发生错误!address:[{address}]", ex); + // return default; + // } + // if (!result.IsSuccess) + // { + // return default; + // } + // return result.Content; + //} + + ///// + ///// 读取UInt32 + ///// + ///// + ///// + //public static uint ReadUInt321(string address) + //{ + // OperateResult result = new OperateResult(); + // try + // { + // result = MelsecInstance1.ReadUInt32(address); + // } + // catch (Exception ex) + // { + // logHelper.Error($"PLC读取Int16发生错误!address:[{address}]", ex); + // return default; + // } + // if (!result.IsSuccess) + // { + // return default; + // } + // return result.Content; + //} + + ///// + ///// 读取Int64 + ///// + ///// + ///// + //public static long ReadInt641(string address) + //{ + // OperateResult result = new OperateResult(); + // try + // { + // result = MelsecInstance1.ReadInt64(address); + // } + // catch (Exception ex) + // { + // logHelper.Error($"PLC读取Int16发生错误!address:[{address}]", ex); + // return default; + // } + // if (!result.IsSuccess) + // { + // return default; + // } + // return result.Content; + //} + + ///// + ///// 读取UInt64 + ///// + ///// + ///// + //public static ulong ReadUInt641(string address) + //{ + // OperateResult result = new OperateResult(); + // try + // { + // result = MelsecInstance1.ReadUInt64(address); + // } + // catch (Exception ex) + // { + // logHelper.Error($"PLC读取Int16发生错误!address:[{address}]", ex); + // return default; + // } + // if (!result.IsSuccess) + // { + // return default; + // } + // return result.Content; + //} + + ///// + ///// 读取Float + ///// + ///// + ///// + //public static float ReadFloat1(string address) + //{ + // OperateResult result = new OperateResult(); + // try + // { + // result = MelsecInstance1.ReadFloat(address); + // } + // catch (Exception ex) + // { + // logHelper.Error($"PLC读取Float发生错误!address:[{address}]", ex); + // return default; + // } + // if (!result.IsSuccess) + // { + // return default; + // } + // return result.Content; + //} + + ///// + ///// 读取Double + ///// + ///// + ///// + //public static double ReadDouble1(string address) + //{ + // OperateResult result = new OperateResult(); + // try + // { + // result = MelsecInstance1.ReadDouble(address); + // } + // catch (Exception ex) + // { + // logHelper.Error($"PLC读取Double发生错误!address:[{address}]", ex); + // return default; + // } + // if (!result.IsSuccess) + // { + // return default; + // } + // return result.Content; + //} /// /// 字符串读取2 @@ -271,222 +485,6 @@ namespace HighWayIot.Plc return result.Content; } - /// - /// 读取bool - /// - /// - /// - public static bool ReadBool1(string address) - { - OperateResult result = new OperateResult(); - try - { - result = MelsecInstance1.ReadBool(address); - } - catch (Exception ex) - { - logHelper.Error($"PLC读取Bool发生错误!address:[{address}]", ex); - return default; - } - if (!result.IsSuccess) - { - return default; - } - return result.Content; - } - - /// - /// 读取Int16 - /// - /// - /// - public static short ReadInt161(string address) - { - OperateResult result = new OperateResult(); - try - { - result = MelsecInstance1.ReadInt16(address); - } - catch (Exception ex) - { - logHelper.Error($"PLC读取Int16发生错误!address:[{address}]", ex); - return default; - } - if (!result.IsSuccess) - { - return default; - } - return result.Content; - } - - /// - /// 读取UInt16 - /// - /// - /// - public static ushort ReadUInt161(string address) - { - OperateResult result = new OperateResult(); - try - { - result = MelsecInstance1.ReadUInt16(address); - } - catch (Exception ex) - { - logHelper.Error($"PLC读取Int16发生错误!address:[{address}]", ex); - return default; - } - if (!result.IsSuccess) - { - return default; - } - return result.Content; - } - - /// - /// 读取Int32 - /// - /// - /// - public static int ReadInt321(string address) - { - OperateResult result = new OperateResult(); - try - { - result = MelsecInstance1.ReadInt32(address); - } - catch (Exception ex) - { - logHelper.Error($"PLC读取Int16发生错误!address:[{address}]", ex); - return default; - } - if (!result.IsSuccess) - { - return default; - } - return result.Content; - } - - /// - /// 读取UInt32 - /// - /// - /// - public static uint ReadUInt321(string address) - { - OperateResult result = new OperateResult(); - try - { - result = MelsecInstance1.ReadUInt32(address); - } - catch (Exception ex) - { - logHelper.Error($"PLC读取Int16发生错误!address:[{address}]", ex); - return default; - } - if (!result.IsSuccess) - { - return default; - } - return result.Content; - } - - /// - /// 读取Int64 - /// - /// - /// - public static long ReadInt641(string address) - { - OperateResult result = new OperateResult(); - try - { - result = MelsecInstance1.ReadInt64(address); - } - catch (Exception ex) - { - logHelper.Error($"PLC读取Int16发生错误!address:[{address}]", ex); - return default; - } - if (!result.IsSuccess) - { - return default; - } - return result.Content; - } - - /// - /// 读取UInt64 - /// - /// - /// - public static ulong ReadUInt641(string address) - { - OperateResult result = new OperateResult(); - try - { - result = MelsecInstance1.ReadUInt64(address); - } - catch (Exception ex) - { - logHelper.Error($"PLC读取Int16发生错误!address:[{address}]", ex); - return default; - } - if (!result.IsSuccess) - { - return default; - } - return result.Content; - } - - /// - /// 读取Float - /// - /// - /// - public static float ReadFloat1(string address) - { - OperateResult result = new OperateResult(); - try - { - result = MelsecInstance1.ReadFloat(address); - } - catch (Exception ex) - { - logHelper.Error($"PLC读取Float发生错误!address:[{address}]", ex); - return default; - } - if (!result.IsSuccess) - { - return default; - } - return result.Content; - } - - /// - /// 读取Double - /// - /// - /// - public static double ReadDouble1(string address) - { - OperateResult result = new OperateResult(); - try - { - result = MelsecInstance1.ReadDouble(address); - } - catch (Exception ex) - { - logHelper.Error($"PLC读取Double发生错误!address:[{address}]", ex); - return default; - } - if (!result.IsSuccess) - { - return default; - } - return result.Content; - } - /// /// 读取bool /// diff --git a/HighWayIot.Plc/PlcHelper/WorkStationHelper.cs b/HighWayIot.Plc/PlcHelper/WorkStationHelper.cs index 690f766..df58812 100644 --- a/HighWayIot.Plc/PlcHelper/WorkStationHelper.cs +++ b/HighWayIot.Plc/PlcHelper/WorkStationHelper.cs @@ -30,7 +30,10 @@ namespace HighWayIot.Plc.PlcHelper point += rgvStationNo - 1; bool result = PlcConnect.PlcWrite2($"B{point.ToString("X")}", true, DataTypeEnum.Bool).IsSuccess; - + if (result) + { + LogHelper.Instance.Info($"B{point.ToString("X")} 点置True"); + } return result; } diff --git a/HighWayIot.Repository/domain/ZxDailyReportEntity.cs b/HighWayIot.Repository/domain/ZxDailyReportEntity.cs index a4ff6b3..45d6863 100644 --- a/HighWayIot.Repository/domain/ZxDailyReportEntity.cs +++ b/HighWayIot.Repository/domain/ZxDailyReportEntity.cs @@ -31,7 +31,7 @@ namespace HighWayIot.Repository.domain /// 默认值: /// [SugarColumn(ColumnName = "start_time")] - public DateTime? StartTime { get; set; } + public DateTime StartTime { get; set; } = DateTime.Now; /// /// 备 注:成品代号 diff --git a/HighWayIot.Repository/domain/ZxMesPlanTransferEntity.cs b/HighWayIot.Repository/domain/ZxMesPlanTransferEntity.cs index 6151e48..ef0ca9a 100644 --- a/HighWayIot.Repository/domain/ZxMesPlanTransferEntity.cs +++ b/HighWayIot.Repository/domain/ZxMesPlanTransferEntity.cs @@ -159,6 +159,33 @@ namespace HighWayIot.Repository.domain [SugarColumn(ColumnName = "sync_time")] public DateTime? SyncTime { get; set; } + /// + /// 备 注:贴合层数1基部胶 + /// 默认值: + /// + [SugarColumn(ColumnName = "material_layers_1_2")] + public int? MaterialLayers12 { get; set; } + + /// + /// 备 注:宽度1基部胶 + /// 默认值: + /// + [SugarColumn(ColumnName = "material_width_1_2")] + public double? MaterialWidth12 { get; set; } + + /// + /// 备 注:贴合层数3胎面胶 + /// 默认值: + /// + [SugarColumn(ColumnName = "material_layers_3_2")] + public int? MaterialLayers32 { get; set; } + + /// + /// 备 注:宽度3胎面胶 + /// 默认值: + /// + [SugarColumn(ColumnName = "material_width_3_2")] + public double? MaterialWidth32 { get; set; } } diff --git a/HighWayIot.Repository/domain/ZxSchedulingEntity.cs b/HighWayIot.Repository/domain/ZxSchedulingEntity.cs index 3d6450d..ed22b36 100644 --- a/HighWayIot.Repository/domain/ZxSchedulingEntity.cs +++ b/HighWayIot.Repository/domain/ZxSchedulingEntity.cs @@ -36,14 +36,7 @@ namespace Models /// 默认值: /// [SugarColumn(ColumnName = "recipe_no_1")] - public string RecipeNo1 { get; set; } = string.Empty; - - /// - /// 备 注:标称尺度1 - /// 默认值: - /// - [SugarColumn(ColumnName = "spec_name_1")] - public string SpecName1 { get; set; } = string.Empty; + public string RecipeCode1 { get; set; } = string.Empty; /// /// 备 注:成品代号2 @@ -57,14 +50,7 @@ namespace Models /// 默认值: /// [SugarColumn(ColumnName = "recipe_no_2")] - public string RecipeNo2 { get; set; } = string.Empty; - - /// - /// 备 注:标称尺度2 - /// 默认值: - /// - [SugarColumn(ColumnName = "spec_name_2")] - public string SpecName2 { get; set; } = string.Empty; + public string RecipeCode2 { get; set; } = string.Empty; } } \ No newline at end of file diff --git a/HighWayIot.Repository/domain/ZxWeightEntity.cs b/HighWayIot.Repository/domain/ZxWeightEntity.cs index 264a1da..95cf811 100644 --- a/HighWayIot.Repository/domain/ZxWeightEntity.cs +++ b/HighWayIot.Repository/domain/ZxWeightEntity.cs @@ -61,6 +61,13 @@ namespace Models [SugarColumn(ColumnName = "set_width")] public decimal? SetWidth { get; set; } + /// + /// 备 注:宽度2 + /// 默认值: + /// + [SugarColumn(ColumnName = "set_width_2")] + public decimal? SetWidth2 { get; set; } + /// /// 备 注:层数 /// 默认值: @@ -68,6 +75,13 @@ namespace Models [SugarColumn(ColumnName = "set_layer")] public int? SetLayer { get; set; } + /// + /// 备 注:层数2 + /// 默认值: + /// + [SugarColumn(ColumnName = "set_layer_2")] + public int? SetLayer2 { get; set; } + /// /// 备 注:重量 /// 默认值: @@ -95,6 +109,8 @@ namespace Models /// [SugarColumn(ColumnName = "is_deleted")] public bool? IsDeleted { get; set; } + + } } \ No newline at end of file diff --git a/HighWayIot.Repository/service/ZxDailyReportService.cs b/HighWayIot.Repository/service/ZxDailyReportService.cs index f61d88f..47ced6b 100644 --- a/HighWayIot.Repository/service/ZxDailyReportService.cs +++ b/HighWayIot.Repository/service/ZxDailyReportService.cs @@ -36,7 +36,7 @@ namespace HighWayIot.Repository.service { try { - List entity = _repository.GetList().Take(50).ToList(); + List entity = _repository.GetList().Take(5).ToList(); return entity; } catch (Exception ex) diff --git a/HighWayIot.Repository/service/ZxRecipeService.cs b/HighWayIot.Repository/service/ZxRecipeService.cs index 219b6e4..2c6f7f1 100644 --- a/HighWayIot.Repository/service/ZxRecipeService.cs +++ b/HighWayIot.Repository/service/ZxRecipeService.cs @@ -75,13 +75,32 @@ namespace HighWayIot.Repository.service ZxRecipeEntity entity = _repository.GetSingle(x => x.RecipeName == recipeName && x.IsDeleted == false); return entity; } - catch(Exception ex) + catch (Exception ex) { log.Error("根据一个配方名称查询到多条配方信息", ex); return null; } } + /// + /// 根据成品代号查询条配方参数 + /// + /// + /// + public ZxRecipeEntity GetSingleInfoByRecipeCode(string recipeCode) + { + try + { + ZxRecipeEntity entity = _repository.GetSingle(x => x.RecipeCode == recipeCode && x.IsDeleted == false); + return entity; + } + catch (Exception ex) + { + log.Error("根据一个成品代号查询到多条配方信息", ex); + return null; + } + } + /// /// 获取所有配方名称 /// diff --git a/HighWayIot.Rfid/RfidDataAnalyse.cs b/HighWayIot.Rfid/RfidDataAnalyse.cs index 9961d5a..17d391c 100644 --- a/HighWayIot.Rfid/RfidDataAnalyse.cs +++ b/HighWayIot.Rfid/RfidDataAnalyse.cs @@ -82,6 +82,7 @@ namespace HighWayIot.Rfid } catch { + return null; } index += 12; @@ -96,11 +97,11 @@ namespace HighWayIot.Rfid /// 发送心跳配置包 /// /// - public byte[] SendBFH(ushort second) + public byte[] SendBFH(byte second) { byte[] data = new byte[3]; data[0] = 0x00; - data[1] = 0x05; + data[1] = second; data[2] = 0x01; BaseSendDataEntity entity = new BaseSendDataEntity() @@ -111,7 +112,6 @@ namespace HighWayIot.Rfid byte[] result = BaseRFIDDataAnalyse.BaseSendDataAnalyse(entity); - return result; } diff --git a/HighWayIot.TouchSocket/TouchSocketTcpClient.cs b/HighWayIot.TouchSocket/TouchSocketTcpClient.cs index dc73eb7..1e44c26 100644 --- a/HighWayIot.TouchSocket/TouchSocketTcpClient.cs +++ b/HighWayIot.TouchSocket/TouchSocketTcpClient.cs @@ -77,6 +77,7 @@ namespace HighWayIot.TouchSocket { _logHelper.Info($"连接{ip}:{port}"); result = tcpClient.TryConnect(); + Task.Delay(1000).Wait(); } while (!result.IsSuccess); _logHelper.Info($"{ip}:{port}连接成功 {++ClientsCount}"); diff --git a/HighWayIot.Winform/Business/GeneralUtils.cs b/HighWayIot.Winform/Business/GeneralUtils.cs index 9bbb840..be0a34a 100644 --- a/HighWayIot.Winform/Business/GeneralUtils.cs +++ b/HighWayIot.Winform/Business/GeneralUtils.cs @@ -123,9 +123,13 @@ namespace HighWayIot.Winform.Business /// /// /// - public string DateTimeToString(DateTime dateTimeStart, DateTime dateTimeEnd) + public static string DateTimeToString(DateTime? dateTimeStart, DateTime? dateTimeEnd) { - TimeSpan span = dateTimeEnd - dateTimeStart; + if(dateTimeEnd == null || dateTimeStart == null) + { + return string.Empty; + } + TimeSpan span = (TimeSpan)(dateTimeEnd - dateTimeStart); string result; if (span > TimeSpan.FromSeconds(60)) { @@ -135,7 +139,8 @@ namespace HighWayIot.Winform.Business } else { - result = span.ToString("ss 秒"); + int spanSeconds = (int)span.TotalSeconds % 60; + result = $"{spanSeconds} 秒"; } return result; } diff --git a/HighWayIot.Winform/Business/RecipeSendBusiness.cs b/HighWayIot.Winform/Business/RecipeSendBusiness.cs index 811622e..89edca6 100644 --- a/HighWayIot.Winform/Business/RecipeSendBusiness.cs +++ b/HighWayIot.Winform/Business/RecipeSendBusiness.cs @@ -19,18 +19,20 @@ namespace HighWayIot.Winform.Business /// public class RecipeSendBusiness { - Timer GetSchedulingTimer; + private Timer GetSchedulingTimer; - RecipeSignal recipeSignal = new RecipeSignal(); + private RecipeSignal recipeSignal = new RecipeSignal(); - ZxSchedulingService zxSchedulingService = ZxSchedulingService.Instance; + private ZxSchedulingService zxSchedulingService = ZxSchedulingService.Instance; - ZxRecipeParaService zxRecipeParaService = ZxRecipeParaService.Instance; + private ZxRecipeParaService zxRecipeParaService = ZxRecipeParaService.Instance; - ZxRecipePositionParaService zxRecipePositionParaService = ZxRecipePositionParaService.Instance; + private ZxRecipePositionParaService zxRecipePositionParaService = ZxRecipePositionParaService.Instance; - RecipeParaHelper recipeParaHelper = new RecipeParaHelper(); + private RecipeParaHelper recipeParaHelper = new RecipeParaHelper(); + public static int RecipeNeededVehicleNo = 0; + public RecipeSendBusiness() { //GetSchedulingTimer = new Timer(new System.Threading.TimerCallback(ReadSignal), null, 0, 1000); @@ -44,7 +46,7 @@ namespace HighWayIot.Winform.Business { Dictionary a = recipeSignal.ReadSchedulingSignal(); - if(a == null) + if (a == null) { return; } @@ -57,9 +59,9 @@ namespace HighWayIot.Winform.Business string recipeNo; ZxRecipeParaEntity recipeParaInfo; List zxRecipePositionParaEntities; - if ((item.Key + 1) < 63) + if ((item.Key + 1) <= 62) { - recipeNo = schedulingInfo.Single(x => x.Id == item.Key + 1).RecipeNo1; + recipeNo = schedulingInfo.Single(x => x.Id == item.Key + 1).RecipeCode1; recipeParaInfo = zxRecipeParaService.GetRecipeParaInfoByRecipeCode(recipeNo).FirstOrDefault(); zxRecipePositionParaEntities = zxRecipePositionParaService.GetRecipePositionParaInfos(x => x.RecipeCode == recipeNo); if (recipeParaInfo == null) @@ -70,12 +72,13 @@ namespace HighWayIot.Winform.Business if (recipeParaHelper.UploadToPLC(recipeParaInfo, zxRecipePositionParaEntities)) { PlcConnect.PlcWrite2($"B{(item.Key + 0x901).ToString("X")}", false, DataTypeEnum.Bool); - MonitorInsert(recipeNo); + int deviceNo = schedulingInfo.Single(x => x.Id == item.Key + 1).DeviceNo ?? 0; + MonitorInsert(recipeNo, $"{deviceNo}上模"); } } else { - recipeNo = schedulingInfo.Single(x => x.Id == item.Key + 1).RecipeNo2; + recipeNo = schedulingInfo.Single(x => x.Id == item.Key + 1).RecipeCode2; recipeParaInfo = zxRecipeParaService.GetRecipeParaInfoByRecipeCode(recipeNo).FirstOrDefault(); zxRecipePositionParaEntities = zxRecipePositionParaService.GetRecipePositionParaInfos(x => x.RecipeCode == recipeNo); if (recipeParaInfo == null) @@ -86,7 +89,8 @@ namespace HighWayIot.Winform.Business if (recipeParaHelper.UploadToPLC(recipeParaInfo, zxRecipePositionParaEntities)) { PlcConnect.PlcWrite2($"B{(item.Key + 0x941).ToString("X")}", false, DataTypeEnum.Bool); - MonitorInsert(recipeNo); + int deviceNo = schedulingInfo.Single(x => x.Id == item.Key + 1 - 62).DeviceNo ?? 0; + MonitorInsert(recipeNo, $"{deviceNo}下模"); } } return; @@ -97,9 +101,27 @@ namespace HighWayIot.Winform.Business /// /// 监控画面信息插入 /// - public void MonitorInsert(string recipeCode) + public void MonitorInsert(string recipeCode, string deviceNo) { + ZxRecipeEntity recipeEntity = ZxRecipeService.Instance.GetRecipeInfosByRecipeCode(recipeCode).FirstOrDefault(); + if (recipeEntity == null) + { + return; + } + ZxDailyReportEntity entity = new ZxDailyReportEntity() + { + Uuid = Guid.NewGuid().ToString("N"), + VulcanizationNo = deviceNo, + StartTime = DateTime.Now, + RecipeName = recipeEntity.RecipeName, + SpecName = recipeEntity.RecipeSpecName, + SpecCode = recipeEntity.RecipeSpecCode, + DeviceNo = RecipeNeededVehicleNo, + IsDone = 0 + }; + + ZxDailyReportService.Instance.InsertDailyReportInfo(entity); } } } diff --git a/HighWayIot.Winform/Business/TCPClientFactory.cs b/HighWayIot.Winform/Business/TCPClientFactory.cs index 5365cb1..35934fe 100644 --- a/HighWayIot.Winform/Business/TCPClientFactory.cs +++ b/HighWayIot.Winform/Business/TCPClientFactory.cs @@ -8,6 +8,7 @@ using HighWayIot.TouchSocket; using HighWayIot.Winform.Properties; using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Text; using System.Threading; @@ -65,6 +66,11 @@ namespace HighWayIot.Winform.Business /// private Timer _heartbeatTimer; + /// + /// 工位识别历史记录 + /// + public Dictionary StationRecord = new Dictionary(); + public TCPClientFactory() { _tagSetting = _tagrService.GetTagInfos(); @@ -78,23 +84,27 @@ namespace HighWayIot.Winform.Business public void ReciveDataRoute(byte[] bytes, string ip) { BaseReciveDataEntity reciveData = BaseRFIDDataAnalyse.BaseReceiveAnalyse(bytes); - if(reciveData == null) + if (reciveData == null) { return; } switch (reciveData.Code) { case 0x02: //盘点结果 + ReciveHeartBeatSignal(ip); Receive02HEntity data02Hentity = _RfidDataAnalyse.Receive02H(reciveData.Data); if (data02Hentity == null || data02Hentity.Data == null) { return; } ReciveRFIDSingal(data02Hentity, ip); - ReciveHeartBeatSignal(ip); break; case 0xBF: //心跳信号 ReciveHeartBeatSignal(ip); + if (reciveData.Status != 0x00) + { + LogHelper.Instance.Error($"读写器[{ip}]心跳返回异常,异常代码[{reciveData.Status}]"); + } break; default: LogHelper.Instance.Error($"接收到未知报文,识别代码[{reciveData.Code.ToString("X2")}]"); @@ -133,8 +143,38 @@ namespace HighWayIot.Winform.Business try { ///写入对应的PLC信号 - _workStationHelper.WriteStationSingal(int.Parse(workstationNo), int.Parse(deviceNo)); - LogHelper.Instance.RfidLog($"{workstationNo}工位, {deviceNo}号车"); + if (int.Parse(workstationNo) == 1) + { + RecipeSendBusiness.RecipeNeededVehicleNo = int.Parse(deviceNo); + } + //如果对应位置成功写入,记录上次该工位写入的是该小车,如果下次还是,不再写入(防止重复写入) + int stationNo = int.Parse(workstationNo); + int vehicleNo = int.Parse(deviceNo); + //if (StationRecord.ContainsKey(stationNo)) //判断上次是不是写入的该点位 + //{ + // //上次就写入的该车 就不继续写入了 + // if (StationRecord[stationNo] == vehicleNo) + // { + // return; + // } + //} + if (_workStationHelper.WriteStationSingal(stationNo, vehicleNo)) + { + ////写入成功后记录,上次已写入了该点位,不继续写入 + //if (StationRecord.ContainsKey(stationNo)) + //{ + // StationRecord[stationNo] = vehicleNo; + //} + //else + //{ + // StationRecord.Add(stationNo, vehicleNo); + //} + LogHelper.Instance.RfidLog($"{workstationNo}工位, {deviceNo}号车 [{DateTime.Now.ToString("yy-MM-dd HH:mm:ss:fff")}]"); + } + else + { + LogHelper.Instance.Error($"{workstationNo}工位, {deviceNo}号车 信号写入异常(测试阶段日志) [{DateTime.Now.ToString("yy-MM-dd HH:mm:ss:fff")}]"); + } } catch (Exception ex) { @@ -147,43 +187,54 @@ namespace HighWayIot.Winform.Business /// 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)) + try { - 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)) + //初次心跳处理 + if (!_heartBeatRecord.ContainsKey(ip)) { - 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(); + LogHelper.Instance.RfidLog($"[{ip}] 初次心跳"); + _heartBeatRecord.Add(ip, DateTime.Now); + return; + } + else //不是初次就更新 + { + _heartBeatRecord[ip] = DateTime.Now; } } - + catch (Exception ex) + { + LogHelper.Instance.Error($"心跳信号接收异常 {ex.Message}"); + } + } + + /// + /// 心跳识别 + /// + /// + public void HeartbeatJudge(object o) + { + try + { + foreach (var kvp in _heartBeatRecord.ToArray()) + { + //Task.Run(() => + //{ + TimeSpan timeSpan = DateTime.Now - kvp.Value; + if (timeSpan > TimeSpan.FromSeconds(10)) + { + LogHelper.Instance.RfidLog($"[{kvp.Key}] 可能掉线,准备重连"); + _touchSocketTcpClient.DisposeClient(kvp.Key).GetAwaiter().GetResult(); + _touchSocketTcpClient.CreateTcpClient(kvp.Key, "20108"); + _touchSocketTcpClient.Send(kvp.Key, _RfidDataAnalyse.SendBFH(3)).GetAwaiter().GetResult(); + _heartBeatRecord.Remove(kvp.Key); + } + //}); + } + } + catch (Exception ex) + { + LogHelper.Instance.Error($"心跳信号监测异常 {ex.Message}"); + } } } } diff --git a/HighWayIot.Winform/Business/WorkStationBusiness.cs b/HighWayIot.Winform/Business/WorkStationBusiness.cs index 93b2a23..55cf493 100644 --- a/HighWayIot.Winform/Business/WorkStationBusiness.cs +++ b/HighWayIot.Winform/Business/WorkStationBusiness.cs @@ -85,7 +85,7 @@ namespace HighWayIot.Winform.Business Task.Run(() => { _touchSocketTcpClient.CreateTcpClient(setting.RfidIp, "20108"); - _touchSocketTcpClient.Send(setting.RfidIp, _RfidDataAnalyse.SendBFH(5)).GetAwaiter().GetResult(); + _touchSocketTcpClient.Send(setting.RfidIp, _RfidDataAnalyse.SendBFH(3)).GetAwaiter().GetResult(); }); } diff --git a/HighWayIot.Winform/Business/XmlUtil.cs b/HighWayIot.Winform/Business/XmlUtil.cs index 949f9d9..6d10479 100644 --- a/HighWayIot.Winform/Business/XmlUtil.cs +++ b/HighWayIot.Winform/Business/XmlUtil.cs @@ -33,6 +33,10 @@ namespace HighWayIot.Winform.Business /// private string Path = System.Environment.CurrentDirectory; + /// + /// 配置读取 + /// + /// public List ConfigReader() { List list = new List(); diff --git a/HighWayIot.Winform/Configuration.xml b/HighWayIot.Winform/Configuration.xml index 24e1041..adec15c 100644 --- a/HighWayIot.Winform/Configuration.xml +++ b/HighWayIot.Winform/Configuration.xml @@ -16,8 +16,7 @@ - - \ No newline at end of file + diff --git a/HighWayIot.Winform/MainForm/BaseForm.Designer.cs b/HighWayIot.Winform/MainForm/BaseForm.Designer.cs index a3d539a..29c2f5c 100644 --- a/HighWayIot.Winform/MainForm/BaseForm.Designer.cs +++ b/HighWayIot.Winform/MainForm/BaseForm.Designer.cs @@ -50,12 +50,11 @@ namespace HighWayIot.Winform.MainForm this.MaterialConfigStripItem = new System.Windows.Forms.ToolStripMenuItem(); this.MaterialTypeConfigStripItem = new System.Windows.Forms.ToolStripMenuItem(); this.RecipeConfigStripItem = new System.Windows.Forms.ToolStripMenuItem(); - this.EquipMaterialBindingStripItem = new System.Windows.Forms.ToolStripMenuItem(); this.TestMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.DeviceDataManageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.RFIDParamManageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.DeviceParamManageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.VulcanizerRecipeConfigToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.机台物料信息绑定ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.UserControlTabs = new System.Windows.Forms.TabControl(); this.ClosePageButton = new System.Windows.Forms.Button(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); @@ -86,7 +85,6 @@ namespace HighWayIot.Winform.MainForm this.MonitorMainPageStripMenuItem, this.MaterialMenuStripItem, this.RecipeConfigStripItem, - this.EquipMaterialBindingStripItem, this.TestMenuItem, this.DeviceDataManageToolStripMenuItem}); this.MainMenu.Location = new System.Drawing.Point(0, 0); @@ -226,14 +224,6 @@ namespace HighWayIot.Winform.MainForm this.RecipeConfigStripItem.Text = "配方管理"; this.RecipeConfigStripItem.Click += new System.EventHandler(this.StripMenuItemClick); // - // EquipMaterialBindingStripItem - // - this.EquipMaterialBindingStripItem.Image = global::HighWayIot.Winform.Properties.Resources.绑定; - this.EquipMaterialBindingStripItem.Name = "EquipMaterialBindingStripItem"; - this.EquipMaterialBindingStripItem.Size = new System.Drawing.Size(132, 22); - this.EquipMaterialBindingStripItem.Text = "机台物料信息绑定"; - this.EquipMaterialBindingStripItem.Click += new System.EventHandler(this.StripMenuItemClick); - // // TestMenuItem // this.TestMenuItem.Image = global::HighWayIot.Winform.Properties.Resources.PLC; @@ -246,8 +236,8 @@ namespace HighWayIot.Winform.MainForm // this.DeviceDataManageToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.RFIDParamManageToolStripMenuItem, - this.DeviceParamManageToolStripMenuItem, - this.VulcanizerRecipeConfigToolStripMenuItem}); + this.VulcanizerRecipeConfigToolStripMenuItem, + this.机台物料信息绑定ToolStripMenuItem}); this.DeviceDataManageToolStripMenuItem.Image = global::HighWayIot.Winform.Properties.Resources.参数; this.DeviceDataManageToolStripMenuItem.Name = "DeviceDataManageToolStripMenuItem"; this.DeviceDataManageToolStripMenuItem.Size = new System.Drawing.Size(84, 22); @@ -261,14 +251,6 @@ namespace HighWayIot.Winform.MainForm this.RFIDParamManageToolStripMenuItem.Text = "RFID参数配置"; this.RFIDParamManageToolStripMenuItem.Click += new System.EventHandler(this.StripMenuItemClick); // - // DeviceParamManageToolStripMenuItem - // - this.DeviceParamManageToolStripMenuItem.Image = global::HighWayIot.Winform.Properties.Resources.设备; - this.DeviceParamManageToolStripMenuItem.Name = "DeviceParamManageToolStripMenuItem"; - this.DeviceParamManageToolStripMenuItem.Size = new System.Drawing.Size(184, 22); - this.DeviceParamManageToolStripMenuItem.Text = "设备参数配置"; - this.DeviceParamManageToolStripMenuItem.Click += new System.EventHandler(this.StripMenuItemClick); - // // VulcanizerRecipeConfigToolStripMenuItem // this.VulcanizerRecipeConfigToolStripMenuItem.Image = global::HighWayIot.Winform.Properties.Resources.加硫_03; @@ -277,6 +259,14 @@ namespace HighWayIot.Winform.MainForm this.VulcanizerRecipeConfigToolStripMenuItem.Text = "硫化机配方参数配置"; this.VulcanizerRecipeConfigToolStripMenuItem.Click += new System.EventHandler(this.StripMenuItemClick); // + // 机台物料信息绑定ToolStripMenuItem + // + this.机台物料信息绑定ToolStripMenuItem.Image = global::HighWayIot.Winform.Properties.Resources.绑定; + this.机台物料信息绑定ToolStripMenuItem.Name = "机台物料信息绑定ToolStripMenuItem"; + this.机台物料信息绑定ToolStripMenuItem.Size = new System.Drawing.Size(184, 22); + this.机台物料信息绑定ToolStripMenuItem.Text = "机台物料信息绑定"; + this.机台物料信息绑定ToolStripMenuItem.Click += new System.EventHandler(this.StripMenuItemClick); + // // UserControlTabs // this.UserControlTabs.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -469,12 +459,10 @@ namespace HighWayIot.Winform.MainForm private ToolStripMenuItem DaliyReportStripItem; private ToolStripMenuItem MaterialMenuStripItem; private ToolStripMenuItem RecipeConfigStripItem; - private ToolStripMenuItem EquipMaterialBindingStripItem; private ToolStripMenuItem MaterialConfigStripItem; private ToolStripMenuItem MaterialTypeConfigStripItem; private ToolStripMenuItem DeviceDataManageToolStripMenuItem; private ToolStripMenuItem RFIDParamManageToolStripMenuItem; - private ToolStripMenuItem DeviceParamManageToolStripMenuItem; private ToolStripStatusLabel SplitLabel2; private ToolStripStatusLabel SplitLabel3; private ToolStripStatusLabel SplitLabel4; @@ -483,5 +471,6 @@ namespace HighWayIot.Winform.MainForm private ToolStripStatusLabel Label2; private ToolStripStatusLabel MolderStateLabel; private ToolStripMenuItem VulcanizerRecipeConfigToolStripMenuItem; + private ToolStripMenuItem 机台物料信息绑定ToolStripMenuItem; } } \ No newline at end of file diff --git a/HighWayIot.Winform/MainForm/BaseForm.cs b/HighWayIot.Winform/MainForm/BaseForm.cs index 16f6eed..5ab7c6f 100644 --- a/HighWayIot.Winform/MainForm/BaseForm.cs +++ b/HighWayIot.Winform/MainForm/BaseForm.cs @@ -174,9 +174,6 @@ namespace HighWayIot.Winform.MainForm case "RFID参数配置": UserPanelSwitch(typeof(RFIDParamSettingPage), button.Text); break; - case "设备参数配置": - UserPanelSwitch(typeof(EquipParamSettingPage), button.Text); - break; case "": break; default: diff --git a/HighWayIot.Winform/UserControlPages/MonitorMainPages/MonitorMainPage.Designer.cs b/HighWayIot.Winform/UserControlPages/MonitorMainPages/MonitorMainPage.Designer.cs index 49bb0ff..3acad72 100644 --- a/HighWayIot.Winform/UserControlPages/MonitorMainPages/MonitorMainPage.Designer.cs +++ b/HighWayIot.Winform/UserControlPages/MonitorMainPages/MonitorMainPage.Designer.cs @@ -33,6 +33,17 @@ namespace HighWayIot.Winform.UserControlPages { this.components = new System.ComponentModel.Container(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); this.panel1 = new System.Windows.Forms.Panel(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); @@ -62,19 +73,19 @@ namespace HighWayIot.Winform.UserControlPages this.label3 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); - this.dataGridView1 = new System.Windows.Forms.DataGridView(); - this.Id = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.DeviceNo = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.MonitorDataGridView = new System.Windows.Forms.DataGridView(); + this.DataRefresh = new System.Windows.Forms.Timer(this.components); + this.No = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.VulcanizationNo = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.StartTime = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.RecipeCode = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.RecipeName = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.SpecName = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.SpecCode = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.RgvNo = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.DeviceNo = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.TireWeight = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.BaseRubFinishTime = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.MidRubFinishTime = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.RowTireFinishTime = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.DataRefresh = new System.Windows.Forms.Timer(this.components); this.panel1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout(); @@ -83,7 +94,7 @@ namespace HighWayIot.Winform.UserControlPages this.panel5.SuspendLayout(); this.panel4.SuspendLayout(); this.panel2.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.MonitorDataGridView)).BeginInit(); this.SuspendLayout(); // // panel1 @@ -93,7 +104,7 @@ namespace HighWayIot.Winform.UserControlPages this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Margin = new System.Windows.Forms.Padding(0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(1627, 231); + this.panel1.Size = new System.Drawing.Size(1905, 231); this.panel1.TabIndex = 0; // // tableLayoutPanel1 @@ -109,7 +120,7 @@ namespace HighWayIot.Winform.UserControlPages this.tableLayoutPanel1.RowCount = 1; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 231F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(1627, 231); + this.tableLayoutPanel1.Size = new System.Drawing.Size(1905, 231); this.tableLayoutPanel1.TabIndex = 0; // // tableLayoutPanel2 @@ -119,13 +130,13 @@ namespace HighWayIot.Winform.UserControlPages this.tableLayoutPanel2.Controls.Add(this.panel3, 0, 0); this.tableLayoutPanel2.Controls.Add(this.tableLayoutPanel3, 0, 1); this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel2.Location = new System.Drawing.Point(813, 0); + this.tableLayoutPanel2.Location = new System.Drawing.Point(952, 0); this.tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanel2.Name = "tableLayoutPanel2"; this.tableLayoutPanel2.RowCount = 2; this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 60F)); this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 40F)); - this.tableLayoutPanel2.Size = new System.Drawing.Size(814, 231); + this.tableLayoutPanel2.Size = new System.Drawing.Size(953, 231); this.tableLayoutPanel2.TabIndex = 1; // // panel3 @@ -141,7 +152,7 @@ namespace HighWayIot.Winform.UserControlPages this.panel3.Location = new System.Drawing.Point(0, 0); this.panel3.Margin = new System.Windows.Forms.Padding(0); this.panel3.Name = "panel3"; - this.panel3.Size = new System.Drawing.Size(814, 138); + this.panel3.Size = new System.Drawing.Size(953, 138); this.panel3.TabIndex = 3; // // label9 @@ -223,7 +234,7 @@ namespace HighWayIot.Winform.UserControlPages this.tableLayoutPanel3.Name = "tableLayoutPanel3"; this.tableLayoutPanel3.RowCount = 1; this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel3.Size = new System.Drawing.Size(814, 93); + this.tableLayoutPanel3.Size = new System.Drawing.Size(953, 93); this.tableLayoutPanel3.TabIndex = 0; // // panel5 @@ -232,7 +243,7 @@ namespace HighWayIot.Winform.UserControlPages this.panel5.Controls.Add(this.NowDateProductNumTextBox); this.panel5.Controls.Add(this.NowDateProductNumLabel); this.panel5.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel5.Location = new System.Drawing.Point(553, 0); + this.panel5.Location = new System.Drawing.Point(692, 0); this.panel5.Margin = new System.Windows.Forms.Padding(0); this.panel5.Name = "panel5"; this.panel5.Size = new System.Drawing.Size(261, 93); @@ -273,7 +284,7 @@ namespace HighWayIot.Winform.UserControlPages this.panel4.Location = new System.Drawing.Point(0, 0); this.panel4.Margin = new System.Windows.Forms.Padding(0); this.panel4.Name = "panel4"; - this.panel4.Size = new System.Drawing.Size(553, 93); + this.panel4.Size = new System.Drawing.Size(692, 93); this.panel4.TabIndex = 3; // // NightProductNumTextBox @@ -350,7 +361,7 @@ namespace HighWayIot.Winform.UserControlPages this.panel2.Location = new System.Drawing.Point(0, 0); this.panel2.Margin = new System.Windows.Forms.Padding(0); this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(813, 231); + this.panel2.Size = new System.Drawing.Size(952, 231); this.panel2.TabIndex = 2; // // SpecCodeLabel @@ -432,106 +443,46 @@ namespace HighWayIot.Winform.UserControlPages this.label1.TabIndex = 0; this.label1.Text = "运行中的计划"; // - // dataGridView1 + // MonitorDataGridView // - this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.MonitorDataGridView.AllowUserToAddRows = false; + this.MonitorDataGridView.AllowUserToDeleteRows = false; + this.MonitorDataGridView.AllowUserToResizeColumns = false; + this.MonitorDataGridView.AllowUserToResizeRows = false; + this.MonitorDataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.dataGridView1.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.MonitorDataGridView.BorderStyle = System.Windows.Forms.BorderStyle.None; dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.TopCenter; dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 12F); + dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText; dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; - this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.Id, - this.DeviceNo, + this.MonitorDataGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1; + this.MonitorDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.MonitorDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.No, + this.VulcanizationNo, this.StartTime, - this.RecipeCode, + this.RecipeName, this.SpecName, this.SpecCode, - this.RgvNo, + this.DeviceNo, this.TireWeight, this.BaseRubFinishTime, this.MidRubFinishTime, this.RowTireFinishTime}); - this.dataGridView1.Location = new System.Drawing.Point(0, 231); - this.dataGridView1.Margin = new System.Windows.Forms.Padding(0); - this.dataGridView1.Name = "dataGridView1"; - this.dataGridView1.RowHeadersVisible = false; - this.dataGridView1.RowTemplate.Height = 23; - this.dataGridView1.Size = new System.Drawing.Size(1627, 774); - this.dataGridView1.TabIndex = 1; - // - // Id - // - this.Id.HeaderText = "序号"; - this.Id.Name = "Id"; - this.Id.Width = 70; - // - // DeviceNo - // - this.DeviceNo.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.DeviceNo.HeaderText = "机位"; - this.DeviceNo.Name = "DeviceNo"; - // - // StartTime - // - this.StartTime.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.StartTime.HeaderText = "开始时间"; - this.StartTime.Name = "StartTime"; - // - // RecipeCode - // - this.RecipeCode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.RecipeCode.HeaderText = "成品代号"; - this.RecipeCode.Name = "RecipeCode"; - // - // SpecName - // - this.SpecName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.SpecName.HeaderText = "标称尺度"; - this.SpecName.Name = "SpecName"; - // - // SpecCode - // - this.SpecCode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.SpecCode.HeaderText = "SPEC编号"; - this.SpecCode.Name = "SpecCode"; - // - // RgvNo - // - this.RgvNo.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.RgvNo.HeaderText = "小车号"; - this.RgvNo.Name = "RgvNo"; - // - // TireWeight - // - this.TireWeight.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.TireWeight.HeaderText = "轮胎重量"; - this.TireWeight.Name = "TireWeight"; - // - // BaseRubFinishTime - // - this.BaseRubFinishTime.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.BaseRubFinishTime.HeaderText = "基部胶完成时间"; - this.BaseRubFinishTime.Name = "BaseRubFinishTime"; - // - // MidRubFinishTime - // - this.MidRubFinishTime.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.MidRubFinishTime.HeaderText = "中层胶完成时间"; - this.MidRubFinishTime.Name = "MidRubFinishTime"; - // - // RowTireFinishTime - // - this.RowTireFinishTime.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.RowTireFinishTime.HeaderText = "生胎完成时间"; - this.RowTireFinishTime.Name = "RowTireFinishTime"; + this.MonitorDataGridView.Location = new System.Drawing.Point(0, 231); + this.MonitorDataGridView.Margin = new System.Windows.Forms.Padding(0); + this.MonitorDataGridView.MultiSelect = false; + this.MonitorDataGridView.Name = "MonitorDataGridView"; + this.MonitorDataGridView.ReadOnly = true; + this.MonitorDataGridView.RowHeadersVisible = false; + this.MonitorDataGridView.RowTemplate.Height = 32; + this.MonitorDataGridView.Size = new System.Drawing.Size(1905, 764); + this.MonitorDataGridView.TabIndex = 1; // // DataRefresh // @@ -539,6 +490,114 @@ namespace HighWayIot.Winform.UserControlPages this.DataRefresh.Interval = 1000; this.DataRefresh.Tick += new System.EventHandler(this.DataRefresh_Tick); // + // No + // + this.No.DataPropertyName = "No"; + dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.No.DefaultCellStyle = dataGridViewCellStyle2; + this.No.HeaderText = "序号"; + this.No.Name = "No"; + this.No.ReadOnly = true; + this.No.Width = 79; + // + // VulcanizationNo + // + this.VulcanizationNo.DataPropertyName = "VulcanizationNo"; + dataGridViewCellStyle3.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.VulcanizationNo.DefaultCellStyle = dataGridViewCellStyle3; + this.VulcanizationNo.HeaderText = "机位"; + this.VulcanizationNo.Name = "VulcanizationNo"; + this.VulcanizationNo.ReadOnly = true; + // + // StartTime + // + this.StartTime.DataPropertyName = "StartTime"; + dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.StartTime.DefaultCellStyle = dataGridViewCellStyle4; + this.StartTime.HeaderText = "开始时间"; + this.StartTime.Name = "StartTime"; + this.StartTime.ReadOnly = true; + this.StartTime.Width = 200; + // + // RecipeName + // + this.RecipeName.DataPropertyName = "RecipeName"; + dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Bold); + this.RecipeName.DefaultCellStyle = dataGridViewCellStyle5; + this.RecipeName.HeaderText = "成品代号"; + this.RecipeName.Name = "RecipeName"; + this.RecipeName.ReadOnly = true; + this.RecipeName.Width = 220; + // + // SpecName + // + this.SpecName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.SpecName.DataPropertyName = "SpecName"; + dataGridViewCellStyle6.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Bold); + this.SpecName.DefaultCellStyle = dataGridViewCellStyle6; + this.SpecName.HeaderText = "标称尺度"; + this.SpecName.Name = "SpecName"; + this.SpecName.ReadOnly = true; + // + // SpecCode + // + this.SpecCode.DataPropertyName = "SpecCode"; + dataGridViewCellStyle7.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Bold); + this.SpecCode.DefaultCellStyle = dataGridViewCellStyle7; + this.SpecCode.HeaderText = "SPEC编号"; + this.SpecCode.Name = "SpecCode"; + this.SpecCode.ReadOnly = true; + this.SpecCode.Width = 200; + // + // DeviceNo + // + this.DeviceNo.DataPropertyName = "DeviceNo"; + dataGridViewCellStyle8.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Bold); + this.DeviceNo.DefaultCellStyle = dataGridViewCellStyle8; + this.DeviceNo.HeaderText = "小车号"; + this.DeviceNo.Name = "DeviceNo"; + this.DeviceNo.ReadOnly = true; + // + // TireWeight + // + this.TireWeight.DataPropertyName = "RawTireWeight"; + dataGridViewCellStyle9.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Bold); + this.TireWeight.DefaultCellStyle = dataGridViewCellStyle9; + this.TireWeight.HeaderText = "轮胎重量"; + this.TireWeight.Name = "TireWeight"; + this.TireWeight.ReadOnly = true; + this.TireWeight.Width = 120; + // + // BaseRubFinishTime + // + this.BaseRubFinishTime.DataPropertyName = "BaseRubTimeSpan"; + dataGridViewCellStyle10.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Bold); + this.BaseRubFinishTime.DefaultCellStyle = dataGridViewCellStyle10; + this.BaseRubFinishTime.HeaderText = "基部胶完成时间"; + this.BaseRubFinishTime.Name = "BaseRubFinishTime"; + this.BaseRubFinishTime.ReadOnly = true; + this.BaseRubFinishTime.Width = 179; + // + // MidRubFinishTime + // + this.MidRubFinishTime.DataPropertyName = "MidRubTimeSpan"; + dataGridViewCellStyle11.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Bold); + this.MidRubFinishTime.DefaultCellStyle = dataGridViewCellStyle11; + this.MidRubFinishTime.HeaderText = "中层胶完成时间"; + this.MidRubFinishTime.Name = "MidRubFinishTime"; + this.MidRubFinishTime.ReadOnly = true; + this.MidRubFinishTime.Width = 179; + // + // RowTireFinishTime + // + this.RowTireFinishTime.DataPropertyName = "FaceRubTimeSpan"; + dataGridViewCellStyle12.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Bold); + this.RowTireFinishTime.DefaultCellStyle = dataGridViewCellStyle12; + this.RowTireFinishTime.HeaderText = "生胎完成时间"; + this.RowTireFinishTime.Name = "RowTireFinishTime"; + this.RowTireFinishTime.ReadOnly = true; + this.RowTireFinishTime.Width = 160; + // // MonitorMainPage // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); @@ -546,11 +605,11 @@ namespace HighWayIot.Winform.UserControlPages this.AutoScroll = true; this.AutoSize = true; this.BackColor = System.Drawing.SystemColors.ActiveCaption; - this.Controls.Add(this.dataGridView1); + this.Controls.Add(this.MonitorDataGridView); this.Controls.Add(this.panel1); this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Name = "MonitorMainPage"; - this.Size = new System.Drawing.Size(1627, 1005); + this.Size = new System.Drawing.Size(1905, 995); this.panel1.ResumeLayout(false); this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel2.ResumeLayout(false); @@ -563,7 +622,7 @@ namespace HighWayIot.Winform.UserControlPages this.panel4.PerformLayout(); this.panel2.ResumeLayout(false); this.panel2.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.MonitorDataGridView)).EndInit(); this.ResumeLayout(false); } @@ -578,7 +637,7 @@ namespace HighWayIot.Winform.UserControlPages private Panel panel5; private Panel panel4; private Panel panel2; - private DataGridView dataGridView1; + private DataGridView MonitorDataGridView; private Label label1; private Label label2; private Label SpecCodeLabel; @@ -600,17 +659,17 @@ namespace HighWayIot.Winform.UserControlPages private TextBox NowDateProductNumTextBox; private TextBox NightProductNumTextBox; private TextBox DayProductNumTextBox; - private DataGridViewTextBoxColumn Id; - private DataGridViewTextBoxColumn DeviceNo; + private Timer DataRefresh; + private DataGridViewTextBoxColumn No; + private DataGridViewTextBoxColumn VulcanizationNo; private DataGridViewTextBoxColumn StartTime; - private DataGridViewTextBoxColumn RecipeCode; + private DataGridViewTextBoxColumn RecipeName; private DataGridViewTextBoxColumn SpecName; private DataGridViewTextBoxColumn SpecCode; - private DataGridViewTextBoxColumn RgvNo; + private DataGridViewTextBoxColumn DeviceNo; private DataGridViewTextBoxColumn TireWeight; private DataGridViewTextBoxColumn BaseRubFinishTime; private DataGridViewTextBoxColumn MidRubFinishTime; private DataGridViewTextBoxColumn RowTireFinishTime; - private Timer DataRefresh; } } diff --git a/HighWayIot.Winform/UserControlPages/MonitorMainPages/MonitorMainPage.cs b/HighWayIot.Winform/UserControlPages/MonitorMainPages/MonitorMainPage.cs index 05e9a66..df699e0 100644 --- a/HighWayIot.Winform/UserControlPages/MonitorMainPages/MonitorMainPage.cs +++ b/HighWayIot.Winform/UserControlPages/MonitorMainPages/MonitorMainPage.cs @@ -1,5 +1,7 @@ using HighWayIot.Log4net; +using HighWayIot.Repository.domain; using HighWayIot.Repository.service; +using HighWayIot.Winform.Business; using System; using System.Collections.Generic; using System.ComponentModel; @@ -9,6 +11,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using Timer = System.Threading.Timer; namespace HighWayIot.Winform.UserControlPages { @@ -16,11 +19,24 @@ namespace HighWayIot.Winform.UserControlPages { LogHelper logHelper = LogHelper.Instance; - SysShiftTimeService shiftTimeService = SysShiftTimeService.Instance; + /// + /// 班次服务类 + /// + private SysShiftTimeService _shiftTimeService = SysShiftTimeService.Instance; + + /// + /// 报表服务类 + /// + private ZxDailyReportService _zxDailyReportService = ZxDailyReportService.Instance; + + private List monitorEntity = new List(); public MonitorMainPage() { InitializeComponent(); + + MonitorDataGridView.AutoGenerateColumns = false; + DateTimeRefresh(); } @@ -35,6 +51,7 @@ namespace HighWayIot.Winform.UserControlPages { DateTimeRefresh(); } + BindData(); } /// @@ -42,7 +59,7 @@ namespace HighWayIot.Winform.UserControlPages /// private void DateTimeRefresh() { - var timeList = shiftTimeService.GetShiftInfos(); + var timeList = _shiftTimeService.GetShiftInfos(); var morningShift = timeList.Where(x => x.ShiftName == "早").FirstOrDefault(); var midShift = timeList.Where(x => x.ShiftName == "中").FirstOrDefault(); var nightShift = timeList.Where(x => x.ShiftName == "夜").FirstOrDefault(); @@ -61,8 +78,33 @@ namespace HighWayIot.Winform.UserControlPages NowDateProductNumLabel.Text = DateTime.Now.ToString("MM 月 dd 日 产量"); } + /// + /// 数据刷新 + /// private void BindData() { + List dailyEntity = _zxDailyReportService.Get50DailyReportInfos(); + monitorEntity.Clear(); + for(int i = 0; i < dailyEntity.Count; i++) + { + monitorEntity.Add(new MonitorDataSource() + { + No = i + 1, + VulcanizationNo = dailyEntity[i].VulcanizationNo, + StartTime = dailyEntity[i].StartTime.ToString("MM月dd日 HH:mm:ss"), + RecipeName = dailyEntity[i].RecipeName, + SpecName = dailyEntity[i].SpecName, + SpecCode = dailyEntity[i].SpecCode, + DeviceNo = dailyEntity[i].DeviceNo, + RawTireWeight = dailyEntity[i].RawTireWeight ?? 0, + BaseRubTimeSpan = GeneralUtils.DateTimeToString(dailyEntity[i].StartTime, dailyEntity[i].BaseEndTime), + MidRubTimeSpan = GeneralUtils.DateTimeToString(dailyEntity[i].StartTime, dailyEntity[i].MidEndTime), + FaceRubTimeSpan = GeneralUtils.DateTimeToString(dailyEntity[i].StartTime, dailyEntity[i].FaceEndTime), + }); + } + + MonitorDataGridView.DataSource = null; + MonitorDataGridView.DataSource = monitorEntity; } } diff --git a/HighWayIot.Winform/UserControlPages/MonitorMainPages/MonitorMainPage.resx b/HighWayIot.Winform/UserControlPages/MonitorMainPages/MonitorMainPage.resx index f0a99eb..9f92fa2 100644 --- a/HighWayIot.Winform/UserControlPages/MonitorMainPages/MonitorMainPage.resx +++ b/HighWayIot.Winform/UserControlPages/MonitorMainPages/MonitorMainPage.resx @@ -117,16 +117,16 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + True - + True True - + True @@ -135,7 +135,7 @@ True - + True diff --git a/HighWayIot.Winform/UserControlPages/ParamConfigPages/ProductionScheduling.Designer.cs b/HighWayIot.Winform/UserControlPages/ParamConfigPages/ProductionScheduling.Designer.cs index 2d2d24d..ce48641 100644 --- a/HighWayIot.Winform/UserControlPages/ParamConfigPages/ProductionScheduling.Designer.cs +++ b/HighWayIot.Winform/UserControlPages/ParamConfigPages/ProductionScheduling.Designer.cs @@ -31,22 +31,22 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); this.SchedulingDataGridView = new System.Windows.Forms.DataGridView(); this.SelectConfigButton = new System.Windows.Forms.Button(); this.ButtonPanel = new System.Windows.Forms.Panel(); this.UpdateConfigButton = new System.Windows.Forms.Button(); this.Id = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.DeviceNo = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.RecipeName1 = new System.Windows.Forms.DataGridViewComboBoxColumn(); - this.SpecName1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.RecipeName2 = new System.Windows.Forms.DataGridViewComboBoxColumn(); - this.SpecName2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.RecipeCode1 = new System.Windows.Forms.DataGridViewComboBoxColumn(); + this.RecipeName1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.RecipeCode2 = new System.Windows.Forms.DataGridViewComboBoxColumn(); + this.RecipeName2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); ((System.ComponentModel.ISupportInitialize)(this.SchedulingDataGridView)).BeginInit(); this.ButtonPanel.SuspendLayout(); this.SuspendLayout(); @@ -60,10 +60,10 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages this.SchedulingDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.Id, this.DeviceNo, + this.RecipeCode1, this.RecipeName1, - this.SpecName1, - this.RecipeName2, - this.SpecName2}); + this.RecipeCode2, + this.RecipeName2}); this.SchedulingDataGridView.Location = new System.Drawing.Point(0, 65); this.SchedulingDataGridView.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.SchedulingDataGridView.Name = "SchedulingDataGridView"; @@ -112,8 +112,8 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages // Id // this.Id.DataPropertyName = "Id"; - dataGridViewCellStyle7.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.Id.DefaultCellStyle = dataGridViewCellStyle7; + dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.Id.DefaultCellStyle = dataGridViewCellStyle1; this.Id.HeaderText = "ID"; this.Id.Name = "Id"; this.Id.ReadOnly = true; @@ -123,58 +123,58 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages // DeviceNo // this.DeviceNo.DataPropertyName = "DeviceNo"; - dataGridViewCellStyle8.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.DeviceNo.DefaultCellStyle = dataGridViewCellStyle8; + dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.DeviceNo.DefaultCellStyle = dataGridViewCellStyle2; this.DeviceNo.HeaderText = "机台编号"; this.DeviceNo.Name = "DeviceNo"; this.DeviceNo.ReadOnly = true; this.DeviceNo.Resizable = System.Windows.Forms.DataGridViewTriState.False; // + // RecipeCode1 + // + this.RecipeCode1.DataPropertyName = "RecipeCode1"; + dataGridViewCellStyle3.BackColor = System.Drawing.Color.Transparent; + dataGridViewCellStyle3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle3.ForeColor = System.Drawing.Color.Black; + dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.Transparent; + dataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.Black; + this.RecipeCode1.DefaultCellStyle = dataGridViewCellStyle3; + this.RecipeCode1.HeaderText = "成品代号 - 上模"; + this.RecipeCode1.Name = "RecipeCode1"; + this.RecipeCode1.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.RecipeCode1.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.RecipeCode1.Width = 200; + // // RecipeName1 // + this.RecipeName1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.RecipeName1.DataPropertyName = "RecipeName1"; - dataGridViewCellStyle9.BackColor = System.Drawing.Color.Transparent; - dataGridViewCellStyle9.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle9.ForeColor = System.Drawing.Color.Black; - dataGridViewCellStyle9.SelectionBackColor = System.Drawing.Color.Transparent; - dataGridViewCellStyle9.SelectionForeColor = System.Drawing.Color.Black; - this.RecipeName1.DefaultCellStyle = dataGridViewCellStyle9; - this.RecipeName1.HeaderText = "成品代号 - 上模"; + dataGridViewCellStyle4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.RecipeName1.DefaultCellStyle = dataGridViewCellStyle4; + this.RecipeName1.HeaderText = "标称尺度 - 上模"; this.RecipeName1.Name = "RecipeName1"; this.RecipeName1.Resizable = System.Windows.Forms.DataGridViewTriState.False; - this.RecipeName1.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.RecipeName1.Width = 150; // - // SpecName1 + // RecipeCode2 // - this.SpecName1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.SpecName1.DataPropertyName = "SpecName1"; - dataGridViewCellStyle10.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.SpecName1.DefaultCellStyle = dataGridViewCellStyle10; - this.SpecName1.HeaderText = "标称尺度 - 上模"; - this.SpecName1.Name = "SpecName1"; - this.SpecName1.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.RecipeCode2.DataPropertyName = "RecipeCode2"; + dataGridViewCellStyle5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.RecipeCode2.DefaultCellStyle = dataGridViewCellStyle5; + this.RecipeCode2.HeaderText = "成品代号 - 下模"; + this.RecipeCode2.Name = "RecipeCode2"; + this.RecipeCode2.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.RecipeCode2.Width = 200; // // RecipeName2 // + this.RecipeName2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.RecipeName2.DataPropertyName = "RecipeName2"; - dataGridViewCellStyle11.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.RecipeName2.DefaultCellStyle = dataGridViewCellStyle11; - this.RecipeName2.HeaderText = "成品代号 - 下模"; + dataGridViewCellStyle6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.RecipeName2.DefaultCellStyle = dataGridViewCellStyle6; + this.RecipeName2.HeaderText = "标称尺度 - 下模"; this.RecipeName2.Name = "RecipeName2"; this.RecipeName2.Resizable = System.Windows.Forms.DataGridViewTriState.False; - this.RecipeName2.Width = 150; - // - // SpecName2 - // - this.SpecName2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.SpecName2.DataPropertyName = "SpecName2"; - dataGridViewCellStyle12.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.SpecName2.DefaultCellStyle = dataGridViewCellStyle12; - this.SpecName2.HeaderText = "标称尺度 - 下模"; - this.SpecName2.Name = "SpecName2"; - this.SpecName2.Resizable = System.Windows.Forms.DataGridViewTriState.False; - this.SpecName2.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; + this.RecipeName2.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; // // ProductionScheduling // @@ -200,9 +200,9 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages private Button UpdateConfigButton; private DataGridViewTextBoxColumn Id; private DataGridViewTextBoxColumn DeviceNo; - private DataGridViewComboBoxColumn RecipeName1; - private DataGridViewTextBoxColumn SpecName1; - private DataGridViewComboBoxColumn RecipeName2; - private DataGridViewTextBoxColumn SpecName2; + private DataGridViewComboBoxColumn RecipeCode1; + private DataGridViewTextBoxColumn RecipeName1; + private DataGridViewComboBoxColumn RecipeCode2; + private DataGridViewTextBoxColumn RecipeName2; } } diff --git a/HighWayIot.Winform/UserControlPages/ParamConfigPages/ProductionScheduling.cs b/HighWayIot.Winform/UserControlPages/ParamConfigPages/ProductionScheduling.cs index 49120af..e90cbcf 100644 --- a/HighWayIot.Winform/UserControlPages/ParamConfigPages/ProductionScheduling.cs +++ b/HighWayIot.Winform/UserControlPages/ParamConfigPages/ProductionScheduling.cs @@ -42,18 +42,21 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages ComboBoxBind(); } + /// + /// 绑定下拉框数据源 + /// private void ComboBoxBind() { zxRecipeEntities = zxRecipeService.GetRecipeInfos(); - RecipeName1.DataSource = null; - RecipeName2.DataSource = null; + RecipeCode1.DataSource = null; + RecipeCode1.DataSource = null; - List r1 = zxRecipeEntities.Select(x => x.RecipeName).ToList(); + List r1 = zxRecipeEntities.Select(x => x.RecipeCode).ToList(); r1.Insert(0, ""); - RecipeName1.DataSource = r1; - List r2 = zxRecipeEntities.Select(x => x.RecipeName).ToList(); + RecipeCode1.DataSource = r1; + List r2 = zxRecipeEntities.Select(x => x.RecipeCode).ToList(); r2.Insert(0, ""); - RecipeName2.DataSource = r2; + RecipeCode2.DataSource = r2; } private void UpdateConfigButton_Click(object sender, EventArgs e) @@ -68,6 +71,11 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages } } + /// + /// 刷新页面 + /// + /// + /// private void SelectConfigButton_Click(object sender, EventArgs e) { zxSchedulingEntity = zxSchedulingService.GetSchedulingInfo(); @@ -75,9 +83,13 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages bindingSource.DataSource = zxSchedulingEntity; } + /// + /// 实现单击一次显示下拉列表框 + /// + /// + /// private void SchedulingDataGridView_CellEnter(object sender, DataGridViewCellEventArgs e) { - //实现单击一次显示下拉列表框 if (SchedulingDataGridView.Columns[e.ColumnIndex] is DataGridViewComboBoxColumn && e.RowIndex != -1) { SendKeys.Send("{F4}"); @@ -90,7 +102,7 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages ComboBox cbo = new ComboBox(); private void SchedulingDataGridView_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) { - if (SchedulingDataGridView.CurrentCell.OwningColumn.Name.Contains("RecipeName") && SchedulingDataGridView.CurrentCell.RowIndex != -1) + if (SchedulingDataGridView.CurrentCell.OwningColumn.Name.Contains("RecipeCode") && SchedulingDataGridView.CurrentCell.RowIndex != -1) { //保存当前的事件源。为了触发事件后。在取消 cbo = e.Control as ComboBox; @@ -116,31 +128,27 @@ namespace HighWayIot.Winform.UserControlPages.ParamConfigPages if(column == 2) { - ZxRecipeEntity recipe = zxRecipeService.GetSingleInfoByRecipeName(combox.Text); + ZxRecipeEntity recipe = zxRecipeService.GetSingleInfoByRecipeCode(combox.Text); if (recipe == null) { - zxSchedulingEntity[row].SpecName1 = string.Empty; - zxSchedulingEntity[row].RecipeNo1 = string.Empty; + zxSchedulingEntity[row].RecipeName1 = string.Empty; } else { - zxSchedulingEntity[row].SpecName1 = recipe.RecipeSpecName; - zxSchedulingEntity[row].RecipeNo1 = recipe.RecipeCode; + zxSchedulingEntity[row].RecipeName1 = recipe.RecipeName; } } if(column == 4) { - ZxRecipeEntity recipe = zxRecipeService.GetSingleInfoByRecipeName(combox.Text); + ZxRecipeEntity recipe = zxRecipeService.GetSingleInfoByRecipeCode(combox.Text); if (recipe == null) { - zxSchedulingEntity[row].SpecName2 = string.Empty; - zxSchedulingEntity[row].RecipeNo2 = string.Empty; + zxSchedulingEntity[row].RecipeName2 = string.Empty; } else { - zxSchedulingEntity[row].SpecName2 = recipe.RecipeSpecName; - zxSchedulingEntity[row].RecipeNo2 = recipe.RecipeCode; + zxSchedulingEntity[row].RecipeName2 = recipe.RecipeName; } } SchedulingDataGridView.Refresh(); diff --git a/HighWayIot.Winform/UserControlPages/ParamConfigPages/ProductionScheduling.resx b/HighWayIot.Winform/UserControlPages/ParamConfigPages/ProductionScheduling.resx index 340ae03..c19eaa6 100644 --- a/HighWayIot.Winform/UserControlPages/ParamConfigPages/ProductionScheduling.resx +++ b/HighWayIot.Winform/UserControlPages/ParamConfigPages/ProductionScheduling.resx @@ -123,16 +123,16 @@ True + + True + True - + True True - - True - \ No newline at end of file diff --git a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/AddRecipeForm.Designer.cs b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/AddRecipeForm.Designer.cs index 067f756..1397a3d 100644 --- a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/AddRecipeForm.Designer.cs +++ b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/AddRecipeForm.Designer.cs @@ -77,7 +77,7 @@ this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(65, 12); this.label3.TabIndex = 17; - this.label3.Text = "配方名称:"; + this.label3.Text = "标称尺度:"; // // RecipeNameTextBox // @@ -93,11 +93,10 @@ this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(65, 12); this.label2.TabIndex = 15; - this.label2.Text = "配方编号:"; + this.label2.Text = "成品代号:"; // // RecipeCodeTextBox // - this.RecipeCodeTextBox.Enabled = false; this.RecipeCodeTextBox.Location = new System.Drawing.Point(103, 28); this.RecipeCodeTextBox.Name = "RecipeCodeTextBox"; this.RecipeCodeTextBox.Size = new System.Drawing.Size(130, 21); @@ -200,6 +199,7 @@ this.WeightErrorTextBox.Name = "WeightErrorTextBox"; this.WeightErrorTextBox.Size = new System.Drawing.Size(83, 21); this.WeightErrorTextBox.TabIndex = 33; + this.WeightErrorTextBox.Text = "1"; // // AddRecipeForm // @@ -226,6 +226,7 @@ this.Controls.Add(this.label1); this.Name = "AddRecipeForm"; this.Text = "配方添加"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.AddRecipeForm_FormClosing); this.ResumeLayout(false); this.PerformLayout(); diff --git a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/AddRecipeForm.cs b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/AddRecipeForm.cs index 327ea9c..a7f60dd 100644 --- a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/AddRecipeForm.cs +++ b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/AddRecipeForm.cs @@ -16,6 +16,11 @@ namespace HighWayIot.Winform.UserControlPages.RecipeConfigPages { ZxRecipeService zxRecipeService = ZxRecipeService.Instance; + /// + /// 关闭窗体时传值 + /// + public ZxRecipeEntity CloseValue { get; set; } + public AddRecipeForm() { InitializeComponent(); @@ -24,8 +29,8 @@ namespace HighWayIot.Winform.UserControlPages.RecipeConfigPages private void Init() { - string recipeCode = DateTime.Now.ToString("yyyyMMddHHmmss"); - RecipeCodeTextBox.Text = recipeCode; + //string recipeCode = DateTime.Now.ToString("yyyyMMddHHmmss"); + //RecipeCodeTextBox.Text = recipeCode; } private void ConfrimAddButton_Click(object sender, EventArgs e) @@ -75,6 +80,7 @@ namespace HighWayIot.Winform.UserControlPages.RecipeConfigPages if(zxRecipeService.InsertRecipeInfo(zxRecipeEntity)) { MessageBox.Show("配方信息添加成功"); + this.CloseValue = zxRecipeEntity; this.Close(); this.Dispose(); } @@ -84,5 +90,10 @@ namespace HighWayIot.Winform.UserControlPages.RecipeConfigPages return; } } + + private void AddRecipeForm_FormClosing(object sender, FormClosingEventArgs e) + { + this.DialogResult = DialogResult.OK; + } } } diff --git a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/AddWeightForm.Designer.cs b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/AddWeightForm.Designer.cs index f5cf45f..e32cdca 100644 --- a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/AddWeightForm.Designer.cs +++ b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/AddWeightForm.Designer.cs @@ -53,6 +53,10 @@ this.AddButton = new System.Windows.Forms.Button(); this.RubTypeCombobox = new System.Windows.Forms.ComboBox(); this.label11 = new System.Windows.Forms.Label(); + this.SetLayerTextBox2 = new System.Windows.Forms.TextBox(); + this.label12 = new System.Windows.Forms.Label(); + this.SetWidthTextBox2 = new System.Windows.Forms.TextBox(); + this.label13 = new System.Windows.Forms.Label(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); // @@ -181,7 +185,7 @@ // // SetThicknessTextBox // - this.SetThicknessTextBox.Location = new System.Drawing.Point(98, 145); + this.SetThicknessTextBox.Location = new System.Drawing.Point(94, 145); this.SetThicknessTextBox.Name = "SetThicknessTextBox"; this.SetThicknessTextBox.Size = new System.Drawing.Size(123, 21); this.SetThicknessTextBox.TabIndex = 14; @@ -197,7 +201,7 @@ // // SetWidthTextBox // - this.SetWidthTextBox.Location = new System.Drawing.Point(274, 145); + this.SetWidthTextBox.Location = new System.Drawing.Point(272, 145); this.SetWidthTextBox.Name = "SetWidthTextBox"; this.SetWidthTextBox.Size = new System.Drawing.Size(123, 21); this.SetWidthTextBox.TabIndex = 16; @@ -205,11 +209,11 @@ // label7 // this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(227, 149); + this.label7.Location = new System.Drawing.Point(225, 149); this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(41, 12); + this.label7.Size = new System.Drawing.Size(47, 12); this.label7.TabIndex = 15; - this.label7.Text = "宽度:"; + this.label7.Text = "宽度1:"; // // SetLayerTextBox // @@ -223,13 +227,13 @@ this.label8.AutoSize = true; this.label8.Location = new System.Drawing.Point(403, 149); this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(41, 12); + this.label8.Size = new System.Drawing.Size(47, 12); this.label8.TabIndex = 17; - this.label8.Text = "层数:"; + this.label8.Text = "层数1:"; // // SetWeightTextBox // - this.SetWeightTextBox.Location = new System.Drawing.Point(98, 172); + this.SetWeightTextBox.Location = new System.Drawing.Point(94, 172); this.SetWeightTextBox.Name = "SetWeightTextBox"; this.SetWeightTextBox.Size = new System.Drawing.Size(123, 21); this.SetWeightTextBox.TabIndex = 20; @@ -245,15 +249,16 @@ // // SetErrorTextBox // - this.SetErrorTextBox.Location = new System.Drawing.Point(298, 172); + this.SetErrorTextBox.Location = new System.Drawing.Point(122, 199); this.SetErrorTextBox.Name = "SetErrorTextBox"; - this.SetErrorTextBox.Size = new System.Drawing.Size(99, 21); + this.SetErrorTextBox.Size = new System.Drawing.Size(95, 21); this.SetErrorTextBox.TabIndex = 22; + this.SetErrorTextBox.Text = "1"; // // label10 // this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(227, 176); + this.label10.Location = new System.Drawing.Point(51, 203); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(65, 12); this.label10.TabIndex = 21; @@ -261,7 +266,7 @@ // // AddButton // - this.AddButton.Location = new System.Drawing.Point(253, 214); + this.AddButton.Location = new System.Drawing.Point(253, 238); this.AddButton.Name = "AddButton"; this.AddButton.Size = new System.Drawing.Size(124, 37); this.AddButton.TabIndex = 23; @@ -287,11 +292,47 @@ this.label11.TabIndex = 24; this.label11.Text = "胶料位置类型:"; // + // SetLayerTextBox2 + // + this.SetLayerTextBox2.Location = new System.Drawing.Point(450, 172); + this.SetLayerTextBox2.Name = "SetLayerTextBox2"; + this.SetLayerTextBox2.Size = new System.Drawing.Size(123, 21); + this.SetLayerTextBox2.TabIndex = 28; + // + // label12 + // + this.label12.AutoSize = true; + this.label12.Location = new System.Drawing.Point(403, 176); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(47, 12); + this.label12.TabIndex = 27; + this.label12.Text = "层数2:"; + // + // SetWidthTextBox2 + // + this.SetWidthTextBox2.Location = new System.Drawing.Point(272, 172); + this.SetWidthTextBox2.Name = "SetWidthTextBox2"; + this.SetWidthTextBox2.Size = new System.Drawing.Size(123, 21); + this.SetWidthTextBox2.TabIndex = 26; + // + // label13 + // + this.label13.AutoSize = true; + this.label13.Location = new System.Drawing.Point(225, 176); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(47, 12); + this.label13.TabIndex = 25; + this.label13.Text = "宽度2:"; + // // AddWeightForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(638, 274); + this.ClientSize = new System.Drawing.Size(638, 294); + this.Controls.Add(this.SetLayerTextBox2); + this.Controls.Add(this.label12); + this.Controls.Add(this.SetWidthTextBox2); + this.Controls.Add(this.label13); this.Controls.Add(this.label11); this.Controls.Add(this.RubTypeCombobox); this.Controls.Add(this.AddButton); @@ -312,6 +353,7 @@ this.Name = "AddWeightForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "添加称量信息"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.AddWeightForm_FormClosing); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.ResumeLayout(false); @@ -346,5 +388,9 @@ private System.Windows.Forms.Button AddButton; private System.Windows.Forms.ComboBox RubTypeCombobox; private System.Windows.Forms.Label label11; + private System.Windows.Forms.TextBox SetLayerTextBox2; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.TextBox SetWidthTextBox2; + private System.Windows.Forms.Label label13; } } \ No newline at end of file diff --git a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/AddWeightForm.cs b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/AddWeightForm.cs index 01e9e12..9a8c1df 100644 --- a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/AddWeightForm.cs +++ b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/AddWeightForm.cs @@ -1,4 +1,5 @@ -using HighWayIot.Repository.service; +using HighWayIot.Repository.domain; +using HighWayIot.Repository.service; using HighWayIot.Winform.Business; using Models; using System; @@ -61,6 +62,8 @@ namespace HighWayIot.Winform.UserControlPages.RecipeConfigPages /// string RecipeCode; + public ZxWeightEntity OutValue { get; set; } = new ZxWeightEntity(); + public AddWeightForm(string recipeCode) { InitializeComponent(); @@ -129,35 +132,49 @@ namespace HighWayIot.Winform.UserControlPages.RecipeConfigPages return; } - if (!decimal.TryParse(SetThicknessTextBox.Text.Trim(), out decimal thickness)) + if (!decimal.TryParse(SetThicknessTextBox.Text.Trim(), out decimal thickness) && !string.IsNullOrEmpty(SetThicknessTextBox.Text.Trim())) { MessageBox.Show("厚度请填入可带小数的阿拉伯数字"); return; } zxWeightEntity.SetThickness = thickness; - if (!decimal.TryParse(SetWidthTextBox.Text.Trim(), out decimal width)) + if (!decimal.TryParse(SetWidthTextBox.Text.Trim(), out decimal width) && !string.IsNullOrEmpty(SetWidthTextBox.Text.Trim())) { MessageBox.Show("宽度请填入可带小数的阿拉伯数字"); return; } zxWeightEntity.SetWidth = width; - if (!int.TryParse(SetLayerTextBox.Text.Trim(), out int layer)) + if (!decimal.TryParse(SetWidthTextBox2.Text.Trim(), out decimal width2) && !string.IsNullOrEmpty(SetWidthTextBox2.Text.Trim())) + { + MessageBox.Show("宽度请填入可带小数的阿拉伯数字"); + return; + } + zxWeightEntity.SetWidth2 = width2; + + if (!int.TryParse(SetLayerTextBox.Text.Trim(), out int layer) && !string.IsNullOrEmpty(SetLayerTextBox.Text.Trim())) { MessageBox.Show("层数请填入整数阿拉伯数字"); return; } zxWeightEntity.SetLayer = layer; - if (!decimal.TryParse(SetWeightTextBox.Text.Trim(), out decimal weight)) + if (!int.TryParse(SetLayerTextBox2.Text.Trim(), out int layer2) && !string.IsNullOrEmpty(SetLayerTextBox2.Text.Trim())) + { + MessageBox.Show("层数请填入整数阿拉伯数字"); + return; + } + zxWeightEntity.SetLayer2 = layer2; + + if (!decimal.TryParse(SetWeightTextBox.Text.Trim(), out decimal weight) && !string.IsNullOrEmpty(SetWeightTextBox.Text.Trim())) { MessageBox.Show("重量请填入可带小数的阿拉伯数字"); return; } zxWeightEntity.SetWeight = weight; - if (!decimal.TryParse(SetErrorTextBox.Text.Trim(), out decimal error)) + if (!decimal.TryParse(SetErrorTextBox.Text.Trim(), out decimal error)&& !string.IsNullOrEmpty(SetErrorTextBox.Text.Trim())) { MessageBox.Show("重量公差请填入可带小数的阿拉伯数字"); return; @@ -173,6 +190,7 @@ namespace HighWayIot.Winform.UserControlPages.RecipeConfigPages MessageBox.Show("称量信息添加失败!请尝试重新添加"); return; } + OutValue = zxWeightEntity; this.Close(); this.Dispose(); @@ -296,5 +314,10 @@ namespace HighWayIot.Winform.UserControlPages.RecipeConfigPages MaterialChildTypeArray = GeneralUtils.HeadAddEmptyString(MaterialChildTypeArray); ChildTypeComboBox.DataSource = MaterialChildTypeArray; } + + private void AddWeightForm_FormClosing(object sender, FormClosingEventArgs e) + { + this.DialogResult = DialogResult.OK; + } } } diff --git a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.Designer.cs b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.Designer.cs index 9091711..82d4171 100644 --- a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.Designer.cs +++ b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.Designer.cs @@ -32,6 +32,18 @@ namespace HighWayIot.Winform.UserControlPages private void InitializeComponent() { this.WeightDataGridView = new System.Windows.Forms.DataGridView(); + this.Id = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.MaterialCode = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.MaterialName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.MaterialType = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.SetThickness = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.SetWidth1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.SetLayer1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.SetWidth2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.SetLayer2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.SetWeight = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.SetError = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.WeightIsUse = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.AddRecipeButton = new System.Windows.Forms.Button(); this.ButtonPanel = new System.Windows.Forms.Panel(); this.SyncDataButton = new System.Windows.Forms.Button(); @@ -88,6 +100,11 @@ namespace HighWayIot.Winform.UserControlPages this.Position2RadioButton = new System.Windows.Forms.RadioButton(); this.Position1RadioButton = new System.Windows.Forms.RadioButton(); this.groupbox5 = new System.Windows.Forms.GroupBox(); + this.Station5MaterialName = new System.Windows.Forms.Label(); + this.Station4MaterialName = new System.Windows.Forms.Label(); + this.Station3MaterialName = new System.Windows.Forms.Label(); + this.Station2MaterialName = new System.Windows.Forms.Label(); + this.Station1MaterialName = new System.Windows.Forms.Label(); this.S2Check = new System.Windows.Forms.CheckBox(); this.label16 = new System.Windows.Forms.Label(); this.PlcSpecNameLabel = new System.Windows.Forms.Label(); @@ -128,16 +145,6 @@ namespace HighWayIot.Winform.UserControlPages this.UpdateWeightButton = new System.Windows.Forms.Button(); this.AddWeightButton = new System.Windows.Forms.Button(); this.DeleteWeightButton = new System.Windows.Forms.Button(); - this.Id = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.MaterialCode = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.MaterialName = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.MaterialType = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.SetThickness = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.SetWidth = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.SetLayer = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.SetWeight = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.SetError = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.WeightIsUse = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.RId = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.RecipeCode = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.RecipeName = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -167,6 +174,8 @@ namespace HighWayIot.Winform.UserControlPages // this.WeightDataGridView.AllowUserToAddRows = false; this.WeightDataGridView.AllowUserToDeleteRows = false; + this.WeightDataGridView.AllowUserToResizeColumns = false; + this.WeightDataGridView.AllowUserToResizeRows = false; this.WeightDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.WeightDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.Id, @@ -174,8 +183,10 @@ namespace HighWayIot.Winform.UserControlPages this.MaterialName, this.MaterialType, this.SetThickness, - this.SetWidth, - this.SetLayer, + this.SetWidth1, + this.SetLayer1, + this.SetWidth2, + this.SetLayer2, this.SetWeight, this.SetError, this.WeightIsUse}); @@ -189,9 +200,110 @@ namespace HighWayIot.Winform.UserControlPages this.WeightDataGridView.TabIndex = 0; this.WeightDataGridView.Tag = ""; // + // Id + // + this.Id.DataPropertyName = "Id"; + this.Id.HeaderText = "ID"; + this.Id.Name = "Id"; + this.Id.ReadOnly = true; + this.Id.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.Id.Width = 40; + // + // MaterialCode + // + this.MaterialCode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.MaterialCode.DataPropertyName = "MaterialCode"; + this.MaterialCode.HeaderText = "胶料编码"; + this.MaterialCode.Name = "MaterialCode"; + this.MaterialCode.ReadOnly = true; + this.MaterialCode.Resizable = System.Windows.Forms.DataGridViewTriState.False; + // + // MaterialName + // + this.MaterialName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.MaterialName.DataPropertyName = "MaterialName"; + this.MaterialName.HeaderText = "胶料名称"; + this.MaterialName.Name = "MaterialName"; + this.MaterialName.ReadOnly = true; + this.MaterialName.Resizable = System.Windows.Forms.DataGridViewTriState.False; + // + // MaterialType + // + this.MaterialType.DataPropertyName = "MaterialType"; + this.MaterialType.HeaderText = "胶料类型"; + this.MaterialType.Name = "MaterialType"; + this.MaterialType.ReadOnly = true; + this.MaterialType.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.MaterialType.Width = 89; + // + // SetThickness + // + this.SetThickness.DataPropertyName = "SetThickness"; + this.SetThickness.HeaderText = "厚度"; + this.SetThickness.Name = "SetThickness"; + this.SetThickness.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.SetThickness.Width = 59; + // + // SetWidth1 + // + this.SetWidth1.DataPropertyName = "SetWidth"; + this.SetWidth1.HeaderText = "宽度1"; + this.SetWidth1.Name = "SetWidth1"; + this.SetWidth1.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.SetWidth1.Width = 60; + // + // SetLayer1 + // + this.SetLayer1.DataPropertyName = "SetLayer"; + this.SetLayer1.HeaderText = "层数1"; + this.SetLayer1.Name = "SetLayer1"; + this.SetLayer1.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.SetLayer1.Width = 60; + // + // SetWidth2 + // + this.SetWidth2.DataPropertyName = "SetWidth2"; + this.SetWidth2.HeaderText = "宽度2"; + this.SetWidth2.Name = "SetWidth2"; + this.SetWidth2.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.SetWidth2.Width = 60; + // + // SetLayer2 + // + this.SetLayer2.DataPropertyName = "SetLayer2"; + this.SetLayer2.HeaderText = "层数2"; + this.SetLayer2.Name = "SetLayer2"; + this.SetLayer2.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.SetLayer2.Width = 60; + // + // SetWeight + // + this.SetWeight.DataPropertyName = "SetWeight"; + this.SetWeight.HeaderText = "重量"; + this.SetWeight.Name = "SetWeight"; + this.SetWeight.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.SetWeight.Width = 70; + // + // SetError + // + this.SetError.DataPropertyName = "SetError"; + this.SetError.HeaderText = "公差"; + this.SetError.Name = "SetError"; + this.SetError.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.SetError.Width = 55; + // + // WeightIsUse + // + this.WeightIsUse.DataPropertyName = "IsUse"; + this.WeightIsUse.HeaderText = "启用"; + this.WeightIsUse.Name = "WeightIsUse"; + this.WeightIsUse.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.WeightIsUse.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.WeightIsUse.Width = 40; + // // AddRecipeButton // - this.AddRecipeButton.Location = new System.Drawing.Point(11, 9); + this.AddRecipeButton.Location = new System.Drawing.Point(11, 12); this.AddRecipeButton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.AddRecipeButton.Name = "AddRecipeButton"; this.AddRecipeButton.Size = new System.Drawing.Size(103, 39); @@ -213,13 +325,13 @@ namespace HighWayIot.Winform.UserControlPages this.ButtonPanel.Location = new System.Drawing.Point(0, 0); this.ButtonPanel.Margin = new System.Windows.Forms.Padding(0); this.ButtonPanel.Name = "ButtonPanel"; - this.ButtonPanel.Size = new System.Drawing.Size(861, 58); + this.ButtonPanel.Size = new System.Drawing.Size(861, 63); this.ButtonPanel.TabIndex = 4; // // SyncDataButton // this.SyncDataButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.SyncDataButton.Location = new System.Drawing.Point(637, 9); + this.SyncDataButton.Location = new System.Drawing.Point(637, 12); this.SyncDataButton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.SyncDataButton.Name = "SyncDataButton"; this.SyncDataButton.Size = new System.Drawing.Size(103, 39); @@ -231,7 +343,7 @@ namespace HighWayIot.Winform.UserControlPages // label26 // this.label26.AutoSize = true; - this.label26.Location = new System.Drawing.Point(338, 9); + this.label26.Location = new System.Drawing.Point(338, 12); this.label26.Name = "label26"; this.label26.Size = new System.Drawing.Size(269, 12); this.label26.TabIndex = 7; @@ -239,7 +351,7 @@ namespace HighWayIot.Winform.UserControlPages // // RefreshRecipeButton // - this.RefreshRecipeButton.Location = new System.Drawing.Point(120, 9); + this.RefreshRecipeButton.Location = new System.Drawing.Point(120, 12); this.RefreshRecipeButton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.RefreshRecipeButton.Name = "RefreshRecipeButton"; this.RefreshRecipeButton.Size = new System.Drawing.Size(103, 39); @@ -250,7 +362,7 @@ namespace HighWayIot.Winform.UserControlPages // // UpdateRecipeButton // - this.UpdateRecipeButton.Location = new System.Drawing.Point(229, 9); + this.UpdateRecipeButton.Location = new System.Drawing.Point(229, 12); this.UpdateRecipeButton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.UpdateRecipeButton.Name = "UpdateRecipeButton"; this.UpdateRecipeButton.Size = new System.Drawing.Size(103, 39); @@ -262,7 +374,7 @@ namespace HighWayIot.Winform.UserControlPages // DeleteRecipeButton // this.DeleteRecipeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.DeleteRecipeButton.Location = new System.Drawing.Point(746, 9); + this.DeleteRecipeButton.Location = new System.Drawing.Point(746, 12); this.DeleteRecipeButton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.DeleteRecipeButton.Name = "DeleteRecipeButton"; this.DeleteRecipeButton.Size = new System.Drawing.Size(103, 39); @@ -299,6 +411,8 @@ namespace HighWayIot.Winform.UserControlPages // this.RecipeDataGridView.AllowUserToAddRows = false; this.RecipeDataGridView.AllowUserToDeleteRows = false; + this.RecipeDataGridView.AllowUserToResizeColumns = false; + this.RecipeDataGridView.AllowUserToResizeRows = false; this.RecipeDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.RecipeDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.RId, @@ -344,7 +458,7 @@ namespace HighWayIot.Winform.UserControlPages this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.groupBox3.Controls.Add(this.tableLayoutPanel3); - this.groupBox3.Location = new System.Drawing.Point(0, 63); + this.groupBox3.Location = new System.Drawing.Point(0, 0); this.groupBox3.Margin = new System.Windows.Forms.Padding(0); this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new System.Drawing.Size(1722, 190); @@ -591,11 +705,11 @@ namespace HighWayIot.Winform.UserControlPages // label7 // this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(383, 114); + this.label7.Location = new System.Drawing.Point(377, 114); this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(89, 12); + this.label7.Size = new System.Drawing.Size(95, 12); this.label7.TabIndex = 26; - this.label7.Text = "纵裁刀宽度(mm)"; + this.label7.Text = "纵裁刀宽度1(mm)"; // // E9TextBox // @@ -623,11 +737,11 @@ namespace HighWayIot.Winform.UserControlPages // label9 // this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(437, 60); + this.label9.Location = new System.Drawing.Point(377, 60); this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(35, 12); + this.label9.Size = new System.Drawing.Size(95, 12); this.label9.TabIndex = 22; - this.label9.Text = "备用2"; + this.label9.Text = "纵裁刀宽度2(mm)"; // // E7TextBox // @@ -639,11 +753,11 @@ namespace HighWayIot.Winform.UserControlPages // label10 // this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(437, 33); + this.label10.Location = new System.Drawing.Point(413, 32); this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(35, 12); + this.label10.Size = new System.Drawing.Size(59, 12); this.label10.TabIndex = 20; - this.label10.Text = "备用1"; + this.label10.Text = "贴合层数2"; // // E6TextBox // @@ -655,11 +769,11 @@ namespace HighWayIot.Winform.UserControlPages // label5 // this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(188, 138); + this.label5.Location = new System.Drawing.Point(182, 138); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(53, 12); + this.label5.Size = new System.Drawing.Size(59, 12); this.label5.TabIndex = 18; - this.label5.Text = "贴合层数"; + this.label5.Text = "贴合层数1"; // // E5TextBox // @@ -813,6 +927,11 @@ namespace HighWayIot.Winform.UserControlPages // // groupbox5 // + this.groupbox5.Controls.Add(this.Station5MaterialName); + this.groupbox5.Controls.Add(this.Station4MaterialName); + this.groupbox5.Controls.Add(this.Station3MaterialName); + this.groupbox5.Controls.Add(this.Station2MaterialName); + this.groupbox5.Controls.Add(this.Station1MaterialName); this.groupbox5.Controls.Add(this.S2Check); this.groupbox5.Controls.Add(this.label16); this.groupbox5.Controls.Add(this.PlcSpecNameLabel); @@ -855,10 +974,55 @@ namespace HighWayIot.Winform.UserControlPages this.groupbox5.TabStop = false; this.groupbox5.Text = "公共参数"; // + // Station5MaterialName + // + this.Station5MaterialName.AutoSize = true; + this.Station5MaterialName.Location = new System.Drawing.Point(16, 139); + this.Station5MaterialName.Name = "Station5MaterialName"; + this.Station5MaterialName.Size = new System.Drawing.Size(89, 12); + this.Station5MaterialName.TabIndex = 75; + this.Station5MaterialName.Text = "5#工位物料名称"; + // + // Station4MaterialName + // + this.Station4MaterialName.AutoSize = true; + this.Station4MaterialName.Location = new System.Drawing.Point(16, 113); + this.Station4MaterialName.Name = "Station4MaterialName"; + this.Station4MaterialName.Size = new System.Drawing.Size(89, 12); + this.Station4MaterialName.TabIndex = 74; + this.Station4MaterialName.Text = "4#工位物料名称"; + // + // Station3MaterialName + // + this.Station3MaterialName.AutoSize = true; + this.Station3MaterialName.Location = new System.Drawing.Point(16, 87); + this.Station3MaterialName.Name = "Station3MaterialName"; + this.Station3MaterialName.Size = new System.Drawing.Size(89, 12); + this.Station3MaterialName.TabIndex = 73; + this.Station3MaterialName.Text = "3#工位物料名称"; + // + // Station2MaterialName + // + this.Station2MaterialName.AutoSize = true; + this.Station2MaterialName.Location = new System.Drawing.Point(16, 61); + this.Station2MaterialName.Name = "Station2MaterialName"; + this.Station2MaterialName.Size = new System.Drawing.Size(89, 12); + this.Station2MaterialName.TabIndex = 72; + this.Station2MaterialName.Text = "2#工位物料名称"; + // + // Station1MaterialName + // + this.Station1MaterialName.AutoSize = true; + this.Station1MaterialName.Location = new System.Drawing.Point(16, 35); + this.Station1MaterialName.Name = "Station1MaterialName"; + this.Station1MaterialName.Size = new System.Drawing.Size(89, 12); + this.Station1MaterialName.TabIndex = 71; + this.Station1MaterialName.Text = "1#工位物料名称"; + // // S2Check // this.S2Check.AutoSize = true; - this.S2Check.Location = new System.Drawing.Point(95, 56); + this.S2Check.Location = new System.Drawing.Point(157, 35); this.S2Check.Margin = new System.Windows.Forms.Padding(6); this.S2Check.Name = "S2Check"; this.S2Check.Size = new System.Drawing.Size(15, 14); @@ -868,7 +1032,7 @@ namespace HighWayIot.Winform.UserControlPages // label16 // this.label16.AutoSize = true; - this.label16.Location = new System.Drawing.Point(93, 32); + this.label16.Location = new System.Drawing.Point(131, 36); this.label16.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6); this.label16.Name = "label16"; this.label16.Size = new System.Drawing.Size(17, 12); @@ -893,7 +1057,7 @@ namespace HighWayIot.Winform.UserControlPages this.label34.Name = "label34"; this.label34.Size = new System.Drawing.Size(83, 12); this.label34.TabIndex = 67; - this.label34.Text = "PLC规格名称:"; + this.label34.Text = "PLC标称尺度:"; // // PlcSpecNoLabel // @@ -911,14 +1075,14 @@ namespace HighWayIot.Winform.UserControlPages this.label32.Font = new System.Drawing.Font("宋体", 9F); this.label32.Location = new System.Drawing.Point(437, 121); this.label32.Name = "label32"; - this.label32.Size = new System.Drawing.Size(71, 12); + this.label32.Size = new System.Drawing.Size(83, 12); this.label32.TabIndex = 65; - this.label32.Text = "PLC规格号:"; + this.label32.Text = "PLC成品代号:"; // // label30 // this.label30.AutoSize = true; - this.label30.Location = new System.Drawing.Point(202, 32); + this.label30.Location = new System.Drawing.Point(131, 139); this.label30.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6); this.label30.Name = "label30"; this.label30.Size = new System.Drawing.Size(17, 12); @@ -928,7 +1092,7 @@ namespace HighWayIot.Winform.UserControlPages // label31 // this.label31.AutoSize = true; - this.label31.Location = new System.Drawing.Point(175, 32); + this.label31.Location = new System.Drawing.Point(131, 113); this.label31.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6); this.label31.Name = "label31"; this.label31.Size = new System.Drawing.Size(17, 12); @@ -938,7 +1102,7 @@ namespace HighWayIot.Winform.UserControlPages // label29 // this.label29.AutoSize = true; - this.label29.Location = new System.Drawing.Point(148, 32); + this.label29.Location = new System.Drawing.Point(131, 88); this.label29.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6); this.label29.Name = "label29"; this.label29.Size = new System.Drawing.Size(17, 12); @@ -948,7 +1112,7 @@ namespace HighWayIot.Winform.UserControlPages // label28 // this.label28.AutoSize = true; - this.label28.Location = new System.Drawing.Point(121, 32); + this.label28.Location = new System.Drawing.Point(131, 62); this.label28.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6); this.label28.Name = "label28"; this.label28.Size = new System.Drawing.Size(17, 12); @@ -958,7 +1122,7 @@ namespace HighWayIot.Winform.UserControlPages // label22 // this.label22.AutoSize = true; - this.label22.Location = new System.Drawing.Point(27, 83); + this.label22.Location = new System.Drawing.Point(181, 62); this.label22.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6); this.label22.Name = "label22"; this.label22.Size = new System.Drawing.Size(53, 12); @@ -968,7 +1132,7 @@ namespace HighWayIot.Winform.UserControlPages // label21 // this.label21.AutoSize = true; - this.label21.Location = new System.Drawing.Point(27, 57); + this.label21.Location = new System.Drawing.Point(131, 12); this.label21.Margin = new System.Windows.Forms.Padding(3, 6, 3, 6); this.label21.Name = "label21"; this.label21.Size = new System.Drawing.Size(53, 12); @@ -987,7 +1151,7 @@ namespace HighWayIot.Winform.UserControlPages // S8Check // this.S8Check.AutoSize = true; - this.S8Check.Location = new System.Drawing.Point(177, 82); + this.S8Check.Location = new System.Drawing.Point(202, 113); this.S8Check.Margin = new System.Windows.Forms.Padding(6); this.S8Check.Name = "S8Check"; this.S8Check.Size = new System.Drawing.Size(15, 14); @@ -997,7 +1161,7 @@ namespace HighWayIot.Winform.UserControlPages // S9Check // this.S9Check.AutoSize = true; - this.S9Check.Location = new System.Drawing.Point(204, 82); + this.S9Check.Location = new System.Drawing.Point(202, 139); this.S9Check.Margin = new System.Windows.Forms.Padding(6); this.S9Check.Name = "S9Check"; this.S9Check.Size = new System.Drawing.Size(15, 14); @@ -1007,7 +1171,7 @@ namespace HighWayIot.Winform.UserControlPages // S5Check // this.S5Check.AutoSize = true; - this.S5Check.Location = new System.Drawing.Point(177, 56); + this.S5Check.Location = new System.Drawing.Point(157, 113); this.S5Check.Margin = new System.Windows.Forms.Padding(6); this.S5Check.Name = "S5Check"; this.S5Check.Size = new System.Drawing.Size(15, 14); @@ -1033,7 +1197,7 @@ namespace HighWayIot.Winform.UserControlPages // S7Check // this.S7Check.AutoSize = true; - this.S7Check.Location = new System.Drawing.Point(150, 82); + this.S7Check.Location = new System.Drawing.Point(202, 87); this.S7Check.Margin = new System.Windows.Forms.Padding(6); this.S7Check.Name = "S7Check"; this.S7Check.Size = new System.Drawing.Size(15, 14); @@ -1050,7 +1214,7 @@ namespace HighWayIot.Winform.UserControlPages // S4Check // this.S4Check.AutoSize = true; - this.S4Check.Location = new System.Drawing.Point(150, 56); + this.S4Check.Location = new System.Drawing.Point(157, 87); this.S4Check.Margin = new System.Windows.Forms.Padding(6); this.S4Check.Name = "S4Check"; this.S4Check.Size = new System.Drawing.Size(15, 14); @@ -1076,7 +1240,7 @@ namespace HighWayIot.Winform.UserControlPages // S6Check // this.S6Check.AutoSize = true; - this.S6Check.Location = new System.Drawing.Point(204, 56); + this.S6Check.Location = new System.Drawing.Point(157, 139); this.S6Check.Margin = new System.Windows.Forms.Padding(6); this.S6Check.Name = "S6Check"; this.S6Check.Size = new System.Drawing.Size(15, 14); @@ -1095,7 +1259,7 @@ namespace HighWayIot.Winform.UserControlPages // S3Check // this.S3Check.AutoSize = true; - this.S3Check.Location = new System.Drawing.Point(123, 56); + this.S3Check.Location = new System.Drawing.Point(157, 61); this.S3Check.Margin = new System.Windows.Forms.Padding(6); this.S3Check.Name = "S3Check"; this.S3Check.Size = new System.Drawing.Size(15, 14); @@ -1141,9 +1305,9 @@ namespace HighWayIot.Winform.UserControlPages this.label18.Font = new System.Drawing.Font("宋体", 12F); this.label18.Location = new System.Drawing.Point(436, 28); this.label18.Name = "label18"; - this.label18.Size = new System.Drawing.Size(71, 16); + this.label18.Size = new System.Drawing.Size(87, 16); this.label18.TabIndex = 43; - this.label18.Text = "规格号:"; + this.label18.Text = "成品代号:"; // // SpecNoLabel // @@ -1163,7 +1327,7 @@ namespace HighWayIot.Winform.UserControlPages this.label19.Name = "label19"; this.label19.Size = new System.Drawing.Size(87, 16); this.label19.TabIndex = 44; - this.label19.Text = "规格名称:"; + this.label19.Text = "标称尺度:"; // // tableLayoutPanel2 // @@ -1174,7 +1338,7 @@ namespace HighWayIot.Winform.UserControlPages this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tableLayoutPanel2.Controls.Add(this.panel1, 1, 0); this.tableLayoutPanel2.Controls.Add(this.ButtonPanel, 0, 0); - this.tableLayoutPanel2.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel2.Location = new System.Drawing.Point(0, 190); this.tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanel2.Name = "tableLayoutPanel2"; this.tableLayoutPanel2.RowCount = 1; @@ -1194,13 +1358,13 @@ namespace HighWayIot.Winform.UserControlPages this.panel1.Location = new System.Drawing.Point(861, 0); this.panel1.Margin = new System.Windows.Forms.Padding(0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(861, 58); + this.panel1.Size = new System.Drawing.Size(861, 63); this.panel1.TabIndex = 5; // // label27 // this.label27.AutoSize = true; - this.label27.Location = new System.Drawing.Point(338, 9); + this.label27.Location = new System.Drawing.Point(338, 12); this.label27.Name = "label27"; this.label27.Size = new System.Drawing.Size(269, 12); this.label27.TabIndex = 8; @@ -1208,7 +1372,7 @@ namespace HighWayIot.Winform.UserControlPages // // RefreshWeightButton // - this.RefreshWeightButton.Location = new System.Drawing.Point(120, 9); + this.RefreshWeightButton.Location = new System.Drawing.Point(120, 12); this.RefreshWeightButton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.RefreshWeightButton.Name = "RefreshWeightButton"; this.RefreshWeightButton.Size = new System.Drawing.Size(103, 39); @@ -1219,7 +1383,7 @@ namespace HighWayIot.Winform.UserControlPages // // UpdateWeightButton // - this.UpdateWeightButton.Location = new System.Drawing.Point(229, 9); + this.UpdateWeightButton.Location = new System.Drawing.Point(229, 12); this.UpdateWeightButton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.UpdateWeightButton.Name = "UpdateWeightButton"; this.UpdateWeightButton.Size = new System.Drawing.Size(103, 39); @@ -1230,7 +1394,7 @@ namespace HighWayIot.Winform.UserControlPages // // AddWeightButton // - this.AddWeightButton.Location = new System.Drawing.Point(11, 9); + this.AddWeightButton.Location = new System.Drawing.Point(11, 12); this.AddWeightButton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.AddWeightButton.Name = "AddWeightButton"; this.AddWeightButton.Size = new System.Drawing.Size(103, 39); @@ -1242,7 +1406,7 @@ namespace HighWayIot.Winform.UserControlPages // DeleteWeightButton // this.DeleteWeightButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.DeleteWeightButton.Location = new System.Drawing.Point(746, 9); + this.DeleteWeightButton.Location = new System.Drawing.Point(746, 12); this.DeleteWeightButton.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.DeleteWeightButton.Name = "DeleteWeightButton"; this.DeleteWeightButton.Size = new System.Drawing.Size(103, 39); @@ -1251,148 +1415,85 @@ namespace HighWayIot.Winform.UserControlPages this.DeleteWeightButton.UseVisualStyleBackColor = true; this.DeleteWeightButton.Click += new System.EventHandler(this.DeleteWeightButton_Click); // - // Id - // - this.Id.DataPropertyName = "Id"; - this.Id.HeaderText = "ID"; - this.Id.Name = "Id"; - this.Id.ReadOnly = true; - this.Id.Width = 40; - // - // MaterialCode - // - this.MaterialCode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.MaterialCode.DataPropertyName = "MaterialCode"; - this.MaterialCode.HeaderText = "胶料编码"; - this.MaterialCode.Name = "MaterialCode"; - this.MaterialCode.ReadOnly = true; - this.MaterialCode.Resizable = System.Windows.Forms.DataGridViewTriState.True; - // - // MaterialName - // - this.MaterialName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.MaterialName.DataPropertyName = "MaterialName"; - this.MaterialName.HeaderText = "胶料名称"; - this.MaterialName.Name = "MaterialName"; - this.MaterialName.ReadOnly = true; - // - // MaterialType - // - this.MaterialType.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.MaterialType.DataPropertyName = "MaterialType"; - this.MaterialType.HeaderText = "胶料类型"; - this.MaterialType.Name = "MaterialType"; - this.MaterialType.ReadOnly = true; - this.MaterialType.Resizable = System.Windows.Forms.DataGridViewTriState.True; - // - // SetThickness - // - this.SetThickness.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.SetThickness.DataPropertyName = "SetThickness"; - this.SetThickness.HeaderText = "厚度"; - this.SetThickness.Name = "SetThickness"; - // - // SetWidth - // - this.SetWidth.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.SetWidth.DataPropertyName = "SetWidth"; - this.SetWidth.HeaderText = "宽度"; - this.SetWidth.Name = "SetWidth"; - // - // SetLayer - // - this.SetLayer.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.SetLayer.DataPropertyName = "SetLayer"; - this.SetLayer.HeaderText = "层数"; - this.SetLayer.Name = "SetLayer"; - // - // SetWeight - // - this.SetWeight.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.SetWeight.DataPropertyName = "SetWeight"; - this.SetWeight.HeaderText = "重量"; - this.SetWeight.Name = "SetWeight"; - // - // SetError - // - this.SetError.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.SetError.DataPropertyName = "SetError"; - this.SetError.HeaderText = "公差"; - this.SetError.Name = "SetError"; - // - // WeightIsUse - // - this.WeightIsUse.DataPropertyName = "IsUse"; - this.WeightIsUse.HeaderText = "启用"; - this.WeightIsUse.Name = "WeightIsUse"; - this.WeightIsUse.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.WeightIsUse.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.WeightIsUse.Width = 40; - // // RId // this.RId.DataPropertyName = "Id"; this.RId.HeaderText = "ID"; this.RId.Name = "RId"; this.RId.ReadOnly = true; + this.RId.Resizable = System.Windows.Forms.DataGridViewTriState.False; this.RId.Width = 40; // // RecipeCode // - this.RecipeCode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.RecipeCode.DataPropertyName = "RecipeCode"; - this.RecipeCode.HeaderText = "配方编号"; + this.RecipeCode.FillWeight = 52.74404F; + this.RecipeCode.HeaderText = "成品代号"; this.RecipeCode.Name = "RecipeCode"; this.RecipeCode.ReadOnly = true; + this.RecipeCode.Resizable = System.Windows.Forms.DataGridViewTriState.False; // // RecipeName // this.RecipeName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.RecipeName.DataPropertyName = "RecipeName"; + this.RecipeName.FillWeight = 52.74404F; this.RecipeName.HeaderText = "标称尺度"; this.RecipeName.Name = "RecipeName"; + this.RecipeName.ReadOnly = true; + this.RecipeName.Resizable = System.Windows.Forms.DataGridViewTriState.False; // // RecipeSpecCode // - this.RecipeSpecCode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.RecipeSpecCode.DataPropertyName = "RecipeSpecCode"; + this.RecipeSpecCode.FillWeight = 52.74404F; this.RecipeSpecCode.HeaderText = "SPEC编号"; this.RecipeSpecCode.Name = "RecipeSpecCode"; + this.RecipeSpecCode.ReadOnly = true; + this.RecipeSpecCode.Resizable = System.Windows.Forms.DataGridViewTriState.False; // // RecipeSpecName // this.RecipeSpecName.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.RecipeSpecName.DataPropertyName = "RecipeSpecName"; + this.RecipeSpecName.FillWeight = 52.74404F; this.RecipeSpecName.HeaderText = "SPEC名称"; this.RecipeSpecName.Name = "RecipeSpecName"; + this.RecipeSpecName.ReadOnly = true; + this.RecipeSpecName.Resizable = System.Windows.Forms.DataGridViewTriState.False; // // SizeKind // - this.SizeKind.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.SizeKind.DataPropertyName = "SizeKind"; + this.SizeKind.FillWeight = 52.74404F; this.SizeKind.HeaderText = "寸别"; this.SizeKind.Name = "SizeKind"; + this.SizeKind.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.SizeKind.Width = 55; // // FixedWidth // - this.FixedWidth.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.FixedWidth.DataPropertyName = "FixedWidth"; + this.FixedWidth.FillWeight = 137.1345F; this.FixedWidth.HeaderText = "固定胶宽度"; this.FixedWidth.Name = "FixedWidth"; + this.FixedWidth.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.FixedWidth.Width = 90; // // WeightError // - this.WeightError.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.WeightError.DataPropertyName = "WeightError"; this.WeightError.HeaderText = "重量公差"; this.WeightError.Name = "WeightError"; + this.WeightError.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.WeightError.Width = 79; // // IsUse // this.IsUse.DataPropertyName = "IsUse"; this.IsUse.HeaderText = "启用"; this.IsUse.Name = "IsUse"; - this.IsUse.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.IsUse.Resizable = System.Windows.Forms.DataGridViewTriState.False; this.IsUse.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; this.IsUse.Width = 40; // @@ -1530,13 +1631,20 @@ namespace HighWayIot.Winform.UserControlPages private Button SyncDataButton; private Label label26; private Label label27; + private Label Station5MaterialName; + private Label Station4MaterialName; + private Label Station3MaterialName; + private Label Station2MaterialName; + private Label Station1MaterialName; private DataGridViewTextBoxColumn Id; private DataGridViewTextBoxColumn MaterialCode; private DataGridViewTextBoxColumn MaterialName; private DataGridViewTextBoxColumn MaterialType; private DataGridViewTextBoxColumn SetThickness; - private DataGridViewTextBoxColumn SetWidth; - private DataGridViewTextBoxColumn SetLayer; + private DataGridViewTextBoxColumn SetWidth1; + private DataGridViewTextBoxColumn SetLayer1; + private DataGridViewTextBoxColumn SetWidth2; + private DataGridViewTextBoxColumn SetLayer2; private DataGridViewTextBoxColumn SetWeight; private DataGridViewTextBoxColumn SetError; private DataGridViewCheckBoxColumn WeightIsUse; diff --git a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.cs b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.cs index 8c309ec..f58f2df 100644 --- a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.cs +++ b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.cs @@ -55,6 +55,16 @@ namespace HighWayIot.Winform.UserControlPages /// private ZxMesPlanTransferService zxMesPlanTransferService = ZxMesPlanTransferService.Instance; + /// + /// 开炼机胶料配置 + /// + private ZxOpenMixMaterialService zxOpenMixMaterialService = ZxOpenMixMaterialService.Instance; + + /// + /// 开炼机胶料配置列表 + /// + private List openMixConfig; + /// /// 配方同步实体类 /// @@ -128,14 +138,22 @@ namespace HighWayIot.Winform.UserControlPages NowRecipeCode = RecipeDataGridView.Rows[0].Cells["RecipeCode"].Value.ToString(); InitPositionEntities(); - if (PlcConnect.IsConnect1 == true) + + if (PlcConnect.IsConnect2) { //读取SPEC编号 - PlcSpecNoLabel.Text = PlcConnect.ReadUInt321("D206").ToString(); - + PlcSpecNoLabel.Text = PlcConnect.ReadUInt322("D206").ToString(); //读取SPEC名称 - PlcSpecNameLabel.Text = PlcConnect.ReadString1("D290", 10).Trim(); + PlcSpecNameLabel.Text = PlcConnect.ReadString2("D290", 10).Trim(); } + + openMixConfig = zxOpenMixMaterialService.GetInfos(); + Station1MaterialName.Text = openMixConfig.Single(x => x.StationNo == 1).MaterialName; + Station2MaterialName.Text = openMixConfig.Single(x => x.StationNo == 2).MaterialName; + Station3MaterialName.Text = openMixConfig.Single(x => x.StationNo == 3).MaterialName; + Station4MaterialName.Text = openMixConfig.Single(x => x.StationNo == 4).MaterialName; + Station5MaterialName.Text = openMixConfig.Single(x => x.StationNo == 5).MaterialName; + } #region 配方信息 @@ -152,9 +170,6 @@ namespace HighWayIot.Winform.UserControlPages SpecNoLabel.Text = RecipeDataGridView.Rows[a].Cells["RecipeSpecCode"].Value.ToString(); SpecNameLabel.Text = RecipeDataGridView.Rows[a].Cells["RecipeSpecName"].Value.ToString(); - //初始化工位参数类 - InitPositionEntities(); - WeightLists = zxWeightService.GetWeightInfos(NowRecipeCode); //WeightToDataSource(); @@ -162,44 +177,7 @@ namespace HighWayIot.Winform.UserControlPages WeightDataGridView.DataSource = null; WeightDataGridView.DataSource = WeightLists; - //设置参数 - var paraData = zxRecipeParaService.GetRecipeParaInfoByRecipeCode(NowRecipeCode); - int flag = GetSelectIndex(); - var positionParaData = zxRecipePositionParaService.GetRecipePositionParaInfos(x => x.RecipeCode == NowRecipeCode); - - //没有就全0 - if (paraData.Count == 0) - { - SetPublicParaValue(new ZxRecipeParaEntity()); - zxRecipeParaEntity = new ZxRecipeParaEntity(); - } - //有就显示 - else if (paraData.Count == 1) - { - SetPublicParaValue(paraData[0]); - zxRecipeParaEntity = paraData[0]; - } - //有多条设为第一条 - else - { - MessageBox.Show("存在多条未删除的相同公共配方字段信息!将设置为第一条。点击清除脏数据"); - SetPublicParaValue(paraData[0]); - zxRecipeParaEntity = paraData[0]; - } - - //没有就全0 - if (positionParaData.Count == 0) - { - SetPrivateParaValue(new ZxRecipePositionParaEntity()); - } - else - { - foreach (var item in positionParaData) - { - ChangePositionEntities(item); - } - SetPrivateParaValue(zxRecipePositionParaEntity.Where(x => x.Position == flag).FirstOrDefault()); - } + ParaRefresh(); } /// @@ -210,10 +188,28 @@ namespace HighWayIot.Winform.UserControlPages private void AddRecipeButton_Click(object sender, EventArgs e) { AddRecipeForm form = new AddRecipeForm(); - form.ShowDialog(); - RecipeLists = zxRecipeService.GetRecipeInfos(); - RecipeDataGridView.DataSource = null; - RecipeDataGridView.DataSource = RecipeLists; + if (form.ShowDialog() == DialogResult.OK) + { + if(form.CloseValue == null) + { + return; + } + //PLC字段更新 + ZxRecipeParaEntity paraEntity = new ZxRecipeParaEntity() + { + SpecCode = form.CloseValue.RecipeSpecCode, + SpecName = form.CloseValue.RecipeSpecName, + RecipeCode = form.CloseValue.RecipeCode, + LightWidth = (int)form.CloseValue.FixedWidth, + RimInch = (int)form.CloseValue.SizeKind, + }; + zxRecipeParaService.InsertRecipeParaInfo(paraEntity); + + RecipeLists = zxRecipeService.GetRecipeInfos(); + RecipeDataGridView.DataSource = null; + RecipeDataGridView.DataSource = RecipeLists; + } + } /// @@ -257,6 +253,25 @@ namespace HighWayIot.Winform.UserControlPages } } + //删除硫化配方防止报错 + List schedulingEntity = ZxSchedulingService.Instance.GetSchedulingInfo(); + var updateInfos = schedulingEntity.Where(x => x.RecipeCode1 == NowRecipeCode || x.RecipeCode2 == NowRecipeCode).ToList(); + foreach (var entity in updateInfos) + { + if (entity.RecipeCode1 == NowRecipeCode) + { + entity.RecipeCode1 = string.Empty; + entity.RecipeName1 = string.Empty; + } + + if (entity.RecipeCode2 == NowRecipeCode) + { + entity.RecipeCode2 = string.Empty; + entity.RecipeName2 = string.Empty; + } + } + ZxSchedulingService.Instance.UpdateSchedulingInfo(updateInfos); + if (zxRecipeService.DeleteRecipeInfoById(id)) { MessageBox.Show("配方信息删除成功!"); @@ -295,10 +310,10 @@ namespace HighWayIot.Winform.UserControlPages entity.RecipeName = nowRow.Cells["RecipeName"].Value.ToString().Trim(); entity.RecipeSpecCode = nowRow.Cells["RecipeSpecCode"].Value.ToString().Trim(); entity.RecipeSpecName = nowRow.Cells["RecipeSpecName"].Value.ToString().Trim(); - entity.SizeKind = int.Parse(nowRow.Cells["SizeKind"].Value.ToString().Trim()); - entity.FixedWidth = decimal.Parse(nowRow.Cells["FixedWidth"].Value.ToString().Trim()); - entity.WeightError = int.Parse(nowRow.Cells["WeightError"].Value.ToString().Trim()); - entity.IsUse = bool.Parse(nowRow.Cells["IsUse"].Value.ToString().Trim()); + entity.SizeKind = int.Parse(Convert.ToString(nowRow.Cells["SizeKind"].Value) ?? "0"); + entity.FixedWidth = decimal.Parse(Convert.ToString(nowRow.Cells["FixedWidth"].Value) ?? "0"); + entity.WeightError = int.Parse(Convert.ToString(nowRow.Cells["WeightError"].Value) ?? "0"); + entity.IsUse = bool.Parse(Convert.ToString(nowRow.Cells["IsUse"].Value) ?? "0"); entity.IsDeleted = false; } catch (Exception ex) @@ -309,6 +324,11 @@ namespace HighWayIot.Winform.UserControlPages if (zxRecipeService.UpdateRecipeInfo(entity)) { + //PLC字段更新 + ZxRecipeParaEntity paraentity = zxRecipeParaService.GetRecipeParaInfoByRecipeCode(entity.RecipeCode).FirstOrDefault(); + paraentity.RimInch = entity.SizeKind; + paraentity.LightWidth = (int)entity.FixedWidth; + zxRecipeParaService.UpdateRecipeParaInfo(paraentity); MessageBox.Show("配方更新成功!"); } else @@ -352,7 +372,50 @@ namespace HighWayIot.Winform.UserControlPages } AddWeightForm form = new AddWeightForm(NowRecipeCode); - form.ShowDialog(); + if (form.ShowDialog() == DialogResult.OK) + { + if (form.OutValue == null) + { + return; + } + //连同更新PLC字段信息 + var config = openMixConfig.Where(x => x.MaterialName == form.OutValue.MaterialName).FirstOrDefault(); + if (config != null) + { + //更新公众参数 + ZxRecipeParaEntity recipePara = zxRecipeParaService.GetRecipeParaInfoByRecipeCode(form.OutValue.RecipeCode).FirstOrDefault(); + var prop = recipePara.GetType().GetProperty($"S{config.StationNo + 1}"); + prop.SetValue(recipePara, true); + zxRecipeParaService.UpdateRecipeParaInfo(recipePara); + //更新字段 + var positionInfo = zxRecipePositionParaService.GetRecipePositionParaInfos(x => x.Position == config.StationNo && x.RecipeCode == NowRecipeCode); + if(positionInfo.Count == 0) + { + ZxRecipePositionParaEntity zxRecipePositionParaEntity = new ZxRecipePositionParaEntity() + { + RecipeCode = NowRecipeCode, + Position = config.StationNo, + E5 = form.OutValue.SetLayer, + E9 = (int)form.OutValue.SetWidth, + E6 = form.OutValue.SetLayer2, + E7 = (int)form.OutValue.SetWidth2, + }; + zxRecipePositionParaService.InsertRecipePositionParaInfo(zxRecipePositionParaEntity); + } + else + { + var entity = positionInfo.FirstOrDefault(); + entity.E5 = form.OutValue.SetLayer; + entity.E9 = (int)form.OutValue.SetWidth; + entity.E6 = form.OutValue.SetLayer2; + entity.E7 = (int)form.OutValue.SetWidth2; + zxRecipePositionParaService.UpdateRecipePositionParaInfo(entity); + } + } + } + + ParaRefresh(); + WeightLists = zxWeightService.GetWeightInfos(NowRecipeCode); //WeightToDataSource(); @@ -429,12 +492,14 @@ namespace HighWayIot.Winform.UserControlPages entity.MaterialCode = nowRow.Cells["MaterialCode"].Value.ToString().Trim(); entity.MaterialName = nowRow.Cells["MaterialName"].Value.ToString().Trim(); entity.MaterialType = nowRow.Cells["MaterialType"].Value.ToString().Trim(); - entity.SetThickness = decimal.Parse(nowRow.Cells["SetThickness"].Value.ToString().Trim()); - entity.SetWidth = decimal.Parse(nowRow.Cells["SetWidth"].Value.ToString().Trim()); - entity.SetLayer = int.Parse(nowRow.Cells["SetLayer"].Value.ToString().Trim()); - entity.SetWeight = decimal.Parse(nowRow.Cells["SetWeight"].Value.ToString().Trim()); - entity.SetError = decimal.Parse(nowRow.Cells["SetError"].Value.ToString().Trim()); - entity.IsUse = bool.Parse(nowRow.Cells["WeightIsUse"].Value.ToString().Trim()); + entity.SetThickness = decimal.Parse(Convert.ToString(nowRow.Cells["SetThickness"].Value ?? "0")); + entity.SetWidth = decimal.Parse(Convert.ToString(nowRow.Cells["SetWidth1"].Value ?? "0")); + entity.SetWidth2 = decimal.Parse(Convert.ToString(nowRow.Cells["SetWidth2"].Value ?? "0")); + entity.SetLayer = int.Parse(Convert.ToString(nowRow.Cells["SetLayer1"].Value ?? "0")); + entity.SetLayer2 = int.Parse(Convert.ToString(nowRow.Cells["SetLayer2"].Value ?? "0")); + entity.SetWeight = decimal.Parse(Convert.ToString(nowRow.Cells["SetWeight"].Value ?? "0")); + entity.SetError = decimal.Parse(Convert.ToString(nowRow.Cells["SetError"].Value ?? "0")); + entity.IsUse = bool.Parse(Convert.ToString(nowRow.Cells["WeightIsUse"].Value)); entity.IsDeleted = false; } catch (Exception ex) @@ -445,6 +510,34 @@ namespace HighWayIot.Winform.UserControlPages if (zxWeightService.UpdateWeightInfo(entity)) { + //连同更新PLC字段信息 + var config = openMixConfig.Where(x => x.MaterialName == entity.MaterialName).FirstOrDefault(); + if (config != null) + { + var positionInfo = zxRecipePositionParaService.GetRecipePositionParaInfos(x => x.Position == config.StationNo && x.RecipeCode == NowRecipeCode); + if (positionInfo.Count == 0) + { + ZxRecipePositionParaEntity zxRecipePositionParaEntity = new ZxRecipePositionParaEntity() + { + RecipeCode = NowRecipeCode, + Position = config.StationNo, + E5 = entity.SetLayer, + E9 = (int)entity.SetWidth, + E6 = entity.SetLayer2, + E7 = (int)entity.SetWidth2, + }; + zxRecipePositionParaService.InsertRecipePositionParaInfo(zxRecipePositionParaEntity); + } + else + { + var positionEntity = positionInfo.FirstOrDefault(); + positionEntity.E5 = entity.SetLayer; + positionEntity.E9 = (int)entity.SetWidth; + positionEntity.E6 = entity.SetLayer2; + positionEntity.E7 = (int)entity.SetWidth2; + zxRecipePositionParaService.UpdateRecipePositionParaInfo(positionEntity); + } + } MessageBox.Show("称量信息更新成功!"); } else @@ -452,6 +545,8 @@ namespace HighWayIot.Winform.UserControlPages MessageBox.Show("称量信息更新失败!"); } + ParaRefresh(); + WeightLists = zxWeightService.GetWeightInfos(NowRecipeCode); //WeightToDataSource(); @@ -524,6 +619,54 @@ namespace HighWayIot.Winform.UserControlPages #region 参数设置 + /// + /// 参数刷新 + /// + private void ParaRefresh() + { + //初始化工位参数类 + InitPositionEntities(); + + //设置参数 + var paraData = zxRecipeParaService.GetRecipeParaInfoByRecipeCode(NowRecipeCode); + int flag = GetSelectIndex(); + var positionParaData = zxRecipePositionParaService.GetRecipePositionParaInfos(x => x.RecipeCode == NowRecipeCode); + + //没有就全0 + if (paraData.Count == 0) + { + SetPublicParaValue(new ZxRecipeParaEntity()); + zxRecipeParaEntity = new ZxRecipeParaEntity(); + } + //有就显示 + else if (paraData.Count == 1) + { + SetPublicParaValue(paraData[0]); + zxRecipeParaEntity = paraData[0]; + } + //有多条设为第一条 + else + { + MessageBox.Show("存在多条未删除的相同公共配方字段信息!将设置为第一条。点击清除脏数据"); + SetPublicParaValue(paraData[0]); + zxRecipeParaEntity = paraData[0]; + } + + //没有就全0 + if (positionParaData.Count == 0) + { + SetPrivateParaValue(new ZxRecipePositionParaEntity()); + } + else + { + foreach (var item in positionParaData) + { + ChangePositionEntities(item); + } + SetPrivateParaValue(zxRecipePositionParaEntity.Where(x => x.Position == flag).FirstOrDefault()); + } + } + /// /// 参数保存 /// @@ -969,7 +1112,7 @@ namespace HighWayIot.Winform.UserControlPages { return; } - if (!PlcConnect.IsConnect1) + if (!PlcConnect.IsConnect2) { MessageBox.Show("PLC未连接"); return; @@ -999,7 +1142,7 @@ namespace HighWayIot.Winform.UserControlPages { return; } - if (!PlcConnect.IsConnect1) + if (!PlcConnect.IsConnect2) { MessageBox.Show("PLC未连接"); return; @@ -1051,9 +1194,6 @@ namespace HighWayIot.Winform.UserControlPages /// private void RecipeDataSync(List sourceEntity) { - ZxOpenMixMaterialService zxOpenMixMaterialService = new ZxOpenMixMaterialService(); - var openMixConfig = zxOpenMixMaterialService.GetInfos(); - foreach (var newRecipes in sourceEntity) { //////////////////////////////更新配方表///////////////////////////////// @@ -1311,7 +1451,7 @@ namespace HighWayIot.Winform.UserControlPages RecipeCode = recipeCode }; - foreach (var config in openMixConfig) + foreach (var config in openMixConfig) //工位选择设置 { if (config.MaterialName == material1.MaterialName || config.MaterialName == material2.MaterialName @@ -1339,7 +1479,7 @@ namespace HighWayIot.Winform.UserControlPages recipePara.LightWidth = newRecipes.FixRubWidth; recipePara.TireWeight = newRecipes.TireWeight; - foreach (var config in openMixConfig) + foreach (var config in openMixConfig) //工位选择设置 { if (config.MaterialName == material1.MaterialName || config.MaterialName == material2.MaterialName @@ -1377,7 +1517,7 @@ namespace HighWayIot.Winform.UserControlPages } bool positionValue; positionValue = Convert.ToBoolean(value); - if(positionValue == true) + if (positionValue == true) { ZxRecipePositionParaEntity positionPara = positionParaEntities.Where(x => x.Position == (i + 1)).FirstOrDefault(); if (position == 1) @@ -1388,13 +1528,19 @@ namespace HighWayIot.Winform.UserControlPages { RecipeCode = recipeCode, Position = i + 1, - E5 = newRecipes.MaterialLayers1 + E5 = newRecipes.MaterialLayers1, + E9 = (int)newRecipes.MaterialWidth1, + E6 = newRecipes.MaterialLayers12, + E7 = (int)newRecipes.MaterialWidth12, }; zxRecipePositionParaService.InsertRecipePositionParaInfo(positionPara); } else//有工位参数 { positionPara.E5 = newRecipes.MaterialLayers1; + positionPara.E9 = (int)newRecipes.MaterialWidth1; + positionPara.E6 = newRecipes.MaterialLayers12; + positionPara.E7 = (int)newRecipes.MaterialWidth12; zxRecipePositionParaService.UpdateRecipePositionParaInfo(positionPara); } } @@ -1406,13 +1552,15 @@ namespace HighWayIot.Winform.UserControlPages { RecipeCode = recipeCode, Position = i + 1, - E5 = newRecipes.MaterialLayers2 + E5 = newRecipes.MaterialLayers2, + E9 = (int)newRecipes.MaterialWidth2, }; zxRecipePositionParaService.InsertRecipePositionParaInfo(positionPara); } else//有工位参数 { positionPara.E5 = newRecipes.MaterialLayers2; + positionPara.E9 = (int)newRecipes.MaterialWidth2; zxRecipePositionParaService.UpdateRecipePositionParaInfo(positionPara); } } @@ -1424,19 +1572,25 @@ namespace HighWayIot.Winform.UserControlPages { RecipeCode = recipeCode, Position = i + 1, - E5 = newRecipes.MaterialLayers3 + E5 = newRecipes.MaterialLayers3, + E9 = (int)newRecipes.MaterialWidth3, + E6 = newRecipes.MaterialLayers32, + E7 = (int)newRecipes.MaterialWidth32, }; zxRecipePositionParaService.InsertRecipePositionParaInfo(positionPara); } else//有工位参数 { positionPara.E5 = newRecipes.MaterialLayers3; + positionPara.E9 = (int)newRecipes.MaterialWidth3; + positionPara.E6 = newRecipes.MaterialLayers32; + positionPara.E7 = (int)newRecipes.MaterialWidth32; zxRecipePositionParaService.UpdateRecipePositionParaInfo(positionPara); } } position++; } - + } catch { @@ -1447,6 +1601,5 @@ namespace HighWayIot.Winform.UserControlPages } #endregion - } } diff --git a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.resx b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.resx index 36b3ae9..74880e6 100644 --- a/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.resx +++ b/HighWayIot.Winform/UserControlPages/RecipeConfigPages/RecipeConfigPage.resx @@ -132,10 +132,16 @@ True - + True - + + True + + + True + + True @@ -174,34 +180,4 @@ True - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - \ No newline at end of file diff --git a/HighWayIot.Winform/UserControlPages/TestPage.cs b/HighWayIot.Winform/UserControlPages/TestPage.cs index 9c3731b..06df0e1 100644 --- a/HighWayIot.Winform/UserControlPages/TestPage.cs +++ b/HighWayIot.Winform/UserControlPages/TestPage.cs @@ -107,7 +107,7 @@ namespace HighWayIot.Winform.UserControlPages /// private async void button3_Click(object sender, EventArgs e) { - + MessageBox.Show(PlcConnect.IsConnect2.ToString()); } /// @@ -117,48 +117,48 @@ namespace HighWayIot.Winform.UserControlPages /// private void ReadButton_Click(object sender, EventArgs e) { - DataTypeEnum en = (DataTypeEnum)Convert.ToInt32(PlcType.SelectedValue); + //DataTypeEnum en = (DataTypeEnum)Convert.ToInt32(PlcType.SelectedValue); - string res = string.Empty; + //string res = string.Empty; - switch (en) - { - case DataTypeEnum.Bool: - res = PlcConnect.ReadBool1(PlcAddress.Text).ToString(); - break; - case DataTypeEnum.Int16: - res = PlcConnect.ReadInt161(PlcAddress.Text).ToString(); - break; - case DataTypeEnum.UInt16: - res = PlcConnect.ReadUInt161(PlcAddress.Text).ToString(); - break; - case DataTypeEnum.Int32: - res = PlcConnect.ReadInt321(PlcAddress.Text).ToString(); - break; - case DataTypeEnum.UInt32: - res = PlcConnect.ReadUInt321(PlcAddress.Text).ToString(); - break; - case DataTypeEnum.Int64: - res = PlcConnect.ReadInt641(PlcAddress.Text).ToString(); - break; - case DataTypeEnum.UInt64: - res = PlcConnect.ReadUInt641(PlcAddress.Text).ToString(); - break; - case DataTypeEnum.Float: - res = PlcConnect.ReadFloat1(PlcAddress.Text).ToString(); - break; - case DataTypeEnum.Double: - res = PlcConnect.ReadDouble1(PlcAddress.Text).ToString(); - break; - case DataTypeEnum.String: - res = PlcConnect.ReadString1(PlcAddress.Text, (ushort)(GeneralUtils.StringNullOrToInt(LengthTextBox.Text) ?? 0)).ToString(); - break; - default: - res = "不对劲儿奥"; - break; - } + //switch (en) + //{ + // case DataTypeEnum.Bool: + // res = PlcConnect.ReadBool1(PlcAddress.Text).ToString(); + // break; + // case DataTypeEnum.Int16: + // res = PlcConnect.ReadInt161(PlcAddress.Text).ToString(); + // break; + // case DataTypeEnum.UInt16: + // res = PlcConnect.ReadUInt161(PlcAddress.Text).ToString(); + // break; + // case DataTypeEnum.Int32: + // res = PlcConnect.ReadInt321(PlcAddress.Text).ToString(); + // break; + // case DataTypeEnum.UInt32: + // res = PlcConnect.ReadUInt321(PlcAddress.Text).ToString(); + // break; + // case DataTypeEnum.Int64: + // res = PlcConnect.ReadInt641(PlcAddress.Text).ToString(); + // break; + // case DataTypeEnum.UInt64: + // res = PlcConnect.ReadUInt641(PlcAddress.Text).ToString(); + // break; + // case DataTypeEnum.Float: + // res = PlcConnect.ReadFloat1(PlcAddress.Text).ToString(); + // break; + // case DataTypeEnum.Double: + // res = PlcConnect.ReadDouble1(PlcAddress.Text).ToString(); + // break; + // case DataTypeEnum.String: + // res = PlcConnect.ReadString1(PlcAddress.Text, (ushort)(GeneralUtils.StringNullOrToInt(LengthTextBox.Text) ?? 0)).ToString(); + // break; + // default: + // res = "不对劲儿奥"; + // break; + //} - PlcShowValue.Text = res; + //PlcShowValue.Text = res; } /// @@ -174,14 +174,14 @@ namespace HighWayIot.Winform.UserControlPages { MessageBox.Show("类型转换错误!"); } - var result = PlcConnect.PlcWrite1(PlcAddress.Text, value, (DataTypeEnum)Convert.ToInt32(PlcType.SelectedValue)); + var result = PlcConnect.PlcWrite2(PlcAddress.Text, value, (DataTypeEnum)Convert.ToInt32(PlcType.SelectedValue)); bool r = result.IsSuccess; PlcShowValue.Text = r.ToString(); } else { string value = PlcValue.Text; - var result = PlcConnect.PlcWrite1(PlcAddress.Text, value, (DataTypeEnum)Convert.ToInt32(PlcType.SelectedValue)); + var result = PlcConnect.PlcWrite2(PlcAddress.Text, value, (DataTypeEnum)Convert.ToInt32(PlcType.SelectedValue)); bool r = result.IsSuccess; PlcShowValue.Text = r.ToString(); }