diff --git a/ButcherFactory.BO/BaseInfo/ClientGoodsSet.cs b/ButcherFactory.BO/BaseInfo/ClientGoodsSet.cs index 2b7031a..4ab4f09 100644 --- a/ButcherFactory.BO/BaseInfo/ClientGoodsSet.cs +++ b/ButcherFactory.BO/BaseInfo/ClientGoodsSet.cs @@ -61,6 +61,10 @@ namespace ButcherFactory.BO [Join("Goods_ID", "ID")] public string Goods_CustomerDefine { get; set; } + [ReferenceTo(typeof(Goods), "Spell")] + [Join("Goods_ID", "ID")] + public string Goods_Spell { get; set; } + public decimal? StandardWeight { get; set; } public decimal? StandardWeightUp { get; set; } diff --git a/ButcherFactory.BO/BaseInfo/Goods.cs b/ButcherFactory.BO/BaseInfo/Goods.cs index 31ff863..71eeb4e 100644 --- a/ButcherFactory.BO/BaseInfo/Goods.cs +++ b/ButcherFactory.BO/BaseInfo/Goods.cs @@ -9,7 +9,8 @@ namespace ButcherFactory.BO { [MapToTable("Butcher_Goods")] public class Goods : BaseInfo - { + { + public string Spell { get; set; } public string Code { get; set; } public string Spec { get; set; } diff --git a/ButcherFactory.BO/LocalBL/FormClientGoodsSetBL.cs b/ButcherFactory.BO/LocalBL/FormClientGoodsSetBL.cs index 3357a6c..6f3bd6a 100644 --- a/ButcherFactory.BO/LocalBL/FormClientGoodsSetBL.cs +++ b/ButcherFactory.BO/LocalBL/FormClientGoodsSetBL.cs @@ -60,6 +60,39 @@ namespace ButcherFactory.BO.LocalBL return result; } + public static IEnumerable GetGoodsSetDic2(string spell) + { + var main = new JoinAlias(typeof(ClientGoodsSet)); + var detail = new JoinAlias(typeof(ClientGoodsSet_Detail)); + var set = new JoinAlias(typeof(GoodsSetTemp)); + var query = new DQueryDom(main); + query.RegisterQueryTable(typeof(GoodsSetTemp), new string[] { "DetailID" }, GoodsSetTemp.GetQueryDom()); + query.From.AddJoin(JoinType.Inner, new DQDmoSource(detail), DQCondition.EQ(main, "ID", detail, "ClientGoodsSet_ID")); + query.From.AddJoin(JoinType.Left, new DQDmoSource(set), DQCondition.EQ(detail, "ID", set, "DetailID")); + + query.Columns.Add(DQSelectColumn.Field("Goods_Name", detail)); + query.Columns.Add(DQSelectColumn.Field("ID", detail)); + query.Columns.Add(DQSelectColumn.Field("DetailID", set)); + + if (!string.IsNullOrEmpty(spell)) + { + query.Where.Conditions.Add(DQCondition.Or( + DQCondition.Like(detail, "Goods_Name", spell), + DQCondition.Like(detail, "Goods_Spell", spell))); + } + + var list = query.EExecuteList< string, long, long? >(); + var result = new List(); + + foreach (var item in list ) + { + result.Add(new ClientGoodsSet_Detail { + Goods_Name = item.Item1, + ID = item.Item2, + Selected = item.Item3.HasValue }); + } + return result; + } public static Dictionary> GetSelectedDetail() { var main = new JoinAlias(typeof(ClientGoodsSet)); diff --git a/ButcherFactory.Form/Dialogs/ClientGoodsSetDialog.Designer.cs b/ButcherFactory.Form/Dialogs/ClientGoodsSetDialog.Designer.cs index 15675db..3f7ea53 100644 --- a/ButcherFactory.Form/Dialogs/ClientGoodsSetDialog.Designer.cs +++ b/ButcherFactory.Form/Dialogs/ClientGoodsSetDialog.Designer.cs @@ -32,6 +32,8 @@ this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); this.colseBtn = new ButcherFactory.Controls.ColorButton(); this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.searchBtn = new ButcherFactory.Controls.ColorButton(); this.SuspendLayout(); // // flowLayoutPanel2 @@ -87,12 +89,39 @@ this.flowLayoutPanel3.Size = new System.Drawing.Size(1108, 144); this.flowLayoutPanel3.TabIndex = 28; // + // textBox1 + // + this.textBox1.Font = new System.Drawing.Font("宋体", 14F); + this.textBox1.Location = new System.Drawing.Point(13, 13); + this.textBox1.Margin = new System.Windows.Forms.Padding(4); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(257, 34); + this.textBox1.TabIndex = 29; + this.textBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.textBox1_MouseDown); + // + // searchBtn + // + this.searchBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(21)))), ((int)(((byte)(198)))), ((int)(((byte)(58))))); + this.searchBtn.Font = new System.Drawing.Font("宋体", 12F); + this.searchBtn.ForeColor = System.Drawing.Color.White; + this.searchBtn.Location = new System.Drawing.Point(290, 10); + this.searchBtn.Margin = new System.Windows.Forms.Padding(4); + this.searchBtn.Name = "searchBtn"; + this.searchBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106))))); + this.searchBtn.Size = new System.Drawing.Size(107, 38); + this.searchBtn.TabIndex = 30; + this.searchBtn.Text = "查询"; + this.searchBtn.UseVisualStyleBackColor = false; + this.searchBtn.Click += new System.EventHandler(this.searchBtn_Click); + // // ClientGoodsSetDialog // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.White; this.ClientSize = new System.Drawing.Size(1112, 666); + this.Controls.Add(this.searchBtn); + this.Controls.Add(this.textBox1); this.Controls.Add(this.flowLayoutPanel3); this.Controls.Add(this.colseBtn); this.Controls.Add(this.flowLayoutPanel2); @@ -104,6 +133,7 @@ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "存货设置"; this.ResumeLayout(false); + this.PerformLayout(); } @@ -113,5 +143,7 @@ private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; private Controls.ColorButton colseBtn; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel3; + private System.Windows.Forms.TextBox textBox1; + private Controls.ColorButton searchBtn; } } \ No newline at end of file diff --git a/ButcherFactory.Form/Dialogs/ClientGoodsSetDialog.cs b/ButcherFactory.Form/Dialogs/ClientGoodsSetDialog.cs index cfd3811..070b00e 100644 --- a/ButcherFactory.Form/Dialogs/ClientGoodsSetDialog.cs +++ b/ButcherFactory.Form/Dialogs/ClientGoodsSetDialog.cs @@ -10,7 +10,9 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; - +using System.Windows.Input; +using WinFormControl; + namespace ButcherFactory.Dialogs { public partial class ClientGoodsSetDialog : Form @@ -32,8 +34,7 @@ namespace ButcherFactory.Dialogs btn.Click += GroupBtnClick01; flowLayoutPanel1.Controls.Add(btn); } - - + } string SelectName = ""; @@ -84,6 +85,33 @@ namespace ButcherFactory.Dialogs private void closeBtn_Click(object sender, EventArgs e) { this.Close(); - } + } + + private void searchBtn_Click(object sender, EventArgs e) + { + var goodsSet = FormClientGoodsSetBL.GetGoodsSetDic2(textBox1.Text.ToLower()); + flowLayoutPanel2.Controls.Clear(); + foreach (var item in goodsSet) + { + var btn = new ColorButton() { Width = 140, Height = 90, Text = item.Goods_Name, Tag = item, Font = new Font("宋体", 12, FontStyle.Bold), BackColor = goodsColor, Margin = new Padding(10, 10, 10, 35), PlaySound = true, StateHold = true }; + if (item.Selected) + btn.Selected = true; + btn.Click += GoodsBtnClick; + flowLayoutPanel2.Controls.Add(btn); + } + + } + + private void PwdTextBoxClick(object sender, MouseButtonEventArgs e) + { + + } + + private void textBox1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) + { + var keyBoard = new VirtualKeyPad(); + if (keyBoard.ShowDialog() == true) + textBox1.Text = keyBoard.Result; + } } }