diff --git a/BO/Utils/BillRpc/GradeAndWeightRpc.cs b/BO/Utils/BillRpc/GradeAndWeightRpc.cs index 15c971b..1789b49 100644 --- a/BO/Utils/BillRpc/GradeAndWeightRpc.cs +++ b/BO/Utils/BillRpc/GradeAndWeightRpc.cs @@ -24,7 +24,37 @@ namespace BO.Utils.BillRpc { const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/GradeAndWeightRpc/GetGradeAndWeightList"; var result = RpcFacade.Call(method, date, isTang); - return serializer.Deserialize>(result); + var list = serializer.Deserialize>(result); + short type = 1; + if (isTang) + type = 0; + var sum = GetSumNumber(date, type); + foreach (var item in list) + { + var first = sum.FirstOrDefault(x => x.Item1 == item.Order); + if (first != null) + item.Already = first.Item2; + } + return list; + } + + static List> GetSumNumber(DateTime date, short type) + { + var query = new DQueryDom(new JoinAlias(typeof(GradeAndWeight_Detail))); + query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("IsDeleted", false), DQCondition.EQ("Date", date), DQCondition.EQ("Technics", type), DQCondition.IsNotNull(DQExpression.Field("Order")))); + query.Columns.Add(DQSelectColumn.Field("Order")); + query.Columns.Add(DQSelectColumn.Count()); + query.GroupBy.Expressions.Add(DQExpression.Field("Order")); + var list = new List>(); + using (var session = LocalDmoSession.New()) + { + using (var reader = session.ExecuteReader(query)) + { + while (reader.Read()) + list.Add(new Tuple((int)reader[0], Convert.ToInt32(reader[1]))); + } + return list; + } } public static void SetGradeFinish(long orderDetailID, short technics) @@ -145,7 +175,8 @@ namespace BO.Utils.BillRpc // { // using (var reader = session.ExecuteReader(query)) // { - // list.Add(new Tuple((short)reader[0], Convert.ToInt32(reader[1]))); + // while (reader.Read()) + // list.Add(new Tuple((short)reader[0], Convert.ToInt32(reader[1]))); // } // return list; // } diff --git a/WeighAndGrading/GradeFrom.Designer.cs b/WeighAndGrading/GradeFrom.Designer.cs index 220dd4b..8417213 100644 --- a/WeighAndGrading/GradeFrom.Designer.cs +++ b/WeighAndGrading/GradeFrom.Designer.cs @@ -100,6 +100,7 @@ this.H_IsDrop = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.H_ReadWeight = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.H_Index = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.H_Order = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.H_Technics = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.H_Livestock_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.H_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -249,7 +250,7 @@ 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 = 50; + this.tangGridView.RowTemplate.Height = 65; 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); @@ -361,7 +362,7 @@ 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 = 50; + this.maoGridView.RowTemplate.Height = 65; 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); @@ -444,7 +445,7 @@ this.groupBox3.Controls.Add(this.historyGrid); this.groupBox3.Location = new System.Drawing.Point(826, 175); this.groupBox3.Name = "groupBox3"; - this.groupBox3.Size = new System.Drawing.Size(471, 663); + this.groupBox3.Size = new System.Drawing.Size(520, 663); this.groupBox3.TabIndex = 11; this.groupBox3.TabStop = false; this.groupBox3.Text = "记录"; @@ -462,7 +463,7 @@ // // vScrollBar2 // - this.vScrollBar2.Location = new System.Drawing.Point(426, 36); + this.vScrollBar2.Location = new System.Drawing.Point(479, 36); this.vScrollBar2.Name = "vScrollBar2"; this.vScrollBar2.Size = new System.Drawing.Size(40, 566); this.vScrollBar2.TabIndex = 52; @@ -502,6 +503,7 @@ this.H_IsDrop, this.H_ReadWeight, this.H_Index, + this.H_Order, this.H_Technics, this.H_Livestock_Name, this.H_Weight, @@ -518,7 +520,7 @@ this.historyGrid.RowTemplate.Height = 40; this.historyGrid.ScrollBars = System.Windows.Forms.ScrollBars.None; this.historyGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.historyGrid.Size = new System.Drawing.Size(423, 566); + this.historyGrid.Size = new System.Drawing.Size(478, 566); this.historyGrid.TabIndex = 0; this.historyGrid.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.historyGrid_CellClick); // @@ -650,7 +652,7 @@ // // discontPanel // - this.discontPanel.Location = new System.Drawing.Point(1303, 182); + this.discontPanel.Location = new System.Drawing.Point(1356, 182); this.discontPanel.Name = "discontPanel"; this.discontPanel.Size = new System.Drawing.Size(71, 656); this.discontPanel.TabIndex = 33; @@ -790,6 +792,14 @@ this.H_Index.ReadOnly = true; this.H_Index.Width = 65; // + // H_Order + // + this.H_Order.DataPropertyName = "Order"; + this.H_Order.HeaderText = "顺序"; + this.H_Order.Name = "H_Order"; + this.H_Order.ReadOnly = true; + this.H_Order.Width = 65; + // // H_Technics // this.H_Technics.DataPropertyName = "Technics_Name"; @@ -838,7 +848,7 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1379, 845); + this.ClientSize = new System.Drawing.Size(1438, 845); this.Controls.Add(this.btnStopWeight); this.Controls.Add(this.btnStartWeight); this.Controls.Add(this.dropPigBtn); @@ -951,6 +961,7 @@ private System.Windows.Forms.DataGridViewTextBoxColumn H_IsDrop; private System.Windows.Forms.DataGridViewCheckBoxColumn H_ReadWeight; private System.Windows.Forms.DataGridViewTextBoxColumn H_Index; + private System.Windows.Forms.DataGridViewTextBoxColumn H_Order; private System.Windows.Forms.DataGridViewTextBoxColumn H_Technics; private System.Windows.Forms.DataGridViewTextBoxColumn H_Livestock_Name; private System.Windows.Forms.DataGridViewTextBoxColumn H_Weight; diff --git a/WeighAndGrading/GradeFrom.cs b/WeighAndGrading/GradeFrom.cs index e1bd5eb..e8b2636 100644 --- a/WeighAndGrading/GradeFrom.cs +++ b/WeighAndGrading/GradeFrom.cs @@ -129,7 +129,7 @@ namespace WeighAndGrading MessageBox.Show("请先同步数据"); return; } - + btn.Enabled = false; SetlblSucessVisibleTrue(); var livestockTag = btn.Tag as CTuple; @@ -220,6 +220,7 @@ namespace WeighAndGrading } SetlblSucessVisibleFalse(); + btn.Enabled = true; } void AddLivestockBtn() @@ -442,13 +443,12 @@ namespace WeighAndGrading void BindTangGrid() { - 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; + //if (tangEntity.Finish) + // tangEntity = null; } foreach (DataGridViewRow row in tangGridView.Rows) { @@ -508,8 +508,8 @@ namespace WeighAndGrading if (maoEntity == null && maoGridView.CurrentRow != null) { maoEntity = maoGridView.CurrentRow.DataBoundItem as GradeAndWeight; - if (maoEntity.Finish) - maoEntity = null; + //if (maoEntity.Finish) + // maoEntity = null; } foreach (DataGridViewRow row in maoGridView.Rows) { @@ -1546,7 +1546,10 @@ namespace WeighAndGrading return; var entity = tangGridView.CurrentRow.DataBoundItem as GradeAndWeight; if (entity.Finish) + { + tangEntity = null; return; + } entity.Finish = true; VerifyConnection(); if (connection) @@ -1563,6 +1566,7 @@ namespace WeighAndGrading if (f != null) f.Finish = true; } + tangEntity = null; BindTangGrid(); } @@ -1597,7 +1601,10 @@ namespace WeighAndGrading return; var entity = maoGridView.CurrentRow.DataBoundItem as GradeAndWeight; if (entity.Finish) + { + maoEntity = null; return; + } entity.Finish = true; VerifyConnection(); if (connection) @@ -1614,7 +1621,7 @@ namespace WeighAndGrading if (f != null) f.Finish = true; } - + maoEntity = null; BindMaoGrid(); } diff --git a/WeighAndGrading/GradeFrom.resx b/WeighAndGrading/GradeFrom.resx index 529a299..db723b2 100644 --- a/WeighAndGrading/GradeFrom.resx +++ b/WeighAndGrading/GradeFrom.resx @@ -171,6 +171,9 @@ True + + True + True