diff --git a/B3ButcherManageClient.sln b/B3ButcherManageClient.sln index ed54cc3..4ea8595 100644 --- a/B3ButcherManageClient.sln +++ b/B3ButcherManageClient.sln @@ -23,6 +23,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoUpdate", "AutoUpdate\Au EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CreateUpdateXmlFile", "CreateUpdateXmlFile\CreateUpdateXmlFile.csproj", "{57BB1A02-118A-443D-A38A-BB36B9A77F6A}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OrderConfirm", "OrderConfirm\OrderConfirm.csproj", "{D4723253-E102-40C7-819F-8052C5BE241D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -67,6 +69,10 @@ Global {57BB1A02-118A-443D-A38A-BB36B9A77F6A}.Debug|Any CPU.Build.0 = Debug|Any CPU {57BB1A02-118A-443D-A38A-BB36B9A77F6A}.Release|Any CPU.ActiveCfg = Release|Any CPU {57BB1A02-118A-443D-A38A-BB36B9A77F6A}.Release|Any CPU.Build.0 = Release|Any CPU + {D4723253-E102-40C7-819F-8052C5BE241D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D4723253-E102-40C7-819F-8052C5BE241D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D4723253-E102-40C7-819F-8052C5BE241D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D4723253-E102-40C7-819F-8052C5BE241D}.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 7bff514..8bd7cf5 100644 --- a/BO/BO.csproj +++ b/BO/BO.csproj @@ -57,6 +57,7 @@ + @@ -71,6 +72,7 @@ + diff --git a/BO/BO/Bill/OrderDetail/ConfirmOrder.cs b/BO/BO/Bill/OrderDetail/ConfirmOrder.cs new file mode 100644 index 0000000..b171e7f --- /dev/null +++ b/BO/BO/Bill/OrderDetail/ConfirmOrder.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BO.BO.Bill +{ + public class ConfirmOrder + { + public long ID { get; set; } + + public int Order { get; set; } + + public long? B3WeighBill_ID { get; set; } + + public string LiveColonyHouse_Name { get; set; } + + public int Number { get; set; } + + public bool Confirmed { get; set; } + } +} diff --git a/BO/Utils/AfterLoginUtil.cs b/BO/Utils/AfterLoginUtil.cs index 962db47..a944f39 100644 --- a/BO/Utils/AfterLoginUtil.cs +++ b/BO/Utils/AfterLoginUtil.cs @@ -21,11 +21,11 @@ namespace BO.Utils // static List> roleToAssemblies = new List>(){new Tuple("排宰员",@"C:\BwpB3Project\src\B3ButcherManageClient\ButcherOrder\bin\Debug\ButcherOrder"), //new Tuple("过磅员",@"C:\BwpB3Project\src\B3ButcherManageClient\ButcherWeight\bin\Debug\ButcherWeight"), - // new Tuple("验质员",@"C:\BwpB3Project\src\B3ButcherManageClient\QualityAndOrder\bin\Debug\QualityAndOrder"),new Tuple("定级员",@"C:\BwpB3Project\src\B3ButcherManageClient\WeighAndGrading\bin\Debug\WeighAndGrading")}; + // new Tuple("验质员",@"C:\BwpB3Project\src\B3ButcherManageClient\QualityAndOrder\bin\Debug\QualityAndOrder"),new Tuple("定级员",@"C:\BwpB3Project\src\B3ButcherManageClient\WeighAndGrading\bin\Debug\WeighAndGrading"),new Tuple("窒晕员",@"C:\BwpB3Project\src\B3ButcherManageClient\OrderConfirm\bin\Debug\OrderConfirm")}; static List> roleToAssemblies = new List>(){new Tuple("排宰员",@"ButcherOrder"), new Tuple("过磅员",@"ButcherWeight"), - new Tuple("验质员",@"QualityAndOrder"),new Tuple("定级员",@"WeighAndGrading")}; + new Tuple("验质员",@"QualityAndOrder"),new Tuple("定级员",@"WeighAndGrading"),new Tuple("窒晕员",@"OrderConfirm")}; public static Form CreateForm(string role) diff --git a/BO/Utils/BillRpc/OrderConfirmRpc.cs b/BO/Utils/BillRpc/OrderConfirmRpc.cs new file mode 100644 index 0000000..1f29781 --- /dev/null +++ b/BO/Utils/BillRpc/OrderConfirmRpc.cs @@ -0,0 +1,28 @@ +using BO.BO.Bill; +using Forks.JsonRpc.Client; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Web.Script.Serialization; + +namespace BO.Utils.BillRpc +{ + public static class OrderConfirmRpc + { + static JavaScriptSerializer serializer = new JavaScriptSerializer(); + public static List GetConfirmOrder(DateTime date) + { + const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/OrderConfirmRpc/GetConfirmOrder"; + var json = RpcFacade.Call(method, date); + return serializer.Deserialize>(json); + } + + public static void SetOrderConfirmed(long id) + { + const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/OrderConfirmRpc/SetOrderConfirmed"; + RpcFacade.Call(method, id); + } + } +} diff --git a/OrderConfirm/OrderConfirm.csproj b/OrderConfirm/OrderConfirm.csproj new file mode 100644 index 0000000..c2e0695 --- /dev/null +++ b/OrderConfirm/OrderConfirm.csproj @@ -0,0 +1,80 @@ + + + + + Debug + AnyCPU + {D4723253-E102-40C7-819F-8052C5BE241D} + Library + Properties + OrderConfirm + OrderConfirm + v4.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + Form + + + OrderConfirmForm.cs + + + + + + OrderConfirmForm.cs + + + + + {8968f14a-c7c7-4751-96ce-b114fbfd65ef} + BO + + + {A782B23E-BE6D-4F51-B5CB-5CD259BA97CC} + BWP.WinFormControl + + + + + \ No newline at end of file diff --git a/OrderConfirm/OrderConfirmForm.Designer.cs b/OrderConfirm/OrderConfirmForm.Designer.cs new file mode 100644 index 0000000..04af847 --- /dev/null +++ b/OrderConfirm/OrderConfirmForm.Designer.cs @@ -0,0 +1,269 @@ +namespace OrderConfirm +{ + partial class OrderConfirmForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + 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 dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + this.uDataGridView1 = new BWP.WinFormControl.UDataGridView(); + this.existBtn = new System.Windows.Forms.Button(); + this.orderLabel = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.syncBtn = new System.Windows.Forms.Button(); + this.uDatePicker1 = new BWP.WinFormControl.UDatePicker(); + this.label1 = new System.Windows.Forms.Label(); + this.vScrollBar1 = new System.Windows.Forms.VScrollBar(); + this.C_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.C_Confirmed = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.C_Order = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.C_B3WeighBill_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.C_LiveColonyHouse_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.C_Number = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.C_OK = new System.Windows.Forms.DataGridViewButtonColumn(); + ((System.ComponentModel.ISupportInitialize)(this.uDataGridView1)).BeginInit(); + this.SuspendLayout(); + // + // uDataGridView1 + // + this.uDataGridView1.AllowUserToAddRows = false; + this.uDataGridView1.AllowUserToDeleteRows = false; + this.uDataGridView1.AllowUserToResizeColumns = false; + this.uDataGridView1.AllowUserToResizeRows = false; + dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.uDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; + this.uDataGridView1.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.uDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; + this.uDataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.uDataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.C_ID, + this.C_Confirmed, + this.C_Order, + this.C_B3WeighBill_ID, + this.C_LiveColonyHouse_Name, + this.C_Number, + this.C_OK}); + this.uDataGridView1.Location = new System.Drawing.Point(35, 73); + this.uDataGridView1.MultiSelect = false; + this.uDataGridView1.Name = "uDataGridView1"; + this.uDataGridView1.ReadOnly = true; + this.uDataGridView1.RowHeadersVisible = false; + dataGridViewCellStyle4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle4.ForeColor = System.Drawing.Color.Black; + dataGridViewCellStyle4.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + dataGridViewCellStyle4.SelectionForeColor = System.Drawing.Color.Black; + this.uDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle4; + this.uDataGridView1.RowTemplate.Height = 60; + this.uDataGridView1.ScrollBars = System.Windows.Forms.ScrollBars.None; + this.uDataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.uDataGridView1.Size = new System.Drawing.Size(753, 525); + this.uDataGridView1.TabIndex = 0; + this.uDataGridView1.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.uDataGridView1_CellClick); + this.uDataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.uDataGridView1_CellContentClick); + // + // existBtn + // + this.existBtn.Font = new System.Drawing.Font("宋体", 15F); + this.existBtn.Location = new System.Drawing.Point(723, 6); + this.existBtn.Name = "existBtn"; + this.existBtn.Size = new System.Drawing.Size(108, 41); + this.existBtn.TabIndex = 12; + this.existBtn.Text = "退出"; + this.existBtn.UseVisualStyleBackColor = true; + this.existBtn.Click += new System.EventHandler(this.existBtn_Click); + // + // orderLabel + // + this.orderLabel.AutoSize = true; + this.orderLabel.Font = new System.Drawing.Font("宋体", 15F); + this.orderLabel.Location = new System.Drawing.Point(540, 22); + this.orderLabel.Name = "orderLabel"; + this.orderLabel.Size = new System.Drawing.Size(19, 20); + this.orderLabel.TabIndex = 11; + this.orderLabel.Text = "0"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("宋体", 15F); + this.label2.Location = new System.Drawing.Point(442, 22); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(109, 20); + this.label2.TabIndex = 10; + this.label2.Text = "排宰顺序:"; + // + // syncBtn + // + this.syncBtn.Font = new System.Drawing.Font("宋体", 15F); + this.syncBtn.Location = new System.Drawing.Point(315, 12); + this.syncBtn.Name = "syncBtn"; + this.syncBtn.Size = new System.Drawing.Size(108, 41); + this.syncBtn.TabIndex = 9; + this.syncBtn.Text = "同步数据"; + this.syncBtn.UseVisualStyleBackColor = true; + this.syncBtn.Click += new System.EventHandler(this.syncBtn_Click); + // + // uDatePicker1 + // + this.uDatePicker1.BackColor = System.Drawing.Color.White; + this.uDatePicker1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.uDatePicker1.Date = new System.DateTime(2017, 9, 5, 0, 0, 0, 0); + this.uDatePicker1.Font = new System.Drawing.Font("宋体", 15F); + this.uDatePicker1.Location = new System.Drawing.Point(142, 17); + this.uDatePicker1.Name = "uDatePicker1"; + this.uDatePicker1.Size = new System.Drawing.Size(150, 30); + this.uDatePicker1.TabIndex = 8; + this.uDatePicker1.Text = "2017/09/05"; + this.uDatePicker1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.uDatePicker1.Type = BWP.WinFormControl.DateTimeType.Date; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("宋体", 15F); + this.label1.Location = new System.Drawing.Point(34, 22); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(109, 20); + this.label1.TabIndex = 7; + this.label1.Text = "宰杀日期:"; + // + // vScrollBar1 + // + this.vScrollBar1.Location = new System.Drawing.Point(791, 73); + this.vScrollBar1.Name = "vScrollBar1"; + this.vScrollBar1.Size = new System.Drawing.Size(40, 525); + this.vScrollBar1.TabIndex = 52; + // + // C_ID + // + this.C_ID.DataPropertyName = "ID"; + this.C_ID.HeaderText = "ID"; + this.C_ID.Name = "C_ID"; + this.C_ID.ReadOnly = true; + this.C_ID.Visible = false; + // + // C_Confirmed + // + this.C_Confirmed.DataPropertyName = "Confirmed"; + this.C_Confirmed.HeaderText = "Confirmed"; + this.C_Confirmed.Name = "C_Confirmed"; + this.C_Confirmed.ReadOnly = true; + this.C_Confirmed.Visible = false; + // + // C_Order + // + this.C_Order.DataPropertyName = "Order"; + this.C_Order.HeaderText = "排宰顺序"; + this.C_Order.Name = "C_Order"; + this.C_Order.ReadOnly = true; + // + // C_B3WeighBill_ID + // + this.C_B3WeighBill_ID.DataPropertyName = "B3WeighBill_ID"; + this.C_B3WeighBill_ID.HeaderText = "过磅单号"; + this.C_B3WeighBill_ID.Name = "C_B3WeighBill_ID"; + this.C_B3WeighBill_ID.ReadOnly = true; + // + // C_LiveColonyHouse_Name + // + this.C_LiveColonyHouse_Name.DataPropertyName = "LiveColonyHouse_Name"; + this.C_LiveColonyHouse_Name.HeaderText = "圈舍"; + this.C_LiveColonyHouse_Name.Name = "C_LiveColonyHouse_Name"; + this.C_LiveColonyHouse_Name.ReadOnly = true; + this.C_LiveColonyHouse_Name.Width = 300; + // + // C_Number + // + this.C_Number.DataPropertyName = "Number"; + this.C_Number.HeaderText = "头数"; + this.C_Number.Name = "C_Number"; + this.C_Number.ReadOnly = true; + // + // C_OK + // + dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle3.Padding = new System.Windows.Forms.Padding(10); + this.C_OK.DefaultCellStyle = dataGridViewCellStyle3; + this.C_OK.HeaderText = "确定"; + this.C_OK.Name = "C_OK"; + this.C_OK.ReadOnly = true; + this.C_OK.Text = "确定"; + this.C_OK.UseColumnTextForButtonValue = true; + this.C_OK.Width = 150; + // + // OrderConfirmForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(869, 631); + this.Controls.Add(this.vScrollBar1); + this.Controls.Add(this.existBtn); + this.Controls.Add(this.orderLabel); + this.Controls.Add(this.label2); + this.Controls.Add(this.syncBtn); + this.Controls.Add(this.uDatePicker1); + this.Controls.Add(this.label1); + this.Controls.Add(this.uDataGridView1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.Name = "OrderConfirmForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "上线确认"; + ((System.ComponentModel.ISupportInitialize)(this.uDataGridView1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private BWP.WinFormControl.UDataGridView uDataGridView1; + private System.Windows.Forms.Button existBtn; + private System.Windows.Forms.Label orderLabel; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Button syncBtn; + private BWP.WinFormControl.UDatePicker uDatePicker1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.VScrollBar vScrollBar1; + private System.Windows.Forms.DataGridViewTextBoxColumn C_ID; + private System.Windows.Forms.DataGridViewTextBoxColumn C_Confirmed; + private System.Windows.Forms.DataGridViewTextBoxColumn C_Order; + private System.Windows.Forms.DataGridViewTextBoxColumn C_B3WeighBill_ID; + private System.Windows.Forms.DataGridViewTextBoxColumn C_LiveColonyHouse_Name; + private System.Windows.Forms.DataGridViewTextBoxColumn C_Number; + private System.Windows.Forms.DataGridViewButtonColumn C_OK; + } +} \ No newline at end of file diff --git a/OrderConfirm/OrderConfirmForm.cs b/OrderConfirm/OrderConfirmForm.cs new file mode 100644 index 0000000..a9db9ac --- /dev/null +++ b/OrderConfirm/OrderConfirmForm.cs @@ -0,0 +1,186 @@ +using BO.BO.Bill; +using BO.Utils; +using BO.Utils.BillRpc; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace OrderConfirm +{ + public partial class OrderConfirmForm : Form, IAfterLogin + { + #region IAfterLogin + public string RoleName + { + get { return "窒晕员"; } + } + + public Form Generate() + { + return this; + } + + #endregion + + private delegate void InvokeHandler(); + List list; + Thread syncThread; + public OrderConfirmForm() + { + InitializeComponent(); + uDatePicker1.Date = DateTime.Today; + uDataGridView1.AutoGenerateColumns = false; + uDataGridView1.DataSource = null; + this.FormClosing += delegate + { + 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() + { + list = OrderConfirmRpc.GetConfirmOrder(uDatePicker1.Date.Value); + BindOrderGrid(); + })); + Thread.Sleep(5000); + } + } + + ConfirmOrder last; + private void BindOrderGrid() + { + uDataGridView1.DataSource = list.OrderBy(x => x.Order).OrderBy(x => x.Confirmed).ToList(); + if (last == null && uDataGridView1.CurrentRow != null) + { + last = uDataGridView1.CurrentRow.DataBoundItem as ConfirmOrder; + if (last.Confirmed) + { + last = null; + uDataGridView1.CurrentRow.DefaultCellStyle.BackColor = Color.YellowGreen; + } + } + foreach (DataGridViewRow row in uDataGridView1.Rows) + { + if ((bool)row.Cells["C_Confirmed"].Value) + row.DefaultCellStyle.BackColor = Color.YellowGreen; + if (last != null && last.ID == (long)row.Cells["C_ID"].Value) + { + last = row.DataBoundItem as ConfirmOrder; + if (last.Confirmed) + row.DefaultCellStyle.BackColor = Color.Yellow; + else + row.DefaultCellStyle.BackColor = uDataGridView1.RowsDefaultCellStyle.SelectionBackColor; + } + } + if (last != null && !last.Confirmed) + orderLabel.Text = last.Order.ToString(); + else + orderLabel.Text = "0"; + InitScrollBar1(); + uDataGridView1.ClearSelection(); + try + { + if (roll != -1) + uDataGridView1.FirstDisplayedScrollingRowIndex = roll; + } + catch + { + roll = -1; + } + uDataGridView1.Refresh(); + } + + private void existBtn_Click(object sender, EventArgs e) + { + this.Close(); + } + + int roll = -1; + private void InitScrollBar1() + { + vScrollBar1.Maximum = (uDataGridView1.RowCount - uDataGridView1.DisplayedRowCount(false) + 30) * uDataGridView1.RowTemplate.Height; + vScrollBar1.Minimum = 0; + vScrollBar1.SmallChange = uDataGridView1.RowTemplate.Height; + vScrollBar1.LargeChange = uDataGridView1.RowTemplate.Height * 30; + this.vScrollBar1.Scroll += (sender, e) => + { + roll = e.NewValue / uDataGridView1.RowTemplate.Height; + uDataGridView1.FirstDisplayedScrollingRowIndex = roll; + }; + } + + private void uDataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) + { + if (e.RowIndex == -1) + return; + var entity = uDataGridView1.CurrentRow.DataBoundItem as ConfirmOrder; + if (e.ColumnIndex != uDataGridView1.Columns.Count - 1)//非确定列 + { + if (last != null) + { + foreach (DataGridViewRow row in uDataGridView1.Rows) + { + if (last.ID == (long)row.Cells["C_ID"].Value) + { + row.DefaultCellStyle.BackColor = last.Confirmed ? Color.YellowGreen : uDataGridView1.RowsDefaultCellStyle.BackColor; + break; + } + } + } + last = entity; + uDataGridView1.CurrentRow.DefaultCellStyle.SelectionBackColor = last.Confirmed ? Color.Yellow : uDataGridView1.RowsDefaultCellStyle.SelectionBackColor; + this.orderLabel.Text = last.Order.ToString(); + } + else//确定列 + { + uDataGridView1.CurrentRow.DefaultCellStyle.SelectionBackColor = last.Confirmed ? Color.YellowGreen : uDataGridView1.RowsDefaultCellStyle.BackColor; + last = null; + } + uDataGridView1.Refresh(); + } + + private void uDataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) + { + if (e.RowIndex == -1) + return; + if (e.ColumnIndex == uDataGridView1.ColumnCount - 1)//确定 + { + var entity = uDataGridView1.CurrentRow.DataBoundItem as ConfirmOrder; + if (entity.Confirmed) + return; + entity.Confirmed = true; + OrderConfirmRpc.SetOrderConfirmed(entity.ID); + BindOrderGrid(); + } + } + } +} diff --git a/OrderConfirm/OrderConfirmForm.resx b/OrderConfirm/OrderConfirmForm.resx new file mode 100644 index 0000000..cd00c51 --- /dev/null +++ b/OrderConfirm/OrderConfirmForm.resx @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + \ No newline at end of file diff --git a/OrderConfirm/Properties/AssemblyInfo.cs b/OrderConfirm/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..83b0ff3 --- /dev/null +++ b/OrderConfirm/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的常规信息通过以下 +// 特性集控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("OrderConfirm")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OrderConfirm")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 使此程序集中的类型 +// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, +// 则将该类型上的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("6b7a6cf7-f71a-4404-9d32-152bdf5c1814")] + +// 程序集的版本信息由下面四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, +// 方法是按如下所示使用“*”: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")]