diff --git a/BO/BO.csproj b/BO/BO.csproj index 562ca17..ad34972 100644 --- a/BO/BO.csproj +++ b/BO/BO.csproj @@ -57,7 +57,6 @@ - @@ -74,7 +73,6 @@ - diff --git a/BO/BO/Bill/OrderDetail/ConfirmOrder.cs b/BO/BO/Bill/OrderDetail/ConfirmOrder.cs deleted file mode 100644 index b171e7f..0000000 --- a/BO/BO/Bill/OrderDetail/ConfirmOrder.cs +++ /dev/null @@ -1,23 +0,0 @@ -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/BO/Bill/OrderDetail/OrderDetail.cs b/BO/BO/Bill/OrderDetail/OrderDetail.cs index 3d4a1c5..cd99d1e 100644 --- a/BO/BO/Bill/OrderDetail/OrderDetail.cs +++ b/BO/BO/Bill/OrderDetail/OrderDetail.cs @@ -33,5 +33,10 @@ namespace BO.BO.Bill public bool IsHurryButcher { get; set; } public bool SecondarySplit { get; set; } + + //0 = 未开始; 10 = 已开始; 20 = 已完毕; + public int OrderState { get; set; } + + public int Doing { get { if (OrderState == 10) return -10; else return OrderState; } } } } diff --git a/BO/Utils/BillRpc/OrderConfirmRpc.cs b/BO/Utils/BillRpc/OrderConfirmRpc.cs deleted file mode 100644 index 1f29781..0000000 --- a/BO/Utils/BillRpc/OrderConfirmRpc.cs +++ /dev/null @@ -1,28 +0,0 @@ -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/BO/Utils/BillRpc/OrderDetailRpc.cs b/BO/Utils/BillRpc/OrderDetailRpc.cs index b2aed38..f08bbf9 100644 --- a/BO/Utils/BillRpc/OrderDetailRpc.cs +++ b/BO/Utils/BillRpc/OrderDetailRpc.cs @@ -87,7 +87,7 @@ namespace BO.Utils.BillRpc return RpcFacade.Call(method, id) == -1; } - public static HurryRecord InsertHurryRecord(SelectHurryList entity,out bool withError) + public static HurryRecord InsertHurryRecord(SelectHurryList entity, out bool withError) { var detail = new HurryRecord(); detail.HurryNumber = entity.HurryNumber; @@ -114,5 +114,11 @@ namespace BO.Utils.BillRpc const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/OrderDetailRpc/GetSelectHurryList"; return serializer.Deserialize>(RpcFacade.Call(method)); } + + public static void SetOrderState(long id, int state) + { + const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/OrderDetailRpc/SetOrderState"; + RpcFacade.Call(method, id, state); + } } } diff --git a/OrderConfirm/OrderConfirmForm.Designer.cs b/OrderConfirm/OrderConfirmForm.Designer.cs index 04af847..9162747 100644 --- a/OrderConfirm/OrderConfirmForm.Designer.cs +++ b/OrderConfirm/OrderConfirmForm.Designer.cs @@ -30,9 +30,10 @@ { 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 dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - this.uDataGridView1 = new BWP.WinFormControl.UDataGridView(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); + this.orderGrid = 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(); @@ -40,25 +41,31 @@ this.uDatePicker1 = new BWP.WinFormControl.UDatePicker(); this.label1 = new System.Windows.Forms.Label(); this.vScrollBar1 = new System.Windows.Forms.VScrollBar(); + this.setTop = new System.Windows.Forms.CheckBox(); this.C_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.C_Confirmed = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.C_IsHurryButcher = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.C_WeightBill_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.C_SecondarySplit = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.C_OrderState = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.C_Order = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.C_B3WeighBill_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.C_Supplier_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.C_LiveColonyHouse_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.C_Number = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.C_PlanNumber = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.C_OK = new System.Windows.Forms.DataGridViewButtonColumn(); - ((System.ComponentModel.ISupportInitialize)(this.uDataGridView1)).BeginInit(); + this.C_Finish = new System.Windows.Forms.DataGridViewButtonColumn(); + ((System.ComponentModel.ISupportInitialize)(this.orderGrid)).BeginInit(); this.SuspendLayout(); // - // uDataGridView1 + // orderGrid // - this.uDataGridView1.AllowUserToAddRows = false; - this.uDataGridView1.AllowUserToDeleteRows = false; - this.uDataGridView1.AllowUserToResizeColumns = false; - this.uDataGridView1.AllowUserToResizeRows = false; + this.orderGrid.AllowUserToAddRows = false; + this.orderGrid.AllowUserToDeleteRows = false; + this.orderGrid.AllowUserToResizeColumns = false; + this.orderGrid.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; + this.orderGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; + this.orderGrid.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); @@ -66,33 +73,38 @@ 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.orderGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; + this.orderGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.orderGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.C_ID, - this.C_Confirmed, + this.C_IsHurryButcher, + this.C_WeightBill_ID, + this.C_SecondarySplit, + this.C_OrderState, this.C_Order, this.C_B3WeighBill_ID, + this.C_Supplier_Name, 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); + this.C_PlanNumber, + this.C_OK, + this.C_Finish}); + this.orderGrid.Location = new System.Drawing.Point(35, 73); + this.orderGrid.MultiSelect = false; + this.orderGrid.Name = "orderGrid"; + this.orderGrid.ReadOnly = true; + this.orderGrid.RowHeadersVisible = false; + dataGridViewCellStyle5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle5.ForeColor = System.Drawing.Color.Black; + dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + dataGridViewCellStyle5.SelectionForeColor = System.Drawing.Color.Black; + this.orderGrid.RowsDefaultCellStyle = dataGridViewCellStyle5; + this.orderGrid.RowTemplate.Height = 60; + this.orderGrid.ScrollBars = System.Windows.Forms.ScrollBars.None; + this.orderGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.orderGrid.Size = new System.Drawing.Size(753, 525); + this.orderGrid.TabIndex = 0; + this.orderGrid.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.orderGrid_CellClick); + this.orderGrid.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.orderGrid_CellContentClick); // // existBtn // @@ -167,6 +179,17 @@ this.vScrollBar1.Size = new System.Drawing.Size(40, 525); this.vScrollBar1.TabIndex = 52; // + // setTop + // + this.setTop.AutoSize = true; + this.setTop.Font = new System.Drawing.Font("宋体", 15F); + this.setTop.Location = new System.Drawing.Point(620, 17); + this.setTop.Name = "setTop"; + this.setTop.Size = new System.Drawing.Size(68, 24); + this.setTop.TabIndex = 53; + this.setTop.Text = "置顶"; + this.setTop.UseVisualStyleBackColor = true; + // // C_ID // this.C_ID.DataPropertyName = "ID"; @@ -175,27 +198,61 @@ this.C_ID.ReadOnly = true; this.C_ID.Visible = false; // - // C_Confirmed + // C_IsHurryButcher + // + this.C_IsHurryButcher.DataPropertyName = "IsHurryButcher"; + this.C_IsHurryButcher.HeaderText = "IsHurryButcher"; + this.C_IsHurryButcher.Name = "C_IsHurryButcher"; + this.C_IsHurryButcher.ReadOnly = true; + this.C_IsHurryButcher.Visible = false; + // + // C_WeightBill_ID + // + this.C_WeightBill_ID.DataPropertyName = "WeightBill_ID"; + this.C_WeightBill_ID.HeaderText = "WeightBill_ID"; + this.C_WeightBill_ID.Name = "C_WeightBill_ID"; + this.C_WeightBill_ID.ReadOnly = true; + this.C_WeightBill_ID.Visible = false; // - 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_SecondarySplit + // + this.C_SecondarySplit.DataPropertyName = "SecondarySplit"; + this.C_SecondarySplit.HeaderText = "SecondarySplit"; + this.C_SecondarySplit.Name = "C_SecondarySplit"; + this.C_SecondarySplit.ReadOnly = true; + this.C_SecondarySplit.Visible = false; + // + // C_OrderState + // + this.C_OrderState.DataPropertyName = "OrderState"; + this.C_OrderState.HeaderText = "OrderState"; + this.C_OrderState.Name = "C_OrderState"; + this.C_OrderState.ReadOnly = true; + this.C_OrderState.Visible = false; // // C_Order // this.C_Order.DataPropertyName = "Order"; - this.C_Order.HeaderText = "排宰顺序"; + this.C_Order.HeaderText = "序号"; this.C_Order.Name = "C_Order"; this.C_Order.ReadOnly = true; + this.C_Order.Width = 80; // // C_B3WeighBill_ID // this.C_B3WeighBill_ID.DataPropertyName = "B3WeighBill_ID"; - this.C_B3WeighBill_ID.HeaderText = "过磅单号"; + this.C_B3WeighBill_ID.HeaderText = "磅单号"; this.C_B3WeighBill_ID.Name = "C_B3WeighBill_ID"; this.C_B3WeighBill_ID.ReadOnly = true; + this.C_B3WeighBill_ID.Width = 90; + // + // C_Supplier_Name + // + this.C_Supplier_Name.DataPropertyName = "Supplier_Name"; + this.C_Supplier_Name.HeaderText = "供应商"; + this.C_Supplier_Name.Name = "C_Supplier_Name"; + this.C_Supplier_Name.ReadOnly = true; + this.C_Supplier_Name.Width = 110; // // C_LiveColonyHouse_Name // @@ -203,32 +260,45 @@ 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; + this.C_LiveColonyHouse_Name.Width = 150; // - // C_Number + // C_PlanNumber // - this.C_Number.DataPropertyName = "Number"; - this.C_Number.HeaderText = "头数"; - this.C_Number.Name = "C_Number"; - this.C_Number.ReadOnly = true; + this.C_PlanNumber.DataPropertyName = "PlanNumber"; + this.C_PlanNumber.HeaderText = "头数"; + this.C_PlanNumber.Name = "C_PlanNumber"; + this.C_PlanNumber.ReadOnly = true; + this.C_PlanNumber.Width = 80; // // 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.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; + this.C_OK.Text = ""; + this.C_OK.Width = 120; + // + // C_Finish + // + dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle4.Padding = new System.Windows.Forms.Padding(10); + this.C_Finish.DefaultCellStyle = dataGridViewCellStyle4; + this.C_Finish.HeaderText = "完毕"; + this.C_Finish.Name = "C_Finish"; + this.C_Finish.ReadOnly = true; + this.C_Finish.Text = "完毕"; + this.C_Finish.UseColumnTextForButtonValue = true; + this.C_Finish.Width = 120; // // 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.setTop); this.Controls.Add(this.vScrollBar1); this.Controls.Add(this.existBtn); this.Controls.Add(this.orderLabel); @@ -236,13 +306,15 @@ this.Controls.Add(this.syncBtn); this.Controls.Add(this.uDatePicker1); this.Controls.Add(this.label1); - this.Controls.Add(this.uDataGridView1); + this.Controls.Add(this.orderGrid); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.KeyPreview = true; this.MaximizeBox = false; this.Name = "OrderConfirmForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "上线确认"; - ((System.ComponentModel.ISupportInitialize)(this.uDataGridView1)).EndInit(); + this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.OrderConfirmForm_KeyUp); + ((System.ComponentModel.ISupportInitialize)(this.orderGrid)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -250,7 +322,7 @@ #endregion - private BWP.WinFormControl.UDataGridView uDataGridView1; + private BWP.WinFormControl.UDataGridView orderGrid; private System.Windows.Forms.Button existBtn; private System.Windows.Forms.Label orderLabel; private System.Windows.Forms.Label label2; @@ -258,12 +330,18 @@ private BWP.WinFormControl.UDatePicker uDatePicker1; private System.Windows.Forms.Label label1; private System.Windows.Forms.VScrollBar vScrollBar1; + private System.Windows.Forms.CheckBox setTop; private System.Windows.Forms.DataGridViewTextBoxColumn C_ID; - private System.Windows.Forms.DataGridViewTextBoxColumn C_Confirmed; + private System.Windows.Forms.DataGridViewTextBoxColumn C_IsHurryButcher; + private System.Windows.Forms.DataGridViewTextBoxColumn C_WeightBill_ID; + private System.Windows.Forms.DataGridViewTextBoxColumn C_SecondarySplit; + private System.Windows.Forms.DataGridViewTextBoxColumn C_OrderState; private System.Windows.Forms.DataGridViewTextBoxColumn C_Order; private System.Windows.Forms.DataGridViewTextBoxColumn C_B3WeighBill_ID; + private System.Windows.Forms.DataGridViewTextBoxColumn C_Supplier_Name; private System.Windows.Forms.DataGridViewTextBoxColumn C_LiveColonyHouse_Name; - private System.Windows.Forms.DataGridViewTextBoxColumn C_Number; + private System.Windows.Forms.DataGridViewTextBoxColumn C_PlanNumber; private System.Windows.Forms.DataGridViewButtonColumn C_OK; + private System.Windows.Forms.DataGridViewButtonColumn C_Finish; } } \ No newline at end of file diff --git a/OrderConfirm/OrderConfirmForm.cs b/OrderConfirm/OrderConfirmForm.cs index efa4cf1..965a333 100644 --- a/OrderConfirm/OrderConfirmForm.cs +++ b/OrderConfirm/OrderConfirmForm.cs @@ -30,14 +30,14 @@ namespace OrderConfirm #endregion private delegate void InvokeHandler(); - List list; + List orderList; Thread syncThread; public OrderConfirmForm() { InitializeComponent(); uDatePicker1.Date = DateTime.Today; - uDataGridView1.AutoGenerateColumns = false; - uDataGridView1.DataSource = null; + orderGrid.AutoGenerateColumns = false; + orderGrid.DataSource = null; this.FormClosing += delegate { if (syncThread != null && syncThread.IsAlive) @@ -68,55 +68,52 @@ namespace OrderConfirm { this.Invoke(new InvokeHandler(delegate() { - list = OrderConfirmRpc.GetConfirmOrder(uDatePicker1.Date.Value); BindOrderGrid(); })); Thread.Sleep(5000); } } - ConfirmOrder last; + OrderDetail lastOrderDetail; private void BindOrderGrid() { - uDataGridView1.DataSource = list.OrderByDescending(x => x.Order).OrderBy(x => x.Confirmed).ToList(); - if (last == null && uDataGridView1.CurrentRow != null) + orderList = OrderDetailRpc.GetOrderDetail(uDatePicker1.Date.Value); + orderGrid.DataSource = orderList.OrderBy(x => x.Order).OrderBy(x => x.Doing).ToList(); + if (lastOrderDetail == null && orderGrid.CurrentRow != null) { - last = uDataGridView1.CurrentRow.DataBoundItem as ConfirmOrder; - if (last.Confirmed) - { - last = null; - uDataGridView1.CurrentRow.DefaultCellStyle.BackColor = Color.YellowGreen; - } + lastOrderDetail = orderGrid.CurrentRow.DataBoundItem as OrderDetail; } - foreach (DataGridViewRow row in uDataGridView1.Rows) + foreach (DataGridViewRow row in orderGrid.Rows) { - if ((bool)row.Cells["C_Confirmed"].Value) - row.DefaultCellStyle.BackColor = Color.YellowGreen; - if (last != null && last.ID == (long)row.Cells["C_ID"].Value) + var state = (int)row.Cells["C_OrderState"].Value; + if ((bool)row.Cells["C_IsHurryButcher"].Value) + row.DefaultCellStyle.BackColor = ColorTranslator.FromHtml("#CC9999"); + if ((bool)row.Cells["C_SecondarySplit"].Value) + row.DefaultCellStyle.BackColor = ColorTranslator.FromHtml("#6699CC"); + ((DataGridViewButtonCell)row.Cells["C_OK"]).Value = state==0 ? "开始" : "取消"; + if (lastOrderDetail != null && lastOrderDetail.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; + lastOrderDetail = row.DataBoundItem as OrderDetail; + var c = orderGrid.RowsDefaultCellStyle.SelectionBackColor; + if (lastOrderDetail.IsHurryButcher) + row.DefaultCellStyle.BackColor = ColorTranslator.FromHtml("#FF9900"); + if (lastOrderDetail.SecondarySplit) + row.DefaultCellStyle.BackColor = ColorTranslator.FromHtml("#006699"); + row.DefaultCellStyle.BackColor = c; } } - if (last != null && !last.Confirmed) - orderLabel.Text = last.Order.ToString(); - else - orderLabel.Text = "0"; InitScrollBar1(); - uDataGridView1.ClearSelection(); + orderGrid.ClearSelection(); try { if (roll != -1) - uDataGridView1.FirstDisplayedScrollingRowIndex = roll; + orderGrid.FirstDisplayedScrollingRowIndex = roll; } catch { roll = -1; } - uDataGridView1.Refresh(); + orderGrid.Refresh(); } private void existBtn_Click(object sender, EventArgs e) @@ -127,59 +124,85 @@ namespace OrderConfirm int roll = -1; private void InitScrollBar1() { - vScrollBar1.Maximum = (uDataGridView1.RowCount - uDataGridView1.DisplayedRowCount(false) + 30) * uDataGridView1.RowTemplate.Height; + vScrollBar1.Maximum = (orderGrid.RowCount - orderGrid.DisplayedRowCount(false) + 30) * orderGrid.RowTemplate.Height; vScrollBar1.Minimum = 0; - vScrollBar1.SmallChange = uDataGridView1.RowTemplate.Height; - vScrollBar1.LargeChange = uDataGridView1.RowTemplate.Height * 30; + vScrollBar1.SmallChange = orderGrid.RowTemplate.Height; + vScrollBar1.LargeChange = orderGrid.RowTemplate.Height * 30; this.vScrollBar1.Scroll += (sender, e) => { - roll = e.NewValue / uDataGridView1.RowTemplate.Height; - uDataGridView1.FirstDisplayedScrollingRowIndex = roll; + roll = e.NewValue / orderGrid.RowTemplate.Height; + orderGrid.FirstDisplayedScrollingRowIndex = roll; }; } - private void uDataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) + private void orderGrid_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == -1) return; - var entity = uDataGridView1.CurrentRow.DataBoundItem as ConfirmOrder; - if (e.ColumnIndex != uDataGridView1.Columns.Count - 1)//非确定列 + var entity = orderGrid.CurrentRow.DataBoundItem as OrderDetail; + if (lastOrderDetail != null) { - if (last != null) + foreach (DataGridViewRow row in orderGrid.Rows) { - foreach (DataGridViewRow row in uDataGridView1.Rows) + if (lastOrderDetail.ID == (long)row.Cells["C_ID"].Value) { - if (last.ID == (long)row.Cells["C_ID"].Value) - { - row.DefaultCellStyle.BackColor = last.Confirmed ? Color.YellowGreen : uDataGridView1.RowsDefaultCellStyle.BackColor; - break; - } + Color c = orderGrid.RowsDefaultCellStyle.BackColor; + if (lastOrderDetail.IsHurryButcher) + c = ColorTranslator.FromHtml("#CC9999"); + if (lastOrderDetail.SecondarySplit) + c = ColorTranslator.FromHtml("#6699CC"); + row.DefaultCellStyle.BackColor = c; + 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(); + lastOrderDetail = entity; + + var bc = orderGrid.RowsDefaultCellStyle.SelectionBackColor; + if (lastOrderDetail.IsHurryButcher) + bc = ColorTranslator.FromHtml("#FF9900"); + if (lastOrderDetail.SecondarySplit) + bc = ColorTranslator.FromHtml("#006699"); + orderGrid.CurrentRow.DefaultCellStyle.SelectionBackColor = bc; + orderGrid.Refresh(); } - private void uDataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) + private void orderGrid_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == -1) return; - if (e.ColumnIndex == uDataGridView1.ColumnCount - 1)//确定 + if (e.ColumnIndex < orderGrid.ColumnCount - 2) + return; + if (lastOrderDetail.OrderState == 20) + return; + if (e.ColumnIndex == orderGrid.ColumnCount - 2)//开始 取消 + OrderDetailRpc.SetOrderState(lastOrderDetail.ID, lastOrderDetail.OrderState == 0 ? 10 : 0); + else//完成 + OrderDetailRpc.SetOrderState(lastOrderDetail.ID, 20); + BindOrderGrid(); + } + + string code = string.Empty; + bool start = false; + private void OrderConfirmForm_KeyUp(object sender, KeyEventArgs e) + { + switch (e.KeyData) { - var entity = uDataGridView1.CurrentRow.DataBoundItem as ConfirmOrder; - if (entity.Confirmed) - return; - entity.Confirmed = true; - OrderConfirmRpc.SetOrderConfirmed(entity.ID); - BindOrderGrid(); + case Keys.S: + start = true; + code = string.Empty; + break; + case Keys.E: + if (!start) + break; + MessageBox.Show(code); + start = false; + code = string.Empty; + break; + default: + if(start) + code += (char)e.KeyValue; + break; } } } diff --git a/OrderConfirm/OrderConfirmForm.resx b/OrderConfirm/OrderConfirmForm.resx index cd00c51..329ff1b 100644 --- a/OrderConfirm/OrderConfirmForm.resx +++ b/OrderConfirm/OrderConfirmForm.resx @@ -120,7 +120,16 @@ True - + + True + + + True + + + True + + True @@ -129,13 +138,19 @@ True + + True + True - + True True + + True + \ No newline at end of file diff --git a/QualityAndOrder/HurryRecordPrint.cs b/QualityAndOrder/HurryRecordPrint.cs index 64dcf4a..fed802d 100644 --- a/QualityAndOrder/HurryRecordPrint.cs +++ b/QualityAndOrder/HurryRecordPrint.cs @@ -15,9 +15,8 @@ namespace QualityAndOrder PrintAPI.B_GetUSBBufferLen(); PrintAPI.B_EnumUSB(new byte[128]); PrintAPI.B_CreateUSBPort(1); - PrintAPI.B_Prn_Text_TrueType(250, 15, 38, "宋体", 1, 700, 0, 0, 0, "C1", "急宰扫码"); - PrintAPI.B_Bar2d_QR(45, 75, 2, 13, 'M', 'A', 0, 0, 0, entity.ID.ToString()); + PrintAPI.B_Bar2d_QR(45, 75, 2, 13, 'M', 'A', 0, 0, 0, string.Format("s{0}e", entity.ID)); PrintAPI.B_Prn_Text_TrueType(335, 90, 32, "宋体", 1, 600, 0, 0, 0, "C2", string.Format("磅单号:{0}", entity.B3WeighBill_ID)); PrintAPI.B_Prn_Text_TrueType(335, 150, 32, "宋体", 1, 600, 0, 0, 0, "C3", string.Format("供应商:{0}", entity.Supplier_Name));