From 24dd4186dd243227f3ae8f984a93810e9e4a6d07 Mon Sep 17 00:00:00 2001
From: yibo <361071264@qq.com>
Date: Sun, 24 Sep 2017 21:52:06 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
BO/BO.csproj | 5 +-
BO/BO/BaseInfo/BodyDiscontItem.cs | 17 +
BO/BO/Bill/WeightBill/WeightBill.cs | 1 +
BO/Utils/AfterLoginUtil.cs | 2 +-
BO/Utils/BillRpc/GradeAndWeightRpc.cs | 22 +-
BO/Utils/BillRpc/HouseAndSanctionRpc.cs | 10 +-
BO/Utils/BillRpc/OrderDetailRpc.cs | 10 +-
BO/Utils/BillRpc/WeightBillRpc.cs | 1 +
QualityAndOrder/QualityOrderForm.Designer.cs | 240 ++++++++++----
QualityAndOrder/QualityOrderForm.cs | 49 ++-
QualityAndOrder/QualityOrderFormForTab2.cs | 50 ++-
.../BodyDiscontSetting.Designer.cs | 154 +++++++++
WeighAndGrading/BodyDiscontSetting.cs | 69 ++++
WeighAndGrading/BodyDiscontSetting.resx | 129 ++++++++
WeighAndGrading/GradeFrom.Designer.cs | 303 ++++++++++--------
WeighAndGrading/GradeFrom.cs | 44 ++-
WeighAndGrading/GradeSettingFrom.Designer.cs | 2 +-
WeighAndGrading/WeighAndGrading.csproj | 9 +
18 files changed, 888 insertions(+), 229 deletions(-)
create mode 100644 BO/BO/BaseInfo/BodyDiscontItem.cs
create mode 100644 WeighAndGrading/BodyDiscontSetting.Designer.cs
create mode 100644 WeighAndGrading/BodyDiscontSetting.cs
create mode 100644 WeighAndGrading/BodyDiscontSetting.resx
diff --git a/BO/BO.csproj b/BO/BO.csproj
index fec1a47..d0750cf 100644
--- a/BO/BO.csproj
+++ b/BO/BO.csproj
@@ -54,6 +54,7 @@
+
@@ -86,9 +87,7 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ True
+
+
+ True
+
+
+ True
+
+
\ No newline at end of file
diff --git a/WeighAndGrading/GradeFrom.Designer.cs b/WeighAndGrading/GradeFrom.Designer.cs
index b909645..4173721 100644
--- a/WeighAndGrading/GradeFrom.Designer.cs
+++ b/WeighAndGrading/GradeFrom.Designer.cs
@@ -31,10 +31,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 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 dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
- System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = 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();
@@ -49,19 +49,6 @@
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.label12 = new System.Windows.Forms.Label();
this.historyGrid = new BWP.WinFormControl.UDataGridView();
- this.enableWeight = new System.Windows.Forms.CheckBox();
- this.isPrintCheckBox = new System.Windows.Forms.CheckBox();
- 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.butcherTimeInput = new BWP.WinFormControl.UDatePicker();
- this.closeBtn = new System.Windows.Forms.Button();
- this.configBtn = new System.Windows.Forms.Button();
- this.stateLabel = new System.Windows.Forms.Label();
- this.modifyPanel = new System.Windows.Forms.Panel();
- this.cancelBtn = new System.Windows.Forms.Button();
this.H_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Livestock_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Index = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -69,6 +56,13 @@
this.H_Livestock_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Time = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.enableWeight = new System.Windows.Forms.CheckBox();
+ this.isPrintCheckBox = new System.Windows.Forms.CheckBox();
+ 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();
@@ -77,6 +71,14 @@
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();
+ this.stateLabel = new System.Windows.Forms.Label();
+ this.modifyPanel = new System.Windows.Forms.Panel();
+ this.cancelBtn = new System.Windows.Forms.Button();
+ this.discontBtn = new System.Windows.Forms.Button();
+ this.discontPanel = new System.Windows.Forms.FlowLayoutPanel();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
@@ -198,7 +200,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(438, 680);
+ this.groupBox3.Size = new System.Drawing.Size(422, 680);
this.groupBox3.TabIndex = 11;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "记录";
@@ -239,7 +241,7 @@
this.H_Livestock_Name,
this.H_Weight,
this.H_Time});
- this.historyGrid.Location = new System.Drawing.Point(6, 36);
+ this.historyGrid.Location = new System.Drawing.Point(0, 36);
this.historyGrid.MultiSelect = false;
this.historyGrid.Name = "historyGrid";
this.historyGrid.ReadOnly = true;
@@ -248,10 +250,67 @@
this.historyGrid.RowsDefaultCellStyle = dataGridViewCellStyle4;
this.historyGrid.RowTemplate.Height = 40;
this.historyGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
- this.historyGrid.Size = new System.Drawing.Size(426, 627);
+ this.historyGrid.Size = new System.Drawing.Size(409, 597);
this.historyGrid.TabIndex = 0;
this.historyGrid.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.historyGrid_CellClick);
//
+ // H_ID
+ //
+ this.H_ID.DataPropertyName = "ID";
+ this.H_ID.HeaderText = "ID";
+ this.H_ID.Name = "H_ID";
+ this.H_ID.ReadOnly = true;
+ this.H_ID.Visible = false;
+ //
+ // H_Livestock_ID
+ //
+ this.H_Livestock_ID.HeaderText = "Livestock_ID";
+ this.H_Livestock_ID.Name = "H_Livestock_ID";
+ this.H_Livestock_ID.ReadOnly = true;
+ this.H_Livestock_ID.Visible = false;
+ //
+ // H_Index
+ //
+ this.H_Index.DataPropertyName = "Index";
+ this.H_Index.HeaderText = "序号";
+ this.H_Index.Name = "H_Index";
+ this.H_Index.ReadOnly = true;
+ this.H_Index.Width = 65;
+ //
+ // H_Technics
+ //
+ this.H_Technics.DataPropertyName = "Technics_Name";
+ this.H_Technics.HeaderText = "工艺";
+ this.H_Technics.Name = "H_Technics";
+ this.H_Technics.ReadOnly = true;
+ this.H_Technics.Width = 65;
+ //
+ // H_Livestock_Name
+ //
+ this.H_Livestock_Name.DataPropertyName = "Livestock_Name";
+ this.H_Livestock_Name.HeaderText = "级别";
+ this.H_Livestock_Name.Name = "H_Livestock_Name";
+ this.H_Livestock_Name.ReadOnly = true;
+ this.H_Livestock_Name.Width = 90;
+ //
+ // H_Weight
+ //
+ this.H_Weight.DataPropertyName = "Weight";
+ dataGridViewCellStyle3.Format = "#0.######";
+ this.H_Weight.DefaultCellStyle = dataGridViewCellStyle3;
+ this.H_Weight.HeaderText = "重量";
+ this.H_Weight.Name = "H_Weight";
+ this.H_Weight.ReadOnly = true;
+ this.H_Weight.Width = 70;
+ //
+ // H_Time
+ //
+ this.H_Time.DataPropertyName = "Time";
+ this.H_Time.HeaderText = "时间";
+ this.H_Time.Name = "H_Time";
+ this.H_Time.ReadOnly = true;
+ this.H_Time.Width = 110;
+ //
// enableWeight
//
this.enableWeight.AutoCheck = false;
@@ -358,6 +417,69 @@
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
+ //
+ 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;
@@ -375,7 +497,7 @@
// closeBtn
//
this.closeBtn.Font = new System.Drawing.Font("宋体", 15F);
- this.closeBtn.Location = new System.Drawing.Point(1156, 12);
+ this.closeBtn.Location = new System.Drawing.Point(1217, 12);
this.closeBtn.Name = "closeBtn";
this.closeBtn.Size = new System.Drawing.Size(102, 43);
this.closeBtn.TabIndex = 33;
@@ -386,11 +508,11 @@
// configBtn
//
this.configBtn.Font = new System.Drawing.Font("宋体", 15F);
- this.configBtn.Location = new System.Drawing.Point(1036, 12);
+ this.configBtn.Location = new System.Drawing.Point(971, 12);
this.configBtn.Name = "configBtn";
this.configBtn.Size = new System.Drawing.Size(102, 43);
this.configBtn.TabIndex = 34;
- this.configBtn.Text = "设置";
+ this.configBtn.Text = "称设置";
this.configBtn.UseVisualStyleBackColor = true;
this.configBtn.Click += new System.EventHandler(this.configBtn_Click);
//
@@ -403,14 +525,13 @@
this.stateLabel.Name = "stateLabel";
this.stateLabel.Size = new System.Drawing.Size(289, 20);
this.stateLabel.TabIndex = 35;
- this.stateLabel.Text = "您正在修改序号为 1000 的等级";
+ this.stateLabel.Text = "您正在修改序号为 1000 的信息";
//
// modifyPanel
//
- this.modifyPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.modifyPanel.Controls.Add(this.cancelBtn);
this.modifyPanel.Controls.Add(this.stateLabel);
- this.modifyPanel.Location = new System.Drawing.Point(826, 107);
+ this.modifyPanel.Location = new System.Drawing.Point(813, 107);
this.modifyPanel.Name = "modifyPanel";
this.modifyPanel.Size = new System.Drawing.Size(438, 56);
this.modifyPanel.TabIndex = 36;
@@ -428,131 +549,31 @@
this.cancelBtn.UseVisualStyleBackColor = true;
this.cancelBtn.Click += new System.EventHandler(this.cancelBtn_Click);
//
- // H_ID
- //
- this.H_ID.DataPropertyName = "ID";
- this.H_ID.HeaderText = "ID";
- this.H_ID.Name = "H_ID";
- this.H_ID.ReadOnly = true;
- this.H_ID.Visible = false;
- //
- // H_Livestock_ID
- //
- this.H_Livestock_ID.HeaderText = "Livestock_ID";
- this.H_Livestock_ID.Name = "H_Livestock_ID";
- this.H_Livestock_ID.ReadOnly = true;
- this.H_Livestock_ID.Visible = false;
- //
- // H_Index
- //
- this.H_Index.DataPropertyName = "Index";
- this.H_Index.HeaderText = "序号";
- this.H_Index.Name = "H_Index";
- this.H_Index.ReadOnly = true;
- this.H_Index.Width = 65;
- //
- // H_Technics
- //
- this.H_Technics.DataPropertyName = "Technics_Name";
- this.H_Technics.HeaderText = "工艺";
- this.H_Technics.Name = "H_Technics";
- this.H_Technics.ReadOnly = true;
- this.H_Technics.Width = 65;
- //
- // H_Livestock_Name
- //
- this.H_Livestock_Name.DataPropertyName = "Livestock_Name";
- this.H_Livestock_Name.HeaderText = "级别";
- this.H_Livestock_Name.Name = "H_Livestock_Name";
- this.H_Livestock_Name.ReadOnly = true;
- this.H_Livestock_Name.Width = 90;
- //
- // H_Weight
- //
- this.H_Weight.DataPropertyName = "Weight";
- dataGridViewCellStyle3.Format = "#0.######";
- this.H_Weight.DefaultCellStyle = dataGridViewCellStyle3;
- this.H_Weight.HeaderText = "重量";
- this.H_Weight.Name = "H_Weight";
- this.H_Weight.ReadOnly = true;
- this.H_Weight.Width = 70;
- //
- // H_Time
- //
- this.H_Time.DataPropertyName = "Time";
- this.H_Time.HeaderText = "时间";
- this.H_Time.Name = "H_Time";
- this.H_Time.ReadOnly = true;
- this.H_Time.Width = 110;
- //
- // 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;
+ // discontBtn
//
- // D_Technics_Name
+ this.discontBtn.Font = new System.Drawing.Font("宋体", 15F);
+ this.discontBtn.Location = new System.Drawing.Point(1095, 12);
+ this.discontBtn.Name = "discontBtn";
+ this.discontBtn.Size = new System.Drawing.Size(102, 43);
+ this.discontBtn.TabIndex = 37;
+ this.discontBtn.Text = "扣重项";
+ this.discontBtn.UseVisualStyleBackColor = true;
+ this.discontBtn.Click += new System.EventHandler(this.discontBtn_Click);
//
- 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
+ // discontPanel
//
- 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
- //
- this.D_FinishBtn.HeaderText = "完毕";
- this.D_FinishBtn.Name = "D_FinishBtn";
- this.D_FinishBtn.ReadOnly = true;
- this.D_FinishBtn.Text = "完毕";
- this.D_FinishBtn.UseColumnTextForButtonValue = true;
+ this.discontPanel.Location = new System.Drawing.Point(1258, 182);
+ this.discontPanel.Name = "discontPanel";
+ this.discontPanel.Size = new System.Drawing.Size(71, 656);
+ this.discontPanel.TabIndex = 33;
//
// GradeFrom
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(1276, 865);
+ this.ClientSize = new System.Drawing.Size(1337, 865);
+ 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);
@@ -637,5 +658,7 @@
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.Button discontBtn;
+ private System.Windows.Forms.FlowLayoutPanel discontPanel;
}
}
\ No newline at end of file
diff --git a/WeighAndGrading/GradeFrom.cs b/WeighAndGrading/GradeFrom.cs
index 4363f1d..d1c9442 100644
--- a/WeighAndGrading/GradeFrom.cs
+++ b/WeighAndGrading/GradeFrom.cs
@@ -57,6 +57,7 @@ namespace WeighAndGrading
dataGridView.DataSource = null;
historyGrid.AutoGenerateColumns = false;
AddLivestockBtn();
+ BuildDiscontPanel();
weightPort = new SerialPort();
this.FormClosing += delegate
{
@@ -114,7 +115,7 @@ namespace WeighAndGrading
list = GradeAndWeightRpc.GetGradeAndWeightList(date);
BindDataGrid();
dataGridView.Refresh();
- details = GradeAndWeightRpc.GetDetails(date, 15);
+ details = GradeAndWeightRpc.GetDetails(date, 14);
BindDetailGrid();
if (details.Any())
maxIndex = details.First().Index;
@@ -372,8 +373,8 @@ namespace WeighAndGrading
entity.Technics = livestock.Item3;
entity.Technics_Name = tech;
entity.Time = DateTime.Now;
- if (details.Count == 15)
- details.RemoveAt(14);
+ if (details.Count == 14)
+ details.RemoveAt(13);
details.Insert(0, entity);
GradeAndWeightRpc.UpdateOrInsertDetail(entity, true);
tempList.Enqueue(entity);
@@ -395,7 +396,7 @@ namespace WeighAndGrading
if (tempList.TryPeek(out first) && first.Weight == null)
{
tempList.TryDequeue(out first);
- first.Weight = weight;
+ first.Weight = (first.Weight ?? 0) + weight;
GradeAndWeightRpc.UpdateOrInsertDetail(first);
historyGrid.Refresh();
}
@@ -404,10 +405,10 @@ namespace WeighAndGrading
maxIndex++;
var entity = new GradeAndWeight_Detail();
entity.Index = maxIndex;
- entity.Weight = weight;
+ entity.Weight = (entity.Weight ?? 0) + weight;
entity.Time = DateTime.Now;
- if (details.Count == 15)
- details.RemoveAt(14);
+ if (details.Count == 14)
+ details.RemoveAt(13);
details.Insert(0, entity);
GradeAndWeightRpc.UpdateOrInsertDetail(entity);
tempList.Enqueue(entity);
@@ -427,7 +428,7 @@ namespace WeighAndGrading
if (e.RowIndex < 0)
return;
modifyDetail = historyGrid.Rows[e.RowIndex].DataBoundItem as GradeAndWeight_Detail;
- stateLabel.Text = string.Format("您正在修改序号为 {0} 的等级", modifyDetail.Index);
+ stateLabel.Text = string.Format("您正在修改序号为 {0} 的信息", modifyDetail.Index);
modifyPanel.Show();
}
@@ -499,5 +500,32 @@ namespace WeighAndGrading
}
}
}
+
+ private void discontBtn_Click(object sender, EventArgs e)
+ {
+ if (new BodyDiscontSetting().ShowDialog() == DialogResult.OK)
+ BuildDiscontPanel();
+ }
+
+ 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) };
+ 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();
+ };
+ discontPanel.Controls.Add(btn);
+ }
+ }
}
}
diff --git a/WeighAndGrading/GradeSettingFrom.Designer.cs b/WeighAndGrading/GradeSettingFrom.Designer.cs
index 3ff4ad4..c9c2aa3 100644
--- a/WeighAndGrading/GradeSettingFrom.Designer.cs
+++ b/WeighAndGrading/GradeSettingFrom.Designer.cs
@@ -185,6 +185,7 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(354, 381);
+ this.ControlBox = false;
this.Controls.Add(this.discont);
this.Controls.Add(this.format);
this.Controls.Add(this.label6);
@@ -200,7 +201,6 @@
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
- this.MaximizeBox = false;
this.Name = "GradeSettingFrom";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "称重设置";
diff --git a/WeighAndGrading/WeighAndGrading.csproj b/WeighAndGrading/WeighAndGrading.csproj
index f269ea1..66f7551 100644
--- a/WeighAndGrading/WeighAndGrading.csproj
+++ b/WeighAndGrading/WeighAndGrading.csproj
@@ -50,6 +50,12 @@
+
+ Form
+
+
+ BodyDiscontSetting.cs
+
Form
@@ -67,6 +73,9 @@
+
+ BodyDiscontSetting.cs
+
GradeFrom.cs