diff --git a/BWP.WinFormControl/BWP.WinFormControl.csproj b/BWP.WinFormControl/BWP.WinFormControl.csproj
index 8151e56..b9de86e 100644
--- a/BWP.WinFormControl/BWP.WinFormControl.csproj
+++ b/BWP.WinFormControl/BWP.WinFormControl.csproj
@@ -55,6 +55,11 @@
+
+
+
+
+
NumberPad.xaml
@@ -62,6 +67,9 @@
Component
+
+ Component
+
Component
@@ -77,6 +85,7 @@
WeightControl.cs
+
diff --git a/BWP.WinFormControl/ComponentUtil.cs b/BWP.WinFormControl/ComponentUtil.cs
index b042ae0..4a8f33e 100644
--- a/BWP.WinFormControl/ComponentUtil.cs
+++ b/BWP.WinFormControl/ComponentUtil.cs
@@ -23,7 +23,6 @@ namespace BWP.WinFormControl
}
}
return control as Form;
-
}
}
}
diff --git a/BWP.WinFormControl/UDataGridView.cs b/BWP.WinFormControl/UDataGridView.cs
new file mode 100644
index 0000000..1f38af6
--- /dev/null
+++ b/BWP.WinFormControl/UDataGridView.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace BWP.WinFormControl
+{
+ public class UDataGridView : DataGridView
+ {
+ public UDataGridView()
+ {
+ this.AllowUserToAddRows = false;
+ this.AllowUserToDeleteRows = false;
+ this.AllowUserToResizeColumns = false;
+ this.AllowUserToResizeRows = false;
+ this.BackgroundColor = System.Drawing.Color.White;
+ this.ColumnHeadersHeight = 24;
+ this.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
+ this.MultiSelect = false;
+
+ this.RowHeadersVisible = false;
+ this.RowTemplate.Height = 23;
+ this.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
+
+ this.AlternatingRowsDefaultCellStyle = new DataGridViewCellStyle() { BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))) };
+
+ this.ColumnHeadersDefaultCellStyle = new DataGridViewCellStyle()
+ {
+ Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft,
+ BackColor = System.Drawing.SystemColors.Control,
+ Font = new System.Drawing.Font("宋体", 12F),
+ ForeColor = System.Drawing.SystemColors.WindowText,
+ SelectionBackColor = System.Drawing.SystemColors.Highlight,
+ SelectionForeColor = System.Drawing.SystemColors.HighlightText,
+ WrapMode = System.Windows.Forms.DataGridViewTriState.True,
+ };
+ this.RowsDefaultCellStyle = new DataGridViewCellStyle() { SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))) };
+ }
+ }
+}
\ No newline at end of file
diff --git a/BWP.WinFormControl/WeightControl.Designer.cs b/BWP.WinFormControl/WeightControl.Designer.cs
index 325b07a..e0f9844 100644
--- a/BWP.WinFormControl/WeightControl.Designer.cs
+++ b/BWP.WinFormControl/WeightControl.Designer.cs
@@ -28,9 +28,11 @@
///
private void InitializeComponent()
{
+ this.components = new System.ComponentModel.Container();
this.panel1 = new System.Windows.Forms.Panel();
this.weightLabel = new System.Windows.Forms.Label();
this.enableWeightBox = new System.Windows.Forms.CheckBox();
+ this.weightSerialPort = new System.IO.Ports.SerialPort(this.components);
this.panel1.SuspendLayout();
this.SuspendLayout();
//
@@ -65,6 +67,7 @@
this.enableWeightBox.TabIndex = 1;
this.enableWeightBox.Text = "启用称重";
this.enableWeightBox.UseVisualStyleBackColor = true;
+ this.enableWeightBox.CheckedChanged += new System.EventHandler(this.enableWeightBox_CheckedChanged);
//
// WeightControl
//
@@ -86,5 +89,6 @@
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label weightLabel;
private System.Windows.Forms.CheckBox enableWeightBox;
+ private System.IO.Ports.SerialPort weightSerialPort;
}
}
diff --git a/BWP.WinFormControl/WeightControl.cs b/BWP.WinFormControl/WeightControl.cs
index 8f8e5b8..cee7b6d 100644
--- a/BWP.WinFormControl/WeightControl.cs
+++ b/BWP.WinFormControl/WeightControl.cs
@@ -7,12 +7,80 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
+using System.IO.Ports;
+using System.Threading;
+using System.Collections.Concurrent;
+using BWP.WinFormControl.WeightDataFormat;
+using System.Windows.Forms;
namespace BWP.WinFormControl
{
+ public enum WeightType
+ {
+ IND560,
+ Xk3124,
+ Xk3190A9,
+ Xk3190D10
+ }
+
public partial class WeightControl : UserControl
{
- public Label WeightLabel { get { return weightLabel; } }
+ #region weight Need
+
+ private IDataFormat _dataFormat;
+ private Thread _inQueryThread, _outQueryThread;
+ readonly StringBuilder _dataStrBuilder = new StringBuilder();
+ readonly ConcurrentQueue _dataQueue = new ConcurrentQueue();
+ Form mainForm;
+ #endregion
+
+ bool inited = false;
+ public void InitSerialPort(string comPort, int baudRate, int dataBits)
+ {
+ weightSerialPort.PortName = comPort;
+ weightSerialPort.BaudRate = baudRate;
+ weightSerialPort.DataBits = dataBits;
+ weightSerialPort.ReadBufferSize = 4096 * 100;
+ inited = true;
+ }
+
+ //public SerialPort WeightSerialPort { get { return this.weightSerialPort; } }
+
+ private string _valueFormat = @"0.00";
+ public string ValueFormat { get { return _valueFormat; } set { _valueFormat = value; } }
+
+ private WeightType _weightType = WeightType.Xk3190A9;
+ ///
+ /// 称类型
+ ///
+ public WeightType TypeOfWeight
+ {
+ get { return _weightType; }
+ set { _weightType = value; }
+ }
+ string format
+ {
+ get
+ {
+ if (string.IsNullOrEmpty(_valueFormat))
+ _valueFormat = @"0.00";
+ return "{0:" + _valueFormat + "}";
+ }
+ }
+ public decimal? Value
+ {
+ get
+ {
+ if (string.IsNullOrEmpty(weightLabel.Text)) return null;
+ return decimal.Parse(string.Format(format, weightLabel.Text));
+ }
+ private set { weightLabel.Text = string.Format(format, value); }
+ }
+
+ public void Clear()
+ {
+ Value = 0;
+ }
public CheckBox EnableCheckBox { get { return enableWeightBox; } }
@@ -20,5 +88,173 @@ namespace BWP.WinFormControl
{
InitializeComponent();
}
+
+ private void OpenSerialPort()
+ {
+ if (!inited)
+ throw new Exception("Com口没有实例化,请先调用InitSerialPort");
+
+ // 打开串口
+ if (!weightSerialPort.IsOpen)
+ {
+ try
+ {
+ weightSerialPort.Open();
+ if (mainForm == null)
+ mainForm = ComponentUtil.GetParentFormm(this);
+ mainForm.FormClosing += MainFrom_FormClosing;
+ }
+ catch (InvalidOperationException)
+ {
+ MessageBox.Show(@"指定的端口已打开");
+ }
+ catch (UnauthorizedAccessException)
+ {
+ MessageBox.Show(@"对端口的访问被拒绝");
+ }
+ }
+ }
+
+ void ReadData()
+ {
+ _inQueryThread = new Thread(InQuery);
+ _inQueryThread.Start();
+
+ _outQueryThread = new Thread(OutQuery);
+ _outQueryThread.Start();
+ }
+
+ private void InQuery()
+ {
+ while (enableWeightBox.Checked)
+ {
+ int availableCount = weightSerialPort.BytesToRead;
+ if (availableCount == 0)
+ {
+ Thread.Sleep(1);
+ }
+ char[] buffer = new char[availableCount];
+ if (!weightSerialPort.IsOpen)
+ {
+ continue;
+ }
+ weightSerialPort.Read(buffer, 0, availableCount);
+ foreach (var c in buffer)
+ {
+ if (c == _dataFormat.Beginchar)
+ {
+ _dataStrBuilder.Clear();
+ _dataStrBuilder.Append(c);
+ }
+ else if (c == _dataFormat.Endchar || _dataStrBuilder.Length > _dataFormat.Bufsize)
+ {
+ _dataStrBuilder.Append(c);
+ _dataQueue.Enqueue(_dataStrBuilder.ToString());
+ _dataStrBuilder.Clear();
+ }
+ else
+ {
+ _dataStrBuilder.Append(c);
+ }
+ }
+ }
+ }
+
+ private void OutQuery()
+ {
+ while (enableWeightBox.Checked)
+ {
+ try
+ {
+ bool isStatic;
+ string str;
+
+ string subStr;
+
+ if (!_dataQueue.TryDequeue(out subStr))
+ {
+ Thread.Sleep(1);
+ continue;
+ }
+ // 解析接受的端口数据
+ if (_dataFormat.ParseAscii(subStr, out str, out isStatic))
+ {
+ Value = decimal.Parse(str);
+ }
+ }
+ catch (Exception)
+ {
+ Thread.Sleep(1000);
+ continue;
+ }
+ Thread.Sleep(1);
+ }
+ }
+
+ void InitWeightType()
+ {
+ switch (_weightType)
+ {
+ case WeightType.IND560:
+ _dataFormat = new IND560DataFormat();
+ break;
+ case WeightType.Xk3124:
+ _dataFormat = new Xk3124DataFormat();
+ break;
+ case WeightType.Xk3190A9:
+ _dataFormat = new Xk3190A9DataFormat();
+ break;
+ case WeightType.Xk3190D10:
+ _dataFormat = new Xk3190D10DataFormat();
+ break;
+ default:
+ throw new Exception("未知称类型");
+ }
+ }
+
+ void DisableWeight()
+ {
+ mainForm.FormClosing -= MainFrom_FormClosing;
+ Thread.Sleep(10);
+
+ if (weightSerialPort.IsOpen)
+ {
+ weightSerialPort.Close();
+ }
+
+ if (_inQueryThread.IsAlive)
+ {
+ _inQueryThread.Abort();
+ }
+ if (_outQueryThread.IsAlive)
+ {
+ _outQueryThread.Abort();
+ }
+ Value = 0;
+ }
+
+ private void MainFrom_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ if (!enableWeightBox.Checked)
+ return;
+ DisableWeight();
+ }
+
+ private void enableWeightBox_CheckedChanged(object sender, EventArgs e)
+ {
+ if (!inited)
+ {
+ enableWeightBox.Checked = false;
+ throw new Exception("Com口没有实例化,请先调用InitSerialPort");
+ }
+ if (enableWeightBox.Checked)
+ {
+ InitWeightType();
+ OpenSerialPort();
+ ReadData();
+ }
+ else
+ DisableWeight();
+ }
}
}
diff --git a/BWP.WinFormControl/WeightControl.resx b/BWP.WinFormControl/WeightControl.resx
index 1af7de1..882b266 100644
--- a/BWP.WinFormControl/WeightControl.resx
+++ b/BWP.WinFormControl/WeightControl.resx
@@ -117,4 +117,7 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ 17, 17
+
\ No newline at end of file
diff --git a/BWP.WinFormControl/WeightDataFormat/DataFormatBase.cs b/BWP.WinFormControl/WeightDataFormat/DataFormatBase.cs
new file mode 100644
index 0000000..3d41d52
--- /dev/null
+++ b/BWP.WinFormControl/WeightDataFormat/DataFormatBase.cs
@@ -0,0 +1,57 @@
+namespace BWP.WinFormControl.WeightDataFormat
+{
+ interface IDataFormat {
+ char Beginchar { get; }
+ char Endchar { get; }
+ short Bufsize { get; }
+ bool ParseAscii(string buf, out string weight, out bool isStatic);
+ bool ParseAscii(string buf, out string weight, out bool isStatic, out string subStr);
+ }
+
+ public abstract class DataFormatBase : IDataFormat {
+
+ public abstract int DataLength {
+ get;
+ }
+
+ public abstract char Beginchar {
+ get;
+ }
+
+ public abstract char Endchar {
+ get;
+ }
+
+ public abstract short Bufsize { get; }
+
+
+ public const short BUFSIZE = 36;
+ // 根据开始字符找出 一个完整的数据帧
+ public string FindDataFrame(string buf, int fSize) {
+ var bufSize = buf.Length;
+ if (fSize > bufSize) {
+ return string.Empty;
+ }
+
+ int index = buf.IndexOf(Beginchar); // 查找开始字符的索引
+
+ if (index < 0 || (index + fSize) > bufSize) {
+ return string.Empty;
+ }
+
+ string data = buf.Substring(index, fSize);
+
+ // 检查结束字符
+ if (data[fSize - 1] != Endchar) {
+ return string.Empty;
+ }
+
+ return data;
+ }
+
+ public abstract string ParseData(string buf, out bool isStatic);
+
+ public abstract bool ParseAscii(string buf, out string weight, out bool isStatic);
+ public abstract bool ParseAscii(string buf, out string weight, out bool isStatic, out string subStr);
+ }
+}
diff --git a/BWP.WinFormControl/WeightDataFormat/IND560DataFormat.cs b/BWP.WinFormControl/WeightDataFormat/IND560DataFormat.cs
new file mode 100644
index 0000000..e1e086b
--- /dev/null
+++ b/BWP.WinFormControl/WeightDataFormat/IND560DataFormat.cs
@@ -0,0 +1,40 @@
+namespace BWP.WinFormControl.WeightDataFormat
+{
+ public class IND560DataFormat : DataFormatBase {
+ public override int DataLength {
+ get { return 10; }
+ }
+
+ public override char Beginchar {
+ get { return (char)0x80; }//ûй̶Ŀʼ־
+ }
+
+ public override char Endchar {
+ get { return (char)0x0A; ; }
+ }
+
+ public override short Bufsize {
+ get { return 10; }
+ }
+
+ public override string ParseData(string buf, out bool isStatic)
+ {
+ isStatic = false;
+ return string.Empty;
+ }
+
+ public override bool ParseAscii(string buf, out string weight, out bool isStatic) {
+ isStatic = true;
+ weight = buf.Replace("kg", "").Replace((char)0x0D, (char)0x20).Replace((char)0x0A, (char)0x20);
+ weight = weight.Trim();
+ return true;
+ }
+
+ public override bool ParseAscii(string buf, out string weight, out bool isStatic, out string subStr) {
+ weight = "";
+ isStatic = false;
+ subStr = "";
+ return false;
+ }
+ }
+}
\ No newline at end of file
diff --git a/BWP.WinFormControl/WeightDataFormat/Xk3124DataFormat.cs b/BWP.WinFormControl/WeightDataFormat/Xk3124DataFormat.cs
new file mode 100644
index 0000000..07d1e0c
--- /dev/null
+++ b/BWP.WinFormControl/WeightDataFormat/Xk3124DataFormat.cs
@@ -0,0 +1,104 @@
+using System.Text;
+
+namespace BWP.WinFormControl.WeightDataFormat
+{
+ public class Xk3124DataFormat : DataFormatBase {
+ public override int DataLength {
+ get { return 17; }
+ }
+
+ public override char Beginchar
+ {
+ get { return (char)0x02; }
+ }
+
+ public override char Endchar
+ {
+ get { return (char)0x0D; ; }
+ }
+
+ public override short Bufsize
+ {
+ get { return 36; }
+ }
+
+ public override string ParseData(string buf, out bool isStatic) {
+ StringBuilder str = new StringBuilder();
+
+ char swa = buf[1]; // 状态字A
+ char swb = buf[2]; // 状态字B
+
+ int dotIndex = (swa & 0x07) - 2; // 小数点位置
+
+ bool isPositive = (((swb >> 1) & 0x01) == 0); // 符号:是否为正数
+ isStatic = (((swb >> 3) & 0x01) == 0);
+
+ char[] num = new char[6];
+
+ for (int i = 0; i < 6; i++) {
+ num[i] = buf[i + 4];
+ }
+
+ if (dotIndex < 0) { // 不考虑精确到十,百位
+ return str.ToString();
+ }
+
+ for (int i = 0; i < 6 - dotIndex; i++) {
+ str.Append(num[i]);
+ }
+
+ str.Append('.');
+
+ for (int i = 0; i < dotIndex; i++) {
+ str.Append(num[6 - dotIndex + i]);
+ }
+
+ // 去掉空格
+ string result = str.ToString().Trim();
+
+ // 取消前面多余的0
+ for (int i = 0; i < result.Length; i++) {
+ if (result[i] != '0') {
+ result = result.Substring(i, result.Length - i);
+ break;
+ }
+ }
+
+ if (result.IndexOf('.') == 0) {
+ result = result.Insert(0, "0");
+ }
+
+ if (result.IndexOf('.') == result.Length - 1) {
+ result = result.Remove(result.IndexOf('.'), 1);
+ }
+
+ if (!isPositive) { // 负数
+ result = result.Insert(0, "-");
+ }
+
+ return result;
+ }
+
+ public override bool ParseAscii(string buf, out string weight, out bool isStatic) {
+ isStatic = false;
+ weight = FindDataFrame(buf, DataLength );
+
+ if (string.IsNullOrEmpty(weight)) {
+ return false;
+ }
+
+ weight = ParseData(weight, out isStatic);
+
+ return true;
+ }
+
+ public override bool ParseAscii(string buf, out string weight, out bool isStatic, out string subStr) {
+ weight = "";
+ isStatic = false;
+ subStr = "";
+ return false;
+ }
+ }
+
+ //IND560单次读入
+}
diff --git a/BWP.WinFormControl/WeightDataFormat/Xk3190A9DataFormat.cs b/BWP.WinFormControl/WeightDataFormat/Xk3190A9DataFormat.cs
new file mode 100644
index 0000000..e192ab9
--- /dev/null
+++ b/BWP.WinFormControl/WeightDataFormat/Xk3190A9DataFormat.cs
@@ -0,0 +1,110 @@
+namespace BWP.WinFormControl.WeightDataFormat
+{
+ public class Xk3190A9DataFormat : DataFormatBase {
+
+ public override int DataLength {
+ get { return 12; }
+ }
+
+ public override char Beginchar {
+ get { return (char)0x02; }
+ }
+
+ public override char Endchar {
+ get { return (char)0x03; ; }
+ }
+
+ public override short Bufsize {
+ get { return 36; }
+ }
+
+ public override string ParseData(string buf, out bool isStatic) {
+ string weight;
+ // Сλ0-4
+ int dot = (short)(0x0F & buf[8]);
+ weight = buf.Substring(2, 6).Trim();
+
+ // insert dot
+ weight = InsertDot(weight, dot);
+ isStatic = true; // Ĭ Ϊ ȶ
+
+ // buffer[1] λ
+ if (buf[1] == '-') {
+ weight = weight.Insert(0, "-");
+ }
+
+ return weight;
+ }
+
+ public override bool ParseAscii(string buf, out string weight, out bool isStatic) {
+ isStatic = false;
+ weight = FindDataFrame(buf, DataLength );
+
+ if (string.IsNullOrEmpty(weight)) {
+ return false;
+ }
+
+ weight = ParseData(weight, out isStatic);
+
+ return true;
+ }
+
+ private static string InsertDot(string weight, int dotBits) {
+ string str = weight.TrimStart(new[] {
+ '0'
+ });
+ str = str.Trim();
+
+ if (dotBits > 0) {
+ //str = str.Insert(str.Length - dotBits, ".");
+ if (string.IsNullOrEmpty(str)) {
+ str = "0";
+ str = str.Insert(str.Length, ".");
+ for (int i = 0; i < dotBits; i++) {
+ str = str.Insert(str.Length, "0");
+ }
+ } else
+ str = str.Insert(str.Length - dotBits, ".");
+ }
+
+ if (str.IndexOf(".") == 0) {
+ str = str.Insert(0, "0");
+ }
+
+ return str;
+ }
+
+ public override bool ParseAscii(string buf, out string weight, out bool isStatic, out string subStr) {
+ isStatic = false;
+ weight = FindDataFrame(buf, DataLength , out subStr);
+
+ if (string.IsNullOrEmpty(weight)) {
+ return false;
+ }
+
+ weight = ParseData(weight, out isStatic);
+
+
+ return true;
+ }
+ // ݿʼַҳ һ֡
+ public string FindDataFrame(string buf, int fSize , out string subStr) {
+ var bufSize = buf.Length;
+ subStr = "";
+ int index = buf.IndexOf(Beginchar); // ҿʼַ
+
+ if (index < 0 || (index + fSize) > bufSize) {
+ return string.Empty;
+ }
+
+ string data = buf.Substring(index, fSize);
+ subStr = buf.Substring(index + fSize);
+ // ַ
+ if (data[fSize - 1] != Endchar) {
+ return string.Empty;
+ }
+
+ return data;
+ }
+ }
+}
\ No newline at end of file
diff --git a/BWP.WinFormControl/WeightDataFormat/Xk3190D10DataFormat.cs b/BWP.WinFormControl/WeightDataFormat/Xk3190D10DataFormat.cs
new file mode 100644
index 0000000..aef0b22
--- /dev/null
+++ b/BWP.WinFormControl/WeightDataFormat/Xk3190D10DataFormat.cs
@@ -0,0 +1,106 @@
+namespace BWP.WinFormControl.WeightDataFormat
+{
+ public class Xk3190D10DataFormat : DataFormatBase {
+
+ public override int DataLength {
+ get { return 12; }
+ }
+ public override char Beginchar {
+ get { return (char)0x02; }
+ }
+
+ public override char Endchar {
+ get { return (char)0x0D; ; }
+ }
+
+ public override short Bufsize
+ {
+ get { return 24; }
+ }
+
+ public override string ParseData(string buf, out bool isStatic) {
+ string weight;
+ // Сλ0-4
+ int dot = (short)(0x0F & buf[8]);
+ weight = buf.Substring(2, 6).Trim();
+
+ // insert dot
+ weight = InsertDot(weight, dot);
+ isStatic = true; // Ĭ Ϊ ȶ
+
+ // buffer[1] λ
+ if (buf[1] == '-') {
+ weight = weight.Insert(0, "-");
+ } else {
+
+ }
+ return weight;
+ }
+
+ public override bool ParseAscii(string buf, out string weight, out bool isStatic) {
+ isStatic = false;
+ weight = FindDataFrame(buf, DataLength);
+
+ if (string.IsNullOrEmpty(weight)) {
+ return false;
+ }
+
+ weight = ParseData(weight, out isStatic);
+
+ return true;
+ }
+
+ private static string InsertDot(string weight, int dotBits) {
+ string str = weight.TrimStart(new[] {
+ '0'
+ });
+ str = str.Trim();
+
+ if (dotBits > 0) {
+ //str = str.Insert(str.Length - dotBits, ".");
+ if (string.IsNullOrEmpty(str)) {
+ str = "0";
+ str = str.Insert(str.Length, ".");
+ for (int i = 0; i < dotBits; i++) {
+ str = str.Insert(str.Length, "0");
+ }
+ } else
+ str = str.Insert(str.Length - dotBits, ".");
+ }
+
+ if (str.IndexOf(".") == 0) {
+ str = str.Insert(0, "0");
+ }
+
+ return str;
+ }
+
+ public override bool ParseAscii(string buf, out string weight, out bool isStatic, out string subStr) {
+ isStatic = false;
+ weight = FindDataFrame(buf, DataLength );
+ subStr = "";
+ if (string.IsNullOrEmpty(weight)) {
+ return false;
+ }
+
+ weight = ParseData(weight, out isStatic);
+
+ return true;
+ }
+
+ #region 1.3 ֤intż
+ ///
+ /// 1.3 ֤intż
+ ///
+ ///
+ ///
+ public bool isJO(int num) {
+ int a = num % 2;
+ if (a == 0)
+ return true;
+ else
+ return false;
+ }
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/BWP.WinFormControl/WinApiSendMessage.cs b/BWP.WinFormControl/WinApiSendMessage.cs
new file mode 100644
index 0000000..b4d288d
--- /dev/null
+++ b/BWP.WinFormControl/WinApiSendMessage.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BWP.WinFormControl
+{
+ public class WinApiSendMessage
+ {
+ [DllImport("User32.dll", EntryPoint = "SendMessage")]
+ public static extern int SendMessage(
+ int hWnd, // handle to destination window
+ int Msg, // message
+ int wParam, // first message parameter
+ int lParam // second message parameter
+ );
+
+ [DllImport("User32.dll", EntryPoint = "FindWindow")]
+ public static extern int FindWindow(string lpClassName, string lpWindowName);
+ }
+}
diff --git a/ButcherManageClient/Login.Designer.cs b/ButcherManageClient/Login.Designer.cs
index 429888d..6c10504 100644
--- a/ButcherManageClient/Login.Designer.cs
+++ b/ButcherManageClient/Login.Designer.cs
@@ -39,6 +39,7 @@
//
// closeBtn
//
+ this.closeBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.closeBtn.Font = new System.Drawing.Font("宋体", 20F);
this.closeBtn.Location = new System.Drawing.Point(233, 211);
this.closeBtn.Name = "closeBtn";
@@ -111,8 +112,10 @@
//
// Login
//
+ this.AcceptButton = this.loginBtn;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.CancelButton = this.closeBtn;
this.ClientSize = new System.Drawing.Size(540, 314);
this.Controls.Add(this.closeBtn);
this.Controls.Add(this.loginBtn);
diff --git a/ButcherWeight/WeightForm.Designer.cs b/ButcherWeight/WeightForm.Designer.cs
index a9c4a19..d215d72 100644
--- a/ButcherWeight/WeightForm.Designer.cs
+++ b/ButcherWeight/WeightForm.Designer.cs
@@ -44,13 +44,27 @@
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle29 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle30 = new System.Windows.Forms.DataGridViewCellStyle();
this.panel1 = new System.Windows.Forms.Panel();
+ this.weightControl = new BWP.WinFormControl.WeightControl();
+ this.exitBtn = new System.Windows.Forms.Button();
+ this.deleteBtn = new System.Windows.Forms.Button();
+ this.printBtn = new System.Windows.Forms.Button();
+ this.createBtn = new System.Windows.Forms.Button();
this.commitBtn = new System.Windows.Forms.Button();
this.readPiBtn = new System.Windows.Forms.Button();
this.readMaoBtn = new System.Windows.Forms.Button();
this.panel2 = new System.Windows.Forms.Panel();
+ this.zoneSelect = new BWP.WinFormControl.UComboBox();
+ this.hogGradeSelect = new BWP.WinFormControl.UComboBox();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
+ this.employeeSelect = new BWP.WinFormControl.UComboBox();
+ this.carSelect = new BWP.WinFormControl.UComboBox();
+ this.liveVarietiesSelect = new BWP.WinFormControl.UComboBox();
+ this.purchaseTypeSelect = new BWP.WinFormControl.UComboBox();
+ this.supplierSelect = new BWP.WinFormControl.UComboBox();
this.testManInput = new System.Windows.Forms.TextBox();
+ this.testTimeInput = new BWP.WinFormControl.UDatePicker();
+ this.weightTimeSelect = new BWP.WinFormControl.UDatePicker();
this.label19 = new System.Windows.Forms.Label();
this.label20 = new System.Windows.Forms.Label();
this.label21 = new System.Windows.Forms.Label();
@@ -72,17 +86,8 @@
this.label7 = new System.Windows.Forms.Label();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.panel3 = new System.Windows.Forms.Panel();
- this.label3 = new System.Windows.Forms.Label();
+ this.farmerSelect = new BWP.WinFormControl.UComboBox();
this.farmerGrid = new System.Windows.Forms.DataGridView();
- this.label18 = new System.Windows.Forms.Label();
- this.weightGrid = new System.Windows.Forms.DataGridView();
- this.panel4 = new System.Windows.Forms.Panel();
- this.houseGird = new System.Windows.Forms.DataGridView();
- this.abnormalGrid = new System.Windows.Forms.DataGridView();
- this.billGrid = new System.Windows.Forms.DataGridView();
- this.label15 = new System.Windows.Forms.Label();
- this.label16 = new System.Windows.Forms.Label();
- this.label17 = new System.Windows.Forms.Label();
this.F_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.F_B3ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.F_WeightBill_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -90,6 +95,9 @@
this.F_Index = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.F_Farmer_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.F_Number = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.label3 = new System.Windows.Forms.Label();
+ this.label18 = new System.Windows.Forms.Label();
+ this.weightGrid = new System.Windows.Forms.DataGridView();
this.D_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.D_B3ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.D_WeightBill_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -98,16 +106,8 @@
this.D_MaoWeight = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.D_PiWeight = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.D_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.M_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.M_B3ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.M_Supplier_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.M_Zone_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.M_FarmerNames = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.M_PurchaseType_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.M_Number = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.M_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.M_HouseNames = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.M_SanctionNumber = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.panel4 = new System.Windows.Forms.Panel();
+ this.houseGird = new System.Windows.Forms.DataGridView();
this.H_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_B3ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_WeightBill_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -115,6 +115,7 @@
this.H_Index = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_LiveColonyHouse_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Number = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.abnormalGrid = new System.Windows.Forms.DataGridView();
this.S_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.S_B3ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.S_WeightBill_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -123,21 +124,20 @@
this.S_Index = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.S_AbnormalItem_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.S_Number = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.createBtn = new System.Windows.Forms.Button();
- this.farmerSelect = new BWP.WinFormControl.UComboBox();
- this.zoneSelect = new BWP.WinFormControl.UComboBox();
- this.hogGradeSelect = new BWP.WinFormControl.UComboBox();
- this.employeeSelect = new BWP.WinFormControl.UComboBox();
- this.carSelect = new BWP.WinFormControl.UComboBox();
- this.liveVarietiesSelect = new BWP.WinFormControl.UComboBox();
- this.purchaseTypeSelect = new BWP.WinFormControl.UComboBox();
- this.supplierSelect = new BWP.WinFormControl.UComboBox();
- this.testTimeInput = new BWP.WinFormControl.UDatePicker();
- this.weightTimeSelect = new BWP.WinFormControl.UDatePicker();
- this.weightControl = new BWP.WinFormControl.WeightControl();
- this.exitBtn = new System.Windows.Forms.Button();
- this.deleteBtn = new System.Windows.Forms.Button();
- this.printBtn = new System.Windows.Forms.Button();
+ this.billGrid = new System.Windows.Forms.DataGridView();
+ this.M_ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.M_B3ID = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.M_Supplier_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.M_Zone_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.M_FarmerNames = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.M_PurchaseType_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.M_Number = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.M_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.M_HouseNames = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.M_SanctionNumber = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.label15 = new System.Windows.Forms.Label();
+ this.label16 = new System.Windows.Forms.Label();
+ this.label17 = new System.Windows.Forms.Label();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
this.panel3.SuspendLayout();
@@ -152,6 +152,7 @@
// panel1
//
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.panel1.Controls.Add(this.weightControl);
this.panel1.Controls.Add(this.exitBtn);
this.panel1.Controls.Add(this.deleteBtn);
this.panel1.Controls.Add(this.printBtn);
@@ -159,12 +160,62 @@
this.panel1.Controls.Add(this.commitBtn);
this.panel1.Controls.Add(this.readPiBtn);
this.panel1.Controls.Add(this.readMaoBtn);
- this.panel1.Controls.Add(this.weightControl);
this.panel1.Location = new System.Drawing.Point(12, 12);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(1252, 95);
this.panel1.TabIndex = 1;
//
+ // weightControl
+ //
+ this.weightControl.Location = new System.Drawing.Point(0, 0);
+ this.weightControl.Name = "weightControl";
+ this.weightControl.Size = new System.Drawing.Size(156, 92);
+ this.weightControl.TabIndex = 9;
+ this.weightControl.TypeOfWeight = BWP.WinFormControl.WeightType.Xk3190A9;
+ this.weightControl.ValueFormat = "0.00";
+ //
+ // exitBtn
+ //
+ this.exitBtn.Font = new System.Drawing.Font("宋体", 15F);
+ this.exitBtn.Location = new System.Drawing.Point(871, 0);
+ this.exitBtn.Name = "exitBtn";
+ this.exitBtn.Size = new System.Drawing.Size(101, 59);
+ this.exitBtn.TabIndex = 4;
+ this.exitBtn.Text = "退出";
+ this.exitBtn.UseVisualStyleBackColor = true;
+ this.exitBtn.Click += new System.EventHandler(this.exitBtn_Click);
+ //
+ // deleteBtn
+ //
+ this.deleteBtn.Font = new System.Drawing.Font("宋体", 15F);
+ this.deleteBtn.Location = new System.Drawing.Point(753, 0);
+ this.deleteBtn.Name = "deleteBtn";
+ this.deleteBtn.Size = new System.Drawing.Size(101, 59);
+ this.deleteBtn.TabIndex = 5;
+ this.deleteBtn.Text = "删除";
+ this.deleteBtn.UseVisualStyleBackColor = true;
+ //
+ // printBtn
+ //
+ this.printBtn.Font = new System.Drawing.Font("宋体", 15F);
+ this.printBtn.Location = new System.Drawing.Point(636, 0);
+ this.printBtn.Name = "printBtn";
+ this.printBtn.Size = new System.Drawing.Size(101, 59);
+ this.printBtn.TabIndex = 8;
+ this.printBtn.Text = "打印";
+ this.printBtn.UseVisualStyleBackColor = true;
+ //
+ // createBtn
+ //
+ this.createBtn.Font = new System.Drawing.Font("宋体", 15F);
+ this.createBtn.Location = new System.Drawing.Point(402, 0);
+ this.createBtn.Name = "createBtn";
+ this.createBtn.Size = new System.Drawing.Size(101, 59);
+ this.createBtn.TabIndex = 3;
+ this.createBtn.Text = "新建";
+ this.createBtn.UseVisualStyleBackColor = true;
+ this.createBtn.Click += new System.EventHandler(this.createBtn_Click);
+ //
// commitBtn
//
this.commitBtn.Font = new System.Drawing.Font("宋体", 15F);
@@ -178,6 +229,7 @@
//
// readPiBtn
//
+ this.readPiBtn.Enabled = false;
this.readPiBtn.Font = new System.Drawing.Font("宋体", 15F);
this.readPiBtn.Location = new System.Drawing.Point(286, 0);
this.readPiBtn.Name = "readPiBtn";
@@ -189,6 +241,7 @@
//
// readMaoBtn
//
+ this.readMaoBtn.Enabled = false;
this.readMaoBtn.Font = new System.Drawing.Font("宋体", 15F);
this.readMaoBtn.Location = new System.Drawing.Point(169, 0);
this.readMaoBtn.Name = "readMaoBtn";
@@ -238,6 +291,32 @@
this.panel2.Size = new System.Drawing.Size(1251, 170);
this.panel2.TabIndex = 2;
//
+ // zoneSelect
+ //
+ this.zoneSelect.CodeArgs = null;
+ this.zoneSelect.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
+ this.zoneSelect.EnableTopItem = true;
+ this.zoneSelect.Font = new System.Drawing.Font("宋体", 14F);
+ this.zoneSelect.FormattingEnabled = true;
+ this.zoneSelect.Location = new System.Drawing.Point(348, 129);
+ this.zoneSelect.Name = "zoneSelect";
+ this.zoneSelect.Range = 10;
+ this.zoneSelect.Size = new System.Drawing.Size(135, 30);
+ this.zoneSelect.TabIndex = 37;
+ //
+ // hogGradeSelect
+ //
+ this.hogGradeSelect.CodeArgs = null;
+ this.hogGradeSelect.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
+ this.hogGradeSelect.EnableTopItem = true;
+ this.hogGradeSelect.Font = new System.Drawing.Font("宋体", 14F);
+ this.hogGradeSelect.FormattingEnabled = true;
+ this.hogGradeSelect.Location = new System.Drawing.Point(103, 129);
+ this.hogGradeSelect.Name = "hogGradeSelect";
+ this.hogGradeSelect.Range = 10;
+ this.hogGradeSelect.Size = new System.Drawing.Size(135, 30);
+ this.hogGradeSelect.TabIndex = 36;
+ //
// label2
//
this.label2.AutoSize = true;
@@ -258,6 +337,71 @@
this.label1.TabIndex = 34;
this.label1.Text = "毛猪等级";
//
+ // employeeSelect
+ //
+ this.employeeSelect.CodeArgs = null;
+ this.employeeSelect.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
+ this.employeeSelect.EnableTopItem = true;
+ this.employeeSelect.Font = new System.Drawing.Font("宋体", 14F);
+ this.employeeSelect.FormattingEnabled = true;
+ this.employeeSelect.Location = new System.Drawing.Point(348, 88);
+ this.employeeSelect.Name = "employeeSelect";
+ this.employeeSelect.Range = 10;
+ this.employeeSelect.Size = new System.Drawing.Size(135, 30);
+ this.employeeSelect.TabIndex = 33;
+ //
+ // carSelect
+ //
+ this.carSelect.CodeArgs = null;
+ this.carSelect.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
+ this.carSelect.EnableTopItem = true;
+ this.carSelect.Font = new System.Drawing.Font("宋体", 14F);
+ this.carSelect.FormattingEnabled = true;
+ this.carSelect.Location = new System.Drawing.Point(348, 49);
+ this.carSelect.Name = "carSelect";
+ this.carSelect.Range = 10;
+ this.carSelect.Size = new System.Drawing.Size(135, 30);
+ this.carSelect.TabIndex = 32;
+ //
+ // liveVarietiesSelect
+ //
+ this.liveVarietiesSelect.CodeArgs = null;
+ this.liveVarietiesSelect.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
+ this.liveVarietiesSelect.EnableTopItem = true;
+ this.liveVarietiesSelect.Font = new System.Drawing.Font("宋体", 14F);
+ this.liveVarietiesSelect.FormattingEnabled = true;
+ this.liveVarietiesSelect.Location = new System.Drawing.Point(103, 88);
+ this.liveVarietiesSelect.Name = "liveVarietiesSelect";
+ this.liveVarietiesSelect.Range = 10;
+ this.liveVarietiesSelect.Size = new System.Drawing.Size(135, 30);
+ this.liveVarietiesSelect.TabIndex = 31;
+ //
+ // purchaseTypeSelect
+ //
+ this.purchaseTypeSelect.CodeArgs = null;
+ this.purchaseTypeSelect.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
+ this.purchaseTypeSelect.EnableTopItem = true;
+ this.purchaseTypeSelect.Font = new System.Drawing.Font("宋体", 14F);
+ this.purchaseTypeSelect.FormattingEnabled = true;
+ this.purchaseTypeSelect.Location = new System.Drawing.Point(348, 8);
+ this.purchaseTypeSelect.Name = "purchaseTypeSelect";
+ this.purchaseTypeSelect.Range = 10;
+ this.purchaseTypeSelect.Size = new System.Drawing.Size(135, 30);
+ this.purchaseTypeSelect.TabIndex = 30;
+ //
+ // supplierSelect
+ //
+ this.supplierSelect.CodeArgs = null;
+ this.supplierSelect.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
+ this.supplierSelect.EnableTopItem = true;
+ this.supplierSelect.Font = new System.Drawing.Font("宋体", 14F);
+ this.supplierSelect.FormattingEnabled = true;
+ this.supplierSelect.Location = new System.Drawing.Point(103, 8);
+ this.supplierSelect.Name = "supplierSelect";
+ this.supplierSelect.Range = 10;
+ this.supplierSelect.Size = new System.Drawing.Size(135, 30);
+ this.supplierSelect.TabIndex = 29;
+ //
// testManInput
//
this.testManInput.Font = new System.Drawing.Font("宋体", 14F);
@@ -266,6 +410,34 @@
this.testManInput.Size = new System.Drawing.Size(135, 29);
this.testManInput.TabIndex = 28;
//
+ // testTimeInput
+ //
+ this.testTimeInput.BackColor = System.Drawing.Color.White;
+ this.testTimeInput.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.testTimeInput.Date = new System.DateTime(2017, 9, 8, 0, 0, 0, 0);
+ this.testTimeInput.Font = new System.Drawing.Font("宋体", 15F);
+ this.testTimeInput.Location = new System.Drawing.Point(1100, 51);
+ this.testTimeInput.Name = "testTimeInput";
+ this.testTimeInput.Size = new System.Drawing.Size(135, 30);
+ this.testTimeInput.TabIndex = 27;
+ this.testTimeInput.Text = "2017/09/08";
+ this.testTimeInput.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ this.testTimeInput.Type = BWP.WinFormControl.DateTimeType.Date;
+ //
+ // weightTimeSelect
+ //
+ this.weightTimeSelect.BackColor = System.Drawing.Color.White;
+ this.weightTimeSelect.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.weightTimeSelect.Date = new System.DateTime(2017, 9, 8, 13, 21, 21, 0);
+ this.weightTimeSelect.Font = new System.Drawing.Font("宋体", 9F);
+ this.weightTimeSelect.Location = new System.Drawing.Point(103, 49);
+ this.weightTimeSelect.Name = "weightTimeSelect";
+ this.weightTimeSelect.Size = new System.Drawing.Size(135, 30);
+ this.weightTimeSelect.TabIndex = 26;
+ this.weightTimeSelect.Text = "2017/09/08 13:21:21";
+ this.weightTimeSelect.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ this.weightTimeSelect.Type = BWP.WinFormControl.DateTimeType.DateTime;
+ //
// label19
//
this.label19.AutoSize = true;
@@ -483,25 +655,28 @@
this.panel3.Size = new System.Drawing.Size(402, 238);
this.panel3.TabIndex = 3;
//
- // label3
+ // farmerSelect
//
- this.label3.AutoSize = true;
- this.label3.Font = new System.Drawing.Font("宋体", 15F);
- this.label3.Location = new System.Drawing.Point(115, 96);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(89, 20);
- this.label3.TabIndex = 9;
- this.label3.Text = "养殖户:";
+ this.farmerSelect.CodeArgs = null;
+ this.farmerSelect.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
+ this.farmerSelect.EnableTopItem = true;
+ this.farmerSelect.Font = new System.Drawing.Font("宋体", 12F);
+ this.farmerSelect.FormattingEnabled = true;
+ this.farmerSelect.Location = new System.Drawing.Point(190, 93);
+ this.farmerSelect.Name = "farmerSelect";
+ this.farmerSelect.Range = 10;
+ this.farmerSelect.Size = new System.Drawing.Size(135, 27);
+ this.farmerSelect.TabIndex = 38;
+ this.farmerSelect.SelectedIndexChanged += new System.EventHandler(this.farmerSelect_SelectedIndexChanged);
//
// farmerGrid
//
this.farmerGrid.AllowUserToAddRows = false;
this.farmerGrid.AllowUserToResizeColumns = false;
this.farmerGrid.AllowUserToResizeRows = false;
- dataGridViewCellStyle16.BackColor = System.Drawing.Color.Silver;
+ dataGridViewCellStyle16.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.farmerGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle16;
this.farmerGrid.BackgroundColor = System.Drawing.Color.White;
- this.farmerGrid.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.SingleHorizontal;
dataGridViewCellStyle17.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle17.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle17.Font = new System.Drawing.Font("宋体", 12F);
@@ -524,17 +699,77 @@
this.farmerGrid.MultiSelect = false;
this.farmerGrid.Name = "farmerGrid";
this.farmerGrid.RowHeadersVisible = false;
- dataGridViewCellStyle18.SelectionBackColor = System.Drawing.Color.DodgerBlue;
+ dataGridViewCellStyle18.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.farmerGrid.RowsDefaultCellStyle = dataGridViewCellStyle18;
- this.farmerGrid.RowTemplate.DefaultCellStyle.SelectionBackColor = System.Drawing.Color.Empty;
this.farmerGrid.RowTemplate.Height = 23;
this.farmerGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.farmerGrid.Size = new System.Drawing.Size(400, 112);
this.farmerGrid.TabIndex = 8;
//
- // label18
+ // F_ID
//
- this.label18.AutoSize = true;
+ this.F_ID.DataPropertyName = "ID";
+ this.F_ID.HeaderText = "ID";
+ this.F_ID.Name = "F_ID";
+ this.F_ID.Visible = false;
+ //
+ // F_B3ID
+ //
+ this.F_B3ID.DataPropertyName = "B3ID";
+ this.F_B3ID.HeaderText = "B3ID";
+ this.F_B3ID.Name = "F_B3ID";
+ this.F_B3ID.Visible = false;
+ //
+ // F_WeightBill_ID
+ //
+ this.F_WeightBill_ID.DataPropertyName = "WeightBill_ID";
+ this.F_WeightBill_ID.HeaderText = "WeightBill_ID";
+ this.F_WeightBill_ID.Name = "F_WeightBill_ID";
+ this.F_WeightBill_ID.Visible = false;
+ //
+ // F_Farmer_ID
+ //
+ this.F_Farmer_ID.DataPropertyName = "Farmer_ID";
+ this.F_Farmer_ID.HeaderText = "Farmer_ID";
+ this.F_Farmer_ID.Name = "F_Farmer_ID";
+ this.F_Farmer_ID.Visible = false;
+ //
+ // F_Index
+ //
+ this.F_Index.DataPropertyName = "Index";
+ this.F_Index.HeaderText = "序号";
+ this.F_Index.Name = "F_Index";
+ this.F_Index.ReadOnly = true;
+ this.F_Index.Width = 80;
+ //
+ // F_Farmer_Name
+ //
+ this.F_Farmer_Name.DataPropertyName = "Farmer_Name";
+ this.F_Farmer_Name.HeaderText = "养殖户";
+ this.F_Farmer_Name.Name = "F_Farmer_Name";
+ this.F_Farmer_Name.ReadOnly = true;
+ this.F_Farmer_Name.Width = 150;
+ //
+ // F_Number
+ //
+ this.F_Number.DataPropertyName = "Number";
+ this.F_Number.HeaderText = "头数";
+ this.F_Number.Name = "F_Number";
+ this.F_Number.Width = 130;
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Font = new System.Drawing.Font("宋体", 15F);
+ this.label3.Location = new System.Drawing.Point(115, 96);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(89, 20);
+ this.label3.TabIndex = 9;
+ this.label3.Text = "养殖户:";
+ //
+ // label18
+ //
+ this.label18.AutoSize = true;
this.label18.Font = new System.Drawing.Font("宋体", 15F);
this.label18.ForeColor = System.Drawing.Color.Red;
this.label18.Location = new System.Drawing.Point(-4, 96);
@@ -548,10 +783,9 @@
this.weightGrid.AllowUserToAddRows = false;
this.weightGrid.AllowUserToResizeColumns = false;
this.weightGrid.AllowUserToResizeRows = false;
- dataGridViewCellStyle19.BackColor = System.Drawing.Color.Silver;
+ dataGridViewCellStyle19.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.weightGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle19;
this.weightGrid.BackgroundColor = System.Drawing.Color.White;
- this.weightGrid.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.SingleHorizontal;
dataGridViewCellStyle20.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle20.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle20.Font = new System.Drawing.Font("宋体", 12F);
@@ -575,14 +809,73 @@
this.weightGrid.MultiSelect = false;
this.weightGrid.Name = "weightGrid";
this.weightGrid.RowHeadersVisible = false;
- dataGridViewCellStyle21.SelectionBackColor = System.Drawing.Color.DodgerBlue;
+ dataGridViewCellStyle21.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.weightGrid.RowsDefaultCellStyle = dataGridViewCellStyle21;
- this.weightGrid.RowTemplate.DefaultCellStyle.SelectionBackColor = System.Drawing.Color.Empty;
this.weightGrid.RowTemplate.Height = 23;
this.weightGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.weightGrid.Size = new System.Drawing.Size(400, 90);
this.weightGrid.TabIndex = 0;
//
+ // D_ID
+ //
+ this.D_ID.DataPropertyName = "ID";
+ this.D_ID.HeaderText = "ID";
+ this.D_ID.Name = "D_ID";
+ this.D_ID.Visible = false;
+ //
+ // D_B3ID
+ //
+ this.D_B3ID.DataPropertyName = "B3ID";
+ this.D_B3ID.HeaderText = "B3ID";
+ this.D_B3ID.Name = "D_B3ID";
+ this.D_B3ID.Visible = false;
+ //
+ // D_WeightBill_ID
+ //
+ this.D_WeightBill_ID.DataPropertyName = "WeightBill_ID";
+ this.D_WeightBill_ID.HeaderText = "WeightBill_ID";
+ this.D_WeightBill_ID.Name = "D_WeightBill_ID";
+ this.D_WeightBill_ID.Visible = false;
+ //
+ // D_Index
+ //
+ this.D_Index.DataPropertyName = "Index";
+ this.D_Index.HeaderText = "序号";
+ this.D_Index.Name = "D_Index";
+ this.D_Index.ReadOnly = true;
+ this.D_Index.Width = 55;
+ //
+ // D_Number
+ //
+ this.D_Number.DataPropertyName = "Number";
+ this.D_Number.HeaderText = "头数";
+ this.D_Number.Name = "D_Number";
+ this.D_Number.Width = 75;
+ //
+ // D_MaoWeight
+ //
+ this.D_MaoWeight.DataPropertyName = "MaoWeight";
+ this.D_MaoWeight.HeaderText = "毛重";
+ this.D_MaoWeight.Name = "D_MaoWeight";
+ this.D_MaoWeight.ReadOnly = true;
+ this.D_MaoWeight.Width = 88;
+ //
+ // D_PiWeight
+ //
+ this.D_PiWeight.DataPropertyName = "PiWeight";
+ this.D_PiWeight.HeaderText = "皮重";
+ this.D_PiWeight.Name = "D_PiWeight";
+ this.D_PiWeight.ReadOnly = true;
+ this.D_PiWeight.Width = 88;
+ //
+ // D_Weight
+ //
+ this.D_Weight.DataPropertyName = "Weight";
+ this.D_Weight.HeaderText = "重量";
+ this.D_Weight.Name = "D_Weight";
+ this.D_Weight.ReadOnly = true;
+ this.D_Weight.Width = 88;
+ //
// panel4
//
this.panel4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
@@ -598,10 +891,9 @@
this.houseGird.AllowUserToDeleteRows = false;
this.houseGird.AllowUserToResizeColumns = false;
this.houseGird.AllowUserToResizeRows = false;
- dataGridViewCellStyle22.BackColor = System.Drawing.Color.Silver;
+ dataGridViewCellStyle22.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.houseGird.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle22;
this.houseGird.BackgroundColor = System.Drawing.Color.White;
- this.houseGird.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.SingleHorizontal;
dataGridViewCellStyle23.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle23.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle23.Font = new System.Drawing.Font("宋体", 12F);
@@ -624,24 +916,73 @@
this.houseGird.MultiSelect = false;
this.houseGird.Name = "houseGird";
this.houseGird.RowHeadersVisible = false;
- dataGridViewCellStyle24.SelectionBackColor = System.Drawing.Color.DodgerBlue;
+ dataGridViewCellStyle24.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.houseGird.RowsDefaultCellStyle = dataGridViewCellStyle24;
- this.houseGird.RowTemplate.DefaultCellStyle.SelectionBackColor = System.Drawing.Color.Empty;
this.houseGird.RowTemplate.Height = 23;
this.houseGird.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.houseGird.Size = new System.Drawing.Size(400, 90);
this.houseGird.TabIndex = 1;
//
+ // H_ID
+ //
+ this.H_ID.DataPropertyName = "ID";
+ this.H_ID.HeaderText = "ID";
+ this.H_ID.Name = "H_ID";
+ this.H_ID.Visible = false;
+ //
+ // H_B3ID
+ //
+ this.H_B3ID.DataPropertyName = "B3ID";
+ this.H_B3ID.HeaderText = "B3ID";
+ this.H_B3ID.Name = "H_B3ID";
+ this.H_B3ID.Visible = false;
+ //
+ // H_WeightBill_ID
+ //
+ this.H_WeightBill_ID.DataPropertyName = "WeightBill_ID";
+ this.H_WeightBill_ID.HeaderText = "WeightBill_ID";
+ this.H_WeightBill_ID.Name = "H_WeightBill_ID";
+ this.H_WeightBill_ID.Visible = false;
+ //
+ // H_LiveColonyHouse_ID
+ //
+ this.H_LiveColonyHouse_ID.DataPropertyName = "LiveColonyHouse_ID";
+ this.H_LiveColonyHouse_ID.HeaderText = "LiveColonyHouse_ID";
+ this.H_LiveColonyHouse_ID.Name = "H_LiveColonyHouse_ID";
+ this.H_LiveColonyHouse_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 = 80;
+ //
+ // H_LiveColonyHouse_Name
+ //
+ this.H_LiveColonyHouse_Name.DataPropertyName = "LiveColonyHouse_Name";
+ this.H_LiveColonyHouse_Name.HeaderText = "圈舍";
+ this.H_LiveColonyHouse_Name.Name = "H_LiveColonyHouse_Name";
+ this.H_LiveColonyHouse_Name.ReadOnly = true;
+ this.H_LiveColonyHouse_Name.Width = 150;
+ //
+ // H_Number
+ //
+ this.H_Number.DataPropertyName = "Number";
+ this.H_Number.HeaderText = "入圈头数";
+ this.H_Number.Name = "H_Number";
+ this.H_Number.Width = 130;
+ //
// abnormalGrid
//
this.abnormalGrid.AllowUserToAddRows = false;
this.abnormalGrid.AllowUserToDeleteRows = false;
this.abnormalGrid.AllowUserToResizeColumns = false;
this.abnormalGrid.AllowUserToResizeRows = false;
- dataGridViewCellStyle25.BackColor = System.Drawing.Color.Silver;
+ dataGridViewCellStyle25.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.abnormalGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle25;
this.abnormalGrid.BackgroundColor = System.Drawing.Color.White;
- this.abnormalGrid.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.SingleHorizontal;
dataGridViewCellStyle26.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle26.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle26.Font = new System.Drawing.Font("宋体", 12F);
@@ -665,23 +1006,79 @@
this.abnormalGrid.MultiSelect = false;
this.abnormalGrid.Name = "abnormalGrid";
this.abnormalGrid.RowHeadersVisible = false;
- dataGridViewCellStyle27.SelectionBackColor = System.Drawing.Color.DodgerBlue;
+ dataGridViewCellStyle27.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.abnormalGrid.RowsDefaultCellStyle = dataGridViewCellStyle27;
this.abnormalGrid.RowTemplate.Height = 23;
this.abnormalGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.abnormalGrid.Size = new System.Drawing.Size(400, 237);
this.abnormalGrid.TabIndex = 1;
//
+ // S_ID
+ //
+ this.S_ID.DataPropertyName = "ID";
+ this.S_ID.HeaderText = "ID";
+ this.S_ID.Name = "S_ID";
+ this.S_ID.Visible = false;
+ //
+ // S_B3ID
+ //
+ this.S_B3ID.DataPropertyName = "B3ID";
+ this.S_B3ID.HeaderText = "B3ID";
+ this.S_B3ID.Name = "S_B3ID";
+ this.S_B3ID.Visible = false;
+ //
+ // S_WeightBill_ID
+ //
+ this.S_WeightBill_ID.DataPropertyName = "WeightBill_ID";
+ this.S_WeightBill_ID.HeaderText = "WeightBill_ID";
+ this.S_WeightBill_ID.Name = "S_WeightBill_ID";
+ this.S_WeightBill_ID.Visible = false;
+ //
+ // S_Sanction_ID
+ //
+ this.S_Sanction_ID.DataPropertyName = "Sanction_ID";
+ this.S_Sanction_ID.HeaderText = "Sanction_ID";
+ this.S_Sanction_ID.Name = "S_Sanction_ID";
+ this.S_Sanction_ID.Visible = false;
+ //
+ // S_AbnormalItem_ID
+ //
+ this.S_AbnormalItem_ID.HeaderText = "AbnormalItem_ID";
+ this.S_AbnormalItem_ID.Name = "S_AbnormalItem_ID";
+ this.S_AbnormalItem_ID.Visible = false;
+ //
+ // S_Index
+ //
+ this.S_Index.DataPropertyName = "Index";
+ this.S_Index.HeaderText = "序号";
+ this.S_Index.Name = "S_Index";
+ this.S_Index.ReadOnly = true;
+ this.S_Index.Width = 80;
+ //
+ // S_AbnormalItem_Name
+ //
+ this.S_AbnormalItem_Name.DataPropertyName = "AbnormalItem_Name";
+ this.S_AbnormalItem_Name.HeaderText = "异常项目";
+ this.S_AbnormalItem_Name.Name = "S_AbnormalItem_Name";
+ this.S_AbnormalItem_Name.ReadOnly = true;
+ this.S_AbnormalItem_Name.Width = 150;
+ //
+ // S_Number
+ //
+ this.S_Number.DataPropertyName = "Number";
+ this.S_Number.HeaderText = "头数";
+ this.S_Number.Name = "S_Number";
+ this.S_Number.Width = 130;
+ //
// billGrid
//
this.billGrid.AllowUserToAddRows = false;
this.billGrid.AllowUserToDeleteRows = false;
this.billGrid.AllowUserToResizeColumns = false;
this.billGrid.AllowUserToResizeRows = false;
- dataGridViewCellStyle28.BackColor = System.Drawing.Color.Silver;
+ dataGridViewCellStyle28.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.billGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle28;
this.billGrid.BackgroundColor = System.Drawing.Color.White;
- this.billGrid.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.SingleHorizontal;
dataGridViewCellStyle29.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle29.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle29.Font = new System.Drawing.Font("宋体", 12F);
@@ -708,168 +1105,23 @@
this.billGrid.Name = "billGrid";
this.billGrid.ReadOnly = true;
this.billGrid.RowHeadersVisible = false;
- dataGridViewCellStyle30.SelectionBackColor = System.Drawing.Color.DodgerBlue;
+ dataGridViewCellStyle30.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.billGrid.RowsDefaultCellStyle = dataGridViewCellStyle30;
- this.billGrid.RowTemplate.DefaultCellStyle.SelectionBackColor = System.Drawing.Color.Empty;
this.billGrid.RowTemplate.Height = 23;
this.billGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.billGrid.Size = new System.Drawing.Size(1250, 281);
this.billGrid.TabIndex = 0;
this.billGrid.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.billGrid_CellDoubleClick);
//
- // label15
- //
- this.label15.AutoSize = true;
- this.label15.Font = new System.Drawing.Font("宋体", 15F);
- this.label15.ForeColor = System.Drawing.Color.Red;
- this.label15.Location = new System.Drawing.Point(9, 297);
- this.label15.Name = "label15";
- this.label15.Size = new System.Drawing.Size(89, 20);
- this.label15.TabIndex = 6;
- this.label15.Text = "过磅记录";
+ // M_ID
//
- // label16
+ this.M_ID.DataPropertyName = "ID";
+ this.M_ID.HeaderText = "ID";
+ this.M_ID.Name = "M_ID";
+ this.M_ID.ReadOnly = true;
+ this.M_ID.Visible = false;
//
- this.label16.AutoSize = true;
- this.label16.Font = new System.Drawing.Font("宋体", 15F);
- this.label16.ForeColor = System.Drawing.Color.Red;
- this.label16.Location = new System.Drawing.Point(434, 297);
- this.label16.Name = "label16";
- this.label16.Size = new System.Drawing.Size(89, 20);
- this.label16.TabIndex = 7;
- this.label16.Text = "入圈信息";
- //
- // label17
- //
- this.label17.AutoSize = true;
- this.label17.Font = new System.Drawing.Font("宋体", 15F);
- this.label17.ForeColor = System.Drawing.Color.Red;
- this.label17.Location = new System.Drawing.Point(858, 297);
- this.label17.Name = "label17";
- this.label17.Size = new System.Drawing.Size(89, 20);
- this.label17.TabIndex = 8;
- this.label17.Text = "异常明细";
- //
- // F_ID
- //
- this.F_ID.DataPropertyName = "ID";
- this.F_ID.HeaderText = "ID";
- this.F_ID.Name = "F_ID";
- this.F_ID.Visible = false;
- //
- // F_B3ID
- //
- this.F_B3ID.DataPropertyName = "B3ID";
- this.F_B3ID.HeaderText = "B3ID";
- this.F_B3ID.Name = "F_B3ID";
- this.F_B3ID.Visible = false;
- //
- // F_WeightBill_ID
- //
- this.F_WeightBill_ID.DataPropertyName = "WeightBill_ID";
- this.F_WeightBill_ID.HeaderText = "WeightBill_ID";
- this.F_WeightBill_ID.Name = "F_WeightBill_ID";
- this.F_WeightBill_ID.Visible = false;
- //
- // F_Farmer_ID
- //
- this.F_Farmer_ID.DataPropertyName = "Farmer_ID";
- this.F_Farmer_ID.HeaderText = "Farmer_ID";
- this.F_Farmer_ID.Name = "F_Farmer_ID";
- this.F_Farmer_ID.Visible = false;
- //
- // F_Index
- //
- this.F_Index.DataPropertyName = "Index";
- this.F_Index.HeaderText = "序号";
- this.F_Index.Name = "F_Index";
- this.F_Index.ReadOnly = true;
- this.F_Index.Width = 80;
- //
- // F_Farmer_Name
- //
- this.F_Farmer_Name.DataPropertyName = "Farmer_Name";
- this.F_Farmer_Name.HeaderText = "养殖户";
- this.F_Farmer_Name.Name = "F_Farmer_Name";
- this.F_Farmer_Name.ReadOnly = true;
- this.F_Farmer_Name.Width = 150;
- //
- // F_Number
- //
- this.F_Number.DataPropertyName = "Number";
- this.F_Number.HeaderText = "头数";
- this.F_Number.Name = "F_Number";
- this.F_Number.Width = 130;
- //
- // D_ID
- //
- this.D_ID.DataPropertyName = "ID";
- this.D_ID.HeaderText = "ID";
- this.D_ID.Name = "D_ID";
- this.D_ID.Visible = false;
- //
- // D_B3ID
- //
- this.D_B3ID.DataPropertyName = "B3ID";
- this.D_B3ID.HeaderText = "B3ID";
- this.D_B3ID.Name = "D_B3ID";
- this.D_B3ID.Visible = false;
- //
- // D_WeightBill_ID
- //
- this.D_WeightBill_ID.DataPropertyName = "WeightBill_ID";
- this.D_WeightBill_ID.HeaderText = "WeightBill_ID";
- this.D_WeightBill_ID.Name = "D_WeightBill_ID";
- this.D_WeightBill_ID.Visible = false;
- //
- // D_Index
- //
- this.D_Index.DataPropertyName = "Index";
- this.D_Index.HeaderText = "序号";
- this.D_Index.Name = "D_Index";
- this.D_Index.ReadOnly = true;
- this.D_Index.Width = 55;
- //
- // D_Number
- //
- this.D_Number.DataPropertyName = "Number";
- this.D_Number.HeaderText = "头数";
- this.D_Number.Name = "D_Number";
- this.D_Number.Width = 75;
- //
- // D_MaoWeight
- //
- this.D_MaoWeight.DataPropertyName = "MaoWeight";
- this.D_MaoWeight.HeaderText = "毛重";
- this.D_MaoWeight.Name = "D_MaoWeight";
- this.D_MaoWeight.ReadOnly = true;
- this.D_MaoWeight.Width = 88;
- //
- // D_PiWeight
- //
- this.D_PiWeight.DataPropertyName = "PiWeight";
- this.D_PiWeight.HeaderText = "皮重";
- this.D_PiWeight.Name = "D_PiWeight";
- this.D_PiWeight.ReadOnly = true;
- this.D_PiWeight.Width = 88;
- //
- // D_Weight
- //
- this.D_Weight.DataPropertyName = "Weight";
- this.D_Weight.HeaderText = "重量";
- this.D_Weight.Name = "D_Weight";
- this.D_Weight.ReadOnly = true;
- this.D_Weight.Width = 88;
- //
- // M_ID
- //
- this.M_ID.DataPropertyName = "ID";
- this.M_ID.HeaderText = "ID";
- this.M_ID.Name = "M_ID";
- this.M_ID.ReadOnly = true;
- this.M_ID.Visible = false;
- //
- // M_B3ID
+ // M_B3ID
//
this.M_B3ID.DataPropertyName = "B3ID";
this.M_B3ID.HeaderText = "过磅单号";
@@ -941,295 +1193,38 @@
this.M_SanctionNumber.ReadOnly = true;
this.M_SanctionNumber.Width = 130;
//
- // H_ID
- //
- this.H_ID.DataPropertyName = "ID";
- this.H_ID.HeaderText = "ID";
- this.H_ID.Name = "H_ID";
- this.H_ID.Visible = false;
- //
- // H_B3ID
- //
- this.H_B3ID.DataPropertyName = "B3ID";
- this.H_B3ID.HeaderText = "B3ID";
- this.H_B3ID.Name = "H_B3ID";
- this.H_B3ID.Visible = false;
- //
- // H_WeightBill_ID
- //
- this.H_WeightBill_ID.DataPropertyName = "WeightBill_ID";
- this.H_WeightBill_ID.HeaderText = "WeightBill_ID";
- this.H_WeightBill_ID.Name = "H_WeightBill_ID";
- this.H_WeightBill_ID.Visible = false;
- //
- // H_LiveColonyHouse_ID
- //
- this.H_LiveColonyHouse_ID.DataPropertyName = "LiveColonyHouse_ID";
- this.H_LiveColonyHouse_ID.HeaderText = "LiveColonyHouse_ID";
- this.H_LiveColonyHouse_ID.Name = "H_LiveColonyHouse_ID";
- this.H_LiveColonyHouse_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 = 80;
- //
- // H_LiveColonyHouse_Name
- //
- this.H_LiveColonyHouse_Name.DataPropertyName = "LiveColonyHouse_Name";
- this.H_LiveColonyHouse_Name.HeaderText = "圈舍";
- this.H_LiveColonyHouse_Name.Name = "H_LiveColonyHouse_Name";
- this.H_LiveColonyHouse_Name.ReadOnly = true;
- this.H_LiveColonyHouse_Name.Width = 150;
- //
- // H_Number
- //
- this.H_Number.DataPropertyName = "Number";
- this.H_Number.HeaderText = "入圈头数";
- this.H_Number.Name = "H_Number";
- this.H_Number.Width = 130;
- //
- // S_ID
- //
- this.S_ID.DataPropertyName = "ID";
- this.S_ID.HeaderText = "ID";
- this.S_ID.Name = "S_ID";
- this.S_ID.Visible = false;
- //
- // S_B3ID
- //
- this.S_B3ID.DataPropertyName = "B3ID";
- this.S_B3ID.HeaderText = "B3ID";
- this.S_B3ID.Name = "S_B3ID";
- this.S_B3ID.Visible = false;
- //
- // S_WeightBill_ID
- //
- this.S_WeightBill_ID.DataPropertyName = "WeightBill_ID";
- this.S_WeightBill_ID.HeaderText = "WeightBill_ID";
- this.S_WeightBill_ID.Name = "S_WeightBill_ID";
- this.S_WeightBill_ID.Visible = false;
- //
- // S_Sanction_ID
- //
- this.S_Sanction_ID.DataPropertyName = "Sanction_ID";
- this.S_Sanction_ID.HeaderText = "Sanction_ID";
- this.S_Sanction_ID.Name = "S_Sanction_ID";
- this.S_Sanction_ID.Visible = false;
- //
- // S_AbnormalItem_ID
- //
- this.S_AbnormalItem_ID.HeaderText = "AbnormalItem_ID";
- this.S_AbnormalItem_ID.Name = "S_AbnormalItem_ID";
- this.S_AbnormalItem_ID.Visible = false;
- //
- // S_Index
- //
- this.S_Index.DataPropertyName = "Index";
- this.S_Index.HeaderText = "序号";
- this.S_Index.Name = "S_Index";
- this.S_Index.ReadOnly = true;
- this.S_Index.Width = 80;
- //
- // S_AbnormalItem_Name
- //
- this.S_AbnormalItem_Name.DataPropertyName = "AbnormalItem_Name";
- this.S_AbnormalItem_Name.HeaderText = "异常项目";
- this.S_AbnormalItem_Name.Name = "S_AbnormalItem_Name";
- this.S_AbnormalItem_Name.ReadOnly = true;
- this.S_AbnormalItem_Name.Width = 150;
- //
- // S_Number
- //
- this.S_Number.DataPropertyName = "Number";
- this.S_Number.HeaderText = "头数";
- this.S_Number.Name = "S_Number";
- this.S_Number.Width = 130;
- //
- // createBtn
- //
- this.createBtn.Font = new System.Drawing.Font("宋体", 15F);
- this.createBtn.Location = new System.Drawing.Point(402, 0);
- this.createBtn.Name = "createBtn";
- this.createBtn.Size = new System.Drawing.Size(101, 59);
- this.createBtn.TabIndex = 3;
- this.createBtn.Text = "新建";
- this.createBtn.UseVisualStyleBackColor = true;
- this.createBtn.Click += new System.EventHandler(this.createBtn_Click);
- //
- // farmerSelect
- //
- this.farmerSelect.CodeArgs = null;
- this.farmerSelect.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
- this.farmerSelect.EnableTopItem = true;
- this.farmerSelect.Font = new System.Drawing.Font("宋体", 12F);
- this.farmerSelect.FormattingEnabled = true;
- this.farmerSelect.Location = new System.Drawing.Point(190, 93);
- this.farmerSelect.Name = "farmerSelect";
- this.farmerSelect.Range = 10;
- this.farmerSelect.Size = new System.Drawing.Size(135, 27);
- this.farmerSelect.TabIndex = 38;
- this.farmerSelect.SelectedIndexChanged += new System.EventHandler(this.farmerSelect_SelectedIndexChanged);
- //
- // zoneSelect
- //
- this.zoneSelect.CodeArgs = null;
- this.zoneSelect.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
- this.zoneSelect.EnableTopItem = true;
- this.zoneSelect.Font = new System.Drawing.Font("宋体", 14F);
- this.zoneSelect.FormattingEnabled = true;
- this.zoneSelect.Location = new System.Drawing.Point(348, 129);
- this.zoneSelect.Name = "zoneSelect";
- this.zoneSelect.Range = 10;
- this.zoneSelect.Size = new System.Drawing.Size(135, 30);
- this.zoneSelect.TabIndex = 37;
- //
- // hogGradeSelect
- //
- this.hogGradeSelect.CodeArgs = null;
- this.hogGradeSelect.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
- this.hogGradeSelect.EnableTopItem = true;
- this.hogGradeSelect.Font = new System.Drawing.Font("宋体", 14F);
- this.hogGradeSelect.FormattingEnabled = true;
- this.hogGradeSelect.Location = new System.Drawing.Point(103, 129);
- this.hogGradeSelect.Name = "hogGradeSelect";
- this.hogGradeSelect.Range = 10;
- this.hogGradeSelect.Size = new System.Drawing.Size(135, 30);
- this.hogGradeSelect.TabIndex = 36;
- //
- // employeeSelect
- //
- this.employeeSelect.CodeArgs = null;
- this.employeeSelect.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
- this.employeeSelect.EnableTopItem = true;
- this.employeeSelect.Font = new System.Drawing.Font("宋体", 14F);
- this.employeeSelect.FormattingEnabled = true;
- this.employeeSelect.Location = new System.Drawing.Point(348, 88);
- this.employeeSelect.Name = "employeeSelect";
- this.employeeSelect.Range = 10;
- this.employeeSelect.Size = new System.Drawing.Size(135, 30);
- this.employeeSelect.TabIndex = 33;
- //
- // carSelect
- //
- this.carSelect.CodeArgs = null;
- this.carSelect.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
- this.carSelect.EnableTopItem = true;
- this.carSelect.Font = new System.Drawing.Font("宋体", 14F);
- this.carSelect.FormattingEnabled = true;
- this.carSelect.Location = new System.Drawing.Point(348, 49);
- this.carSelect.Name = "carSelect";
- this.carSelect.Range = 10;
- this.carSelect.Size = new System.Drawing.Size(135, 30);
- this.carSelect.TabIndex = 32;
- //
- // liveVarietiesSelect
- //
- this.liveVarietiesSelect.CodeArgs = null;
- this.liveVarietiesSelect.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
- this.liveVarietiesSelect.EnableTopItem = true;
- this.liveVarietiesSelect.Font = new System.Drawing.Font("宋体", 14F);
- this.liveVarietiesSelect.FormattingEnabled = true;
- this.liveVarietiesSelect.Location = new System.Drawing.Point(103, 88);
- this.liveVarietiesSelect.Name = "liveVarietiesSelect";
- this.liveVarietiesSelect.Range = 10;
- this.liveVarietiesSelect.Size = new System.Drawing.Size(135, 30);
- this.liveVarietiesSelect.TabIndex = 31;
- //
- // purchaseTypeSelect
- //
- this.purchaseTypeSelect.CodeArgs = null;
- this.purchaseTypeSelect.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
- this.purchaseTypeSelect.EnableTopItem = true;
- this.purchaseTypeSelect.Font = new System.Drawing.Font("宋体", 14F);
- this.purchaseTypeSelect.FormattingEnabled = true;
- this.purchaseTypeSelect.Location = new System.Drawing.Point(348, 8);
- this.purchaseTypeSelect.Name = "purchaseTypeSelect";
- this.purchaseTypeSelect.Range = 10;
- this.purchaseTypeSelect.Size = new System.Drawing.Size(135, 30);
- this.purchaseTypeSelect.TabIndex = 30;
- //
- // supplierSelect
- //
- this.supplierSelect.CodeArgs = null;
- this.supplierSelect.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
- this.supplierSelect.EnableTopItem = true;
- this.supplierSelect.Font = new System.Drawing.Font("宋体", 14F);
- this.supplierSelect.FormattingEnabled = true;
- this.supplierSelect.Location = new System.Drawing.Point(103, 8);
- this.supplierSelect.Name = "supplierSelect";
- this.supplierSelect.Range = 10;
- this.supplierSelect.Size = new System.Drawing.Size(135, 30);
- this.supplierSelect.TabIndex = 29;
- //
- // testTimeInput
- //
- this.testTimeInput.BackColor = System.Drawing.Color.White;
- this.testTimeInput.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.testTimeInput.Date = new System.DateTime(2017, 9, 7, 0, 0, 0, 0);
- this.testTimeInput.Font = new System.Drawing.Font("宋体", 15F);
- this.testTimeInput.Location = new System.Drawing.Point(1100, 51);
- this.testTimeInput.Name = "testTimeInput";
- this.testTimeInput.Size = new System.Drawing.Size(135, 30);
- this.testTimeInput.TabIndex = 27;
- this.testTimeInput.Text = "2017/09/07";
- this.testTimeInput.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.testTimeInput.Type = BWP.WinFormControl.DateTimeType.Date;
- //
- // weightTimeSelect
- //
- this.weightTimeSelect.BackColor = System.Drawing.Color.White;
- this.weightTimeSelect.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
- this.weightTimeSelect.Date = new System.DateTime(2017, 9, 7, 19, 7, 31, 0);
- this.weightTimeSelect.Font = new System.Drawing.Font("宋体", 9F);
- this.weightTimeSelect.Location = new System.Drawing.Point(103, 49);
- this.weightTimeSelect.Name = "weightTimeSelect";
- this.weightTimeSelect.Size = new System.Drawing.Size(135, 30);
- this.weightTimeSelect.TabIndex = 26;
- this.weightTimeSelect.Text = "2017/09/07 19:07:31";
- this.weightTimeSelect.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.weightTimeSelect.Type = BWP.WinFormControl.DateTimeType.DateTime;
- //
- // weightControl
- //
- this.weightControl.Location = new System.Drawing.Point(0, 0);
- this.weightControl.Margin = new System.Windows.Forms.Padding(5);
- this.weightControl.Name = "weightControl";
- this.weightControl.Size = new System.Drawing.Size(155, 94);
- this.weightControl.TabIndex = 0;
- //
- // exitBtn
+ // label15
//
- this.exitBtn.Font = new System.Drawing.Font("宋体", 15F);
- this.exitBtn.Location = new System.Drawing.Point(871, 0);
- this.exitBtn.Name = "exitBtn";
- this.exitBtn.Size = new System.Drawing.Size(101, 59);
- this.exitBtn.TabIndex = 4;
- this.exitBtn.Text = "退出";
- this.exitBtn.UseVisualStyleBackColor = true;
+ this.label15.AutoSize = true;
+ this.label15.Font = new System.Drawing.Font("宋体", 15F);
+ this.label15.ForeColor = System.Drawing.Color.Red;
+ this.label15.Location = new System.Drawing.Point(9, 297);
+ this.label15.Name = "label15";
+ this.label15.Size = new System.Drawing.Size(89, 20);
+ this.label15.TabIndex = 6;
+ this.label15.Text = "过磅记录";
//
- // deleteBtn
+ // label16
//
- this.deleteBtn.Font = new System.Drawing.Font("宋体", 15F);
- this.deleteBtn.Location = new System.Drawing.Point(753, 0);
- this.deleteBtn.Name = "deleteBtn";
- this.deleteBtn.Size = new System.Drawing.Size(101, 59);
- this.deleteBtn.TabIndex = 5;
- this.deleteBtn.Text = "删除";
- this.deleteBtn.UseVisualStyleBackColor = true;
+ this.label16.AutoSize = true;
+ this.label16.Font = new System.Drawing.Font("宋体", 15F);
+ this.label16.ForeColor = System.Drawing.Color.Red;
+ this.label16.Location = new System.Drawing.Point(434, 297);
+ this.label16.Name = "label16";
+ this.label16.Size = new System.Drawing.Size(89, 20);
+ this.label16.TabIndex = 7;
+ this.label16.Text = "入圈信息";
//
- // printBtn
+ // label17
//
- this.printBtn.Font = new System.Drawing.Font("宋体", 15F);
- this.printBtn.Location = new System.Drawing.Point(636, 0);
- this.printBtn.Name = "printBtn";
- this.printBtn.Size = new System.Drawing.Size(101, 59);
- this.printBtn.TabIndex = 8;
- this.printBtn.Text = "打印";
- this.printBtn.UseVisualStyleBackColor = true;
+ this.label17.AutoSize = true;
+ this.label17.Font = new System.Drawing.Font("宋体", 15F);
+ this.label17.ForeColor = System.Drawing.Color.Red;
+ this.label17.Location = new System.Drawing.Point(858, 297);
+ this.label17.Name = "label17";
+ this.label17.Size = new System.Drawing.Size(89, 20);
+ this.label17.TabIndex = 8;
+ this.label17.Text = "异常明细";
//
// WeightForm
//
@@ -1268,7 +1263,6 @@
#endregion
- private BWP.WinFormControl.WeightControl weightControl;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button commitBtn;
private System.Windows.Forms.Button readPiBtn;
@@ -1363,5 +1357,6 @@
private System.Windows.Forms.Button exitBtn;
private System.Windows.Forms.Button deleteBtn;
private System.Windows.Forms.Button printBtn;
+ private BWP.WinFormControl.WeightControl weightControl;
}
}
\ No newline at end of file
diff --git a/ButcherWeight/WeightForm.cs b/ButcherWeight/WeightForm.cs
index 503f4bb..35ab4f0 100644
--- a/ButcherWeight/WeightForm.cs
+++ b/ButcherWeight/WeightForm.cs
@@ -2,6 +2,7 @@
using BO.Utils;
using BO.Utils.BillRpc;
using ButcherManageClient;
+using BWP.WinFormControl;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -41,13 +42,19 @@ namespace ButcherWeight
farmerSelect.Init("BaseInfoRpc/GetFarmerList");
farmerSelect.EnableTopItem = false;
weightTimeSelect.Date = DateTime.Now;
- testTimeInput.Date = DateTime.Now;
+ testTimeInput.Date = null;
dmoList = WeightBillRpc.GetWeightBillList();
billGrid.AutoGenerateColumns = false;
farmerGrid.AutoGenerateColumns = false;
weightGrid.AutoGenerateColumns = false;
houseGird.AutoGenerateColumns = false;
abnormalGrid.AutoGenerateColumns = false;
+ weightControl.EnableCheckBox.CheckedChanged += delegate
+ {
+ readMaoBtn.Enabled = readPiBtn.Enabled = weightControl.EnableCheckBox.Checked;
+ };
+ weightControl.InitSerialPort("COM2", 9600, 8);
+ weightControl.TypeOfWeight = WeightType.Xk3190A9;
BindWeightBill();
}
@@ -65,11 +72,17 @@ namespace ButcherWeight
private void exitBtn_Click(object sender, EventArgs e)
{
+ if (weightControl.EnableCheckBox.Checked)
+ weightControl.EnableCheckBox.Checked = false;
this.Close();
}
private void commitBtn_Click(object sender, EventArgs e)
{
+ if (!_details.Any())
+ throw new Exception("没有称重记录");
+ if (!_farmerDetails.Any())
+ throw new Exception("没有养殖户信息");
GetFromUI();
Dmo.Details.Clear();
Dmo.Details.AddRange(_details.ToList());
@@ -95,12 +108,30 @@ namespace ButcherWeight
private void readMaoBtn_Click(object sender, EventArgs e)
{
-
+ var d = new WeightBill_Detail();
+ _details.Add(d);
+ d.Index = _details.Max(x => x.Index) + 1;
+ d.WeightBill_ID = Dmo.ID;
+ d.MaoWeight = weightControl.Value;
+ d.Weight = d.MaoWeight;
+ weightGrid.DataSource = null;
+ weightGrid.DataSource = _details;
+ weightGrid.Refresh();
+ weightControl.Clear();
}
private void readPiBtn_Click(object sender, EventArgs e)
{
-
+ if (weightGrid.SelectedRows.Count == 0)
+ {
+ MessageBox.Show("请选中过磅记录");
+ return;
+ }
+ var target = weightGrid.CurrentRow.DataBoundItem as WeightBill_Detail;
+ target.PiWeight = weightControl.Value;
+ target.Weight = target.MaoWeight - target.PiWeight;
+ weightGrid.Refresh();
+ weightControl.Clear();
}
private void farmerSelect_SelectedIndexChanged(object sender, EventArgs e)