diff --git a/BO/Utils/AfterLoginUtil.cs b/BO/Utils/AfterLoginUtil.cs index 1ecc9bc..9bd60b4 100644 --- a/BO/Utils/AfterLoginUtil.cs +++ b/BO/Utils/AfterLoginUtil.cs @@ -31,13 +31,12 @@ namespace BO.Utils //static List> roleToAssemblies = new List>() // { - // new Tuple("排宰员",@"\ButcherOrder"), + // 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") // }; diff --git a/BO/Utils/BillRpc/GradeAndWeightRpc.cs b/BO/Utils/BillRpc/GradeAndWeightRpc.cs index f583f94..729e6b4 100644 --- a/BO/Utils/BillRpc/GradeAndWeightRpc.cs +++ b/BO/Utils/BillRpc/GradeAndWeightRpc.cs @@ -325,10 +325,6 @@ namespace BO.Utils.BillRpc public static void InsertOrUpdate(GradeAndWeight_Detail entity) { - if (entity.Technics_Name == "烫褪") - entity.Technics = 0; - else - entity.Technics = 1; if (entity.SID == 0) { using (var session = LocalDmoSession.New()) @@ -340,31 +336,5 @@ namespace BO.Utils.BillRpc 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/ButcherWeight/WeightForm.Designer.cs b/ButcherWeight/WeightForm.Designer.cs index 033a531..f879d05 100644 --- a/ButcherWeight/WeightForm.Designer.cs +++ b/ButcherWeight/WeightForm.Designer.cs @@ -135,6 +135,19 @@ this.S_AbnormalItem_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.S_Number = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.billGrid = new System.Windows.Forms.DataGridView(); + this.M_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.M_FinishWeight = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.M_PrintNumber = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.M_B3ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.M_Car_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.M_Supplier_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.M_Employee_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.M_PurchaseType_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.M_Number = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.M_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.M_HouseNames = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.M_SanctionMoney = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.M_Remark = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.label15 = new System.Windows.Forms.Label(); this.label16 = new System.Windows.Forms.Label(); this.label17 = new System.Windows.Forms.Label(); @@ -149,19 +162,6 @@ this.farmerMenu = new System.Windows.Forms.ContextMenuStrip(this.components); this.farmerDelete = new System.Windows.Forms.ToolStripMenuItem(); this.viewDetailBtn = new System.Windows.Forms.Button(); - this.M_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.M_FinishWeight = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.M_PrintNumber = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.M_B3ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.M_Car_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.M_Supplier_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.M_Employee_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.M_PurchaseType_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.M_Number = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.M_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.M_HouseNames = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.M_SanctionMoney = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.M_Remark = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.panel1.SuspendLayout(); this.panel2.SuspendLayout(); this.panel3.SuspendLayout(); @@ -346,6 +346,7 @@ this.discontInput.Name = "discontInput"; this.discontInput.Size = new System.Drawing.Size(135, 29); this.discontInput.TabIndex = 41; + this.discontInput.TextChanged += new System.EventHandler(this.penMoneyInput_TextChanged); // // label9 // @@ -364,6 +365,7 @@ this.jingjianInput.Name = "jingjianInput"; this.jingjianInput.Size = new System.Drawing.Size(135, 29); this.jingjianInput.TabIndex = 39; + this.jingjianInput.TextChanged += new System.EventHandler(this.penMoneyInput_TextChanged); // // label6 // @@ -604,9 +606,9 @@ this.penMoneyInput.Font = new System.Drawing.Font("宋体", 14F); this.penMoneyInput.Location = new System.Drawing.Point(854, 89); this.penMoneyInput.Name = "penMoneyInput"; - this.penMoneyInput.ReadOnly = true; this.penMoneyInput.Size = new System.Drawing.Size(135, 29); this.penMoneyInput.TabIndex = 15; + this.penMoneyInput.TextChanged += new System.EventHandler(this.penMoneyInput_TextChanged); // // remarkInput // @@ -621,9 +623,9 @@ this.penPriceInput.Font = new System.Drawing.Font("宋体", 14F); this.penPriceInput.Location = new System.Drawing.Point(854, 50); this.penPriceInput.Name = "penPriceInput"; + this.penPriceInput.ReadOnly = true; this.penPriceInput.Size = new System.Drawing.Size(135, 29); this.penPriceInput.TabIndex = 12; - this.penPriceInput.TextChanged += new System.EventHandler(this.penWeightPriceInput_TextChanged); // // testCardNumberInput // @@ -640,7 +642,7 @@ this.penWeightInput.Name = "penWeightInput"; this.penWeightInput.Size = new System.Drawing.Size(135, 29); this.penWeightInput.TabIndex = 0; - this.penWeightInput.TextChanged += new System.EventHandler(this.penWeightPriceInput_TextChanged); + this.penWeightInput.TextChanged += new System.EventHandler(this.penMoneyInput_TextChanged); // // label14 // @@ -1194,6 +1196,112 @@ this.billGrid.TabIndex = 0; this.billGrid.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.billGrid_CellDoubleClick); // + // M_ID + // + this.M_ID.DataPropertyName = "ID"; + this.M_ID.HeaderText = "ID"; + this.M_ID.Name = "M_ID"; + this.M_ID.ReadOnly = true; + this.M_ID.Visible = false; + // + // M_FinishWeight + // + this.M_FinishWeight.DataPropertyName = "FinishWeight"; + this.M_FinishWeight.HeaderText = "FinishWeight"; + this.M_FinishWeight.Name = "M_FinishWeight"; + this.M_FinishWeight.ReadOnly = true; + this.M_FinishWeight.Visible = false; + // + // M_PrintNumber + // + this.M_PrintNumber.DataPropertyName = "PrintNumber"; + this.M_PrintNumber.HeaderText = "PrintNumber"; + this.M_PrintNumber.Name = "M_PrintNumber"; + this.M_PrintNumber.ReadOnly = true; + this.M_PrintNumber.Visible = false; + // + // M_B3ID + // + this.M_B3ID.DataPropertyName = "B3ID"; + this.M_B3ID.HeaderText = "过磅单号"; + this.M_B3ID.Name = "M_B3ID"; + this.M_B3ID.ReadOnly = true; + // + // M_Car_Name + // + this.M_Car_Name.DataPropertyName = "Car_Name"; + this.M_Car_Name.HeaderText = "车辆"; + this.M_Car_Name.Name = "M_Car_Name"; + this.M_Car_Name.ReadOnly = true; + this.M_Car_Name.Width = 120; + // + // M_Supplier_Name + // + this.M_Supplier_Name.DataPropertyName = "Supplier_Name"; + this.M_Supplier_Name.HeaderText = "供应商"; + this.M_Supplier_Name.Name = "M_Supplier_Name"; + this.M_Supplier_Name.ReadOnly = true; + this.M_Supplier_Name.Width = 120; + // + // M_Employee_Name + // + this.M_Employee_Name.DataPropertyName = "Employee_Name"; + this.M_Employee_Name.HeaderText = "业务员"; + this.M_Employee_Name.Name = "M_Employee_Name"; + this.M_Employee_Name.ReadOnly = true; + this.M_Employee_Name.Width = 110; + // + // M_PurchaseType_Name + // + this.M_PurchaseType_Name.DataPropertyName = "PurchaseType_Name"; + this.M_PurchaseType_Name.HeaderText = "收购类型"; + this.M_PurchaseType_Name.Name = "M_PurchaseType_Name"; + this.M_PurchaseType_Name.ReadOnly = true; + this.M_PurchaseType_Name.Width = 110; + // + // M_Number + // + this.M_Number.DataPropertyName = "Number"; + this.M_Number.HeaderText = "收购头数"; + this.M_Number.Name = "M_Number"; + this.M_Number.ReadOnly = true; + this.M_Number.Width = 110; + // + // M_Weight + // + this.M_Weight.DataPropertyName = "Weight"; + dataGridViewCellStyle19.Format = "#0.######"; + this.M_Weight.DefaultCellStyle = dataGridViewCellStyle19; + this.M_Weight.HeaderText = "收购重量"; + this.M_Weight.Name = "M_Weight"; + this.M_Weight.ReadOnly = true; + this.M_Weight.Width = 120; + // + // M_HouseNames + // + this.M_HouseNames.DataPropertyName = "HouseNames"; + this.M_HouseNames.HeaderText = "圈舍"; + this.M_HouseNames.Name = "M_HouseNames"; + this.M_HouseNames.ReadOnly = true; + this.M_HouseNames.Width = 180; + // + // M_SanctionMoney + // + this.M_SanctionMoney.DataPropertyName = "SanctionMoney"; + dataGridViewCellStyle20.Format = "#0.######"; + this.M_SanctionMoney.DefaultCellStyle = dataGridViewCellStyle20; + this.M_SanctionMoney.HeaderText = "异常明细"; + this.M_SanctionMoney.Name = "M_SanctionMoney"; + this.M_SanctionMoney.ReadOnly = true; + // + // M_Remark + // + this.M_Remark.DataPropertyName = "Remark"; + this.M_Remark.HeaderText = "摘要"; + this.M_Remark.Name = "M_Remark"; + this.M_Remark.ReadOnly = true; + this.M_Remark.Width = 130; + // // label15 // this.label15.AutoSize = true; @@ -1329,112 +1437,6 @@ this.viewDetailBtn.UseVisualStyleBackColor = true; this.viewDetailBtn.Click += new System.EventHandler(this.viewDetailBtn_Click); // - // M_ID - // - this.M_ID.DataPropertyName = "ID"; - this.M_ID.HeaderText = "ID"; - this.M_ID.Name = "M_ID"; - this.M_ID.ReadOnly = true; - this.M_ID.Visible = false; - // - // M_FinishWeight - // - this.M_FinishWeight.DataPropertyName = "FinishWeight"; - this.M_FinishWeight.HeaderText = "FinishWeight"; - this.M_FinishWeight.Name = "M_FinishWeight"; - this.M_FinishWeight.ReadOnly = true; - this.M_FinishWeight.Visible = false; - // - // M_PrintNumber - // - this.M_PrintNumber.DataPropertyName = "PrintNumber"; - this.M_PrintNumber.HeaderText = "PrintNumber"; - this.M_PrintNumber.Name = "M_PrintNumber"; - this.M_PrintNumber.ReadOnly = true; - this.M_PrintNumber.Visible = false; - // - // M_B3ID - // - this.M_B3ID.DataPropertyName = "B3ID"; - this.M_B3ID.HeaderText = "过磅单号"; - this.M_B3ID.Name = "M_B3ID"; - this.M_B3ID.ReadOnly = true; - // - // M_Car_Name - // - this.M_Car_Name.DataPropertyName = "Car_Name"; - this.M_Car_Name.HeaderText = "车辆"; - this.M_Car_Name.Name = "M_Car_Name"; - this.M_Car_Name.ReadOnly = true; - this.M_Car_Name.Width = 120; - // - // M_Supplier_Name - // - this.M_Supplier_Name.DataPropertyName = "Supplier_Name"; - this.M_Supplier_Name.HeaderText = "供应商"; - this.M_Supplier_Name.Name = "M_Supplier_Name"; - this.M_Supplier_Name.ReadOnly = true; - this.M_Supplier_Name.Width = 120; - // - // M_Employee_Name - // - this.M_Employee_Name.DataPropertyName = "Employee_Name"; - this.M_Employee_Name.HeaderText = "业务员"; - this.M_Employee_Name.Name = "M_Employee_Name"; - this.M_Employee_Name.ReadOnly = true; - this.M_Employee_Name.Width = 110; - // - // M_PurchaseType_Name - // - this.M_PurchaseType_Name.DataPropertyName = "PurchaseType_Name"; - this.M_PurchaseType_Name.HeaderText = "收购类型"; - this.M_PurchaseType_Name.Name = "M_PurchaseType_Name"; - this.M_PurchaseType_Name.ReadOnly = true; - this.M_PurchaseType_Name.Width = 110; - // - // M_Number - // - this.M_Number.DataPropertyName = "Number"; - this.M_Number.HeaderText = "收购头数"; - this.M_Number.Name = "M_Number"; - this.M_Number.ReadOnly = true; - this.M_Number.Width = 110; - // - // M_Weight - // - this.M_Weight.DataPropertyName = "Weight"; - dataGridViewCellStyle19.Format = "#0.######"; - this.M_Weight.DefaultCellStyle = dataGridViewCellStyle19; - this.M_Weight.HeaderText = "收购重量"; - this.M_Weight.Name = "M_Weight"; - this.M_Weight.ReadOnly = true; - this.M_Weight.Width = 120; - // - // M_HouseNames - // - this.M_HouseNames.DataPropertyName = "HouseNames"; - this.M_HouseNames.HeaderText = "圈舍"; - this.M_HouseNames.Name = "M_HouseNames"; - this.M_HouseNames.ReadOnly = true; - this.M_HouseNames.Width = 180; - // - // M_SanctionMoney - // - this.M_SanctionMoney.DataPropertyName = "SanctionMoney"; - dataGridViewCellStyle20.Format = "#0.######"; - this.M_SanctionMoney.DefaultCellStyle = dataGridViewCellStyle20; - this.M_SanctionMoney.HeaderText = "异常明细"; - this.M_SanctionMoney.Name = "M_SanctionMoney"; - this.M_SanctionMoney.ReadOnly = true; - // - // M_Remark - // - this.M_Remark.DataPropertyName = "Remark"; - this.M_Remark.HeaderText = "摘要"; - this.M_Remark.Name = "M_Remark"; - this.M_Remark.ReadOnly = true; - this.M_Remark.Width = 130; - // // WeightForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); diff --git a/ButcherWeight/WeightForm.cs b/ButcherWeight/WeightForm.cs index 391ce0b..47cdac0 100644 --- a/ButcherWeight/WeightForm.cs +++ b/ButcherWeight/WeightForm.cs @@ -515,14 +515,24 @@ namespace ButcherWeight } } - private void penWeightPriceInput_TextChanged(object sender, EventArgs e) + private void penMoneyInput_TextChanged(object sender, EventArgs e) { - decimal w = 0; - decimal price = 0; - if (decimal.TryParse(penWeightInput.Text, out w) && decimal.TryParse(penPriceInput.Text, out price)) - penMoneyInput.Text = (w * price).ToString("#0.######"); + //得到单价 + decimal money = 0; + decimal tryOut=0; + if (!string.IsNullOrEmpty(penMoneyInput.Text) && decimal.TryParse(penMoneyInput.Text, out tryOut)) + money += tryOut; + if (!string.IsNullOrEmpty(jingjianInput.Text) && decimal.TryParse(jingjianInput.Text, out tryOut)) + money += tryOut; + if (!string.IsNullOrEmpty(discontInput.Text) && decimal.TryParse(discontInput.Text, out tryOut)) + money -= tryOut; + decimal weight = 0; + if (!string.IsNullOrEmpty(penWeightInput.Text) && decimal.TryParse(penWeightInput.Text, out tryOut)) + weight = tryOut; + if (weight == 0) + penPriceInput.Text = "0"; else - penMoneyInput.Text = "0"; + penPriceInput.Text = decimal.Round((money / weight),2).ToString(); } private void printBtn_Click(object sender, EventArgs e) diff --git a/WeighAndGrading/DataConfirm.Designer.cs b/WeighAndGrading/DataConfirm.Designer.cs index dcb8a54..b6d8b3e 100644 --- a/WeighAndGrading/DataConfirm.Designer.cs +++ b/WeighAndGrading/DataConfirm.Designer.cs @@ -56,14 +56,6 @@ this.ttPanel = new System.Windows.Forms.FlowLayoutPanel(); this.mbPanel = new System.Windows.Forms.FlowLayoutPanel(); this.weightGrid = new BWP.WinFormControl.UDataGridView(); - this.H_SID = new System.Windows.Forms.DataGridViewTextBoxColumn(); - 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_Save = new System.Windows.Forms.DataGridViewButtonColumn(); this.label5 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.tangNumber = new System.Windows.Forms.Label(); @@ -77,6 +69,16 @@ this.tangBtn = new System.Windows.Forms.Button(); this.maoBtn = new System.Windows.Forms.Button(); this.leftVScrollBar = new System.Windows.Forms.VScrollBar(); + this.H_SID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.H_Technics = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.H_Livestock_ID = 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.H_Save = new System.Windows.Forms.DataGridViewButtonColumn(); ((System.ComponentModel.ISupportInitialize)(this.orderGridView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.weightGrid)).BeginInit(); this.SuspendLayout(); @@ -297,9 +299,11 @@ this.weightGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.weightGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.H_SID, + this.H_Technics, + this.H_Livestock_ID, this.H_Index, this.H_Order, - this.H_Technics, + this.H_Technics_Name, this.H_Livestock_Name, this.H_Weight, this.H_Time, @@ -320,77 +324,6 @@ this.weightGrid.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.weightGrid_CellClick); this.weightGrid.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.weightGrid_CellContentClick); // - // 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_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"; - dataGridViewCellStyle6.Format = "#0.######"; - this.H_Weight.DefaultCellStyle = dataGridViewCellStyle6; - 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"; - dataGridViewCellStyle7.Format = "HH:mm:ss"; - dataGridViewCellStyle7.NullValue = null; - this.H_Time.DefaultCellStyle = dataGridViewCellStyle7; - this.H_Time.HeaderText = "时间"; - this.H_Time.Name = "H_Time"; - this.H_Time.ReadOnly = true; - // - // H_Save - // - dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle8.Padding = new System.Windows.Forms.Padding(5, 10, 5, 10); - this.H_Save.DefaultCellStyle = dataGridViewCellStyle8; - this.H_Save.HeaderText = "保存"; - this.H_Save.Name = "H_Save"; - this.H_Save.ReadOnly = true; - this.H_Save.Text = "保存"; - this.H_Save.UseColumnTextForButtonValue = true; - // // label5 // this.label5.AutoSize = true; @@ -528,6 +461,93 @@ this.leftVScrollBar.Size = new System.Drawing.Size(40, 617); this.leftVScrollBar.TabIndex = 70; // + // 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_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_Livestock_ID + // + this.H_Livestock_ID.DataPropertyName = "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_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 = 90; + // + // H_Weight + // + this.H_Weight.DataPropertyName = "Weight"; + dataGridViewCellStyle6.Format = "#0.######"; + this.H_Weight.DefaultCellStyle = dataGridViewCellStyle6; + 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"; + dataGridViewCellStyle7.Format = "HH:mm:ss"; + dataGridViewCellStyle7.NullValue = null; + this.H_Time.DefaultCellStyle = dataGridViewCellStyle7; + this.H_Time.HeaderText = "时间"; + this.H_Time.Name = "H_Time"; + this.H_Time.ReadOnly = true; + // + // H_Save + // + dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle8.Padding = new System.Windows.Forms.Padding(5, 10, 5, 10); + this.H_Save.DefaultCellStyle = dataGridViewCellStyle8; + this.H_Save.HeaderText = "保存"; + this.H_Save.Name = "H_Save"; + this.H_Save.ReadOnly = true; + this.H_Save.Text = "保存"; + this.H_Save.UseColumnTextForButtonValue = true; + // // DataConfirm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); @@ -600,14 +620,6 @@ private System.Windows.Forms.Label maoNumber; private System.Windows.Forms.Label label7; private System.Windows.Forms.Label label8; - private System.Windows.Forms.DataGridViewTextBoxColumn H_SID; - 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_Livestock_Name; - private System.Windows.Forms.DataGridViewTextBoxColumn H_Weight; - private System.Windows.Forms.DataGridViewTextBoxColumn H_Time; - private System.Windows.Forms.DataGridViewButtonColumn H_Save; private System.Windows.Forms.Button AddBtn; private System.Windows.Forms.Button deleteBtn; private System.Windows.Forms.Label tangW; @@ -615,5 +627,15 @@ private System.Windows.Forms.Button tangBtn; private System.Windows.Forms.Button maoBtn; private System.Windows.Forms.VScrollBar leftVScrollBar; + private System.Windows.Forms.DataGridViewTextBoxColumn H_SID; + private System.Windows.Forms.DataGridViewTextBoxColumn H_Technics; + private System.Windows.Forms.DataGridViewTextBoxColumn H_Livestock_ID; + private System.Windows.Forms.DataGridViewTextBoxColumn H_Index; + private System.Windows.Forms.DataGridViewTextBoxColumn H_Order; + 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.DataGridViewButtonColumn H_Save; } } \ No newline at end of file diff --git a/WeighAndGrading/DataConfirm.cs b/WeighAndGrading/DataConfirm.cs index f1a38e5..f60fd2c 100644 --- a/WeighAndGrading/DataConfirm.cs +++ b/WeighAndGrading/DataConfirm.cs @@ -150,7 +150,7 @@ namespace WeighAndGrading { if (e.RowIndex == -1) return; - if (e.ColumnIndex == 7) + if (e.ColumnIndex == weightGrid.Columns.Count - 1) { LocalGradeAndWeightBL.InsertOrUpdate(select); rightBtn_Click(sender, EventArgs.Empty); diff --git a/WeighAndGrading/DataConfirm.resx b/WeighAndGrading/DataConfirm.resx index 6950a26..6280e9b 100644 --- a/WeighAndGrading/DataConfirm.resx +++ b/WeighAndGrading/DataConfirm.resx @@ -132,13 +132,19 @@ True + + True + + + True + True True - + True diff --git a/WeighAndGrading/GradeFrom.Designer.cs b/WeighAndGrading/GradeFrom.Designer.cs index b086054..b6549cf 100644 --- a/WeighAndGrading/GradeFrom.Designer.cs +++ b/WeighAndGrading/GradeFrom.Designer.cs @@ -73,6 +73,16 @@ 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.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.isPrintCheckBox = new System.Windows.Forms.CheckBox(); this.printBtn = new System.Windows.Forms.Button(); this.panel1 = new System.Windows.Forms.Panel(); @@ -91,16 +101,6 @@ 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(); @@ -511,6 +511,89 @@ 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; + // + // 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; + // // isPrintCheckBox // this.isPrintCheckBox.AutoSize = true; @@ -709,89 +792,6 @@ 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; diff --git a/WeighAndGrading/GradeFrom.cs b/WeighAndGrading/GradeFrom.cs index 26e4f4c..0146baf 100644 --- a/WeighAndGrading/GradeFrom.cs +++ b/WeighAndGrading/GradeFrom.cs @@ -314,7 +314,6 @@ namespace WeighAndGrading } } - void BindTangGrid() { tangGridView.DataSource = tangList.OrderBy(x => x.Order).OrderBy(x => x.Finish).ToList(); @@ -360,6 +359,7 @@ namespace WeighAndGrading { maoList = GradeAndWeightRpc.GetGradeAndWeightList(butcherTimeInput.Date.Value, false); } + } catch (TimeoutException) { } } @@ -370,9 +370,9 @@ namespace WeighAndGrading } } - void BindMaoGrid() { + maoGridView.DataSource = maoList.OrderBy(x => x.Order).OrderBy(x => x.Finish).ToList(); if (maoEntity == null && maoGridView.CurrentRow != null) { @@ -778,10 +778,7 @@ namespace WeighAndGrading if (details.Count == 50) details.RemoveAt(49); details.Insert(0, entity); - // LocalGradeAndWeightBL.Insert(entity); 改成调用方法 方便加锁 - LocalGradeAndWeightBLInsert(entity); - // noWeightList.Enqueue(entity); // 添加的掉猪明细不加入到没有称重队列 - + LocalGradeAndWeightBL.Insert(entity); //这里绑定界面 东旭说不应该放到锁了 不知道怎么改 BindDetailGrid(); @@ -807,16 +804,6 @@ namespace WeighAndGrading } } - static object insertweightdetail = new object(); - void LocalGradeAndWeightBLInsert(GradeAndWeight_Detail entity) - { - //为了防止点级别和称重同时进行 - lock (insertweightdetail) - { - LocalGradeAndWeightBL.Insert(entity); - } - } - void SetlblSucessVisibleFalse() { this.Invoke(new InvokeHandler(delegate @@ -850,8 +837,7 @@ namespace WeighAndGrading details.RemoveAt(49); details.Insert(0, entity); - //LocalGradeAndWeightBL.Insert(entity); //改成调用方法 方便加锁 - LocalGradeAndWeightBLInsert(entity); + LocalGradeAndWeightBL.Insert(entity); noLivestockList.Enqueue(entity); } @@ -868,106 +854,78 @@ namespace WeighAndGrading //删除选中 private void btnDeleteSelected_Click(object sender, EventArgs e) { - if (MessageBox.Show("确定删除选中一条称重记录?", "删除选中", MessageBoxButtons.OKCancel) == DialogResult.Cancel) - { + if (MessageBox.Show("确定删除选中的称重记录?", "删除选中", MessageBoxButtons.OKCancel) == DialogResult.Cancel) return; - } - if (lastCheckItem == null) - { - return; - } - //如果没有选中 - if (!lastCheckItem.ReadWeight) + if (modifyDetail == null) { + UMessageBox.Show("请选中要删除的记录"); return; } //删除选中 更新 IsDeleted 和 Sync - lastCheckItem.IsDeleted = true; - LocalGradeAndWeightBL.Update(lastCheckItem, "IsDeleted"); - if (lastCheckItem.Order.HasValue) + lock (_obj) { - if (lastCheckItem.Technics == 0) + modifyDetail.IsDeleted = true; + LocalGradeAndWeightBL.Update(modifyDetail, "IsDeleted"); + details.Remove(modifyDetail); + if (modifyDetail.Order > 0) { - foreach (DataGridViewRow row in tangGridView.Rows) + if (modifyDetail.Technics == 0) { - if ((int)row.Cells["T_Order"].Value == lastCheckItem.Order.Value) + foreach (DataGridViewRow row in tangGridView.Rows) { - var r = row.DataBoundItem as GradeAndWeight; - r.Already -= 1; - tangGridView.Refresh(); - break; + if ((int)row.Cells["T_Order"].Value == modifyDetail.Order.Value) + { + var r = row.DataBoundItem as GradeAndWeight; + r.Already -= 1; + tangGridView.Refresh(); + break; + } } } - } - else - { - foreach (DataGridViewRow row in maoGridView.Rows) + else { - if ((int)row.Cells["M_Order"].Value == lastCheckItem.Order.Value) + foreach (DataGridViewRow row in maoGridView.Rows) { - var r = row.DataBoundItem as GradeAndWeight; - r.Already -= 1; - maoGridView.Refresh(); - break; + if ((int)row.Cells["M_Order"].Value == modifyDetail.Order.Value) + { + var r = row.DataBoundItem as GradeAndWeight; + r.Already -= 1; + maoGridView.Refresh(); + break; + } } } } - } - - details.Remove(lastCheckItem); - - - //找到锁定的最大id - long suodingmaxsid = 0; - var lostweightlist = details.Where(x => x.IsLostWeight).ToList(); - if (lostweightlist.Count > 0) - { - suodingmaxsid = lostweightlist.Max(x => x.SID); - } - - //重新赋值 队列 - //重新设置没有级别的 - noLivestockList = new ConcurrentQueue(); - var stackNoLiveStock = new Stack(); - - //把没有级别的记录加进去 - var livestockNoNameList = details.Where(x => string.IsNullOrWhiteSpace(x.Livestock_Name)); - foreach (var item in livestockNoNameList) - { - if (item.SID > suodingmaxsid) + if (modifyDetail.Technics == null) { - stackNoLiveStock.Push(item); + //重新赋值 队列 + //重新设置没有级别的 + noLivestockList = new ConcurrentQueue(); + var stackNoLiveStock = new Stack(); + //把没有级别的记录加进去 + foreach (var item in details) + { + if (item.Technics.HasValue) + break; + stackNoLiveStock.Push(item); + } + while (stackNoLiveStock.Count > 0) + { + noLivestockList.Enqueue(stackNoLiveStock.Pop()); + } } + modifyDetail = null; + modifyPanel.Hide(); } - while (stackNoLiveStock.Count > 0) - { - noLivestockList.Enqueue(stackNoLiveStock.Pop()); - } + BindDetailGrid(); } - GradeAndWeight_Detail lastCheckItem, mCurrentSlectItem; private void historyGrid_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) return; var currentRow = historyGrid.CurrentRow.DataBoundItem as GradeAndWeight_Detail; - - mCurrentSlectItem = currentRow; - - if (e.ColumnIndex == 4) - { - if (lastCheckItem != null && lastCheckItem.SID != currentRow.SID) - lastCheckItem.ReadWeight = false; - lastCheckItem = currentRow; - lastCheckItem.ReadWeight = !lastCheckItem.ReadWeight; - // - modifyDetail = null; - if (modifyPanel.Visible) - modifyPanel.Hide(); - historyGrid.Refresh(); - return; - } modifyDetail = currentRow; stateLabel.Text = string.Format("您正在修改序号为 {0} 的信息", modifyDetail.Index); modifyPanel.Show(); @@ -1009,11 +967,10 @@ namespace WeighAndGrading return; } entity.Finish = true; - VerifyConnection(); 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; + //var first = tangList.FirstOrDefault(x => x.OrderDetail_ID == entity.OrderDetail_ID); + //if (first != null) + // first.Finish = true; tangEntity = null; BindTangGrid(); } @@ -1055,9 +1012,9 @@ namespace WeighAndGrading } entity.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; + //var first = maoList.FirstOrDefault(x => x.OrderDetail_ID == entity.OrderDetail_ID); + //if (first != null) + // first.Finish = true; maoEntity = null; BindMaoGrid(); }