From c5184311e0da911ee20b8062a39dc9c7226fc434 Mon Sep 17 00:00:00 2001 From: yibo <361071264@qq.com> Date: Mon, 20 Nov 2017 18:07:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=8C=E6=B2=A1=E5=A4=84?= =?UTF-8?q?=E7=90=86=E5=AE=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BO/BO.csproj | 1 + .../GradeAndWeight/OrderGradeFinishRelate.cs | 42 + BO/Utils/AfterLoginUtil.cs | 44 +- BO/Utils/BillRpc/GradeAndWeightRpc.cs | 184 ++--- ButcherManageClient/Login.cs | 2 +- .../AbnormalModifyForm.Designer.cs | 337 -------- WeighAndGrading/AbnormalModifyForm.cs | 242 ------ WeighAndGrading/AbnormalModifyForm.resx | 141 ---- WeighAndGrading/DataConfirm.Designer.cs | 72 +- WeighAndGrading/DataConfirm.cs | 50 +- WeighAndGrading/GradeContext.cs | 2 - WeighAndGrading/GradeFrom.Designer.cs | 493 ++++++------ WeighAndGrading/GradeFrom.cs | 734 ++---------------- WeighAndGrading/GradeFrom.resx | 10 +- WeighAndGrading/GradeSettingFrom.Designer.cs | 32 +- WeighAndGrading/GradeSettingFrom.cs | 13 - WeighAndGrading/WeighAndGrading.csproj | 9 - 17 files changed, 552 insertions(+), 1856 deletions(-) create mode 100644 BO/BO/Bill/GradeAndWeight/OrderGradeFinishRelate.cs delete mode 100644 WeighAndGrading/AbnormalModifyForm.Designer.cs delete mode 100644 WeighAndGrading/AbnormalModifyForm.cs delete mode 100644 WeighAndGrading/AbnormalModifyForm.resx diff --git a/BO/BO.csproj b/BO/BO.csproj index 73d813d..4b1b525 100644 --- a/BO/BO.csproj +++ b/BO/BO.csproj @@ -74,6 +74,7 @@ + diff --git a/BO/BO/Bill/GradeAndWeight/OrderGradeFinishRelate.cs b/BO/BO/Bill/GradeAndWeight/OrderGradeFinishRelate.cs new file mode 100644 index 0000000..bfe8742 --- /dev/null +++ b/BO/BO/Bill/GradeAndWeight/OrderGradeFinishRelate.cs @@ -0,0 +1,42 @@ +using Forks.EnterpriseServices.DomainObjects2; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BO.BO.Bill +{ + [MapToTable("OrderGradeFinishRelate")] + public class OrderGradeFinishRelate + { + public OrderGradeFinishRelate(int order, DateTime date, short technics) + { + Order = order; + Date = date; + Technics = technics; + } + + public int Order { get; set; } + + public DateTime Date { get; set; } + + public short Technics { get; set; } + } + + /*USE [LocalClientService] +GO + +SET ANSI_NULLS ON +GO + +SET QUOTED_IDENTIFIER ON +GO + +CREATE TABLE [dbo].[OrderGradeFinishRelate]( + [Date] [smalldatetime] NOT NULL, + [Technics] [smallint] NOT NULL, + [Order] [int] NOT NULL, +) +GO*/ +} diff --git a/BO/Utils/AfterLoginUtil.cs b/BO/Utils/AfterLoginUtil.cs index 386d292..1ecc9bc 100644 --- a/BO/Utils/AfterLoginUtil.cs +++ b/BO/Utils/AfterLoginUtil.cs @@ -18,27 +18,27 @@ namespace BO.Utils public static class AfterLoginUtil { -// -// static List> roleToAssemblies = new List>(){new Tuple("排宰员",@"C:\BwpB3Project\src\B3ButcherManageClient\ButcherOrder\bin\Debug\ButcherOrder"), -// new Tuple("过磅员",@"C:\BwpB3Project\src\B3ButcherManageClient\ButcherWeight\bin\Debug\ButcherWeight"), -// new Tuple("验质员",@"C:\BwpB3Project\src\B3ButcherManageClient\QualityAndOrder\bin\Debug\QualityAndOrder"), -// new Tuple("定级员",@"C:\BwpB3Project\src\B3ButcherManageClient\WeighAndGrading\bin\Debug\WeighAndGrading"), -// new Tuple("窒晕员",@"C:\BwpB3Project\src\B3ButcherManageClient\OrderConfirm\bin\Debug\OrderConfirm"), -// new Tuple("掉猪处理员",@"C:\BwpB3Project\src\B3ButcherManageClient\DropPigReOrder\bin\Debug\DropPigReOrder"), -// new Tuple("配货员",@"D:\BWP\BWPB3\src\B3ButcherManageClient\Distribution\bin\Debug\Distribution") -// -// }; - static List> roleToAssemblies = new List>() - { - new Tuple("排宰员",@"\ButcherOrder"), - new Tuple("过磅员",@"ButcherWeight"), - new Tuple("验质员",@"QualityAndOrder"), - new Tuple("定级员",@"WeighAndGrading"), - new Tuple("窒晕员",@"OrderConfirm"), - new Tuple("掉猪处理员",@"DropPigReOrder"), - // new Tuple("定级员",@"C:\B3\src\B3ButcherManageClient\CarcassStateWeight\bin\Debug\CarcassStateWeight") - }; + static List> roleToAssemblies = new List>(){new Tuple("排宰员",@"C:\BwpB3Project\src\B3ButcherManageClient\ButcherOrder\bin\Debug\ButcherOrder"), + new Tuple("过磅员",@"C:\BwpB3Project\src\B3ButcherManageClient\ButcherWeight\bin\Debug\ButcherWeight"), + new Tuple("验质员",@"C:\BwpB3Project\src\B3ButcherManageClient\QualityAndOrder\bin\Debug\QualityAndOrder"), + new Tuple("定级员",@"C:\BwpB3Project\src\B3ButcherManageClient\WeighAndGrading\bin\Debug\WeighAndGrading"), + new Tuple("窒晕员",@"C:\BwpB3Project\src\B3ButcherManageClient\OrderConfirm\bin\Debug\OrderConfirm"), + new Tuple("掉猪处理员",@"C:\BwpB3Project\src\B3ButcherManageClient\DropPigReOrder\bin\Debug\DropPigReOrder"), + new Tuple("配货员",@"D:\BWP\BWPB3\src\B3ButcherManageClient\Distribution\bin\Debug\Distribution") + + }; + + //static List> roleToAssemblies = new List>() + // { + // new Tuple("排宰员",@"\ButcherOrder"), + // new Tuple("过磅员",@"ButcherWeight"), + // new Tuple("验质员",@"QualityAndOrder"), + // new Tuple("定级员",@"WeighAndGrading"), + // new Tuple("窒晕员",@"OrderConfirm"), + // new Tuple("掉猪处理员",@"DropPigReOrder"), + //// new Tuple("定级员",@"C:\B3\src\B3ButcherManageClient\CarcassStateWeight\bin\Debug\CarcassStateWeight") + // }; @@ -48,10 +48,10 @@ namespace BO.Utils if (first == null) throw new Exception("未注册的角色"); //#if debug -// var filePath = string.Format("{0}.dll", first.Item2); + var filePath = string.Format("{0}.dll", first.Item2); //#endif //#if !debug - var filePath = Path.Combine(Application.StartupPath, string.Format("{0}.dll", first.Item2)); + //var filePath = Path.Combine(Application.StartupPath, string.Format("{0}.dll", first.Item2)); //#endif if (!File.Exists(filePath)) throw new Exception("相关模块不存在"); diff --git a/BO/Utils/BillRpc/GradeAndWeightRpc.cs b/BO/Utils/BillRpc/GradeAndWeightRpc.cs index 7efad85..f583f94 100644 --- a/BO/Utils/BillRpc/GradeAndWeightRpc.cs +++ b/BO/Utils/BillRpc/GradeAndWeightRpc.cs @@ -28,17 +28,36 @@ namespace BO.Utils.BillRpc short type = 1; if (isTang) type = 0; - var sum = GetSumNumber(date, type); + var sum = GetAlreadyNumber(date, type); + var finish = GetFinishRelate(date, type); foreach (var item in list) { var first = sum.FirstOrDefault(x => x.Item1 == item.Order); if (first != null) item.Already = first.Item2; + item.Finish = finish.Contains(item.Order); } return list; } - static List> GetSumNumber(DateTime date, short type) + static List GetFinishRelate(DateTime date, short type) + { + var query = new DQueryDom(new JoinAlias(typeof(OrderGradeFinishRelate))); + query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Date", date), DQCondition.EQ("Technics", type))); + query.Columns.Add(DQSelectColumn.Field("Order")); + var list = new List(); + using (var session = LocalDmoSession.New()) + { + using (var reader = session.ExecuteReader(query)) + { + while (reader.Read()) + list.Add((int)reader[0]); + } + } + return list; + } + + static List> GetAlreadyNumber(DateTime date, short type) { var query = new DQueryDom(new JoinAlias(typeof(GradeAndWeight_Detail))); query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("IsDeleted", false), DQCondition.EQ("Date", date), DQCondition.EQ("Technics", type), DQCondition.IsNotNull(DQExpression.Field("Order")))); @@ -57,12 +76,6 @@ namespace BO.Utils.BillRpc } } - public static void SetGradeFinish(long orderDetailID, short technics) - { - const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/GradeAndWeightRpc/SetGradeFinish"; - RpcFacade.Call(method, orderDetailID, technics); - } - public static List GetBodyDiscontItem() { const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/GradeAndWeightRpc/GetBodyDiscontItemSetting"; @@ -88,38 +101,31 @@ namespace BO.Utils.BillRpc { static JavaScriptSerializer serializer = new JavaScriptSerializer(); - public static void ClearWeightBySID(long sid) + public static void SetGradeFinish(int order, DateTime date, short technics) { - var updateDom = new DQUpdateDom(typeof(GradeAndWeight_Detail)); - updateDom.Where.Conditions.Add(DQCondition.EQ("SID", sid)); - updateDom.Columns.Add(new DQUpdateColumn("Weight", DQExpression.NULL)); - updateDom.Columns.Add(new DQUpdateColumn("Sync", false)); using (var session = LocalDmoSession.New()) { - session.ExecuteNonQuery(updateDom); + if (Finished(session, date, order, technics)) + return; + session.Insert(new OrderGradeFinishRelate(order, date, technics)); session.Commit(); } } - public static void DeleteBySID(long sid) + static bool Finished(IDmoSession session, DateTime date, int order, short technics) { - var updateDom = new DQUpdateDom(typeof(GradeAndWeight_Detail)); - updateDom.Where.Conditions.Add(DQCondition.EQ("SID", sid)); - updateDom.Columns.Add(new DQUpdateColumn("IsDeleted", true)); - updateDom.Columns.Add(new DQUpdateColumn("Sync", false)); - using (var session = LocalDmoSession.New()) - { - session.ExecuteNonQuery(updateDom); - session.Commit(); - } + var query = new DQueryDom(new JoinAlias(typeof(OrderGradeFinishRelate))); + query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Order", order), DQCondition.EQ("Date", date), DQCondition.EQ("Technics", technics))); + query.Columns.Add(DQSelectColumn.Create(DQExpression.Field("1"), "c")); + return session.ExecuteScalar(query) != null; } - public static void UpdateLosted(long sid) + public static void DeleteBySID(long sid) { var updateDom = new DQUpdateDom(typeof(GradeAndWeight_Detail)); updateDom.Where.Conditions.Add(DQCondition.EQ("SID", sid)); - updateDom.Columns.Add(new DQUpdateColumn("IsLostWeight", true)); - + updateDom.Columns.Add(new DQUpdateColumn("IsDeleted", true)); + updateDom.Columns.Add(new DQUpdateColumn("Sync", false)); using (var session = LocalDmoSession.New()) { session.ExecuteNonQuery(updateDom); @@ -130,7 +136,6 @@ namespace BO.Utils.BillRpc public static BindingList GetDetails(DateTime date, int top = 15) { var bindList = new BindingList(); - // var bindList=new BlockingCollection(); var list = new List(); var query = new DmoQuery(typeof(GradeAndWeight_Detail)); @@ -148,28 +153,6 @@ namespace BO.Utils.BillRpc return bindList; } - public static int GetSumNumber(DateTime date, short type) - { - var query = new DQueryDom(new JoinAlias(typeof(GradeAndWeight_Detail))); - query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("IsDeleted", false), DQCondition.EQ("Technics", type), DQCondition.EQ("Date", date))); - query.Columns.Add(DQSelectColumn.Count()); - using (var session = LocalDmoSession.New()) - { - return Convert.ToInt32(session.ExecuteScalar(query)); - } - } - - //public static int GetSumNumber(long orderID, short type) - //{ - // var query = new DQueryDom(new JoinAlias(typeof(GradeAndWeight_Detail))); - // query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("IsDeleted", false), DQCondition.EQ("Technics", type), DQCondition.EQ("OrderDetail_ID", orderID))); - // query.Columns.Add(DQSelectColumn.Count()); - // using (var session = LocalDmoSession.New()) - // { - // return Convert.ToInt32(session.ExecuteScalar(query)); - // } - //} - public static List> GetSumNumber(DateTime date, int? order, short? type) { var query = new DQueryDom(new JoinAlias(typeof(GradeAndWeight_Detail))); @@ -199,30 +182,6 @@ namespace BO.Utils.BillRpc } } - public static decimal GetSumWeight(DateTime date) - { - var query = new DQueryDom(new JoinAlias(typeof(GradeAndWeight_Detail))); - query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("IsDeleted", false), DQCondition.EQ("Date", date))); - - query.Columns.Add(DQSelectColumn.Sum("Weight")); - using (var session = LocalDmoSession.New()) - { - return Convert.ToDecimal(session.ExecuteScalar(query)); - } - } - - public static List GetLostWeightDetails(DateTime date) - { - var query = new DmoQuery(typeof(GradeAndWeight_Detail)); - query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("IsDeleted", false), DQCondition.EQ("IsLostWeight", true), DQCondition.EQ("Date", date))); - query.OrderBy.Expressions.Add(DQOrderByExpression.Create("Index", true)); - - using (var session = LocalDmoSession.New()) - { - return session.ExecuteList(query).Cast().ToList(); - } - } - public static void Insert(GradeAndWeight_Detail detail) { using (var session = LocalDmoSession.New()) @@ -236,7 +195,6 @@ namespace BO.Utils.BillRpc public static void Update(GradeAndWeight_Detail detail, params string[] properties) { - var type = typeof(GradeAndWeight_Detail); using (var session = LocalDmoSession.New()) { if (detail.SID == 0) @@ -245,16 +203,14 @@ namespace BO.Utils.BillRpc throw new Exception("ID不能通过该方法维护"); if (properties.Length == 0) throw new Exception("Update时要给出属性数组"); + + var type = typeof(GradeAndWeight_Detail); var update = new DQUpdateDom(type); update.Where.Conditions.Add(DQCondition.EQ("SID", detail.SID)); foreach (var p in properties) { - // if (p == "Sync" && detail.Sync) - // detail.Sync = false; update.Columns.Add(new DQUpdateColumn(p, type.GetProperty(p).GetValue(detail))); } - - //只要修改就设置 Sync为False update.Columns.Add(new DQUpdateColumn("Sync", false)); session.ExecuteNonQuery(update); @@ -340,16 +296,6 @@ namespace BO.Utils.BillRpc } } - public static void SaveWeightData(decimal weight) - { - using (var session = LocalDmoSession.New()) - { - var record = new WeightData { Weight = weight, Time = DateTime.Now }; - session.Insert(record); - session.Commit(); - } - } - public static int GetTodayTotalCount(DateTime date) { var query = new DQueryDom(new JoinAlias(typeof(GradeAndWeight_Detail))); @@ -370,7 +316,7 @@ namespace BO.Utils.BillRpc if (index.HasValue) query.Where.Conditions.Add(DQCondition.EQ("Index", index)); if (type.HasValue) - query.Where.Conditions.Add(DQCondition.EQ("Technics", type)); + query.Where.Conditions.Add(DQCondition.Or(DQCondition.IsNull(DQExpression.Field("Technics")), DQCondition.EQ("Technics", type))); using (var session = LocalDmoSession.New()) { return session.ExecuteList(query).Cast().ToList(); @@ -379,34 +325,46 @@ namespace BO.Utils.BillRpc public static void InsertOrUpdate(GradeAndWeight_Detail entity) { - using (var session = LocalDmoSession.New()) + if (entity.Technics_Name == "烫褪") + entity.Technics = 0; + else + entity.Technics = 1; + if (entity.SID == 0) { - if (entity.Technics_Name == "烫褪") - entity.Technics = 0; - else - entity.Technics = 1; - - if (entity.SID == 0) + using (var session = LocalDmoSession.New()) { session.Insert(entity); + session.Commit(); } - else - { - entity.Sync = false; - var update = new DQUpdateDom(typeof(GradeAndWeight_Detail)); - update.Columns.Add(new DQUpdateColumn("Technics", entity.Technics)); - update.Columns.Add(new DQUpdateColumn("Technics_Name", entity.Technics_Name)); - update.Columns.Add(new DQUpdateColumn("Index", entity.Index)); - update.Columns.Add(new DQUpdateColumn("Order", entity.Order)); - update.Columns.Add(new DQUpdateColumn("Sync", entity.Sync)); - update.Columns.Add(new DQUpdateColumn("Weight", entity.Weight)); - update.Columns.Add(new DQUpdateColumn("Livestock_ID", entity.Livestock_ID)); - update.Columns.Add(new DQUpdateColumn("Livestock_ID", entity.Livestock_ID)); - update.Where.Conditions.Add(DQCondition.EQ("SID", entity.SID)); - session.ExecuteNonQuery(update); - } - session.Commit(); } + else + Update(entity, "Technics", "Technics_Name", "Index", "Order", "Weight", "Livestock_ID", "Livestock_Name"); } + + //static T GetPartT(IDmoSession session, string property, object value, params string[] fields) + // where T : new() + //{ + // var t = new T(); + // if (fields.Count() == 0) + // return t; + // var type = typeof(T); + // var query = new DQueryDom(new JoinAlias(type)); + // foreach (var item in fields) + // query.Columns.Add(DQSelectColumn.Field(item)); + // query.Where.Conditions.Add(DQCondition.EQ(property, value)); + // using (var reader = session.ExecuteReader(query)) + // { + // while (reader.Read()) + // { + // var idx = 0; + // foreach (var item in fields) + // { + // type.GetProperty(item).SetValue(t, reader[idx], null); + // idx++; + // } + // } + // } + // return t; + //} } } diff --git a/ButcherManageClient/Login.cs b/ButcherManageClient/Login.cs index 10476fc..6d99a7b 100644 --- a/ButcherManageClient/Login.cs +++ b/ButcherManageClient/Login.cs @@ -141,7 +141,7 @@ namespace ButcherManageClient private void Login_Load(object sender, EventArgs e) { - AutoUpdate(); + //AutoUpdate(); } } } diff --git a/WeighAndGrading/AbnormalModifyForm.Designer.cs b/WeighAndGrading/AbnormalModifyForm.Designer.cs deleted file mode 100644 index 940d8a8..0000000 --- a/WeighAndGrading/AbnormalModifyForm.Designer.cs +++ /dev/null @@ -1,337 +0,0 @@ -namespace WeighAndGrading -{ - partial class AbnormalModifyForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = 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.panel4 = new System.Windows.Forms.Panel(); - this.button1 = new System.Windows.Forms.Button(); - this.flpKeyPanel = new System.Windows.Forms.FlowLayoutPanel(); - this.uDataGridView1 = new BWP.WinFormControl.UDataGridView(); - this.H_SID = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.H_Livestock_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.H_Index = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.H_Technics = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.H_Livestock_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.H_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.H_Time = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.label1 = new System.Windows.Forms.Label(); - this.lblPaiZaiTT = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.lblPaiZaiMB = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.lblWeightTT = new System.Windows.Forms.Label(); - this.label7 = new System.Windows.Forms.Label(); - this.lblWeightMB = new System.Windows.Forms.Label(); - this.label9 = new System.Windows.Forms.Label(); - this.lblWeightWeight = new System.Windows.Forms.Label(); - this.panel4.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.uDataGridView1)).BeginInit(); - this.SuspendLayout(); - // - // panel4 - // - this.panel4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.panel4.Controls.Add(this.button1); - this.panel4.Controls.Add(this.flpKeyPanel); - this.panel4.Location = new System.Drawing.Point(504, 13); - this.panel4.Name = "panel4"; - this.panel4.Size = new System.Drawing.Size(454, 510); - this.panel4.TabIndex = 61; - // - // button1 - // - this.button1.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.button1.Location = new System.Drawing.Point(161, 434); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(129, 54); - this.button1.TabIndex = 45; - this.button1.Text = "全部修改"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // flpKeyPanel - // - this.flpKeyPanel.Location = new System.Drawing.Point(3, 22); - this.flpKeyPanel.Name = "flpKeyPanel"; - this.flpKeyPanel.Padding = new System.Windows.Forms.Padding(25, 0, 0, 0); - this.flpKeyPanel.Size = new System.Drawing.Size(446, 406); - this.flpKeyPanel.TabIndex = 43; - // - // uDataGridView1 - // - this.uDataGridView1.AllowUserToAddRows = false; - this.uDataGridView1.AllowUserToDeleteRows = false; - this.uDataGridView1.AllowUserToResizeColumns = false; - this.uDataGridView1.AllowUserToResizeRows = false; - dataGridViewCellStyle6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); - this.uDataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle6; - this.uDataGridView1.BackgroundColor = System.Drawing.Color.White; - dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle7.Font = new System.Drawing.Font("宋体", 12F); - dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.uDataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7; - this.uDataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.uDataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { - this.H_SID, - this.H_Livestock_ID, - this.H_Index, - this.H_Technics, - this.H_Livestock_Name, - this.H_Weight, - this.H_Time}); - this.uDataGridView1.Location = new System.Drawing.Point(12, 12); - this.uDataGridView1.MultiSelect = false; - this.uDataGridView1.Name = "uDataGridView1"; - this.uDataGridView1.ReadOnly = true; - this.uDataGridView1.RowHeadersVisible = false; - dataGridViewCellStyle10.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle10.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); - this.uDataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle10; - this.uDataGridView1.RowTemplate.Height = 40; - this.uDataGridView1.ScrollBars = System.Windows.Forms.ScrollBars.None; - this.uDataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.uDataGridView1.Size = new System.Drawing.Size(423, 511); - this.uDataGridView1.TabIndex = 44; - this.uDataGridView1.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.uDataGridView1_CellClick); - // - // H_SID - // - this.H_SID.DataPropertyName = "SID"; - this.H_SID.HeaderText = "SID"; - this.H_SID.Name = "H_SID"; - this.H_SID.ReadOnly = true; - this.H_SID.Visible = false; - // - // H_Livestock_ID - // - this.H_Livestock_ID.HeaderText = "Livestock_ID"; - this.H_Livestock_ID.Name = "H_Livestock_ID"; - this.H_Livestock_ID.ReadOnly = true; - this.H_Livestock_ID.Visible = false; - // - // H_Index - // - this.H_Index.DataPropertyName = "Index"; - this.H_Index.HeaderText = "序号"; - this.H_Index.Name = "H_Index"; - this.H_Index.ReadOnly = true; - this.H_Index.Width = 65; - // - // H_Technics - // - this.H_Technics.DataPropertyName = "Technics_Name"; - this.H_Technics.HeaderText = "工艺"; - this.H_Technics.Name = "H_Technics"; - this.H_Technics.ReadOnly = true; - this.H_Technics.Width = 65; - // - // H_Livestock_Name - // - this.H_Livestock_Name.DataPropertyName = "Livestock_Name"; - this.H_Livestock_Name.HeaderText = "级别"; - this.H_Livestock_Name.Name = "H_Livestock_Name"; - this.H_Livestock_Name.ReadOnly = true; - this.H_Livestock_Name.Width = 90; - // - // H_Weight - // - this.H_Weight.DataPropertyName = "Weight"; - dataGridViewCellStyle8.Format = "#0.######"; - this.H_Weight.DefaultCellStyle = dataGridViewCellStyle8; - this.H_Weight.HeaderText = "重量"; - this.H_Weight.Name = "H_Weight"; - this.H_Weight.ReadOnly = true; - this.H_Weight.Width = 70; - // - // H_Time - // - this.H_Time.DataPropertyName = "Time"; - dataGridViewCellStyle9.Format = "HH:mm:ss"; - dataGridViewCellStyle9.NullValue = null; - this.H_Time.DefaultCellStyle = dataGridViewCellStyle9; - this.H_Time.HeaderText = "时间"; - this.H_Time.Name = "H_Time"; - this.H_Time.ReadOnly = true; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label1.Location = new System.Drawing.Point(39, 547); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(76, 22); - this.label1.TabIndex = 62; - this.label1.Text = "烫褪:"; - // - // lblPaiZaiTT - // - this.lblPaiZaiTT.AutoSize = true; - this.lblPaiZaiTT.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.lblPaiZaiTT.Location = new System.Drawing.Point(105, 547); - this.lblPaiZaiTT.Name = "lblPaiZaiTT"; - this.lblPaiZaiTT.Size = new System.Drawing.Size(0, 22); - this.lblPaiZaiTT.TabIndex = 62; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label3.Location = new System.Drawing.Point(198, 547); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(76, 22); - this.label3.TabIndex = 62; - this.label3.Text = "毛剥:"; - // - // lblPaiZaiMB - // - this.lblPaiZaiMB.AutoSize = true; - this.lblPaiZaiMB.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.lblPaiZaiMB.Location = new System.Drawing.Point(266, 547); - this.lblPaiZaiMB.Name = "lblPaiZaiMB"; - this.lblPaiZaiMB.Size = new System.Drawing.Size(0, 22); - this.lblPaiZaiMB.TabIndex = 62; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label5.Location = new System.Drawing.Point(502, 547); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(76, 22); - this.label5.TabIndex = 62; - this.label5.Text = "烫褪:"; - // - // lblWeightTT - // - this.lblWeightTT.AutoSize = true; - this.lblWeightTT.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.lblWeightTT.Location = new System.Drawing.Point(566, 547); - this.lblWeightTT.Name = "lblWeightTT"; - this.lblWeightTT.Size = new System.Drawing.Size(0, 22); - this.lblWeightTT.TabIndex = 62; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label7.Location = new System.Drawing.Point(641, 547); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(76, 22); - this.label7.TabIndex = 62; - this.label7.Text = "毛剥:"; - // - // lblWeightMB - // - this.lblWeightMB.AutoSize = true; - this.lblWeightMB.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.lblWeightMB.Location = new System.Drawing.Point(707, 547); - this.lblWeightMB.Name = "lblWeightMB"; - this.lblWeightMB.Size = new System.Drawing.Size(0, 22); - this.lblWeightMB.TabIndex = 62; - // - // label9 - // - this.label9.AutoSize = true; - this.label9.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label9.Location = new System.Drawing.Point(778, 547); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(76, 22); - this.label9.TabIndex = 62; - this.label9.Text = "重量:"; - // - // lblWeightWeight - // - this.lblWeightWeight.AutoSize = true; - this.lblWeightWeight.Font = new System.Drawing.Font("宋体", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.lblWeightWeight.Location = new System.Drawing.Point(855, 547); - this.lblWeightWeight.Name = "lblWeightWeight"; - this.lblWeightWeight.Size = new System.Drawing.Size(0, 22); - this.lblWeightWeight.TabIndex = 62; - // - // AbnormalModifyForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(970, 590); - this.Controls.Add(this.lblWeightWeight); - this.Controls.Add(this.label9); - this.Controls.Add(this.lblWeightMB); - this.Controls.Add(this.label7); - this.Controls.Add(this.lblPaiZaiMB); - this.Controls.Add(this.lblWeightTT); - this.Controls.Add(this.label3); - this.Controls.Add(this.label5); - this.Controls.Add(this.lblPaiZaiTT); - this.Controls.Add(this.label1); - this.Controls.Add(this.uDataGridView1); - this.Controls.Add(this.panel4); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "AbnormalModifyForm"; - this.Text = "异常修改"; - this.Load += new System.EventHandler(this.AbnormalModifyForm_Load); - this.panel4.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.uDataGridView1)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - private System.Windows.Forms.Panel panel4; - private System.Windows.Forms.FlowLayoutPanel flpKeyPanel; - private BWP.WinFormControl.UDataGridView uDataGridView1; - private System.Windows.Forms.Button button1; - private System.Windows.Forms.DataGridViewTextBoxColumn H_SID; - private System.Windows.Forms.DataGridViewTextBoxColumn H_Livestock_ID; - private System.Windows.Forms.DataGridViewTextBoxColumn H_Index; - private System.Windows.Forms.DataGridViewTextBoxColumn H_Technics; - private System.Windows.Forms.DataGridViewTextBoxColumn H_Livestock_Name; - private System.Windows.Forms.DataGridViewTextBoxColumn H_Weight; - private System.Windows.Forms.DataGridViewTextBoxColumn H_Time; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label lblPaiZaiTT; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label lblPaiZaiMB; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label lblWeightTT; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.Label lblWeightMB; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.Label lblWeightWeight; - } -} \ No newline at end of file diff --git a/WeighAndGrading/AbnormalModifyForm.cs b/WeighAndGrading/AbnormalModifyForm.cs deleted file mode 100644 index 5343778..0000000 --- a/WeighAndGrading/AbnormalModifyForm.cs +++ /dev/null @@ -1,242 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using BO.BO.Bill; -using BO.Utils.BillRpc; - -namespace WeighAndGrading -{ - public partial class AbnormalModifyForm : Form - { - List details; - private DateTime mDate; - - GradeAndWeight_Detail mCurrentSlectItem; - public AbnormalModifyForm(DateTime date) - { - InitializeComponent(); - mDate = date; - uDataGridView1.AutoGenerateColumns = false; - } - - - private void AbnormalModifyForm_Load(object sender, EventArgs e) - { - BindGridView(); - AddKeyPad(); - if (uDataGridView1.Rows.Count > 0) - { - uDataGridView1.Rows[0].Selected = true; - var currentRow = uDataGridView1.Rows[0].DataBoundItem as GradeAndWeight_Detail; - mCurrentSlectItem = currentRow; - } - - var tangtuiList = GradeAndWeightRpc.GetGradeAndWeightList(mDate, true); - var maoboList = GradeAndWeightRpc.GetGradeAndWeightList(mDate, false); - - lblPaiZaiTT.Text = tangtuiList.Sum(x => x.Number).ToString(); - lblPaiZaiMB.Text = maoboList.Sum(x => x.Number).ToString(); - - - var tangtui = LocalGradeAndWeightBL.GetSumNumber(mDate,0); - var maobo = LocalGradeAndWeightBL.GetSumNumber(mDate, 1); - var weight = LocalGradeAndWeightBL.GetSumWeight(mDate); - - lblWeightTT.Text = tangtui.ToString(); - lblWeightMB.Text = maobo.ToString(); - lblWeightWeight.Text = weight.ToString("f2"); - } - - private void BindGridView() - { - details = LocalGradeAndWeightBL.GetLostWeightDetails(mDate); - if (details.Any()) - { - foreach (GradeAndWeight_Detail detail in details) - { - if (detail.Weight.HasValue && detail.Weight == 0) - { - detail.Weight = null; - } - - } - uDataGridView1.DataSource = details; - } - } - - - private void AddKeyPad() - { - for (var i = 1; i < 10; i++) - { - var btn = new Button() { Name = "_3" + i, Text = i.ToString(), Size = new Size(80, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 10 }, Font = new Font("宋体", 15) }; - btn.Click += (sender, e) => - { - ModifyWeight(btn.Text); - }; - flpKeyPanel.Controls.Add(btn); - } - var zero = new Button() { Name = "_30", Text = "0", Size = new Size(80, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 10 }, Font = new Font("宋体", 15) }; - zero.Click += (sender, e) => - { - ModifyWeight(zero.Text); - }; - flpKeyPanel.Controls.Add(zero); - - var dian = new Button() { Name = "_40", Text = ".", Size = new Size(80, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 10 }, Font = new Font("宋体", 15) }; - dian.Click += (sender, e) => - { - ModifyWeight(dian.Text); - }; - flpKeyPanel.Controls.Add(dian); - - var back = new Button() { Name = "_3back", Text = "←", Size = new Size(80, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 10 }, Font = new Font("宋体", 15) }; - back.Click += (sender, e) => - { - ModifyWeight(back.Text); - }; - flpKeyPanel.Controls.Add(back); - - var clear = new Button() { Name = "_3clear", Text = "清空", Size = new Size(80, 60), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 10 }, Font = new Font("宋体", 15) }; - clear.Click += (sender, e) => - { - ModifyWeight(clear.Text); - }; - flpKeyPanel.Controls.Add(clear); - - } - - // private decimal? lastWeght; - private void ModifyWeight(string input) - { - if (mCurrentSlectItem == null) - throw new Exception("请选择一条记录"); - - var destring = DecimalToString(mCurrentSlectItem.Weight); - var value = GetAfterNumber(destring, input); - mCurrentSlectItem.Weight = StringToDecimal(value); - - uDataGridView1.Refresh(); - - - } - - - decimal? StringToDecimal(string value) - { - if (string.IsNullOrWhiteSpace(value)) - { - return null; - } - value = value.Replace("..", "."); - if (value.Length > 1) - { - var last = value.Substring(value.Length - 1); - if (last == ".") - { - value += "0"; - } - } - try - { - return decimal.Parse(value); - } - catch - { - return null; - } - - } - - string DecimalToString(decimal? value) - { - if (value == null) - { - return ""; - } - - try - { - - var newvalue = value.ToString(); - if (newvalue.Length > 2) - { - var lasttwo = newvalue.Substring(newvalue.Length - 2); - if (lasttwo == ".0") - { - var intvalue = Convert.ToInt32(value); - return intvalue.ToString() + "."; - } - } - - return value.ToString() + ""; - } - catch - { - return value.ToString(); - } - } - - string GetAfterNumber(string oldValue, string input) - { - bool hasValue = !string.IsNullOrWhiteSpace(oldValue); - switch (input) - { - case ".": - if (hasValue) - return (oldValue + "."); - return null; - case "0": - if (hasValue) - return (oldValue + "0"); - return null; - case "←": - if (hasValue) - { - var s = oldValue.ToString(); - s = s.Substring(0, s.Length - 1); - if (string.IsNullOrEmpty(s)) - return null; - return (s); - } - return null; - case "清空": - return null; - default: - var sn = ""; - if (hasValue) - sn = oldValue.ToString(); - sn += input; - return (sn); - } - } - - private void button1_Click(object sender, EventArgs e) - { - foreach (GradeAndWeight_Detail detail in details.Where(x => x.Weight.HasValue)) - { - detail.IsLostWeight = false; - LocalGradeAndWeightBL.Update(detail, "Weight", "IsLostWeight"); - } - details = LocalGradeAndWeightBL.GetLostWeightDetails(mDate); - uDataGridView1.Refresh(); - MessageBox.Show("保存成功"); - DialogResult = DialogResult.OK; - Close(); - } - - private void uDataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) - { - if (e.RowIndex < 0) - return; - var currentRow = uDataGridView1.CurrentRow.DataBoundItem as GradeAndWeight_Detail; - mCurrentSlectItem = currentRow; - } - } -} diff --git a/WeighAndGrading/AbnormalModifyForm.resx b/WeighAndGrading/AbnormalModifyForm.resx deleted file mode 100644 index 1e80200..0000000 --- a/WeighAndGrading/AbnormalModifyForm.resx +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - True - - - True - - - True - - - True - - - True - - - True - - - True - - \ No newline at end of file diff --git a/WeighAndGrading/DataConfirm.Designer.cs b/WeighAndGrading/DataConfirm.Designer.cs index 0c93e2d..dcb8a54 100644 --- a/WeighAndGrading/DataConfirm.Designer.cs +++ b/WeighAndGrading/DataConfirm.Designer.cs @@ -52,7 +52,7 @@ this.L_PlanNumber = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.L_HotFadeNumber = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.L_MaoNumber = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.vScrollBar1 = new System.Windows.Forms.VScrollBar(); + this.rightVScrollBar = new System.Windows.Forms.VScrollBar(); this.ttPanel = new System.Windows.Forms.FlowLayoutPanel(); this.mbPanel = new System.Windows.Forms.FlowLayoutPanel(); this.weightGrid = new BWP.WinFormControl.UDataGridView(); @@ -76,6 +76,7 @@ this.maoW = new System.Windows.Forms.Label(); this.tangBtn = new System.Windows.Forms.Button(); this.maoBtn = new System.Windows.Forms.Button(); + this.leftVScrollBar = new System.Windows.Forms.VScrollBar(); ((System.ComponentModel.ISupportInitialize)(this.orderGridView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.weightGrid)).BeginInit(); this.SuspendLayout(); @@ -137,7 +138,7 @@ // rightOrder // this.rightOrder.Font = new System.Drawing.Font("宋体", 20F); - this.rightOrder.Location = new System.Drawing.Point(867, 18); + this.rightOrder.Location = new System.Drawing.Point(936, 18); this.rightOrder.Name = "rightOrder"; this.rightOrder.Size = new System.Drawing.Size(100, 38); this.rightOrder.TabIndex = 10; @@ -147,7 +148,7 @@ // this.label3.AutoSize = true; this.label3.Font = new System.Drawing.Font("宋体", 15F); - this.label3.Location = new System.Drawing.Point(772, 27); + this.label3.Location = new System.Drawing.Point(841, 27); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(89, 20); this.label3.TabIndex = 9; @@ -156,7 +157,7 @@ // rightBtn // this.rightBtn.Font = new System.Drawing.Font("宋体", 15F); - this.rightBtn.Location = new System.Drawing.Point(1191, 15); + this.rightBtn.Location = new System.Drawing.Point(1294, 15); this.rightBtn.Name = "rightBtn"; this.rightBtn.Size = new System.Drawing.Size(149, 41); this.rightBtn.TabIndex = 8; @@ -167,7 +168,7 @@ // rightIndex // this.rightIndex.Font = new System.Drawing.Font("宋体", 20F); - this.rightIndex.Location = new System.Drawing.Point(1068, 18); + this.rightIndex.Location = new System.Drawing.Point(1154, 18); this.rightIndex.Name = "rightIndex"; this.rightIndex.Size = new System.Drawing.Size(100, 38); this.rightIndex.TabIndex = 12; @@ -177,7 +178,7 @@ // this.label4.AutoSize = true; this.label4.Font = new System.Drawing.Font("宋体", 15F); - this.label4.Location = new System.Drawing.Point(986, 27); + this.label4.Location = new System.Drawing.Point(1072, 27); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(69, 20); this.label4.TabIndex = 11; @@ -219,7 +220,7 @@ this.orderGridView.RowTemplate.Height = 60; this.orderGridView.ScrollBars = System.Windows.Forms.ScrollBars.None; this.orderGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.orderGridView.Size = new System.Drawing.Size(368, 591); + this.orderGridView.Size = new System.Drawing.Size(368, 617); this.orderGridView.TabIndex = 13; this.orderGridView.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.orderGridView_CellClick); // @@ -255,23 +256,23 @@ this.L_MaoNumber.ReadOnly = true; this.L_MaoNumber.Width = 90; // - // vScrollBar1 + // rightVScrollBar // - this.vScrollBar1.Location = new System.Drawing.Point(1300, 185); - this.vScrollBar1.Name = "vScrollBar1"; - this.vScrollBar1.Size = new System.Drawing.Size(40, 499); - this.vScrollBar1.TabIndex = 52; + this.rightVScrollBar.Location = new System.Drawing.Point(1403, 185); + this.rightVScrollBar.Name = "rightVScrollBar"; + this.rightVScrollBar.Size = new System.Drawing.Size(40, 525); + this.rightVScrollBar.TabIndex = 52; // // ttPanel // - this.ttPanel.Location = new System.Drawing.Point(393, 116); + this.ttPanel.Location = new System.Drawing.Point(461, 116); this.ttPanel.Name = "ttPanel"; this.ttPanel.Size = new System.Drawing.Size(337, 276); this.ttPanel.TabIndex = 53; // // mbPanel // - this.mbPanel.Location = new System.Drawing.Point(393, 406); + this.mbPanel.Location = new System.Drawing.Point(461, 432); this.mbPanel.Name = "mbPanel"; this.mbPanel.Size = new System.Drawing.Size(337, 278); this.mbPanel.TabIndex = 54; @@ -303,7 +304,7 @@ this.H_Weight, this.H_Time, this.H_Save}); - this.weightGrid.Location = new System.Drawing.Point(740, 185); + this.weightGrid.Location = new System.Drawing.Point(843, 185); this.weightGrid.MultiSelect = false; this.weightGrid.Name = "weightGrid"; this.weightGrid.ReadOnly = true; @@ -314,7 +315,7 @@ this.weightGrid.RowTemplate.Height = 65; this.weightGrid.ScrollBars = System.Windows.Forms.ScrollBars.None; this.weightGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.weightGrid.Size = new System.Drawing.Size(557, 499); + this.weightGrid.Size = new System.Drawing.Size(557, 525); this.weightGrid.TabIndex = 55; this.weightGrid.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.weightGrid_CellClick); this.weightGrid.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.weightGrid_CellContentClick); @@ -394,7 +395,7 @@ // this.label5.AutoSize = true; this.label5.Font = new System.Drawing.Font("宋体", 15F); - this.label5.Location = new System.Drawing.Point(755, 76); + this.label5.Location = new System.Drawing.Point(841, 75); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(69, 20); this.label5.TabIndex = 56; @@ -404,7 +405,7 @@ // this.label6.AutoSize = true; this.label6.Font = new System.Drawing.Font("宋体", 15F); - this.label6.Location = new System.Drawing.Point(887, 78); + this.label6.Location = new System.Drawing.Point(1036, 78); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(69, 20); this.label6.TabIndex = 57; @@ -415,7 +416,7 @@ this.tangNumber.AutoSize = true; this.tangNumber.Font = new System.Drawing.Font("宋体", 18F); this.tangNumber.ForeColor = System.Drawing.Color.Red; - this.tangNumber.Location = new System.Drawing.Point(820, 74); + this.tangNumber.Location = new System.Drawing.Point(911, 74); this.tangNumber.Name = "tangNumber"; this.tangNumber.Size = new System.Drawing.Size(22, 24); this.tangNumber.TabIndex = 58; @@ -426,7 +427,7 @@ this.maoNumber.AutoSize = true; this.maoNumber.Font = new System.Drawing.Font("宋体", 18F); this.maoNumber.ForeColor = System.Drawing.Color.Red; - this.maoNumber.Location = new System.Drawing.Point(952, 75); + this.maoNumber.Location = new System.Drawing.Point(1101, 75); this.maoNumber.Name = "maoNumber"; this.maoNumber.Size = new System.Drawing.Size(22, 24); this.maoNumber.TabIndex = 59; @@ -437,7 +438,7 @@ this.label7.AutoSize = true; this.label7.Font = new System.Drawing.Font("宋体", 15F); this.label7.ForeColor = System.Drawing.Color.Red; - this.label7.Location = new System.Drawing.Point(390, 95); + this.label7.Location = new System.Drawing.Point(465, 91); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(69, 20); this.label7.TabIndex = 60; @@ -448,7 +449,7 @@ this.label8.AutoSize = true; this.label8.Font = new System.Drawing.Font("宋体", 15F); this.label8.ForeColor = System.Drawing.Color.Red; - this.label8.Location = new System.Drawing.Point(390, 383); + this.label8.Location = new System.Drawing.Point(465, 407); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(69, 20); this.label8.TabIndex = 61; @@ -457,7 +458,7 @@ // AddBtn // this.AddBtn.Font = new System.Drawing.Font("宋体", 15F); - this.AddBtn.Location = new System.Drawing.Point(1191, 73); + this.AddBtn.Location = new System.Drawing.Point(1294, 73); this.AddBtn.Name = "AddBtn"; this.AddBtn.Size = new System.Drawing.Size(149, 39); this.AddBtn.TabIndex = 62; @@ -468,7 +469,7 @@ // deleteBtn // this.deleteBtn.Font = new System.Drawing.Font("宋体", 15F); - this.deleteBtn.Location = new System.Drawing.Point(1019, 73); + this.deleteBtn.Location = new System.Drawing.Point(1294, 128); this.deleteBtn.Name = "deleteBtn"; this.deleteBtn.Size = new System.Drawing.Size(149, 39); this.deleteBtn.TabIndex = 63; @@ -481,7 +482,7 @@ this.tangW.AutoSize = true; this.tangW.Font = new System.Drawing.Font("宋体", 18F); this.tangW.ForeColor = System.Drawing.Color.Red; - this.tangW.Location = new System.Drawing.Point(799, 108); + this.tangW.Location = new System.Drawing.Point(888, 108); this.tangW.Name = "tangW"; this.tangW.Size = new System.Drawing.Size(22, 24); this.tangW.TabIndex = 66; @@ -492,7 +493,7 @@ this.maoW.AutoSize = true; this.maoW.Font = new System.Drawing.Font("宋体", 18F); this.maoW.ForeColor = System.Drawing.Color.Red; - this.maoW.Location = new System.Drawing.Point(926, 108); + this.maoW.Location = new System.Drawing.Point(1073, 108); this.maoW.Name = "maoW"; this.maoW.Size = new System.Drawing.Size(22, 24); this.maoW.TabIndex = 67; @@ -501,7 +502,7 @@ // tangBtn // this.tangBtn.Font = new System.Drawing.Font("宋体", 15F); - this.tangBtn.Location = new System.Drawing.Point(824, 140); + this.tangBtn.Location = new System.Drawing.Point(842, 140); this.tangBtn.Name = "tangBtn"; this.tangBtn.Size = new System.Drawing.Size(149, 39); this.tangBtn.TabIndex = 68; @@ -512,7 +513,7 @@ // maoBtn // this.maoBtn.Font = new System.Drawing.Font("宋体", 15F); - this.maoBtn.Location = new System.Drawing.Point(1019, 140); + this.maoBtn.Location = new System.Drawing.Point(1037, 140); this.maoBtn.Name = "maoBtn"; this.maoBtn.Size = new System.Drawing.Size(149, 39); this.maoBtn.TabIndex = 69; @@ -520,11 +521,19 @@ this.maoBtn.UseVisualStyleBackColor = true; this.maoBtn.Click += new System.EventHandler(this.maoBtn_Click); // + // leftVScrollBar + // + this.leftVScrollBar.Location = new System.Drawing.Point(384, 93); + this.leftVScrollBar.Name = "leftVScrollBar"; + this.leftVScrollBar.Size = new System.Drawing.Size(40, 617); + this.leftVScrollBar.TabIndex = 70; + // // DataConfirm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1362, 741); + this.ClientSize = new System.Drawing.Size(1471, 741); + this.Controls.Add(this.leftVScrollBar); this.Controls.Add(this.maoBtn); this.Controls.Add(this.tangBtn); this.Controls.Add(this.maoW); @@ -537,7 +546,7 @@ this.Controls.Add(this.tangNumber); this.Controls.Add(this.label6); this.Controls.Add(this.label5); - this.Controls.Add(this.vScrollBar1); + this.Controls.Add(this.rightVScrollBar); this.Controls.Add(this.weightGrid); this.Controls.Add(this.mbPanel); this.Controls.Add(this.ttPanel); @@ -577,7 +586,7 @@ private BWP.WinFormControl.UTextBoxWithPad rightIndex; private System.Windows.Forms.Label label4; private BWP.WinFormControl.UDataGridView orderGridView; - private System.Windows.Forms.VScrollBar vScrollBar1; + private System.Windows.Forms.VScrollBar rightVScrollBar; private System.Windows.Forms.FlowLayoutPanel ttPanel; private System.Windows.Forms.FlowLayoutPanel mbPanel; private BWP.WinFormControl.UDataGridView weightGrid; @@ -605,5 +614,6 @@ private System.Windows.Forms.Label maoW; private System.Windows.Forms.Button tangBtn; private System.Windows.Forms.Button maoBtn; + private System.Windows.Forms.VScrollBar leftVScrollBar; } } \ No newline at end of file diff --git a/WeighAndGrading/DataConfirm.cs b/WeighAndGrading/DataConfirm.cs index 9ae7c57..f1a38e5 100644 --- a/WeighAndGrading/DataConfirm.cs +++ b/WeighAndGrading/DataConfirm.cs @@ -38,6 +38,16 @@ namespace WeighAndGrading order = int.Parse(leftOrder.Text); leftList = GradeAndWeightRpc.GetDataConfirmList(uDatePicker1.Date.Value, order); orderGridView.DataSource = leftList; + InitLeftScrollBar(); + try + { + if (leftRollIdx != -1) + orderGridView.FirstDisplayedScrollingRowIndex = leftRollIdx; + } + catch + { + leftRollIdx = -1; + } orderGridView.Refresh(); } @@ -57,15 +67,15 @@ namespace WeighAndGrading idx = int.Parse(rightIndex.Text); weightList = LocalGradeAndWeightBL.GetGradeAndWeightDetails(uDatePicker1.Date.Value, order, idx, type); weightGrid.DataSource = weightList; - InitTangScrollBar(); + InitRightScrollBar(); try { - if (rollIdx != -1) - weightGrid.FirstDisplayedScrollingRowIndex = rollIdx; + if (rightRollIdx != -1) + weightGrid.FirstDisplayedScrollingRowIndex = rightRollIdx; } catch { - rollIdx = -1; + rightRollIdx = -1; } weightGrid.Refresh(); var number = LocalGradeAndWeightBL.GetSumNumber(uDatePicker1.Date.Value, order, null); @@ -209,17 +219,31 @@ namespace WeighAndGrading rightBtn_Click(sender, EventArgs.Empty); } - int rollIdx = -1; - private void InitTangScrollBar() + int rightRollIdx = -1; + private void InitRightScrollBar() + { + rightVScrollBar.Maximum = (weightGrid.RowCount - weightGrid.DisplayedRowCount(false) + 30) * weightGrid.RowTemplate.Height; + rightVScrollBar.Minimum = 0; + rightVScrollBar.SmallChange = weightGrid.RowTemplate.Height; + rightVScrollBar.LargeChange = weightGrid.RowTemplate.Height * 30; + this.rightVScrollBar.Scroll += (sender, e) => + { + rightRollIdx = e.NewValue / weightGrid.RowTemplate.Height; + weightGrid.FirstDisplayedScrollingRowIndex = rightRollIdx; + }; + } + + int leftRollIdx = -1; + private void InitLeftScrollBar() { - vScrollBar1.Maximum = (weightGrid.RowCount - weightGrid.DisplayedRowCount(false) + 30) * weightGrid.RowTemplate.Height; - vScrollBar1.Minimum = 0; - vScrollBar1.SmallChange = weightGrid.RowTemplate.Height; - vScrollBar1.LargeChange = weightGrid.RowTemplate.Height * 30; - this.vScrollBar1.Scroll += (sender, e) => + leftVScrollBar.Maximum = (orderGridView.RowCount - orderGridView.DisplayedRowCount(false) + 30) * orderGridView.RowTemplate.Height; + leftVScrollBar.Minimum = 0; + leftVScrollBar.SmallChange = orderGridView.RowTemplate.Height; + leftVScrollBar.LargeChange = orderGridView.RowTemplate.Height * 30; + this.leftVScrollBar.Scroll += (sender, e) => { - rollIdx = e.NewValue / weightGrid.RowTemplate.Height; - weightGrid.FirstDisplayedScrollingRowIndex = rollIdx; + leftRollIdx = e.NewValue / orderGridView.RowTemplate.Height; + orderGridView.FirstDisplayedScrollingRowIndex = leftRollIdx; }; } diff --git a/WeighAndGrading/GradeContext.cs b/WeighAndGrading/GradeContext.cs index 76d305b..f5aec70 100644 --- a/WeighAndGrading/GradeContext.cs +++ b/WeighAndGrading/GradeContext.cs @@ -77,7 +77,5 @@ namespace WeighAndGrading public decimal MinWeight { get; set; } public decimal MaxWeight { get; set; } - - public decimal AllowInterval{ get; set; }//当固定值发送数据的时候 设置称 多少秒接受数据 } } diff --git a/WeighAndGrading/GradeFrom.Designer.cs b/WeighAndGrading/GradeFrom.Designer.cs index 8eeccb0..b086054 100644 --- a/WeighAndGrading/GradeFrom.Designer.cs +++ b/WeighAndGrading/GradeFrom.Designer.cs @@ -28,19 +28,19 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle53 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle54 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle56 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle55 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle57 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle58 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle60 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle59 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle61 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle62 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle65 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle63 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle64 = 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 dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); this.label1 = new System.Windows.Forms.Label(); this.syncBtn = new System.Windows.Forms.Button(); this.label2 = new System.Windows.Forms.Label(); @@ -70,23 +70,9 @@ this.mbPanel = new System.Windows.Forms.FlowLayoutPanel(); this.lblMaoBo = new System.Windows.Forms.Label(); this.groupBox3 = new System.Windows.Forms.GroupBox(); - this.lblHeJi = new System.Windows.Forms.Label(); this.vScrollBar2 = new System.Windows.Forms.VScrollBar(); this.label12 = new System.Windows.Forms.Label(); this.historyGrid = new BWP.WinFormControl.UDataGridView(); - this.H_SID = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.H_Livestock_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.IsLostWeight = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.H_IsDrop = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.H_ReadWeight = new System.Windows.Forms.DataGridViewCheckBoxColumn(); - this.H_Index = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.H_Order = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.H_Technics = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.H_Livestock_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.H_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.H_Time = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.H_OrderDetail_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.enableWeight = new System.Windows.Forms.CheckBox(); this.isPrintCheckBox = new System.Windows.Forms.CheckBox(); this.printBtn = new System.Windows.Forms.Button(); this.panel1 = new System.Windows.Forms.Panel(); @@ -101,11 +87,26 @@ this.statePic = new System.Windows.Forms.PictureBox(); this.btnDeleteSelected = new System.Windows.Forms.Button(); this.lblSucessed = new System.Windows.Forms.Label(); - this.btnClearWeight = new System.Windows.Forms.Button(); this.dropPigBtn = new System.Windows.Forms.Button(); this.btnStartWeight = new System.Windows.Forms.Button(); this.btnStopWeight = new System.Windows.Forms.Button(); this.dataConfirmBtn = new System.Windows.Forms.Button(); + this.H_SID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.H_Livestock_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.H_IsDrop = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.H_Technics = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.H_Index = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.H_Order = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.H_Technics_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.H_Livestock_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.H_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.H_Time = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.label5 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.tangGridView)).BeginInit(); this.groupBox2.SuspendLayout(); @@ -221,17 +222,17 @@ this.tangGridView.AllowUserToDeleteRows = false; this.tangGridView.AllowUserToResizeColumns = false; this.tangGridView.AllowUserToResizeRows = false; - dataGridViewCellStyle53.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); - this.tangGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle53; + dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.tangGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; this.tangGridView.BackgroundColor = System.Drawing.Color.White; - dataGridViewCellStyle54.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle54.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle54.Font = new System.Drawing.Font("宋体", 12F); - dataGridViewCellStyle54.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle54.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle54.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle54.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.tangGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle54; + dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 12F); + dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.tangGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; this.tangGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.tangGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.T_OrderDetail_ID, @@ -245,11 +246,11 @@ this.tangGridView.Name = "tangGridView"; this.tangGridView.ReadOnly = true; this.tangGridView.RowHeadersVisible = false; - dataGridViewCellStyle56.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle56.ForeColor = System.Drawing.Color.Black; - dataGridViewCellStyle56.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); - dataGridViewCellStyle56.SelectionForeColor = System.Drawing.Color.Black; - this.tangGridView.RowsDefaultCellStyle = dataGridViewCellStyle56; + dataGridViewCellStyle4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle4.ForeColor = System.Drawing.Color.Black; + dataGridViewCellStyle4.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + dataGridViewCellStyle4.SelectionForeColor = System.Drawing.Color.Black; + this.tangGridView.RowsDefaultCellStyle = dataGridViewCellStyle4; this.tangGridView.RowTemplate.Height = 65; this.tangGridView.ScrollBars = System.Windows.Forms.ScrollBars.None; this.tangGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; @@ -299,9 +300,9 @@ // // T_FinishBtn // - dataGridViewCellStyle55.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle55.Padding = new System.Windows.Forms.Padding(5, 10, 5, 10); - this.T_FinishBtn.DefaultCellStyle = dataGridViewCellStyle55; + dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle3.Padding = new System.Windows.Forms.Padding(5, 10, 5, 10); + this.T_FinishBtn.DefaultCellStyle = dataGridViewCellStyle3; this.T_FinishBtn.HeaderText = "完毕"; this.T_FinishBtn.Name = "T_FinishBtn"; this.T_FinishBtn.ReadOnly = true; @@ -333,17 +334,17 @@ this.maoGridView.AllowUserToDeleteRows = false; this.maoGridView.AllowUserToResizeColumns = false; this.maoGridView.AllowUserToResizeRows = false; - dataGridViewCellStyle57.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); - this.maoGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle57; + dataGridViewCellStyle5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.maoGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle5; this.maoGridView.BackgroundColor = System.Drawing.Color.White; - dataGridViewCellStyle58.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle58.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle58.Font = new System.Drawing.Font("宋体", 12F); - dataGridViewCellStyle58.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle58.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle58.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle58.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.maoGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle58; + dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle6.Font = new System.Drawing.Font("宋体", 12F); + dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.maoGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle6; this.maoGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.maoGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.M_OrderDetail_ID, @@ -357,11 +358,11 @@ this.maoGridView.Name = "maoGridView"; this.maoGridView.ReadOnly = true; this.maoGridView.RowHeadersVisible = false; - dataGridViewCellStyle60.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle60.ForeColor = System.Drawing.Color.Black; - dataGridViewCellStyle60.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); - dataGridViewCellStyle60.SelectionForeColor = System.Drawing.Color.Black; - this.maoGridView.RowsDefaultCellStyle = dataGridViewCellStyle60; + dataGridViewCellStyle8.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle8.ForeColor = System.Drawing.Color.Black; + dataGridViewCellStyle8.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + dataGridViewCellStyle8.SelectionForeColor = System.Drawing.Color.Black; + this.maoGridView.RowsDefaultCellStyle = dataGridViewCellStyle8; this.maoGridView.RowTemplate.Height = 65; this.maoGridView.ScrollBars = System.Windows.Forms.ScrollBars.Horizontal; this.maoGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; @@ -411,9 +412,9 @@ // // M_FinishBtn // - dataGridViewCellStyle59.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle59.Padding = new System.Windows.Forms.Padding(5, 10, 5, 10); - this.M_FinishBtn.DefaultCellStyle = dataGridViewCellStyle59; + dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle7.Padding = new System.Windows.Forms.Padding(5, 10, 5, 10); + this.M_FinishBtn.DefaultCellStyle = dataGridViewCellStyle7; this.M_FinishBtn.HeaderText = "完毕"; this.M_FinishBtn.Name = "M_FinishBtn"; this.M_FinishBtn.ReadOnly = true; @@ -439,7 +440,6 @@ // // groupBox3 // - this.groupBox3.Controls.Add(this.lblHeJi); this.groupBox3.Controls.Add(this.vScrollBar2); this.groupBox3.Controls.Add(this.label12); this.groupBox3.Controls.Add(this.historyGrid); @@ -450,22 +450,11 @@ this.groupBox3.TabStop = false; this.groupBox3.Text = "记录"; // - // lblHeJi - // - this.lblHeJi.AutoSize = true; - this.lblHeJi.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.lblHeJi.Location = new System.Drawing.Point(6, 624); - this.lblHeJi.Name = "lblHeJi"; - this.lblHeJi.Size = new System.Drawing.Size(82, 24); - this.lblHeJi.TabIndex = 53; - this.lblHeJi.Text = "合计:"; - this.lblHeJi.Visible = false; - // // vScrollBar2 // this.vScrollBar2.Location = new System.Drawing.Point(479, 36); this.vScrollBar2.Name = "vScrollBar2"; - this.vScrollBar2.Size = new System.Drawing.Size(40, 566); + this.vScrollBar2.Size = new System.Drawing.Size(40, 610); this.vScrollBar2.TabIndex = 52; // // label12 @@ -484,159 +473,44 @@ this.historyGrid.AllowUserToDeleteRows = false; this.historyGrid.AllowUserToResizeColumns = false; this.historyGrid.AllowUserToResizeRows = false; - dataGridViewCellStyle61.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); - this.historyGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle61; + dataGridViewCellStyle9.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.historyGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle9; this.historyGrid.BackgroundColor = System.Drawing.Color.White; - dataGridViewCellStyle62.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle62.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle62.Font = new System.Drawing.Font("宋体", 12F); - dataGridViewCellStyle62.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle62.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle62.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle62.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.historyGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle62; + dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle10.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle10.Font = new System.Drawing.Font("宋体", 12F); + dataGridViewCellStyle10.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle10.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle10.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.historyGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle10; this.historyGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.historyGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.H_SID, this.H_Livestock_ID, - this.IsLostWeight, this.H_IsDrop, - this.H_ReadWeight, + this.H_Technics, this.H_Index, this.H_Order, - this.H_Technics, + this.H_Technics_Name, this.H_Livestock_Name, this.H_Weight, - this.H_Time, - this.H_OrderDetail_ID}); + this.H_Time}); this.historyGrid.Location = new System.Drawing.Point(1, 36); this.historyGrid.MultiSelect = false; this.historyGrid.Name = "historyGrid"; this.historyGrid.ReadOnly = true; this.historyGrid.RowHeadersVisible = false; - dataGridViewCellStyle65.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle65.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); - this.historyGrid.RowsDefaultCellStyle = dataGridViewCellStyle65; + dataGridViewCellStyle13.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle13.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + this.historyGrid.RowsDefaultCellStyle = dataGridViewCellStyle13; this.historyGrid.RowTemplate.Height = 40; this.historyGrid.ScrollBars = System.Windows.Forms.ScrollBars.None; this.historyGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.historyGrid.Size = new System.Drawing.Size(478, 566); + this.historyGrid.Size = new System.Drawing.Size(478, 610); this.historyGrid.TabIndex = 0; this.historyGrid.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.historyGrid_CellClick); // - // H_SID - // - this.H_SID.DataPropertyName = "SID"; - this.H_SID.HeaderText = "SID"; - this.H_SID.Name = "H_SID"; - this.H_SID.ReadOnly = true; - this.H_SID.Visible = false; - // - // H_Livestock_ID - // - this.H_Livestock_ID.HeaderText = "Livestock_ID"; - this.H_Livestock_ID.Name = "H_Livestock_ID"; - this.H_Livestock_ID.ReadOnly = true; - this.H_Livestock_ID.Visible = false; - // - // IsLostWeight - // - this.IsLostWeight.DataPropertyName = "IsLostWeight"; - this.IsLostWeight.HeaderText = "IsLostWeight"; - this.IsLostWeight.Name = "IsLostWeight"; - this.IsLostWeight.ReadOnly = true; - this.IsLostWeight.Visible = false; - // - // H_IsDrop - // - this.H_IsDrop.DataPropertyName = "IsDrop"; - this.H_IsDrop.HeaderText = "IsDrop"; - this.H_IsDrop.Name = "H_IsDrop"; - this.H_IsDrop.ReadOnly = true; - this.H_IsDrop.Visible = false; - // - // H_ReadWeight - // - this.H_ReadWeight.DataPropertyName = "ReadWeight"; - this.H_ReadWeight.HeaderText = ""; - this.H_ReadWeight.Name = "H_ReadWeight"; - this.H_ReadWeight.ReadOnly = true; - this.H_ReadWeight.Width = 30; - // - // H_Index - // - this.H_Index.DataPropertyName = "Index"; - this.H_Index.HeaderText = "序号"; - this.H_Index.Name = "H_Index"; - this.H_Index.ReadOnly = true; - this.H_Index.Width = 65; - // - // H_Order - // - this.H_Order.DataPropertyName = "Order"; - this.H_Order.HeaderText = "顺序"; - this.H_Order.Name = "H_Order"; - this.H_Order.ReadOnly = true; - this.H_Order.Width = 65; - // - // H_Technics - // - this.H_Technics.DataPropertyName = "Technics_Name"; - this.H_Technics.HeaderText = "工艺"; - this.H_Technics.Name = "H_Technics"; - this.H_Technics.ReadOnly = true; - this.H_Technics.Width = 65; - // - // H_Livestock_Name - // - this.H_Livestock_Name.DataPropertyName = "Livestock_Name"; - this.H_Livestock_Name.HeaderText = "级别"; - this.H_Livestock_Name.Name = "H_Livestock_Name"; - this.H_Livestock_Name.ReadOnly = true; - this.H_Livestock_Name.Width = 90; - // - // H_Weight - // - this.H_Weight.DataPropertyName = "Weight"; - dataGridViewCellStyle63.Format = "#0.######"; - this.H_Weight.DefaultCellStyle = dataGridViewCellStyle63; - this.H_Weight.HeaderText = "重量"; - this.H_Weight.Name = "H_Weight"; - this.H_Weight.ReadOnly = true; - this.H_Weight.Width = 70; - // - // H_Time - // - this.H_Time.DataPropertyName = "Time"; - dataGridViewCellStyle64.Format = "HH:mm:ss"; - dataGridViewCellStyle64.NullValue = null; - this.H_Time.DefaultCellStyle = dataGridViewCellStyle64; - this.H_Time.HeaderText = "时间"; - this.H_Time.Name = "H_Time"; - this.H_Time.ReadOnly = true; - // - // H_OrderDetail_ID - // - this.H_OrderDetail_ID.DataPropertyName = "OrderDetail_ID"; - this.H_OrderDetail_ID.HeaderText = "OrderDetail_ID"; - this.H_OrderDetail_ID.Name = "H_OrderDetail_ID"; - this.H_OrderDetail_ID.ReadOnly = true; - this.H_OrderDetail_ID.Visible = false; - // - // enableWeight - // - this.enableWeight.AutoCheck = false; - this.enableWeight.AutoSize = true; - this.enableWeight.Font = new System.Drawing.Font("宋体", 18F); - this.enableWeight.Location = new System.Drawing.Point(427, -2); - this.enableWeight.Name = "enableWeight"; - this.enableWeight.Size = new System.Drawing.Size(125, 28); - this.enableWeight.TabIndex = 31; - this.enableWeight.Text = "启用称重"; - this.enableWeight.UseVisualStyleBackColor = true; - this.enableWeight.Visible = false; - this.enableWeight.Click += new System.EventHandler(this.enableWeight_Click); - // // isPrintCheckBox // this.isPrintCheckBox.AutoSize = true; @@ -696,7 +570,7 @@ // configBtn // this.configBtn.Font = new System.Drawing.Font("宋体", 15F); - this.configBtn.Location = new System.Drawing.Point(417, 38); + this.configBtn.Location = new System.Drawing.Point(400, 2); this.configBtn.Name = "configBtn"; this.configBtn.Size = new System.Drawing.Size(102, 42); this.configBtn.TabIndex = 34; @@ -741,7 +615,7 @@ // discontBtn // this.discontBtn.Font = new System.Drawing.Font("宋体", 15F); - this.discontBtn.Location = new System.Drawing.Point(541, 38); + this.discontBtn.Location = new System.Drawing.Point(400, 50); this.discontBtn.Name = "discontBtn"; this.discontBtn.Size = new System.Drawing.Size(102, 42); this.discontBtn.TabIndex = 37; @@ -760,7 +634,7 @@ // this.statePic.ErrorImage = null; this.statePic.InitialImage = null; - this.statePic.Location = new System.Drawing.Point(219, 89); + this.statePic.Location = new System.Drawing.Point(274, 93); this.statePic.Name = "statePic"; this.statePic.Size = new System.Drawing.Size(30, 30); this.statePic.TabIndex = 38; @@ -769,7 +643,7 @@ // btnDeleteSelected // this.btnDeleteSelected.Font = new System.Drawing.Font("宋体", 15F); - this.btnDeleteSelected.Location = new System.Drawing.Point(1102, 6); + this.btnDeleteSelected.Location = new System.Drawing.Point(1197, 14); this.btnDeleteSelected.Name = "btnDeleteSelected"; this.btnDeleteSelected.Size = new System.Drawing.Size(102, 54); this.btnDeleteSelected.TabIndex = 34; @@ -782,7 +656,7 @@ this.lblSucessed.BackColor = System.Drawing.Color.Lime; this.lblSucessed.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lblSucessed.ForeColor = System.Drawing.Color.Red; - this.lblSucessed.Location = new System.Drawing.Point(691, 70); + this.lblSucessed.Location = new System.Drawing.Point(785, 70); this.lblSucessed.Name = "lblSucessed"; this.lblSucessed.Size = new System.Drawing.Size(267, 39); this.lblSucessed.TabIndex = 39; @@ -790,21 +664,10 @@ this.lblSucessed.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.lblSucessed.Visible = false; // - // btnClearWeight - // - this.btnClearWeight.Font = new System.Drawing.Font("宋体", 15F); - this.btnClearWeight.Location = new System.Drawing.Point(971, 6); - this.btnClearWeight.Name = "btnClearWeight"; - this.btnClearWeight.Size = new System.Drawing.Size(102, 54); - this.btnClearWeight.TabIndex = 34; - this.btnClearWeight.Text = "删除称重"; - this.btnClearWeight.UseVisualStyleBackColor = true; - this.btnClearWeight.Click += new System.EventHandler(this.btnClearLastWeight_Click); - // // dropPigBtn // this.dropPigBtn.Font = new System.Drawing.Font("宋体", 15F); - this.dropPigBtn.Location = new System.Drawing.Point(845, 6); + this.dropPigBtn.Location = new System.Drawing.Point(1071, 14); this.dropPigBtn.Name = "dropPigBtn"; this.dropPigBtn.Size = new System.Drawing.Size(102, 54); this.dropPigBtn.TabIndex = 40; @@ -814,9 +677,10 @@ // // btnStartWeight // + this.btnStartWeight.Font = new System.Drawing.Font("宋体", 15F); this.btnStartWeight.Location = new System.Drawing.Point(12, 85); this.btnStartWeight.Name = "btnStartWeight"; - this.btnStartWeight.Size = new System.Drawing.Size(82, 39); + this.btnStartWeight.Size = new System.Drawing.Size(109, 42); this.btnStartWeight.TabIndex = 41; this.btnStartWeight.Text = "启用称重"; this.btnStartWeight.UseVisualStyleBackColor = true; @@ -825,9 +689,10 @@ // btnStopWeight // this.btnStopWeight.Enabled = false; - this.btnStopWeight.Location = new System.Drawing.Point(116, 84); + this.btnStopWeight.Font = new System.Drawing.Font("宋体", 15F); + this.btnStopWeight.Location = new System.Drawing.Point(140, 85); this.btnStopWeight.Name = "btnStopWeight"; - this.btnStopWeight.Size = new System.Drawing.Size(85, 39); + this.btnStopWeight.Size = new System.Drawing.Size(109, 42); this.btnStopWeight.TabIndex = 41; this.btnStopWeight.Text = "停止称重"; this.btnStopWeight.UseVisualStyleBackColor = true; @@ -836,7 +701,7 @@ // dataConfirmBtn // this.dataConfirmBtn.Font = new System.Drawing.Font("宋体", 15F); - this.dataConfirmBtn.Location = new System.Drawing.Point(1226, 6); + this.dataConfirmBtn.Location = new System.Drawing.Point(1321, 14); this.dataConfirmBtn.Name = "dataConfirmBtn"; this.dataConfirmBtn.Size = new System.Drawing.Size(102, 54); this.dataConfirmBtn.TabIndex = 42; @@ -844,13 +709,162 @@ this.dataConfirmBtn.UseVisualStyleBackColor = true; this.dataConfirmBtn.Click += new System.EventHandler(this.dataConfirmBtn_Click); // + // H_SID + // + this.H_SID.DataPropertyName = "SID"; + this.H_SID.HeaderText = "SID"; + this.H_SID.Name = "H_SID"; + this.H_SID.ReadOnly = true; + this.H_SID.Visible = false; + // + // H_Livestock_ID + // + this.H_Livestock_ID.HeaderText = "Livestock_ID"; + this.H_Livestock_ID.Name = "H_Livestock_ID"; + this.H_Livestock_ID.ReadOnly = true; + this.H_Livestock_ID.Visible = false; + // + // H_IsDrop + // + this.H_IsDrop.DataPropertyName = "IsDrop"; + this.H_IsDrop.HeaderText = "IsDrop"; + this.H_IsDrop.Name = "H_IsDrop"; + this.H_IsDrop.ReadOnly = true; + this.H_IsDrop.Visible = false; + // + // H_Technics + // + this.H_Technics.DataPropertyName = "Technics"; + this.H_Technics.HeaderText = "Technics"; + this.H_Technics.Name = "H_Technics"; + this.H_Technics.ReadOnly = true; + this.H_Technics.Visible = false; + // + // H_Index + // + this.H_Index.DataPropertyName = "Index"; + this.H_Index.HeaderText = "序号"; + this.H_Index.Name = "H_Index"; + this.H_Index.ReadOnly = true; + this.H_Index.Width = 65; + // + // H_Order + // + this.H_Order.DataPropertyName = "Order"; + this.H_Order.HeaderText = "顺序"; + this.H_Order.Name = "H_Order"; + this.H_Order.ReadOnly = true; + this.H_Order.Width = 65; + // + // H_Technics_Name + // + this.H_Technics_Name.DataPropertyName = "Technics_Name"; + this.H_Technics_Name.HeaderText = "工艺"; + this.H_Technics_Name.Name = "H_Technics_Name"; + this.H_Technics_Name.ReadOnly = true; + this.H_Technics_Name.Width = 65; + // + // H_Livestock_Name + // + this.H_Livestock_Name.DataPropertyName = "Livestock_Name"; + this.H_Livestock_Name.HeaderText = "级别"; + this.H_Livestock_Name.Name = "H_Livestock_Name"; + this.H_Livestock_Name.ReadOnly = true; + this.H_Livestock_Name.Width = 110; + // + // H_Weight + // + this.H_Weight.DataPropertyName = "Weight"; + dataGridViewCellStyle11.Format = "#0.######"; + this.H_Weight.DefaultCellStyle = dataGridViewCellStyle11; + this.H_Weight.HeaderText = "重量"; + this.H_Weight.Name = "H_Weight"; + this.H_Weight.ReadOnly = true; + this.H_Weight.Width = 70; + // + // H_Time + // + this.H_Time.DataPropertyName = "Time"; + dataGridViewCellStyle12.Format = "HH:mm:ss"; + dataGridViewCellStyle12.NullValue = null; + this.H_Time.DefaultCellStyle = dataGridViewCellStyle12; + this.H_Time.HeaderText = "时间"; + this.H_Time.Name = "H_Time"; + this.H_Time.ReadOnly = true; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Font = new System.Drawing.Font("宋体", 15F); + this.label5.Location = new System.Drawing.Point(524, 8); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(69, 20); + this.label5.TabIndex = 45; + this.label5.Text = "烫褪:"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Font = new System.Drawing.Font("宋体", 15F); + this.label6.Location = new System.Drawing.Point(524, 45); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(69, 20); + this.label6.TabIndex = 46; + this.label6.Text = "毛剥:"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Font = new System.Drawing.Font("宋体", 15F); + this.label7.Location = new System.Drawing.Point(583, 10); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(179, 20); + this.label7.TabIndex = 47; + this.label7.Text = "5000 头 500000 KG"; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Font = new System.Drawing.Font("宋体", 15F); + this.label9.Location = new System.Drawing.Point(524, 81); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(69, 20); + this.label9.TabIndex = 49; + this.label9.Text = "合计:"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("宋体", 15F); + this.label3.Location = new System.Drawing.Point(583, 47); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(179, 20); + this.label3.TabIndex = 50; + this.label3.Text = "5000 头 500000 KG"; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Font = new System.Drawing.Font("宋体", 15F); + this.label8.Location = new System.Drawing.Point(583, 85); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(179, 20); + this.label8.TabIndex = 51; + this.label8.Text = "5000 头 500000 KG"; + // // GradeFrom // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1438, 845); + this.Controls.Add(this.label8); + this.Controls.Add(this.label3); + this.Controls.Add(this.label9); + this.Controls.Add(this.label7); this.Controls.Add(this.dataConfirmBtn); + this.Controls.Add(this.label6); this.Controls.Add(this.btnStopWeight); + this.Controls.Add(this.label5); this.Controls.Add(this.btnStartWeight); this.Controls.Add(this.dropPigBtn); this.Controls.Add(this.lblSucessed); @@ -859,10 +873,8 @@ this.Controls.Add(this.lblMaoBo); this.Controls.Add(this.discontBtn); this.Controls.Add(this.modifyPanel); - this.Controls.Add(this.btnClearWeight); this.Controls.Add(this.btnDeleteSelected); this.Controls.Add(this.configBtn); - this.Controls.Add(this.enableWeight); this.Controls.Add(this.groupBox3); this.Controls.Add(this.isPrintCheckBox); this.Controls.Add(this.groupBox2); @@ -915,7 +927,6 @@ private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.FlowLayoutPanel mbPanel; private System.Windows.Forms.GroupBox groupBox3; - private System.Windows.Forms.CheckBox enableWeight; private System.Windows.Forms.CheckBox isPrintCheckBox; private System.Windows.Forms.Button printBtn; private System.Windows.Forms.Panel panel1; @@ -948,24 +959,26 @@ private System.Windows.Forms.DataGridViewTextBoxColumn M_Number; private System.Windows.Forms.DataGridViewTextBoxColumn M_Already; private System.Windows.Forms.DataGridViewButtonColumn M_FinishBtn; - private System.Windows.Forms.Label lblHeJi; private System.Windows.Forms.Label lblSucessed; - private System.Windows.Forms.Button btnClearWeight; private System.Windows.Forms.Button dropPigBtn; private System.Windows.Forms.Button btnStartWeight; private System.Windows.Forms.Button btnStopWeight; + private System.Windows.Forms.Button dataConfirmBtn; private System.Windows.Forms.DataGridViewTextBoxColumn H_SID; private System.Windows.Forms.DataGridViewTextBoxColumn H_Livestock_ID; - private System.Windows.Forms.DataGridViewTextBoxColumn IsLostWeight; private System.Windows.Forms.DataGridViewTextBoxColumn H_IsDrop; - private System.Windows.Forms.DataGridViewCheckBoxColumn H_ReadWeight; + private System.Windows.Forms.DataGridViewTextBoxColumn H_Technics; private System.Windows.Forms.DataGridViewTextBoxColumn H_Index; private System.Windows.Forms.DataGridViewTextBoxColumn H_Order; - private System.Windows.Forms.DataGridViewTextBoxColumn H_Technics; + private System.Windows.Forms.DataGridViewTextBoxColumn H_Technics_Name; private System.Windows.Forms.DataGridViewTextBoxColumn H_Livestock_Name; private System.Windows.Forms.DataGridViewTextBoxColumn H_Weight; private System.Windows.Forms.DataGridViewTextBoxColumn H_Time; - private System.Windows.Forms.DataGridViewTextBoxColumn H_OrderDetail_ID; - private System.Windows.Forms.Button dataConfirmBtn; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label8; } } \ No newline at end of file diff --git a/WeighAndGrading/GradeFrom.cs b/WeighAndGrading/GradeFrom.cs index ea9ce8d..2c00b73 100644 --- a/WeighAndGrading/GradeFrom.cs +++ b/WeighAndGrading/GradeFrom.cs @@ -46,18 +46,13 @@ namespace WeighAndGrading List tangList; List maoList; BindingList details; - - List localTang, localMao; - string maoFilePath, tangFilePath; string discontPath = Path.Combine(DATA_PATH, "Disconts.xml"); bool connection = false; - SerialPort weightPort; int maxIndex = 0; ConcurrentQueue noLivestockList; - - ConcurrentQueue noWeightList; + BackgroundWorker tangWork, maoWork, detailWork; Thread syncWork; Thread syncToServer; #region weightNeed @@ -76,10 +71,9 @@ namespace WeighAndGrading maoGridView.AutoGenerateColumns = false; maoGridView.DataSource = null; historyGrid.AutoGenerateColumns = false; + InitBackGroundWorker(); if (!Directory.Exists(DATA_PATH)) Directory.CreateDirectory(DATA_PATH); - maoFilePath = Path.Combine(DATA_PATH, "MaoList.xml"); - tangFilePath = Path.Combine(DATA_PATH, "TangList.xml"); connection = ButcherAppContext.Context.UserConfig.Connection; AddLivestockBtn(); BuildDiscontPanel(true); @@ -92,36 +86,32 @@ namespace WeighAndGrading syncWork.Abort(); if (syncToServer != null && syncToServer.IsAlive) syncToServer.Abort(); + + if (tangWork != null && tangWork.IsBusy) + tangWork.CancelAsync(); + if (maoWork != null && maoWork.IsBusy) + maoWork.CancelAsync(); + if (detailWork != null && detailWork.IsBusy) + detailWork.CancelAsync(); }; } - GradeAndWeight_Detail modifyDetail; + void InitBackGroundWorker() + { + tangWork = new BackgroundWorker() { WorkerSupportsCancellation = true }; + tangWork.DoWork += delegate { BindTangGridFortangList(); }; + tangWork.RunWorkerCompleted += delegate { BindTangGrid(); }; + + maoWork = new BackgroundWorker(); + maoWork.DoWork += delegate { BindMaoGridFortangList(); }; + maoWork.RunWorkerCompleted += BindMaoGrid(); + + detailWork = new BackgroundWorker(); + //detailWork.DoWork += GetDetailData(); + //detailWork.RunWorkerCompleted += BindDetailGrid(); + } - // private void GradeFrom_KeyPress(object sender, KeyPressEventArgs e) - // { - // Char keyChar = e.KeyChar; - // var key = keyChar.ToString().ToLower(); - // foreach (Button btn in ttPanel.Controls) - // { - // var livestockTag = btn.Tag as CTuple; - // if (livestockTag.Item4.ToLower() == key) - // { - // JiBieButtonClick(btn); - // SetJiBieSelectBackColor(btn.Text); - // } - // } - // foreach (Button btn in mbPanel.Controls) - // { - // var livestockTag = btn.Tag as CTuple; - // if (livestockTag.Item4.ToLower() == key) - // { - // JiBieButtonClick(btn); - // SetJiBieSelectBackColor(btn.Text); - // } - // } - // } - - //点击 级别 + GradeAndWeight_Detail modifyDetail; void JiBieButtonClick(Button btn) { if (details == null) @@ -135,7 +125,6 @@ namespace WeighAndGrading var livestockTag = btn.Tag as CTuple; var tech = livestockTag.Item3 == TANG_TECH ? "烫褪" : "毛剥"; - if (modifyDetail == null) { StartPrintEntity(tech, null); @@ -178,6 +167,7 @@ namespace WeighAndGrading } else LocalGradeAndWeightBL.Update(modifyDetail, "Livestock_ID", "Livestock_Name", "Technics", "Technics_Name"); + noLivestockList = new ConcurrentQueue(); var stack = new Stack(); @@ -202,7 +192,6 @@ namespace WeighAndGrading noLivestockList.Enqueue(stack.Pop()); } - historyGrid.Refresh(); modifyDetail = null; modifyPanel.Hide(); @@ -229,41 +218,7 @@ namespace WeighAndGrading btn.Click += (sender, e) => { - // btn.Enabled = false; - // Application.DoEvents(); JiBieButtonClick(btn); - #region 改到方法JiBieButtonClick()里了 - - - - // if (details == null) - // { - // MessageBox.Show("请先同步数据"); - // return; - // } - // var livestockTag = btn.Tag as CTuple; - // if (modifyDetail == null) - // AddDetail(livestockTag); - // else - // { - // modifyDetail.Livestock_ID = livestockTag.Item1; - // modifyDetail.Livestock_Name = livestockTag.Item2; - // modifyDetail.Technics = livestockTag.Item3; - // modifyDetail.Technics_Name = livestockTag.Item3 == TANG_TECH ? "烫褪" : "毛剥"; - // LocalGradeAndWeightBL.Update(modifyDetail, "Livestock_ID", "Livestock_Name", "Technics", "Technics_Name"); - // historyGrid.Refresh(); - // modifyDetail = null; - // modifyPanel.Hide(); - // } - - #endregion - - // btn.Enabled = true; - // Application.DoEvents(); - - //var name = livestock.Technics == 0 ? "带皮白条" : "去皮白条"; - //Print(name, entity.Index); - }; if (item.Item3 == TANG_TECH) { @@ -278,37 +233,6 @@ namespace WeighAndGrading SetMargin(mbPanel); } - - - // private void SetJiBieSelectBackColor(string btnText) - // { - // foreach (Control control in ttPanel.Controls) - // { - // if (control.Text == btnText) - // { - // control.BackColor = Color.Aqua; - // } - // else - // { - // control.BackColor = SystemColors.Control; - // } - // } - // - // foreach (Control control in mbPanel.Controls) - // { - // if (control.Text == btnText) - // { - // control.BackColor = Color.Aqua; - // } - // else - // { - // control.BackColor = SystemColors.Control; - // } - // } - // - // } - - void SetMargin(FlowLayoutPanel panel) { for (var i = 0; i < panel.Controls.Count; i++) @@ -323,11 +247,6 @@ namespace WeighAndGrading } } - private void closeBtn_Click(object sender, EventArgs e) - { - this.Close(); - } - private void syncBtn_Click(object sender, EventArgs e) { details = LocalGradeAndWeightBL.GetDetails(butcherTimeInput.Date.Value, 50); @@ -335,6 +254,12 @@ namespace WeighAndGrading BindDetailGrid(); if (details.Any()) maxIndex = details.First().Index; + + if (tangWork.CancellationPending) + tangWork.RunWorkerAsync(); + else + tangWork.CancelAsync(); + if (syncWork == null || !syncWork.IsAlive) { syncWork = new Thread(Sync); @@ -352,20 +277,15 @@ namespace WeighAndGrading void Sync() { + var bc = new BackgroundWorker(); + bc.DoWork += Bc_DoWork; + bc.RunWorkerCompleted += Bc_RunWorkerCompleted; while (true) { - var bc = new BackgroundWorker(); - bc.DoWork += Bc_DoWork; - bc.RunWorkerCompleted += Bc_RunWorkerCompleted; if (!bc.IsBusy) { bc.RunWorkerAsync(); } - // this.Invoke(new InvokeHandler(delegate () - // { - // BindTangGrid(); - // BindMaoGrid(); - // })); Thread.Sleep(5000); } } @@ -388,7 +308,6 @@ namespace WeighAndGrading void FillQueue() { - noWeightList = new ConcurrentQueue(); noLivestockList = new ConcurrentQueue(); var stack = new Stack(); foreach (var item in details) @@ -401,16 +320,11 @@ namespace WeighAndGrading while (stack.Count > 0) { var bottom = stack.Pop(); - if (bottom.Weight == null) - noWeightList.Enqueue(bottom); - else + if (bottom.Weight.HasValue) noLivestockList.Enqueue(bottom); } - - } - void BindTangGridFortangList() { VerifyConnection(); @@ -436,8 +350,6 @@ namespace WeighAndGrading if (tangEntity == null && tangGridView.CurrentRow != null) { tangEntity = tangGridView.CurrentRow.DataBoundItem as GradeAndWeight; - //if (tangEntity.Finish) - // tangEntity = null; } foreach (DataGridViewRow row in tangGridView.Rows) { @@ -464,7 +376,6 @@ namespace WeighAndGrading tangRoll = -1; } tangGridView.Refresh(); - // lblTangTui.Text= "烫褪" + "("+tangList.Sum(x=>x.Number)+")"; } void BindMaoGridFromaoList() @@ -489,7 +400,6 @@ namespace WeighAndGrading } } - void BindMaoGrid() { @@ -497,8 +407,6 @@ namespace WeighAndGrading if (maoEntity == null && maoGridView.CurrentRow != null) { maoEntity = maoGridView.CurrentRow.DataBoundItem as GradeAndWeight; - //if (maoEntity.Finish) - // maoEntity = null; } foreach (DataGridViewRow row in maoGridView.Rows) { @@ -525,7 +433,6 @@ namespace WeighAndGrading maoRoll = -1; } maoGridView.Refresh(); - // lblMaoBo.Text = "毛剥" + "(" + maoList.Sum(x=>x.Number) + ")"; } void BindDetailGrid() @@ -539,17 +446,6 @@ namespace WeighAndGrading row.DefaultCellStyle.BackColor = Color.Red; } InitScrollBar2(); - //if (lastSelectID.HasValue) - //{ - // foreach (DataGridViewRow row in historyGrid.Rows) - // { - // if ((long)row.Cells["H_SID"].Value == lastSelectID) - // { - // historyGrid.CurrentCell = row.Cells[row.Cells.Count - 1]; - // break; - // } - // } - //} try { if (rightRoll != -1) @@ -560,8 +456,6 @@ namespace WeighAndGrading rightRoll = -1; } historyGrid.Refresh(); - // SetHistorBackColor(); - // ReSetHistorySum(); } void StartPrintEntity(string gongyijibie, int? index) @@ -629,17 +523,6 @@ namespace WeighAndGrading modifyPanel.Hide(); } - // void Print(object obj) - // { - // var entity = obj as PrintEntity; - // this.Invoke(new Action(() => - // { - // WeightGradePrint.Print(entity); - // })); - // } - - - private void configBtn_Click(object sender, EventArgs e) { new GradeSettingFrom().ShowDialog(); @@ -651,8 +534,6 @@ namespace WeighAndGrading #region weightNeed void OpenSerialPort() { - if (enableWeight.Checked) - return; if (GradeContext.Config.RateSet == null) throw new Exception("请先配置称相关信息"); @@ -703,8 +584,6 @@ namespace WeighAndGrading string format = "{0:0.00}"; - private DateTime lastWeightDateTime = DateTime.Now; - private void InQuery() { while (_mainProcessIsRun) @@ -744,17 +623,7 @@ namespace WeighAndGrading lblChengZhong.Text = string.Format(format, decimal.Parse(str)); if (str != "0") { - //稳定发送有效间隔 - var allowInterval = GradeContext.Config.AllowInterval; - //如果间隔时间内多条的话不处理 - - // var timeSpanTotalSeconds= (DateTime.Now - lastWeightDateTime).TotalSeconds; - // if (Convert.ToDecimal(timeSpanTotalSeconds) > allowInterval) - // { AddWeightDetail(decimal.Parse(lblChengZhong.Text)); - // lastWeightDateTime = DateTime.Now; - // } - } })); } @@ -768,7 +637,6 @@ namespace WeighAndGrading { lblChengZhong.Text = string.Format(format, num); })); - LocalGradeAndWeightBL.SaveWeightData(num); WeighAvgControl.Add(num, isStatic); } if (WeighAvgControl.TryGetValue(out num)) @@ -873,102 +741,9 @@ namespace WeighAndGrading DisableWeight(); btnStopWeight.Enabled = false; } - - public void enableWeight_Click(object sender, EventArgs e) - { - if (details == null) - { - MessageBox.Show("请先同步数据"); - return; - } - if (!enableWeight.Checked) - { - OpenSerialPort(); - _mainProcessIsRun = true; - ReadData(); - } - else - DisableWeight(); - enableWeight.CheckState = enableWeight.Checked ? CheckState.Unchecked : CheckState.Checked; - } #endregion static object _obj = new object(); - - - // void AddDetail(CTuple livestock) - // { - // lock (_obj) - // { - // var currentRow = livestock.Item3 == 0 ? tangEntity : maoEntity; - // var tech = livestock.Item3 == TANG_TECH ? "烫褪" : "毛剥"; - // - // GradeAndWeight_Detail first; - // if (noLivestockList.TryPeek(out first) && first.Livestock_ID == null) - // { - // noLivestockList.TryDequeue(out first); - // if (currentRow != null) - // first.OrderDetail_ID = currentRow.OrderDetail_ID; - // first.Date = butcherTimeInput.Date.Value; - // first.Livestock_ID = livestock.Item1; - // first.Livestock_Name = livestock.Item2; - // first.Technics = livestock.Item3; - // first.Technics_Name = tech; - // if (disBtn != null) - // { - // first.Weight = (first.Weight ?? 0) - Convert.ToDecimal(disBtn.Tag); - // SetBtnUnCheck(disBtn); - // disBtn = null; - // } - // LocalGradeAndWeightBL.Update(first, "OrderDetail_ID", "Date", "Livestock_ID", "Livestock_Name", "Technics", "Technics_Name", "Weight"); - // historyGrid.Refresh(); - // } - // else//add - // { - // maxIndex++; - // var entity = new GradeAndWeight_Detail(); - // entity.Index = maxIndex; - // if (currentRow != null) - // entity.OrderDetail_ID = currentRow.OrderDetail_ID; - // entity.Date = butcherTimeInput.Date.Value; - // entity.Livestock_ID = livestock.Item1; - // entity.Livestock_Name = livestock.Item2; - // entity.Technics = livestock.Item3; - // entity.Technics_Name = tech; - // entity.Time = DateTime.Now; - // entity.Date = butcherTimeInput.Date.Value; - // if (disBtn != null) - // { - // entity.Weight = -Convert.ToDecimal(disBtn.Tag); - // SetBtnUnCheck(disBtn); - // disBtn = null; - // } - // if (details.Count == 50) - // details.RemoveAt(49); - // details.Insert(0, entity); - // LocalGradeAndWeightBL.Insert(entity); - // noWeightList.Enqueue(entity); - // BindDetailGrid(); - // } - // if (currentRow != null) - // { - // currentRow.Already = currentRow.Already + 1; - // orderLabel.Text = currentRow.Order.ToString(); - // alreadyLabel.Text = currentRow.Already.ToString(); - // tangGridView.Refresh(); - // } - // else - // { - // orderLabel.Text = string.Empty; - // alreadyLabel.Text = string.Empty; - // } - // - // //计算合计 - // ReSetHistorySum(); - // } - // } - - //点级别 void AddDetail(CTuple livestock) { lock (_obj) @@ -1059,9 +834,6 @@ namespace WeighAndGrading orderLabel.Text = string.Empty; alreadyLabel.Text = string.Empty; } - - //计算合计 - // ReSetHistorySum(); } } @@ -1093,55 +865,25 @@ namespace WeighAndGrading })); } - - // void ReSetHistorySum() - // { - // var tangtui=LocalGradeAndWeightBL.GetTangTuiSumNumber(butcherTimeInput.Date.Value); - // var maobo=LocalGradeAndWeightBL.GetMaoBoSumNumber(butcherTimeInput.Date.Value); - // lblHeJi.Text = "合计: 烫褪("+ tangtui + ") 毛剥("+maobo+")"; - // } - - void AddWeightDetail(decimal weight) { lock (_obj) { weight -= (GradeContext.Config.Discont ?? 0); - // GradeAndWeight_Detail first; - // if (noWeightList.TryPeek(out first)) - // { - // noWeightList.TryDequeue(out first); - // if (first.Weight < 0) - // first.Weight = (first.Weight ?? 0) + weight; - // else - // first.Weight = weight; - // LocalGradeAndWeightBL.Update(first, "Weight"); - // historyGrid.Refresh(); - // } - // else//add - { - - - maxIndex++; - var entity = new GradeAndWeight_Detail(); - entity.Index = maxIndex; - entity.Weight = (entity.Weight ?? 0) + weight; - entity.Time = DateTime.Now; - entity.Date = butcherTimeInput.Date.Value; - if (details.Count == 50) - details.RemoveAt(49); - details.Insert(0, entity); + maxIndex++; + var entity = new GradeAndWeight_Detail(); + entity.Index = maxIndex; + entity.Weight = (entity.Weight ?? 0) + weight; + entity.Time = DateTime.Now; + entity.Date = butcherTimeInput.Date.Value; + if (details.Count == 50) + details.RemoveAt(49); + details.Insert(0, entity); - //LocalGradeAndWeightBL.Insert(entity); //改成调用方法 方便加锁 - LocalGradeAndWeightBLInsert(entity); + //LocalGradeAndWeightBL.Insert(entity); //改成调用方法 方便加锁 + LocalGradeAndWeightBLInsert(entity); - noLivestockList.Enqueue(entity); - - - // SetlblSucessVisibleTrue(); - // SetlblSucessVisibleFalse(); - - } + noLivestockList.Enqueue(entity); } BindDetailGrid(); @@ -1153,7 +895,6 @@ namespace WeighAndGrading modifyPanel.Hide(); } - //删除选中 private void btnDeleteSelected_Click(object sender, EventArgs e) { @@ -1204,34 +945,6 @@ namespace WeighAndGrading } } - //修改本地 - if (lastCheckItem.OrderDetail_ID.HasValue) - { - VerifyConnection(); - if (!connection) - { - //"烫褪" : "毛剥" - if (lastCheckItem.Technics_Name == "烫褪") - { - localTang = XmlUtil.DeserializeFromFile>(tangFilePath); - if (localTang.Contains(lastCheckItem.OrderDetail_ID.Value)) - { - localTang.Remove(lastCheckItem.OrderDetail_ID.Value); - SaveEntityToLocal(true); - } - } - else if (lastCheckItem.Technics_Name == "毛剥") - { - localMao = XmlUtil.DeserializeFromFile>(maoFilePath); - if (localMao.Contains(lastCheckItem.OrderDetail_ID.Value)) - { - localMao.Remove(lastCheckItem.OrderDetail_ID.Value); - SaveEntityToLocal(false); - } - } - } - } - details.Remove(lastCheckItem); @@ -1261,206 +974,14 @@ namespace WeighAndGrading { noLivestockList.Enqueue(stackNoLiveStock.Pop()); } - - - //重新设置没有重量的 - - noWeightList = new ConcurrentQueue(); - var stackNoWeight = new Stack(); - - - //把没有重量的记录加进去 - var noWeightDetails = details.Where(x => x.Weight == null); - foreach (var item in noWeightDetails) - { - if (item.SID > suodingmaxsid) - { - stackNoWeight.Push(item); - } - } - while (stackNoWeight.Count > 0) - { - noWeightList.Enqueue(stackNoWeight.Pop()); - } - - - - } - private void btnClearLastWeight_Click(object sender, EventArgs e) - { - - if (MessageBox.Show("确定删除最后一条称重记录?", "删除称重", MessageBoxButtons.OKCancel) == DialogResult.Cancel) - { - return; - } - - // if (mCurrentSlectItem == null) - // { - // return; - // } - - - #region 原来逻辑 清空最后一条有重量的值 - // //有称重重量的 并且不是掉猪的最大的一条 - // var fuhemaxsid = details.Where(x => x.Weight.HasValue && !x.IsLostWeight).Max(x => x.SID); - // var fd = details.First(x => x.SID == fuhemaxsid); - // fd.Weight = null; - // - // //清空数据库重量记录 - // LocalGradeAndWeightBL.ClearWeightBySID(fuhemaxsid); - - - // historyGrid.Refresh(); - // - // noWeightList = new ConcurrentQueue(); - // var stack = new Stack(); - // foreach (var item in details) - // { - // if (item.SID > fd.SID) - // { - // stack.Push(item); - // } - // } - // while (stack.Count > 0) - // { - // noWeightList.Enqueue(stack.Pop()); - // } - #endregion - - if (details.Count == 0) - { - return; - } - var lastItem = details[0]; - //如果级别不为空 则返回 - if (!string.IsNullOrWhiteSpace(lastItem.Livestock_Name)) - { - return; - } - - details.RemoveAt(0); - //删除数据库 - LocalGradeAndWeightBL.DeleteBySID(lastItem.SID); - historyGrid.Rows[0].Selected = true; - historyGrid.FirstDisplayedScrollingRowIndex = 0; - vScrollBar2.Value = 0; - historyGrid.Refresh(); - - - - //从新赋值 没有级别的 - // noLivestockList=new ConcurrentQueue(); - // - // - // - // GradeAndWeight_Detail first; - // if (noLivestockList.TryPeek(out first) && first.Livestock_ID == null) - // { - // noLivestockList.TryDequeue(out first); - // } - - //重新设置没有级别的 - noLivestockList = new ConcurrentQueue(); - var stack = new Stack(); - - //找到锁定的最大id - long suodingmaxsid = 0; - var lostweightlist = details.Where(x => x.IsLostWeight).ToList(); - if (lostweightlist.Count > 0) - { - suodingmaxsid = lostweightlist.Max(x => x.SID); - } - //把没有级别的记录加进去 - var livestockNoNameList = details.Where(x => string.IsNullOrWhiteSpace(x.Livestock_Name)); - foreach (var item in livestockNoNameList) - { - if (item.SID > suodingmaxsid) - { - stack.Push(item); - } - } - while (stack.Count > 0) - { - noLivestockList.Enqueue(stack.Pop()); - } } - private void btnLockItem_Click(object sender, EventArgs e) - { - if (mCurrentSlectItem == null) - { - return; - } - //获取最大值 - var lostList = details.Where(x => x.IsLostWeight).ToList(); - if (lostList.Count < 1) - { - maxLockID = 0; - } - else - { - maxLockID = lostList.Max(x => x.SID); - } - - //赋最大值 - if (mCurrentSlectItem.SID > maxLockID) - { - maxLockID = mCurrentSlectItem.SID; - UpdateItemLosted(mCurrentSlectItem.SID); - - if (modifyPanel.Visible) - modifyPanel.Hide(); - historyGrid.Refresh(); - - noWeightList = new ConcurrentQueue(); - var stack = new Stack(); - foreach (var item in details) - { - if (item.SID > mCurrentSlectItem.SID) - { - stack.Push(item); - } - } - while (stack.Count > 0) - { - noWeightList.Enqueue(stack.Pop()); - } - - } - // SetHistorBackColor(); - - - } - - // void SetHistorBackColor() - // { - // foreach (DataGridViewRow row in historyGrid.Rows) - // { - // if ((bool)row.Cells["IsLostWeight"].Value) - // row.DefaultCellStyle.ForeColor = Color.Red; - // } - // } - - private void UpdateItemLosted(long sid) - { - //设置数据库 - LocalGradeAndWeightBL.UpdateLosted(sid); - - //更新界面 - var fd = details.First(x => x.SID == sid); - fd.IsLostWeight = true; - } - - private long? maxLockID; - GradeAndWeight_Detail lastCheckItem, mCurrentSlectItem; - //long? lastSelectID = null; private void historyGrid_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) return; var currentRow = historyGrid.CurrentRow.DataBoundItem as GradeAndWeight_Detail; - // lastSelectID = currentRow.SID; mCurrentSlectItem = currentRow; @@ -1475,28 +996,6 @@ namespace WeighAndGrading if (modifyPanel.Visible) modifyPanel.Hide(); historyGrid.Refresh(); - // if (lastCheckItem.ReadWeight) - // { - // noWeightList = new ConcurrentQueue(); - // var stack = new Stack(); - // foreach (var item in details) - // { - // if (item.SID > lastCheckItem.SID) - // { - // stack.Push(item); - // } - //// stack.Push(item); - //// if (item.SID == lastCheckItem.SID) - //// break; - // } - // while (stack.Count > 0) - // noWeightList.Enqueue(stack.Pop()); - // } - // else - // { - // FillQueue(); - // lastCheckItem = null; - // } return; } modifyDetail = currentRow; @@ -1541,20 +1040,10 @@ namespace WeighAndGrading } entity.Finish = true; VerifyConnection(); - if (connection) - GradeAndWeightRpc.SetGradeFinish(entity.OrderDetail_ID, TANG_TECH); - else - { - localTang = XmlUtil.DeserializeFromFile>(tangFilePath); - if (!localTang.Contains(entity.OrderDetail_ID)) - { - localTang.Add(entity.OrderDetail_ID); - SaveEntityToLocal(true); - } - var f = tangList.FirstOrDefault(x => x.OrderDetail_ID == entity.OrderDetail_ID); - if (f != null) - f.Finish = true; - } + LocalGradeAndWeightBL.SetGradeFinish(entity.Order, butcherTimeInput.Date.Value, TANG_TECH); + var first = tangList.FirstOrDefault(x => x.OrderDetail_ID == entity.OrderDetail_ID); + if (first != null) + first.Finish = true; tangEntity = null; BindTangGrid(); } @@ -1595,21 +1084,10 @@ namespace WeighAndGrading return; } entity.Finish = true; - VerifyConnection(); - if (connection) - GradeAndWeightRpc.SetGradeFinish(entity.OrderDetail_ID, MAO_TECH); - else - { - localMao = XmlUtil.DeserializeFromFile>(maoFilePath); - if (!localMao.Contains(entity.OrderDetail_ID)) - { - localMao.Add(entity.OrderDetail_ID); - SaveEntityToLocal(false); - } - var f = maoList.FirstOrDefault(x => x.OrderDetail_ID == entity.OrderDetail_ID); - if (f != null) - f.Finish = true; - } + LocalGradeAndWeightBL.SetGradeFinish(entity.Order, butcherTimeInput.Date.Value, MAO_TECH); + var first = maoList.FirstOrDefault(x => x.OrderDetail_ID == entity.OrderDetail_ID); + if (first != null) + first.Finish = true; maoEntity = null; BindMaoGrid(); } @@ -1643,12 +1121,9 @@ namespace WeighAndGrading { if (modifyDetail == null) { - // if (disBtn != null) - // SetBtnUnCheck(disBtn); if (disBtn != btn) { disBtn = btn; - // SetBtnChecked(disBtn); } else disBtn = null; @@ -1666,6 +1141,28 @@ namespace WeighAndGrading } } + private void dropPigBtn_Click(object sender, EventArgs e) + { + if (modifyDetail == null) + { + UMessageBox.Show("请先选择要设置为掉猪的行", "错误"); + return; + } + else + { + modifyDetail.IsDrop = !modifyDetail.IsDrop; + LocalGradeAndWeightBL.Update(modifyDetail, "IsDrop"); + BindDetailGrid(); + modifyDetail = null; + modifyPanel.Hide(); + } + } + + private void dataConfirmBtn_Click(object sender, EventArgs e) + { + new DataConfirm().ShowDialog(); + } + readonly Color btnSelectForeColor = Color.FromArgb(255, 255, 255); readonly Color btnSelectBackColor = Color.FromArgb(66, 163, 218); Color btnUnSelectForeColor = SystemColors.ControlText; @@ -1682,6 +1179,7 @@ namespace WeighAndGrading btn.ForeColor = btnUnSelectForeColor; } + #region scrollBar int tangRoll = -1; private void InitTangScrollBar() { @@ -1724,44 +1222,7 @@ namespace WeighAndGrading historyGrid.FirstDisplayedScrollingRowIndex = rightRoll; }; } - - object _fileSaveObj = new object(); - void SaveEntityToLocal(bool tang) - { - lock (_fileSaveObj) - { - if (tang) - XmlUtil.SerializerObjToFile(localTang, tangFilePath); - else - XmlUtil.SerializerObjToFile(localMao, maoFilePath); - } - } - - void SyncLocalMainFinish(ref List list, bool tang) - { - string path = maoFilePath; - short tech = MAO_TECH; - if (tang) - { - path = tangFilePath; - tech = TANG_TECH; - } - - list = XmlUtil.DeserializeFromFile>(path); - var count = list.Count; - if (count == 0) - return; - if (count >= 30) - count = 30; - - var sync = list.GetRange(0, count); - foreach (var item in sync) - { - GradeAndWeightRpc.SetGradeFinish(item, tech); - list.Remove(item); - } - SaveEntityToLocal(tang); - } + #endregion bool? last = null; void VerifyConnection() @@ -1791,17 +1252,6 @@ namespace WeighAndGrading last = connection; } - private void btnAbnormalModify_Click(object sender, EventArgs e) - { - if (!butcherTimeInput.Date.HasValue) - { - MessageBox.Show("请在上一个界面选择宰杀日期"); - return; - } - var f = new AbnormalModifyForm(butcherTimeInput.Date.Value); - f.ShowDialog(); - } - private void GradeFrom_Load(object sender, EventArgs e) { syncToServer = new Thread(ToServerTask); @@ -1812,15 +1262,12 @@ namespace WeighAndGrading { while (true) { - // this.Invoke(new InvokeHandler(delegate () { VerifyConnection(); if (connection) { try { - SyncLocalMainFinish(ref localTang, true); - SyncLocalMainFinish(ref localMao, false); SyncDiscontToSever(); LocalGradeAndWeightBL.Sync(); } @@ -1830,7 +1277,6 @@ namespace WeighAndGrading } } } - // )); Thread.Sleep(2000); } } @@ -1849,27 +1295,5 @@ namespace WeighAndGrading File.Delete(changeFlagPath); } } - - private void dropPigBtn_Click(object sender, EventArgs e) - { - if (modifyDetail == null) - { - UMessageBox.Show("请先选择要设置为掉猪的行", "错误"); - return; - } - else - { - modifyDetail.IsDrop = !modifyDetail.IsDrop; - LocalGradeAndWeightBL.Update(modifyDetail, "IsDrop"); - BindDetailGrid(); - modifyDetail = null; - modifyPanel.Hide(); - } - } - - private void dataConfirmBtn_Click(object sender, EventArgs e) - { - new DataConfirm().ShowDialog(); - } } } diff --git a/WeighAndGrading/GradeFrom.resx b/WeighAndGrading/GradeFrom.resx index db723b2..f123d58 100644 --- a/WeighAndGrading/GradeFrom.resx +++ b/WeighAndGrading/GradeFrom.resx @@ -159,13 +159,10 @@ True - - True - True - + True @@ -174,7 +171,7 @@ True - + True @@ -186,7 +183,4 @@ True - - True - \ No newline at end of file diff --git a/WeighAndGrading/GradeSettingFrom.Designer.cs b/WeighAndGrading/GradeSettingFrom.Designer.cs index 4128796..1dc6126 100644 --- a/WeighAndGrading/GradeSettingFrom.Designer.cs +++ b/WeighAndGrading/GradeSettingFrom.Designer.cs @@ -47,8 +47,6 @@ this.label8 = new System.Windows.Forms.Label(); this.minInput = new BWP.WinFormControl.UTextBoxWithPad(); this.maxInput = new BWP.WinFormControl.UTextBoxWithPad(); - this.label9 = new System.Windows.Forms.Label(); - this.utxtAllowInterval = new BWP.WinFormControl.UTextBoxWithPad(); this.SuspendLayout(); // // label5 @@ -64,7 +62,7 @@ // closeBtn // this.closeBtn.Font = new System.Drawing.Font("宋体", 15F); - this.closeBtn.Location = new System.Drawing.Point(173, 461); + this.closeBtn.Location = new System.Drawing.Point(173, 416); this.closeBtn.Name = "closeBtn"; this.closeBtn.Size = new System.Drawing.Size(75, 35); this.closeBtn.TabIndex = 19; @@ -75,7 +73,7 @@ // saveBtn // this.saveBtn.Font = new System.Drawing.Font("宋体", 15F); - this.saveBtn.Location = new System.Drawing.Point(67, 461); + this.saveBtn.Location = new System.Drawing.Point(67, 416); this.saveBtn.Name = "saveBtn"; this.saveBtn.Size = new System.Drawing.Size(75, 35); this.saveBtn.TabIndex = 18; @@ -234,38 +232,17 @@ this.maxInput.TabIndex = 29; this.maxInput.Type = BWP.WinFormControl.UTextBoxWithPad.TextBoxType.Number; // - // label9 - // - this.label9.AutoSize = true; - this.label9.Font = new System.Drawing.Font("宋体", 15F); - this.label9.Location = new System.Drawing.Point(51, 409); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(109, 20); - this.label9.TabIndex = 27; - this.label9.Text = "有效间隔:"; - // - // utxtAllowInterval - // - this.utxtAllowInterval.Font = new System.Drawing.Font("宋体", 14F); - this.utxtAllowInterval.Location = new System.Drawing.Point(173, 407); - this.utxtAllowInterval.Name = "utxtAllowInterval"; - this.utxtAllowInterval.Size = new System.Drawing.Size(121, 29); - this.utxtAllowInterval.TabIndex = 24; - this.utxtAllowInterval.Type = BWP.WinFormControl.UTextBoxWithPad.TextBoxType.Number; - // // GradeSettingFrom // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(354, 543); + this.ClientSize = new System.Drawing.Size(354, 473); this.ControlBox = false; this.Controls.Add(this.maxInput); this.Controls.Add(this.minInput); - this.Controls.Add(this.label9); this.Controls.Add(this.label8); this.Controls.Add(this.weightReadType); this.Controls.Add(this.label7); - this.Controls.Add(this.utxtAllowInterval); this.Controls.Add(this.discont); this.Controls.Add(this.format); this.Controls.Add(this.label6); @@ -284,7 +261,6 @@ this.Name = "GradeSettingFrom"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "称重设置"; - this.Load += new System.EventHandler(this.GradeSettingFrom_Load); this.ResumeLayout(false); this.PerformLayout(); @@ -311,7 +287,5 @@ private System.Windows.Forms.Label label8; private BWP.WinFormControl.UTextBoxWithPad minInput; private BWP.WinFormControl.UTextBoxWithPad maxInput; - private System.Windows.Forms.Label label9; - private BWP.WinFormControl.UTextBoxWithPad utxtAllowInterval; } } \ No newline at end of file diff --git a/WeighAndGrading/GradeSettingFrom.cs b/WeighAndGrading/GradeSettingFrom.cs index ed02521..c8bedd7 100644 --- a/WeighAndGrading/GradeSettingFrom.cs +++ b/WeighAndGrading/GradeSettingFrom.cs @@ -52,8 +52,6 @@ namespace WeighAndGrading weightReadType.SelectedIndex = GradeContext.Config.WeightType; minInput.Text = GradeContext.Config.MinWeight.ToString(); maxInput.Text = GradeContext.Config.MaxWeight.ToString(); - - utxtAllowInterval.Text = GradeContext.Config.AllowInterval.ToString(); } private void saveBtn_Click(object sender, EventArgs e) @@ -86,12 +84,6 @@ namespace WeighAndGrading else GradeContext.Config.Discont = 0; - decimal allowInterval; - if (decimal.TryParse(utxtAllowInterval.Text.Trim(), out allowInterval)) - { - GradeContext.Config.AllowInterval = allowInterval; - } - GradeContext.Save(); MessageBox.Show("保存成功!"); } @@ -100,10 +92,5 @@ namespace WeighAndGrading { this.Close(); } - - private void GradeSettingFrom_Load(object sender, EventArgs e) - { - - } } } diff --git a/WeighAndGrading/WeighAndGrading.csproj b/WeighAndGrading/WeighAndGrading.csproj index c598e91..c862b38 100644 --- a/WeighAndGrading/WeighAndGrading.csproj +++ b/WeighAndGrading/WeighAndGrading.csproj @@ -49,12 +49,6 @@ - - Form - - - AbnormalModifyForm.cs - Form @@ -89,9 +83,6 @@ - - AbnormalModifyForm.cs - BodyDiscontSetting.cs