From ab610c56bbea71298599de2c149e0597b0504e83 Mon Sep 17 00:00:00 2001 From: liuwf Date: Mon, 12 Aug 2024 18:43:45 +0800 Subject: [PATCH] =?UTF-8?q?add-=E6=B7=BB=E5=8A=A0=E9=85=8D=E6=96=B9?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E5=8F=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SlnMesnac.Business/base/BaseBusiness.cs | 3 +- SlnMesnac.Config/DebugConfig.cs | 55 +- SlnMesnac.Model/domain/RecipeManage.cs | 16 +- SlnMesnac.WPF/Model/PLCMachineModel.cs | 2 +- SlnMesnac.WPF/Model/RecipeManageCache.cs | 83 ++- SlnMesnac.WPF/Page/DevMonitorPage.xaml | 21 +- SlnMesnac.WPF/Page/DevMonitorPage.xaml.cs | 572 ++++++++++++------ SlnMesnac.WPF/Page/RecipeManagePage.xaml | 84 ++- SlnMesnac.WPF/Page/RecipeManagePage.xaml.cs | 107 +++- .../Page/Window/RecipeManageSetWindow.xaml | 4 +- .../Page/Window/RecipeModeSetWindow.xaml | 32 + .../Page/Window/RecipeModeSetWindow.xaml.cs | 73 +++ SlnMesnac.WPF/SlnMesnac.WPF.csproj | 3 + .../Templates/style/resourceStyle.xaml | 6 + .../ViewModel/RecipeManageViewModel.cs | 99 ++- 15 files changed, 937 insertions(+), 223 deletions(-) create mode 100644 SlnMesnac.WPF/Page/Window/RecipeModeSetWindow.xaml create mode 100644 SlnMesnac.WPF/Page/Window/RecipeModeSetWindow.xaml.cs diff --git a/SlnMesnac.Business/base/BaseBusiness.cs b/SlnMesnac.Business/base/BaseBusiness.cs index 48133f3..d1552bd 100644 --- a/SlnMesnac.Business/base/BaseBusiness.cs +++ b/SlnMesnac.Business/base/BaseBusiness.cs @@ -279,7 +279,8 @@ namespace SlnMesnac.Business.@base throw new ArgumentNullException("根据Key获取PLC地址异常:配置集合为空"); } - return baseConfigInfos.Where(x => x.ConfigKey == configKey).First().ConfigValue; + var result = baseConfigInfos.Where(x => x.ConfigKey == configKey).First().ConfigValue; + return result; } catch (Exception ex) { diff --git a/SlnMesnac.Config/DebugConfig.cs b/SlnMesnac.Config/DebugConfig.cs index 20637bb..39c3fcc 100644 --- a/SlnMesnac.Config/DebugConfig.cs +++ b/SlnMesnac.Config/DebugConfig.cs @@ -27,14 +27,61 @@ namespace SlnMesnac.Config } /// - ///上次投料时间 + ///缓存区重量 /// - public string LastTime + public string BufferWeight { - get { return iniHelper.IniReadValue("system", "LastTime"); } - set { iniHelper.IniWriteValue("system", "LastTime", value); } + get { return iniHelper.IniReadValue("system", "BufferWeight"); } + set { iniHelper.IniWriteValue("system", "BufferWeight", value); } } + /// + ///系统当前使用配方模版 + /// + public string RecipeName + { + get { return iniHelper.IniReadValue("system", "RecipeName"); } + set { iniHelper.IniWriteValue("system", "RecipeName", value); } + } + + + /// + ///配方运行模式 + /// + public string RecipeMode + { + get { return iniHelper.IniReadValue("system", "RecipeMode"); } + set { iniHelper.IniWriteValue("system", "RecipeMode", value); } + } + + /// + ///拆包机螺旋--烘干机螺旋切换间隔(单位:ms) + /// + public string UnpackToHotTime + { + get { return iniHelper.IniReadValue("system", "UnpackToHotTime"); } + set { iniHelper.IniWriteValue("system", "UnpackToHotTime", value); } + } + + /// + ///烘干机螺旋--螺旋1切换间隔(单位:ms) + /// + public string HotToSpiralTime + { + get { return iniHelper.IniReadValue("system", "HotToSpiralTime"); } + set { iniHelper.IniWriteValue("system", "HotToSpiralTime", value); } + } + + /// + ///#螺旋1--螺旋2切换间隔(单位:ms) + /// + public string SpiralTwoTime + { + get { return iniHelper.IniReadValue("system", "SpiralTwoTime"); } + set { iniHelper.IniWriteValue("system", "SpiralTwoTime", value); } + } + + /// ///喷码机IP /// diff --git a/SlnMesnac.Model/domain/RecipeManage.cs b/SlnMesnac.Model/domain/RecipeManage.cs index e9c3317..22e025a 100644 --- a/SlnMesnac.Model/domain/RecipeManage.cs +++ b/SlnMesnac.Model/domain/RecipeManage.cs @@ -34,49 +34,49 @@ namespace SlnMesnac.Model.domain public class RecipeManage { /// - /// 配方Id + /// 配方Id频率 /// [SugarColumn(ColumnName = "obj_id", IsPrimaryKey = true, IsIdentity = true)] public int ObjId { get; set; } /// - /// 配方Key + /// 配方Key频率 /// [SugarColumn(ColumnName = "recipe_key")] public int RecipeKey { get; set; } /// - /// 配方名称 + /// 配方名称频率 /// [SugarColumn(ColumnName = "recipe_name")] public string RecipeName { get; set; } /// - /// 拆包机螺旋1 + /// 拆包机螺旋1频率 /// [SugarColumn(ColumnName = "unpack_spiral1")] public int UnpackSpiral1 { get; set; } /// - /// 拆包机螺旋2 + /// 拆包机螺旋2频率 /// [SugarColumn(ColumnName = "unpack_spiral2")] public int UnpackSpiral2 { get; set; } /// - /// 烘干机螺旋 + /// 烘干机螺旋频率 /// [SugarColumn(ColumnName = "dryer_spiral")] public int DryerSpiral { get; set; } /// - /// 螺旋机螺旋1 + /// 螺旋机螺旋1频率 /// [SugarColumn(ColumnName = "spiral1")] public int Spiral1 { get; set; } /// - /// 螺旋机螺旋2 + /// 螺旋机螺旋2频率 /// [SugarColumn(ColumnName = "spiral2")] public int Spiral2 { get; set; } diff --git a/SlnMesnac.WPF/Model/PLCMachineModel.cs b/SlnMesnac.WPF/Model/PLCMachineModel.cs index 0115a79..68d53d8 100644 --- a/SlnMesnac.WPF/Model/PLCMachineModel.cs +++ b/SlnMesnac.WPF/Model/PLCMachineModel.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; namespace SlnMesnac.WPF.Model { /// - /// 烘干机采集参数 + /// 采集实体参数 /// public class PLCMachineModel { diff --git a/SlnMesnac.WPF/Model/RecipeManageCache.cs b/SlnMesnac.WPF/Model/RecipeManageCache.cs index 972d406..fb558a7 100644 --- a/SlnMesnac.WPF/Model/RecipeManageCache.cs +++ b/SlnMesnac.WPF/Model/RecipeManageCache.cs @@ -1,11 +1,13 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; +using SlnMesnac.Config; using SlnMesnac.Model.domain; using SlnMesnac.Repository.service; using SlnMesnac.WPF; using SlnMesnac.WPF.Page; using System; using System.Collections.Generic; +using System.Linq; using System.Text; #region << 版 本 注 释 >> @@ -50,9 +52,86 @@ namespace SlnMesnac.WPF.Model #region 变量定义 private readonly ILogger _logger; - + private DebugConfig config = DebugConfig.Instance; private readonly IBaseRecipeManageService? baseRecipeManageService; - public List recipeManageList = null; + + /// + /// 所有配方列表 + /// + public List recipeManageList = null; + + + /// + /// 当前正在使用配方 + /// + public RecipeManage useRecipeManage + { + get + { + if (recipeManageList != null) + { + return recipeManageList.FirstOrDefault(x => x.RecipeName == config.RecipeName); + } + else + { + return null; + } + } + + } + + + /// + /// 当前监测重量 + /// + public double BufferWeight { + get { return double.Parse(config.BufferWeight); } + set { config.BufferWeight = value.ToString(); } + } + /// + /// 当前使用模版名称 + /// + public string RecipeName + { + get { return config.RecipeName; } + set { config.RecipeName = value; } + } + /// + /// 当前使用模式 + /// + public string RecipeMode + { + get { return config.RecipeMode; } + set { config.RecipeMode = value; } + } + + /// + /// 拆包机螺旋--烘干机螺旋切换间隔(单位:ms) + /// + public string UnpackToHotTime + { + get { return config.UnpackToHotTime; } + set { config.UnpackToHotTime = value; } + } + + /// + /// 烘干机螺旋--螺旋1切换间隔(单位:ms) + /// + public string HotToSpiralTime + { + get { return config.HotToSpiralTime; } + set { config.HotToSpiralTime = value; } + } + + /// + /// 螺旋1--螺旋2切换间隔(单位:ms) + /// + public string SpiralTwoTime + { + get { return config.SpiralTwoTime; } + set { config.SpiralTwoTime = value; } + } + #endregion diff --git a/SlnMesnac.WPF/Page/DevMonitorPage.xaml b/SlnMesnac.WPF/Page/DevMonitorPage.xaml index 4bae408..ef42ce6 100644 --- a/SlnMesnac.WPF/Page/DevMonitorPage.xaml +++ b/SlnMesnac.WPF/Page/DevMonitorPage.xaml @@ -6,7 +6,8 @@ xmlns:local="clr-namespace:SlnMesnac.WPF.Page" mc:Ignorable="d" d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent"> - + + @@ -151,13 +152,13 @@ --> - + -