From 843d408e6cbcd03312a60e0a086abe203fb16353 Mon Sep 17 00:00:00 2001 From: yibo <361071264@qq.com> Date: Tue, 12 Jan 2021 13:35:33 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9C=80=E6=B1=82=E5=8D=95No.154255=20?= =?UTF-8?q?=E4=B8=87=E7=A6=8F=E5=9C=A8=E7=94=A8=E7=9A=84=E2=80=9C=E5=88=86?= =?UTF-8?q?=E5=89=B2=E7=A7=B0=E9=87=8D=E6=89=93=E7=A0=81=E2=80=9D=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E7=AB=AF=EF=BC=8C=E5=A2=9E=E5=8A=A0=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E2=80=9C=E6=95=B0=E9=87=8F=E2=80=9D=E7=9A=84=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E6=A1=86=EF=BC=8C=E7=94=A8=E6=88=B7=E8=BE=93=E5=85=A5=E2=80=9C?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E2=80=9D=EF=BC=8C=E7=82=B9=E6=89=93=E5=8D=B0?= =?UTF-8?q?=EF=BC=8C=E7=B3=BB=E7=BB=9F=E6=89=93=E5=8D=B0=E5=87=BA=E8=BE=93?= =?UTF-8?q?=E5=85=A5=E6=95=B0=E9=87=8F=E7=9A=84=E6=9D=A1=E7=A0=81=E6=95=B0?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SegmentProductionAutoForm.Designer.cs | 60 +++++++++---- .../SegmentProductionAutoForm.cs | 89 +++++++++++++------ .../SegmentProductionPrint.cs | 4 +- 3 files changed, 105 insertions(+), 48 deletions(-) diff --git a/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.Designer.cs b/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.Designer.cs index 1a86581..3751a1e 100644 --- a/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.Designer.cs +++ b/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.Designer.cs @@ -64,6 +64,7 @@ this.goodsSetBtn = new ButcherFactory.Controls.ColorButton(); this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel(); this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.viewTaskBtn = new ButcherFactory.Controls.ColorButton(); this.deleteBtn = new ButcherFactory.Controls.ColorButton(); this.rePrintBtn = new ButcherFactory.Controls.ColorButton(); this.groupBox1 = new System.Windows.Forms.GroupBox(); @@ -73,7 +74,8 @@ this.H_BarCode = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.H_Goods_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.H_Weight = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.viewTaskBtn = new ButcherFactory.Controls.ColorButton(); + this.numberInput = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); this.groupBox2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.taskDataGrid)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); @@ -206,6 +208,8 @@ // // splitContainer1.Panel1 // + this.splitContainer1.Panel1.Controls.Add(this.numberInput); + this.splitContainer1.Panel1.Controls.Add(this.label2); this.splitContainer1.Panel1.Controls.Add(this.statisticNumberBox); this.splitContainer1.Panel1.Controls.Add(this.label1); this.splitContainer1.Panel1.Controls.Add(this.logBtn); @@ -230,7 +234,7 @@ // statisticNumberBox // this.statisticNumberBox.Font = new System.Drawing.Font("宋体", 15F); - this.statisticNumberBox.Location = new System.Drawing.Point(532, 47); + this.statisticNumberBox.Location = new System.Drawing.Point(502, 47); this.statisticNumberBox.Name = "statisticNumberBox"; this.statisticNumberBox.Size = new System.Drawing.Size(115, 30); this.statisticNumberBox.TabIndex = 27; @@ -240,7 +244,7 @@ // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("宋体", 15F); - this.label1.Location = new System.Drawing.Point(430, 51); + this.label1.Location = new System.Drawing.Point(400, 51); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(109, 20); this.label1.TabIndex = 26; @@ -252,7 +256,7 @@ this.logBtn.BackColor = System.Drawing.Color.CadetBlue; this.logBtn.Font = new System.Drawing.Font("宋体", 15F); this.logBtn.ForeColor = System.Drawing.Color.White; - this.logBtn.Location = new System.Drawing.Point(670, 7); + this.logBtn.Location = new System.Drawing.Point(670, 4); this.logBtn.Name = "logBtn"; this.logBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106))))); this.logBtn.Size = new System.Drawing.Size(111, 41); @@ -433,6 +437,21 @@ this.flowLayoutPanel1.Size = new System.Drawing.Size(640, 70); this.flowLayoutPanel1.TabIndex = 22; // + // viewTaskBtn + // + this.viewTaskBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.viewTaskBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(77)))), ((int)(((byte)(135)))), ((int)(((byte)(245))))); + this.viewTaskBtn.Font = new System.Drawing.Font("宋体", 15F); + this.viewTaskBtn.ForeColor = System.Drawing.Color.White; + this.viewTaskBtn.Location = new System.Drawing.Point(14, 126); + this.viewTaskBtn.Name = "viewTaskBtn"; + this.viewTaskBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106))))); + this.viewTaskBtn.Size = new System.Drawing.Size(111, 41); + this.viewTaskBtn.TabIndex = 24; + this.viewTaskBtn.Text = "完工"; + this.viewTaskBtn.UseVisualStyleBackColor = false; + this.viewTaskBtn.Click += new System.EventHandler(this.ViewTaskBtn_Click); + // // deleteBtn // this.deleteBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); @@ -552,20 +571,25 @@ this.H_Weight.Name = "H_Weight"; this.H_Weight.ReadOnly = true; // - // viewTaskBtn + // numberInput // - this.viewTaskBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.viewTaskBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(77)))), ((int)(((byte)(135)))), ((int)(((byte)(245))))); - this.viewTaskBtn.Font = new System.Drawing.Font("宋体", 15F); - this.viewTaskBtn.ForeColor = System.Drawing.Color.White; - this.viewTaskBtn.Location = new System.Drawing.Point(14, 126); - this.viewTaskBtn.Name = "viewTaskBtn"; - this.viewTaskBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106))))); - this.viewTaskBtn.Size = new System.Drawing.Size(111, 41); - this.viewTaskBtn.TabIndex = 24; - this.viewTaskBtn.Text = "完工"; - this.viewTaskBtn.UseVisualStyleBackColor = false; - this.viewTaskBtn.Click += new System.EventHandler(this.ViewTaskBtn_Click); + this.numberInput.Font = new System.Drawing.Font("宋体", 15F); + this.numberInput.Location = new System.Drawing.Point(680, 47); + this.numberInput.Name = "numberInput"; + this.numberInput.Size = new System.Drawing.Size(115, 30); + this.numberInput.TabIndex = 29; + this.numberInput.Text = "1"; + this.numberInput.MouseClick += new System.Windows.Forms.MouseEventHandler(this.numberInput_MouseClick); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("宋体", 15F); + this.label2.Location = new System.Drawing.Point(623, 51); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(69, 20); + this.label2.TabIndex = 28; + this.label2.Text = "数量:"; // // SegmentProductionAutoForm // @@ -634,5 +658,7 @@ private System.Windows.Forms.TextBox statisticNumberBox; private System.Windows.Forms.Label label1; private Controls.ColorButton viewTaskBtn; + private System.Windows.Forms.TextBox numberInput; + private System.Windows.Forms.Label label2; } } \ No newline at end of file diff --git a/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs b/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs index 3972f1d..aa94ece 100644 --- a/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs +++ b/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs @@ -198,38 +198,47 @@ namespace ButcherFactory.SegmentProductionAuto_ throw new Exception(string.Format("重量必须在{0:#0.######}-{1:#0.######}之间", detail.StandardWeightLow, detail.StandardWeightUp)); weight = detail.StandardWeight.Value; } - var entity = new SegmentProduction(); - entity.Goods_ID = detail.Goods_ID; - entity.Weight = weight; - entity.WorkUnit_ID = config.WorkUnitID; - entity.ProductBatch_ID = batchID.Value; - entity.StandardPic = detail.StandardPic; - if (!string.IsNullOrEmpty(statisticNumberBox.Text)) - entity.StatisticNumber = decimal.Parse(statisticNumberBox.Text); - SegmentProductionBL.InsertAndSetGroupID(entity, batchDate.Value); - entity.Goods_Code = detail.Goods_Code; - entity.Goods_Name = detail.Goods_Name; - entity.Goods_Spec = detail.Goods_Spec; - entity.MainUnit = detail.MainUnit; - entity.ShotPrintName = detail.ShotPrintName; - GoodsLabel.Text = entity.Goods_Name; - - historyList.Insert(0, entity); - if (historyList.Count > 30) - historyList.RemoveAt(30); + var pics = int.Parse(numberInput.Text); + if (pics <= 0) + pics = 1; + else if (pics > 50) + pics = 50; + SegmentProduction entity = null; + for (var i = 0; i < pics; i++) + { + entity = new SegmentProduction(); + entity.Goods_ID = detail.Goods_ID; + entity.Weight = weight; + entity.WorkUnit_ID = config.WorkUnitID; + entity.ProductBatch_ID = batchID.Value; + entity.StandardPic = detail.StandardPic; + if (!string.IsNullOrEmpty(statisticNumberBox.Text)) + entity.StatisticNumber = decimal.Parse(statisticNumberBox.Text); + SegmentProductionBL.InsertAndSetGroupID(entity, batchDate.Value); + entity.Goods_Code = detail.Goods_Code; + entity.Goods_Name = detail.Goods_Name; + entity.Goods_Spec = detail.Goods_Spec; + entity.MainUnit = detail.MainUnit; + entity.ShotPrintName = detail.ShotPrintName; + + historyList.Insert(0, entity); + if (historyList.Count > 30) + historyList.RemoveAt(30); + if (barPrintCheck.Checked) + { + var template = config.Template; + if (detail.GoodsType.HasValue) + template = detail.GoodsType == 0 ? "SegmentProductionPrint.html" : "SegmentProductionPrint1.html"; + NotAuto.SegmentProductionPrint.Print(entity, batchDate, template); + var log = new SegmentLog(entity.BarCode, "打印"); + log.Message = string.Format("存货名称:{0} 重量:{1:#0.###}", entity.Goods_Name, entity.Weight); + SegmentProductionBL.InsertLog(log); + } + } + GoodsLabel.Text = detail.Goods_Name; historyDataGrid.FirstDisplayedScrollingRowIndex = 0; historyDataGrid.ClearSelection(); historyDataGrid.Refresh(); - if (barPrintCheck.Checked) - { - var template = config.Template; - if (detail.GoodsType.HasValue) - template = detail.GoodsType == 0 ? "SegmentProductionPrint.html" : "SegmentProductionPrint1.html"; - NotAuto.SegmentProductionPrint.Print(entity, batchDate, template); - var log = new SegmentLog(entity.BarCode, "打印"); - log.Message = string.Format("存货名称:{0} 重量:{1:#0.###}", entity.Goods_Name, entity.Weight); - SegmentProductionBL.InsertLog(log); - } var thd = new Thread(new ParameterizedThreadStart(RefreshTask)); thd.Start(entity); } @@ -406,5 +415,27 @@ namespace ButcherFactory.SegmentProductionAuto_ var goods = arr.Select(x => new Goods { Code = x.Goods_Code, Name = x.Goods_Name, ID = x.Goods_ID }); new ViewTaskForm(batchDate ?? DateTime.Today, batchID.Value, goods).ShowDialog(); } + + private void numberInput_MouseClick(object sender, MouseEventArgs e) + { + var keyBoard = new NumberPad(); + if (keyBoard.ShowDialog() == true) + { + var box = (sender as TextBox); + if (string.IsNullOrEmpty(keyBoard.Result)) + box.Text = "1"; + else + { + int num = 0; + if (!int.TryParse(keyBoard.Result, out num)) + throw new Exception("数量输入有误"); + if (num <= 0) + num = 1; + if (num > 50) + num = 50; + box.Text = num.ToString(); + } + } + } } } diff --git a/ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint.cs b/ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint.cs index 11ec8c1..44cc6f3 100644 --- a/ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint.cs +++ b/ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint.cs @@ -99,13 +99,13 @@ namespace ButcherFactory.SegmentProduction_ static DirectoryInfo TempImage = null; private static void AfterPrint() { - if (id == 20) + if (id == 100) id = 0; id++; if (TempImage == null) TempImage = new DirectoryInfo("TempImg"); var files = TempImage.GetFiles(); - while (files.Length > 20) + while (files.Length > 100) { var last = files.OrderBy(x => x.CreationTime).First().FullName; File.Delete(last);