diff --git a/BO/BO/Bill/WeightBill/WeightBill.cs b/BO/BO/Bill/WeightBill/WeightBill.cs index 9ee9dae..1f23033 100644 --- a/BO/BO/Bill/WeightBill/WeightBill.cs +++ b/BO/BO/Bill/WeightBill/WeightBill.cs @@ -104,7 +104,7 @@ namespace BO.BO } } - public int? HouseNumber { get { if (_houseDetails.Any()) return _details.Sum(x => (x.Number ?? 0)); return null; } } + public int? HouseNumber { get { if (_houseDetails.Any()) return _houseDetails.Sum(x => (x.Number ?? 0)); return null; } } private List _sanctionDetails = new List(); public List SanctionDetails { get { return _sanctionDetails; } } diff --git a/BO/BO/Bill/WeightBill/WeightBill_HouseDetail.cs b/BO/BO/Bill/WeightBill/WeightBill_HouseDetail.cs index 0a22406..3336f3c 100644 --- a/BO/BO/Bill/WeightBill/WeightBill_HouseDetail.cs +++ b/BO/BO/Bill/WeightBill/WeightBill_HouseDetail.cs @@ -15,7 +15,7 @@ namespace BO.BO public long? LiveColonyHouse_ID { get; set; } - public long? LiveColonyHouse_Name { get; set; } + public string LiveColonyHouse_Name { get; set; } public int? Number { get; set; } } diff --git a/BO/BO/Bill/WeightBill/WeightBill_SanctionDetail.cs b/BO/BO/Bill/WeightBill/WeightBill_SanctionDetail.cs index 3f6377a..975c4e1 100644 --- a/BO/BO/Bill/WeightBill/WeightBill_SanctionDetail.cs +++ b/BO/BO/Bill/WeightBill/WeightBill_SanctionDetail.cs @@ -26,7 +26,7 @@ namespace BO.BO /// /// 异常项目名称 /// - public long? AbnormalItem_Name { get; set; } + public string AbnormalItem_Name { get; set; } public int? Number { get; set; } } diff --git a/BO/Utils/BillRpc/WeightBillRpc.cs b/BO/Utils/BillRpc/WeightBillRpc.cs index d855abe..cc6a469 100644 --- a/BO/Utils/BillRpc/WeightBillRpc.cs +++ b/BO/Utils/BillRpc/WeightBillRpc.cs @@ -218,5 +218,56 @@ namespace BO.Utils.BillRpc } return result; } + + public static int InsertHouseAndSanctionInfo(WeightBill bo) + { + const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/WeightBillRpc/InsertWeightBillHouseDetail"; + var obj = new RpcObject("/MainSystem/B3ClientService/BO/WeightBill"); + + obj.Set("HogGrade_ID", bo.HogGrade_ID); + obj.Set("HogGrade_Name", bo.HogGrade_Name); + obj.Set("Inspector_ID", ButcherAppContext.Context.UserConfig.Employee_ID); + obj.Set("Inspector_Name", ButcherAppContext.Context.UserConfig.Employee_Name); + + const string houseErtPath = "/MainSystem/B3ClientService/BO/WeightBill_HouseDetail"; + + var houseDetails = new ManyList(houseErtPath); + foreach (var detail in bo.HouseDetails) + { + var objDetail = new RpcObject(houseErtPath); + objDetail.Set("WeightBill_ID", detail.WeightBill_ID); + objDetail.Set("Index", detail.Index); + objDetail.Set("LiveColonyHouse_ID", detail.LiveColonyHouse_ID); + objDetail.Set("LiveColonyHouse_Name", detail.LiveColonyHouse_Name); + objDetail.Set("Number", detail.Number); + houseDetails.Add(objDetail); + } + + obj.Set("HouseDetails", houseDetails); + + const string sanctionsErtPath = "/MainSystem/B3ClientService/BO/WeightBill_SanctionDetail"; + + var sanctionDetails = new ManyList(sanctionsErtPath); + foreach (var detail in bo.SanctionDetails) + { + var objDetail = new RpcObject(sanctionsErtPath); + objDetail.Set("WeightBill_ID", detail.WeightBill_ID); + objDetail.Set("Index", detail.Index); + objDetail.Set("Sanction_ID", detail.Sanction_ID); + objDetail.Set("AbnormalItem_ID", detail.AbnormalItem_ID); + objDetail.Set("AbnormalItem_Name", detail.AbnormalItem_Name); + objDetail.Set("Number", detail.Number); + sanctionDetails.Add(objDetail); + } + + obj.Set("SanctionDetails", sanctionDetails); + return RpcFacade.Call(method, obj); + } + + public static int GetHouseDetailTotalNumber(DateTime date) + { + const string method = "/MainSystem/B3ClientService/Rpcs/BillRpc/WeightBillRpc/GetHouseDetailTotalNumber"; + return RpcFacade.Call(method, date); + } } } diff --git a/ButcherManageClient/Program.cs b/ButcherManageClient/Program.cs index 6595e4f..d342bd3 100644 --- a/ButcherManageClient/Program.cs +++ b/ButcherManageClient/Program.cs @@ -40,7 +40,7 @@ namespace ButcherManageClient catch (Exception e) { // LogUtil.WriteError(e); - MessageBox.Show("错误:" + e.Message); + MessageBox.Show("错误:" + e.Message + " \n详细信息:" + e.StackTrace); } } @@ -58,7 +58,8 @@ namespace ButcherManageClient //LogUtil.WriteError(ex); err = ex.Message; } - MessageBox.Show("错误:" + err); + MessageBox.Show("错误:" + ex.Message + " \n详细信息:" + ex.StackTrace); + // MessageBox.Show("错误:" + err); } private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) @@ -70,7 +71,9 @@ namespace ButcherManageClient //LogUtil.WriteError(ex); err = ex.Message; } - MessageBox.Show("错误:" + err); + + MessageBox.Show("错误:" + ex.Message + " \n详细信息:" + ex.StackTrace); + //MessageBox.Show("错误:" + err); } } } diff --git a/QualityAndOrder/QualityOrderForm.Designer.cs b/QualityAndOrder/QualityOrderForm.Designer.cs index 8bb9bd8..0431923 100644 --- a/QualityAndOrder/QualityOrderForm.Designer.cs +++ b/QualityAndOrder/QualityOrderForm.Designer.cs @@ -46,9 +46,21 @@ this.uTabControl2 = new BWP.WinFormControl.UTabControl(); this.tabPage3 = new System.Windows.Forms.TabPage(); this.sanctionGrid = new BWP.WinFormControl.UDataGridView(); + this.S_AbnormalItem_Name1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.S_Number1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.S_AbnormalItem_Name2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.S_Number2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.S_AbnormalItem_Name3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.S_Number3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.S_Sanction_ID1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.S_AbnormalItem_ID1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.S_Sanction_ID2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.S_AbnormalItem_ID2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.S_Sanction_ID3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.S_AbnormalItem_ID3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.tabPage4 = new System.Windows.Forms.TabPage(); this.housePanel = new System.Windows.Forms.TabControl(); - this.label3 = new System.Windows.Forms.Label(); + this.inHouseNumberLabel = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.hogGradePanel = new System.Windows.Forms.FlowLayoutPanel(); this.closeBtn = new System.Windows.Forms.Button(); @@ -57,11 +69,6 @@ this.label1 = new System.Windows.Forms.Label(); this.keyBoardPanel = new System.Windows.Forms.FlowLayoutPanel(); this.weightBillGrid = new BWP.WinFormControl.UDataGridView(); - this.W_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.W_B3ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.W_Supplier_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.W_HouseNumber = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.W_HouseNames = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.syncBtn = new System.Windows.Forms.Button(); this.testTimeInput = new BWP.WinFormControl.UDatePicker(); this.label20 = new System.Windows.Forms.Label(); @@ -89,18 +96,12 @@ this.tab2SyncBtn = new System.Windows.Forms.Button(); this.tab2DateSelect = new BWP.WinFormControl.UDatePicker(); this.label4 = new System.Windows.Forms.Label(); - this.S_AbnormalItem_Name1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.S_Number1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.S_AbnormalItem_Name2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.S_Number2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.S_AbnormalItem_Name3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.S_Number3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.S_Sanction_ID1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.S_AbnormalItem_ID1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.S_Sanction_ID2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.S_AbnormalItem_ID2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.S_Sanction_ID3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.S_AbnormalItem_ID3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.W_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.W_B3ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.W_Supplier_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.W_HouseNumber = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.W_HouseNames = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.W_FinishCreate = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.uTabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); this.panel1.SuspendLayout(); @@ -124,14 +125,14 @@ this.uTabControl1.Location = new System.Drawing.Point(0, 0); this.uTabControl1.Name = "uTabControl1"; this.uTabControl1.SelectedIndex = 0; - this.uTabControl1.Size = new System.Drawing.Size(1276, 873); + this.uTabControl1.Size = new System.Drawing.Size(1276, 741); this.uTabControl1.SizeMode = System.Windows.Forms.TabSizeMode.Fixed; this.uTabControl1.TabIndex = 0; // // tabPage1 // this.tabPage1.Controls.Add(this.panel1); - this.tabPage1.Controls.Add(this.label3); + this.tabPage1.Controls.Add(this.inHouseNumberLabel); this.tabPage1.Controls.Add(this.label2); this.tabPage1.Controls.Add(this.hogGradePanel); this.tabPage1.Controls.Add(this.closeBtn); @@ -146,7 +147,7 @@ this.tabPage1.Location = new System.Drawing.Point(4, 54); this.tabPage1.Name = "tabPage1"; this.tabPage1.Padding = new System.Windows.Forms.Padding(3); - this.tabPage1.Size = new System.Drawing.Size(1268, 815); + this.tabPage1.Size = new System.Drawing.Size(1268, 683); this.tabPage1.TabIndex = 0; this.tabPage1.Text = "验质分圈"; this.tabPage1.UseVisualStyleBackColor = true; @@ -230,6 +231,99 @@ this.sanctionGrid.Size = new System.Drawing.Size(717, 540); this.sanctionGrid.TabIndex = 43; // + // S_AbnormalItem_Name1 + // + this.S_AbnormalItem_Name1.DataPropertyName = "AbnormalItem_Name1"; + this.S_AbnormalItem_Name1.HeaderText = "异常项"; + this.S_AbnormalItem_Name1.Name = "S_AbnormalItem_Name1"; + this.S_AbnormalItem_Name1.ReadOnly = true; + // + // S_Number1 + // + this.S_Number1.DataPropertyName = "Number1"; + this.S_Number1.HeaderText = "头数"; + this.S_Number1.Name = "S_Number1"; + this.S_Number1.ReadOnly = true; + this.S_Number1.Width = 135; + // + // S_AbnormalItem_Name2 + // + this.S_AbnormalItem_Name2.DataPropertyName = "AbnormalItem_Name2"; + this.S_AbnormalItem_Name2.HeaderText = "异常项"; + this.S_AbnormalItem_Name2.Name = "S_AbnormalItem_Name2"; + this.S_AbnormalItem_Name2.ReadOnly = true; + // + // S_Number2 + // + this.S_Number2.DataPropertyName = "Number2"; + this.S_Number2.HeaderText = "头数"; + this.S_Number2.Name = "S_Number2"; + this.S_Number2.ReadOnly = true; + this.S_Number2.Width = 135; + // + // S_AbnormalItem_Name3 + // + this.S_AbnormalItem_Name3.DataPropertyName = "AbnormalItem_Name3"; + this.S_AbnormalItem_Name3.HeaderText = "异常项"; + this.S_AbnormalItem_Name3.Name = "S_AbnormalItem_Name3"; + this.S_AbnormalItem_Name3.ReadOnly = true; + // + // S_Number3 + // + this.S_Number3.DataPropertyName = "Number3"; + this.S_Number3.HeaderText = "头数"; + this.S_Number3.Name = "S_Number3"; + this.S_Number3.ReadOnly = true; + this.S_Number3.Width = 135; + // + // S_Sanction_ID1 + // + this.S_Sanction_ID1.DataPropertyName = "Sanction_ID1"; + this.S_Sanction_ID1.HeaderText = "Sanction_ID1"; + this.S_Sanction_ID1.Name = "S_Sanction_ID1"; + this.S_Sanction_ID1.ReadOnly = true; + this.S_Sanction_ID1.Visible = false; + // + // S_AbnormalItem_ID1 + // + this.S_AbnormalItem_ID1.DataPropertyName = "AbnormalItem_ID1"; + this.S_AbnormalItem_ID1.HeaderText = "AbnormalItem_ID1"; + this.S_AbnormalItem_ID1.Name = "S_AbnormalItem_ID1"; + this.S_AbnormalItem_ID1.ReadOnly = true; + this.S_AbnormalItem_ID1.Visible = false; + // + // S_Sanction_ID2 + // + this.S_Sanction_ID2.DataPropertyName = "Sanction_ID2"; + this.S_Sanction_ID2.HeaderText = "Sanction_ID2"; + this.S_Sanction_ID2.Name = "S_Sanction_ID2"; + this.S_Sanction_ID2.ReadOnly = true; + this.S_Sanction_ID2.Visible = false; + // + // S_AbnormalItem_ID2 + // + this.S_AbnormalItem_ID2.DataPropertyName = "AbnormalItem_ID2"; + this.S_AbnormalItem_ID2.HeaderText = "AbnormalItem_ID2"; + this.S_AbnormalItem_ID2.Name = "S_AbnormalItem_ID2"; + this.S_AbnormalItem_ID2.ReadOnly = true; + this.S_AbnormalItem_ID2.Visible = false; + // + // S_Sanction_ID3 + // + this.S_Sanction_ID3.DataPropertyName = "Sanction_ID3"; + this.S_Sanction_ID3.HeaderText = "Sanction_ID3"; + this.S_Sanction_ID3.Name = "S_Sanction_ID3"; + this.S_Sanction_ID3.ReadOnly = true; + this.S_Sanction_ID3.Visible = false; + // + // S_AbnormalItem_ID3 + // + this.S_AbnormalItem_ID3.DataPropertyName = "AbnormalItem_ID3"; + this.S_AbnormalItem_ID3.HeaderText = "AbnormalItem_ID3"; + this.S_AbnormalItem_ID3.Name = "S_AbnormalItem_ID3"; + this.S_AbnormalItem_ID3.ReadOnly = true; + this.S_AbnormalItem_ID3.Visible = false; + // // tabPage4 // this.tabPage4.Controls.Add(this.housePanel); @@ -255,16 +349,16 @@ this.housePanel.SizeMode = System.Windows.Forms.TabSizeMode.Fixed; this.housePanel.TabIndex = 0; // - // label3 + // inHouseNumberLabel // - this.label3.AutoSize = true; - this.label3.Font = new System.Drawing.Font("宋体", 15F); - this.label3.ForeColor = System.Drawing.Color.Red; - this.label3.Location = new System.Drawing.Point(838, 24); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(39, 20); - this.label3.TabIndex = 42; - this.label3.Text = "100"; + this.inHouseNumberLabel.AutoSize = true; + this.inHouseNumberLabel.Font = new System.Drawing.Font("宋体", 15F); + this.inHouseNumberLabel.ForeColor = System.Drawing.Color.Red; + this.inHouseNumberLabel.Location = new System.Drawing.Point(838, 24); + this.inHouseNumberLabel.Name = "inHouseNumberLabel"; + this.inHouseNumberLabel.Size = new System.Drawing.Size(19, 20); + this.inHouseNumberLabel.TabIndex = 42; + this.inHouseNumberLabel.Text = "0"; // // label2 // @@ -356,7 +450,8 @@ this.W_B3ID, this.W_Supplier_Name, this.W_HouseNumber, - this.W_HouseNames}); + this.W_HouseNames, + this.W_FinishCreate}); this.weightBillGrid.Location = new System.Drawing.Point(25, 77); this.weightBillGrid.MultiSelect = false; this.weightBillGrid.Name = "weightBillGrid"; @@ -364,49 +459,11 @@ this.weightBillGrid.RowHeadersVisible = false; dataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); this.weightBillGrid.RowsDefaultCellStyle = dataGridViewCellStyle6; - this.weightBillGrid.RowTemplate.Height = 50; + this.weightBillGrid.RowTemplate.Height = 40; this.weightBillGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.weightBillGrid.Size = new System.Drawing.Size(452, 401); this.weightBillGrid.TabIndex = 34; // - // W_ID - // - this.W_ID.DataPropertyName = "ID"; - this.W_ID.HeaderText = "ID"; - this.W_ID.Name = "W_ID"; - this.W_ID.ReadOnly = true; - this.W_ID.Visible = false; - // - // W_B3ID - // - this.W_B3ID.DataPropertyName = "B3ID"; - this.W_B3ID.HeaderText = "过磅单号"; - this.W_B3ID.Name = "W_B3ID"; - this.W_B3ID.ReadOnly = true; - // - // W_Supplier_Name - // - this.W_Supplier_Name.DataPropertyName = "Supplier_Name"; - this.W_Supplier_Name.HeaderText = "供应商"; - this.W_Supplier_Name.Name = "W_Supplier_Name"; - this.W_Supplier_Name.ReadOnly = true; - this.W_Supplier_Name.Width = 120; - // - // W_HouseNumber - // - this.W_HouseNumber.DataPropertyName = "HouseNumber"; - this.W_HouseNumber.HeaderText = "头数"; - this.W_HouseNumber.Name = "W_HouseNumber"; - this.W_HouseNumber.ReadOnly = true; - // - // W_HouseNames - // - this.W_HouseNames.DataPropertyName = "HouseNames"; - this.W_HouseNames.HeaderText = "圈舍"; - this.W_HouseNames.Name = "W_HouseNames"; - this.W_HouseNames.ReadOnly = true; - this.W_HouseNames.Width = 120; - // // syncBtn // this.syncBtn.Font = new System.Drawing.Font("宋体", 15F); @@ -456,7 +513,7 @@ this.tabPage2.Location = new System.Drawing.Point(4, 54); this.tabPage2.Name = "tabPage2"; this.tabPage2.Padding = new System.Windows.Forms.Padding(3); - this.tabPage2.Size = new System.Drawing.Size(1268, 815); + this.tabPage2.Size = new System.Drawing.Size(1268, 683); this.tabPage2.TabIndex = 1; this.tabPage2.Text = "排宰顺序"; this.tabPage2.UseVisualStyleBackColor = true; @@ -711,111 +768,63 @@ this.label4.TabIndex = 35; this.label4.Text = "日期:"; // - // S_AbnormalItem_Name1 - // - this.S_AbnormalItem_Name1.DataPropertyName = "AbnormalItem_Name1"; - this.S_AbnormalItem_Name1.HeaderText = "异常项"; - this.S_AbnormalItem_Name1.Name = "S_AbnormalItem_Name1"; - this.S_AbnormalItem_Name1.ReadOnly = true; - // - // S_Number1 - // - this.S_Number1.DataPropertyName = "Number1"; - this.S_Number1.HeaderText = "头数"; - this.S_Number1.Name = "S_Number1"; - this.S_Number1.ReadOnly = true; - this.S_Number1.Width = 135; - // - // S_AbnormalItem_Name2 - // - this.S_AbnormalItem_Name2.DataPropertyName = "AbnormalItem_Name2"; - this.S_AbnormalItem_Name2.HeaderText = "异常项"; - this.S_AbnormalItem_Name2.Name = "S_AbnormalItem_Name2"; - this.S_AbnormalItem_Name2.ReadOnly = true; - // - // S_Number2 - // - this.S_Number2.DataPropertyName = "Number2"; - this.S_Number2.HeaderText = "头数"; - this.S_Number2.Name = "S_Number2"; - this.S_Number2.ReadOnly = true; - this.S_Number2.Width = 135; - // - // S_AbnormalItem_Name3 - // - this.S_AbnormalItem_Name3.DataPropertyName = "AbnormalItem_Name3"; - this.S_AbnormalItem_Name3.HeaderText = "异常项"; - this.S_AbnormalItem_Name3.Name = "S_AbnormalItem_Name3"; - this.S_AbnormalItem_Name3.ReadOnly = true; - // - // S_Number3 - // - this.S_Number3.DataPropertyName = "Number3"; - this.S_Number3.HeaderText = "头数"; - this.S_Number3.Name = "S_Number3"; - this.S_Number3.ReadOnly = true; - this.S_Number3.Width = 135; - // - // S_Sanction_ID1 + // W_ID // - this.S_Sanction_ID1.DataPropertyName = "Sanction_ID1"; - this.S_Sanction_ID1.HeaderText = "Sanction_ID1"; - this.S_Sanction_ID1.Name = "S_Sanction_ID1"; - this.S_Sanction_ID1.ReadOnly = true; - this.S_Sanction_ID1.Visible = false; + this.W_ID.DataPropertyName = "ID"; + this.W_ID.HeaderText = "ID"; + this.W_ID.Name = "W_ID"; + this.W_ID.ReadOnly = true; + this.W_ID.Visible = false; // - // S_AbnormalItem_ID1 + // W_B3ID // - this.S_AbnormalItem_ID1.DataPropertyName = "AbnormalItem_ID1"; - this.S_AbnormalItem_ID1.HeaderText = "AbnormalItem_ID1"; - this.S_AbnormalItem_ID1.Name = "S_AbnormalItem_ID1"; - this.S_AbnormalItem_ID1.ReadOnly = true; - this.S_AbnormalItem_ID1.Visible = false; + this.W_B3ID.DataPropertyName = "B3ID"; + this.W_B3ID.HeaderText = "过磅单号"; + this.W_B3ID.Name = "W_B3ID"; + this.W_B3ID.ReadOnly = true; // - // S_Sanction_ID2 + // W_Supplier_Name // - this.S_Sanction_ID2.DataPropertyName = "Sanction_ID2"; - this.S_Sanction_ID2.HeaderText = "Sanction_ID2"; - this.S_Sanction_ID2.Name = "S_Sanction_ID2"; - this.S_Sanction_ID2.ReadOnly = true; - this.S_Sanction_ID2.Visible = false; + this.W_Supplier_Name.DataPropertyName = "Supplier_Name"; + this.W_Supplier_Name.HeaderText = "供应商"; + this.W_Supplier_Name.Name = "W_Supplier_Name"; + this.W_Supplier_Name.ReadOnly = true; + this.W_Supplier_Name.Width = 120; // - // S_AbnormalItem_ID2 + // W_HouseNumber // - this.S_AbnormalItem_ID2.DataPropertyName = "AbnormalItem_ID2"; - this.S_AbnormalItem_ID2.HeaderText = "AbnormalItem_ID2"; - this.S_AbnormalItem_ID2.Name = "S_AbnormalItem_ID2"; - this.S_AbnormalItem_ID2.ReadOnly = true; - this.S_AbnormalItem_ID2.Visible = false; + this.W_HouseNumber.DataPropertyName = "HouseNumber"; + this.W_HouseNumber.HeaderText = "头数"; + this.W_HouseNumber.Name = "W_HouseNumber"; + this.W_HouseNumber.ReadOnly = true; // - // S_Sanction_ID3 + // W_HouseNames // - this.S_Sanction_ID3.DataPropertyName = "Sanction_ID3"; - this.S_Sanction_ID3.HeaderText = "Sanction_ID3"; - this.S_Sanction_ID3.Name = "S_Sanction_ID3"; - this.S_Sanction_ID3.ReadOnly = true; - this.S_Sanction_ID3.Visible = false; + this.W_HouseNames.DataPropertyName = "HouseNames"; + this.W_HouseNames.HeaderText = "圈舍"; + this.W_HouseNames.Name = "W_HouseNames"; + this.W_HouseNames.ReadOnly = true; + this.W_HouseNames.Width = 120; // - // S_AbnormalItem_ID3 + // W_FinishCreate // - this.S_AbnormalItem_ID3.DataPropertyName = "AbnormalItem_ID3"; - this.S_AbnormalItem_ID3.HeaderText = "AbnormalItem_ID3"; - this.S_AbnormalItem_ID3.Name = "S_AbnormalItem_ID3"; - this.S_AbnormalItem_ID3.ReadOnly = true; - this.S_AbnormalItem_ID3.Visible = false; + this.W_FinishCreate.DataPropertyName = "FinishCreate"; + this.W_FinishCreate.HeaderText = "标识列勿去"; + this.W_FinishCreate.Name = "W_FinishCreate"; + this.W_FinishCreate.ReadOnly = true; + this.W_FinishCreate.Visible = false; // // QualityOrderForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1276, 873); + this.ClientSize = new System.Drawing.Size(1276, 741); this.Controls.Add(this.uTabControl1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.MaximizeBox = false; this.Name = "QualityOrderForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "验质分圈"; - this.Click += new System.EventHandler(this.QualityOrderForm_Click); this.uTabControl1.ResumeLayout(false); this.tabPage1.ResumeLayout(false); this.tabPage1.PerformLayout(); @@ -845,7 +854,7 @@ private System.Windows.Forms.TextBox numberBox; private System.Windows.Forms.Label label1; private System.Windows.Forms.FlowLayoutPanel keyBoardPanel; - private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label inHouseNumberLabel; private System.Windows.Forms.Label label2; private System.Windows.Forms.FlowLayoutPanel hogGradePanel; private System.Windows.Forms.Button closeBtn; @@ -879,11 +888,6 @@ private System.Windows.Forms.TabPage tabPage3; private System.Windows.Forms.TabPage tabPage4; private System.Windows.Forms.TabControl housePanel; - private System.Windows.Forms.DataGridViewTextBoxColumn W_ID; - private System.Windows.Forms.DataGridViewTextBoxColumn W_B3ID; - private System.Windows.Forms.DataGridViewTextBoxColumn W_Supplier_Name; - private System.Windows.Forms.DataGridViewTextBoxColumn W_HouseNumber; - private System.Windows.Forms.DataGridViewTextBoxColumn W_HouseNames; private System.Windows.Forms.DataGridViewTextBoxColumn S_AbnormalItem_Name1; private System.Windows.Forms.DataGridViewTextBoxColumn S_Number1; private System.Windows.Forms.DataGridViewTextBoxColumn S_AbnormalItem_Name2; @@ -896,6 +900,12 @@ private System.Windows.Forms.DataGridViewTextBoxColumn S_AbnormalItem_ID2; private System.Windows.Forms.DataGridViewTextBoxColumn S_Sanction_ID3; private System.Windows.Forms.DataGridViewTextBoxColumn S_AbnormalItem_ID3; + private System.Windows.Forms.DataGridViewTextBoxColumn W_ID; + private System.Windows.Forms.DataGridViewTextBoxColumn W_B3ID; + private System.Windows.Forms.DataGridViewTextBoxColumn W_Supplier_Name; + private System.Windows.Forms.DataGridViewTextBoxColumn W_HouseNumber; + private System.Windows.Forms.DataGridViewTextBoxColumn W_HouseNames; + private System.Windows.Forms.DataGridViewTextBoxColumn W_FinishCreate; diff --git a/QualityAndOrder/QualityOrderForm.cs b/QualityAndOrder/QualityOrderForm.cs index 5452ebe..4f5cea3 100644 --- a/QualityAndOrder/QualityOrderForm.cs +++ b/QualityAndOrder/QualityOrderForm.cs @@ -38,6 +38,7 @@ namespace QualityAndOrder readonly Color btnSelectBackColor = Color.FromArgb(66, 163, 218); Color btnUnSelectForeColor = SystemColors.ControlText; Color btnUnSelectBackColor = Color.FromArgb(225, 225, 225); + int inHouseNumber = 0; public QualityOrderForm() { InitializeComponent(); @@ -67,7 +68,13 @@ namespace QualityAndOrder private void BindWeightBillGrid() { - weightBillGrid.DataSource = weightBills.OrderBy(x => x.Remark).OrderBy(x => x.ID).ToList(); + weightBillGrid.DataSource = weightBills.OrderBy(x => x.ID).OrderBy(x => x.FinishCreate).ToList(); + foreach (DataGridViewRow row in weightBillGrid.Rows) + { + if ((bool)row.Cells["W_FinishCreate"].Value) + row.DefaultCellStyle.BackColor = Color.YellowGreen; + + } weightBillGrid.Refresh(); } @@ -125,7 +132,6 @@ namespace QualityAndOrder keyBoardPanel.Controls.Add(clear); } - void InputSanctionNumber(string input) { if (sanctionGrid.CurrentCell == null) @@ -182,7 +188,6 @@ namespace QualityAndOrder } } - Button currentBtn; private void AddHogGradeBtn() { @@ -291,6 +296,8 @@ namespace QualityAndOrder } housePanel.TabPages.Add(tabPage); } + if (housePanel.TabPages.Count != 0) + housePanel.SelectedIndex = housePanel.TabPages.Count - 1; } private void closeBtn_Click(object sender, EventArgs e) @@ -300,35 +307,111 @@ namespace QualityAndOrder private void commitBtn_Click(object sender, EventArgs e) { - //var ids = new List(); - //foreach (var item in houseSelectedBtn) - //{ - // item.BackColor = btnUnSelectBackColor; - // item.ForeColor = btnUnSelectForeColor; - // ids.Add((item.Tag as Tuple).Item1); - //} - //houseSelectedBtn.Clear(); - //MessageBox.Show(string.Join(",", ids)); - if (currentBtn == null) - MessageBox.Show("not select"); - else + var entity = GetHouseDataFromUI(); + var result = WeightBillRpc.InsertHouseAndSanctionInfo(entity); + if (result == 1) { - MessageBox.Show((currentBtn.Tag as Tuple).Item1); - currentBtn.BackColor = btnUnSelectBackColor; - currentBtn.ForeColor = btnUnSelectForeColor; - currentBtn = null; + MessageBox.Show("提交成功"); + entity.FinishCreate = true; + BindWeightBillGrid(); + inHouseNumber += (entity.HouseNumber ?? 0); + inHouseNumberLabel.Text = inHouseNumber.ToString(); + ResetTab1Controls(); } + else + MessageBox.Show("结果", "提交失败", MessageBoxButtons.OK, MessageBoxIcon.Error); } private void syncBtn_Click(object sender, EventArgs e) { weightBills = WeightBillRpc.GetUnHousedBill(testTimeInput.Date.Value); BindWeightBillGrid(); + + inHouseNumber = WeightBillRpc.GetHouseDetailTotalNumber(testTimeInput.Date.Value); + inHouseNumberLabel.Text = inHouseNumber.ToString(); + } + + WeightBill GetHouseDataFromUI() + { + if (weightBillGrid.CurrentRow == null) + throw new Exception("请选择需要处理的记录"); + var entity = weightBillGrid.CurrentRow.DataBoundItem as WeightBill; + if (entity.HouseDetails.Any()) + throw new Exception("没有待分圈的数据了"); + if (string.IsNullOrEmpty(numberBox.Text)) + throw new Exception("数量不能为空"); + if (currentBtn == null) + throw new Exception("请选等级"); + if (houseSelectedBtn.Count == 0) + throw new Exception("请选择圈舍"); + + if (houseSelectedBtn.Count > 1) + throw new Exception("不允许分圈"); + var house = houseSelectedBtn[0].Tag as Tuple; + entity.HouseDetails.Add(new WeightBill_HouseDetail() { WeightBill_ID = entity.ID, Index = 1, LiveColonyHouse_ID = long.Parse(house.Item1), LiveColonyHouse_Name = house.Item2, Number = int.Parse(numberBox.Text) }); + var gradeTag = currentBtn.Tag as Tuple; + entity.HogGrade_ID = long.Parse(gradeTag.Item1); + entity.HogGrade_Name = gradeTag.Item2; + foreach (DataGridViewRow row in sanctionGrid.Rows) + { + var tag = row.DataBoundItem as SanctionSplit3Part; + if (tag.Number1.HasValue) + { + var detail = new WeightBill_SanctionDetail(); + entity.SanctionDetails.Add(detail); + detail.WeightBill_ID = entity.ID; + detail.Index = entity.SanctionDetails.Max(x => x.Index) + 1; + detail.Sanction_ID = tag.Sanction_ID1; + detail.AbnormalItem_ID = tag.AbnormalItem_ID1; + detail.AbnormalItem_Name = tag.AbnormalItem_Name1; + detail.Number = tag.Number1; + } + if (tag.Number2.HasValue) + { + var detail = new WeightBill_SanctionDetail(); + entity.SanctionDetails.Add(detail); + detail.WeightBill_ID = entity.ID; + detail.Index = entity.SanctionDetails.Max(x => x.Index) + 1; + detail.Sanction_ID = tag.Sanction_ID2; + detail.AbnormalItem_ID = tag.AbnormalItem_ID2; + detail.AbnormalItem_Name = tag.AbnormalItem_Name2; + detail.Number = tag.Number2; + } + if (tag.Number3.HasValue) + { + var detail = new WeightBill_SanctionDetail(); + entity.SanctionDetails.Add(detail); + detail.WeightBill_ID = entity.ID; + detail.Index = entity.SanctionDetails.Max(x => x.Index) + 1; + detail.Sanction_ID = tag.Sanction_ID3; + detail.AbnormalItem_ID = tag.AbnormalItem_ID3; + detail.AbnormalItem_Name = tag.AbnormalItem_Name3; + detail.Number = tag.Number3; + } + } + return entity; } - private void QualityOrderForm_Click(object sender, EventArgs e) + void ResetTab1Controls() { - MessageBox.Show("ddd"); + foreach (var item in houseSelectedBtn) + { + item.BackColor = btnUnSelectBackColor; + item.ForeColor = btnUnSelectForeColor; + } + houseSelectedBtn.Clear(); + if (currentBtn != null) + { + currentBtn.BackColor = btnUnSelectBackColor; + currentBtn.ForeColor = btnUnSelectForeColor; + } + numberBox.Text = string.Empty; + + foreach (var item in sanctionList) + item.Number1 = item.Number2 = item.Number3 = null; + sanctionGrid.Refresh(); + uTabControl2.TabIndex = 0; + flag = 0; } } diff --git a/QualityAndOrder/QualityOrderForm.resx b/QualityAndOrder/QualityOrderForm.resx index 61566f9..d9e6c6a 100644 --- a/QualityAndOrder/QualityOrderForm.resx +++ b/QualityAndOrder/QualityOrderForm.resx @@ -168,6 +168,9 @@ True + + True + True