diff --git a/BO/BO/Bill/GradeAndWeight/GradeAndWeight_Detail.cs b/BO/BO/Bill/GradeAndWeight/GradeAndWeight_Detail.cs
index f03f41d..0e2bf64 100644
--- a/BO/BO/Bill/GradeAndWeight/GradeAndWeight_Detail.cs
+++ b/BO/BO/Bill/GradeAndWeight/GradeAndWeight_Detail.cs
@@ -37,6 +37,11 @@ namespace BO.BO.Bill
public DateTime Time { get; set; }
+// public string Shortcut { get; set; }//快捷键
+
+ public bool IsLostWeight { get; set; }//是否丢称重
+
+
///
/// ServerID
///
diff --git a/BO/Utils/BaseInfoRpcUtil.cs b/BO/Utils/BaseInfoRpcUtil.cs
index 217b366..bbd9f7a 100644
--- a/BO/Utils/BaseInfoRpcUtil.cs
+++ b/BO/Utils/BaseInfoRpcUtil.cs
@@ -38,10 +38,10 @@ namespace BO.Utils
return result;
}
- public static List> GetLivestockList()
+ public static List> GetLivestockList()
{
var list = RpcFacade.Call("/MainSystem/B3ClientService/Rpcs/BaseInfoRpc/GetLivestock");
- return serializer.Deserialize>>(list);
+ return serializer.Deserialize>>(list);
}
}
}
diff --git a/BO/Utils/BillRpc/GradeAndWeightRpc.cs b/BO/Utils/BillRpc/GradeAndWeightRpc.cs
index 484f12c..f882a93 100644
--- a/BO/Utils/BillRpc/GradeAndWeightRpc.cs
+++ b/BO/Utils/BillRpc/GradeAndWeightRpc.cs
@@ -49,7 +49,7 @@ namespace BO.Utils.BillRpc
{
static JavaScriptSerializer serializer = new JavaScriptSerializer();
- class DmoSession
+ public class DmoSession
{
public static IDmoSessionWithTransaction New()
{
@@ -74,6 +74,31 @@ namespace BO.Utils.BillRpc
}
}
+ public static void ClearWeightBySID(long sid)
+ {
+ var updateDom = new DQUpdateDom(typeof(GradeAndWeight_Detail));
+ updateDom.Where.Conditions.Add(DQCondition.EQ("SID", sid));
+ updateDom.Columns.Add(new DQUpdateColumn("Weight", DQExpression.NULL));
+ using (var session = DmoSession.New())
+ {
+ session.ExecuteNonQuery(updateDom);
+ session.Commit();
+ }
+ }
+
+ public static void UpdateLosted(long sid)
+ {
+ var updateDom = new DQUpdateDom(typeof(GradeAndWeight_Detail));
+ updateDom.Where.Conditions.Add(DQCondition.EQ("SID", sid));
+ updateDom.Columns.Add(new DQUpdateColumn("IsLostWeight", true));
+
+ using (var session = DmoSession.New())
+ {
+ session.ExecuteNonQuery(updateDom);
+ session.Commit();
+ }
+ }
+
public static List GetDetails(DateTime date, int top = 15)
{
var query = new DmoQuery(typeof(GradeAndWeight_Detail));
@@ -86,6 +111,43 @@ namespace BO.Utils.BillRpc
}
}
+ public static int GetTangTuiSumNumber(DateTime date)
+ {
+ var query = new DQueryDom(new JoinAlias(typeof(GradeAndWeight_Detail)));
+ query.Where.Conditions.Add(DQCondition.EQ("Date", date));
+ query.Where.Conditions.Add(DQCondition.EQ("Technics_Name", "烫褪"));
+ query.Columns.Add(DQSelectColumn.Count());
+ using (var session = DmoSession.New())
+ {
+ return Convert.ToInt32(session.ExecuteScalar(query));
+ }
+ }
+ public static int GetMaoBoSumNumber(DateTime date)
+ {
+ var query = new DQueryDom(new JoinAlias(typeof(GradeAndWeight_Detail)));
+ query.Where.Conditions.Add(DQCondition.EQ("Date", date));
+ query.Where.Conditions.Add(DQCondition.EQ("Technics_Name", "毛剥"));
+ query.Columns.Add(DQSelectColumn.Count());
+ using (var session = DmoSession.New())
+ {
+ return Convert.ToInt32(session.ExecuteScalar(query));
+ }
+ }
+
+
+ public static List GetLostWeightDetails(DateTime date)
+ {
+ var query = new DmoQuery(typeof(GradeAndWeight_Detail));
+ query.Where.Conditions.Add(DQCondition.EQ("IsLostWeight", true));
+ query.Where.Conditions.Add(DQCondition.EQ("Date", date));
+ query.OrderBy.Expressions.Add(DQOrderByExpression.Create("Index", true));
+
+ using (var session = DmoSession.New())
+ {
+ return session.ExecuteList(query).Cast().ToList();
+ }
+ }
+
public static void Insert(GradeAndWeight_Detail detail)
{
using (var session = DmoSession.New())
diff --git a/WeighAndGrading/AbnormalModifyForm.Designer.cs b/WeighAndGrading/AbnormalModifyForm.Designer.cs
new file mode 100644
index 0000000..305fe8d
--- /dev/null
+++ b/WeighAndGrading/AbnormalModifyForm.Designer.cs
@@ -0,0 +1,211 @@
+namespace WeighAndGrading
+{
+ partial class AbnormalModifyForm
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ 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();
+ this.panel4 = new System.Windows.Forms.Panel();
+ this.button1 = new System.Windows.Forms.Button();
+ this.flpKeyPanel = new System.Windows.Forms.FlowLayoutPanel();
+ this.uDataGridView1 = new BWP.WinFormControl.UDataGridView();
+ this.H_SID = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.H_Livestock_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.H_Index = 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();
+ this.H_Time = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.panel4.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.uDataGridView1)).BeginInit();
+ this.SuspendLayout();
+ //
+ // panel4
+ //
+ this.panel4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.panel4.Controls.Add(this.button1);
+ this.panel4.Controls.Add(this.flpKeyPanel);
+ this.panel4.Location = new System.Drawing.Point(504, 13);
+ this.panel4.Name = "panel4";
+ this.panel4.Size = new System.Drawing.Size(454, 572);
+ this.panel4.TabIndex = 61;
+ //
+ // button1
+ //
+ this.button1.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.button1.Location = new System.Drawing.Point(150, 499);
+ this.button1.Name = "button1";
+ this.button1.Size = new System.Drawing.Size(129, 54);
+ this.button1.TabIndex = 45;
+ this.button1.Text = "全部修改";
+ this.button1.UseVisualStyleBackColor = true;
+ this.button1.Click += new System.EventHandler(this.button1_Click);
+ //
+ // flpKeyPanel
+ //
+ this.flpKeyPanel.Location = new System.Drawing.Point(3, 22);
+ this.flpKeyPanel.Name = "flpKeyPanel";
+ this.flpKeyPanel.Padding = new System.Windows.Forms.Padding(25, 0, 0, 0);
+ this.flpKeyPanel.Size = new System.Drawing.Size(446, 406);
+ this.flpKeyPanel.TabIndex = 43;
+ //
+ // uDataGridView1
+ //
+ this.uDataGridView1.AllowUserToAddRows = false;
+ this.uDataGridView1.AllowUserToDeleteRows = false;
+ this.uDataGridView1.AllowUserToResizeColumns = false;
+ this.uDataGridView1.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;
+ 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.uDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
+ this.uDataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.uDataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
+ this.H_SID,
+ this.H_Livestock_ID,
+ this.H_Index,
+ this.H_Technics,
+ this.H_Livestock_Name,
+ this.H_Weight,
+ this.H_Time});
+ this.uDataGridView1.Location = new System.Drawing.Point(12, 12);
+ this.uDataGridView1.MultiSelect = false;
+ this.uDataGridView1.Name = "uDataGridView1";
+ this.uDataGridView1.ReadOnly = true;
+ this.uDataGridView1.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.uDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle5;
+ this.uDataGridView1.RowTemplate.Height = 40;
+ this.uDataGridView1.ScrollBars = System.Windows.Forms.ScrollBars.None;
+ this.uDataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
+ this.uDataGridView1.Size = new System.Drawing.Size(423, 566);
+ this.uDataGridView1.TabIndex = 44;
+ this.uDataGridView1.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.uDataGridView1_CellClick);
+ //
+ // H_SID
+ //
+ this.H_SID.DataPropertyName = "SID";
+ this.H_SID.HeaderText = "SID";
+ this.H_SID.Name = "H_SID";
+ this.H_SID.ReadOnly = true;
+ this.H_SID.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";
+ dataGridViewCellStyle4.Format = "HH:mm:ss";
+ dataGridViewCellStyle4.NullValue = null;
+ this.H_Time.DefaultCellStyle = dataGridViewCellStyle4;
+ this.H_Time.HeaderText = "时间";
+ this.H_Time.Name = "H_Time";
+ this.H_Time.ReadOnly = true;
+ //
+ // AbnormalModifyForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(970, 590);
+ this.Controls.Add(this.uDataGridView1);
+ this.Controls.Add(this.panel4);
+ this.MaximizeBox = false;
+ this.MinimizeBox = false;
+ this.Name = "AbnormalModifyForm";
+ this.Text = "异常修改";
+ this.Load += new System.EventHandler(this.AbnormalModifyForm_Load);
+ this.panel4.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.uDataGridView1)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+ private System.Windows.Forms.Panel panel4;
+ private System.Windows.Forms.FlowLayoutPanel flpKeyPanel;
+ private BWP.WinFormControl.UDataGridView uDataGridView1;
+ private System.Windows.Forms.Button button1;
+ private System.Windows.Forms.DataGridViewTextBoxColumn H_SID;
+ private System.Windows.Forms.DataGridViewTextBoxColumn H_Livestock_ID;
+ private System.Windows.Forms.DataGridViewTextBoxColumn H_Index;
+ private System.Windows.Forms.DataGridViewTextBoxColumn H_Technics;
+ private System.Windows.Forms.DataGridViewTextBoxColumn H_Livestock_Name;
+ private System.Windows.Forms.DataGridViewTextBoxColumn H_Weight;
+ private System.Windows.Forms.DataGridViewTextBoxColumn H_Time;
+ }
+}
\ No newline at end of file
diff --git a/WeighAndGrading/AbnormalModifyForm.cs b/WeighAndGrading/AbnormalModifyForm.cs
new file mode 100644
index 0000000..9b85a99
--- /dev/null
+++ b/WeighAndGrading/AbnormalModifyForm.cs
@@ -0,0 +1,219 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using BO.BO.Bill;
+using BO.Utils.BillRpc;
+
+namespace WeighAndGrading
+{
+ public partial class AbnormalModifyForm : Form
+ {
+ List details;
+ private DateTime mDate;
+
+ GradeAndWeight_Detail mCurrentSlectItem;
+ public AbnormalModifyForm(DateTime date)
+ {
+ InitializeComponent();
+ mDate = date;
+ uDataGridView1.AutoGenerateColumns = false;
+ }
+
+
+ private void AbnormalModifyForm_Load(object sender, EventArgs e)
+ {
+ BindGridView();
+ AddKeyPad();
+ if (uDataGridView1.Rows.Count > 0)
+ {
+ uDataGridView1.Rows[0].Selected = true;
+ var currentRow = uDataGridView1.Rows[0].DataBoundItem as GradeAndWeight_Detail;
+ mCurrentSlectItem = currentRow;
+ }
+
+ }
+
+ private void BindGridView()
+ {
+ details = LocalGradeAndWeightBL.GetLostWeightDetails(mDate);
+ if (details.Any())
+ uDataGridView1.DataSource = details;
+ }
+
+
+ private void AddKeyPad()
+ {
+ for (var i = 1; i < 10; i++)
+ {
+ var btn = new Button() { Name = "_3" + i, Text = i.ToString(), Size = new Size(80, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 10 }, Font = new Font("宋体", 15) };
+ btn.Click += (sender, e) =>
+ {
+ ModifyWeight(btn.Text);
+ };
+ flpKeyPanel.Controls.Add(btn);
+ }
+ var zero = new Button() { Name = "_30", Text = "0", Size = new Size(80, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 10 }, Font = new Font("宋体", 15) };
+ zero.Click += (sender, e) =>
+ {
+ ModifyWeight(zero.Text);
+ };
+ flpKeyPanel.Controls.Add(zero);
+
+ var dian = new Button() { Name = "_40", Text = ".", Size = new Size(80, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 10 }, Font = new Font("宋体", 15) };
+ dian.Click += (sender, e) =>
+ {
+ ModifyWeight(dian.Text);
+ };
+ flpKeyPanel.Controls.Add(dian);
+
+ var back = new Button() { Name = "_3back", Text = "←", Size = new Size(80, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 10 }, Font = new Font("宋体", 15) };
+ back.Click += (sender, e) =>
+ {
+ ModifyWeight(back.Text);
+ };
+ flpKeyPanel.Controls.Add(back);
+
+ var clear = new Button() { Name = "_3clear", Text = "清空", Size = new Size(80, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 10 }, Font = new Font("宋体", 15) };
+ clear.Click += (sender, e) =>
+ {
+ ModifyWeight(clear.Text);
+ };
+ flpKeyPanel.Controls.Add(clear);
+
+ }
+
+// private decimal? lastWeght;
+ private void ModifyWeight(string input)
+ {
+ if (mCurrentSlectItem == null)
+ throw new Exception("请选择一条记录");
+
+ var destring = DecimalToString(mCurrentSlectItem.Weight);
+ var value=GetAfterNumber(destring, input);
+ mCurrentSlectItem.Weight = StringToDecimal(value);
+
+ uDataGridView1.Refresh();
+
+
+ }
+
+
+ decimal? StringToDecimal(string value)
+ {
+ if (string.IsNullOrWhiteSpace(value))
+ {
+ return null;
+ }
+ value = value.Replace("..", ".");
+ if (value.Length > 1)
+ {
+ var last = value.Substring(value.Length - 1);
+ if (last == ".")
+ {
+ value += "0";
+ }
+ }
+ try
+ {
+ return decimal.Parse(value);
+ }
+ catch
+ {
+ return null;
+ }
+
+ }
+
+ string DecimalToString(decimal? value)
+ {
+ if (value == null)
+ {
+ return "";
+ }
+
+ try
+ {
+
+ var newvalue = value.ToString();
+ if (newvalue.Length > 2)
+ {
+ var lasttwo = newvalue.Substring(newvalue.Length - 2);
+ if (lasttwo == ".0")
+ {
+ var intvalue = Convert.ToInt32(value);
+ return intvalue.ToString() + ".";
+ }
+ }
+
+ return value.ToString()+"";
+ }
+ catch
+ {
+ return value.ToString();
+ }
+ }
+
+ string GetAfterNumber(string oldValue, string input)
+ {
+ bool hasValue = !string.IsNullOrWhiteSpace(oldValue);
+ switch (input)
+ {
+ case ".":
+ if (hasValue)
+ return (oldValue + ".");
+ return null;
+ case "0":
+ if (hasValue)
+ return (oldValue + "0");
+ return null;
+ case "←":
+ if (hasValue)
+ {
+ var s = oldValue.ToString();
+ s = s.Substring(0, s.Length - 1);
+ if (string.IsNullOrEmpty(s))
+ return null;
+ return (s);
+ }
+ return null;
+ case "清空":
+ return null;
+ default:
+ var sn = "";
+ if (hasValue)
+ sn = oldValue.ToString();
+ sn += input;
+ return (sn);
+ }
+ }
+
+ private void button1_Click(object sender, EventArgs e)
+ {
+ foreach (GradeAndWeight_Detail detail in details.Where(x=>x.Weight.HasValue))
+ {
+ detail.IsLostWeight = false;
+ detail.Sync = false;
+ LocalGradeAndWeightBL.Update(detail, "Weight", "IsLostWeight", "Sync");
+ }
+ details = LocalGradeAndWeightBL.GetLostWeightDetails(mDate);
+ uDataGridView1.Refresh();
+ MessageBox.Show("保存成功");
+ DialogResult=DialogResult.OK;
+ Close();
+ }
+
+ private void uDataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
+ {
+ if (e.RowIndex < 0)
+ return;
+ var currentRow = uDataGridView1.CurrentRow.DataBoundItem as GradeAndWeight_Detail;
+ mCurrentSlectItem = currentRow;
+ }
+ }
+}
diff --git a/WeighAndGrading/AbnormalModifyForm.resx b/WeighAndGrading/AbnormalModifyForm.resx
new file mode 100644
index 0000000..1e80200
--- /dev/null
+++ b/WeighAndGrading/AbnormalModifyForm.resx
@@ -0,0 +1,141 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
\ No newline at end of file
diff --git a/WeighAndGrading/GradeContext.cs b/WeighAndGrading/GradeContext.cs
index f5aec70..76d305b 100644
--- a/WeighAndGrading/GradeContext.cs
+++ b/WeighAndGrading/GradeContext.cs
@@ -77,5 +77,7 @@ namespace WeighAndGrading
public decimal MinWeight { get; set; }
public decimal MaxWeight { get; set; }
+
+ public decimal AllowInterval{ get; set; }//当固定值发送数据的时候 设置称 多少秒接受数据
}
}
diff --git a/WeighAndGrading/GradeFrom.Designer.cs b/WeighAndGrading/GradeFrom.Designer.cs
index 300b598..f6d2c7e 100644
--- a/WeighAndGrading/GradeFrom.Designer.cs
+++ b/WeighAndGrading/GradeFrom.Designer.cs
@@ -28,19 +28,19 @@
///
private void InitializeComponent()
{
- 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 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 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();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle21 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle22 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle23 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle26 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle24 = new System.Windows.Forms.DataGridViewCellStyle();
+ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle25 = 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();
@@ -50,7 +50,7 @@
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.lblTangTui = 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();
@@ -67,8 +67,8 @@
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.lblMaoBo = new System.Windows.Forms.Label();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.vScrollBar2 = new System.Windows.Forms.VScrollBar();
this.label12 = new System.Windows.Forms.Label();
@@ -87,14 +87,19 @@
this.discontBtn = new System.Windows.Forms.Button();
this.discontPanel = new System.Windows.Forms.FlowLayoutPanel();
this.statePic = new System.Windows.Forms.PictureBox();
+ this.btnLockItem = new System.Windows.Forms.Button();
+ this.btnClearLast = new System.Windows.Forms.Button();
+ this.btnAbnormalModify = new System.Windows.Forms.Button();
this.H_SID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Livestock_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.IsLostWeight = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_ReadWeight = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.H_Index = 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();
this.H_Time = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.lblHeJi = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.tangGridView)).BeginInit();
this.groupBox2.SuspendLayout();
@@ -171,11 +176,11 @@
//
this.groupBox1.Controls.Add(this.tangScrollBar);
this.groupBox1.Controls.Add(this.ttPanel);
- this.groupBox1.Controls.Add(this.label10);
+ this.groupBox1.Controls.Add(this.lblTangTui);
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(783, 330);
+ this.groupBox1.Size = new System.Drawing.Size(783, 318);
this.groupBox1.TabIndex = 9;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "烫褪";
@@ -194,15 +199,15 @@
this.ttPanel.Size = new System.Drawing.Size(337, 276);
this.ttPanel.TabIndex = 0;
//
- // label10
+ // lblTangTui
//
- 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 = "烫褪";
+ this.lblTangTui.AutoSize = true;
+ this.lblTangTui.Font = new System.Drawing.Font("宋体", 15F);
+ this.lblTangTui.Location = new System.Drawing.Point(6, -1);
+ this.lblTangTui.Name = "lblTangTui";
+ this.lblTangTui.Size = new System.Drawing.Size(49, 20);
+ this.lblTangTui.TabIndex = 32;
+ this.lblTangTui.Text = "烫褪";
//
// tangGridView
//
@@ -210,17 +215,17 @@
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;
+ dataGridViewCellStyle14.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
+ this.tangGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle14;
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;
+ dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
+ dataGridViewCellStyle15.BackColor = System.Drawing.SystemColors.Control;
+ dataGridViewCellStyle15.Font = new System.Drawing.Font("宋体", 12F);
+ dataGridViewCellStyle15.ForeColor = System.Drawing.SystemColors.WindowText;
+ dataGridViewCellStyle15.SelectionBackColor = System.Drawing.SystemColors.Highlight;
+ dataGridViewCellStyle15.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
+ dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
+ this.tangGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle15;
this.tangGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.tangGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.T_OrderDetail_ID,
@@ -234,12 +239,12 @@
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;
+ dataGridViewCellStyle17.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ dataGridViewCellStyle17.ForeColor = System.Drawing.Color.Black;
+ dataGridViewCellStyle17.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
+ dataGridViewCellStyle17.SelectionForeColor = System.Drawing.Color.Black;
+ this.tangGridView.RowsDefaultCellStyle = dataGridViewCellStyle17;
+ this.tangGridView.RowTemplate.Height = 50;
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);
@@ -288,9 +293,9 @@
//
// 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;
+ dataGridViewCellStyle16.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+ dataGridViewCellStyle16.Padding = new System.Windows.Forms.Padding(5, 10, 5, 10);
+ this.T_FinishBtn.DefaultCellStyle = dataGridViewCellStyle16;
this.T_FinishBtn.HeaderText = "完毕";
this.T_FinishBtn.Name = "T_FinishBtn";
this.T_FinishBtn.ReadOnly = true;
@@ -301,9 +306,8 @@
//
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(16, 525);
+ this.groupBox2.Location = new System.Drawing.Point(16, 508);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(783, 330);
this.groupBox2.TabIndex = 10;
@@ -323,17 +327,17 @@
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;
+ dataGridViewCellStyle18.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
+ this.maoGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle18;
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;
+ dataGridViewCellStyle19.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
+ dataGridViewCellStyle19.BackColor = System.Drawing.SystemColors.Control;
+ dataGridViewCellStyle19.Font = new System.Drawing.Font("宋体", 12F);
+ dataGridViewCellStyle19.ForeColor = System.Drawing.SystemColors.WindowText;
+ dataGridViewCellStyle19.SelectionBackColor = System.Drawing.SystemColors.Highlight;
+ dataGridViewCellStyle19.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
+ dataGridViewCellStyle19.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
+ this.maoGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle19;
this.maoGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.maoGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.M_OrderDetail_ID,
@@ -347,12 +351,12 @@
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;
+ dataGridViewCellStyle21.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ dataGridViewCellStyle21.ForeColor = System.Drawing.Color.Black;
+ dataGridViewCellStyle21.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
+ dataGridViewCellStyle21.SelectionForeColor = System.Drawing.Color.Black;
+ this.maoGridView.RowsDefaultCellStyle = dataGridViewCellStyle21;
+ this.maoGridView.RowTemplate.Height = 50;
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);
@@ -401,25 +405,15 @@
//
// 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;
+ dataGridViewCellStyle20.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
+ dataGridViewCellStyle20.Padding = new System.Windows.Forms.Padding(5, 10, 5, 10);
+ this.M_FinishBtn.DefaultCellStyle = dataGridViewCellStyle20;
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;
- this.label11.Font = new System.Drawing.Font("宋体", 15F);
- this.label11.Location = new System.Drawing.Point(6, -1);
- this.label11.Name = "label11";
- this.label11.Size = new System.Drawing.Size(49, 20);
- this.label11.TabIndex = 32;
- this.label11.Text = "毛剥";
- //
// mbPanel
//
this.mbPanel.Location = new System.Drawing.Point(431, 35);
@@ -427,14 +421,25 @@
this.mbPanel.Size = new System.Drawing.Size(337, 278);
this.mbPanel.TabIndex = 1;
//
+ // lblMaoBo
+ //
+ this.lblMaoBo.AutoSize = true;
+ this.lblMaoBo.Font = new System.Drawing.Font("宋体", 15F);
+ this.lblMaoBo.Location = new System.Drawing.Point(22, 507);
+ this.lblMaoBo.Name = "lblMaoBo";
+ this.lblMaoBo.Size = new System.Drawing.Size(49, 20);
+ this.lblMaoBo.TabIndex = 32;
+ this.lblMaoBo.Text = "毛剥";
+ //
// groupBox3
//
+ this.groupBox3.Controls.Add(this.lblHeJi);
this.groupBox3.Controls.Add(this.vScrollBar2);
this.groupBox3.Controls.Add(this.label12);
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, 680);
+ this.groupBox3.Size = new System.Drawing.Size(471, 663);
this.groupBox3.TabIndex = 11;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "记录";
@@ -462,21 +467,22 @@
this.historyGrid.AllowUserToDeleteRows = false;
this.historyGrid.AllowUserToResizeColumns = false;
this.historyGrid.AllowUserToResizeRows = false;
- dataGridViewCellStyle9.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
- this.historyGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle9;
+ dataGridViewCellStyle22.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
+ this.historyGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle22;
this.historyGrid.BackgroundColor = System.Drawing.Color.White;
- 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;
+ dataGridViewCellStyle23.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
+ dataGridViewCellStyle23.BackColor = System.Drawing.SystemColors.Control;
+ dataGridViewCellStyle23.Font = new System.Drawing.Font("宋体", 12F);
+ dataGridViewCellStyle23.ForeColor = System.Drawing.SystemColors.WindowText;
+ dataGridViewCellStyle23.SelectionBackColor = System.Drawing.SystemColors.Highlight;
+ dataGridViewCellStyle23.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
+ dataGridViewCellStyle23.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
+ this.historyGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle23;
this.historyGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.historyGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.H_SID,
this.H_Livestock_ID,
+ this.IsLostWeight,
this.H_ReadWeight,
this.H_Index,
this.H_Technics,
@@ -488,9 +494,9 @@
this.historyGrid.Name = "historyGrid";
this.historyGrid.ReadOnly = true;
this.historyGrid.RowHeadersVisible = false;
- 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;
+ dataGridViewCellStyle26.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ dataGridViewCellStyle26.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
+ this.historyGrid.RowsDefaultCellStyle = dataGridViewCellStyle26;
this.historyGrid.RowTemplate.Height = 40;
this.historyGrid.ScrollBars = System.Windows.Forms.ScrollBars.None;
this.historyGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
@@ -571,9 +577,9 @@
// closeBtn
//
this.closeBtn.Font = new System.Drawing.Font("宋体", 15F);
- this.closeBtn.Location = new System.Drawing.Point(1270, 12);
+ this.closeBtn.Location = new System.Drawing.Point(1272, 20);
this.closeBtn.Name = "closeBtn";
- this.closeBtn.Size = new System.Drawing.Size(102, 43);
+ this.closeBtn.Size = new System.Drawing.Size(102, 60);
this.closeBtn.TabIndex = 33;
this.closeBtn.Text = "关闭";
this.closeBtn.UseVisualStyleBackColor = true;
@@ -582,9 +588,9 @@
// configBtn
//
this.configBtn.Font = new System.Drawing.Font("宋体", 15F);
- this.configBtn.Location = new System.Drawing.Point(1024, 12);
+ this.configBtn.Location = new System.Drawing.Point(417, 38);
this.configBtn.Name = "configBtn";
- this.configBtn.Size = new System.Drawing.Size(102, 43);
+ this.configBtn.Size = new System.Drawing.Size(102, 42);
this.configBtn.TabIndex = 34;
this.configBtn.Text = "称设置";
this.configBtn.UseVisualStyleBackColor = true;
@@ -605,9 +611,9 @@
//
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(826, 112);
this.modifyPanel.Name = "modifyPanel";
- this.modifyPanel.Size = new System.Drawing.Size(438, 56);
+ this.modifyPanel.Size = new System.Drawing.Size(438, 57);
this.modifyPanel.TabIndex = 36;
this.modifyPanel.Visible = false;
//
@@ -626,9 +632,9 @@
// discontBtn
//
this.discontBtn.Font = new System.Drawing.Font("宋体", 15F);
- this.discontBtn.Location = new System.Drawing.Point(1148, 12);
+ this.discontBtn.Location = new System.Drawing.Point(541, 38);
this.discontBtn.Name = "discontBtn";
- this.discontBtn.Size = new System.Drawing.Size(102, 43);
+ this.discontBtn.Size = new System.Drawing.Size(102, 42);
this.discontBtn.TabIndex = 37;
this.discontBtn.Text = "扣重项";
this.discontBtn.UseVisualStyleBackColor = true;
@@ -651,6 +657,39 @@
this.statePic.TabIndex = 38;
this.statePic.TabStop = false;
//
+ // btnLockItem
+ //
+ this.btnLockItem.Font = new System.Drawing.Font("宋体", 15F);
+ this.btnLockItem.Location = new System.Drawing.Point(903, 20);
+ this.btnLockItem.Name = "btnLockItem";
+ this.btnLockItem.Size = new System.Drawing.Size(102, 60);
+ this.btnLockItem.TabIndex = 34;
+ this.btnLockItem.Text = "锁定";
+ this.btnLockItem.UseVisualStyleBackColor = true;
+ this.btnLockItem.Click += new System.EventHandler(this.btnLockItem_Click);
+ //
+ // btnClearLast
+ //
+ this.btnClearLast.Font = new System.Drawing.Font("宋体", 15F);
+ this.btnClearLast.Location = new System.Drawing.Point(1027, 20);
+ this.btnClearLast.Name = "btnClearLast";
+ this.btnClearLast.Size = new System.Drawing.Size(102, 60);
+ this.btnClearLast.TabIndex = 34;
+ this.btnClearLast.Text = "清空";
+ this.btnClearLast.UseVisualStyleBackColor = true;
+ this.btnClearLast.Click += new System.EventHandler(this.btnClearLast_Click);
+ //
+ // btnAbnormalModify
+ //
+ this.btnAbnormalModify.Font = new System.Drawing.Font("宋体", 15F);
+ this.btnAbnormalModify.Location = new System.Drawing.Point(1149, 20);
+ this.btnAbnormalModify.Name = "btnAbnormalModify";
+ this.btnAbnormalModify.Size = new System.Drawing.Size(102, 60);
+ this.btnAbnormalModify.TabIndex = 34;
+ this.btnAbnormalModify.Text = "异常";
+ this.btnAbnormalModify.UseVisualStyleBackColor = true;
+ this.btnAbnormalModify.Click += new System.EventHandler(this.btnAbnormalModify_Click);
+ //
// H_SID
//
this.H_SID.DataPropertyName = "SID";
@@ -666,6 +705,14 @@
this.H_Livestock_ID.ReadOnly = true;
this.H_Livestock_ID.Visible = false;
//
+ // IsLostWeight
+ //
+ this.IsLostWeight.DataPropertyName = "IsLostWeight";
+ this.IsLostWeight.HeaderText = "IsLostWeight";
+ this.IsLostWeight.Name = "IsLostWeight";
+ this.IsLostWeight.ReadOnly = true;
+ this.IsLostWeight.Visible = false;
+ //
// H_ReadWeight
//
this.H_ReadWeight.DataPropertyName = "ReadWeight";
@@ -701,8 +748,8 @@
// H_Weight
//
this.H_Weight.DataPropertyName = "Weight";
- dataGridViewCellStyle11.Format = "#0.######";
- this.H_Weight.DefaultCellStyle = dataGridViewCellStyle11;
+ dataGridViewCellStyle24.Format = "#0.######";
+ this.H_Weight.DefaultCellStyle = dataGridViewCellStyle24;
this.H_Weight.HeaderText = "重量";
this.H_Weight.Name = "H_Weight";
this.H_Weight.ReadOnly = true;
@@ -711,22 +758,36 @@
// H_Time
//
this.H_Time.DataPropertyName = "Time";
- dataGridViewCellStyle12.Format = "MM/dd HH:mm";
- dataGridViewCellStyle12.NullValue = null;
- this.H_Time.DefaultCellStyle = dataGridViewCellStyle12;
+ dataGridViewCellStyle25.Format = "HH:mm:ss";
+ dataGridViewCellStyle25.NullValue = null;
+ this.H_Time.DefaultCellStyle = dataGridViewCellStyle25;
this.H_Time.HeaderText = "时间";
this.H_Time.Name = "H_Time";
this.H_Time.ReadOnly = true;
//
+ // lblHeJi
+ //
+ this.lblHeJi.AutoSize = true;
+ this.lblHeJi.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.lblHeJi.Location = new System.Drawing.Point(6, 624);
+ this.lblHeJi.Name = "lblHeJi";
+ this.lblHeJi.Size = new System.Drawing.Size(82, 24);
+ this.lblHeJi.TabIndex = 53;
+ this.lblHeJi.Text = "合计:";
+ //
// 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.ClientSize = new System.Drawing.Size(1379, 842);
this.Controls.Add(this.statePic);
this.Controls.Add(this.discontPanel);
+ this.Controls.Add(this.lblMaoBo);
this.Controls.Add(this.discontBtn);
this.Controls.Add(this.modifyPanel);
+ this.Controls.Add(this.btnAbnormalModify);
+ this.Controls.Add(this.btnClearLast);
+ this.Controls.Add(this.btnLockItem);
this.Controls.Add(this.configBtn);
this.Controls.Add(this.closeBtn);
this.Controls.Add(this.enableWeight);
@@ -744,16 +805,17 @@
this.Controls.Add(this.butcherTimeInput);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
+ this.KeyPreview = true;
this.MaximizeBox = false;
this.Name = "GradeFrom";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "称重定级";
this.Load += new System.EventHandler(this.GradeFrom_Load);
+ this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.GradeFrom_KeyPress);
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();
@@ -788,10 +850,10 @@
private System.Windows.Forms.Button printBtn;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label lblChengZhong;
- private System.Windows.Forms.Label label11;
+ private System.Windows.Forms.Label lblMaoBo;
private System.Windows.Forms.Label label12;
private BWP.WinFormControl.UDataGridView historyGrid;
- private System.Windows.Forms.Label label10;
+ private System.Windows.Forms.Label lblTangTui;
private System.Windows.Forms.Button closeBtn;
private System.Windows.Forms.Button configBtn;
private System.Windows.Forms.Label stateLabel;
@@ -803,6 +865,10 @@
private System.Windows.Forms.VScrollBar tangScrollBar;
private System.Windows.Forms.VScrollBar maoScrollBar;
private BWP.WinFormControl.UDataGridView maoGridView;
+ private System.Windows.Forms.PictureBox statePic;
+ private System.Windows.Forms.Button btnLockItem;
+ private System.Windows.Forms.Button btnClearLast;
+ private System.Windows.Forms.Button btnAbnormalModify;
private System.Windows.Forms.DataGridViewTextBoxColumn T_OrderDetail_ID;
private System.Windows.Forms.DataGridViewTextBoxColumn T_Finish;
private System.Windows.Forms.DataGridViewTextBoxColumn T_Order;
@@ -815,14 +881,15 @@
private System.Windows.Forms.DataGridViewTextBoxColumn M_Number;
private System.Windows.Forms.DataGridViewTextBoxColumn M_Already;
private System.Windows.Forms.DataGridViewButtonColumn M_FinishBtn;
- private System.Windows.Forms.PictureBox statePic;
private System.Windows.Forms.DataGridViewTextBoxColumn H_SID;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Livestock_ID;
+ private System.Windows.Forms.DataGridViewTextBoxColumn IsLostWeight;
private System.Windows.Forms.DataGridViewCheckBoxColumn H_ReadWeight;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Index;
private System.Windows.Forms.DataGridViewTextBoxColumn H_Technics;
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.Label lblHeJi;
}
}
\ No newline at end of file
diff --git a/WeighAndGrading/GradeFrom.cs b/WeighAndGrading/GradeFrom.cs
index 603c149..b2835fe 100644
--- a/WeighAndGrading/GradeFrom.cs
+++ b/WeighAndGrading/GradeFrom.cs
@@ -97,9 +97,57 @@ namespace WeighAndGrading
GradeAndWeight_Detail modifyDetail;
+ private void GradeFrom_KeyPress(object sender, KeyPressEventArgs e)
+ {
+ Char keyChar = e.KeyChar;
+ var key = keyChar.ToString().ToLower();
+ foreach (Button btn in ttPanel.Controls)
+ {
+ var livestockTag = btn.Tag as CTuple;
+ if (livestockTag.Item4.ToLower() == key)
+ {
+ JiBieButtonClick(btn);
+ SetJiBieSelectBackColor(btn.Text);
+ }
+ }
+ foreach (Button btn in mbPanel.Controls)
+ {
+ var livestockTag = btn.Tag as CTuple;
+ if (livestockTag.Item4.ToLower() == key)
+ {
+ JiBieButtonClick(btn);
+ SetJiBieSelectBackColor(btn.Text);
+ }
+ }
+ }
+
+ //点击 级别
+ void JiBieButtonClick(Button btn)
+ {
+ if (details == null)
+ {
+ MessageBox.Show("请先同步数据");
+ return;
+ }
+ var livestockTag = btn.Tag as CTuple;
+ if (modifyDetail == null)
+ AddDetail(livestockTag);
+ else
+ {
+ modifyDetail.Livestock_ID = livestockTag.Item1;
+ modifyDetail.Livestock_Name = livestockTag.Item2;
+ modifyDetail.Technics = livestockTag.Item3;
+ modifyDetail.Technics_Name = livestockTag.Item3 == TANG_TECH ? "烫褪" : "毛剥";
+ LocalGradeAndWeightBL.Update(modifyDetail, "Livestock_ID", "Livestock_Name", "Technics", "Technics_Name");
+ historyGrid.Refresh();
+ modifyDetail = null;
+ modifyPanel.Hide();
+ }
+ }
+
void AddLivestockBtn()
{
- var livestocks = new List>();
+ var livestocks = new List>();
var fileName = Path.Combine(DATA_PATH, "Livestocks.xml");
if (connection)
{
@@ -107,44 +155,91 @@ namespace WeighAndGrading
XmlUtil.SerializerObjToFile(livestocks, fileName);
}
else
- livestocks = XmlUtil.DeserializeFromFile>>(fileName);
+ livestocks = XmlUtil.DeserializeFromFile>>(fileName);
foreach (var item in livestocks)
{
- 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) };
+ var btn = new Button() { Name = "_" + item.Item1, Text = item.Item2 + "(" + item.Item4.ToLower() + ")", 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)
- {
- MessageBox.Show("请先同步数据");
- return;
- }
- var livestockTag = btn.Tag as CTuple;
- if (modifyDetail == null)
- AddDetail(livestockTag);
- else
- {
- modifyDetail.Livestock_ID = livestockTag.Item1;
- modifyDetail.Livestock_Name = livestockTag.Item2;
- modifyDetail.Technics = livestockTag.Item3;
- modifyDetail.Technics_Name = livestockTag.Item3 == TANG_TECH ? "烫褪" : "毛剥";
- LocalGradeAndWeightBL.Update(modifyDetail, "Livestock_ID", "Livestock_Name", "Technics", "Technics_Name");
- historyGrid.Refresh();
- modifyDetail = null;
- modifyPanel.Hide();
- }
+ JiBieButtonClick(btn);
+ #region 改到方法JiBieButtonClick()里了
+
+
+
+ // if (details == null)
+ // {
+ // MessageBox.Show("请先同步数据");
+ // return;
+ // }
+ // var livestockTag = btn.Tag as CTuple;
+ // if (modifyDetail == null)
+ // AddDetail(livestockTag);
+ // else
+ // {
+ // modifyDetail.Livestock_ID = livestockTag.Item1;
+ // modifyDetail.Livestock_Name = livestockTag.Item2;
+ // modifyDetail.Technics = livestockTag.Item3;
+ // modifyDetail.Technics_Name = livestockTag.Item3 == TANG_TECH ? "烫褪" : "毛剥";
+ // LocalGradeAndWeightBL.Update(modifyDetail, "Livestock_ID", "Livestock_Name", "Technics", "Technics_Name");
+ // historyGrid.Refresh();
+ // modifyDetail = null;
+ // modifyPanel.Hide();
+ // }
+
+ #endregion
+
+
+
//var name = livestock.Technics == 0 ? "带皮白条" : "去皮白条";
//Print(name, entity.Index);
+
};
if (item.Item3 == TANG_TECH)
+ {
+ btn.Click += delegate { SetJiBieSelectBackColor(btn.Text); };
ttPanel.Controls.Add(btn);
+ }
else
+ {
+ btn.Click += delegate { SetJiBieSelectBackColor(btn.Text); };
mbPanel.Controls.Add(btn);
+ }
}
SetMargin(ttPanel);
SetMargin(mbPanel);
}
+ private void SetJiBieSelectBackColor(string btnText)
+ {
+ foreach (Control control in ttPanel.Controls)
+ {
+ if (control.Text == btnText)
+ {
+ control.BackColor = Color.Aqua;
+ }
+ else
+ {
+ control.BackColor = SystemColors.Control;
+ }
+ }
+
+ foreach (Control control in mbPanel.Controls)
+ {
+ if (control.Text == btnText)
+ {
+ control.BackColor = Color.Aqua;
+ }
+ else
+ {
+ control.BackColor = SystemColors.Control;
+ }
+ }
+
+ }
+
+
void SetMargin(FlowLayoutPanel panel)
{
for (var i = 0; i < panel.Controls.Count; i++)
@@ -190,7 +285,7 @@ namespace WeighAndGrading
{
while (true)
{
- this.Invoke(new InvokeHandler(delegate()
+ this.Invoke(new InvokeHandler(delegate ()
{
BindTangGrid();
BindMaoGrid();
@@ -219,6 +314,8 @@ namespace WeighAndGrading
else
noLivestockList.Enqueue(bottom);
}
+
+
}
void BindTangGrid()
@@ -269,6 +366,7 @@ namespace WeighAndGrading
tangRoll = -1;
}
tangGridView.Refresh();
+ lblTangTui.Text= "烫褪" + "("+tangList.Sum(x=>x.Number)+")";
}
void BindMaoGrid()
@@ -319,6 +417,7 @@ namespace WeighAndGrading
maoRoll = -1;
}
maoGridView.Refresh();
+ lblMaoBo.Text = "毛剥" + "(" + maoList.Sum(x=>x.Number) + ")";
}
void BindDetailGrid()
@@ -348,6 +447,8 @@ namespace WeighAndGrading
rightRoll = -1;
}
historyGrid.Refresh();
+ SetHistorBackColor();
+ ReSetHistorySum();
}
private void printBtn_Click(object sender, EventArgs e)
@@ -429,6 +530,8 @@ namespace WeighAndGrading
string format = "{0:0.00}";
+ private DateTime lastWeightDateTime = DateTime.Now;
+
private void InQuery()
{
while (_mainProcessIsRun)
@@ -458,25 +561,37 @@ namespace WeighAndGrading
string str;
if (_dataFormat.ParseAscii(_dataStrBuilder.ToString(), out str, out isStatic))
{
+ //稳定后发送
if (GradeContext.Config.WeightType == 0)
{
if (string.IsNullOrEmpty(str))
str = "0";
- this.Invoke(new InvokeHandler(delegate()
+ this.Invoke(new InvokeHandler(delegate ()
{
lblChengZhong.Text = string.Format(format, decimal.Parse(str));
if (str != "0")
{
- AddWeightDetail(decimal.Parse(lblChengZhong.Text));
+ //稳定发送有效间隔
+ var allowInterval = GradeContext.Config.AllowInterval;
+ //如果间隔时间内多条的话不处理
+
+ var timeSpanTotalSeconds= (DateTime.Now - lastWeightDateTime).TotalSeconds;
+ if (Convert.ToDecimal(timeSpanTotalSeconds) > allowInterval)
+ {
+ AddWeightDetail(decimal.Parse(lblChengZhong.Text));
+ lastWeightDateTime = DateTime.Now;
+ }
+
}
}));
}
+ //连续发送
else
{
decimal num = 0;
if (decimal.TryParse(str, out num))
{
- this.Invoke(new InvokeHandler(delegate()
+ this.Invoke(new InvokeHandler(delegate ()
{
lblChengZhong.Text = string.Format(format, num);
}));
@@ -485,11 +600,12 @@ namespace WeighAndGrading
}
if (WeighAvgControl.TryGetValue(out num))
{
- this.Invoke(new InvokeHandler(delegate()
+ this.Invoke(new InvokeHandler(delegate ()
{
//lblChengZhong.Text = string.Format(format, num);
if (str != "0")
{
+ //
AddWeightDetail(decimal.Parse(string.Format(format, num)));
}
}));
@@ -583,7 +699,7 @@ namespace WeighAndGrading
static object _obj = new object();
- void AddDetail(CTuple livestock)
+ void AddDetail(CTuple livestock)
{
lock (_obj)
{
@@ -649,9 +765,20 @@ namespace WeighAndGrading
orderLabel.Text = string.Empty;
alreadyLabel.Text = string.Empty;
}
+
+ //计算合计
+ ReSetHistorySum();
}
}
+ void ReSetHistorySum()
+ {
+ var tangtui=LocalGradeAndWeightBL.GetTangTuiSumNumber(butcherTimeInput.Date.Value);
+ var maobo=LocalGradeAndWeightBL.GetMaoBoSumNumber(butcherTimeInput.Date.Value);
+ lblHeJi.Text = "合计: 烫褪("+ tangtui + ") 毛剥("+maobo+")";
+ }
+
+
void AddWeightDetail(decimal weight)
{
lock (_obj)
@@ -670,18 +797,21 @@ namespace WeighAndGrading
}
else//add
{
- maxIndex++;
- var entity = new GradeAndWeight_Detail();
- entity.Index = maxIndex;
- entity.Weight = (entity.Weight ?? 0) + weight;
- entity.Time = DateTime.Now;
- entity.Date = butcherTimeInput.Date.Value;
- if (details.Count == 50)
- details.RemoveAt(49);
- details.Insert(0, entity);
- LocalGradeAndWeightBL.Insert(entity);
- noLivestockList.Enqueue(entity);
- BindDetailGrid();
+ //todo 目前先去掉 称重增加记录的功能
+
+ // maxIndex++;
+ // var entity = new GradeAndWeight_Detail();
+ // entity.Index = maxIndex;
+ // entity.Weight = (entity.Weight ?? 0) + weight;
+ // entity.Time = DateTime.Now;
+ // entity.Date = butcherTimeInput.Date.Value;
+ // if (details.Count == 50)
+ // details.RemoveAt(49);
+ // details.Insert(0, entity);
+ // LocalGradeAndWeightBL.Insert(entity);
+ // noLivestockList.Enqueue(entity);
+ // BindDetailGrid();
+
}
}
}
@@ -692,45 +822,156 @@ namespace WeighAndGrading
modifyPanel.Hide();
}
- GradeAndWeight_Detail lastCheckItem;
- long? lastSelectID = null;
- private void historyGrid_CellClick(object sender, DataGridViewCellEventArgs e)
+
+ private void btnClearLast_Click(object sender, EventArgs e)
{
- if (e.RowIndex < 0)
- return;
- var currentRow = historyGrid.CurrentRow.DataBoundItem as GradeAndWeight_Detail;
- lastSelectID = currentRow.SID;
- if (e.ColumnIndex == 2)
+
+// if (MessageBox.Show("确定清空最后一次称重?", "确定清空最后一次称重?", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
+// {
+// return;
+// }
+
+// if (mCurrentSlectItem == null)
+// {
+// return;
+// }
+
+//有称重重量的 并且不是掉猪的最大的一条
+ var fuhemaxsid = details.Where(x => x.Weight.HasValue && !x.IsLostWeight).Max(x => x.SID);
+ var fd = details.First(x => x.SID == fuhemaxsid);
+ fd.Weight = null;
+
+ //清空数据库重量记录
+ LocalGradeAndWeightBL.ClearWeightBySID(fuhemaxsid);
+ historyGrid.Refresh();
+
+ noWeightList = new ConcurrentQueue();
+ var stack = new Stack();
+ foreach (var item in details)
{
- if (lastCheckItem != null && lastCheckItem.SID != currentRow.SID)
- lastCheckItem.ReadWeight = false;
- lastCheckItem = currentRow;
- lastCheckItem.ReadWeight = !lastCheckItem.ReadWeight;
+ if (item.SID >= fd.SID)
+ {
+ stack.Push(item);
+ }
+ }
+ while (stack.Count > 0)
+ noWeightList.Enqueue(stack.Pop());
+ }
- modifyDetail = null;
+ private void btnLockItem_Click(object sender, EventArgs e)
+ {
+ if (mCurrentSlectItem == null)
+ {
+ return;
+ }
+ //获取最大值
+ var lostList = details.Where(x => x.IsLostWeight).ToList();
+ if (lostList.Count < 1)
+ {
+ maxLockID = 0;
+ }
+ else
+ {
+ maxLockID = lostList.Max(x => x.SID);
+ }
+
+ //赋最大值
+ if (mCurrentSlectItem.SID > maxLockID)
+ {
+ maxLockID = mCurrentSlectItem.SID;
+ UpdateItemLosted(mCurrentSlectItem.SID);
+
if (modifyPanel.Visible)
modifyPanel.Hide();
historyGrid.Refresh();
- if (lastCheckItem.ReadWeight)
+
+ noWeightList = new ConcurrentQueue();
+ var stack = new Stack();
+ foreach (var item in details)
{
- noWeightList = new ConcurrentQueue();
- var stack = new Stack();
- foreach (var item in details)
+ if (item.SID > mCurrentSlectItem.SID)
{
stack.Push(item);
- if (item.SID == lastCheckItem.SID)
- break;
}
- while (stack.Count > 0)
- noWeightList.Enqueue(stack.Pop());
}
- else
+ while (stack.Count > 0)
{
- FillQueue();
- lastCheckItem = null;
+ noWeightList.Enqueue(stack.Pop());
}
- return;
+
+ }
+ SetHistorBackColor();
+
+
+ }
+
+ void SetHistorBackColor()
+ {
+ foreach (DataGridViewRow row in historyGrid.Rows)
+ {
+ if ((bool)row.Cells["IsLostWeight"].Value)
+ row.DefaultCellStyle.BackColor = Color.Red;
}
+ }
+
+ private void UpdateItemLosted(long sid)
+ {
+ //设置数据库
+ LocalGradeAndWeightBL.UpdateLosted(sid);
+
+ //更新界面
+ var fd = details.First(x => x.SID == sid);
+ fd.IsLostWeight = true;
+ }
+
+ private long? maxLockID;
+
+ GradeAndWeight_Detail lastCheckItem, mCurrentSlectItem;
+ long? lastSelectID = null;
+ private void historyGrid_CellClick(object sender, DataGridViewCellEventArgs e)
+ {
+ if (e.RowIndex < 0)
+ return;
+ var currentRow = historyGrid.CurrentRow.DataBoundItem as GradeAndWeight_Detail;
+ lastSelectID = currentRow.SID;
+
+ mCurrentSlectItem = currentRow;
+
+ if (e.ColumnIndex == 3)
+ {
+ if (lastCheckItem != null && lastCheckItem.SID != currentRow.SID)
+ lastCheckItem.ReadWeight = false;
+ lastCheckItem = currentRow;
+ lastCheckItem.ReadWeight = !lastCheckItem.ReadWeight;
+ //
+ modifyDetail = null;
+ if (modifyPanel.Visible)
+ modifyPanel.Hide();
+ historyGrid.Refresh();
+ // if (lastCheckItem.ReadWeight)
+ // {
+ // noWeightList = new ConcurrentQueue();
+ // var stack = new Stack();
+ // foreach (var item in details)
+ // {
+ // if (item.SID > lastCheckItem.SID)
+ // {
+ // stack.Push(item);
+ // }
+ //// stack.Push(item);
+ //// if (item.SID == lastCheckItem.SID)
+ //// break;
+ // }
+ // while (stack.Count > 0)
+ // noWeightList.Enqueue(stack.Pop());
+ // }
+ // else
+ // {
+ // FillQueue();
+ // lastCheckItem = null;
+ // }
+ return;
+ }
modifyDetail = currentRow;
stateLabel.Text = string.Format("您正在修改序号为 {0} 的信息", modifyDetail.Index);
modifyPanel.Show();
@@ -1003,17 +1244,30 @@ namespace WeighAndGrading
last = connection;
}
+ private void btnAbnormalModify_Click(object sender, EventArgs e)
+ {
+ if (!butcherTimeInput.Date.HasValue)
+ {
+ MessageBox.Show("请在上一个界面选择宰杀日期");
+ return;
+ }
+ var f=new AbnormalModifyForm(butcherTimeInput.Date.Value);
+ f.ShowDialog();
+ }
+
private void GradeFrom_Load(object sender, EventArgs e)
{
syncToServer = new Thread(ToServerTask);
syncToServer.Start();
}
+
+
void ToServerTask()
{
while (true)
{
- this.Invoke(new InvokeHandler(delegate()
+ this.Invoke(new InvokeHandler(delegate ()
{
VerifyConnection();
if (connection)
diff --git a/WeighAndGrading/GradeFrom.resx b/WeighAndGrading/GradeFrom.resx
index 7b5224b..6241c61 100644
--- a/WeighAndGrading/GradeFrom.resx
+++ b/WeighAndGrading/GradeFrom.resx
@@ -159,6 +159,9 @@
True
+
+ True
+
True
diff --git a/WeighAndGrading/GradeSettingFrom.Designer.cs b/WeighAndGrading/GradeSettingFrom.Designer.cs
index 7c1b88c..4128796 100644
--- a/WeighAndGrading/GradeSettingFrom.Designer.cs
+++ b/WeighAndGrading/GradeSettingFrom.Designer.cs
@@ -47,6 +47,8 @@
this.label8 = new System.Windows.Forms.Label();
this.minInput = new BWP.WinFormControl.UTextBoxWithPad();
this.maxInput = new BWP.WinFormControl.UTextBoxWithPad();
+ this.label9 = new System.Windows.Forms.Label();
+ this.utxtAllowInterval = new BWP.WinFormControl.UTextBoxWithPad();
this.SuspendLayout();
//
// label5
@@ -62,7 +64,7 @@
// closeBtn
//
this.closeBtn.Font = new System.Drawing.Font("宋体", 15F);
- this.closeBtn.Location = new System.Drawing.Point(189, 414);
+ this.closeBtn.Location = new System.Drawing.Point(173, 461);
this.closeBtn.Name = "closeBtn";
this.closeBtn.Size = new System.Drawing.Size(75, 35);
this.closeBtn.TabIndex = 19;
@@ -73,7 +75,7 @@
// saveBtn
//
this.saveBtn.Font = new System.Drawing.Font("宋体", 15F);
- this.saveBtn.Location = new System.Drawing.Point(83, 414);
+ this.saveBtn.Location = new System.Drawing.Point(67, 461);
this.saveBtn.Name = "saveBtn";
this.saveBtn.Size = new System.Drawing.Size(75, 35);
this.saveBtn.TabIndex = 18;
@@ -232,17 +234,38 @@
this.maxInput.TabIndex = 29;
this.maxInput.Type = BWP.WinFormControl.UTextBoxWithPad.TextBoxType.Number;
//
+ // label9
+ //
+ this.label9.AutoSize = true;
+ this.label9.Font = new System.Drawing.Font("宋体", 15F);
+ this.label9.Location = new System.Drawing.Point(51, 409);
+ this.label9.Name = "label9";
+ this.label9.Size = new System.Drawing.Size(109, 20);
+ this.label9.TabIndex = 27;
+ this.label9.Text = "有效间隔:";
+ //
+ // utxtAllowInterval
+ //
+ this.utxtAllowInterval.Font = new System.Drawing.Font("宋体", 14F);
+ this.utxtAllowInterval.Location = new System.Drawing.Point(173, 407);
+ this.utxtAllowInterval.Name = "utxtAllowInterval";
+ this.utxtAllowInterval.Size = new System.Drawing.Size(121, 29);
+ this.utxtAllowInterval.TabIndex = 24;
+ this.utxtAllowInterval.Type = BWP.WinFormControl.UTextBoxWithPad.TextBoxType.Number;
+ //
// GradeSettingFrom
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(354, 463);
+ this.ClientSize = new System.Drawing.Size(354, 543);
this.ControlBox = false;
this.Controls.Add(this.maxInput);
this.Controls.Add(this.minInput);
+ this.Controls.Add(this.label9);
this.Controls.Add(this.label8);
this.Controls.Add(this.weightReadType);
this.Controls.Add(this.label7);
+ this.Controls.Add(this.utxtAllowInterval);
this.Controls.Add(this.discont);
this.Controls.Add(this.format);
this.Controls.Add(this.label6);
@@ -261,6 +284,7 @@
this.Name = "GradeSettingFrom";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "称重设置";
+ this.Load += new System.EventHandler(this.GradeSettingFrom_Load);
this.ResumeLayout(false);
this.PerformLayout();
@@ -287,5 +311,7 @@
private System.Windows.Forms.Label label8;
private BWP.WinFormControl.UTextBoxWithPad minInput;
private BWP.WinFormControl.UTextBoxWithPad maxInput;
+ private System.Windows.Forms.Label label9;
+ private BWP.WinFormControl.UTextBoxWithPad utxtAllowInterval;
}
}
\ No newline at end of file
diff --git a/WeighAndGrading/GradeSettingFrom.cs b/WeighAndGrading/GradeSettingFrom.cs
index 2a7bd38..ed02521 100644
--- a/WeighAndGrading/GradeSettingFrom.cs
+++ b/WeighAndGrading/GradeSettingFrom.cs
@@ -52,6 +52,8 @@ namespace WeighAndGrading
weightReadType.SelectedIndex = GradeContext.Config.WeightType;
minInput.Text = GradeContext.Config.MinWeight.ToString();
maxInput.Text = GradeContext.Config.MaxWeight.ToString();
+
+ utxtAllowInterval.Text = GradeContext.Config.AllowInterval.ToString();
}
private void saveBtn_Click(object sender, EventArgs e)
@@ -83,6 +85,13 @@ namespace WeighAndGrading
}
else
GradeContext.Config.Discont = 0;
+
+ decimal allowInterval;
+ if (decimal.TryParse(utxtAllowInterval.Text.Trim(), out allowInterval))
+ {
+ GradeContext.Config.AllowInterval = allowInterval;
+ }
+
GradeContext.Save();
MessageBox.Show("保存成功!");
}
@@ -91,5 +100,10 @@ namespace WeighAndGrading
{
this.Close();
}
+
+ private void GradeSettingFrom_Load(object sender, EventArgs e)
+ {
+
+ }
}
}
diff --git a/WeighAndGrading/WeighAndGrading.csproj b/WeighAndGrading/WeighAndGrading.csproj
index 5d66b82..ae4d705 100644
--- a/WeighAndGrading/WeighAndGrading.csproj
+++ b/WeighAndGrading/WeighAndGrading.csproj
@@ -49,6 +49,12 @@
+
+ Form
+
+
+ AbnormalModifyForm.cs
+
Form
@@ -77,6 +83,9 @@
+
+ AbnormalModifyForm.cs
+
BodyDiscontSetting.cs