Browse Source

需求单No.4261

qdwf_2864
Robin_PC\robin 1 month ago
parent
commit
19dd46f76a
2 changed files with 366 additions and 205 deletions
  1. +246
    -180
      ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.Designer.cs
  2. +120
    -25
      ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs

+ 246
- 180
ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.Designer.cs View File

@ -28,12 +28,12 @@
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = 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 dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle();
this.uLabel3 = new WinFormControl.ULabel();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.taskDataGrid = new WinFormControl.UDataGridView();
@ -49,10 +49,7 @@
this.label2 = new System.Windows.Forms.Label();
this.statisticNumberBox = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.logBtn = new ButcherFactory.Controls.ColorButton();
this.msglbl = new System.Windows.Forms.Label();
this.closeBtn = new ButcherFactory.Controls.ColorButton();
this.uWeightControl1 = new ButcherFactory.Controls.WeightControl();
this.barPrintCheck = new System.Windows.Forms.CheckBox();
this.uTimerLabel1 = new WinFormControl.UTimerLabel();
this.productBatchSelect = new System.Windows.Forms.ComboBox();
@ -61,17 +58,22 @@
this.uLabel2 = new WinFormControl.ULabel();
this.netStateWatch1 = new WinFormControl.NetStateWatch();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.goodsSetBtn = new ButcherFactory.Controls.ColorButton();
this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.flowLayoutPanel4 = new System.Windows.Forms.FlowLayoutPanel();
this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel();
this.scDate = new WinFormControl.ULabel();
this.label4 = new System.Windows.Forms.Label();
this.logBtn = new ButcherFactory.Controls.ColorButton();
this.closeBtn = new ButcherFactory.Controls.ColorButton();
this.uWeightControl1 = new ButcherFactory.Controls.WeightControl();
this.goodsSetBtn = new ButcherFactory.Controls.ColorButton();
this.colorButton2 = new ButcherFactory.Controls.ColorButton();
this.viewTaskBtn = new ButcherFactory.Controls.ColorButton();
this.colorButton1 = new ButcherFactory.Controls.ColorButton();
this.deleteBtn = new ButcherFactory.Controls.ColorButton();
this.rePrintBtn = new ButcherFactory.Controls.ColorButton();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.flowLayoutPanel4 = new System.Windows.Forms.FlowLayoutPanel();
this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.taskDataGrid)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
@ -90,19 +92,21 @@
this.uLabel3.AutoSize = true;
this.uLabel3.BackColor = System.Drawing.Color.White;
this.uLabel3.Font = new System.Drawing.Font("宋体", 12F);
this.uLabel3.Location = new System.Drawing.Point(8, 0);
this.uLabel3.Location = new System.Drawing.Point(11, 0);
this.uLabel3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.uLabel3.Name = "uLabel3";
this.uLabel3.Size = new System.Drawing.Size(72, 16);
this.uLabel3.Size = new System.Drawing.Size(89, 20);
this.uLabel3.TabIndex = 1;
this.uLabel3.Text = "生产历史";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.taskDataGrid);
this.groupBox2.Location = new System.Drawing.Point(3, 3);
this.groupBox2.Location = new System.Drawing.Point(4, 4);
this.groupBox2.Margin = new System.Windows.Forms.Padding(4);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Padding = new System.Windows.Forms.Padding(5, 5, 5, 5);
this.groupBox2.Size = new System.Drawing.Size(452, 120);
this.groupBox2.Padding = new System.Windows.Forms.Padding(7, 6, 7, 6);
this.groupBox2.Size = new System.Drawing.Size(603, 150);
this.groupBox2.TabIndex = 4;
this.groupBox2.TabStop = false;
//
@ -112,15 +116,15 @@
this.taskDataGrid.AllowUserToDeleteRows = false;
this.taskDataGrid.AllowUserToResizeColumns = false;
this.taskDataGrid.AllowUserToResizeRows = false;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.taskDataGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
dataGridViewCellStyle13.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.taskDataGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle13;
this.taskDataGrid.BackgroundColor = System.Drawing.Color.White;
this.taskDataGrid.BorderStyle = System.Windows.Forms.BorderStyle.None;
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.taskDataGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle14.Font = new System.Drawing.Font("宋体", 12F);
dataGridViewCellStyle14.ForeColor = System.Drawing.Color.White;
dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.taskDataGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle14;
this.taskDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.taskDataGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.T_Item,
@ -128,18 +132,19 @@
this.T_Done,
this.T_Last});
this.taskDataGrid.Dock = System.Windows.Forms.DockStyle.Fill;
this.taskDataGrid.Location = new System.Drawing.Point(5, 19);
this.taskDataGrid.Location = new System.Drawing.Point(7, 24);
this.taskDataGrid.Margin = new System.Windows.Forms.Padding(4);
this.taskDataGrid.MultiSelect = false;
this.taskDataGrid.Name = "taskDataGrid";
this.taskDataGrid.ReadOnly = true;
this.taskDataGrid.RowHeadersVisible = false;
this.taskDataGrid.RowHeadersWidth = 51;
dataGridViewCellStyle6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.taskDataGrid.RowsDefaultCellStyle = dataGridViewCellStyle6;
dataGridViewCellStyle18.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle18.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218)))));
this.taskDataGrid.RowsDefaultCellStyle = dataGridViewCellStyle18;
this.taskDataGrid.RowTemplate.Height = 23;
this.taskDataGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.taskDataGrid.Size = new System.Drawing.Size(442, 96);
this.taskDataGrid.Size = new System.Drawing.Size(589, 120);
this.taskDataGrid.TabIndex = 2;
//
// T_Item
@ -155,8 +160,8 @@
//
this.T_Need.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.T_Need.DataPropertyName = "Need";
dataGridViewCellStyle3.Format = "#0.######";
this.T_Need.DefaultCellStyle = dataGridViewCellStyle3;
dataGridViewCellStyle15.Format = "#0.######";
this.T_Need.DefaultCellStyle = dataGridViewCellStyle15;
this.T_Need.HeaderText = "订货";
this.T_Need.MinimumWidth = 6;
this.T_Need.Name = "T_Need";
@ -166,8 +171,8 @@
//
this.T_Done.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.T_Done.DataPropertyName = "Done";
dataGridViewCellStyle4.Format = "#0.######";
this.T_Done.DefaultCellStyle = dataGridViewCellStyle4;
dataGridViewCellStyle16.Format = "#0.######";
this.T_Done.DefaultCellStyle = dataGridViewCellStyle16;
this.T_Done.HeaderText = "完工";
this.T_Done.MinimumWidth = 6;
this.T_Done.Name = "T_Done";
@ -177,8 +182,8 @@
//
this.T_Last.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.T_Last.DataPropertyName = "Last";
dataGridViewCellStyle5.Format = "#0.######";
this.T_Last.DefaultCellStyle = dataGridViewCellStyle5;
dataGridViewCellStyle17.Format = "#0.######";
this.T_Last.DefaultCellStyle = dataGridViewCellStyle17;
this.T_Last.HeaderText = "剩余";
this.T_Last.MinimumWidth = 6;
this.T_Last.Name = "T_Last";
@ -190,9 +195,10 @@
this.GoodsLabel.BackColor = System.Drawing.Color.White;
this.GoodsLabel.Font = new System.Drawing.Font("宋体", 12F);
this.GoodsLabel.ForeColor = System.Drawing.Color.Blue;
this.GoodsLabel.Location = new System.Drawing.Point(144, 178);
this.GoodsLabel.Location = new System.Drawing.Point(192, 222);
this.GoodsLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.GoodsLabel.Name = "GoodsLabel";
this.GoodsLabel.Size = new System.Drawing.Size(72, 16);
this.GoodsLabel.Size = new System.Drawing.Size(89, 20);
this.GoodsLabel.TabIndex = 1;
this.GoodsLabel.Text = "存货名称";
//
@ -203,11 +209,14 @@
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.IsSplitterFixed = true;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Margin = new System.Windows.Forms.Padding(4);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.scDate);
this.splitContainer1.Panel1.Controls.Add(this.label4);
this.splitContainer1.Panel1.Controls.Add(this.butcherDateBox);
this.splitContainer1.Panel1.Controls.Add(this.label3);
this.splitContainer1.Panel1.Controls.Add(this.numberInput);
@ -229,8 +238,9 @@
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
this.splitContainer1.Size = new System.Drawing.Size(1155, 676);
this.splitContainer1.Size = new System.Drawing.Size(1794, 845);
this.splitContainer1.SplitterDistance = 100;
this.splitContainer1.SplitterWidth = 5;
this.splitContainer1.TabIndex = 1;
//
// butcherDateBox
@ -238,9 +248,10 @@
this.butcherDateBox.BackColor = System.Drawing.Color.Transparent;
this.butcherDateBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.butcherDateBox.Font = new System.Drawing.Font("宋体", 15F);
this.butcherDateBox.Location = new System.Drawing.Point(502, 15);
this.butcherDateBox.Location = new System.Drawing.Point(636, 8);
this.butcherDateBox.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.butcherDateBox.Name = "butcherDateBox";
this.butcherDateBox.Size = new System.Drawing.Size(115, 30);
this.butcherDateBox.Size = new System.Drawing.Size(153, 37);
this.butcherDateBox.TabIndex = 35;
this.butcherDateBox.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.butcherDateBox.MouseClick += new System.Windows.Forms.MouseEventHandler(this.butcherDateBox_MouseClick);
@ -248,19 +259,22 @@
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("宋体", 15F);
this.label3.Location = new System.Drawing.Point(400, 21);
this.label3.Font = new System.Drawing.Font("宋体", 13F);
this.label3.Location = new System.Drawing.Point(523, 16);
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(109, 20);
this.label3.Size = new System.Drawing.Size(120, 22);
this.label3.TabIndex = 30;
this.label3.Text = "屠宰日期:";
this.label3.Click += new System.EventHandler(this.label3_Click);
//
// numberInput
//
this.numberInput.Font = new System.Drawing.Font("宋体", 15F);
this.numberInput.Location = new System.Drawing.Point(680, 47);
this.numberInput.Location = new System.Drawing.Point(906, 58);
this.numberInput.Margin = new System.Windows.Forms.Padding(4);
this.numberInput.Name = "numberInput";
this.numberInput.Size = new System.Drawing.Size(115, 30);
this.numberInput.Size = new System.Drawing.Size(152, 36);
this.numberInput.TabIndex = 29;
this.numberInput.Text = "1";
this.numberInput.MouseClick += new System.Windows.Forms.MouseEventHandler(this.numberInput_MouseClick);
@ -268,88 +282,53 @@
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("宋体", 15F);
this.label2.Location = new System.Drawing.Point(623, 51);
this.label2.Font = new System.Drawing.Font("宋体", 13F);
this.label2.Location = new System.Drawing.Point(797, 65);
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(69, 20);
this.label2.Size = new System.Drawing.Size(76, 22);
this.label2.TabIndex = 28;
this.label2.Text = "数量:";
//
// statisticNumberBox
//
this.statisticNumberBox.Font = new System.Drawing.Font("宋体", 15F);
this.statisticNumberBox.Location = new System.Drawing.Point(502, 47);
this.statisticNumberBox.Location = new System.Drawing.Point(636, 58);
this.statisticNumberBox.Margin = new System.Windows.Forms.Padding(4);
this.statisticNumberBox.Name = "statisticNumberBox";
this.statisticNumberBox.Size = new System.Drawing.Size(115, 30);
this.statisticNumberBox.Size = new System.Drawing.Size(152, 36);
this.statisticNumberBox.TabIndex = 27;
this.statisticNumberBox.MouseClick += new System.Windows.Forms.MouseEventHandler(this.StatisticNumberBox_MouseClick);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("宋体", 15F);
this.label1.Location = new System.Drawing.Point(400, 51);
this.label1.Font = new System.Drawing.Font("宋体", 13F);
this.label1.Location = new System.Drawing.Point(523, 64);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(109, 20);
this.label1.Size = new System.Drawing.Size(120, 22);
this.label1.TabIndex = 26;
this.label1.Text = "统计数量:";
//
// logBtn
//
this.logBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
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(609, 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(101, 41);
this.logBtn.TabIndex = 25;
this.logBtn.Text = "日志";
this.logBtn.UseVisualStyleBackColor = false;
this.logBtn.Click += new System.EventHandler(this.logBtn_Click);
//
// msglbl
//
this.msglbl.AutoSize = true;
this.msglbl.ForeColor = System.Drawing.Color.Red;
this.msglbl.Location = new System.Drawing.Point(388, 6);
this.msglbl.Location = new System.Drawing.Point(517, 8);
this.msglbl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.msglbl.Name = "msglbl";
this.msglbl.Size = new System.Drawing.Size(0, 12);
this.msglbl.Size = new System.Drawing.Size(0, 15);
this.msglbl.TabIndex = 24;
//
// closeBtn
//
this.closeBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.closeBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(25)))));
this.closeBtn.Font = new System.Drawing.Font("宋体", 15F);
this.closeBtn.ForeColor = System.Drawing.Color.White;
this.closeBtn.Location = new System.Drawing.Point(1038, 7);
this.closeBtn.Name = "closeBtn";
this.closeBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106)))));
this.closeBtn.Size = new System.Drawing.Size(111, 41);
this.closeBtn.TabIndex = 18;
this.closeBtn.Text = "关闭";
this.closeBtn.UseVisualStyleBackColor = false;
this.closeBtn.Click += new System.EventHandler(this.closeBtn_Click);
//
// uWeightControl1
//
this.uWeightControl1.BackColor = System.Drawing.Color.Transparent;
this.uWeightControl1.Location = new System.Drawing.Point(12, 7);
this.uWeightControl1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.uWeightControl1.Name = "uWeightControl1";
this.uWeightControl1.Size = new System.Drawing.Size(262, 74);
this.uWeightControl1.TabIndex = 17;
this.uWeightControl1.WeightFalg = null;
//
// barPrintCheck
//
this.barPrintCheck.AutoSize = true;
this.barPrintCheck.Font = new System.Drawing.Font("宋体", 15F);
this.barPrintCheck.Location = new System.Drawing.Point(292, 50);
this.barPrintCheck.Location = new System.Drawing.Point(389, 62);
this.barPrintCheck.Margin = new System.Windows.Forms.Padding(4);
this.barPrintCheck.Name = "barPrintCheck";
this.barPrintCheck.Size = new System.Drawing.Size(108, 24);
this.barPrintCheck.Size = new System.Drawing.Size(134, 29);
this.barPrintCheck.TabIndex = 16;
this.barPrintCheck.Text = "启用打码";
this.barPrintCheck.UseVisualStyleBackColor = true;
@ -361,9 +340,10 @@
this.uTimerLabel1.BackColor = System.Drawing.Color.Transparent;
this.uTimerLabel1.Font = new System.Drawing.Font("黑体", 12F);
this.uTimerLabel1.Format = "M月d日 H:mm:ss";
this.uTimerLabel1.Location = new System.Drawing.Point(1012, 53);
this.uTimerLabel1.Location = new System.Drawing.Point(1604, 66);
this.uTimerLabel1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.uTimerLabel1.Name = "uTimerLabel1";
this.uTimerLabel1.Size = new System.Drawing.Size(136, 16);
this.uTimerLabel1.Size = new System.Drawing.Size(169, 20);
this.uTimerLabel1.TabIndex = 14;
this.uTimerLabel1.Text = "4月21日 16:32:19";
//
@ -372,9 +352,10 @@
this.productBatchSelect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.productBatchSelect.Font = new System.Drawing.Font("宋体", 15F);
this.productBatchSelect.FormattingEnabled = true;
this.productBatchSelect.Location = new System.Drawing.Point(832, 47);
this.productBatchSelect.Location = new System.Drawing.Point(1364, 59);
this.productBatchSelect.Margin = new System.Windows.Forms.Padding(4);
this.productBatchSelect.Name = "productBatchSelect";
this.productBatchSelect.Size = new System.Drawing.Size(170, 28);
this.productBatchSelect.Size = new System.Drawing.Size(225, 33);
this.productBatchSelect.TabIndex = 11;
//
// workUnitSelect
@ -382,9 +363,10 @@
this.workUnitSelect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.workUnitSelect.Font = new System.Drawing.Font("宋体", 15F);
this.workUnitSelect.FormattingEnabled = true;
this.workUnitSelect.Location = new System.Drawing.Point(832, 11);
this.workUnitSelect.Location = new System.Drawing.Point(1364, 14);
this.workUnitSelect.Margin = new System.Windows.Forms.Padding(4);
this.workUnitSelect.Name = "workUnitSelect";
this.workUnitSelect.Size = new System.Drawing.Size(170, 28);
this.workUnitSelect.Size = new System.Drawing.Size(225, 33);
this.workUnitSelect.TabIndex = 10;
//
// uLabel1
@ -393,9 +375,10 @@
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(730, 14);
this.uLabel1.Location = new System.Drawing.Point(1228, 18);
this.uLabel1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.uLabel1.Name = "uLabel1";
this.uLabel1.Size = new System.Drawing.Size(109, 20);
this.uLabel1.Size = new System.Drawing.Size(137, 25);
this.uLabel1.TabIndex = 12;
this.uLabel1.Text = "工作单元:";
//
@ -405,19 +388,20 @@
this.uLabel2.AutoSize = true;
this.uLabel2.BackColor = System.Drawing.Color.Transparent;
this.uLabel2.Font = new System.Drawing.Font("宋体", 15F);
this.uLabel2.Location = new System.Drawing.Point(730, 50);
this.uLabel2.Location = new System.Drawing.Point(1228, 62);
this.uLabel2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.uLabel2.Name = "uLabel2";
this.uLabel2.Size = new System.Drawing.Size(109, 20);
this.uLabel2.Size = new System.Drawing.Size(137, 25);
this.uLabel2.TabIndex = 13;
this.uLabel2.Text = "生产批次:";
//
// netStateWatch1
//
this.netStateWatch1.BackColor = System.Drawing.Color.Transparent;
this.netStateWatch1.Location = new System.Drawing.Point(292, 2);
this.netStateWatch1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.netStateWatch1.Location = new System.Drawing.Point(389, 2);
this.netStateWatch1.Margin = new System.Windows.Forms.Padding(5);
this.netStateWatch1.Name = "netStateWatch1";
this.netStateWatch1.Size = new System.Drawing.Size(90, 39);
this.netStateWatch1.Size = new System.Drawing.Size(120, 49);
this.netStateWatch1.TabIndex = 1;
//
// splitContainer2
@ -426,6 +410,7 @@
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
this.splitContainer2.Location = new System.Drawing.Point(0, 0);
this.splitContainer2.Margin = new System.Windows.Forms.Padding(4);
this.splitContainer2.Name = "splitContainer2";
//
// splitContainer2.Panel1
@ -444,25 +429,11 @@
this.splitContainer2.Panel2.Controls.Add(this.rePrintBtn);
this.splitContainer2.Panel2.Controls.Add(this.groupBox1);
this.splitContainer2.Panel2.Controls.Add(this.groupBox2);
this.splitContainer2.Size = new System.Drawing.Size(1155, 572);
this.splitContainer2.SplitterDistance = 697;
this.splitContainer2.Size = new System.Drawing.Size(1794, 740);
this.splitContainer2.SplitterDistance = 1334;
this.splitContainer2.SplitterWidth = 5;
this.splitContainer2.TabIndex = 0;
//
// goodsSetBtn
//
this.goodsSetBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.goodsSetBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(77)))), ((int)(((byte)(135)))), ((int)(((byte)(245)))));
this.goodsSetBtn.Font = new System.Drawing.Font("宋体", 15F);
this.goodsSetBtn.ForeColor = System.Drawing.Color.White;
this.goodsSetBtn.Location = new System.Drawing.Point(596, 3);
this.goodsSetBtn.Name = "goodsSetBtn";
this.goodsSetBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106)))));
this.goodsSetBtn.Size = new System.Drawing.Size(111, 62);
this.goodsSetBtn.TabIndex = 19;
this.goodsSetBtn.Text = "产品设置";
this.goodsSetBtn.UseVisualStyleBackColor = false;
this.goodsSetBtn.Click += new System.EventHandler(this.goodsSetBtn_Click);
//
// flowLayoutPanel2
//
this.flowLayoutPanel2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@ -470,10 +441,12 @@
| System.Windows.Forms.AnchorStyles.Right)));
this.flowLayoutPanel2.AutoScroll = true;
this.flowLayoutPanel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.flowLayoutPanel2.Location = new System.Drawing.Point(-1, 75);
this.flowLayoutPanel2.Location = new System.Drawing.Point(-1, 94);
this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(4);
this.flowLayoutPanel2.Name = "flowLayoutPanel2";
this.flowLayoutPanel2.Size = new System.Drawing.Size(708, 495);
this.flowLayoutPanel2.Size = new System.Drawing.Size(1348, 644);
this.flowLayoutPanel2.TabIndex = 24;
this.flowLayoutPanel2.Paint += new System.Windows.Forms.PaintEventHandler(this.flowLayoutPanel2_Paint);
//
// flowLayoutPanel1
//
@ -481,19 +454,142 @@
| System.Windows.Forms.AnchorStyles.Right)));
this.flowLayoutPanel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.flowLayoutPanel1.Location = new System.Drawing.Point(-1, -1);
this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(4);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(591, 70);
this.flowLayoutPanel1.Size = new System.Drawing.Size(1192, 87);
this.flowLayoutPanel1.TabIndex = 22;
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.groupBox1.Controls.Add(this.flowLayoutPanel4);
this.groupBox1.Controls.Add(this.flowLayoutPanel3);
this.groupBox1.Controls.Add(this.uLabel3);
this.groupBox1.Location = new System.Drawing.Point(11, 278);
this.groupBox1.Margin = new System.Windows.Forms.Padding(4);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(7, 6, 7, 6);
this.groupBox1.Size = new System.Drawing.Size(596, 450);
this.groupBox1.TabIndex = 5;
this.groupBox1.TabStop = false;
//
// flowLayoutPanel4
//
this.flowLayoutPanel4.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.flowLayoutPanel4.AutoScroll = true;
this.flowLayoutPanel4.Location = new System.Drawing.Point(7, 112);
this.flowLayoutPanel4.Margin = new System.Windows.Forms.Padding(4);
this.flowLayoutPanel4.Name = "flowLayoutPanel4";
this.flowLayoutPanel4.Size = new System.Drawing.Size(583, 332);
this.flowLayoutPanel4.TabIndex = 5;
//
// flowLayoutPanel3
//
this.flowLayoutPanel3.AutoScroll = true;
this.flowLayoutPanel3.BackColor = System.Drawing.Color.White;
this.flowLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Top;
this.flowLayoutPanel3.Location = new System.Drawing.Point(7, 24);
this.flowLayoutPanel3.Margin = new System.Windows.Forms.Padding(0);
this.flowLayoutPanel3.Name = "flowLayoutPanel3";
this.flowLayoutPanel3.Size = new System.Drawing.Size(582, 85);
this.flowLayoutPanel3.TabIndex = 4;
this.flowLayoutPanel3.WrapContents = false;
//
// scDate
//
this.scDate.BackColor = System.Drawing.Color.Transparent;
this.scDate.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.scDate.Font = new System.Drawing.Font("宋体", 15F);
this.scDate.Location = new System.Drawing.Point(906, 8);
this.scDate.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.scDate.Name = "scDate";
this.scDate.Size = new System.Drawing.Size(153, 37);
this.scDate.TabIndex = 37;
this.scDate.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.scDate.MouseClick += new System.Windows.Forms.MouseEventHandler(this.scDateBox_MouseClick);
//
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("宋体", 13F);
this.label4.Location = new System.Drawing.Point(797, 16);
this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(120, 22);
this.label4.TabIndex = 36;
this.label4.Text = "生产日期:";
//
// logBtn
//
this.logBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
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(1067, 5);
this.logBtn.Margin = new System.Windows.Forms.Padding(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(135, 51);
this.logBtn.TabIndex = 25;
this.logBtn.Text = "日志";
this.logBtn.UseVisualStyleBackColor = false;
this.logBtn.Click += new System.EventHandler(this.logBtn_Click);
//
// closeBtn
//
this.closeBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.closeBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(25)))));
this.closeBtn.Font = new System.Drawing.Font("宋体", 15F);
this.closeBtn.ForeColor = System.Drawing.Color.White;
this.closeBtn.Location = new System.Drawing.Point(1639, 9);
this.closeBtn.Margin = new System.Windows.Forms.Padding(4);
this.closeBtn.Name = "closeBtn";
this.closeBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106)))));
this.closeBtn.Size = new System.Drawing.Size(148, 51);
this.closeBtn.TabIndex = 18;
this.closeBtn.Text = "关闭";
this.closeBtn.UseVisualStyleBackColor = false;
this.closeBtn.Click += new System.EventHandler(this.closeBtn_Click);
//
// uWeightControl1
//
this.uWeightControl1.BackColor = System.Drawing.Color.Transparent;
this.uWeightControl1.Location = new System.Drawing.Point(16, 9);
this.uWeightControl1.Margin = new System.Windows.Forms.Padding(5);
this.uWeightControl1.Name = "uWeightControl1";
this.uWeightControl1.Size = new System.Drawing.Size(349, 92);
this.uWeightControl1.TabIndex = 17;
this.uWeightControl1.WeightFalg = null;
//
// goodsSetBtn
//
this.goodsSetBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.goodsSetBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(77)))), ((int)(((byte)(135)))), ((int)(((byte)(245)))));
this.goodsSetBtn.Font = new System.Drawing.Font("宋体", 15F);
this.goodsSetBtn.ForeColor = System.Drawing.Color.White;
this.goodsSetBtn.Location = new System.Drawing.Point(1200, 4);
this.goodsSetBtn.Margin = new System.Windows.Forms.Padding(4);
this.goodsSetBtn.Name = "goodsSetBtn";
this.goodsSetBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106)))));
this.goodsSetBtn.Size = new System.Drawing.Size(148, 78);
this.goodsSetBtn.TabIndex = 19;
this.goodsSetBtn.Text = "产品设置";
this.goodsSetBtn.UseVisualStyleBackColor = false;
this.goodsSetBtn.Click += new System.EventHandler(this.goodsSetBtn_Click);
//
// colorButton2
//
this.colorButton2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(192)))), ((int)(((byte)(192)))));
this.colorButton2.Font = new System.Drawing.Font("宋体", 13F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.colorButton2.ForeColor = System.Drawing.Color.White;
this.colorButton2.Location = new System.Drawing.Point(344, 178);
this.colorButton2.Location = new System.Drawing.Point(459, 222);
this.colorButton2.Margin = new System.Windows.Forms.Padding(4);
this.colorButton2.Name = "colorButton2";
this.colorButton2.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107)))));
this.colorButton2.Size = new System.Drawing.Size(91, 38);
this.colorButton2.Size = new System.Drawing.Size(121, 48);
this.colorButton2.TabIndex = 5;
this.colorButton2.Text = "打总码";
this.colorButton2.UseVisualStyleBackColor = false;
@ -505,10 +601,11 @@
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(-10, 124);
this.viewTaskBtn.Location = new System.Drawing.Point(-164, 155);
this.viewTaskBtn.Margin = new System.Windows.Forms.Padding(4);
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(100, 41);
this.viewTaskBtn.Size = new System.Drawing.Size(133, 51);
this.viewTaskBtn.TabIndex = 24;
this.viewTaskBtn.Text = "完工";
this.viewTaskBtn.UseVisualStyleBackColor = false;
@ -519,10 +616,11 @@
this.colorButton1.BackColor = System.Drawing.Color.Blue;
this.colorButton1.Font = new System.Drawing.Font("宋体", 28F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.colorButton1.ForeColor = System.Drawing.Color.White;
this.colorButton1.Location = new System.Drawing.Point(13, 178);
this.colorButton1.Location = new System.Drawing.Point(17, 222);
this.colorButton1.Margin = new System.Windows.Forms.Padding(4);
this.colorButton1.Name = "colorButton1";
this.colorButton1.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(215)))), ((int)(((byte)(107)))));
this.colorButton1.Size = new System.Drawing.Size(100, 38);
this.colorButton1.Size = new System.Drawing.Size(133, 48);
this.colorButton1.TabIndex = 3;
this.colorButton1.Text = "+";
this.colorButton1.UseVisualStyleBackColor = false;
@ -534,10 +632,11 @@
this.deleteBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(25)))));
this.deleteBtn.Font = new System.Drawing.Font("宋体", 15F);
this.deleteBtn.ForeColor = System.Drawing.Color.White;
this.deleteBtn.Location = new System.Drawing.Point(155, 124);
this.deleteBtn.Location = new System.Drawing.Point(56, 155);
this.deleteBtn.Margin = new System.Windows.Forms.Padding(4);
this.deleteBtn.Name = "deleteBtn";
this.deleteBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106)))));
this.deleteBtn.Size = new System.Drawing.Size(85, 41);
this.deleteBtn.Size = new System.Drawing.Size(113, 51);
this.deleteBtn.TabIndex = 23;
this.deleteBtn.Text = "删除";
this.deleteBtn.UseVisualStyleBackColor = false;
@ -549,60 +648,25 @@
this.rePrintBtn.Enabled = false;
this.rePrintBtn.Font = new System.Drawing.Font("宋体", 15F);
this.rePrintBtn.ForeColor = System.Drawing.Color.White;
this.rePrintBtn.Location = new System.Drawing.Point(344, 126);
this.rePrintBtn.Location = new System.Drawing.Point(459, 158);
this.rePrintBtn.Margin = new System.Windows.Forms.Padding(4);
this.rePrintBtn.Name = "rePrintBtn";
this.rePrintBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106)))));
this.rePrintBtn.Size = new System.Drawing.Size(91, 39);
this.rePrintBtn.Size = new System.Drawing.Size(121, 49);
this.rePrintBtn.TabIndex = 22;
this.rePrintBtn.Text = "补打";
this.rePrintBtn.UseVisualStyleBackColor = false;
this.rePrintBtn.Visible = false;
this.rePrintBtn.Click += new System.EventHandler(this.rePrintBtn_Click);
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.groupBox1.Controls.Add(this.flowLayoutPanel4);
this.groupBox1.Controls.Add(this.flowLayoutPanel3);
this.groupBox1.Controls.Add(this.uLabel3);
this.groupBox1.Location = new System.Drawing.Point(8, 222);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(5, 5, 5, 5);
this.groupBox1.Size = new System.Drawing.Size(447, 339);
this.groupBox1.TabIndex = 5;
this.groupBox1.TabStop = false;
//
// flowLayoutPanel4
//
this.flowLayoutPanel4.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.flowLayoutPanel4.AutoScroll = true;
this.flowLayoutPanel4.Location = new System.Drawing.Point(5, 90);
this.flowLayoutPanel4.Name = "flowLayoutPanel4";
this.flowLayoutPanel4.Size = new System.Drawing.Size(437, 245);
this.flowLayoutPanel4.TabIndex = 5;
//
// flowLayoutPanel3
//
this.flowLayoutPanel3.AutoScroll = true;
this.flowLayoutPanel3.BackColor = System.Drawing.Color.White;
this.flowLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Top;
this.flowLayoutPanel3.Location = new System.Drawing.Point(5, 19);
this.flowLayoutPanel3.Margin = new System.Windows.Forms.Padding(0);
this.flowLayoutPanel3.Name = "flowLayoutPanel3";
this.flowLayoutPanel3.Size = new System.Drawing.Size(437, 68);
this.flowLayoutPanel3.TabIndex = 4;
this.flowLayoutPanel3.WrapContents = false;
//
// SegmentProductionAutoForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(1155, 676);
this.ClientSize = new System.Drawing.Size(1794, 845);
this.Controls.Add(this.splitContainer1);
this.Margin = new System.Windows.Forms.Padding(4);
this.Name = "SegmentProductionAutoForm";
this.Text = "分割品车间称重计数";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
@ -664,5 +728,7 @@
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel4;
private System.Windows.Forms.Label label3;
private WinFormControl.ULabel butcherDateBox;
private WinFormControl.ULabel scDate;
private System.Windows.Forms.Label label4;
}
}

