diff --git a/IProvider.cs b/IProvider.cs new file mode 100644 index 0000000..7ac2c8c --- /dev/null +++ b/IProvider.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace formula_manage +{ + /// + /// 查询接口 + /// + /// + public interface IProvider where T : class + { + /// + /// 查询所有记录 + /// + /// + List Select(); + + /// + /// 查询一条记录 + /// + /// + /// + List Selectsql(T t); + + /// + /// 插入一条记录 + /// + /// + /// + int Insert(T t); + + /// + /// 修改一条记录 + /// + /// + /// + int Update(T t); + + /// + /// 删除一条记录 + /// + /// + /// + int Delete(T t); + } +} diff --git a/SQLModels/STUFF_Product.cs b/SQLModels/STUFF_Product.cs new file mode 100644 index 0000000..859ef26 --- /dev/null +++ b/SQLModels/STUFF_Product.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace formula_manage.SQLModels +{ + // internal class STUFF_Product + //{ + // } + + public partial class Product + { + public string ProductCode { get; set; } + public string ProductName { get; set; } + public Nullable ProductType { get; set; } + public Nullable ProductClass { get; set; } + public Nullable Color { get; set; } + public string ProductLot { get; set; } + public Nullable FullWeight { get; set; } + public Nullable ProductUnit { get; set; } + public Nullable SafetyStock { get; set; } + public Nullable Price { get; set; } + public Nullable CurrentStock { get; set; } + public Nullable Deduct { get; set; } + public Nullable RplDate { get; set; } + public Nullable UsedDate { get; set; } + public string CuMonth { get; set; } + public Nullable LaStock { get; set; } + public Nullable ThStock { get; set; } + public Nullable ThUsed { get; set; } + public Nullable LampPosition { get; set; } + public string TablePosition { get; set; } + public string Area { get; set; } + public Nullable Concentration { get; set; } + public string Batch_NO { get; set; } + public string SUPPLIER { get; set; } + public double GRAVITY { get; set; } + } +} diff --git a/Windows/Stuff.xaml b/Windows/Stuff.xaml index a360445..c8d0a27 100644 --- a/Windows/Stuff.xaml +++ b/Windows/Stuff.xaml @@ -3,13 +3,18 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:local="clr-namespace:formula_manage.Windows" + xmlns:local="clr-namespace:formula_manage.Windows" + xmlns:ConvertMoels="clr-namespace:formula_manage.ConvertMoels" mc:Ignorable="d" Title="Stuff" Height="720" Width="1100" BorderBrush="White" Background="#FFE0E0E0"> - + + + + + - @@ -57,7 +62,7 @@ @@ -65,6 +70,7 @@ diff --git a/Windows/Stuff.xaml.cs b/Windows/Stuff.xaml.cs index 4a1af22..82c37af 100644 --- a/Windows/Stuff.xaml.cs +++ b/Windows/Stuff.xaml.cs @@ -24,9 +24,20 @@ namespace formula_manage.Windows public Stuff() { WindowStartupLocation = WindowStartupLocation.CenterScreen; + + this.DataGridStuff.LoadingRow += new EventHandler(this.DataGridEquipment_LoadingRow);//生成序列号 + InitializeComponent(); } + /// + /// 生成序列号的方法 + /// + private void DataGridEquipment_LoadingRow(object sender, DataGridRowEventArgs e) + { + e.Row.Header = e.Row.GetIndex() + 1; + } + private void Radiobutton(object sender, EventArgs e) { /* System.Windows.Controls.RadioButton Radiobutton = (sender as System.Windows.Controls.RadioButton); @@ -144,6 +155,45 @@ namespace formula_manage.Windows */ } + private void DataGridStuff_MouseDoubleClick(object sender, MouseButtonEventArgs e)//数据表双击事件 + { + int rownum = DataGridStuff.SelectedIndex;//获取鼠标选中行并定义变量 + if (rownum != -1)//判断鼠标定位是否有效 + { + /*定位选中行及指定列单元格文本信息*/ + string DataGridStuff_ProductCode = (DataGridStuff.Columns[1].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位第0列,原料代码 + string DataGridStuff_ProductName = (DataGridStuff.Columns[2].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位第1列,原料名称 + string DataGridStuff_Price = (DataGridStuff.Columns[3].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位第2列,价格 + string DataGridstuff_SUPPLIER = (DataGridStuff.Columns[4].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位第3列,供应商 + string DataGridStuff_ProductType = (DataGridStuff.Columns[5].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位第4列,类型 + //string DataGridStuff_Color = (DataGridStuff.Columns[6].GetCellContent(DataGridStuff.Items[rownum])as TextBlock).Text;//定位第5列,色彩 + string DataGridStuff_Concentration = (DataGridStuff.Columns[7].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位第6列选中行单元格文本信息并去除空白字符,浓度 + string DataGridStuff_GRAVITY = (DataGridStuff.Columns[8].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Text;//定位第7列,比重 + /*stuff_Color.Background = (DataGridStuff.Columns[6].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Background;//定位第5列,色彩,背景色传递至色彩框背景色*/ + /*填写信息至指定文本框*/ + //product_temp.ProductCode = DataGridStuff_ProductCode;//写入sql实体缓存 + stuff_ProductCode.Text = DataGridStuff_ProductCode.Trim();//原料代码,去除空白字符 + stuff_ProductName.Text = DataGridStuff_ProductName.Trim();//原料名称,去除空白字符 + stuff_Price.Text = DataGridStuff_Price;//价格 + stuff_ProductType.Text = DataGridStuff_ProductType;//类型 + stuff_SUPPLIER.Text = DataGridstuff_SUPPLIER;//供应商 + /*stuff_Color.Text = DataGridStuff_Color;//色彩数据*/ + stuff_Concentration.Text = DataGridStuff_Concentration;//浓度 + stuff_GRAVITY.Text = DataGridStuff_GRAVITY;//比重 + /*if (DataGridStuff_ProductType.ToString() == "0") stuff_ProductType.Text = "染料";//判断类型1-染料。2-助剂。3-粉体助剂。 + if (DataGridStuff_ProductType.ToString() == "1") stuff_ProductType.Text = "助剂"; + if (DataGridStuff_ProductType.ToString() == "2") stuff_ProductType.Text = "粉体助剂";*/ + if ((DataGridStuff.Columns[6].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Background != null) //定位第5列选中行单元格,色彩,判断参数是否有效 + { + stuff_Color.Background = (DataGridStuff.Columns[6].GetCellContent(DataGridStuff.Items[rownum]) as TextBlock).Background; //定位第5列选中行单元格,色彩,有效背景色传递至色彩框背景色 + } + else + { + stuff_Color.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 255, 255, 255));//白色传递至色彩框背景色 + } + } + } + private void Stuff_Color_MouseDoubleClick(object sender, MouseButtonEventArgs e)//色彩框双击事件 { diff --git a/formula_manage.csproj b/formula_manage.csproj index 337f2c1..0ba3b3e 100644 --- a/formula_manage.csproj +++ b/formula_manage.csproj @@ -106,9 +106,11 @@ + Login.xaml + @@ -230,6 +232,7 @@ + \ No newline at end of file