Browse Source

修改。

master
yibo 8 years ago
parent
commit
324288597c
4 changed files with 68 additions and 16 deletions
  1. +33
    -2
      BO/Utils/BillRpc/GradeAndWeightRpc.cs
  2. +18
    -7
      WeighAndGrading/GradeFrom.Designer.cs
  3. +14
    -7
      WeighAndGrading/GradeFrom.cs
  4. +3
    -0
      WeighAndGrading/GradeFrom.resx

+ 33
- 2
BO/Utils/BillRpc/GradeAndWeightRpc.cs View File

@ -24,7 +24,37 @@ namespace BO.Utils.BillRpc
{
const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/GradeAndWeightRpc/GetGradeAndWeightList";
var result = RpcFacade.Call<string>(method, date, isTang);
return serializer.Deserialize<List<GradeAndWeight>>(result);
var list = serializer.Deserialize<List<GradeAndWeight>>(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<Tuple<int, int>> 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<Tuple<int, int>>();
using (var session = LocalDmoSession.New())
{
using (var reader = session.ExecuteReader(query))
{
while (reader.Read())
list.Add(new Tuple<int, int>((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, int>((short)reader[0], Convert.ToInt32(reader[1])));
// while (reader.Read())
// list.Add(new Tuple<short, int>((short)reader[0], Convert.ToInt32(reader[1])));
// }
// return list;
// }


+ 18
- 7
WeighAndGrading/GradeFrom.Designer.cs View File

@ -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;


+ 14
- 7
WeighAndGrading/GradeFrom.cs View File

@ -129,7 +129,7 @@ namespace WeighAndGrading
MessageBox.Show("请先同步数据");
return;
}
btn.Enabled = false;
SetlblSucessVisibleTrue();
var livestockTag = btn.Tag as CTuple<long, string, short, string>;
@ -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();
}


+ 3
- 0
WeighAndGrading/GradeFrom.resx View File

@ -171,6 +171,9 @@
<metadata name="H_Index.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="H_Order.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="H_Technics.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>


Loading…
Cancel
Save