diff --git a/B3ButcherWeightClient/B3ButcherWeightClient.csproj b/B3ButcherWeightClient/B3ButcherWeightClient.csproj index 6efab63..d1e22de 100644 --- a/B3ButcherWeightClient/B3ButcherWeightClient.csproj +++ b/B3ButcherWeightClient/B3ButcherWeightClient.csproj @@ -41,6 +41,14 @@ False ..\..\..\tsref\Debug\Forks.EnterpriseServices.dll + + False + ..\..\..\tsref\Debug\forks.json.dll + + + False + ..\..\..\tsref\Debug\Forks.JsonRpc.Client.dll + @@ -48,6 +56,8 @@ + + @@ -64,6 +74,13 @@ ChangeLevelForm.cs + + Form + + + Parameters.cs + + @@ -119,6 +136,9 @@ Login.cs + + Parameters.cs + ResXFileCodeGenerator Resources.Designer.cs diff --git a/B3ButcherWeightClient/ConfigUtil.cs b/B3ButcherWeightClient/ConfigUtil.cs index 3b88c38..f3fbd6b 100644 --- a/B3ButcherWeightClient/ConfigUtil.cs +++ b/B3ButcherWeightClient/ConfigUtil.cs @@ -8,6 +8,7 @@ using Forks.Utils.IO; namespace B3ButcherWeightClient { public class ConfigUtil { public static string ConfigFilePath = Application.StartupPath + "\\Config.txt"; + public static string ParametersPath = Application.StartupPath + "\\Parameters.txt"; public static string LivestockFilePath = Application.StartupPath + "\\Livestock.txt"; public static void Init() { @@ -72,8 +73,44 @@ namespace B3ButcherWeightClient { MinWeight = nutFile.AsDecimal(ConfigItem.MinWeight, 25m); MaxWeight = nutFile.AsDecimal(ConfigItem.MaxWeight, 300m); AllowChangeLevel = nutFile.AsBool(ConfigItem.AllowChangeLevel, false); - SubWeight = nutFile.AsDecimal(ConfigItem.SubWeight, 0m); -PerDayStartHour = nutFile.AsInt32(ConfigItem.PerDayStartHour, 0); + SubWeight = nutFile.AsDecimal(ConfigItem.SubWeight, 0m); + PerDayStartHour = nutFile.AsInt32(ConfigItem.PerDayStartHour, 0); + Url = nutFile.AsString(ConfigItem.Url, ""); + } + + using (TextReader reader = FS.OpenReader(ParametersPath, true)) { + var nutFile = NutFile.Parse(reader); + var str = nutFile.AsString(ConfigItem.AccID, ""); + if (string.IsNullOrEmpty(str)) { + AccID = 0; + } else { + long.TryParse(str, out AccID); + } + str = nutFile.AsString(ConfigItem.DeptID, ""); + if (string.IsNullOrEmpty(str)) { + DeptID = 0; + } else { + long.TryParse(str, out DeptID); + } + str = nutFile.AsString(ConfigItem.StoreID, ""); + if (string.IsNullOrEmpty(str)) { + StoreID = 0; + } else { + long.TryParse(str, out StoreID); + } + str = nutFile.AsString(ConfigItem.TouruID, ""); + if (string.IsNullOrEmpty(str)) { + TouruID = 0; + } else { + long.TryParse(str, out TouruID); + } + str = nutFile.AsString(ConfigItem.ShengchanID, ""); + if (string.IsNullOrEmpty(str)) { + ShengchanID = 0; + } else { + long.TryParse(str, out ShengchanID); + } + } } @@ -116,8 +153,17 @@ PerDayStartHour = nutFile.AsInt32(ConfigItem.PerDayStartHour, 0); public static int StartTime; public static string CType; public static bool AllowChangeLevel; - public static decimal SubWeight; - public static int PerDayStartHour; } + public static decimal SubWeight; + public static int PerDayStartHour; + public static string Url; + + public static long AccID; + public static long DeptID; + public static long StoreID; + public static long TouruID; + public static long ShengchanID; + + } public class ConfigItem { public const string CType = "CType"; @@ -146,6 +192,14 @@ PerDayStartHour = nutFile.AsInt32(ConfigItem.PerDayStartHour, 0); public const string ReadType = "ReadType"; public const string LastUser = "LastUser"; public const string AllowChangeLevel = "AllowChangeLevel"; -public const string SubWeight = "SubWeight"; -public const string PerDayStartHour = "PerDayStartHour"; } + public const string SubWeight = "SubWeight"; + public const string PerDayStartHour = "PerDayStartHour"; + public const string Url = "Url"; + + public const string AccID = "AccID"; + public const string DeptID = "DeptID"; + public const string StoreID = "StoreID"; + public const string TouruID = "TouruID"; + public const string ShengchanID = "ShengchanID"; + } } diff --git a/B3ButcherWeightClient/Data/IND560DataFormat.cs b/B3ButcherWeightClient/Data/IND560DataFormat.cs index 36fb485..74f289c 100644 --- a/B3ButcherWeightClient/Data/IND560DataFormat.cs +++ b/B3ButcherWeightClient/Data/IND560DataFormat.cs @@ -1,3 +1,4 @@ +using System.Globalization; using System.Text; namespace B3ButcherWeightClient.Data @@ -29,7 +30,10 @@ namespace B3ButcherWeightClient.Data isStatic = true; weight = buf.Replace("kg", "").Replace((char)0x0D, (char)0x20).Replace((char)0x0A, (char)0x20); weight = weight.Trim(); - return true; + decimal w; + if (decimal.TryParse(weight, out w)) + return true; + return false; } public override bool ParseAscii(string buf, out string weight, out bool isStatic, out string subStr) { diff --git a/B3ButcherWeightClient/EncodeString.cs b/B3ButcherWeightClient/EncodeString.cs index 6621d95..8fadbb6 100644 --- a/B3ButcherWeightClient/EncodeString.cs +++ b/B3ButcherWeightClient/EncodeString.cs @@ -43,6 +43,8 @@ namespace B3ButcherWeightClient { return new string(ch); } + public static string UserName = ""; + public static string Password = ""; public static readonly object RwLocker = new object(); } } \ No newline at end of file diff --git a/B3ButcherWeightClient/Login.cs b/B3ButcherWeightClient/Login.cs index 2a5303d..e5910fd 100644 --- a/B3ButcherWeightClient/Login.cs +++ b/B3ButcherWeightClient/Login.cs @@ -2,6 +2,7 @@ using System.Data; using System.IO; using System.Windows.Forms; +using Forks.JsonRpc.Client; using Forks.Utils.Data; using Forks.Utils.IO; @@ -9,7 +10,7 @@ namespace B3ButcherWeightClient { public partial class Login : Form { public Login() { InitializeComponent(); - using (TextReader reader = FS.OpenReader(ConfigUtil.ConfigFilePath,true)) { + using (TextReader reader = FS.OpenReader(ConfigUtil.ConfigFilePath, true)) { NutFile nutFile = NutFile.Parse(reader); txtBUser.Text = nutFile.AsString(ConfigItem.LastUser, "system"); } @@ -21,34 +22,30 @@ namespace B3ButcherWeightClient { private void btnLogin_Click(object sender, EventArgs e) { ConfigUtil.Init(); + if (!RpcUtil.IsInited) { + RpcFacade.Init(ConfigUtil.Url, "B3WuFengClient"); + RpcUtil.IsInited = true; + } + string loginUser = txtBUser.Text.Trim(); string passWord = txtBPassword.Text.Trim(); - long userID = 0; - string role = ""; - - if (!CheckUser(loginUser)) { - MessageBox.Show("用户名不存在!"); - txtBUser.Text = ""; - txtBPassword.Text = ""; - txtBUser.Focus(); - } else { - if (CheckPassword(loginUser, passWord, out userID, out role)) { - Form main = new Main(this); - Hide(); - using (var reader = FS.OpenReader(ConfigUtil.ConfigFilePath)) { - var nutFile = NutFile.Parse(reader); - nutFile.SetValue(ConfigItem.LastUser, loginUser); - using (var writer = FS.OpenWriter(ConfigUtil.ConfigFilePath)) { - nutFile.Write(writer); - } - } - main.Show(); - } else { - MessageBox.Show("密码错误!"); - txtBPassword.Text = ""; - txtBPassword.Focus(); + string errorInfo; + var success = RpcUtil.Login(loginUser, passWord, out errorInfo); + if (!success) + if (!string.IsNullOrEmpty(errorInfo) && errorInfo != "无法连接到远程服务器") { + MessageBox.Show(errorInfo); + return; + } + Form main = new Main(this); + Hide(); + using (var reader = FS.OpenReader(ConfigUtil.ConfigFilePath)) { + var nutFile = NutFile.Parse(reader); + nutFile.SetValue(ConfigItem.LastUser, loginUser); + using (var writer = FS.OpenWriter(ConfigUtil.ConfigFilePath)) { + nutFile.Write(writer); } } + main.Show(); } private void btnSetConStr_Click(object sender, EventArgs e) { @@ -56,7 +53,6 @@ namespace B3ButcherWeightClient { setForm.ShowDialog(); } - private static bool CheckUser(string userName) { var conStr = ConfigUtil.ConnectionStr; @@ -65,7 +61,7 @@ namespace B3ButcherWeightClient { return false; } - var isExist = false; + var isExist = false; if (!string.IsNullOrEmpty(userName)) { string sql = "select PassWord from LoginUser where UserName='" + userName.Trim() + "'"; try { diff --git a/B3ButcherWeightClient/Main.Designer.cs b/B3ButcherWeightClient/Main.Designer.cs index a9e2784..037de22 100644 --- a/B3ButcherWeightClient/Main.Designer.cs +++ b/B3ButcherWeightClient/Main.Designer.cs @@ -49,6 +49,7 @@ namespace B3ButcherWeightClient { this.lblDisplay = new System.Windows.Forms.Label(); this.dataGridView = new System.Windows.Forms.DataGridView(); this.ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.DmoID = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Sequence = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.JdColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.批号 = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -59,17 +60,28 @@ namespace B3ButcherWeightClient { this.DeleteDetail = new System.Windows.Forms.DataGridViewButtonColumn(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.button1 = new System.Windows.Forms.Button(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.txtBatch = new System.Windows.Forms.TextBox(); this.pictureBox2 = new System.Windows.Forms.PictureBox(); - this.tbxSequence = new System.Windows.Forms.TextBox(); - this.subWeightTextBox = new System.Windows.Forms.TextBox(); + this.monthCalendar = new System.Windows.Forms.MonthCalendar(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.setButton = new System.Windows.Forms.Button(); + this.textBoxEndTime = new System.Windows.Forms.TextBox(); + this.button2 = new System.Windows.Forms.Button(); + this.textBoxBeginTime = new System.Windows.Forms.TextBox(); + this.label5 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); this.jdTextBox = new System.Windows.Forms.TextBox(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); - this.lblNumber = new System.Windows.Forms.Label(); + this.batchComboBox = new System.Windows.Forms.ComboBox(); this.saveButton = new System.Windows.Forms.Button(); + this.tbxSequence = new System.Windows.Forms.TextBox(); + this.lblNumber = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.numberTextBox = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.subWeightTextBox = new System.Windows.Forms.TextBox(); + this.label4 = new System.Windows.Forms.Label(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.panel1 = new System.Windows.Forms.Panel(); this._serialPort = new System.IO.Ports.SerialPort(this.components); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); @@ -77,8 +89,10 @@ namespace B3ButcherWeightClient { this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); + this.groupBox2.SuspendLayout(); + this.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // // lblDisplay @@ -88,9 +102,9 @@ namespace B3ButcherWeightClient { this.lblDisplay.BackColor = System.Drawing.Color.Black; this.lblDisplay.Font = new System.Drawing.Font("宋体", 26.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lblDisplay.ForeColor = System.Drawing.Color.LimeGreen; - this.lblDisplay.Location = new System.Drawing.Point(3, 3); + this.lblDisplay.Location = new System.Drawing.Point(3, 0); this.lblDisplay.Name = "lblDisplay"; - this.lblDisplay.Size = new System.Drawing.Size(410, 64); + this.lblDisplay.Size = new System.Drawing.Size(530, 64); this.lblDisplay.TabIndex = 3; this.lblDisplay.Text = "display"; this.lblDisplay.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -114,6 +128,7 @@ namespace B3ButcherWeightClient { this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.ID, + this.DmoID, this.Sequence, this.JdColumn, this.批号, @@ -143,6 +158,14 @@ namespace B3ButcherWeightClient { this.ID.ReadOnly = true; this.ID.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; // + // DmoID + // + this.DmoID.DataPropertyName = "DmoID"; + this.DmoID.HeaderText = "."; + this.DmoID.Name = "DmoID"; + this.DmoID.ReadOnly = true; + this.DmoID.Visible = false; + // // Sequence // this.Sequence.DataPropertyName = "Sequence"; @@ -238,22 +261,16 @@ namespace B3ButcherWeightClient { this.splitContainer1.Panel1.BackColor = System.Drawing.Color.White; this.splitContainer1.Panel1.Controls.Add(this.button1); this.splitContainer1.Panel1.Controls.Add(this.lblDisplay); + this.splitContainer1.Panel1.Controls.Add(this.pictureBox2); this.splitContainer1.Panel1.Controls.Add(this.dataGridView); // // splitContainer1.Panel2 // this.splitContainer1.Panel2.BackColor = System.Drawing.Color.White; + this.splitContainer1.Panel2.Controls.Add(this.monthCalendar); + this.splitContainer1.Panel2.Controls.Add(this.groupBox2); + this.splitContainer1.Panel2.Controls.Add(this.groupBox1); this.splitContainer1.Panel2.Controls.Add(this.pictureBox1); - this.splitContainer1.Panel2.Controls.Add(this.txtBatch); - this.splitContainer1.Panel2.Controls.Add(this.pictureBox2); - this.splitContainer1.Panel2.Controls.Add(this.tbxSequence); - this.splitContainer1.Panel2.Controls.Add(this.subWeightTextBox); - this.splitContainer1.Panel2.Controls.Add(this.jdTextBox); - this.splitContainer1.Panel2.Controls.Add(this.label2); - this.splitContainer1.Panel2.Controls.Add(this.label3); - this.splitContainer1.Panel2.Controls.Add(this.label1); - this.splitContainer1.Panel2.Controls.Add(this.lblNumber); - this.splitContainer1.Panel2.Controls.Add(this.saveButton); this.splitContainer1.Panel2.Controls.Add(this.panel1); this.splitContainer1.Size = new System.Drawing.Size(1387, 748); this.splitContainer1.SplitterDistance = 722; @@ -262,37 +279,18 @@ namespace B3ButcherWeightClient { // button1 // this.button1.Font = new System.Drawing.Font("宋体", 24F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.button1.Location = new System.Drawing.Point(520, 3); + this.button1.Location = new System.Drawing.Point(579, 3); this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(167, 58); + this.button1.Size = new System.Drawing.Size(140, 58); this.button1.TabIndex = 5; this.button1.Text = "查询"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); // - // pictureBox1 - // - this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); - this.pictureBox1.Location = new System.Drawing.Point(741, 8); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(34, 29); - this.pictureBox1.TabIndex = 18; - this.pictureBox1.TabStop = false; - this.pictureBox1.Visible = false; - this.pictureBox1.Click += new System.EventHandler(this.pictureBox2_Click); - // - // txtBatch - // - this.txtBatch.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.txtBatch.Location = new System.Drawing.Point(262, 69); - this.txtBatch.Name = "txtBatch"; - this.txtBatch.Size = new System.Drawing.Size(119, 29); - this.txtBatch.TabIndex = 11; - // // pictureBox2 // this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image"))); - this.pictureBox2.Location = new System.Drawing.Point(654, 3); + this.pictureBox2.Location = new System.Drawing.Point(539, 3); this.pictureBox2.Name = "pictureBox2"; this.pictureBox2.Size = new System.Drawing.Size(34, 29); this.pictureBox2.TabIndex = 18; @@ -300,93 +298,242 @@ namespace B3ButcherWeightClient { this.pictureBox2.Visible = false; this.pictureBox2.Click += new System.EventHandler(this.pictureBox2_Click); // + // monthCalendar + // + this.monthCalendar.Location = new System.Drawing.Point(196, 158); + this.monthCalendar.Name = "monthCalendar"; + this.monthCalendar.TabIndex = 7; + this.monthCalendar.DateChanged += new System.Windows.Forms.DateRangeEventHandler(this.monthCalendar_DateSelected); + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.setButton); + this.groupBox2.Controls.Add(this.textBoxEndTime); + this.groupBox2.Controls.Add(this.button2); + this.groupBox2.Controls.Add(this.textBoxBeginTime); + this.groupBox2.Controls.Add(this.label5); + this.groupBox2.Controls.Add(this.label6); + this.groupBox2.Location = new System.Drawing.Point(3, 105); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(655, 97); + this.groupBox2.TabIndex = 0; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "创建单据"; + // + // setButton + // + this.setButton.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.setButton.Location = new System.Drawing.Point(492, 8); + this.setButton.Name = "setButton"; + this.setButton.Size = new System.Drawing.Size(154, 37); + this.setButton.TabIndex = 19; + this.setButton.Text = "设置单据默认值"; + this.setButton.UseVisualStyleBackColor = true; + this.setButton.Click += new System.EventHandler(this.setButton_Click); + // + // textBoxEndTime + // + this.textBoxEndTime.Font = new System.Drawing.Font("宋体", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBoxEndTime.Location = new System.Drawing.Point(313, 11); + this.textBoxEndTime.MaxLength = 20; + this.textBoxEndTime.Multiline = true; + this.textBoxEndTime.Name = "textBoxEndTime"; + this.textBoxEndTime.Size = new System.Drawing.Size(165, 30); + this.textBoxEndTime.TabIndex = 13; + this.textBoxEndTime.TabStop = false; + this.textBoxEndTime.DoubleClick += new System.EventHandler(this.textBoxEndTime_DoubleClick); + // + // button2 + // + this.button2.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.button2.Location = new System.Drawing.Point(492, 51); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(154, 37); + this.button2.TabIndex = 21; + this.button2.Text = "创建白条领料单"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // textBoxBeginTime + // + this.textBoxBeginTime.Font = new System.Drawing.Font("宋体", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBoxBeginTime.Location = new System.Drawing.Point(107, 11); + this.textBoxBeginTime.MaxLength = 20; + this.textBoxBeginTime.Multiline = true; + this.textBoxBeginTime.Name = "textBoxBeginTime"; + this.textBoxBeginTime.Size = new System.Drawing.Size(165, 30); + this.textBoxBeginTime.TabIndex = 14; + this.textBoxBeginTime.TabStop = false; + this.textBoxBeginTime.DoubleClick += new System.EventHandler(this.textBoxBeginTime_DoubleClick); + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label5.Location = new System.Drawing.Point(278, 17); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(29, 20); + this.label5.TabIndex = 11; + this.label5.Text = "->"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label6.Location = new System.Drawing.Point(6, 22); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(95, 19); + this.label6.TabIndex = 12; + this.label6.Text = "记录范围:"; + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.jdTextBox); + this.groupBox1.Controls.Add(this.batchComboBox); + this.groupBox1.Controls.Add(this.saveButton); + this.groupBox1.Controls.Add(this.tbxSequence); + this.groupBox1.Controls.Add(this.lblNumber); + this.groupBox1.Controls.Add(this.label1); + this.groupBox1.Controls.Add(this.label3); + this.groupBox1.Controls.Add(this.numberTextBox); + this.groupBox1.Controls.Add(this.label2); + this.groupBox1.Controls.Add(this.subWeightTextBox); + this.groupBox1.Controls.Add(this.label4); + this.groupBox1.Location = new System.Drawing.Point(3, 6); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(655, 93); + this.groupBox1.TabIndex = 0; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "称重"; + // + // jdTextBox + // + this.jdTextBox.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.jdTextBox.Location = new System.Drawing.Point(81, 12); + this.jdTextBox.Multiline = true; + this.jdTextBox.Name = "jdTextBox"; + this.jdTextBox.Size = new System.Drawing.Size(173, 30); + this.jdTextBox.TabIndex = 8; + // + // batchComboBox + // + this.batchComboBox.AllowDrop = true; + this.batchComboBox.DropDownHeight = 120; + this.batchComboBox.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.batchComboBox.FormattingEnabled = true; + this.batchComboBox.IntegralHeight = false; + this.batchComboBox.Location = new System.Drawing.Point(81, 55); + this.batchComboBox.Name = "batchComboBox"; + this.batchComboBox.Size = new System.Drawing.Size(173, 24); + this.batchComboBox.TabIndex = 20; + this.batchComboBox.TextUpdate += new System.EventHandler(this.batchComboBox_TextUpdate); + // + // saveButton + // + this.saveButton.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.saveButton.Location = new System.Drawing.Point(492, 46); + this.saveButton.Name = "saveButton"; + this.saveButton.Size = new System.Drawing.Size(154, 37); + this.saveButton.TabIndex = 7; + this.saveButton.Text = "读 入"; + this.saveButton.UseVisualStyleBackColor = true; + this.saveButton.Click += new System.EventHandler(this.saveButton_Click); + // // tbxSequence // this.tbxSequence.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.tbxSequence.Location = new System.Drawing.Point(79, 70); + this.tbxSequence.Location = new System.Drawing.Point(492, 14); this.tbxSequence.Name = "tbxSequence"; this.tbxSequence.ReadOnly = true; - this.tbxSequence.Size = new System.Drawing.Size(122, 29); + this.tbxSequence.Size = new System.Drawing.Size(154, 29); this.tbxSequence.TabIndex = 11; // - // subWeightTextBox - // - this.subWeightTextBox.Font = new System.Drawing.Font("宋体", 42F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.subWeightTextBox.Location = new System.Drawing.Point(259, 8); - this.subWeightTextBox.Multiline = true; - this.subWeightTextBox.Name = "subWeightTextBox"; - this.subWeightTextBox.Size = new System.Drawing.Size(122, 43); - this.subWeightTextBox.TabIndex = 8; - this.subWeightTextBox.Visible = false; - // - // jdTextBox + // lblNumber // - this.jdTextBox.Font = new System.Drawing.Font("宋体", 42F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.jdTextBox.Location = new System.Drawing.Point(79, 8); - this.jdTextBox.Multiline = true; - this.jdTextBox.Name = "jdTextBox"; - this.jdTextBox.Size = new System.Drawing.Size(122, 43); - this.jdTextBox.TabIndex = 8; + this.lblNumber.AutoSize = true; + this.lblNumber.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.lblNumber.Location = new System.Drawing.Point(419, 17); + this.lblNumber.Name = "lblNumber"; + this.lblNumber.Size = new System.Drawing.Size(79, 20); + this.lblNumber.TabIndex = 12; + this.lblNumber.Text = "顺序号:"; // - // label2 + // label1 // - this.label2.AutoSize = true; - this.label2.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label2.Location = new System.Drawing.Point(207, 9); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(59, 20); - this.label2.TabIndex = 12; - this.label2.Text = "扣重:"; - this.label2.Visible = false; + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.Location = new System.Drawing.Point(6, 22); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(79, 20); + this.label1.TabIndex = 12; + this.label1.Text = "标识号:"; // // label3 // this.label3.AutoSize = true; this.label3.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label3.Location = new System.Drawing.Point(209, 72); + this.label3.Location = new System.Drawing.Point(6, 59); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(59, 20); this.label3.TabIndex = 12; this.label3.Text = "批号:"; // - // label1 + // numberTextBox // - this.label1.AutoSize = true; - this.label1.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label1.Location = new System.Drawing.Point(6, 18); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(79, 20); - this.label1.TabIndex = 12; - this.label1.Text = "标识号:"; + this.numberTextBox.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.numberTextBox.Location = new System.Drawing.Point(326, 49); + this.numberTextBox.Multiline = true; + this.numberTextBox.Name = "numberTextBox"; + this.numberTextBox.Size = new System.Drawing.Size(87, 30); + this.numberTextBox.TabIndex = 8; // - // lblNumber + // label2 // - this.lblNumber.AutoSize = true; - this.lblNumber.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.lblNumber.Location = new System.Drawing.Point(6, 72); - this.lblNumber.Name = "lblNumber"; - this.lblNumber.Size = new System.Drawing.Size(79, 20); - this.lblNumber.TabIndex = 12; - this.lblNumber.Text = "顺序号:"; + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label2.Location = new System.Drawing.Point(260, 22); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(59, 20); + this.label2.TabIndex = 12; + this.label2.Text = "扣重:"; // - // saveButton + // subWeightTextBox // - this.saveButton.Font = new System.Drawing.Font("宋体", 24F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.saveButton.Location = new System.Drawing.Point(402, 3); - this.saveButton.Name = "saveButton"; - this.saveButton.Size = new System.Drawing.Size(167, 58); - this.saveButton.TabIndex = 7; - this.saveButton.Text = "添 加"; - this.saveButton.UseVisualStyleBackColor = true; - this.saveButton.Click += new System.EventHandler(this.saveButton_Click); + this.subWeightTextBox.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.subWeightTextBox.Location = new System.Drawing.Point(326, 12); + this.subWeightTextBox.Multiline = true; + this.subWeightTextBox.Name = "subWeightTextBox"; + this.subWeightTextBox.Size = new System.Drawing.Size(87, 30); + this.subWeightTextBox.TabIndex = 8; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label4.Location = new System.Drawing.Point(261, 59); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(59, 20); + this.label4.TabIndex = 12; + this.label4.Text = "头数:"; + // + // pictureBox1 + // + this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); + this.pictureBox1.Location = new System.Drawing.Point(741, 8); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(34, 29); + this.pictureBox1.TabIndex = 18; + this.pictureBox1.TabStop = false; + this.pictureBox1.Visible = false; + this.pictureBox1.Click += new System.EventHandler(this.pictureBox2_Click); // // panel1 // this.panel1.AutoScroll = true; this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.panel1.Location = new System.Drawing.Point(3, 105); + this.panel1.Location = new System.Drawing.Point(3, 208); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(655, 640); + this.panel1.Size = new System.Drawing.Size(655, 537); this.panel1.TabIndex = 6; // // Main @@ -401,11 +548,14 @@ namespace B3ButcherWeightClient { ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); this.splitContainer1.Panel1.ResumeLayout(false); this.splitContainer1.Panel2.ResumeLayout(false); - this.splitContainer1.Panel2.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.ResumeLayout(false); } @@ -427,7 +577,21 @@ namespace B3ButcherWeightClient { private System.Windows.Forms.TextBox subWeightTextBox; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label3; + private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.TextBox numberTextBox; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.ComboBox batchComboBox; + private System.Windows.Forms.Button setButton; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.TextBox textBoxEndTime; + private System.Windows.Forms.TextBox textBoxBeginTime; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.MonthCalendar monthCalendar; private System.Windows.Forms.DataGridViewTextBoxColumn ID; + private System.Windows.Forms.DataGridViewTextBoxColumn DmoID; private System.Windows.Forms.DataGridViewTextBoxColumn Sequence; private System.Windows.Forms.DataGridViewTextBoxColumn JdColumn; private System.Windows.Forms.DataGridViewTextBoxColumn 批号; @@ -436,7 +600,5 @@ namespace B3ButcherWeightClient { private System.Windows.Forms.DataGridViewTextBoxColumn subColumn; private System.Windows.Forms.DataGridViewTextBoxColumn Weight; private System.Windows.Forms.DataGridViewButtonColumn DeleteDetail; - private System.Windows.Forms.PictureBox pictureBox1; - private System.Windows.Forms.TextBox txtBatch; } } \ No newline at end of file diff --git a/B3ButcherWeightClient/Main.cs b/B3ButcherWeightClient/Main.cs index 2d107b8..2306f5a 100644 --- a/B3ButcherWeightClient/Main.cs +++ b/B3ButcherWeightClient/Main.cs @@ -1,8 +1,10 @@ using System; +using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Data; using System.Drawing; +using System.Globalization; using System.Linq; using System.Text; using System.Threading; @@ -11,15 +13,18 @@ using B3ButcherWeightClient.Data; using BO; using Forks.EnterpriseServices.BusinessInterfaces; using Forks.EnterpriseServices.DomainObjects2; +using Forks.EnterpriseServices.DomainObjects2.DQuery; +using Forks.JsonRpc.Client.Data; using Forks.Utils.Data; using Timer = System.Threading.Timer; +using System.Web.Script.Serialization; -namespace B3ButcherWeightClient -{ - public partial class Main : Form - { +namespace B3ButcherWeightClient { + public partial class Main : Form { #region 变量实例 + List batchListOnit = new List(); + List batchListNew = new List(); private string _msg = string.Empty; private readonly IDataFormat _dataFormat; @@ -27,17 +32,14 @@ namespace B3ButcherWeightClient private Thread _inQueryThread, _outQueryThread; private bool _mainProcessIsRun; - private static DateTime NewToday - { - get - { + private static DateTime NewToday { + get { return new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, ConfigUtil.PerDayStartHour, 0, 0); } } - private static DateTime NextNewToday - { + private static DateTime NextNewToday { get { return NewToday.AddHours(24); } } @@ -60,7 +62,7 @@ namespace B3ButcherWeightClient static string startDate = NewToday.ToString("yyyy-MM-dd HH:mm:ss");//24小时 - private readonly string _querySql = string.Format("select [ID],[Sequence],[PhaseCode],[DateTime],[Livestock_Name],[Weight],[SubWeight],[GoodsBatchName] from [WeightTable] where [DateTime] >='{0}' order by [ID] desc", startDate); + private readonly string _querySql = string.Format("select [ID],[Sequence],[PhaseCode],[DateTime],[Livestock_Name],[Weight],[SubWeight],[GoodsBatchName],[DmoID] from [WeightTable] where [DateTime] >='{0}' order by [ID] desc", startDate); private string _querySeqSql = string.Format("select top 1 Sequence from [WeightTable] where [DateTime] > '{0}' and [DateTime] <'{1}' order by Sequence desc", NewToday.ToString("yyyy-MM-dd HH:mm"), NextNewToday.ToString("yyyy-MM-dd HH:mm")); private DataSet _resultDataSet = new DataSet(); @@ -72,12 +74,9 @@ namespace B3ButcherWeightClient private string _displayValue; private int _mainHandle; - int MainHandle - { - get - { - if (_mainHandle == 0) - { + int MainHandle { + get { + if (_mainHandle == 0) { _mainHandle = WinApiSendMessage.FindWindow(null, @"青花瓷称重客户端"); } return _mainHandle; @@ -88,9 +87,9 @@ namespace B3ButcherWeightClient readonly AutoSizeFormClass _asc = new AutoSizeFormClass(); - public Main(Form form) - { + public Main(Form form) { InitializeComponent(); + monthCalendar.Visible = false; dataGridView.AutoGenerateColumns = false; OpenSerialPort(); _parentForm = form; @@ -98,8 +97,7 @@ namespace B3ButcherWeightClient _displayValue = "display"; _mainProcessIsRun = true; pictureBox2.Visible = false; - switch (ConfigUtil.CType) - { + switch (ConfigUtil.CType) { case "XK3130": case "XK3124": _dataFormat = new Xk3124DataFormat(); @@ -121,12 +119,15 @@ namespace B3ButcherWeightClient syncThread.Start(); CheckForIllegalCrossThreadCalls = false;//线程间操作 tbxSequence.Text = "1"; + if (ConfigUtil.SubWeight > 0) { + subWeightTextBox.Text = ConfigUtil.SubWeight.ToString(); + } + textBoxBeginTime.Text = DateTime.Today.ToString("yyyy-MM-dd"); + textBoxEndTime.Text = DateTime.Today.ToString("yyyy-MM-dd"); } - protected override void DefWndProc(ref Message m) - { - switch (m.Msg) - { + protected override void DefWndProc(ref Message m) { + switch (m.Msg) { case WmProcessMessage: QueryResult(); break; @@ -143,51 +144,62 @@ namespace B3ButcherWeightClient #region 控件事件 - private void Main_Resize(object sender, EventArgs e) - { - _asc.controlAutoSize(this); - } - - void bt_Click(object sender, EventArgs e) - { + void bt_Click(object sender, EventArgs e) { var bt = sender as Button; - foreach (var button in _btList) - { + foreach (var button in _btList) { button.BackColor = Color.White; } - if (bt != null) - { + if (bt != null) { bt.BackColor = Color.OrangeRed; _currentInfo = bt.Tag as Livestock.Info; + batchListOnit.Clear(); + batchComboBox.Text = ""; + batchComboBox.Items.Clear(); + var o = RpcUtil.Call>(RpcUtil.GetGoodsBatch, _currentInfo.ID); + foreach (var rpcObject in o) { + var item = new IDName(); + item.ID = rpcObject.Get("ID"); + item.Name = rpcObject.Get("Name"); + batchListOnit.Add(item); + } + batchComboBox.Items.AddRange(batchListOnit.Select(x => x.Name).ToArray()); } + } - private void Main_Load(object sender, EventArgs e) - { + private void Main_Load(object sender, EventArgs e) { InitSequence(); //_asc.ControllInitializeSize(this); //WindowState = FormWindowState.Maximized; FormLoadQueryResult(); } - private void saveButton_Click(object sender, EventArgs e) - { + private void saveButton_Click(object sender, EventArgs e) { decimal w; + if (numberTextBox.Text == "") { + MessageBox.Show("头数录入为空"); + return; + } + int number; + if (!int.TryParse(numberTextBox.Text, out number)) { + MessageBox.Show("头数录入的格式错误"); + return; + } if (decimal.TryParse(_displayValue, out w)) - AddWeightInfo(w); + AddWeightInfo(w, number); + else { + MessageBox.Show("重量格式错误"); + } } - private void DataGridViewCellContentClick(object sender, DataGridViewCellEventArgs e) - { - if (DeleteDetail.Index == e.ColumnIndex) - { + private void DataGridViewCellContentClick(object sender, DataGridViewCellEventArgs e) { + if (DeleteDetail.Index == e.ColumnIndex) { if (MessageBox.Show("确定要删除吗?", "删除", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) return; var sql = string.Format("delete [WeightTable] where id = {0}", dataGridView.Rows[e.RowIndex].Cells["ID"].Value); //var sequence = dataGridView.Rows[e.RowIndex].Cells["Sequence"].Value; - using (var sqlUtil = new SqlUtil(ConfigUtil.ConnectionStr)) - { + using (var sqlUtil = new SqlUtil(ConfigUtil.ConnectionStr)) { sqlUtil.ExecuteNonQuery(sql); } @@ -202,31 +214,50 @@ namespace B3ButcherWeightClient } - private void pictureBox2_Click(object sender, EventArgs e) - { + private void pictureBox2_Click(object sender, EventArgs e) { MessageBox.Show(_msg); } + private int textBoxNum; + private void textBoxBeginTime_DoubleClick(object sender, EventArgs e) { + textBoxNum = 1; + monthCalendar.Visible = true; + monthCalendar.Focus(); + } + + private void textBoxEndTime_DoubleClick(object sender, EventArgs e) { + textBoxNum = 2; + monthCalendar.Visible = true; + monthCalendar.Focus(); + } + + private void monthCalendar_DateSelected(object sender, DateRangeEventArgs e) { + if (textBoxNum == 1) { + textBoxBeginTime.Text = this.monthCalendar.SelectionStart.ToString("yyyy-MM-dd", + DateTimeFormatInfo.InvariantInfo); + } + if (textBoxNum == 2) { + string str = this.monthCalendar.SelectionStart.ToString("yyyy-MM-dd", DateTimeFormatInfo.InvariantInfo); + textBoxEndTime.Text = str; + } + monthCalendar.Visible = false; + } #endregion #region 方法 - private void InitSequence() - { - using (var sqlUtil = new SqlUtil(ConfigUtil.ConnectionStr)) - { + private void InitSequence() { + using (var sqlUtil = new SqlUtil(ConfigUtil.ConnectionStr)) { var obj = sqlUtil.ExecuteScalar(_querySeqSql); tbxSequence.Text = obj != null ? (long.Parse(obj.ToString()) + 1).ToString() : @"1"; } } - private void AddLivestockControl() - { + private void AddLivestockControl() { ConfigUtil.SetLivestock(_dTable); var i = 0; var j = 0; - foreach (var info in _dTable) - { + foreach (var info in _dTable) { var bt = new Button(); bt.Text = info.名称; bt.Size = new Size(200, 100); @@ -237,42 +268,33 @@ namespace B3ButcherWeightClient panel1.Controls.Add(bt); _btList.Add(bt); i++; - if (i == 3) - { + if (i == 3) { i = 0; j++; } } } - private void OpenSerialPort() - { + private void OpenSerialPort() { _serialPort.PortName = ConfigUtil.ComName; _serialPort.BaudRate = int.Parse(ConfigUtil.BaundRate); _serialPort.DataBits = int.Parse(ConfigUtil.DataBits); _serialPort.ReadBufferSize = 4096 * 100; // 打开串口 - if (!_serialPort.IsOpen) - { - try - { + if (!_serialPort.IsOpen) { + try { _serialPort.Open(); - } - catch (InvalidOperationException) - { + } catch (InvalidOperationException) { MessageBox.Show(@"指定的端口已打开"); - } - catch (UnauthorizedAccessException) - { + } catch (UnauthorizedAccessException) { MessageBox.Show(@"对端口的访问被拒绝"); } } } // 接受数据: 称仪表连续输出 - void ReadData() - { + void ReadData() { _inQueryThread = new Thread(InQuery); _inQueryThread.Start(); @@ -282,83 +304,62 @@ namespace B3ButcherWeightClient } - private void InQuery() - { - while (_mainProcessIsRun) - { + private void InQuery() { + while (_mainProcessIsRun) { int availableCount = _serialPort.BytesToRead; - if (availableCount == 0) - { + if (availableCount == 0) { Thread.Sleep(1); } char[] buffer = new char[availableCount]; _serialPort.Read(buffer, 0, availableCount); - foreach (var c in buffer) - { - if (c == _dataFormat.Beginchar) - { + foreach (var c in buffer) { + if (c == _dataFormat.Beginchar) { _dataStrBuilder.Clear(); _dataStrBuilder.Append(c); - } - else if (c == _dataFormat.Endchar || _dataStrBuilder.Length > _dataFormat.Bufsize) - { + } else if (c == _dataFormat.Endchar || _dataStrBuilder.Length > _dataFormat.Bufsize) { _dataStrBuilder.Append(c); _dataQueue.Enqueue(_dataStrBuilder.ToString()); _dataStrBuilder.Clear(); - } - else - { + } else { _dataStrBuilder.Append(c); } } } } - private void OutQuery() - { - while (_mainProcessIsRun) - { - try - { + private void OutQuery() { + while (_mainProcessIsRun) { + try { bool isStatic; string str; string subStr; - if (!_dataQueue.TryDequeue(out subStr)) - { + if (!_dataQueue.TryDequeue(out subStr)) { Thread.Sleep(1); continue; } // 解析接受的端口数据 - if (_dataFormat.ParseAscii(subStr, out str, out isStatic)) - { + if (_dataFormat.ParseAscii(subStr, out str, out isStatic)) { _displayValue = str; WinApiSendMessage.SendMessage(_mainHandle, WmUpdDisplayMessage, 0, 0); } decimal num; - if (ConfigUtil.ReadType == "0") - { - if (decimal.TryParse(str, out num)) - { - WeighAvgControl.Add(num, isStatic); - } - if (WeighAvgControl.TryGetValue(out num)) - { - AddWeightInfo(num); - } - } - else if (ConfigUtil.ReadType == "1") - { - if (decimal.TryParse(str, out num)) - { + if (ConfigUtil.ReadType == "0") { + //五丰通过点击界面按钮来增加重量信息 + //if (decimal.TryParse(str, out num)) { + // WeighAvgControl.Add(num, isStatic); + //} + //if (WeighAvgControl.TryGetValue(out num)) { + // AddWeightInfo(num); + //} + } else if (ConfigUtil.ReadType == "1") { + if (decimal.TryParse(str, out num)) { if (num >= ConfigUtil.MinWeight && num <= ConfigUtil.MaxWeight) AddWeightInfo(num); } } - } - catch (Exception) - { + } catch (Exception) { Thread.Sleep(1000); continue; } @@ -366,46 +367,47 @@ namespace B3ButcherWeightClient } } - private void TimerClick(object o) - { + private void TimerClick(object o) { WinApiSendMessage.SendMessage(MainHandle, WmUpdLanStateMessage, 0, 0); } - private void AddWeightInfo(decimal curValue) - { + private void AddWeightInfo(decimal curValue, int number = 1) { var info = new WeightTable(); info.DateTime = DateTime.Now; info.SubWeight = ConfigUtil.SubWeight;//默认取设置的扣重 decimal subWeight = 0; - if (!string.IsNullOrEmpty(subWeightTextBox.Text)) - { + if (!string.IsNullOrEmpty(subWeightTextBox.Text)) { if (decimal.TryParse(subWeightTextBox.Text, out subWeight)) - info.SubWeight = subWeight; + info.SubWeight = subWeight * number; } info.Weight = curValue - subWeight; info.Livestock_ID = _currentInfo.ID; info.Livestock_Name = _currentInfo.名称; info.Sequence = long.Parse(tbxSequence.Text); info.PhaseCode = jdTextBox.Text; - info.GoodsBatchName = txtBatch.Text; + if (batchComboBox.Text.Length > 0) { + info.GoodsBatchName = batchComboBox.Text; + var batch = batchListOnit.FirstOrDefault(x => x.Name == info.GoodsBatchName); + if (batch != null) + info.GoodsBatchID = batch.ID; + } + + info.Number = number; WeightEnQueue(info); } - private void WeightEnQueue(WeightTable inforStruct) - { + private void WeightEnQueue(WeightTable inforStruct) { Monitor.Enter(_queLocker); _weightQueue.Enqueue(inforStruct); _manualResetEvent.Set(); Monitor.Exit(_queLocker); } - private WeightTable WeightDeQueue() - { + private WeightTable WeightDeQueue() { Monitor.Enter(_queLocker); WeightTable weightInfo = null; - if (_weightQueue.Count > 0) - { + if (_weightQueue.Count > 0) { weightInfo = _weightQueue.Dequeue(); } @@ -414,54 +416,37 @@ namespace B3ButcherWeightClient return weightInfo; } - private void BeginInsertThread() - { + private void BeginInsertThread() { _insertThread = new Thread(DoInser) { IsBackground = true }; _insertThread.Start(new object()); } - private void DoInser(object o) - { + private void DoInser(object o) { _manualResetEvent.WaitOne(); - while (_mainProcessIsRun) - { + while (_mainProcessIsRun) { var weightInfo = WeightDeQueue();//获取队列对象 - if (weightInfo != null) - { + if (weightInfo != null) { string err = string.Empty; - try - { - using (var context = new TransactionContext(Dmo.NewSession(ConfigUtil.ConnectionStr))) - { + try { + using (var context = new TransactionContext(Dmo.NewSession(ConfigUtil.ConnectionStr))) { context.Session.Insert(weightInfo); - //_displayValue = weightInfo.Weight.ToString(); context.Commit(); } tbxSequence.Text = (weightInfo.Sequence + 1).ToString(); - } - catch (Exception ex) - { + } catch (Exception ex) { err = ex.Message; - } - finally - { - lock (EncodeString.RwLocker) - { - using (ISqlUtil sqlUtil = new SqlUtil(ConfigUtil.ConnectionStr)) - { - try - { - lock (EncodeString.RwLocker) - { + } finally { + lock (EncodeString.RwLocker) { + using (ISqlUtil sqlUtil = new SqlUtil(ConfigUtil.ConnectionStr)) { + try { + lock (EncodeString.RwLocker) { _resultDataSet = sqlUtil.ExecuteSql(_querySql); } sqlUtil.Close(); - } - catch (Exception ex) - { + } catch (Exception ex) { MessageBox.Show(ex.Message); } } @@ -475,46 +460,42 @@ namespace B3ButcherWeightClient } } - private void QueryResult() - { - lock (EncodeString.RwLocker) - { + private void QueryResult() { + lock (EncodeString.RwLocker) { dataGridView.DataSource = _resultDataSet.Tables[0]; } + if (this.dataGridView.Rows.Count > 0) { + for (int index = 0; index < dataGridView.Rows.Count; index++) { + var row = dataGridView.Rows[index]; + var dmoID = row.Cells["DmoID"].Value; + if (dmoID != DBNull.Value && ((long)dmoID) > 0) { + row.DefaultCellStyle.BackColor = Color.LawnGreen; + } + } + } } - private void FormLoadQueryResult() - { - using (ISqlUtil sqlUtil = new SqlUtil(ConfigUtil.ConnectionStr)) - { - try - { - lock (EncodeString.RwLocker) - { + private void FormLoadQueryResult() { + using (ISqlUtil sqlUtil = new SqlUtil(ConfigUtil.ConnectionStr)) { + try { + lock (EncodeString.RwLocker) { _resultDataSet = sqlUtil.ExecuteSql(_querySql); } sqlUtil.Close(); - } - catch (Exception ex) - { + } catch (Exception ex) { MessageBox.Show(ex.Message); } } - - dataGridView.DataSource = _resultDataSet.Tables[0]; - + QueryResult(); } - void SyncTask() - { + void SyncTask() { var sleeptime = 500; pictureBox2.Visible = true; - while (_mainProcessIsRun) - { + while (_mainProcessIsRun) { Thread.Sleep(sleeptime); sleeptime = 20000; - if (string.IsNullOrEmpty(ConfigUtil.RemoteConStr)) - { + if (string.IsNullOrEmpty(ConfigUtil.RemoteConStr)) { _msg = "没有设置服务器数据库,无法同步!"; LogUtil.WriteLog(DateTime.Now + ":" + _msg); continue; @@ -527,17 +508,13 @@ namespace B3ButcherWeightClient #endregion - private class WeighAvgControl - { - public static bool TryGetValue(out decimal result) - { + private class WeighAvgControl { + public static bool TryGetValue(out decimal result) { List> list; - if (mWeighList.TryDequeue(out list)) - { + if (mWeighList.TryDequeue(out list)) { var r = list.Where(x => x.Item2).Select(x => x.Item1).GroupBy(x => x); var firstOrDefault = r.OrderByDescending(x => x.Count()).FirstOrDefault(); - if (firstOrDefault != null) - { + if (firstOrDefault != null) { result = firstOrDefault.Key; return true; } @@ -552,16 +529,11 @@ namespace B3ButcherWeightClient static List> _list = new List>(); - public static void Add(decimal value, bool isStatic) - { - if (value >= ConfigUtil.MinWeight && value <= ConfigUtil.MaxWeight) - { + public static void Add(decimal value, bool isStatic) { + if (value >= ConfigUtil.MinWeight && value <= ConfigUtil.MaxWeight) { _list.Add(new Tuple(value, isStatic)); - } - else - { - if (_list.Count > 0) - { + } else { + if (_list.Count > 0) { mWeighList.Enqueue(_list); _list = new List>(); } @@ -569,49 +541,37 @@ namespace B3ButcherWeightClient } } - private void dataGridView_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) - { - if (!ConfigUtil.AllowChangeLevel) - { + private void dataGridView_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { + if (!ConfigUtil.AllowChangeLevel) { return; } // e.RowIndex long id; - if (long.TryParse(dataGridView.Rows[e.RowIndex].Cells[0].Value.ToString(), out id)) - { + if (long.TryParse(dataGridView.Rows[e.RowIndex].Cells[0].Value.ToString(), out id)) { var levelName = dataGridView.Rows[e.RowIndex].Cells[0].Value.ToString(); var f = new ChangeLevelForm(); f.Init(levelName); - if (f.ShowDialog() == DialogResult.OK) - { + if (f.ShowDialog() == DialogResult.OK) { var newLevelId = f.mID; var newLevelName = f.mName; var updateSql = "update [WeightTable] set [Livestock_ID]=" + newLevelId + ",[Livestock_Name]='" + newLevelName + "' where ID=" + id + " "; bool needUpdate = false; - lock (EncodeString.RwLocker) - { - using (ISqlUtil sqlUtil = new SqlUtil(ConfigUtil.ConnectionStr)) - { - try - { - lock (EncodeString.RwLocker) - { + lock (EncodeString.RwLocker) { + using (ISqlUtil sqlUtil = new SqlUtil(ConfigUtil.ConnectionStr)) { + try { + lock (EncodeString.RwLocker) { sqlUtil.ExecuteNonQuery(updateSql); _resultDataSet = sqlUtil.ExecuteSql(_querySql); - - dataGridView.DataSource = _resultDataSet.Tables[0]; + QueryResult(); needUpdate = true; } sqlUtil.Close(); - } - catch (Exception ex) - { + } catch (Exception ex) { MessageBox.Show(ex.Message); } } } - if (needUpdate) - { + if (needUpdate) { //同步修改远程数据库的数据 pictureBox2.Visible = !SyncUtil.TryUpdateLevel(id.ToString(), newLevelId, newLevelName, out _msg); } @@ -621,12 +581,145 @@ namespace B3ButcherWeightClient } - private void button1_Click(object sender, EventArgs e) - { + private void button1_Click(object sender, EventArgs e) { var form = new QueryForm(); form.StartPosition = FormStartPosition.CenterParent; form.ShowDialog(); } + private void batchComboBox_TextUpdate(object sender, EventArgs e) { + + batchComboBox.Items.Clear(); + batchListNew.Clear(); + + if (batchComboBox.Text.Length == 0) { + batchComboBox.Items.AddRange(batchListOnit.Select(x => x.Name).ToArray()); + } else { + foreach (var item in batchListOnit) { + if (item.Name.Contains(batchComboBox.Text)) { + batchListNew.Add(item); + } + } + batchComboBox.Items.AddRange(batchListNew.Select(x => x.Name).ToArray()); + } + batchComboBox.SelectionStart = batchComboBox.Text.Length; + Cursor = Cursors.Default; + batchComboBox.DroppedDown = true; + } + + private void setButton_Click(object sender, EventArgs e) { + var setForm = new Parameters(); + setForm.ShowDialog(); + } + + private void button2_Click(object sender, EventArgs e) { + + + if (textBoxBeginTime.Text.Length == 0) { + MessageBox.Show("开始日期不能为空"); + return; + } + if (textBoxEndTime.Text.Length == 0) { + MessageBox.Show("结束日期不能为空"); + return; + } + var dmos = new List(); + using (var sqlUtil = new SqlUtil(ConfigUtil.ConnectionStr)) { + using (var context = new TransactionContext(Dmo.NewSession(sqlUtil, SessionBehaviors.None))) { + var dom = new DmoQuery(typeof(WeightTable)); + dom.Where.Conditions.Add(DQCondition.IsNull(DQExpression.Field("DmoID"))); + dom.Where.Conditions.Add(DQCondition.GreaterThanOrEqual("DateTime", textBoxBeginTime.Text)); + dom.Where.Conditions.Add(DQCondition.LessThanOrEqual("DateTime", string.Format("{0} 23:59:59", textBoxEndTime.Text))); + var list = context.Session.ExecuteList(dom); + foreach (WeightTable dmo in list) { + dmos.Add(dmo); + } + } + } + if (dmos.Count == 0) { + MessageBox.Show("没有可以创建单据的称重数据"); + return; + } + var details = new ManyList("/MainSystem/B3ButcherManage/BO/CarcassPicking_WeightDetail"); + foreach (var detail in dmos) { + var detail1 = new RpcObject("/MainSystem/B3ButcherManage/BO/CarcassPicking_WeightDetail"); + detail1.Set("Goods_ID", detail.Livestock_ID); + detail1.Set("Goods_Name", detail.Livestock_Name); + detail1.Set("GoodsBatch_ID", detail.GoodsBatchID); + detail1.Set("SubWeight", detail.SubWeight); + detail1.Set("Weight", detail.Weight); + detail1.Set("DateTime", detail.DateTime); + details.Add(detail1); + } + + var groups = dmos.GroupBy(x => new { x.Livestock_ID, x.GoodsBatchID }); + var details2 = new ManyList("/MainSystem/B3ButcherManage/BO/CarcassPicking_Detail"); + foreach (var @group in groups) { + var weight = @group.Sum(x => x.Weight ?? 0); + var subWeight = @group.Sum(x => x.SubWeight ?? 0); + var first = @group.FirstOrDefault(); + var detail1 = new RpcObject("/MainSystem/B3ButcherManage/BO/CarcassPicking_Detail"); + detail1.Set("Goods_ID", @group.Key.Livestock_ID); + detail1.Set("Goods_Name", first.Livestock_Name); + detail1.Set("GoodsBatch_ID", @group.Key.GoodsBatchID); + detail1.Set("BodyWeight", weight - subWeight); + detail1.Set("SecondNumber", @group.Count() * 1.0m); + detail1.Set("Number", weight - subWeight); + details2.Add(detail1); + } + var bill = new RpcObject("/MainSystem/B3ButcherManage/BO/CarcassPicking"); + bill.Set("Store_ID", ConfigUtil.StoreID); + bill.Set("Department_ID", ConfigUtil.DeptID); + bill.Set("InputType_ID", ConfigUtil.TouruID); + bill.Set("ProductionUnit_ID", ConfigUtil.ShengchanID); + bill.Set("Remark", "称重客户端上传"); + bill.Set("Details", details2); + bill.Set("WeightDetails", details); + var id = RpcUtil.Call(RpcUtil.InsertCarcassPicking, bill); + using (var sqlUtil = new SqlUtil(ConfigUtil.ConnectionStr)) { + using (var context = new TransactionContext(Dmo.NewSession(sqlUtil, SessionBehaviors.None))) { + var dom = new DQUpdateDom(typeof(WeightTable)); + dom.Columns.Add(new DQUpdateColumn("DmoID", id)); + dom.Columns.Add(new DQUpdateColumn("DmoTypeID", 2880 + 14)); + dom.Where.Conditions.Add(DQCondition.InList(DQExpression.Field("ID"), dmos.Select(x => DQExpression.ConstValue(x.ID)).ToArray())); + context.Session.ExecuteNonQuery(dom); + context.Commit(); + } + } + + var querySql = new StringBuilder(); + querySql.Append("select [ID],[Sequence],[PhaseCode],[DateTime],[Livestock_Name],[Weight],[SubWeight],[GoodsBatchName],[DmoID] from [WeightTable] where [DmoID]="); + querySql.Append(id); + using (ISqlUtil sqlUtil = new SqlUtil(ConfigUtil.ConnectionStr)) { + + lock (EncodeString.RwLocker) { + _resultDataSet = sqlUtil.ExecuteSql(querySql.ToString()); + } + sqlUtil.Close(); + } + lock (EncodeString.RwLocker) { + dataGridView.DataSource = _resultDataSet.Tables[0]; + } + if (this.dataGridView.Rows.Count > 0) { + for (int index = 0; index < dataGridView.Rows.Count; index++) { + var row = dataGridView.Rows[index]; + var dmoID = row.Cells["DmoID"].Value; + if (dmoID != DBNull.Value && ((long)dmoID) > 0) { + row.DefaultCellStyle.BackColor = Color.LawnGreen; + } + } + } + MessageBox.Show("成功创建单据No." + id); + } + + } + + class IDName { + public long ID { get; set; } + private string _name = string.Empty; + public string Name { + get { return _name; } + set { _name = value; } + } } } diff --git a/B3ButcherWeightClient/Main.resx b/B3ButcherWeightClient/Main.resx index e0ad8bd..a50db28 100644 --- a/B3ButcherWeightClient/Main.resx +++ b/B3ButcherWeightClient/Main.resx @@ -120,6 +120,9 @@ True + + True + True @@ -142,7 +145,7 @@ True - + R0lGODlhIAAdALMPAP///xgYGBAQCBgYACEhACkpAFJSAGNjAHNzAJSUAK2tAL29AM7OAO/vAP//AAAA ACH/C05FVFNDQVBFMi4wAwHoAwAh/lbR3cq+sOaxvjog08nOtNeisuGw5rG+tcQgR0lGIE1vdmllIEdl @@ -167,7 +170,7 @@ ZXJzaW9uIG9mIEdJRiBDb25zdHJ1Y3Rpb24gU2V0ADs= - + R0lGODlhIAAdALMPAP///xgYGBAQCBgYACEhACkpAFJSAGNjAHNzAJSUAK2tAL29AM7OAO/vAP//AAAA ACH/C05FVFNDQVBFMi4wAwHoAwAh/lbR3cq+sOaxvjog08nOtNeisuGw5rG+tcQgR0lGIE1vdmllIEdl diff --git a/B3ButcherWeightClient/Parameters.Designer.cs b/B3ButcherWeightClient/Parameters.Designer.cs new file mode 100644 index 0000000..f0c49bd --- /dev/null +++ b/B3ButcherWeightClient/Parameters.Designer.cs @@ -0,0 +1,171 @@ +namespace B3ButcherWeightClient { + partial class Parameters { + /// + /// 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() { + this.label6 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.txtBAcc = new System.Windows.Forms.TextBox(); + this.label4 = new System.Windows.Forms.Label(); + this.txtBoxDept = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.txtBoxStore = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.txtBTouru = new System.Windows.Forms.TextBox(); + this.txtShengchan = new System.Windows.Forms.TextBox(); + this.btnSave = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(204, 70); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(65, 12); + this.label6.TabIndex = 28; + this.label6.Text = "生产单位ID"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(15, 32); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(65, 12); + this.label1.TabIndex = 20; + this.label1.Text = "会计单位ID"; + // + // txtBAcc + // + this.txtBAcc.Location = new System.Drawing.Point(86, 29); + this.txtBAcc.MaxLength = 100; + this.txtBAcc.Name = "txtBAcc"; + this.txtBAcc.Size = new System.Drawing.Size(100, 21); + this.txtBAcc.TabIndex = 25; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(204, 32); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(65, 12); + this.label4.TabIndex = 24; + this.label4.Text = "投入类型ID"; + // + // txtBoxDept + // + this.txtBoxDept.Location = new System.Drawing.Point(86, 67); + this.txtBoxDept.MaxLength = 30; + this.txtBoxDept.Name = "txtBoxDept"; + this.txtBoxDept.Size = new System.Drawing.Size(100, 21); + this.txtBoxDept.TabIndex = 26; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(15, 70); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(41, 12); + this.label2.TabIndex = 19; + this.label2.Text = "部门ID"; + // + // txtBoxStore + // + this.txtBoxStore.Location = new System.Drawing.Point(86, 105); + this.txtBoxStore.MaxLength = 20; + this.txtBoxStore.Name = "txtBoxStore"; + this.txtBoxStore.Size = new System.Drawing.Size(100, 21); + this.txtBoxStore.TabIndex = 27; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(15, 108); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(41, 12); + this.label3.TabIndex = 18; + this.label3.Text = "仓库ID"; + // + // txtBTouru + // + this.txtBTouru.Location = new System.Drawing.Point(275, 29); + this.txtBTouru.MaxLength = 10; + this.txtBTouru.Name = "txtBTouru"; + this.txtBTouru.Size = new System.Drawing.Size(100, 21); + this.txtBTouru.TabIndex = 21; + // + // txtShengchan + // + this.txtShengchan.Location = new System.Drawing.Point(275, 67); + this.txtShengchan.MaxLength = 10; + this.txtShengchan.Name = "txtShengchan"; + this.txtShengchan.Size = new System.Drawing.Size(100, 21); + this.txtShengchan.TabIndex = 22; + // + // btnSave + // + this.btnSave.Location = new System.Drawing.Point(159, 154); + this.btnSave.Name = "btnSave"; + this.btnSave.Size = new System.Drawing.Size(62, 23); + this.btnSave.TabIndex = 29; + this.btnSave.Text = "保 存"; + this.btnSave.UseVisualStyleBackColor = true; + this.btnSave.Click += new System.EventHandler(this.btnSave_Click); + // + // Parameters + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(388, 267); + this.Controls.Add(this.btnSave); + this.Controls.Add(this.label6); + this.Controls.Add(this.label1); + this.Controls.Add(this.txtBAcc); + this.Controls.Add(this.label4); + this.Controls.Add(this.txtBoxDept); + this.Controls.Add(this.label2); + this.Controls.Add(this.txtBoxStore); + this.Controls.Add(this.label3); + this.Controls.Add(this.txtBTouru); + this.Controls.Add(this.txtShengchan); + this.Name = "Parameters"; + this.Text = "创建单据默认值"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox txtBAcc; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.TextBox txtBoxDept; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox txtBoxStore; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox txtBTouru; + private System.Windows.Forms.TextBox txtShengchan; + private System.Windows.Forms.Button btnSave; + } +} \ No newline at end of file diff --git a/B3ButcherWeightClient/Parameters.cs b/B3ButcherWeightClient/Parameters.cs new file mode 100644 index 0000000..918bbae --- /dev/null +++ b/B3ButcherWeightClient/Parameters.cs @@ -0,0 +1,76 @@ +using System; +using System.IO; +using System.Windows.Forms; +using Forks.Utils.IO; + +namespace B3ButcherWeightClient { + public partial class Parameters : Form { + public Parameters() { + InitializeComponent(); + SetConfigControl(); + } + + + // 取得设置的值 + private void SetConfigControl() { + + using (var reader = FS.OpenReader(ConfigUtil.ParametersPath, true)) { + var nutFile = NutFile.Parse(reader); + + txtBAcc.Text = nutFile.AsString(ConfigItem.AccID, ""); + txtBoxDept.Text = nutFile.AsString(ConfigItem.DeptID, ""); + txtBoxStore.Text = nutFile.AsString(ConfigItem.StoreID, ""); + txtBTouru.Text = nutFile.AsString(ConfigItem.TouruID, ""); + txtShengchan.Text = nutFile.AsString(ConfigItem.ShengchanID, ""); + + } + } + + private void btnSave_Click(object sender, EventArgs e) { + using (TextReader reader = FS.OpenReader(ConfigUtil.ParametersPath, true)) { + var nutFile = NutFile.Parse(reader); + nutFile.SetValue(ConfigItem.AccID, txtBAcc.Text.Trim()); + nutFile.SetValue(ConfigItem.DeptID, txtBoxDept.Text.Trim()); + nutFile.SetValue(ConfigItem.StoreID, txtBoxStore.Text.Trim()); + nutFile.SetValue(ConfigItem.ShengchanID, txtShengchan.Text.Trim()); + nutFile.SetValue(ConfigItem.TouruID, txtBTouru.Text.Trim()); + + using (TextWriter writer = FS.OpenWriter(ConfigUtil.ParametersPath, createDirsIfNotExist: true)) { + nutFile.Write(writer); + } + } + + var str = txtBAcc.Text; + if (string.IsNullOrEmpty(str)) { + ConfigUtil.AccID = 0; + } else { + long.TryParse(str, out ConfigUtil.AccID); + } + str = txtBoxDept.Text; + if (string.IsNullOrEmpty(str)) { + ConfigUtil.DeptID = 0; + } else { + long.TryParse(str, out ConfigUtil.DeptID); + } + str = txtBoxStore.Text; + if (string.IsNullOrEmpty(str)) { + ConfigUtil.StoreID = 0; + } else { + long.TryParse(str, out ConfigUtil.StoreID); + } + str = txtBTouru.Text; + if (string.IsNullOrEmpty(str)) { + ConfigUtil.TouruID = 0; + } else { + long.TryParse(str, out ConfigUtil.TouruID); + } + str = txtShengchan.Text; + if (string.IsNullOrEmpty(str)) { + ConfigUtil.ShengchanID = 0; + } else { + long.TryParse(str, out ConfigUtil.ShengchanID); + } + Dispose(); + } + } +} diff --git a/B3ButcherWeightClient/Parameters.resx b/B3ButcherWeightClient/Parameters.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/B3ButcherWeightClient/Parameters.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/B3ButcherWeightClient/Parameters.txt b/B3ButcherWeightClient/Parameters.txt new file mode 100644 index 0000000..e69de29 diff --git a/B3ButcherWeightClient/QueryForm.Designer.cs b/B3ButcherWeightClient/QueryForm.Designer.cs index c602ffc..ad290ca 100644 --- a/B3ButcherWeightClient/QueryForm.Designer.cs +++ b/B3ButcherWeightClient/QueryForm.Designer.cs @@ -23,15 +23,15 @@ /// the contents of this method with the code editor. /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle21 = 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 dataGridViewCellStyle24 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle25 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle26 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle27 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = 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(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); this.textBoxEndTime = new System.Windows.Forms.TextBox(); this.textBoxBeginTime = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); @@ -77,6 +77,7 @@ this.textBoxBeginTime.Size = new System.Drawing.Size(164, 40); this.textBoxBeginTime.TabIndex = 10; this.textBoxBeginTime.TabStop = false; + this.textBoxBeginTime.TextChanged += new System.EventHandler(this.textBoxBeginTime_TextChanged); this.textBoxBeginTime.DoubleClick += new System.EventHandler(this.textBoxBeginTime_DoubleClick); // // label3 @@ -148,8 +149,8 @@ // IDColumn // this.IDColumn.DataPropertyName = "ID"; - dataGridViewCellStyle19.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.IDColumn.DefaultCellStyle = dataGridViewCellStyle19; + dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.IDColumn.DefaultCellStyle = dataGridViewCellStyle1; this.IDColumn.FillWeight = 0.8370507F; this.IDColumn.HeaderText = "ID"; this.IDColumn.Name = "IDColumn"; @@ -158,8 +159,8 @@ // SeqColumn // this.SeqColumn.DataPropertyName = "Sequence"; - dataGridViewCellStyle20.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.SeqColumn.DefaultCellStyle = dataGridViewCellStyle20; + dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.SeqColumn.DefaultCellStyle = dataGridViewCellStyle2; this.SeqColumn.FillWeight = 0.8370507F; this.SeqColumn.HeaderText = "顺序号"; this.SeqColumn.Name = "SeqColumn"; @@ -168,8 +169,8 @@ // DateColumn // this.DateColumn.DataPropertyName = "DateTime"; - dataGridViewCellStyle21.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.DateColumn.DefaultCellStyle = dataGridViewCellStyle21; + dataGridViewCellStyle3.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.DateColumn.DefaultCellStyle = dataGridViewCellStyle3; this.DateColumn.FillWeight = 1.8F; this.DateColumn.HeaderText = "时间"; this.DateColumn.Name = "DateColumn"; @@ -178,8 +179,8 @@ // PhaseColumn // this.PhaseColumn.DataPropertyName = "PhaseCode"; - dataGridViewCellStyle22.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.PhaseColumn.DefaultCellStyle = dataGridViewCellStyle22; + dataGridViewCellStyle4.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.PhaseColumn.DefaultCellStyle = dataGridViewCellStyle4; this.PhaseColumn.FillWeight = 1.065272F; this.PhaseColumn.HeaderText = "阶段号"; this.PhaseColumn.Name = "PhaseColumn"; @@ -188,8 +189,8 @@ // LivestockColumn // this.LivestockColumn.DataPropertyName = "Livestock_Name"; - dataGridViewCellStyle23.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.LivestockColumn.DefaultCellStyle = dataGridViewCellStyle23; + dataGridViewCellStyle5.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.LivestockColumn.DefaultCellStyle = dataGridViewCellStyle5; this.LivestockColumn.FillWeight = 1.065272F; this.LivestockColumn.HeaderText = "级别"; this.LivestockColumn.Name = "LivestockColumn"; @@ -198,9 +199,9 @@ // NumberColumn // this.NumberColumn.DataPropertyName = "Number"; - dataGridViewCellStyle24.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle24.Format = "0"; - this.NumberColumn.DefaultCellStyle = dataGridViewCellStyle24; + dataGridViewCellStyle6.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle6.Format = "0"; + this.NumberColumn.DefaultCellStyle = dataGridViewCellStyle6; this.NumberColumn.FillWeight = 1.065272F; this.NumberColumn.HeaderText = "头数"; this.NumberColumn.Name = "NumberColumn"; @@ -209,10 +210,10 @@ // WeightColumn // this.WeightColumn.DataPropertyName = "AllWeight"; - dataGridViewCellStyle25.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle25.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle25.Format = "0.00"; - this.WeightColumn.DefaultCellStyle = dataGridViewCellStyle25; + dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle7.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle7.Format = "0.00"; + this.WeightColumn.DefaultCellStyle = dataGridViewCellStyle7; this.WeightColumn.FillWeight = 1.065272F; this.WeightColumn.HeaderText = "重量"; this.WeightColumn.Name = "WeightColumn"; @@ -221,10 +222,10 @@ // SubWeightColumn // this.SubWeightColumn.DataPropertyName = "SubWeight"; - dataGridViewCellStyle26.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle26.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle26.Format = "0.00"; - this.SubWeightColumn.DefaultCellStyle = dataGridViewCellStyle26; + dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle8.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle8.Format = "0.00"; + this.SubWeightColumn.DefaultCellStyle = dataGridViewCellStyle8; this.SubWeightColumn.FillWeight = 1.065272F; this.SubWeightColumn.HeaderText = "扣重"; this.SubWeightColumn.Name = "SubWeightColumn"; @@ -233,10 +234,10 @@ // RWeightColumn // this.RWeightColumn.DataPropertyName = "Weight"; - dataGridViewCellStyle27.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle27.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle27.Format = "0.00"; - this.RWeightColumn.DefaultCellStyle = dataGridViewCellStyle27; + dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle9.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle9.Format = "0.00"; + this.RWeightColumn.DefaultCellStyle = dataGridViewCellStyle9; this.RWeightColumn.FillWeight = 1.065272F; this.RWeightColumn.HeaderText = "净重"; this.RWeightColumn.Name = "RWeightColumn"; diff --git a/B3ButcherWeightClient/QueryForm.cs b/B3ButcherWeightClient/QueryForm.cs index e35bda3..39cc194 100644 --- a/B3ButcherWeightClient/QueryForm.cs +++ b/B3ButcherWeightClient/QueryForm.cs @@ -213,5 +213,9 @@ namespace B3ButcherWeightClient { range.HorizontalAlignment = a; } + private void textBoxBeginTime_TextChanged(object sender, EventArgs e) { + + } + } } diff --git a/B3ButcherWeightClient/QueryForm.resx b/B3ButcherWeightClient/QueryForm.resx index 2f00241..729cd76 100644 --- a/B3ButcherWeightClient/QueryForm.resx +++ b/B3ButcherWeightClient/QueryForm.resx @@ -144,31 +144,4 @@ True - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - - True - \ No newline at end of file diff --git a/B3ButcherWeightClient/RpcUtil.cs b/B3ButcherWeightClient/RpcUtil.cs new file mode 100644 index 0000000..e1c490b --- /dev/null +++ b/B3ButcherWeightClient/RpcUtil.cs @@ -0,0 +1,62 @@ +using System; +using Forks.JsonRpc.Client; + +namespace B3ButcherWeightClient { + public static class RpcUtil { + + public static bool IsInited { set; get; } + + const string WpfUserMethod = "/MainSystem/B3TianJinMeatUnite/Rpcs/ClientRpc/GetWpfUserInfoByIds"; + public const string GetGoodsBatch = "/MainSystem/BWP/B3_WuFeng/Rpcs/WeightClientRpc/GetGoodsBatch"; + public const string InsertCarcassPicking = "/MainSystem/BWP/B3_WuFeng/Rpcs/WeightClientRpc/InsertCarcassPicking"; + public static string OnLineLoadNameByCode(string code, out string error) { + try { + error = string.Empty; + + return RpcFacade.Call(WpfUserMethod, code); + } catch (Exception ex) { + error = ex.ToString(); + } + return string.Empty; + } + + public static bool Login(string name, string password, out string error) { + error = string.Empty; + try { + RpcFacade.Login(name, password); + } catch (Exception e) { + error = e.Message; + return false; + } + return true; + } + + public static bool Logout(out string error) { + error = string.Empty; + try { + RpcFacade.Logout(); + } catch (Exception e) { + error = e.Message; + return false; + } + return true; + } + + + public static T Call(string relativeMethod, params object[] parameters) { + + bool logedIn; + try { + logedIn = RpcFacade.IsLogedIn; + } catch { + logedIn = false; + } + + if (!logedIn) { + RpcFacade.Login(EncodeString.UserName, EncodeString.Password); + } + + return RpcFacade.Call(relativeMethod, parameters); + } + } +} diff --git a/B3ButcherWeightClient/Setting.Designer.cs b/B3ButcherWeightClient/Setting.Designer.cs index b5d186a..0122cbc 100644 --- a/B3ButcherWeightClient/Setting.Designer.cs +++ b/B3ButcherWeightClient/Setting.Designer.cs @@ -63,10 +63,13 @@ this.radioButton2 = new System.Windows.Forms.RadioButton(); this.radioButton1 = new System.Windows.Forms.RadioButton(); this.cbxAllowChangeLevel = new System.Windows.Forms.CheckBox(); -this.subWeightLabel = new System.Windows.Forms.Label(); - this.subWeightSettingTextBox = new System.Windows.Forms.TextBox(); this.label15 = new System.Windows.Forms.Label(); + this.subWeightLabel = new System.Windows.Forms.Label(); + this.subWeightSettingTextBox = new System.Windows.Forms.TextBox(); + this.label15 = new System.Windows.Forms.Label(); this.txtPerDayStartHour = new System.Windows.Forms.TextBox(); - this.groupBox1.SuspendLayout(); + this.urlTextBox = new System.Windows.Forms.TextBox(); + this.label16 = new System.Windows.Forms.Label(); + this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox3.SuspendLayout(); this.groupBox4.SuspendLayout(); @@ -353,7 +356,7 @@ this.subWeightLabel = new System.Windows.Forms.Label(); // // btnClose // - this.btnClose.Location = new System.Drawing.Point(229, 431); + this.btnClose.Location = new System.Drawing.Point(233, 483); this.btnClose.Name = "btnClose"; this.btnClose.Size = new System.Drawing.Size(62, 23); this.btnClose.TabIndex = 26; @@ -363,7 +366,7 @@ this.subWeightLabel = new System.Windows.Forms.Label(); // // btnSave // - this.btnSave.Location = new System.Drawing.Point(134, 431); + this.btnSave.Location = new System.Drawing.Point(138, 483); this.btnSave.Name = "btnSave"; this.btnSave.Size = new System.Drawing.Size(62, 23); this.btnSave.TabIndex = 25; @@ -461,7 +464,22 @@ this.subWeightLabel = new System.Windows.Forms.Label(); this.cbxAllowChangeLevel.Text = "允许修改级别"; this.cbxAllowChangeLevel.UseVisualStyleBackColor = true; // - + // subWeightLabel + // + this.subWeightLabel.AutoSize = true; + this.subWeightLabel.Location = new System.Drawing.Point(21, 398); + this.subWeightLabel.Name = "subWeightLabel"; + this.subWeightLabel.Size = new System.Drawing.Size(29, 12); + this.subWeightLabel.TabIndex = 30; + this.subWeightLabel.Text = "扣重"; + // + // subWeightSettingTextBox + // + this.subWeightSettingTextBox.Location = new System.Drawing.Point(82, 395); + this.subWeightSettingTextBox.Name = "subWeightSettingTextBox"; + this.subWeightSettingTextBox.Size = new System.Drawing.Size(100, 21); + this.subWeightSettingTextBox.TabIndex = 31; + // // label15 // this.label15.AutoSize = true; @@ -479,37 +497,33 @@ this.subWeightLabel = new System.Windows.Forms.Label(); this.txtPerDayStartHour.Size = new System.Drawing.Size(41, 21); this.txtPerDayStartHour.TabIndex = 31; // - - // subWeightLabel + // urlTextBox // - this.subWeightLabel.AutoSize = true; - this.subWeightLabel.Location = new System.Drawing.Point(21, 398); - this.subWeightLabel.Name = "subWeightLabel"; - this.subWeightLabel.Size = new System.Drawing.Size(29, 12); - this.subWeightLabel.TabIndex = 30; - this.subWeightLabel.Text = "扣重"; + this.urlTextBox.Location = new System.Drawing.Point(82, 423); + this.urlTextBox.Name = "urlTextBox"; + this.urlTextBox.Size = new System.Drawing.Size(323, 21); + this.urlTextBox.TabIndex = 32; // - // subWeightSettingTextBox + // label16 // - this.subWeightSettingTextBox.Location = new System.Drawing.Point(82, 395); - this.subWeightSettingTextBox.Name = "subWeightSettingTextBox"; - this.subWeightSettingTextBox.Size = new System.Drawing.Size(100, 21); - this.subWeightSettingTextBox.TabIndex = 31; + this.label16.AutoSize = true; + this.label16.Location = new System.Drawing.Point(21, 426); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(53, 12); + this.label16.TabIndex = 30; + this.label16.Text = "B3地址:"; // - - // Setting // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(424, 466); - + this.ClientSize = new System.Drawing.Size(424, 535); + this.Controls.Add(this.urlTextBox); this.Controls.Add(this.txtPerDayStartHour); this.Controls.Add(this.label15); - this.Controls.Add(this.subWeightSettingTextBox); + this.Controls.Add(this.label16); this.Controls.Add(this.subWeightLabel); - this.Controls.Add(this.cbxAllowChangeLevel); this.Controls.Add(this.groupBox4); this.Controls.Add(this.button3); @@ -581,6 +595,8 @@ this.subWeightLabel = new System.Windows.Forms.Label(); private System.Windows.Forms.Label subWeightLabel; private System.Windows.Forms.TextBox subWeightSettingTextBox; + private System.Windows.Forms.TextBox urlTextBox; + private System.Windows.Forms.Label label16; } } \ No newline at end of file diff --git a/B3ButcherWeightClient/Setting.cs b/B3ButcherWeightClient/Setting.cs index 3fc0f59..f1d4c41 100644 --- a/B3ButcherWeightClient/Setting.cs +++ b/B3ButcherWeightClient/Setting.cs @@ -44,7 +44,8 @@ namespace B3ButcherWeightClient { radioButton1.Checked = true; } else if (readType == "1") { radioButton2.Checked = true; - } + } + urlTextBox.Text = nutFile.AsString(ConfigItem.Url, "http://"); subWeightSettingTextBox.Text = nutFile.AsString(ConfigItem.SubWeight, "0"); } } @@ -131,7 +132,7 @@ namespace B3ButcherWeightClient { nutFile.SetValue(ConfigItem.ReadType, readType); nutFile.SetValue(ConfigItem.SubWeight, subWeightSettingTextBox.Text.Trim()); - + nutFile.SetValue(ConfigItem.Url, urlTextBox.Text.Trim()); using (TextWriter writer = FS.OpenWriter(ConfigUtil.ConfigFilePath, createDirsIfNotExist: true)) { nutFile.Write(writer); } diff --git a/BO/WeightTable.cs b/BO/WeightTable.cs index e4a081a..b98bef7 100644 --- a/BO/WeightTable.cs +++ b/BO/WeightTable.cs @@ -34,6 +34,9 @@ namespace BO { [LogicName("扣重")] public decimal? SubWeight { get; set; } + [LogicName("头数")] + public decimal? Number { get; set; } + [LogicName("顺序号")] public long Sequence { get; set; } @@ -45,16 +48,23 @@ namespace BO { [LogicName("批次")] public string GoodsBatchName { get; set; } + public long? GoodsBatchID { get; set; } + [DbColumn(DefaultValue = 0)] public long Mac { get; set; } [DbColumn(DefaultValue = 0)] public bool IsExport { get; set; } - + [DbColumn(DefaultValue = 0)] public bool LastExportFail { get; set; } [DbColumn(Index = IndexType.Normal)] public long? SourceID { get; set; } + + public short? DmoTypeID { get; set; } + + [LogicName("B3单据号")] + public long? DmoID { get; set; } } } diff --git a/白条称重客户端.docx b/白条称重客户端.docx index b211123..a9d416c 100644 Binary files a/白条称重客户端.docx and b/白条称重客户端.docx differ