From 44823197d293e62a9daa090dc3db624d28e555f1 Mon Sep 17 00:00:00 2001 From: yibo <361071264@qq.com> Date: Tue, 14 Nov 2017 22:14:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- B3ButcherManageClient.sln | 10 +- BO/BO.csproj | 1 + BO/BO/Bill/OrderDetail/DropPigOrderList.cs | 25 +++++ BO/Utils/BillRpc/OrderDetailRpc.cs | 8 ++ DropPigReOrder/ReOrderForm.Designer.cs | 121 ++++++++++++--------- DropPigReOrder/ReOrderForm.cs | 118 +++++++++++++++++++- DropPigReOrder/ReOrderForm.resx | 9 +- 7 files changed, 228 insertions(+), 64 deletions(-) create mode 100644 BO/BO/Bill/OrderDetail/DropPigOrderList.cs diff --git a/B3ButcherManageClient.sln b/B3ButcherManageClient.sln index 0f861a0..72e564d 100644 --- a/B3ButcherManageClient.sln +++ b/B3ButcherManageClient.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27004.2002 +# Visual Studio 2013 +VisualStudioVersion = 12.0.40629.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BO", "BO\BO.csproj", "{8968F14A-C7C7-4751-96CE-B114FBFD65EF}" EndProject @@ -35,6 +35,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ByProductWeight", "ByProduc EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Distribution", "Distribution\Distribution.csproj", "{054F5E88-9AF0-430F-990E-17B8B268D59A}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DropPigReOrder", "DropPigReOrder\DropPigReOrder.csproj", "{031BDA81-6DCE-41CD-B8FB-D5334A4940B0}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -103,6 +105,10 @@ Global {054F5E88-9AF0-430F-990E-17B8B268D59A}.Debug|Any CPU.Build.0 = Debug|Any CPU {054F5E88-9AF0-430F-990E-17B8B268D59A}.Release|Any CPU.ActiveCfg = Release|Any CPU {054F5E88-9AF0-430F-990E-17B8B268D59A}.Release|Any CPU.Build.0 = Release|Any CPU + {031BDA81-6DCE-41CD-B8FB-D5334A4940B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {031BDA81-6DCE-41CD-B8FB-D5334A4940B0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {031BDA81-6DCE-41CD-B8FB-D5334A4940B0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {031BDA81-6DCE-41CD-B8FB-D5334A4940B0}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/BO/BO.csproj b/BO/BO.csproj index f08b947..b5b0a18 100644 --- a/BO/BO.csproj +++ b/BO/BO.csproj @@ -72,6 +72,7 @@ + diff --git a/BO/BO/Bill/OrderDetail/DropPigOrderList.cs b/BO/BO/Bill/OrderDetail/DropPigOrderList.cs new file mode 100644 index 0000000..956aa13 --- /dev/null +++ b/BO/BO/Bill/OrderDetail/DropPigOrderList.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BO.BO.Bill +{ + public class DropPigOrderList + { + public long? B3WeighBill_ID { get; set; } + + public long OrderDetail_ID { get; set; } + + public int Order { get; set; } + + public int HotFadeNumber { get; set; } + + public int PlanNumber { get; set; } + + public int MaoNumber { get { return PlanNumber - HotFadeNumber; } } + + public bool IsDrop { get; set; } + } +} diff --git a/BO/Utils/BillRpc/OrderDetailRpc.cs b/BO/Utils/BillRpc/OrderDetailRpc.cs index b75b4ea..0b869bc 100644 --- a/BO/Utils/BillRpc/OrderDetailRpc.cs +++ b/BO/Utils/BillRpc/OrderDetailRpc.cs @@ -147,5 +147,13 @@ namespace BO.Utils.BillRpc const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/OrderDetailRpc/GetFinishNumbers"; return RpcFacade.Call(method, date); } + + public static List GetDropPigOrderList(DateTime date) + { + const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/DropPigRpc/GetDropPigOrderList"; + var result = RpcFacade.Call(method, date); + result = result.ESerializeDateTime(); + return serializer.Deserialize>(result); + } } } diff --git a/DropPigReOrder/ReOrderForm.Designer.cs b/DropPigReOrder/ReOrderForm.Designer.cs index 82565ab..ba5dac5 100644 --- a/DropPigReOrder/ReOrderForm.Designer.cs +++ b/DropPigReOrder/ReOrderForm.Designer.cs @@ -28,9 +28,9 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); this.syncBtn = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.uDatePicker1 = new BWP.WinFormControl.UDatePicker(); @@ -40,12 +40,13 @@ this.uTextBoxWithPad1 = new BWP.WinFormControl.UTextBoxWithPad(); this.uTextBoxWithPad2 = new BWP.WinFormControl.UTextBoxWithPad(); this.OkBtn = new System.Windows.Forms.Button(); - this.updateBtn = new System.Windows.Forms.Button(); + this.ExistBtn = new System.Windows.Forms.Button(); this.vScrollBar1 = new System.Windows.Forms.VScrollBar(); - this.D_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.D_OrderDetail_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.D_IsDrop = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.D_Order = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.D_B3WeightBill_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.D_TangNumber = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.D_B3WeighBill_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.D_HotFadeNumber = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.D_MaoNumber = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.D_PlanNumber = new System.Windows.Forms.DataGridViewTextBoxColumn(); ((System.ComponentModel.ISupportInitialize)(this.orderGridView)).BeginInit(); @@ -60,6 +61,7 @@ this.syncBtn.TabIndex = 11; this.syncBtn.Text = "同步数据"; this.syncBtn.UseVisualStyleBackColor = true; + this.syncBtn.Click += new System.EventHandler(this.syncBtn_Click); // // label1 // @@ -91,36 +93,39 @@ this.orderGridView.AllowUserToDeleteRows = false; this.orderGridView.AllowUserToResizeColumns = false; this.orderGridView.AllowUserToResizeRows = false; - dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); - this.orderGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.orderGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle7; this.orderGridView.BackgroundColor = System.Drawing.Color.White; - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 12F); - dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.orderGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle8.Font = new System.Drawing.Font("宋体", 12F); + dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.orderGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle8; this.orderGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.orderGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.D_ID, + this.D_OrderDetail_ID, + this.D_IsDrop, this.D_Order, - this.D_B3WeightBill_ID, - this.D_TangNumber, + this.D_B3WeighBill_ID, + this.D_HotFadeNumber, this.D_MaoNumber, this.D_PlanNumber}); this.orderGridView.Location = new System.Drawing.Point(16, 78); this.orderGridView.MultiSelect = false; this.orderGridView.Name = "orderGridView"; this.orderGridView.RowHeadersVisible = false; - dataGridViewCellStyle3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); - this.orderGridView.RowsDefaultCellStyle = dataGridViewCellStyle3; - this.orderGridView.RowTemplate.Height = 23; + dataGridViewCellStyle9.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle9.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + this.orderGridView.RowsDefaultCellStyle = dataGridViewCellStyle9; + this.orderGridView.RowTemplate.Height = 60; + this.orderGridView.ScrollBars = System.Windows.Forms.ScrollBars.None; this.orderGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.orderGridView.Size = new System.Drawing.Size(547, 521); this.orderGridView.TabIndex = 13; + this.orderGridView.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.orderGridView_CellClick); // // label2 // @@ -163,7 +168,7 @@ // OkBtn // this.OkBtn.Font = new System.Drawing.Font("宋体", 15F); - this.OkBtn.Location = new System.Drawing.Point(666, 328); + this.OkBtn.Location = new System.Drawing.Point(758, 280); this.OkBtn.Name = "OkBtn"; this.OkBtn.Size = new System.Drawing.Size(108, 41); this.OkBtn.TabIndex = 16; @@ -171,16 +176,16 @@ this.OkBtn.UseVisualStyleBackColor = true; this.OkBtn.Click += new System.EventHandler(this.OkBtn_Click); // - // updateBtn + // ExistBtn // - this.updateBtn.Font = new System.Drawing.Font("宋体", 15F); - this.updateBtn.Location = new System.Drawing.Point(838, 328); - this.updateBtn.Name = "updateBtn"; - this.updateBtn.Size = new System.Drawing.Size(108, 41); - this.updateBtn.TabIndex = 17; - this.updateBtn.Text = "更新"; - this.updateBtn.UseVisualStyleBackColor = true; - this.updateBtn.Click += new System.EventHandler(this.updateBtn_Click); + this.ExistBtn.Font = new System.Drawing.Font("宋体", 15F); + this.ExistBtn.Location = new System.Drawing.Point(900, 8); + this.ExistBtn.Name = "ExistBtn"; + this.ExistBtn.Size = new System.Drawing.Size(108, 41); + this.ExistBtn.TabIndex = 17; + this.ExistBtn.Text = "退出"; + this.ExistBtn.UseVisualStyleBackColor = true; + this.ExistBtn.Click += new System.EventHandler(this.existBtn_Click); // // vScrollBar1 // @@ -189,12 +194,19 @@ this.vScrollBar1.Size = new System.Drawing.Size(40, 521); this.vScrollBar1.TabIndex = 53; // - // D_ID + // D_OrderDetail_ID // - this.D_ID.DataPropertyName = "ID"; - this.D_ID.HeaderText = "ID"; - this.D_ID.Name = "D_ID"; - this.D_ID.Visible = false; + this.D_OrderDetail_ID.DataPropertyName = "OrderDetail_ID"; + this.D_OrderDetail_ID.HeaderText = "OrderDetail_ID"; + this.D_OrderDetail_ID.Name = "D_OrderDetail_ID"; + this.D_OrderDetail_ID.Visible = false; + // + // D_IsDrop + // + this.D_IsDrop.DataPropertyName = "IsDrop"; + this.D_IsDrop.HeaderText = "IsDrop"; + this.D_IsDrop.Name = "D_IsDrop"; + this.D_IsDrop.Visible = false; // // D_Order // @@ -202,19 +214,19 @@ this.D_Order.HeaderText = "序号"; this.D_Order.Name = "D_Order"; // - // D_B3WeightBill_ID + // D_B3WeighBill_ID // - this.D_B3WeightBill_ID.DataPropertyName = "B3WeightBill_ID"; - this.D_B3WeightBill_ID.HeaderText = "磅单号"; - this.D_B3WeightBill_ID.Name = "D_B3WeightBill_ID"; - this.D_B3WeightBill_ID.Width = 110; + this.D_B3WeighBill_ID.DataPropertyName = "B3WeighBill_ID"; + this.D_B3WeighBill_ID.HeaderText = "磅单号"; + this.D_B3WeighBill_ID.Name = "D_B3WeighBill_ID"; + this.D_B3WeighBill_ID.Width = 110; // - // D_TangNumber + // D_HotFadeNumber // - this.D_TangNumber.DataPropertyName = "TangNumber"; - this.D_TangNumber.HeaderText = "烫褪头数"; - this.D_TangNumber.Name = "D_TangNumber"; - this.D_TangNumber.Width = 110; + this.D_HotFadeNumber.DataPropertyName = "HotFadeNumber"; + this.D_HotFadeNumber.HeaderText = "烫褪头数"; + this.D_HotFadeNumber.Name = "D_HotFadeNumber"; + this.D_HotFadeNumber.Width = 110; // // D_MaoNumber // @@ -236,7 +248,7 @@ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1020, 617); this.Controls.Add(this.vScrollBar1); - this.Controls.Add(this.updateBtn); + this.Controls.Add(this.ExistBtn); this.Controls.Add(this.OkBtn); this.Controls.Add(this.uTextBoxWithPad2); this.Controls.Add(this.uTextBoxWithPad1); @@ -268,12 +280,13 @@ private BWP.WinFormControl.UTextBoxWithPad uTextBoxWithPad1; private BWP.WinFormControl.UTextBoxWithPad uTextBoxWithPad2; private System.Windows.Forms.Button OkBtn; - private System.Windows.Forms.Button updateBtn; + private System.Windows.Forms.Button ExistBtn; private System.Windows.Forms.VScrollBar vScrollBar1; - private System.Windows.Forms.DataGridViewTextBoxColumn D_ID; + private System.Windows.Forms.DataGridViewTextBoxColumn D_OrderDetail_ID; + private System.Windows.Forms.DataGridViewTextBoxColumn D_IsDrop; private System.Windows.Forms.DataGridViewTextBoxColumn D_Order; - private System.Windows.Forms.DataGridViewTextBoxColumn D_B3WeightBill_ID; - private System.Windows.Forms.DataGridViewTextBoxColumn D_TangNumber; + private System.Windows.Forms.DataGridViewTextBoxColumn D_B3WeighBill_ID; + private System.Windows.Forms.DataGridViewTextBoxColumn D_HotFadeNumber; private System.Windows.Forms.DataGridViewTextBoxColumn D_MaoNumber; private System.Windows.Forms.DataGridViewTextBoxColumn D_PlanNumber; } diff --git a/DropPigReOrder/ReOrderForm.cs b/DropPigReOrder/ReOrderForm.cs index 534cd34..6dbd3ad 100644 --- a/DropPigReOrder/ReOrderForm.cs +++ b/DropPigReOrder/ReOrderForm.cs @@ -1,4 +1,6 @@ -using BO.Utils; +using BO.BO.Bill; +using BO.Utils; +using BO.Utils.BillRpc; using System; using System.Collections.Generic; using System.ComponentModel; @@ -25,7 +27,8 @@ namespace DropPigReOrder } private delegate void InvokeHandler(); - Thread syncWork; + List list; + Thread syncThread; public ReOrderForm() { InitializeComponent(); @@ -34,19 +37,124 @@ namespace DropPigReOrder orderGridView.DataSource = null; this.FormClosing += delegate { - if (syncWork != null && syncWork.IsAlive) - syncWork.Abort(); + if (syncThread != null && syncThread.IsAlive) + syncThread.Abort(); }; } + private void syncBtn_Click(object sender, EventArgs e) + { + if (syncThread == null || !syncThread.IsAlive) + { + syncThread = new Thread(SyncTask); + syncThread.Start(); + syncBtn.BackColor = Color.FromArgb(15, 215, 107); + syncBtn.ForeColor = Color.White; + } + else + { + syncThread.Abort(); + syncBtn.BackColor = Color.FromKnownColor(KnownColor.Control); + syncBtn.ForeColor = Color.FromKnownColor(KnownColor.ControlText); + } + } + private void SyncTask() + { + while (true) + { + this.Invoke(new InvokeHandler(delegate() + { + BindOrderGrid(); + })); + Thread.Sleep(5000); + } + } + + DropPigOrderList lastSelect; + void BindOrderGrid() + { + list = OrderDetailRpc.GetDropPigOrderList(uDatePicker1.Date.Value); + orderGridView.DataSource = list.OrderBy(x => x.Order).ToList(); + if (lastSelect == null && orderGridView.CurrentRow != null) + { + lastSelect = orderGridView.CurrentRow.DataBoundItem as DropPigOrderList; + } + foreach (DataGridViewRow row in orderGridView.Rows) + { + if ((bool)row.Cells["D_IsDrop"].Value) + row.DefaultCellStyle.BackColor = Color.Red; + if (lastSelect != null && lastSelect.Order == (int)row.Cells["D_Order"].Value) + { + lastSelect = row.DataBoundItem as DropPigOrderList; + if (lastSelect.IsDrop) + row.DefaultCellStyle.BackColor = Color.Red; + row.DefaultCellStyle.BackColor = orderGridView.RowsDefaultCellStyle.SelectionBackColor; + } + } + InitScrollBar1(); + orderGridView.ClearSelection(); + try + { + if (roll != -1) + orderGridView.FirstDisplayedScrollingRowIndex = roll; + } + catch + { + roll = -1; + } + orderGridView.Refresh(); + } + + int roll = -1; + private void InitScrollBar1() + { + vScrollBar1.Maximum = (orderGridView.RowCount - orderGridView.DisplayedRowCount(false) + 30) * orderGridView.RowTemplate.Height; + vScrollBar1.Minimum = 0; + vScrollBar1.SmallChange = orderGridView.RowTemplate.Height; + vScrollBar1.LargeChange = orderGridView.RowTemplate.Height * 30; + this.vScrollBar1.Scroll += (sender, e) => + { + roll = e.NewValue / orderGridView.RowTemplate.Height; + orderGridView.FirstDisplayedScrollingRowIndex = roll; + }; + } private void OkBtn_Click(object sender, EventArgs e) { + if (lastSelect == null) + throw new Exception("请选选择掉猪的行记录"); + + + } + private void existBtn_Click(object sender, EventArgs e) + { + this.Close(); } - private void updateBtn_Click(object sender, EventArgs e) + private void orderGridView_CellClick(object sender, DataGridViewCellEventArgs e) { + if (e.RowIndex == -1) + return; + var entity = orderGridView.CurrentRow.DataBoundItem as DropPigOrderList; + if (lastSelect != null) + { + foreach (DataGridViewRow row in orderGridView.Rows) + { + if (lastSelect.Order == (int)row.Cells["D_Order"].Value) + { + if (lastSelect.IsDrop) + row.DefaultCellStyle.BackColor = Color.Red; + else + row.DefaultCellStyle.BackColor = orderGridView.RowsDefaultCellStyle.BackColor; + break; + } + } + } + lastSelect = entity; + if (lastSelect.IsDrop) + orderGridView.CurrentRow.DefaultCellStyle.SelectionBackColor = Color.Red; + orderGridView.Refresh(); } } } diff --git a/DropPigReOrder/ReOrderForm.resx b/DropPigReOrder/ReOrderForm.resx index 62a9c60..b47cce0 100644 --- a/DropPigReOrder/ReOrderForm.resx +++ b/DropPigReOrder/ReOrderForm.resx @@ -117,16 +117,19 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + + True + + True True - + True - + True