Browse Source

需求单No.154255 万福在用的“分割称重打码”客户端,增加一个“数量”的输入框,用户输入“数量”,点打印,系统打印出输入数量的条码数。

master
yibo 5 years ago
parent
commit
843d408e6c
3 changed files with 105 additions and 48 deletions
  1. +43
    -17
      ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.Designer.cs
  2. +60
    -29
      ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs
  3. +2
    -2
      ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint.cs

+ 43
- 17
ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.Designer.cs View File

@ -64,6 +64,7 @@
this.goodsSetBtn = new ButcherFactory.Controls.ColorButton(); this.goodsSetBtn = new ButcherFactory.Controls.ColorButton();
this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel(); this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
this.flowLayoutPanel1 = 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.deleteBtn = new ButcherFactory.Controls.ColorButton();
this.rePrintBtn = new ButcherFactory.Controls.ColorButton(); this.rePrintBtn = new ButcherFactory.Controls.ColorButton();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
@ -73,7 +74,8 @@
this.H_BarCode = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.H_BarCode = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Goods_Name = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.H_Goods_Name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.H_Weight = 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(); this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.taskDataGrid)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.taskDataGrid)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
@ -206,6 +208,8 @@
// //
// splitContainer1.Panel1 // 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.statisticNumberBox);
this.splitContainer1.Panel1.Controls.Add(this.label1); this.splitContainer1.Panel1.Controls.Add(this.label1);
this.splitContainer1.Panel1.Controls.Add(this.logBtn); this.splitContainer1.Panel1.Controls.Add(this.logBtn);
@ -230,7 +234,7 @@
// statisticNumberBox // statisticNumberBox
// //
this.statisticNumberBox.Font = new System.Drawing.Font("宋体", 15F); 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.Name = "statisticNumberBox";
this.statisticNumberBox.Size = new System.Drawing.Size(115, 30); this.statisticNumberBox.Size = new System.Drawing.Size(115, 30);
this.statisticNumberBox.TabIndex = 27; this.statisticNumberBox.TabIndex = 27;
@ -240,7 +244,7 @@
// //
this.label1.AutoSize = true; this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("宋体", 15F); 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.Name = "label1";
this.label1.Size = new System.Drawing.Size(109, 20); this.label1.Size = new System.Drawing.Size(109, 20);
this.label1.TabIndex = 26; this.label1.TabIndex = 26;
@ -252,7 +256,7 @@
this.logBtn.BackColor = System.Drawing.Color.CadetBlue; this.logBtn.BackColor = System.Drawing.Color.CadetBlue;
this.logBtn.Font = new System.Drawing.Font("宋体", 15F); this.logBtn.Font = new System.Drawing.Font("宋体", 15F);
this.logBtn.ForeColor = System.Drawing.Color.White; 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.Name = "logBtn";
this.logBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106))))); 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); this.logBtn.Size = new System.Drawing.Size(111, 41);
@ -433,6 +437,21 @@
this.flowLayoutPanel1.Size = new System.Drawing.Size(640, 70); this.flowLayoutPanel1.Size = new System.Drawing.Size(640, 70);
this.flowLayoutPanel1.TabIndex = 22; 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 // deleteBtn
// //
this.deleteBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 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.Name = "H_Weight";
this.H_Weight.ReadOnly = true; 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 // SegmentProductionAutoForm
// //
@ -634,5 +658,7 @@
private System.Windows.Forms.TextBox statisticNumberBox; private System.Windows.Forms.TextBox statisticNumberBox;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private Controls.ColorButton viewTaskBtn; private Controls.ColorButton viewTaskBtn;
private System.Windows.Forms.TextBox numberInput;
private System.Windows.Forms.Label label2;
} }
} }

+ 60
- 29
ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs View File

@ -198,38 +198,47 @@ namespace ButcherFactory.SegmentProductionAuto_
throw new Exception(string.Format("重量必须在{0:#0.######}-{1:#0.######}之间", detail.StandardWeightLow, detail.StandardWeightUp)); throw new Exception(string.Format("重量必须在{0:#0.######}-{1:#0.######}之间", detail.StandardWeightLow, detail.StandardWeightUp));
weight = detail.StandardWeight.Value; 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.FirstDisplayedScrollingRowIndex = 0;
historyDataGrid.ClearSelection(); historyDataGrid.ClearSelection();
historyDataGrid.Refresh(); 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)); var thd = new Thread(new ParameterizedThreadStart(RefreshTask));
thd.Start(entity); 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 }); 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(); 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();
}
}
}
} }
} }

+ 2
- 2
ButcherFactory.Form/SegmentProduction_/SegmentProductionPrint.cs View File

@ -99,13 +99,13 @@ namespace ButcherFactory.SegmentProduction_
static DirectoryInfo TempImage = null; static DirectoryInfo TempImage = null;
private static void AfterPrint() private static void AfterPrint()
{ {
if (id == 20)
if (id == 100)
id = 0; id = 0;
id++; id++;
if (TempImage == null) if (TempImage == null)
TempImage = new DirectoryInfo("TempImg"); TempImage = new DirectoryInfo("TempImg");
var files = TempImage.GetFiles(); var files = TempImage.GetFiles();
while (files.Length > 20)
while (files.Length > 100)
{ {
var last = files.OrderBy(x => x.CreationTime).First().FullName; var last = files.OrderBy(x => x.CreationTime).First().FullName;
File.Delete(last); File.Delete(last);


Loading…
Cancel
Save