+ 120
- 25
ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs View File

@ -32,6 +32,9 @@ namespace ButcherFactory.SegmentProductionAuto_
{
return this;
}
//====新增:线程安全退出标志====
private bool _isFormClosing = false;
private System.Windows.Forms.Timer _msgClearTimer;
Thread uploadData;
Thread checkInStoreState;
@ -43,6 +46,7 @@ namespace ButcherFactory.SegmentProductionAuto_
long? batchID;
DateTime? batchDate;
DateTime butcherDate = DateTime.Today;
DateTime scDateValue = DateTime.Today;
NotAuto.SegmentProductionFormConfig config;
List<GoodsIdentify> identityList;
List<string> specialGoodsCodes;
@ -50,6 +54,7 @@ namespace ButcherFactory.SegmentProductionAuto_
{
InitializeComponent();
butcherDateBox.Text = butcherDate.ToString("yyyy-MM-dd");
scDate.Text = scDateValue.ToString("yyyy-MM-dd");
netStateWatch1.GetConnectState = () => LoginUtil.TestConnection(500);
this.FormClosing += SegmentProductionAutoForm_FormClosing;
workUnitSelect.SelectedIndexChanged += delegate
@ -74,18 +79,56 @@ namespace ButcherFactory.SegmentProductionAuto_
batchDate = entity.Date;
}
};
_msgClearTimer = new System.Windows.Forms.Timer();
_msgClearTimer.Interval = 3000; //1秒
_msgClearTimer.Tick += (s, e) =>
{
msglbl.Text = string.Empty;
_msgClearTimer.Stop(); //用完停止
};
}
/// <summary>
/// 线程安全的UI更新,窗体已关闭/释放直接跳过,不抛异常
/// </summary>
private void SafeInvoke(Action action)
{
if (_isFormClosing || this.IsDisposed || !this.IsHandleCreated)
return;
if (this.InvokeRequired)
{
this.Invoke(action);
}
else
{
action();
}
}
void SegmentProductionAutoForm_FormClosing(object sender, FormClosingEventArgs e)
{
_isFormClosing = true;
if (_msgClearTimer != null)
{
_msgClearTimer.Stop();
_msgClearTimer.Dispose();
}
int waitMs = 2000; //最多等待2秒给后台线程退出
if (initTask != null && initTask.IsAlive)
initTask.Abort();
initTask.Join(waitMs);
if (uploadData != null && uploadData.IsAlive)
uploadData.Abort();
uploadData.Join(waitMs);
if (checkInStoreState != null && checkInStoreState.IsAlive)
checkInStoreState.Abort();
checkInStoreState.Join(waitMs);
}
public WeightDetails mCache;
protected override void OnLoad(EventArgs e)
@ -133,13 +176,19 @@ namespace ButcherFactory.SegmentProductionAuto_
SegmentProductionBL.DeleteBefore();
GetBasicInfo();
}
bool ok = false;
bool bind = false;
void GetBasicInfo()
{
int t = 0;
while (!ok)
{
//窗口已经关闭,直接退出线程
if (_isFormClosing || this.IsDisposed)
return;
t++;
try
{
var changed = BaseInfoSyncRpc.SyncGoodsByTag(ApplyClient.分割品);
@ -149,14 +198,13 @@ namespace ButcherFactory.SegmentProductionAuto_
ok = true;
if (changed || !bind)
BindBasicInfo();
this.Invoke(new Action(() =>
SafeInvoke(() =>
{
msglbl.Text = string.Empty;
}));
}) ;
}
catch (Exception ex)
{
if (!bind)
{
BindBasicInfo();
@ -164,13 +212,28 @@ namespace ButcherFactory.SegmentProductionAuto_
}
var msg = ex.Message ?? string.Empty;
msglbl.Text = "ERROR:" + msg;
SafeInvoke(() =>
{
msglbl.Text = "ERROR:" + msg;
_msgClearTimer.Stop();
_msgClearTimer.Start();
}) ;
LogUtil.WriteErrorFile(msg, "分割品车间称重计数");
if (t >= 3)
{
ok = true;
}
}
//延时,每次循环前检查是否要退出
Thread.Sleep(500);
if (_isFormClosing || this.IsDisposed)
return;
}
}
void BindBasicInfo()
{
this.BeginInvoke(new Action(() =>
@ -491,7 +554,7 @@ namespace ButcherFactory.SegmentProductionAuto_
else
template = "SegmentProductionPrint1.html";
}
NotAuto.SegmentProductionPrint.Print(entity, batchDate, template);
NotAuto.SegmentProductionPrint.Print(entity, scDateValue, template);
var log = new SegmentLog(entity.BarCode, "打印");
log.Message = string.Format("存货名称:{0} 重量:{1:#0.###}", entity.Goods_Name, entity.Weight);
SegmentProductionBL.InsertLog(log);
@ -564,11 +627,11 @@ namespace ButcherFactory.SegmentProductionAuto_
{
var entity = obj as SegmentProduction;
var list = SegmentProductionBL.GetProductTask(batchDate ?? DateTime.Today, entity);
this.Invoke(new Action(() =>
SafeInvoke(() =>
{
taskDataGrid.DataSource = list;
taskDataGrid.Refresh();
}));
} );
}
List<ColorButton> codeButtons = new List<ColorButton>(0);
@ -617,6 +680,9 @@ namespace ButcherFactory.SegmentProductionAuto_
{
while (true)
{
if (_isFormClosing || this.IsDisposed)
return;
try
{
if (netStateWatch1.NetState)
@ -624,25 +690,31 @@ namespace ButcherFactory.SegmentProductionAuto_
var msg = SegmentProductionBL.UploadSegmentInfo(true);
if (!string.IsNullOrEmpty(msg) && msg.EndsWith("重复上传"))
{
this.Invoke(new Action(() =>
SafeInvoke(() =>
{
MessageBox.Show(msg + "请检查原因!");
}));
} );
}
}
}
catch
{
}
Thread.Sleep(2000);
if (_isFormClosing || this.IsDisposed)
return;
}
}
private void CheckInStored()
{
while (true)
{
if (_isFormClosing || this.IsDisposed)
return;
try
{
if (netStateWatch1.NetState)
@ -660,14 +732,12 @@ namespace ButcherFactory.SegmentProductionAuto_
if (tag.Any())
{
SegmentProductionBL.SetInStored(tag.Select(x => x.ID).ToList());
this.Invoke(new Action(() =>
SafeInvoke(() =>
{
var groupByTotal = tag.GroupBy(x => x.TotalCode_ID);
foreach (var item2 in groupByTotal)
{
var d = item2.FirstOrDefault();
//鲜品不删除总码
if (d.GoodsType == 0)
{
if (_freshPanel != null)
@ -692,7 +762,7 @@ namespace ButcherFactory.SegmentProductionAuto_
}
continue;
}
else if (d.GoodsType == 1 && d.NoTotalCode)//暂存区不删除总码
else if (d.GoodsType == 1 && d.NoTotalCode)
{
if (_stayPanel != null)
{
@ -729,28 +799,30 @@ namespace ButcherFactory.SegmentProductionAuto_
_totalCode = null;
}
}
foreach (var item in tag)
historyList.Remove(item);
}));
} );
}
}
}
}
catch (Exception ex)
{
this.Invoke(new Action(() =>
SafeInvoke(() =>
{
var msg = ex.Message ?? string.Empty;
msglbl.Text = "ERROR:" + msg;
LogUtil.WriteErrorFile(msg, "分割品车间称重计数");
}));
} );
}
Thread.Sleep(5000);
if (_isFormClosing || this.IsDisposed)
return;
}
}
private void closeBtn_Click(object sender, EventArgs e)
{
var unSyncCount = SegmentProductionBL.GetUnSyncCount();
@ -1086,8 +1158,7 @@ namespace ButcherFactory.SegmentProductionAuto_
}
private void butcherDateBox_MouseClick(object sender, MouseEventArgs e)
{
var simpleLbl = sender as Label;
{
var cs = new CalendarSelecter();
if (cs.ShowDialog() == true)
{
@ -1095,5 +1166,29 @@ namespace ButcherFactory.SegmentProductionAuto_
butcherDateBox.Text = butcherDate.ToString("yyyy-MM-dd");
}
}
private void scDateBox_MouseClick(object sender, MouseEventArgs e)
{
var cs = new CalendarSelecter();
if (cs.ShowDialog() == true)
{
scDateValue = cs.Result;
scDate .Text = scDateValue.ToString("yyyy-MM-dd");
}
}
private void flowLayoutPanel2_Paint(object sender, PaintEventArgs e)
{
}
private void label3_Click(object sender, EventArgs e)
{
}
private void scDate_Click(object sender, EventArgs e)
{
}
}
}

Loading…
Cancel
Save