diff --git a/SlnMesnac.Business/base/BaseBusiness.cs b/SlnMesnac.Business/base/BaseBusiness.cs index 55919cb..48133f3 100644 --- a/SlnMesnac.Business/base/BaseBusiness.cs +++ b/SlnMesnac.Business/base/BaseBusiness.cs @@ -69,6 +69,8 @@ namespace SlnMesnac.Business.@base private List barCodeTasks; private List baseConfigInfos; + + #endregion @@ -90,7 +92,7 @@ namespace SlnMesnac.Business.@base using (var scope = _serviceProvider.CreateScope()) { baseConfigInfos = scope.ServiceProvider.GetRequiredService>(); - + palletTasks = scope.ServiceProvider.GetRequiredService>(); barCodeTasks = scope.ServiceProvider.GetRequiredService>(); diff --git a/SlnMesnac.Model/domain/RecipeManage.cs b/SlnMesnac.Model/domain/RecipeManage.cs new file mode 100644 index 0000000..e9c3317 --- /dev/null +++ b/SlnMesnac.Model/domain/RecipeManage.cs @@ -0,0 +1,96 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Text; + +#region << 版 本 注 释 >> +/*-------------------------------------------------------------------- +* 版权所有 (c) 2024 WenJY 保留所有权利。 +* CLR版本:4.0.30319.42000 +* 机器名称:LAPTOP-E0N2L34V +* 命名空间:SlnMesnac.Model.domain +* 唯一标识:ca1b0f85-e7a8-4e1b-ab98-07a7aa31c8f5 +* +* 创建者:WenJY +* 电子邮箱:wenjy@mesnac.com +* 创建时间:2024-04-08 16:43:07 +* 版本:V1.0.0 +* 描述: +* +*-------------------------------------------------------------------- +* 修改人: +* 时间: +* 修改说明: +* +* 版本:V1.0.0 +*--------------------------------------------------------------------*/ +#endregion << 版 本 注 释 >> +namespace SlnMesnac.Model.domain +{ + /// + /// 配方管理实体类 + /// + [SugarTable("recipe_manage"), TenantAttribute("local")] + public class RecipeManage + { + /// + /// 配方Id + /// + [SugarColumn(ColumnName = "obj_id", IsPrimaryKey = true, IsIdentity = true)] + public int ObjId { get; set; } + + /// + /// 配方Key + /// + [SugarColumn(ColumnName = "recipe_key")] + public int RecipeKey { get; set; } + + /// + /// 配方名称 + /// + [SugarColumn(ColumnName = "recipe_name")] + public string RecipeName { get; set; } + + /// + /// 拆包机螺旋1 + /// + [SugarColumn(ColumnName = "unpack_spiral1")] + public int UnpackSpiral1 { get; set; } + + /// + /// 拆包机螺旋2 + /// + [SugarColumn(ColumnName = "unpack_spiral2")] + public int UnpackSpiral2 { get; set; } + + /// + /// 烘干机螺旋 + /// + [SugarColumn(ColumnName = "dryer_spiral")] + public int DryerSpiral { get; set; } + + /// + /// 螺旋机螺旋1 + /// + [SugarColumn(ColumnName = "spiral1")] + public int Spiral1 { get; set; } + + /// + /// 螺旋机螺旋2 + /// + [SugarColumn(ColumnName = "spiral2")] + public int Spiral2 { get; set; } + + /// + /// 配方区间最低重量,包含(kg) + /// + [SugarColumn(ColumnName = "low_weight")] + public int LowWeight { get; set; } + + /// + /// 配方区间最高重量,不包含(kg) + /// + [SugarColumn(ColumnName = "hight_weight")] + public int HightWeight { get; set; } + } +} diff --git a/SlnMesnac.Repository/service/IBaseRecipeManageService.cs b/SlnMesnac.Repository/service/IBaseRecipeManageService.cs new file mode 100644 index 0000000..ce68a44 --- /dev/null +++ b/SlnMesnac.Repository/service/IBaseRecipeManageService.cs @@ -0,0 +1,16 @@ +using SlnMesnac.Model.domain; +using SlnMesnac.Repository.service.@base; +using System; +using System.Collections.Generic; +using System.Text; + +namespace SlnMesnac.Repository.service +{ + public interface IBaseRecipeManageService : IBaseService + { + + void UpdateRecipeManage(RecipeManage recipeManage); + + public List GetRecipeManageList(); + } +} diff --git a/SlnMesnac.Repository/service/Impl/BaseRecipeManageServiceImpl.cs b/SlnMesnac.Repository/service/Impl/BaseRecipeManageServiceImpl.cs new file mode 100644 index 0000000..d0501d1 --- /dev/null +++ b/SlnMesnac.Repository/service/Impl/BaseRecipeManageServiceImpl.cs @@ -0,0 +1,58 @@ +using Microsoft.Extensions.DependencyInjection; +using SlnMesnac.Model.domain; +using SlnMesnac.Repository.service.@base; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +#region << 版 本 注 释 >> +/*-------------------------------------------------------------------- +* 版权所有 (c) 2024 WenJY 保留所有权利。 +* CLR版本:4.0.30319.42000 +* 机器名称:LAPTOP-E0N2L34V +* 命名空间:SlnMesnac.Repository.service.Impl +* 唯一标识:50d84911-9088-4fd3-b85a-151411028afc +* +* 创建者:WenJY +* 电子邮箱:wenjy@mesnac.com +* 创建时间:2024-04-08 16:47:57 +* 版本:V1.0.0 +* 描述: +* +*-------------------------------------------------------------------- +* 修改人: +* 时间: +* 修改说明: +* +* 版本:V1.0.0 +*--------------------------------------------------------------------*/ +#endregion << 版 本 注 释 >> +namespace SlnMesnac.Repository.service.Impl +{ + public class BaseRecipeManageServiceImpl : BaseServiceImpl, IBaseRecipeManageService + { + + private readonly IServiceProvider _serviceProvider; + + public BaseRecipeManageServiceImpl(Repository rep,IServiceProvider serviceProvider) : base(rep) + { + _serviceProvider = serviceProvider; + } + + + + public void UpdateRecipeManage(RecipeManage recipeManage) + { + bool isRes = base._rep.Update(recipeManage); + } + + public List GetRecipeManageList() + { + return base._rep.GetList(); + } + + + + } +} diff --git a/SlnMesnac.WPF/Model/RecipeManageCache.cs b/SlnMesnac.WPF/Model/RecipeManageCache.cs new file mode 100644 index 0000000..972d406 --- /dev/null +++ b/SlnMesnac.WPF/Model/RecipeManageCache.cs @@ -0,0 +1,85 @@ +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using SlnMesnac.Model.domain; +using SlnMesnac.Repository.service; +using SlnMesnac.WPF; +using SlnMesnac.WPF.Page; +using System; +using System.Collections.Generic; +using System.Text; + +#region << 版 本 注 释 >> +/*-------------------------------------------------------------------- +* 版权所有 (c) 2024 WenJY 保留所有权利。 +* CLR版本:4.0.30319.42000 +* 机器名称:LAPTOP-E0N2L34V +* 命名空间:SlnMesnac.Model.dto +* 唯一标识:96940a51-66a8-4593-b68d-e4d7fdb16c9b +* +* 创建者:WenJY +* 电子邮箱:wenjy@mesnac.com +* 创建时间:2024-04-12 11:07:33 +* 版本:V1.0.0 +* 描述: +* +*-------------------------------------------------------------------- +* 修改人: +* 时间: +* 修改说明: +* +* 版本:V1.0.0 +*--------------------------------------------------------------------*/ +#endregion << 版 本 注 释 >> +namespace SlnMesnac.WPF.Model +{ + /// + /// 配方管理封装对象 + /// + public class RecipeManageCache + { + #region 单例实现 + private static readonly RecipeManageCache lazy = new RecipeManageCache(); + public static RecipeManageCache Instance + { + get + { + return lazy; + } + } + #endregion + + #region 变量定义 + private readonly ILogger _logger; + + private readonly IBaseRecipeManageService? baseRecipeManageService; + public List recipeManageList = null; + #endregion + + + public RecipeManageCache() + { + baseRecipeManageService = App.ServiceProvider.GetService(); + recipeManageList = baseRecipeManageService.GetRecipeManageList(); + } + + + + /// + /// 更新配方 + /// + /// + public void UpdateRecipeManage(RecipeManage recipeManage) + { + try + { + baseRecipeManageService.UpdateRecipeManage(recipeManage); + //刷新缓存 + recipeManageList = baseRecipeManageService.GetRecipeManageList(); + } + catch (Exception ex) + { + _logger.LogError($"UpdateRecipeManage异常:{ex.Message}"); + } + } + } +} diff --git a/SlnMesnac.WPF/Page/DevMonitorPage.xaml b/SlnMesnac.WPF/Page/DevMonitorPage.xaml index 2152bb9..4bae408 100644 --- a/SlnMesnac.WPF/Page/DevMonitorPage.xaml +++ b/SlnMesnac.WPF/Page/DevMonitorPage.xaml @@ -147,16 +147,16 @@ - + - - +