diff --git a/BO/BO/Bill/GradeAndWeight/GradeAndWeight.cs b/BO/BO/Bill/GradeAndWeight/GradeAndWeight.cs index ed9d5f5..9f62d3b 100644 --- a/BO/BO/Bill/GradeAndWeight/GradeAndWeight.cs +++ b/BO/BO/Bill/GradeAndWeight/GradeAndWeight.cs @@ -12,10 +12,6 @@ namespace BO.BO.Bill public int Order { get; set; } - public short Technics { get; set; } - - public string Technics_Name { get; set; } - public int Number { get; set; } public int Already { get; set; } diff --git a/BO/Utils/BillRpc/GradeAndWeightRpc.cs b/BO/Utils/BillRpc/GradeAndWeightRpc.cs index 763797c..3570431 100644 --- a/BO/Utils/BillRpc/GradeAndWeightRpc.cs +++ b/BO/Utils/BillRpc/GradeAndWeightRpc.cs @@ -14,10 +14,10 @@ namespace BO.Utils.BillRpc { static JavaScriptSerializer serializer = new JavaScriptSerializer(); - public static List GetGradeAndWeightList(DateTime date, long? maxID = null) + public static List GetGradeAndWeightList(DateTime date,bool isTang) { const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/GradeAndWeightRpc/GetGradeAndWeightList"; - var result = RpcFacade.Call(method, date, maxID); + var result = RpcFacade.Call(method, date, isTang); return serializer.Deserialize>(result); } diff --git a/ButcherOrder/ButcherOrderForm.cs b/ButcherOrder/ButcherOrderForm.cs index 44f3645..a499f03 100644 --- a/ButcherOrder/ButcherOrderForm.cs +++ b/ButcherOrder/ButcherOrderForm.cs @@ -121,10 +121,7 @@ namespace ButcherOrder { last = secondOrderGridView.CurrentRow.DataBoundItem as SecondOrder; if (last.Finish) - { last = null; - secondOrderGridView.CurrentRow.DefaultCellStyle.BackColor = Color.YellowGreen; - } } foreach (DataGridViewRow row in secondOrderGridView.Rows) { diff --git a/QualityAndOrder/QualityOrderForm.cs b/QualityAndOrder/QualityOrderForm.cs index 13f10fc..0296e7e 100644 --- a/QualityAndOrder/QualityOrderForm.cs +++ b/QualityAndOrder/QualityOrderForm.cs @@ -259,15 +259,11 @@ namespace QualityAndOrder btn.Click += (sender, e) => { if (currentBtn != null) - { - currentBtn.BackColor = btnUnSelectBackColor; - currentBtn.ForeColor = btnUnSelectForeColor; - } + SetBtnUnCheck(currentBtn); if (currentBtn != btn) { - btn.BackColor = btnSelectBackColor; - btn.ForeColor = btnSelectForeColor; currentBtn = btn; + SetBtnChecked(currentBtn); } else currentBtn = null; diff --git a/WeighAndGrading/GradeFrom.Designer.cs b/WeighAndGrading/GradeFrom.Designer.cs index d6ebd3d..8c477a3 100644 --- a/WeighAndGrading/GradeFrom.Designer.cs +++ b/WeighAndGrading/GradeFrom.Designer.cs @@ -30,13 +30,17 @@ { System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = 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(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); this.label1 = new System.Windows.Forms.Label(); this.syncBtn = new System.Windows.Forms.Button(); this.label2 = new System.Windows.Forms.Label(); @@ -44,8 +48,25 @@ this.label4 = new System.Windows.Forms.Label(); this.alreadyLabel = new System.Windows.Forms.Label(); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.tangScrollBar = new System.Windows.Forms.VScrollBar(); this.ttPanel = new System.Windows.Forms.FlowLayoutPanel(); + this.label10 = new System.Windows.Forms.Label(); + this.tangGridView = new BWP.WinFormControl.UDataGridView(); + this.T_OrderDetail_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.T_Finish = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.T_Order = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.T_Number = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.T_Already = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.T_FinishBtn = new System.Windows.Forms.DataGridViewButtonColumn(); this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.maoScrollBar = new System.Windows.Forms.VScrollBar(); + this.maoGridView = new BWP.WinFormControl.UDataGridView(); + this.M_OrderDetail_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.M_Finish = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.M_Order = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.M_Number = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.M_Already = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.M_FinishBtn = new System.Windows.Forms.DataGridViewButtonColumn(); this.label11 = new System.Windows.Forms.Label(); this.mbPanel = new System.Windows.Forms.FlowLayoutPanel(); this.groupBox3 = new System.Windows.Forms.GroupBox(); @@ -65,16 +86,6 @@ this.printBtn = new System.Windows.Forms.Button(); this.panel1 = new System.Windows.Forms.Panel(); this.lblChengZhong = new System.Windows.Forms.Label(); - this.label10 = new System.Windows.Forms.Label(); - this.dataGridView = new BWP.WinFormControl.UDataGridView(); - this.D_OrderDetail_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.D_Technics = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.D_Finish = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.D_Order = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.D_Technics_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.D_Number = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.D_Already = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.D_FinishBtn = new System.Windows.Forms.DataGridViewButtonColumn(); this.butcherTimeInput = new BWP.WinFormControl.UDatePicker(); this.closeBtn = new System.Windows.Forms.Button(); this.configBtn = new System.Windows.Forms.Button(); @@ -83,13 +94,13 @@ this.cancelBtn = new System.Windows.Forms.Button(); this.discontBtn = new System.Windows.Forms.Button(); this.discontPanel = new System.Windows.Forms.FlowLayoutPanel(); - this.vScrollBar1 = new System.Windows.Forms.VScrollBar(); this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.tangGridView)).BeginInit(); this.groupBox2.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.maoGridView)).BeginInit(); this.groupBox3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.historyGrid)).BeginInit(); this.panel1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); this.modifyPanel.SuspendLayout(); this.SuspendLayout(); // @@ -118,7 +129,7 @@ // this.label2.AutoSize = true; this.label2.Font = new System.Drawing.Font("宋体", 15F); - this.label2.Location = new System.Drawing.Point(511, 131); + this.label2.Location = new System.Drawing.Point(443, 136); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(109, 20); this.label2.TabIndex = 5; @@ -128,7 +139,7 @@ // this.orderLabel.AutoSize = true; this.orderLabel.Font = new System.Drawing.Font("宋体", 15F); - this.orderLabel.Location = new System.Drawing.Point(616, 131); + this.orderLabel.Location = new System.Drawing.Point(548, 136); this.orderLabel.Name = "orderLabel"; this.orderLabel.Size = new System.Drawing.Size(19, 20); this.orderLabel.TabIndex = 6; @@ -138,7 +149,7 @@ // this.label4.AutoSize = true; this.label4.Font = new System.Drawing.Font("宋体", 15F); - this.label4.Location = new System.Drawing.Point(675, 131); + this.label4.Location = new System.Drawing.Point(599, 136); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(109, 20); this.label4.TabIndex = 7; @@ -148,7 +159,7 @@ // this.alreadyLabel.AutoSize = true; this.alreadyLabel.Font = new System.Drawing.Font("宋体", 15F); - this.alreadyLabel.Location = new System.Drawing.Point(776, 131); + this.alreadyLabel.Location = new System.Drawing.Point(700, 136); this.alreadyLabel.Name = "alreadyLabel"; this.alreadyLabel.Size = new System.Drawing.Size(19, 20); this.alreadyLabel.TabIndex = 8; @@ -156,32 +167,247 @@ // // groupBox1 // + this.groupBox1.Controls.Add(this.tangScrollBar); this.groupBox1.Controls.Add(this.ttPanel); - this.groupBox1.Location = new System.Drawing.Point(505, 175); + this.groupBox1.Controls.Add(this.label10); + this.groupBox1.Controls.Add(this.tangGridView); + this.groupBox1.Location = new System.Drawing.Point(16, 175); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(294, 330); + this.groupBox1.Size = new System.Drawing.Size(783, 330); this.groupBox1.TabIndex = 9; this.groupBox1.TabStop = false; this.groupBox1.Text = "烫褪"; // + // tangScrollBar + // + this.tangScrollBar.Location = new System.Drawing.Point(373, 36); + this.tangScrollBar.Name = "tangScrollBar"; + this.tangScrollBar.Size = new System.Drawing.Size(40, 275); + this.tangScrollBar.TabIndex = 51; + // // ttPanel // - this.ttPanel.Location = new System.Drawing.Point(12, 36); + this.ttPanel.Location = new System.Drawing.Point(431, 35); this.ttPanel.Name = "ttPanel"; - this.ttPanel.Size = new System.Drawing.Size(270, 276); + this.ttPanel.Size = new System.Drawing.Size(337, 276); this.ttPanel.TabIndex = 0; // + // label10 + // + this.label10.AutoSize = true; + this.label10.Font = new System.Drawing.Font("宋体", 15F); + this.label10.Location = new System.Drawing.Point(6, -1); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(49, 20); + this.label10.TabIndex = 32; + this.label10.Text = "烫褪"; + // + // tangGridView + // + this.tangGridView.AllowUserToAddRows = false; + this.tangGridView.AllowUserToDeleteRows = false; + this.tangGridView.AllowUserToResizeColumns = false; + this.tangGridView.AllowUserToResizeRows = false; + dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.tangGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; + this.tangGridView.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.tangGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; + this.tangGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.tangGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.T_OrderDetail_ID, + this.T_Finish, + this.T_Order, + this.T_Number, + this.T_Already, + this.T_FinishBtn}); + this.tangGridView.Location = new System.Drawing.Point(10, 36); + this.tangGridView.MultiSelect = false; + this.tangGridView.Name = "tangGridView"; + this.tangGridView.ReadOnly = true; + this.tangGridView.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.tangGridView.RowsDefaultCellStyle = dataGridViewCellStyle4; + this.tangGridView.RowTemplate.Height = 60; + this.tangGridView.ScrollBars = System.Windows.Forms.ScrollBars.None; + this.tangGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.tangGridView.Size = new System.Drawing.Size(363, 275); + this.tangGridView.TabIndex = 4; + this.tangGridView.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.tangGridView_CellClick); + this.tangGridView.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.tangGridView_CellContentClick); + // + // T_OrderDetail_ID + // + this.T_OrderDetail_ID.DataPropertyName = "OrderDetail_ID"; + this.T_OrderDetail_ID.HeaderText = "OrderDetail_ID"; + this.T_OrderDetail_ID.Name = "T_OrderDetail_ID"; + this.T_OrderDetail_ID.ReadOnly = true; + this.T_OrderDetail_ID.Visible = false; + // + // T_Finish + // + this.T_Finish.DataPropertyName = "Finish"; + this.T_Finish.HeaderText = "Finish"; + this.T_Finish.Name = "T_Finish"; + this.T_Finish.ReadOnly = true; + this.T_Finish.Visible = false; + // + // T_Order + // + this.T_Order.DataPropertyName = "Order"; + this.T_Order.HeaderText = "屠宰顺序"; + this.T_Order.Name = "T_Order"; + this.T_Order.ReadOnly = true; + // + // T_Number + // + this.T_Number.DataPropertyName = "Number"; + this.T_Number.HeaderText = "头数"; + this.T_Number.Name = "T_Number"; + this.T_Number.ReadOnly = true; + this.T_Number.Width = 80; + // + // T_Already + // + this.T_Already.DataPropertyName = "Already"; + this.T_Already.HeaderText = "已宰"; + this.T_Already.Name = "T_Already"; + this.T_Already.ReadOnly = true; + this.T_Already.Width = 80; + // + // T_FinishBtn + // + dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle3.Padding = new System.Windows.Forms.Padding(5, 10, 5, 10); + this.T_FinishBtn.DefaultCellStyle = dataGridViewCellStyle3; + this.T_FinishBtn.HeaderText = "完毕"; + this.T_FinishBtn.Name = "T_FinishBtn"; + this.T_FinishBtn.ReadOnly = true; + this.T_FinishBtn.Text = "完毕"; + this.T_FinishBtn.UseColumnTextForButtonValue = true; + // // groupBox2 // + this.groupBox2.Controls.Add(this.maoScrollBar); + this.groupBox2.Controls.Add(this.maoGridView); this.groupBox2.Controls.Add(this.label11); this.groupBox2.Controls.Add(this.mbPanel); - this.groupBox2.Location = new System.Drawing.Point(505, 525); + this.groupBox2.Location = new System.Drawing.Point(16, 525); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(294, 330); + this.groupBox2.Size = new System.Drawing.Size(783, 330); this.groupBox2.TabIndex = 10; this.groupBox2.TabStop = false; this.groupBox2.Text = "毛剥"; // + // maoScrollBar + // + this.maoScrollBar.Location = new System.Drawing.Point(373, 35); + this.maoScrollBar.Name = "maoScrollBar"; + this.maoScrollBar.Size = new System.Drawing.Size(40, 278); + this.maoScrollBar.TabIndex = 52; + // + // maoGridView + // + this.maoGridView.AllowUserToAddRows = false; + this.maoGridView.AllowUserToDeleteRows = false; + this.maoGridView.AllowUserToResizeColumns = false; + this.maoGridView.AllowUserToResizeRows = false; + dataGridViewCellStyle5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.maoGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle5; + this.maoGridView.BackgroundColor = System.Drawing.Color.White; + dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle6.Font = new System.Drawing.Font("宋体", 12F); + dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.maoGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle6; + this.maoGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.maoGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.M_OrderDetail_ID, + this.M_Finish, + this.M_Order, + this.M_Number, + this.M_Already, + this.M_FinishBtn}); + this.maoGridView.Location = new System.Drawing.Point(10, 35); + this.maoGridView.MultiSelect = false; + this.maoGridView.Name = "maoGridView"; + this.maoGridView.ReadOnly = true; + this.maoGridView.RowHeadersVisible = false; + dataGridViewCellStyle8.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle8.ForeColor = System.Drawing.Color.Black; + dataGridViewCellStyle8.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + dataGridViewCellStyle8.SelectionForeColor = System.Drawing.Color.Black; + this.maoGridView.RowsDefaultCellStyle = dataGridViewCellStyle8; + this.maoGridView.RowTemplate.Height = 60; + this.maoGridView.ScrollBars = System.Windows.Forms.ScrollBars.Horizontal; + this.maoGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this.maoGridView.Size = new System.Drawing.Size(363, 278); + this.maoGridView.TabIndex = 33; + this.maoGridView.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.maoGridView_CellClick); + this.maoGridView.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.maoGridView_CellContentClick); + // + // M_OrderDetail_ID + // + this.M_OrderDetail_ID.DataPropertyName = "OrderDetail_ID"; + this.M_OrderDetail_ID.HeaderText = "OrderDetail_ID"; + this.M_OrderDetail_ID.Name = "M_OrderDetail_ID"; + this.M_OrderDetail_ID.ReadOnly = true; + this.M_OrderDetail_ID.Visible = false; + // + // M_Finish + // + this.M_Finish.DataPropertyName = "Finish"; + this.M_Finish.HeaderText = "Finish"; + this.M_Finish.Name = "M_Finish"; + this.M_Finish.ReadOnly = true; + this.M_Finish.Visible = false; + // + // M_Order + // + this.M_Order.DataPropertyName = "Order"; + this.M_Order.HeaderText = "屠宰顺序"; + this.M_Order.Name = "M_Order"; + this.M_Order.ReadOnly = true; + // + // M_Number + // + this.M_Number.DataPropertyName = "Number"; + this.M_Number.HeaderText = "头数"; + this.M_Number.Name = "M_Number"; + this.M_Number.ReadOnly = true; + this.M_Number.Width = 80; + // + // M_Already + // + this.M_Already.DataPropertyName = "Already"; + this.M_Already.HeaderText = "已宰"; + this.M_Already.Name = "M_Already"; + this.M_Already.ReadOnly = true; + this.M_Already.Width = 80; + // + // M_FinishBtn + // + dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle7.Padding = new System.Windows.Forms.Padding(5, 10, 5, 10); + this.M_FinishBtn.DefaultCellStyle = dataGridViewCellStyle7; + this.M_FinishBtn.HeaderText = "完毕"; + this.M_FinishBtn.Name = "M_FinishBtn"; + this.M_FinishBtn.ReadOnly = true; + this.M_FinishBtn.Text = "完毕"; + this.M_FinishBtn.UseColumnTextForButtonValue = true; + // // label11 // this.label11.AutoSize = true; @@ -194,9 +420,9 @@ // // mbPanel // - this.mbPanel.Location = new System.Drawing.Point(12, 37); + this.mbPanel.Location = new System.Drawing.Point(431, 35); this.mbPanel.Name = "mbPanel"; - this.mbPanel.Size = new System.Drawing.Size(270, 276); + this.mbPanel.Size = new System.Drawing.Size(337, 278); this.mbPanel.TabIndex = 1; // // groupBox3 @@ -234,17 +460,17 @@ this.historyGrid.AllowUserToDeleteRows = false; this.historyGrid.AllowUserToResizeColumns = false; this.historyGrid.AllowUserToResizeRows = false; - dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); - this.historyGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle9.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.historyGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle9; this.historyGrid.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.historyGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle10.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle10.Font = new System.Drawing.Font("宋体", 12F); + dataGridViewCellStyle10.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle10.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle10.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.historyGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle10; this.historyGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.historyGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.H_ID, @@ -260,9 +486,9 @@ this.historyGrid.Name = "historyGrid"; this.historyGrid.ReadOnly = true; this.historyGrid.RowHeadersVisible = false; - dataGridViewCellStyle5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); - this.historyGrid.RowsDefaultCellStyle = dataGridViewCellStyle5; + dataGridViewCellStyle13.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle13.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + this.historyGrid.RowsDefaultCellStyle = dataGridViewCellStyle13; this.historyGrid.RowTemplate.Height = 40; this.historyGrid.ScrollBars = System.Windows.Forms.ScrollBars.None; this.historyGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; @@ -320,8 +546,8 @@ // H_Weight // this.H_Weight.DataPropertyName = "Weight"; - dataGridViewCellStyle3.Format = "#0.######"; - this.H_Weight.DefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle11.Format = "#0.######"; + this.H_Weight.DefaultCellStyle = dataGridViewCellStyle11; this.H_Weight.HeaderText = "重量"; this.H_Weight.Name = "H_Weight"; this.H_Weight.ReadOnly = true; @@ -330,9 +556,9 @@ // H_Time // this.H_Time.DataPropertyName = "Time"; - dataGridViewCellStyle4.Format = "MM/dd HH:mm"; - dataGridViewCellStyle4.NullValue = null; - this.H_Time.DefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle12.Format = "MM/dd HH:mm"; + dataGridViewCellStyle12.NullValue = null; + this.H_Time.DefaultCellStyle = dataGridViewCellStyle12; this.H_Time.HeaderText = "时间"; this.H_Time.Name = "H_Time"; this.H_Time.ReadOnly = true; @@ -341,10 +567,10 @@ // this.enableWeight.AutoCheck = false; this.enableWeight.AutoSize = true; - this.enableWeight.Font = new System.Drawing.Font("宋体", 15F); - this.enableWeight.Location = new System.Drawing.Point(10, 91); + this.enableWeight.Font = new System.Drawing.Font("宋体", 18F); + this.enableWeight.Location = new System.Drawing.Point(12, 91); this.enableWeight.Name = "enableWeight"; - this.enableWeight.Size = new System.Drawing.Size(108, 24); + this.enableWeight.Size = new System.Drawing.Size(125, 28); this.enableWeight.TabIndex = 31; this.enableWeight.Text = "启用称重"; this.enableWeight.UseVisualStyleBackColor = true; @@ -393,126 +619,6 @@ this.lblChengZhong.TabIndex = 0; this.lblChengZhong.Text = "0.00"; // - // label10 - // - this.label10.AutoSize = true; - this.label10.Font = new System.Drawing.Font("宋体", 15F); - this.label10.Location = new System.Drawing.Point(511, 171); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(49, 20); - this.label10.TabIndex = 32; - this.label10.Text = "烫褪"; - // - // dataGridView - // - this.dataGridView.AllowUserToAddRows = false; - this.dataGridView.AllowUserToDeleteRows = false; - this.dataGridView.AllowUserToResizeColumns = false; - this.dataGridView.AllowUserToResizeRows = false; - dataGridViewCellStyle6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); - this.dataGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle6; - this.dataGridView.BackgroundColor = System.Drawing.Color.White; - dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle7.Font = new System.Drawing.Font("宋体", 12F); - dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.dataGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7; - this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.D_OrderDetail_ID, - this.D_Technics, - this.D_Finish, - this.D_Order, - this.D_Technics_Name, - this.D_Number, - this.D_Already, - this.D_FinishBtn}); - this.dataGridView.Location = new System.Drawing.Point(12, 175); - this.dataGridView.MultiSelect = false; - this.dataGridView.Name = "dataGridView"; - this.dataGridView.ReadOnly = true; - this.dataGridView.RowHeadersVisible = false; - dataGridViewCellStyle9.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle9.ForeColor = System.Drawing.Color.Black; - dataGridViewCellStyle9.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); - dataGridViewCellStyle9.SelectionForeColor = System.Drawing.Color.Black; - this.dataGridView.RowsDefaultCellStyle = dataGridViewCellStyle9; - this.dataGridView.RowTemplate.Height = 60; - this.dataGridView.ScrollBars = System.Windows.Forms.ScrollBars.None; - this.dataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.dataGridView.Size = new System.Drawing.Size(443, 566); - this.dataGridView.TabIndex = 4; - this.dataGridView.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_CellClick); - // - // D_OrderDetail_ID - // - 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.ReadOnly = true; - this.D_OrderDetail_ID.Visible = false; - // - // D_Technics - // - this.D_Technics.DataPropertyName = "Technics"; - this.D_Technics.HeaderText = "Technics"; - this.D_Technics.Name = "D_Technics"; - this.D_Technics.ReadOnly = true; - this.D_Technics.Visible = false; - // - // D_Finish - // - this.D_Finish.DataPropertyName = "Finish"; - this.D_Finish.HeaderText = "Finish"; - this.D_Finish.Name = "D_Finish"; - this.D_Finish.ReadOnly = true; - this.D_Finish.Visible = false; - // - // D_Order - // - this.D_Order.DataPropertyName = "Order"; - this.D_Order.HeaderText = "屠宰顺序"; - this.D_Order.Name = "D_Order"; - this.D_Order.ReadOnly = true; - // - // D_Technics_Name - // - this.D_Technics_Name.DataPropertyName = "Technics_Name"; - this.D_Technics_Name.HeaderText = "工艺"; - this.D_Technics_Name.Name = "D_Technics_Name"; - this.D_Technics_Name.ReadOnly = true; - this.D_Technics_Name.Width = 80; - // - // D_Number - // - this.D_Number.DataPropertyName = "Number"; - this.D_Number.HeaderText = "头数"; - this.D_Number.Name = "D_Number"; - this.D_Number.ReadOnly = true; - this.D_Number.Width = 80; - // - // D_Already - // - this.D_Already.DataPropertyName = "Already"; - this.D_Already.HeaderText = "已宰"; - this.D_Already.Name = "D_Already"; - this.D_Already.ReadOnly = true; - this.D_Already.Width = 80; - // - // D_FinishBtn - // - dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle8.Padding = new System.Windows.Forms.Padding(5, 10, 5, 10); - this.D_FinishBtn.DefaultCellStyle = dataGridViewCellStyle8; - this.D_FinishBtn.HeaderText = "完毕"; - this.D_FinishBtn.Name = "D_FinishBtn"; - this.D_FinishBtn.ReadOnly = true; - this.D_FinishBtn.Text = "完毕"; - this.D_FinishBtn.UseColumnTextForButtonValue = true; - // // butcherTimeInput // this.butcherTimeInput.BackColor = System.Drawing.Color.White; @@ -564,7 +670,7 @@ // this.modifyPanel.Controls.Add(this.cancelBtn); this.modifyPanel.Controls.Add(this.stateLabel); - this.modifyPanel.Location = new System.Drawing.Point(813, 107); + this.modifyPanel.Location = new System.Drawing.Point(826, 107); this.modifyPanel.Name = "modifyPanel"; this.modifyPanel.Size = new System.Drawing.Size(438, 56); this.modifyPanel.TabIndex = 36; @@ -600,25 +706,16 @@ this.discontPanel.Size = new System.Drawing.Size(71, 656); this.discontPanel.TabIndex = 33; // - // vScrollBar1 - // - this.vScrollBar1.Location = new System.Drawing.Point(455, 175); - this.vScrollBar1.Name = "vScrollBar1"; - this.vScrollBar1.Size = new System.Drawing.Size(40, 566); - this.vScrollBar1.TabIndex = 51; - // // GradeFrom // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1379, 865); - this.Controls.Add(this.vScrollBar1); this.Controls.Add(this.discontPanel); this.Controls.Add(this.discontBtn); this.Controls.Add(this.modifyPanel); this.Controls.Add(this.configBtn); this.Controls.Add(this.closeBtn); - this.Controls.Add(this.label10); this.Controls.Add(this.enableWeight); this.Controls.Add(this.groupBox3); this.Controls.Add(this.isPrintCheckBox); @@ -630,7 +727,6 @@ this.Controls.Add(this.label4); this.Controls.Add(this.orderLabel); this.Controls.Add(this.label2); - this.Controls.Add(this.dataGridView); this.Controls.Add(this.syncBtn); this.Controls.Add(this.butcherTimeInput); this.Controls.Add(this.label1); @@ -640,14 +736,16 @@ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "称重定级"; this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.tangGridView)).EndInit(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.maoGridView)).EndInit(); this.groupBox3.ResumeLayout(false); this.groupBox3.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.historyGrid)).EndInit(); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); this.modifyPanel.ResumeLayout(false); this.modifyPanel.PerformLayout(); this.ResumeLayout(false); @@ -660,7 +758,7 @@ private System.Windows.Forms.Label label1; private BWP.WinFormControl.UDatePicker butcherTimeInput; private System.Windows.Forms.Button syncBtn; - private BWP.WinFormControl.UDataGridView dataGridView; + private BWP.WinFormControl.UDataGridView tangGridView; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label orderLabel; private System.Windows.Forms.Label label4; @@ -695,14 +793,20 @@ private System.Windows.Forms.DataGridViewTextBoxColumn H_Livestock_Name; private System.Windows.Forms.DataGridViewTextBoxColumn H_Weight; private System.Windows.Forms.DataGridViewTextBoxColumn H_Time; - private System.Windows.Forms.VScrollBar vScrollBar1; - private System.Windows.Forms.DataGridViewTextBoxColumn D_OrderDetail_ID; - private System.Windows.Forms.DataGridViewTextBoxColumn D_Technics; - private System.Windows.Forms.DataGridViewTextBoxColumn D_Finish; - private System.Windows.Forms.DataGridViewTextBoxColumn D_Order; - private System.Windows.Forms.DataGridViewTextBoxColumn D_Technics_Name; - private System.Windows.Forms.DataGridViewTextBoxColumn D_Number; - private System.Windows.Forms.DataGridViewTextBoxColumn D_Already; - private System.Windows.Forms.DataGridViewButtonColumn D_FinishBtn; + private System.Windows.Forms.VScrollBar tangScrollBar; + private System.Windows.Forms.VScrollBar maoScrollBar; + private BWP.WinFormControl.UDataGridView maoGridView; + private System.Windows.Forms.DataGridViewTextBoxColumn T_OrderDetail_ID; + private System.Windows.Forms.DataGridViewTextBoxColumn T_Finish; + private System.Windows.Forms.DataGridViewTextBoxColumn T_Order; + private System.Windows.Forms.DataGridViewTextBoxColumn T_Number; + private System.Windows.Forms.DataGridViewTextBoxColumn T_Already; + private System.Windows.Forms.DataGridViewButtonColumn T_FinishBtn; + private System.Windows.Forms.DataGridViewTextBoxColumn M_OrderDetail_ID; + private System.Windows.Forms.DataGridViewTextBoxColumn M_Finish; + private System.Windows.Forms.DataGridViewTextBoxColumn M_Order; + private System.Windows.Forms.DataGridViewTextBoxColumn M_Number; + private System.Windows.Forms.DataGridViewTextBoxColumn M_Already; + private System.Windows.Forms.DataGridViewButtonColumn M_FinishBtn; } } \ No newline at end of file diff --git a/WeighAndGrading/GradeFrom.cs b/WeighAndGrading/GradeFrom.cs index 6ef7901..3cd780a 100644 --- a/WeighAndGrading/GradeFrom.cs +++ b/WeighAndGrading/GradeFrom.cs @@ -33,7 +33,11 @@ namespace WeighAndGrading } #endregion private delegate void InvokeHandler(); - List list; + + const short TANG_TECH = 0; + const short MAO_TECH = 1; + List tangList; + List maoList; List details; SerialPort weightPort; int maxIndex = 0; @@ -53,8 +57,10 @@ namespace WeighAndGrading { InitializeComponent(); butcherTimeInput.Date = DateTime.Today; - dataGridView.AutoGenerateColumns = false; - dataGridView.DataSource = null; + tangGridView.AutoGenerateColumns = false; + tangGridView.DataSource = null; + maoGridView.AutoGenerateColumns = false; + maoGridView.DataSource = null; historyGrid.AutoGenerateColumns = false; AddLivestockBtn(); BuildDiscontPanel(); @@ -75,7 +81,7 @@ namespace WeighAndGrading var livestocks = BaseInfoRpcUtil.GetLivestockList(); foreach (var item in livestocks) { - var btn = new Button() { Name = "_" + item.Item1, Text = item.Item2, Tag = item, Size = new Size(70, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 10 }, Font = new Font("宋体", 15) }; + var btn = new Button() { Name = "_" + item.Item1, Text = item.Item2, Tag = item, Size = new Size(90, 75), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 15 }, Font = new Font("宋体", 18) }; btn.Click += (sender, e) => { if (details == null) @@ -91,7 +97,7 @@ namespace WeighAndGrading modifyDetail.Livestock_ID = livestockTag.Item1; modifyDetail.Livestock_Name = livestockTag.Item2; modifyDetail.Technics = livestockTag.Item3; - modifyDetail.Technics_Name = livestockTag.Item3 == 0 ? "烫褪" : "毛剥"; + modifyDetail.Technics_Name = livestockTag.Item3 == TANG_TECH ? "烫褪" : "毛剥"; GradeAndWeightRpc.UpdateLivestock(modifyDetail.ID, modifyDetail.Livestock_ID, modifyDetail.Livestock_Name, modifyDetail.Technics, modifyDetail.Technics_Name); historyGrid.Refresh(); modifyDetail = null; @@ -101,11 +107,27 @@ namespace WeighAndGrading //var name = livestock.Technics == 0 ? "带皮白条" : "去皮白条"; //Print(name, entity.Index); }; - if (item.Item3 == 0) + if (item.Item3 == TANG_TECH) ttPanel.Controls.Add(btn); else mbPanel.Controls.Add(btn); } + SetMargin(ttPanel); + SetMargin(mbPanel); + } + + void SetMargin(FlowLayoutPanel panel) + { + for (var i = 0; i < panel.Controls.Count; i++) + { + var c = panel.Controls[i]; + if (i % 3 == 0)//left + c.Margin = new Padding(0, c.Margin.Top, c.Margin.Right, c.Margin.Bottom); + if ((i + 1) % 3 == 0)//right + c.Margin = new Padding(c.Margin.Left, c.Margin.Top, 0, c.Margin.Bottom); + if (i <= 2)//firstRow + c.Margin = new Padding(c.Margin.Left, 0, c.Margin.Right, c.Margin.Bottom); + } } private void closeBtn_Click(object sender, EventArgs e) @@ -115,11 +137,6 @@ namespace WeighAndGrading private void syncBtn_Click(object sender, EventArgs e) { - list = GradeAndWeightRpc.GetGradeAndWeightList(butcherTimeInput.Date.Value); - BindDataGrid(); - tangRow = FindRowSetSelected(tangEntity); - maoRow = FindRowSetSelected(maoEntity); - dataGridView.Refresh(); details = GradeAndWeightRpc.GetDetails(butcherTimeInput.Date.Value, 50); FillQueue(); BindDetailGrid(); @@ -144,15 +161,12 @@ namespace WeighAndGrading { while (true) { - Thread.Sleep(5000); this.Invoke(new InvokeHandler(delegate() { - list = GradeAndWeightRpc.GetGradeAndWeightList(butcherTimeInput.Date.Value); - BindDataGrid(); - tangRow = FindRowSetSelected(tangEntity); - maoRow = FindRowSetSelected(maoEntity); - dataGridView.Refresh(); + BindTangGrid(); + BindMaoGrid(); })); + Thread.Sleep(5000); } } @@ -178,25 +192,78 @@ namespace WeighAndGrading } } - void BindDataGrid() + void BindTangGrid() { - dataGridView.DataSource = list.OrderBy(x => x.Order).OrderBy(x => x.Finish).ToList(); - foreach (DataGridViewRow row in dataGridView.Rows) + tangList = GradeAndWeightRpc.GetGradeAndWeightList(butcherTimeInput.Date.Value, true); + tangGridView.DataSource = tangList.OrderBy(x => x.Order).OrderBy(x => x.Finish).ToList(); + if (tangEntity == null && tangGridView.CurrentRow != null) + { + tangEntity = tangGridView.CurrentRow.DataBoundItem as GradeAndWeight; + if (tangEntity.Finish) + tangEntity = null; + } + foreach (DataGridViewRow row in tangGridView.Rows) { - if ((bool)row.Cells["D_Finish"].Value) + if ((bool)row.Cells["T_Finish"].Value) row.DefaultCellStyle.BackColor = Color.YellowGreen; + if (tangEntity != null && tangEntity.OrderDetail_ID == (long)row.Cells["T_OrderDetail_ID"].Value) + { + tangEntity = row.DataBoundItem as GradeAndWeight; + if (tangEntity.Finish) + row.DefaultCellStyle.BackColor = Color.Yellow; + else + row.DefaultCellStyle.BackColor = tangGridView.RowsDefaultCellStyle.SelectionBackColor; + } } - InitScrollBar1(); - dataGridView.ClearSelection(); + InitTangScrollBar(); + tangGridView.ClearSelection(); try { - if (leftRoll != -1) - dataGridView.FirstDisplayedScrollingRowIndex = leftRoll; + if (tangRoll != -1) + tangGridView.FirstDisplayedScrollingRowIndex = tangRoll; } catch { - leftRoll = -1; + tangRoll = -1; } + tangGridView.Refresh(); + } + + void BindMaoGrid() + { + maoList = GradeAndWeightRpc.GetGradeAndWeightList(butcherTimeInput.Date.Value, false); + maoGridView.DataSource = maoList.OrderBy(x => x.Order).OrderBy(x => x.Finish).ToList(); + if (maoEntity == null && maoGridView.CurrentRow != null) + { + maoEntity = maoGridView.CurrentRow.DataBoundItem as GradeAndWeight; + if (maoEntity.Finish) + maoEntity = null; + } + foreach (DataGridViewRow row in maoGridView.Rows) + { + if ((bool)row.Cells["M_Finish"].Value) + row.DefaultCellStyle.BackColor = Color.YellowGreen; + if (maoEntity != null && maoEntity.OrderDetail_ID == (long)row.Cells["M_OrderDetail_ID"].Value) + { + maoEntity = row.DataBoundItem as GradeAndWeight; + if (maoEntity.Finish) + row.DefaultCellStyle.BackColor = Color.Yellow; + else + row.DefaultCellStyle.BackColor = maoGridView.RowsDefaultCellStyle.SelectionBackColor; + } + } + InitMaoScrollBar(); + maoGridView.ClearSelection(); + try + { + if (maoRoll != -1) + maoGridView.FirstDisplayedScrollingRowIndex = maoRoll; + } + catch + { + maoRoll = -1; + } + maoGridView.Refresh(); } void BindDetailGrid() @@ -465,7 +532,7 @@ namespace WeighAndGrading lock (_obj) { var currentRow = livestock.Item3 == 0 ? tangEntity : maoEntity; - var tech = livestock.Item3 == 0 ? "烫褪" : "毛剥"; + var tech = livestock.Item3 == TANG_TECH ? "烫褪" : "毛剥"; GradeAndWeight_Detail first; if (noLivestockList.TryPeek(out first) && first.Livestock_ID == 0) @@ -478,6 +545,12 @@ namespace WeighAndGrading first.Livestock_Name = livestock.Item2; first.Technics = livestock.Item3; first.Technics_Name = tech; + if (disBtn != null) + { + first.Weight = (first.Weight ?? 0) - Convert.ToDecimal(disBtn.Tag); + SetBtnUnCheck(disBtn); + disBtn = null; + } GradeAndWeightRpc.UpdateOrInsertDetail(first, true); historyGrid.Refresh(); } @@ -495,6 +568,12 @@ namespace WeighAndGrading entity.Technics_Name = tech; entity.Time = DateTime.Now; entity.Date = butcherTimeInput.Date.Value; + if (disBtn != null) + { + entity.Weight = -Convert.ToDecimal(disBtn.Tag); + SetBtnUnCheck(disBtn); + disBtn = null; + } if (details.Count == 50) details.RemoveAt(49); details.Insert(0, entity); @@ -507,7 +586,7 @@ namespace WeighAndGrading currentRow.Already = currentRow.Already + 1; orderLabel.Text = currentRow.Order.ToString(); alreadyLabel.Text = currentRow.Already.ToString(); - dataGridView.Refresh(); + tangGridView.Refresh(); } else { @@ -601,82 +680,78 @@ namespace WeighAndGrading modifyPanel.Show(); } - DataGridViewRow tangRow; - DataGridViewRow maoRow; - private void dataGridView_CellClick(object sender, DataGridViewCellEventArgs e) + private void tangGridView_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == -1) return; - var entity = dataGridView.CurrentRow.DataBoundItem as GradeAndWeight; - if (entity.Technics_Name == "烫褪") - { - if (tangRow != null) - { - if (tangEntity.Finish) - tangRow.DefaultCellStyle.BackColor = Color.YellowGreen; - else - tangRow.DefaultCellStyle.BackColor = dataGridView.RowsDefaultCellStyle.BackColor; - } - tangRow = dataGridView.CurrentRow; - tangRow.DefaultCellStyle.BackColor = tangRow.DefaultCellStyle.SelectionBackColor = entity.Finish ? Color.YellowGreen : dataGridView.RowsDefaultCellStyle.SelectionBackColor; - tangEntity = entity; - } - else + if (e.ColumnIndex == tangGridView.Columns.Count - 1) + return; + var entity = tangGridView.CurrentRow.DataBoundItem as GradeAndWeight; + if (tangEntity != null) { - if (maoRow != null) + foreach (DataGridViewRow row in tangGridView.Rows) { - if (maoEntity.Finish) - maoRow.DefaultCellStyle.BackColor = Color.YellowGreen; - else - maoRow.DefaultCellStyle.BackColor = dataGridView.RowsDefaultCellStyle.BackColor; + if (tangEntity.OrderDetail_ID == (long)row.Cells["T_OrderDetail_ID"].Value) + { + row.DefaultCellStyle.BackColor = tangEntity.Finish ? Color.YellowGreen : tangGridView.RowsDefaultCellStyle.BackColor; + break; + } } - maoRow = dataGridView.CurrentRow; - maoRow.DefaultCellStyle.BackColor = maoRow.DefaultCellStyle.SelectionBackColor = entity.Finish ? Color.YellowGreen : Color.Yellow; - maoEntity = entity; } + tangEntity = entity; + tangGridView.CurrentRow.DefaultCellStyle.SelectionBackColor = tangEntity.Finish ? Color.Yellow : tangGridView.RowsDefaultCellStyle.SelectionBackColor; + tangGridView.Refresh(); + } - if (e.ColumnIndex == dataGridView.ColumnCount - 1 && !entity.Finish) - { - entity.Finish = true; - GradeAndWeightRpc.SetGradeFinish(entity.OrderDetail_ID, entity.Technics); - BindDataGrid(); - if (entity.Technics == 0) - { - maoRow = FindRowSetSelected(maoEntity); - tangEntity = null; - tangRow = null; - } - else - { - tangRow = FindRowSetSelected(tangEntity); - maoEntity = null; - maoRow = null; - } - } - dataGridView.Refresh(); + private void tangGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) + { + if (e.RowIndex == -1) + return; + if (e.ColumnIndex != tangGridView.ColumnCount - 1) + return; + var entity = tangGridView.CurrentRow.DataBoundItem as GradeAndWeight; + if (entity.Finish) + return; + entity.Finish = true; + GradeAndWeightRpc.SetGradeFinish(entity.OrderDetail_ID, TANG_TECH); + BindTangGrid(); } - DataGridViewRow FindRowSetSelected(GradeAndWeight tag) + private void maoGridView_CellClick(object sender, DataGridViewCellEventArgs e) { - if (tag == null) - return null; - foreach (DataGridViewRow row in dataGridView.Rows) + if (e.RowIndex == -1) + return; + if (e.ColumnIndex == maoGridView.Columns.Count - 1) + return; + var entity = maoGridView.CurrentRow.DataBoundItem as GradeAndWeight; + if (maoEntity != null) { - if ((long)row.Cells["D_OrderDetail_ID"].Value == tag.OrderDetail_ID && (string)row.Cells["D_Technics_Name"].Value == tag.Technics_Name) + foreach (DataGridViewRow row in maoGridView.Rows) { - if (tag.Finish) - row.DefaultCellStyle.BackColor = Color.YellowGreen; - else - row.DefaultCellStyle.BackColor = tag.Technics == 1 ? Color.Yellow : dataGridView.RowsDefaultCellStyle.SelectionBackColor; - - if (tag.Technics == 0) - tangEntity = row.DataBoundItem as GradeAndWeight; - else - maoEntity = row.DataBoundItem as GradeAndWeight; - return row; + if (maoEntity.OrderDetail_ID == (long)row.Cells["M_OrderDetail_ID"].Value) + { + row.DefaultCellStyle.BackColor = maoEntity.Finish ? Color.YellowGreen : maoGridView.RowsDefaultCellStyle.BackColor; + break; + } } } - return null; + maoEntity = entity; + maoGridView.CurrentRow.DefaultCellStyle.SelectionBackColor = maoEntity.Finish ? Color.Yellow : maoGridView.RowsDefaultCellStyle.SelectionBackColor; + maoGridView.Refresh(); + } + + private void maoGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) + { + if (e.RowIndex == -1) + return; + if (e.ColumnIndex != maoGridView.ColumnCount - 1) + return; + var entity = maoGridView.CurrentRow.DataBoundItem as GradeAndWeight; + if (entity.Finish) + return; + entity.Finish = true; + GradeAndWeightRpc.SetGradeFinish(entity.OrderDetail_ID, MAO_TECH); + BindMaoGrid(); } private void discontBtn_Click(object sender, EventArgs e) @@ -685,38 +760,82 @@ namespace WeighAndGrading BuildDiscontPanel(); } + Button disBtn = null; void BuildDiscontPanel() { var disconts = GradeAndWeightRpc.GetBodyDiscontItem().Where(x => x.Discont > 0).OrderBy(x => x.ID); discontPanel.Controls.Clear(); foreach (var item in disconts) { - var btn = new Button() { Name = "_D" + item.ID, Text = item.Name, Tag = item.Discont, Size = new Size(70, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { Left = 0, Right = 0, Top = 10, Bottom = 10 }, Font = new Font("宋体", 15) }; + var btn = new Button() { Name = "_D" + item.ID, Text = item.Name, Tag = item.Discont, Size = new Size(70, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { Bottom = 30 }, Font = new Font("宋体", 15) }; btn.Click += (sender, e) => { if (modifyDetail == null) - throw new Exception("请先选择要扣重的记录"); - modifyDetail.Weight = (modifyDetail.Weight ?? 0) - Convert.ToDecimal(btn.Tag); - GradeAndWeightRpc.UpdateWeight(modifyDetail.ID, modifyDetail.Weight); - historyGrid.Refresh(); - modifyDetail = null; - modifyPanel.Hide(); + { + if (disBtn != null) + SetBtnUnCheck(disBtn); + if (disBtn != btn) + { + disBtn = btn; + SetBtnChecked(disBtn); + } + else + disBtn = null; + } + else + { + modifyDetail.Weight = (modifyDetail.Weight ?? 0) - Convert.ToDecimal(btn.Tag); + GradeAndWeightRpc.UpdateWeight(modifyDetail.ID, modifyDetail.Weight); + historyGrid.Refresh(); + modifyDetail = null; + modifyPanel.Hide(); + } }; discontPanel.Controls.Add(btn); } } - int leftRoll = -1; - private void InitScrollBar1() + readonly Color btnSelectForeColor = Color.FromArgb(255, 255, 255); + readonly Color btnSelectBackColor = Color.FromArgb(66, 163, 218); + Color btnUnSelectForeColor = SystemColors.ControlText; + Color btnUnSelectBackColor = Color.FromArgb(225, 225, 225); + void SetBtnChecked(Button btn) + { + btn.BackColor = btnSelectBackColor; + btn.ForeColor = btnSelectForeColor; + } + + void SetBtnUnCheck(Button btn) + { + btn.BackColor = btnUnSelectBackColor; + btn.ForeColor = btnUnSelectForeColor; + } + + int tangRoll = -1; + private void InitTangScrollBar() + { + tangScrollBar.Maximum = (tangGridView.RowCount - tangGridView.DisplayedRowCount(false) + 30) * tangGridView.RowTemplate.Height; + tangScrollBar.Minimum = 0; + tangScrollBar.SmallChange = tangGridView.RowTemplate.Height; + tangScrollBar.LargeChange = tangGridView.RowTemplate.Height * 30; + this.tangScrollBar.Scroll += (sender, e) => + { + tangRoll = e.NewValue / tangGridView.RowTemplate.Height; + tangGridView.FirstDisplayedScrollingRowIndex = tangRoll; + }; + } + + int maoRoll = -1; + private void InitMaoScrollBar() { - vScrollBar1.Maximum = (dataGridView.RowCount - dataGridView.DisplayedRowCount(false) + 30) * dataGridView.RowTemplate.Height; - vScrollBar1.Minimum = 0; - vScrollBar1.SmallChange = dataGridView.RowTemplate.Height; - vScrollBar1.LargeChange = dataGridView.RowTemplate.Height * 30; - this.vScrollBar1.Scroll += (sender, e) => + maoScrollBar.Maximum = (maoGridView.RowCount - maoGridView.DisplayedRowCount(false) + 30) * maoGridView.RowTemplate.Height; + maoScrollBar.Minimum = 0; + maoScrollBar.SmallChange = maoGridView.RowTemplate.Height; + maoScrollBar.LargeChange = maoGridView.RowTemplate.Height * 30; + maoScrollBar.Scroll += (sender, e) => { - leftRoll = e.NewValue / dataGridView.RowTemplate.Height; - dataGridView.FirstDisplayedScrollingRowIndex = leftRoll; + maoRoll = e.NewValue / maoGridView.RowTemplate.Height; + maoGridView.FirstDisplayedScrollingRowIndex = maoRoll; }; } diff --git a/WeighAndGrading/GradeFrom.resx b/WeighAndGrading/GradeFrom.resx index ecec308..b02a311 100644 --- a/WeighAndGrading/GradeFrom.resx +++ b/WeighAndGrading/GradeFrom.resx @@ -117,52 +117,64 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + True - + True - + True - + True - + True - + True - + True - + + True + + + True + + True - + True - + True - + + True + + + True + + True - + True - + True - + True - + True - + True \ No newline at end of file