From 73539677cc778a4e71694741ea6c822edf09e443 Mon Sep 17 00:00:00 2001 From: yibo <361071264@qq.com> Date: Wed, 16 May 2018 18:48:55 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BD=E6=9D=A1=E5=88=86=E6=AE=B5=E9=A2=86?= =?UTF-8?q?=E7=94=A8=E8=B0=83=E6=95=B4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ButcherFactory.BO/Bill/CarcassTakeOut.cs | 6 + ButcherFactory.BO/LocalBL/CarcassTakeOutBL.cs | 41 +- .../ButcherFactory.Form.csproj | 9 + .../CarcassTakeOutForm.Designer.cs | 426 +++++++++++------- .../CarcassTakeOut_/CarcassTakeOutForm.cs | 113 ++++- .../CarcassTakeOut_/CarcassTakeOutForm.resx | 30 ++ .../Dialogs/NumberSetDialog.Designer.cs | 138 ++++++ .../Dialogs/NumberSetDialog.cs | 64 +++ .../Dialogs/NumberSetDialog.resx | 137 ++++++ 9 files changed, 800 insertions(+), 164 deletions(-) create mode 100644 ButcherFactory.Form/Dialogs/NumberSetDialog.Designer.cs create mode 100644 ButcherFactory.Form/Dialogs/NumberSetDialog.cs create mode 100644 ButcherFactory.Form/Dialogs/NumberSetDialog.resx diff --git a/ButcherFactory.BO/Bill/CarcassTakeOut.cs b/ButcherFactory.BO/Bill/CarcassTakeOut.cs index 0797647..30d3c3c 100644 --- a/ButcherFactory.BO/Bill/CarcassTakeOut.cs +++ b/ButcherFactory.BO/Bill/CarcassTakeOut.cs @@ -23,6 +23,9 @@ namespace ButcherFactory.BO public decimal? Weight { get; set; } + [DbColumn(DefaultValue = 1)] + public int Number { get; set; } + public decimal? BeforeWeight { get; set; } [ReferenceTo(typeof(Goods), "Name")] @@ -32,5 +35,8 @@ namespace ButcherFactory.BO public long? GroupID { get; set; } public bool Submited { get; set; } + + [DbColumn(DefaultValue = true)] + public bool IsCarcass { get; set; } } } diff --git a/ButcherFactory.BO/LocalBL/CarcassTakeOutBL.cs b/ButcherFactory.BO/LocalBL/CarcassTakeOutBL.cs index 9ffa2bd..7e11b94 100644 --- a/ButcherFactory.BO/LocalBL/CarcassTakeOutBL.cs +++ b/ButcherFactory.BO/LocalBL/CarcassTakeOutBL.cs @@ -17,7 +17,7 @@ namespace ButcherFactory.BO.LocalBL { const string RpcPath = @"/MainSystem/B3ClientService/Rpcs/CarcassTakeOutRpc/"; - public static CarcassTakeOut Insert(long? workUnitID, long? batchID, long? goodsID, string barCode) + public static CarcassTakeOut Insert(long? workUnitID, long? batchID, long? goodsID, string barCode, bool isCarcass) { using (var session = DmoSession.New()) { @@ -31,6 +31,8 @@ namespace ButcherFactory.BO.LocalBL entity.ProductBatch_ID = batchID; entity.Goods_ID = goodsID; } + entity.IsCarcass = isCarcass; + entity.Number = 1; entity.UserID = AppContext.Worker.ID; entity.BarCode = barCode; entity.RowIndex = GenerateRowIndex(session); @@ -69,6 +71,15 @@ namespace ButcherFactory.BO.LocalBL session.ExecuteNonQuery(update); } + public static void Update(long id, params Tuple[] updates) + { + using (var session = DmoSession.New()) + { + Update(id, session, updates); + session.Commit(); + } + } + public static BindingList GetWeightList() { var query = new DQueryDom(new JoinAlias(typeof(CarcassTakeOutWeightTemp))); @@ -100,6 +111,8 @@ namespace ButcherFactory.BO.LocalBL query.Columns.Add(DQSelectColumn.Field("Goods_Name")); query.Columns.Add(DQSelectColumn.Field("BeforeWeight")); query.Columns.Add(DQSelectColumn.Field("Weight")); + query.Columns.Add(DQSelectColumn.Field("Number")); + query.Columns.Add(DQSelectColumn.Field("IsCarcass")); if (history) query.Range = SelectRange.Top(30); query.Where.Conditions.Add(DQCondition.EQ("Submited", history)); @@ -119,6 +132,8 @@ namespace ButcherFactory.BO.LocalBL entity.Goods_Name = (string)reader[3]; entity.BeforeWeight = (decimal?)reader[4]; entity.Weight = (decimal?)reader[5]; + entity.Number = (int)reader[6]; + entity.IsCarcass = (bool)reader[7]; } } } @@ -202,6 +217,8 @@ namespace ButcherFactory.BO.LocalBL session.ExecuteNonQuery(update); } + static string carcassMethod = RpcPath + "UploadCarcassInfo"; + static string sectionMethod = @"/MainSystem/B3ClientService/Rpcs/SectionStoreDetailRpc/FillWeight"; public static void UploadCarcassInfo() { try @@ -211,11 +228,14 @@ namespace ButcherFactory.BO.LocalBL var needUpload = GetUnSyncData(session); if (needUpload.Count == 0) return; - - var json = JsonConvert.SerializeObject(needUpload); - RpcFacade.Call(RpcPath + "UploadCarcassInfo", json); - foreach (var item in needUpload) - SetLocalAsSyncd(item, session); + foreach (var gp in needUpload.GroupBy(x => x.IsCarcass)) + { + var method = gp.Key ? carcassMethod : sectionMethod; + var json = JsonConvert.SerializeObject(gp); + RpcFacade.Call(method, json); + foreach (var item in needUpload) + SetLocalAsSyncd(item, session); + } session.Commit(); } } @@ -240,6 +260,9 @@ namespace ButcherFactory.BO.LocalBL query.Columns.Add(DQSelectColumn.Field("Weight")); query.Columns.Add(DQSelectColumn.Field("CreateTime")); query.Columns.Add(DQSelectColumn.Field("GroupID")); + query.Columns.Add(DQSelectColumn.Field("Number")); + query.Columns.Add(DQSelectColumn.Field("IsCarcass")); + query.Columns.Add(DQSelectColumn.Field("UserID")); query.Where.Conditions.Add(DQCondition.And(DQCondition.EQ("Submited", true), DQCondition.EQ("Sync", false))); query.Range = SelectRange.Top(10); query.OrderBy.Expressions.Add(DQOrderByExpression.Create("ID")); @@ -263,6 +286,9 @@ namespace ButcherFactory.BO.LocalBL obj.Weight = (decimal)reader[7]; obj.Time = (DateTime)reader[8]; obj.GroupID = (long?)reader[9]; + obj.Number = (int)reader[10]; + obj.IsCarcass = (bool)reader[11]; + obj.Worker_ID = (long)reader[12]; upload.Add(obj); } } @@ -290,5 +316,8 @@ namespace ButcherFactory.BO.LocalBL public decimal? Weight { get; set; } public DateTime? Time { get; set; } public long? GroupID { get; set; } + public int Number { get; set; } + public bool IsCarcass { get; set; } + public long Worker_ID { get; set; } } } diff --git a/ButcherFactory.Form/ButcherFactory.Form.csproj b/ButcherFactory.Form/ButcherFactory.Form.csproj index ed8ad81..fa5d8c9 100644 --- a/ButcherFactory.Form/ButcherFactory.Form.csproj +++ b/ButcherFactory.Form/ButcherFactory.Form.csproj @@ -78,6 +78,12 @@ ClientGoodsSetDialog.cs + + Form + + + NumberSetDialog.cs + Form @@ -150,6 +156,9 @@ ClientGoodsSetDialog.cs + + NumberSetDialog.cs + SelectBillStateDialog.cs diff --git a/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.Designer.cs b/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.Designer.cs index 34f4010..261e03e 100644 --- a/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.Designer.cs +++ b/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.Designer.cs @@ -29,20 +29,23 @@ private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CarcassTakeOutForm)); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle25 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle26 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle29 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle27 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle28 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle30 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle31 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle32 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle33 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle34 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle36 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle35 = 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 dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); this.workUnitSelect = new System.Windows.Forms.ComboBox(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.numSetBtn = new WinFormControl.UButton(); + this.carcassBtn = new WinFormControl.UButton(); + this.sectionBtn = new WinFormControl.UButton(); this.productBatchSelect = new System.Windows.Forms.ComboBox(); this.uLabel2 = new WinFormControl.ULabel(); this.closeBtn = new WinFormControl.UButton(); @@ -54,28 +57,31 @@ this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.historyDataGrid = new WinFormControl.UDataGridView(); - this.H_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.H_RowIndex = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.H_BarCode = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.H_Goods_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.H_BeforeWeight = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.H_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.uLabel4 = new WinFormControl.ULabel(); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.numFlowPanel = new System.Windows.Forms.FlowLayoutPanel(); this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.weightGrid = new WinFormControl.UDataGridView(); this.W_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.W_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.needSubmitGrid = new WinFormControl.UDataGridView(); + this.readBtn = new WinFormControl.UButton(); + this.submitBtn = new WinFormControl.UButton(); + this.uLabel3 = new WinFormControl.ULabel(); + this.H_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.H_RowIndex = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.H_BarCode = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.H_Goods_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.H_BeforeWeight = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.H_Number = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.H_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.U_ID = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.U_RowIndex = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.U_BarCode = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.U_Goods_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.U_BeforeWeight = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.U_Number = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.U_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.readBtn = new WinFormControl.UButton(); - this.submitBtn = new WinFormControl.UButton(); - this.uLabel3 = new WinFormControl.ULabel(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -115,6 +121,9 @@ // splitContainer1.Panel1 // this.splitContainer1.Panel1.BackColor = System.Drawing.Color.Transparent; + this.splitContainer1.Panel1.Controls.Add(this.numSetBtn); + this.splitContainer1.Panel1.Controls.Add(this.carcassBtn); + this.splitContainer1.Panel1.Controls.Add(this.sectionBtn); this.splitContainer1.Panel1.Controls.Add(this.productBatchSelect); this.splitContainer1.Panel1.Controls.Add(this.uLabel2); this.splitContainer1.Panel1.Controls.Add(this.closeBtn); @@ -134,6 +143,74 @@ this.splitContainer1.SplitterDistance = 86; this.splitContainer1.TabIndex = 1; // + // numSetBtn + // + this.numSetBtn.AsClicked = false; + this.numSetBtn.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("numSetBtn.BackgroundImage"))); + this.numSetBtn.EnableGroup = false; + this.numSetBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214))))); + this.numSetBtn.FlatAppearance.BorderSize = 0; + this.numSetBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.numSetBtn.Font = new System.Drawing.Font("宋体", 15F); + this.numSetBtn.ForeColor = System.Drawing.Color.Black; + this.numSetBtn.Location = new System.Drawing.Point(358, 46); + this.numSetBtn.Name = "numSetBtn"; + this.numSetBtn.PlaySound = false; + this.numSetBtn.SelfControlEnable = false; + this.numSetBtn.Size = new System.Drawing.Size(111, 34); + this.numSetBtn.SoundType = WinFormControl.SoundType.Click; + this.numSetBtn.TabIndex = 21; + this.numSetBtn.Text = "数量设置"; + this.numSetBtn.UseVisualStyleBackColor = true; + this.numSetBtn.WithStataHode = false; + this.numSetBtn.Click += new System.EventHandler(this.numSetBtn_Click); + // + // carcassBtn + // + this.carcassBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.carcassBtn.AsClicked = false; + this.carcassBtn.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("carcassBtn.BackgroundImage"))); + this.carcassBtn.EnableGroup = false; + this.carcassBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214))))); + this.carcassBtn.FlatAppearance.BorderSize = 0; + this.carcassBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.carcassBtn.Font = new System.Drawing.Font("宋体", 15F); + this.carcassBtn.ForeColor = System.Drawing.Color.Black; + this.carcassBtn.Location = new System.Drawing.Point(768, 46); + this.carcassBtn.Name = "carcassBtn"; + this.carcassBtn.PlaySound = false; + this.carcassBtn.SelfControlEnable = true; + this.carcassBtn.Size = new System.Drawing.Size(111, 34); + this.carcassBtn.SoundType = WinFormControl.SoundType.Click; + this.carcassBtn.TabIndex = 20; + this.carcassBtn.Text = "白 条"; + this.carcassBtn.UseVisualStyleBackColor = true; + this.carcassBtn.WithStataHode = false; + this.carcassBtn.Click += new System.EventHandler(this.carcassBtn_Click); + // + // sectionBtn + // + this.sectionBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.sectionBtn.AsClicked = false; + this.sectionBtn.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("sectionBtn.BackgroundImage"))); + this.sectionBtn.EnableGroup = false; + this.sectionBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214))))); + this.sectionBtn.FlatAppearance.BorderSize = 0; + this.sectionBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.sectionBtn.Font = new System.Drawing.Font("宋体", 15F); + this.sectionBtn.ForeColor = System.Drawing.Color.Black; + this.sectionBtn.Location = new System.Drawing.Point(644, 46); + this.sectionBtn.Name = "sectionBtn"; + this.sectionBtn.PlaySound = false; + this.sectionBtn.SelfControlEnable = true; + this.sectionBtn.Size = new System.Drawing.Size(111, 34); + this.sectionBtn.SoundType = WinFormControl.SoundType.Click; + this.sectionBtn.TabIndex = 19; + this.sectionBtn.Text = "条 段"; + this.sectionBtn.UseVisualStyleBackColor = true; + this.sectionBtn.WithStataHode = false; + this.sectionBtn.Click += new System.EventHandler(this.sectionBtn_Click); + // // productBatchSelect // this.productBatchSelect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); @@ -261,15 +338,15 @@ this.historyDataGrid.AllowUserToDeleteRows = false; this.historyDataGrid.AllowUserToResizeColumns = false; this.historyDataGrid.AllowUserToResizeRows = false; - dataGridViewCellStyle25.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); - this.historyDataGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle25; + dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.historyDataGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; this.historyDataGrid.BackgroundColor = System.Drawing.Color.White; this.historyDataGrid.BorderStyle = System.Windows.Forms.BorderStyle.None; - dataGridViewCellStyle26.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle26.Font = new System.Drawing.Font("宋体", 12F); - dataGridViewCellStyle26.ForeColor = System.Drawing.Color.White; - dataGridViewCellStyle26.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.historyDataGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle26; + dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 12F); + dataGridViewCellStyle2.ForeColor = System.Drawing.Color.White; + dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.historyDataGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; this.historyDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.historyDataGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.H_ID, @@ -277,6 +354,7 @@ this.H_BarCode, this.H_Goods_Name, this.H_BeforeWeight, + this.H_Number, this.H_Weight}); this.historyDataGrid.Dock = System.Windows.Forms.DockStyle.Fill; this.historyDataGrid.Location = new System.Drawing.Point(5, 19); @@ -284,65 +362,14 @@ this.historyDataGrid.Name = "historyDataGrid"; this.historyDataGrid.ReadOnly = true; this.historyDataGrid.RowHeadersVisible = false; - dataGridViewCellStyle29.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle29.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); - this.historyDataGrid.RowsDefaultCellStyle = dataGridViewCellStyle29; + dataGridViewCellStyle5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + this.historyDataGrid.RowsDefaultCellStyle = dataGridViewCellStyle5; this.historyDataGrid.RowTemplate.Height = 23; this.historyDataGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.historyDataGrid.Size = new System.Drawing.Size(766, 198); this.historyDataGrid.TabIndex = 2; // - // H_ID - // - this.H_ID.DataPropertyName = "ID"; - this.H_ID.HeaderText = "ID"; - this.H_ID.Name = "H_ID"; - this.H_ID.ReadOnly = true; - this.H_ID.Visible = false; - // - // H_RowIndex - // - this.H_RowIndex.DataPropertyName = "RowIndex"; - this.H_RowIndex.HeaderText = "序号"; - this.H_RowIndex.Name = "H_RowIndex"; - this.H_RowIndex.ReadOnly = true; - // - // H_BarCode - // - this.H_BarCode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.H_BarCode.DataPropertyName = "BarCode"; - this.H_BarCode.HeaderText = "条码"; - this.H_BarCode.Name = "H_BarCode"; - this.H_BarCode.ReadOnly = true; - // - // H_Goods_Name - // - this.H_Goods_Name.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.H_Goods_Name.DataPropertyName = "Goods_Name"; - this.H_Goods_Name.HeaderText = "产品名称"; - this.H_Goods_Name.Name = "H_Goods_Name"; - this.H_Goods_Name.ReadOnly = true; - // - // H_BeforeWeight - // - this.H_BeforeWeight.DataPropertyName = "BeforeWeight"; - dataGridViewCellStyle27.Format = "#0.######"; - this.H_BeforeWeight.DefaultCellStyle = dataGridViewCellStyle27; - this.H_BeforeWeight.HeaderText = "入库重量"; - this.H_BeforeWeight.Name = "H_BeforeWeight"; - this.H_BeforeWeight.ReadOnly = true; - this.H_BeforeWeight.Width = 150; - // - // H_Weight - // - this.H_Weight.DataPropertyName = "Weight"; - dataGridViewCellStyle28.Format = "#0.######"; - this.H_Weight.DefaultCellStyle = dataGridViewCellStyle28; - this.H_Weight.HeaderText = "重量"; - this.H_Weight.Name = "H_Weight"; - this.H_Weight.ReadOnly = true; - this.H_Weight.Width = 150; - // // uLabel4 // this.uLabel4.AutoSize = true; @@ -358,6 +385,7 @@ // this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.groupBox1.Controls.Add(this.numFlowPanel); this.groupBox1.Controls.Add(this.splitContainer2); this.groupBox1.Controls.Add(this.readBtn); this.groupBox1.Controls.Add(this.submitBtn); @@ -369,6 +397,15 @@ this.groupBox1.TabIndex = 2; this.groupBox1.TabStop = false; // + // numFlowPanel + // + this.numFlowPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.numFlowPanel.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; + this.numFlowPanel.Location = new System.Drawing.Point(265, 14); + this.numFlowPanel.Name = "numFlowPanel"; + this.numFlowPanel.Size = new System.Drawing.Size(506, 41); + this.numFlowPanel.TabIndex = 15; + // // splitContainer2 // this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Bottom; @@ -394,15 +431,15 @@ this.weightGrid.AllowUserToDeleteRows = false; this.weightGrid.AllowUserToResizeColumns = false; this.weightGrid.AllowUserToResizeRows = false; - dataGridViewCellStyle30.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); - this.weightGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle30; + dataGridViewCellStyle6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.weightGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle6; this.weightGrid.BackgroundColor = System.Drawing.Color.White; this.weightGrid.BorderStyle = System.Windows.Forms.BorderStyle.None; - dataGridViewCellStyle31.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle31.Font = new System.Drawing.Font("宋体", 12F); - dataGridViewCellStyle31.ForeColor = System.Drawing.Color.White; - dataGridViewCellStyle31.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.weightGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle31; + dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle7.Font = new System.Drawing.Font("宋体", 12F); + dataGridViewCellStyle7.ForeColor = System.Drawing.Color.White; + dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.weightGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7; this.weightGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.weightGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.W_ID, @@ -413,9 +450,9 @@ this.weightGrid.Name = "weightGrid"; this.weightGrid.ReadOnly = true; this.weightGrid.RowHeadersVisible = false; - dataGridViewCellStyle32.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle32.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); - this.weightGrid.RowsDefaultCellStyle = dataGridViewCellStyle32; + dataGridViewCellStyle8.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle8.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + this.weightGrid.RowsDefaultCellStyle = dataGridViewCellStyle8; this.weightGrid.RowTemplate.Height = 23; this.weightGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.weightGrid.Size = new System.Drawing.Size(254, 200); @@ -442,15 +479,15 @@ this.needSubmitGrid.AllowUserToDeleteRows = false; this.needSubmitGrid.AllowUserToResizeColumns = false; this.needSubmitGrid.AllowUserToResizeRows = false; - dataGridViewCellStyle33.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); - this.needSubmitGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle33; + dataGridViewCellStyle9.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.needSubmitGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle9; this.needSubmitGrid.BackgroundColor = System.Drawing.Color.White; this.needSubmitGrid.BorderStyle = System.Windows.Forms.BorderStyle.None; - dataGridViewCellStyle34.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle34.Font = new System.Drawing.Font("宋体", 12F); - dataGridViewCellStyle34.ForeColor = System.Drawing.Color.White; - dataGridViewCellStyle34.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.needSubmitGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle34; + dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle10.Font = new System.Drawing.Font("宋体", 12F); + dataGridViewCellStyle10.ForeColor = System.Drawing.Color.White; + dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.needSubmitGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle10; this.needSubmitGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.needSubmitGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.U_ID, @@ -458,6 +495,7 @@ this.U_BarCode, this.U_Goods_Name, this.U_BeforeWeight, + this.U_Number, this.U_Weight}); this.needSubmitGrid.Dock = System.Windows.Forms.DockStyle.Fill; this.needSubmitGrid.Location = new System.Drawing.Point(0, 0); @@ -465,61 +503,14 @@ this.needSubmitGrid.Name = "needSubmitGrid"; this.needSubmitGrid.ReadOnly = true; this.needSubmitGrid.RowHeadersVisible = false; - dataGridViewCellStyle36.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle36.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); - this.needSubmitGrid.RowsDefaultCellStyle = dataGridViewCellStyle36; - this.needSubmitGrid.RowTemplate.Height = 23; + dataGridViewCellStyle12.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle12.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + this.needSubmitGrid.RowsDefaultCellStyle = dataGridViewCellStyle12; + this.needSubmitGrid.RowTemplate.Height = 30; this.needSubmitGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; this.needSubmitGrid.Size = new System.Drawing.Size(508, 200); this.needSubmitGrid.TabIndex = 1; // - // U_ID - // - this.U_ID.DataPropertyName = "ID"; - this.U_ID.HeaderText = "ID"; - this.U_ID.Name = "U_ID"; - this.U_ID.ReadOnly = true; - this.U_ID.Visible = false; - // - // U_RowIndex - // - this.U_RowIndex.DataPropertyName = "RowIndex"; - this.U_RowIndex.HeaderText = "序号"; - this.U_RowIndex.Name = "U_RowIndex"; - this.U_RowIndex.ReadOnly = true; - // - // U_BarCode - // - this.U_BarCode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.U_BarCode.DataPropertyName = "BarCode"; - this.U_BarCode.HeaderText = "条码"; - this.U_BarCode.Name = "U_BarCode"; - this.U_BarCode.ReadOnly = true; - // - // U_Goods_Name - // - this.U_Goods_Name.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - this.U_Goods_Name.DataPropertyName = "Goods_Name"; - this.U_Goods_Name.HeaderText = "产品名称"; - this.U_Goods_Name.Name = "U_Goods_Name"; - this.U_Goods_Name.ReadOnly = true; - // - // U_BeforeWeight - // - this.U_BeforeWeight.DataPropertyName = "BeforeWeight"; - dataGridViewCellStyle35.Format = "#0.######"; - this.U_BeforeWeight.DefaultCellStyle = dataGridViewCellStyle35; - this.U_BeforeWeight.HeaderText = "入库重量"; - this.U_BeforeWeight.Name = "U_BeforeWeight"; - this.U_BeforeWeight.ReadOnly = true; - // - // U_Weight - // - this.U_Weight.DataPropertyName = "Weight"; - this.U_Weight.HeaderText = "重量"; - this.U_Weight.Name = "U_Weight"; - this.U_Weight.ReadOnly = true; - // // readBtn // this.readBtn.AsClicked = false; @@ -575,6 +566,121 @@ this.uLabel3.TabIndex = 0; this.uLabel3.Text = "领料明细"; // + // H_ID + // + this.H_ID.DataPropertyName = "ID"; + this.H_ID.HeaderText = "ID"; + this.H_ID.Name = "H_ID"; + this.H_ID.ReadOnly = true; + this.H_ID.Visible = false; + // + // H_RowIndex + // + this.H_RowIndex.DataPropertyName = "RowIndex"; + this.H_RowIndex.HeaderText = "序号"; + this.H_RowIndex.Name = "H_RowIndex"; + this.H_RowIndex.ReadOnly = true; + // + // H_BarCode + // + this.H_BarCode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.H_BarCode.DataPropertyName = "BarCode"; + this.H_BarCode.HeaderText = "条码"; + this.H_BarCode.Name = "H_BarCode"; + this.H_BarCode.ReadOnly = true; + // + // H_Goods_Name + // + this.H_Goods_Name.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.H_Goods_Name.DataPropertyName = "Goods_Name"; + this.H_Goods_Name.HeaderText = "产品名称"; + this.H_Goods_Name.Name = "H_Goods_Name"; + this.H_Goods_Name.ReadOnly = true; + // + // H_BeforeWeight + // + this.H_BeforeWeight.DataPropertyName = "BeforeWeight"; + dataGridViewCellStyle3.Format = "#0.######"; + this.H_BeforeWeight.DefaultCellStyle = dataGridViewCellStyle3; + this.H_BeforeWeight.HeaderText = "入库重量"; + this.H_BeforeWeight.Name = "H_BeforeWeight"; + this.H_BeforeWeight.ReadOnly = true; + this.H_BeforeWeight.Width = 150; + // + // H_Number + // + this.H_Number.DataPropertyName = "Number"; + this.H_Number.HeaderText = "头数"; + this.H_Number.Name = "H_Number"; + this.H_Number.ReadOnly = true; + this.H_Number.Width = 65; + // + // H_Weight + // + this.H_Weight.DataPropertyName = "Weight"; + dataGridViewCellStyle4.Format = "#0.######"; + this.H_Weight.DefaultCellStyle = dataGridViewCellStyle4; + this.H_Weight.HeaderText = "重量"; + this.H_Weight.Name = "H_Weight"; + this.H_Weight.ReadOnly = true; + this.H_Weight.Width = 150; + // + // U_ID + // + this.U_ID.DataPropertyName = "ID"; + this.U_ID.HeaderText = "ID"; + this.U_ID.Name = "U_ID"; + this.U_ID.ReadOnly = true; + this.U_ID.Visible = false; + // + // U_RowIndex + // + this.U_RowIndex.DataPropertyName = "RowIndex"; + this.U_RowIndex.HeaderText = "序号"; + this.U_RowIndex.Name = "U_RowIndex"; + this.U_RowIndex.ReadOnly = true; + this.U_RowIndex.Width = 70; + // + // U_BarCode + // + this.U_BarCode.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.U_BarCode.DataPropertyName = "BarCode"; + this.U_BarCode.HeaderText = "条码"; + this.U_BarCode.Name = "U_BarCode"; + this.U_BarCode.ReadOnly = true; + // + // U_Goods_Name + // + this.U_Goods_Name.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.U_Goods_Name.DataPropertyName = "Goods_Name"; + this.U_Goods_Name.HeaderText = "产品名称"; + this.U_Goods_Name.Name = "U_Goods_Name"; + this.U_Goods_Name.ReadOnly = true; + // + // U_BeforeWeight + // + this.U_BeforeWeight.DataPropertyName = "BeforeWeight"; + dataGridViewCellStyle11.Format = "#0.######"; + this.U_BeforeWeight.DefaultCellStyle = dataGridViewCellStyle11; + this.U_BeforeWeight.HeaderText = "入库重量"; + this.U_BeforeWeight.Name = "U_BeforeWeight"; + this.U_BeforeWeight.ReadOnly = true; + // + // U_Number + // + this.U_Number.DataPropertyName = "Number"; + this.U_Number.HeaderText = "头数"; + this.U_Number.Name = "U_Number"; + this.U_Number.ReadOnly = true; + this.U_Number.Width = 65; + // + // U_Weight + // + this.U_Weight.DataPropertyName = "Weight"; + this.U_Weight.HeaderText = "重量"; + this.U_Weight.Name = "U_Weight"; + this.U_Weight.ReadOnly = true; + // // CarcassTakeOutForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); @@ -623,25 +729,31 @@ private WinFormControl.UButton closeBtn; private WinFormControl.UButton readBtn; private WinFormControl.UButton submitBtn; - private System.Windows.Forms.DataGridViewTextBoxColumn H_ID; - private System.Windows.Forms.DataGridViewTextBoxColumn H_RowIndex; - private System.Windows.Forms.DataGridViewTextBoxColumn H_BarCode; - private System.Windows.Forms.DataGridViewTextBoxColumn H_Goods_Name; - private System.Windows.Forms.DataGridViewTextBoxColumn H_BeforeWeight; - private System.Windows.Forms.DataGridViewTextBoxColumn H_Weight; private WinFormControl.UDataGridView weightGrid; private System.Windows.Forms.SplitContainer splitContainer2; private System.Windows.Forms.DataGridViewTextBoxColumn W_ID; private System.Windows.Forms.DataGridViewTextBoxColumn W_Weight; private System.Windows.Forms.ComboBox productBatchSelect; private WinFormControl.ULabel uLabel2; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + private WinFormControl.UButton carcassBtn; + private WinFormControl.UButton sectionBtn; + private WinFormControl.UButton numSetBtn; + private System.Windows.Forms.FlowLayoutPanel numFlowPanel; + private System.Windows.Forms.DataGridViewTextBoxColumn H_ID; + private System.Windows.Forms.DataGridViewTextBoxColumn H_RowIndex; + private System.Windows.Forms.DataGridViewTextBoxColumn H_BarCode; + private System.Windows.Forms.DataGridViewTextBoxColumn H_Goods_Name; + private System.Windows.Forms.DataGridViewTextBoxColumn H_BeforeWeight; + private System.Windows.Forms.DataGridViewTextBoxColumn H_Number; + private System.Windows.Forms.DataGridViewTextBoxColumn H_Weight; private System.Windows.Forms.DataGridViewTextBoxColumn U_ID; private System.Windows.Forms.DataGridViewTextBoxColumn U_RowIndex; private System.Windows.Forms.DataGridViewTextBoxColumn U_BarCode; private System.Windows.Forms.DataGridViewTextBoxColumn U_Goods_Name; private System.Windows.Forms.DataGridViewTextBoxColumn U_BeforeWeight; + private System.Windows.Forms.DataGridViewTextBoxColumn U_Number; private System.Windows.Forms.DataGridViewTextBoxColumn U_Weight; - private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; } } \ No newline at end of file diff --git a/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.cs b/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.cs index 4827a9e..66b9761 100644 --- a/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.cs +++ b/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.cs @@ -14,6 +14,7 @@ using System.Threading.Tasks; using System.Windows.Forms; using ButcherFactory.Utils; using WinFormControl; +using ButcherFactory.Dialogs; namespace ButcherFactory.CarcassTakeOut_ { @@ -31,6 +32,7 @@ namespace ButcherFactory.CarcassTakeOut_ } #endregion + const string FilePatch = @"Config\NumberSetDialog.cfg"; Thread syncBeforeInfo; Thread uploadData; BindingList needSubmitedList; @@ -38,9 +40,11 @@ namespace ButcherFactory.CarcassTakeOut_ BindingList weightList; long? workUnitID; long? batchID; + bool isCarcass; public CarcassTakeOutForm() { InitializeComponent(); + BuildNumberPanel(); netStateWatch1.GetConnectState = () => LoginUtil.TestConnection(500); uScanPanel1.AfterScan += uScanPanel1_AfterScan; workUnitSelect.SelectedIndexChanged += delegate @@ -131,11 +135,27 @@ namespace ButcherFactory.CarcassTakeOut_ needSubmitGrid.DataSource = needSubmitedList; needSubmitGrid.Refresh(); + BindSectionBtn(); + historyList = CarcassTakeOutBL.GetLocalDataWithState(true); historyDataGrid.DataSource = historyList; historyDataGrid.Refresh(); } + void BindSectionBtn() + { + if (needSubmitedList.Count == 0 || needSubmitedList.First().IsCarcass) + { + carcassBtn.Enabled = false; + SetSection(false); + } + else + { + sectionBtn.Enabled = false; + SetSection(true); + } + } + private void GetBeforeInfo() { while (true) @@ -216,13 +236,14 @@ namespace ButcherFactory.CarcassTakeOut_ void Insert(string barCode, long? goodsID, string goodsName) { - var entity = CarcassTakeOutBL.Insert(workUnitID, batchID, goodsID, barCode); + var entity = CarcassTakeOutBL.Insert(workUnitID, batchID, goodsID, barCode, isCarcass); if (entity == null) return; if (string.IsNullOrEmpty(barCode)) entity.Goods_Name = goodsName; needSubmitedList.Insert(0, entity); needSubmitGrid.FirstDisplayedScrollingRowIndex = 0; + needSubmitGrid.Rows[0].Selected = true; needSubmitGrid.Refresh(); uScanPanel1.TextBox.Clear(); } @@ -265,5 +286,95 @@ namespace ButcherFactory.CarcassTakeOut_ weightGrid.FirstDisplayedScrollingRowIndex = 0; weightGrid.Refresh(); } + + private void sectionBtn_Click(object sender, EventArgs e) + { + CheckCanChange(); + SetSection(true); + } + + private void carcassBtn_Click(object sender, EventArgs e) + { + CheckCanChange(); + SetSection(false); + } + + void CheckCanChange() + { + if (needSubmitedList.Any()) + throw new Exception("领料明细有未提交的数据"); + } + + private void numSetBtn_Click(object sender, EventArgs e) + { + new NumberSetDialog().ShowDialog(); + BuildNumberPanel(); + } + + void BuildNumberPanel() + { + numFlowPanel.Controls.Clear(); + if (!System.IO.File.Exists(FilePatch)) + return; + var simpBtn = new UButton() { Width = 100, Height = 34, Text = "自定义", Font = new Font("宋体", 15), Margin = new Padding(6, 2, 6, 0), WithStataHode = true, EnableGroup = true }; + simpBtn.Click += delegate + { + var cr = GetCurrentRowEntity(); + if (cr == null) + return; + var keyBoard = new NumberPad(); + if (keyBoard.ShowDialog() == true) + { + var v = 0; + if (int.TryParse(keyBoard.Result, out v)) + { + cr.Number = v; + CarcassTakeOutBL.Update(cr.ID, new Tuple("Number", cr.Number)); + needSubmitGrid.Refresh(); + } + else + throw new Exception("输入头数有误!"); + } + }; + numFlowPanel.Controls.Add(simpBtn); + var arr = System.IO.File.ReadAllText(FilePatch).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Reverse(); + foreach (var item in arr) + { + var btn = new UButton() { Width = 100, Height = 34, Text = item, Font = new Font("宋体", 15), Margin = new Padding(6, 2, 6, 0), WithStataHode = true, EnableGroup = true }; + btn.Click += (sender, e) => + { + var row = GetCurrentRowEntity(); + if (row == null) + return; + var b = sender as UButton; + row.Number = int.Parse(b.Text); + CarcassTakeOutBL.Update(row.ID, new Tuple("Number", row.Number)); + needSubmitGrid.Refresh(); + }; + numFlowPanel.Controls.Add(btn); + } + } + + CarcassTakeOut GetCurrentRowEntity() + { + if (needSubmitGrid.CurrentRow == null) + return null; + var row = needSubmitGrid.CurrentRow.DataBoundItem as CarcassTakeOut; + if (string.IsNullOrEmpty(row.BarCode)) + return row; + return null; + } + + void SetSection(bool section) + { + numSetBtn.Visible = section; + numFlowPanel.Visible = section; + isCarcass = !section; + if (section) + carcassBtn.Enabled = true; + else + sectionBtn.Enabled = true; + + } } } diff --git a/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.resx b/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.resx index 441ddc6..b07fc6f 100644 --- a/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.resx +++ b/ButcherFactory.Form/CarcassTakeOut_/CarcassTakeOutForm.resx @@ -118,6 +118,30 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAAHNJREFUaEPt0AENACAMwDAkowVB14aDz0CTKui5b1gICoKCoCAoCAqCgqAgKAgK + goKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAg + KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAAHNJREFUaEPt0AENACAMwDAkowVB14aDz0CTKui5b1gICoKCoCAoCAqCgqAgKAgK + goKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAg + KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAAHNJREFUaEPt0AENACAMwDAkowVB14aDz0CTKui5b1gICoKCoCAoCAqCgqAgKAgK + goKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAg + KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII= + + iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO @@ -129,6 +153,9 @@ True + + True + True @@ -138,6 +165,9 @@ True + + True + True diff --git a/ButcherFactory.Form/Dialogs/NumberSetDialog.Designer.cs b/ButcherFactory.Form/Dialogs/NumberSetDialog.Designer.cs new file mode 100644 index 0000000..8dab94b --- /dev/null +++ b/ButcherFactory.Form/Dialogs/NumberSetDialog.Designer.cs @@ -0,0 +1,138 @@ +namespace ButcherFactory.Dialogs +{ + partial class NumberSetDialog + { + /// + /// 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.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(NumberSetDialog)); + this.numBox = new WinFormControl.UTextBoxWithPad(); + this.uLabel1 = new WinFormControl.ULabel(); + this.setBtn = new WinFormControl.UButton(); + this.clearAllBtn = new WinFormControl.UButton(); + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.SuspendLayout(); + // + // numBox + // + this.numBox.Font = new System.Drawing.Font("宋体", 20F); + this.numBox.Location = new System.Drawing.Point(67, 12); + this.numBox.Name = "numBox"; + this.numBox.Size = new System.Drawing.Size(195, 38); + this.numBox.TabIndex = 0; + this.numBox.Type = WinFormControl.UTextBoxWithPad.TextBoxType.Number; + // + // uLabel1 + // + this.uLabel1.AutoSize = true; + this.uLabel1.BackColor = System.Drawing.Color.Transparent; + this.uLabel1.Font = new System.Drawing.Font("宋体", 15F); + this.uLabel1.Location = new System.Drawing.Point(2, 21); + this.uLabel1.Name = "uLabel1"; + this.uLabel1.Size = new System.Drawing.Size(69, 20); + this.uLabel1.TabIndex = 1; + this.uLabel1.Text = "数量:"; + // + // setBtn + // + this.setBtn.AsClicked = false; + this.setBtn.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("setBtn.BackgroundImage"))); + this.setBtn.EnableGroup = false; + this.setBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214))))); + this.setBtn.FlatAppearance.BorderSize = 0; + this.setBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.setBtn.Font = new System.Drawing.Font("宋体", 12F); + this.setBtn.ForeColor = System.Drawing.Color.Black; + this.setBtn.Location = new System.Drawing.Point(281, 12); + this.setBtn.Name = "setBtn"; + this.setBtn.PlaySound = false; + this.setBtn.SelfControlEnable = false; + this.setBtn.Size = new System.Drawing.Size(87, 38); + this.setBtn.SoundType = WinFormControl.SoundType.Click; + this.setBtn.TabIndex = 2; + this.setBtn.Text = "设定"; + this.setBtn.UseVisualStyleBackColor = true; + this.setBtn.WithStataHode = false; + this.setBtn.Click += new System.EventHandler(this.setBtn_Click); + // + // clearAllBtn + // + this.clearAllBtn.AsClicked = false; + this.clearAllBtn.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("clearAllBtn.BackgroundImage"))); + this.clearAllBtn.EnableGroup = false; + this.clearAllBtn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(155)))), ((int)(((byte)(214))))); + this.clearAllBtn.FlatAppearance.BorderSize = 0; + this.clearAllBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.clearAllBtn.Font = new System.Drawing.Font("宋体", 12F); + this.clearAllBtn.ForeColor = System.Drawing.Color.Black; + this.clearAllBtn.Location = new System.Drawing.Point(393, 12); + this.clearAllBtn.Name = "clearAllBtn"; + this.clearAllBtn.PlaySound = false; + this.clearAllBtn.SelfControlEnable = false; + this.clearAllBtn.Size = new System.Drawing.Size(87, 38); + this.clearAllBtn.SoundType = WinFormControl.SoundType.Click; + this.clearAllBtn.TabIndex = 3; + this.clearAllBtn.Text = "全清"; + this.clearAllBtn.UseVisualStyleBackColor = true; + this.clearAllBtn.WithStataHode = false; + this.clearAllBtn.Click += new System.EventHandler(this.clearAllBtn_Click); + // + // flowLayoutPanel1 + // + this.flowLayoutPanel1.Location = new System.Drawing.Point(12, 73); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(468, 67); + this.flowLayoutPanel1.TabIndex = 4; + // + // NumberSetDialog + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.White; + this.ClientSize = new System.Drawing.Size(522, 370); + this.Controls.Add(this.flowLayoutPanel1); + this.Controls.Add(this.clearAllBtn); + this.Controls.Add(this.setBtn); + this.Controls.Add(this.numBox); + this.Controls.Add(this.uLabel1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.Name = "NumberSetDialog"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "数量设置"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private WinFormControl.UTextBoxWithPad numBox; + private WinFormControl.ULabel uLabel1; + private WinFormControl.UButton setBtn; + private WinFormControl.UButton clearAllBtn; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + } +} \ No newline at end of file diff --git a/ButcherFactory.Form/Dialogs/NumberSetDialog.cs b/ButcherFactory.Form/Dialogs/NumberSetDialog.cs new file mode 100644 index 0000000..9cb0deb --- /dev/null +++ b/ButcherFactory.Form/Dialogs/NumberSetDialog.cs @@ -0,0 +1,64 @@ +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 WinFormControl; + +namespace ButcherFactory.Dialogs +{ + public partial class NumberSetDialog : Form + { + const string FilePatch = @"Config\NumberSetDialog.cfg"; + public NumberSetDialog() + { + InitializeComponent(); + if (System.IO.File.Exists(FilePatch)) + { + var text = System.IO.File.ReadAllText(FilePatch); + var arr = text.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + foreach (var item in arr) + flowLayoutPanel1.Controls.Add(BuildBtn(item)); + } + } + + private void setBtn_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(numBox.Text)) + return; + var selected = flowLayoutPanel1.Controls.Cast().FirstOrDefault(x => x.AsClicked); + if (selected != null) + { + selected.Text = numBox.Text; + selected.AsClicked = false; + } + else if (flowLayoutPanel1.Controls.Count == 3) + throw new Exception("最多设置3项"); + else + flowLayoutPanel1.Controls.Add(BuildBtn(numBox.Text)); + SaveConfig(); + } + + UButton BuildBtn(string text) + { + var btn = new UButton() { Width = 100, Height = 34, Text = text, Font = new Font("宋体", 15), Margin = new Padding(6, 2, 6, 0), WithStataHode = true, EnableGroup = true }; + return btn; + } + + private void clearAllBtn_Click(object sender, EventArgs e) + { + flowLayoutPanel1.Controls.Clear(); + SaveConfig(); + } + + void SaveConfig() + { + var arr = flowLayoutPanel1.Controls.Cast().Select(x => x.Text); + System.IO.File.WriteAllText(FilePatch, string.Join(",", arr)); + } + } +} diff --git a/ButcherFactory.Form/Dialogs/NumberSetDialog.resx b/ButcherFactory.Form/Dialogs/NumberSetDialog.resx new file mode 100644 index 0000000..7443a6a --- /dev/null +++ b/ButcherFactory.Form/Dialogs/NumberSetDialog.resx @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAAHNJREFUaEPt0AENACAMwDAkowVB14aDz0CTKui5b1gICoKCoCAoCAqCgqAgKAgK + goKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAg + KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII= + + + + + iVBORw0KGgoAAAANSUhEUgAAAGAAAAAwCAIAAABhdOiYAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO + wwAADsMBx2+oZAAAAHNJREFUaEPt0AENACAMwDAkowVB14aDz0CTKui5b1gICoKCoCAoCAqCgqAgKAgK + goKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAgKAgKgoKgICgICoKCoCAoCAqCgqAg + KAgKgoKg1ZsPvpCB0hBohjQAAAAASUVORK5CYII= + + + \ No newline at end of file