From 492122310d89ab6095d2f7dcd7ff392f7dc87962 Mon Sep 17 00:00:00 2001 From: nodyang Date: Wed, 25 Oct 2023 17:25:08 +0800 Subject: [PATCH] =?UTF-8?q?MyMCCombobox=20=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoControl/DB/StockMaterrialDBHelp.cs | 26 +++++++++---------- .../AutoControl/GelerWeterControl.cs | 3 +++ .../LjMaterial/MaterialInfoTypeHelp.cs | 10 +++++++ 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/DB/StockMaterrialDBHelp.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/DB/StockMaterrialDBHelp.cs index 5767f26..a5b6f0c 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/DB/StockMaterrialDBHelp.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/DB/StockMaterrialDBHelp.cs @@ -15,11 +15,11 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl.DB /// 获取干混机物料 /// /// - public static List GetDryerMaterrial() + public static List GetDryerMaterrial() { var list = GetStockMaterrial(1); - list.RemoveAll(x => x.Id == 5); - list.RemoveAll(x => x.Id == 6); + list.RemoveAll(x => x.CmbValue == 5); + list.RemoveAll(x => x.CmbValue == 6); return list; } @@ -27,10 +27,10 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl.DB /// 获取糊化机物料 /// /// - public static List GetSiloMaterrial() + public static List GetSiloMaterrial() { var list1 = GetStockMaterrial(1); - list1 = list1.Where(x => x.Id == 5 || x.Id == 6).ToList(); + list1 = list1.Where(x => x.CmbValue == 5 || x.CmbValue == 6).ToList(); return list1; } @@ -50,16 +50,16 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl.DB - private static List GetStockMaterrial(int mtypId) + private static List GetStockMaterrial(int mtypId) { string sql = "select Id, Code, StockName, MTypeId, MTypeName, MId, MName, Remark from lj_stock_material"; var dataTable = DBHelp.GetTable(sql); - List ls = new List(); - ls.Add(new MyNameValue() + List ls = new List(); + ls.Add(new MyMCCombobox() { - Id = -1, - Name = "请选择" + CmbValue = -1, + CmbDisplay = "请选择" }); foreach (DataRow o in dataTable.Rows) { @@ -68,10 +68,10 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl.DB { if (tableMTypeId == mtypId) { - ls.Add(new MyNameValue() + ls.Add(new MyMCCombobox() { - Id = (int)o["Id"], - Name = o["StockName"].ToString() + $"({o["MName"]})" + CmbValue = (int)o["Id"], + CmbDisplay = o["StockName"].ToString() + $"({o["MName"]})" }); } } diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/GelerWeterControl.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/GelerWeterControl.cs index dd18b26..8d1843d 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/GelerWeterControl.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/GelerWeterControl.cs @@ -13,6 +13,8 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using Mesnac.Controls.Default; +using Button = System.Windows.Forms.Button; namespace Mesnac.Action.ChemicalWeighing.AutoControl { @@ -228,6 +230,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl private IBaseControl GetBaseControl(string name) { + return McControls.First(x => x.Name == name) as IBaseControl; } diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMaterial/MaterialInfoTypeHelp.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMaterial/MaterialInfoTypeHelp.cs index 572e2d8..a6a4e33 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMaterial/MaterialInfoTypeHelp.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMaterial/MaterialInfoTypeHelp.cs @@ -15,6 +15,16 @@ namespace Mesnac.Action.ChemicalWeighing.LjMaterial public string Name { get; set; } } + + public class MyMCCombobox + { + + public int CmbValue { get; set; } + + public string CmbDisplay { get; set; } + + } + public class MyNameValueStr { public string Id { get; set; }