diff --git a/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.Designer.cs b/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.Designer.cs index d5282f3..83339e8 100644 --- a/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.Designer.cs +++ b/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.Designer.cs @@ -1,34 +1,33 @@ -namespace ButcherFactory.SegmentProductionAuto_ -{ - partial class SegmentProductionAutoForm - { - /// - /// 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() - { - this.components = new System.ComponentModel.Container(); +namespace ButcherFactory.SegmentProductionAuto_ +{ + partial class SegmentProductionAutoForm + { + /// + /// 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.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(); @@ -64,16 +63,9 @@ this.groupBox1 = new System.Windows.Forms.GroupBox(); this.flowLayoutPanel4 = new System.Windows.Forms.FlowLayoutPanel(); this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel(); - this.timer1 = new System.Windows.Forms.Timer(this.components); - this.serialPort1 = new System.IO.Ports.SerialPort(this.components); - this.weightSwitch = new ButcherFactory.Controls.ColorButton(); - this.zeroBtn = new ButcherFactory.Controls.ColorButton(); - this.roundPanel2 = new ButcherFactory.Controls.RoundPanel(this.components); - this.labelStable = new System.Windows.Forms.Label(); - this.labelZero = new System.Windows.Forms.Label(); - this.lblChengZhong = 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(); @@ -91,7 +83,6 @@ this.splitContainer2.Panel2.SuspendLayout(); this.splitContainer2.SuspendLayout(); this.groupBox1.SuspendLayout(); - this.roundPanel2.SuspendLayout(); this.SuspendLayout(); // // uLabel3 @@ -99,19 +90,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(71, 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, 4, 4, 4); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Padding = new System.Windows.Forms.Padding(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; // @@ -137,25 +130,29 @@ 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, 4, 4, 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; 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 // this.T_Item.DataPropertyName = "Item"; this.T_Item.HeaderText = "项目"; + this.T_Item.MinimumWidth = 6; this.T_Item.Name = "T_Item"; this.T_Item.ReadOnly = true; + this.T_Item.Width = 125; // // T_Need // @@ -164,6 +161,7 @@ dataGridViewCellStyle3.Format = "#0.######"; this.T_Need.DefaultCellStyle = dataGridViewCellStyle3; this.T_Need.HeaderText = "订货"; + this.T_Need.MinimumWidth = 6; this.T_Need.Name = "T_Need"; this.T_Need.ReadOnly = true; // @@ -174,6 +172,7 @@ dataGridViewCellStyle4.Format = "#0.######"; this.T_Done.DefaultCellStyle = dataGridViewCellStyle4; this.T_Done.HeaderText = "完工"; + this.T_Done.MinimumWidth = 6; this.T_Done.Name = "T_Done"; this.T_Done.ReadOnly = true; // @@ -184,6 +183,7 @@ dataGridViewCellStyle5.Format = "#0.######"; this.T_Last.DefaultCellStyle = dataGridViewCellStyle5; this.T_Last.HeaderText = "剩余"; + this.T_Last.MinimumWidth = 6; this.T_Last.Name = "T_Last"; this.T_Last.ReadOnly = true; // @@ -193,9 +193,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(71, 16); + this.GoodsLabel.Size = new System.Drawing.Size(89, 20); this.GoodsLabel.TabIndex = 1; this.GoodsLabel.Text = "存货名称"; // @@ -206,14 +207,12 @@ 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, 4, 4, 4); this.splitContainer1.Name = "splitContainer1"; this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; // // splitContainer1.Panel1 // - this.splitContainer1.Panel1.Controls.Add(this.weightSwitch); - this.splitContainer1.Panel1.Controls.Add(this.zeroBtn); - this.splitContainer1.Panel1.Controls.Add(this.roundPanel2); this.splitContainer1.Panel1.Controls.Add(this.butcherDateBox); this.splitContainer1.Panel1.Controls.Add(this.label3); this.splitContainer1.Panel1.Controls.Add(this.numberInput); @@ -223,6 +222,7 @@ this.splitContainer1.Panel1.Controls.Add(this.logBtn); this.splitContainer1.Panel1.Controls.Add(this.msglbl); this.splitContainer1.Panel1.Controls.Add(this.closeBtn); + this.splitContainer1.Panel1.Controls.Add(this.uWeightControl1); this.splitContainer1.Panel1.Controls.Add(this.barPrintCheck); this.splitContainer1.Panel1.Controls.Add(this.uTimerLabel1); this.splitContainer1.Panel1.Controls.Add(this.productBatchSelect); @@ -234,8 +234,9 @@ // splitContainer1.Panel2 // this.splitContainer1.Panel2.Controls.Add(this.splitContainer2); - this.splitContainer1.Size = new System.Drawing.Size(1226, 704); - this.splitContainer1.SplitterDistance = 87; + this.splitContainer1.Size = new System.Drawing.Size(1635, 880); + this.splitContainer1.SplitterDistance = 100; + this.splitContainer1.SplitterWidth = 5; this.splitContainer1.TabIndex = 1; // // butcherDateBox @@ -243,9 +244,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(669, 19); + 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); @@ -254,18 +256,20 @@ // this.label3.AutoSize = true; this.label3.Font = new System.Drawing.Font("宋体", 15F); - this.label3.Location = new System.Drawing.Point(400, 21); + this.label3.Location = new System.Drawing.Point(533, 26); + 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(137, 25); this.label3.TabIndex = 30; this.label3.Text = "屠宰日期:"; // // 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(907, 59); + this.numberInput.Margin = new System.Windows.Forms.Padding(4, 4, 4, 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); @@ -274,18 +278,20 @@ // this.label2.AutoSize = true; this.label2.Font = new System.Drawing.Font("宋体", 15F); - this.label2.Location = new System.Drawing.Point(623, 51); + this.label2.Location = new System.Drawing.Point(831, 64); + 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(87, 25); 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(669, 59); + this.statisticNumberBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 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); // @@ -293,9 +299,10 @@ // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("宋体", 15F); - this.label1.Location = new System.Drawing.Point(400, 51); + this.label1.Location = new System.Drawing.Point(533, 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(137, 25); this.label1.TabIndex = 26; this.label1.Text = "统计数量:"; // @@ -303,9 +310,10 @@ // 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(101, 12); + this.msglbl.Size = new System.Drawing.Size(127, 15); this.msglbl.TabIndex = 24; this.msglbl.Text = ""; // @@ -313,9 +321,10 @@ // 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, 4, 4, 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; @@ -327,9 +336,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(1084, 53); + this.uTimerLabel1.Location = new System.Drawing.Point(1446, 66); + this.uTimerLabel1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.uTimerLabel1.Name = "uTimerLabel1"; - this.uTimerLabel1.Size = new System.Drawing.Size(135, 16); + this.uTimerLabel1.Size = new System.Drawing.Size(169, 20); this.uTimerLabel1.TabIndex = 14; this.uTimerLabel1.Text = "4月21日 16:32:19"; // @@ -338,9 +348,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(903, 47); + this.productBatchSelect.Location = new System.Drawing.Point(1205, 59); + this.productBatchSelect.Margin = new System.Windows.Forms.Padding(4, 4, 4, 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 @@ -348,9 +359,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(903, 11); + this.workUnitSelect.Location = new System.Drawing.Point(1205, 14); + this.workUnitSelect.Margin = new System.Windows.Forms.Padding(4, 4, 4, 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 @@ -359,9 +371,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(802, 14); + this.uLabel1.Location = new System.Drawing.Point(1070, 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 = "工作单元:"; // @@ -371,18 +384,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(802, 50); + this.uLabel2.Location = new System.Drawing.Point(1070, 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.Location = new System.Drawing.Point(389, 2); + this.netStateWatch1.Margin = new System.Windows.Forms.Padding(5, 5, 5, 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 @@ -391,6 +406,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, 4, 4, 4); this.splitContainer2.Name = "splitContainer2"; // // splitContainer2.Panel1 @@ -409,8 +425,9 @@ 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(1226, 613); - this.splitContainer2.SplitterDistance = 761; + this.splitContainer2.Size = new System.Drawing.Size(1635, 775); + this.splitContainer2.SplitterDistance = 1022; + this.splitContainer2.SplitterWidth = 5; this.splitContainer2.TabIndex = 0; // // flowLayoutPanel2 @@ -420,9 +437,10 @@ | 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, 4, 4, 4); this.flowLayoutPanel2.Name = "flowLayoutPanel2"; - this.flowLayoutPanel2.Size = new System.Drawing.Size(757, 536); + this.flowLayoutPanel2.Size = new System.Drawing.Size(1037, 679); this.flowLayoutPanel2.TabIndex = 24; // // flowLayoutPanel1 @@ -431,8 +449,9 @@ | 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, 4, 4, 4); this.flowLayoutPanel1.Name = "flowLayoutPanel1"; - this.flowLayoutPanel1.Size = new System.Drawing.Size(640, 70); + this.flowLayoutPanel1.Size = new System.Drawing.Size(881, 87); this.flowLayoutPanel1.TabIndex = 22; // // groupBox1 @@ -442,10 +461,11 @@ 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.Location = new System.Drawing.Point(11, 278); + this.groupBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Padding = new System.Windows.Forms.Padding(5); - this.groupBox1.Size = new System.Drawing.Size(447, 381); + this.groupBox1.Padding = new System.Windows.Forms.Padding(7, 6, 7, 6); + this.groupBox1.Size = new System.Drawing.Size(596, 485); this.groupBox1.TabIndex = 5; this.groupBox1.TabStop = false; // @@ -455,9 +475,10 @@ | 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.Location = new System.Drawing.Point(7, 112); + this.flowLayoutPanel4.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.flowLayoutPanel4.Name = "flowLayoutPanel4"; - this.flowLayoutPanel4.Size = new System.Drawing.Size(437, 286); + this.flowLayoutPanel4.Size = new System.Drawing.Size(583, 367); this.flowLayoutPanel4.TabIndex = 5; // // flowLayoutPanel3 @@ -465,114 +486,24 @@ 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.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(437, 68); + this.flowLayoutPanel3.Size = new System.Drawing.Size(582, 85); this.flowLayoutPanel3.TabIndex = 4; this.flowLayoutPanel3.WrapContents = false; // - // timer1 - // - this.timer1.Interval = 50; - this.timer1.Tick += new System.EventHandler(this.timer1_Tick); - // - // serialPort1 - // - this.serialPort1.PortName = "COM3"; - // - // weightSwitch - // - this.weightSwitch.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(77)))), ((int)(((byte)(135)))), ((int)(((byte)(245))))); - this.weightSwitch.Font = new System.Drawing.Font("宋体", 10F); - this.weightSwitch.ForeColor = System.Drawing.Color.White; - this.weightSwitch.Location = new System.Drawing.Point(173, 43); - this.weightSwitch.Name = "weightSwitch"; - this.weightSwitch.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106))))); - this.weightSwitch.Size = new System.Drawing.Size(90, 32); - this.weightSwitch.StateHold = true; - this.weightSwitch.TabIndex = 38; - this.weightSwitch.Text = "启用称重"; - this.weightSwitch.UseVisualStyleBackColor = false; - this.weightSwitch.Click += new System.EventHandler(this.weightSwitch_Click); - // - // zeroBtn - // - this.zeroBtn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(144)))), ((int)(((byte)(98)))), ((int)(((byte)(222))))); - this.zeroBtn.Font = new System.Drawing.Font("宋体", 10F); - this.zeroBtn.ForeColor = System.Drawing.Color.White; - this.zeroBtn.Location = new System.Drawing.Point(173, 4); - this.zeroBtn.Name = "zeroBtn"; - this.zeroBtn.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(158)))), ((int)(((byte)(234)))), ((int)(((byte)(106))))); - this.zeroBtn.Size = new System.Drawing.Size(90, 32); - this.zeroBtn.TabIndex = 37; - this.zeroBtn.Text = "归零"; - this.zeroBtn.UseVisualStyleBackColor = false; - this.zeroBtn.Click += new System.EventHandler(this.zeroBtn_Click); - // - // roundPanel2 - // - this.roundPanel2._setRoundRadius = 15; - this.roundPanel2.BackColor = System.Drawing.Color.Black; - this.roundPanel2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.roundPanel2.Controls.Add(this.labelStable); - this.roundPanel2.Controls.Add(this.labelZero); - this.roundPanel2.Controls.Add(this.lblChengZhong); - this.roundPanel2.Location = new System.Drawing.Point(6, 3); - this.roundPanel2.Margin = new System.Windows.Forms.Padding(0); - this.roundPanel2.Name = "roundPanel2"; - this.roundPanel2.Size = new System.Drawing.Size(162, 74); - this.roundPanel2.TabIndex = 36; - // - // labelStable - // - this.labelStable.AutoSize = true; - this.labelStable.BackColor = System.Drawing.Color.White; - this.labelStable.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.labelStable.Font = new System.Drawing.Font("微软雅黑", 9F); - this.labelStable.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.labelStable.Location = new System.Drawing.Point(119, 1); - this.labelStable.Name = "labelStable"; - this.labelStable.Size = new System.Drawing.Size(17, 19); - this.labelStable.TabIndex = 13; - this.labelStable.Text = "S"; - this.labelStable.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // labelZero - // - this.labelZero.AutoSize = true; - this.labelZero.BackColor = System.Drawing.Color.White; - this.labelZero.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.labelZero.Font = new System.Drawing.Font("微软雅黑", 9F); - this.labelZero.Location = new System.Drawing.Point(138, 1); - this.labelZero.Name = "labelZero"; - this.labelZero.Size = new System.Drawing.Size(17, 19); - this.labelZero.TabIndex = 12; - this.labelZero.Text = "0"; - this.labelZero.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // lblChengZhong - // - this.lblChengZhong.AutoSize = true; - this.lblChengZhong.Font = new System.Drawing.Font("宋体", 25F); - this.lblChengZhong.ForeColor = System.Drawing.Color.Red; - this.lblChengZhong.Location = new System.Drawing.Point(5, 19); - this.lblChengZhong.Margin = new System.Windows.Forms.Padding(0); - this.lblChengZhong.Name = "lblChengZhong"; - this.lblChengZhong.Size = new System.Drawing.Size(83, 34); - this.lblChengZhong.TabIndex = 0; - this.lblChengZhong.Text = "0.00"; - // // 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(680, 4); + this.logBtn.Location = new System.Drawing.Point(908, 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(101, 41); + this.logBtn.Size = new System.Drawing.Size(135, 51); this.logBtn.TabIndex = 25; this.logBtn.Text = "日志"; this.logBtn.UseVisualStyleBackColor = false; @@ -584,25 +515,37 @@ 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(1109, 7); + this.closeBtn.Location = new System.Drawing.Point(1480, 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(111, 41); + 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(645, 3); + this.goodsSetBtn.Location = new System.Drawing.Point(888, 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(111, 62); + this.goodsSetBtn.Size = new System.Drawing.Size(148, 78); this.goodsSetBtn.TabIndex = 19; this.goodsSetBtn.Text = "产品设置"; this.goodsSetBtn.UseVisualStyleBackColor = false; @@ -613,10 +556,11 @@ 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; @@ -628,10 +572,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(13, 124); + this.viewTaskBtn.Location = new System.Drawing.Point(-9, 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; @@ -642,10 +587,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; @@ -657,10 +603,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(178, 124); + this.deleteBtn.Location = new System.Drawing.Point(211, 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; @@ -672,10 +619,11 @@ 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; @@ -684,15 +632,15 @@ // // 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(1226, 704); + this.ClientSize = new System.Drawing.Size(1635, 880); this.Controls.Add(this.splitContainer1); + this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Name = "SegmentProductionAutoForm"; this.Text = "分割品车间称重计数"; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; - this.Load += new System.EventHandler(this.SegmentProductionAutoForm_Load); this.groupBox2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.taskDataGrid)).EndInit(); this.splitContainer1.Panel1.ResumeLayout(false); @@ -707,37 +655,36 @@ this.splitContainer2.ResumeLayout(false); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); - this.roundPanel2.ResumeLayout(false); - this.roundPanel2.PerformLayout(); this.ResumeLayout(false); - } - - #endregion - - private WinFormControl.ULabel uLabel3; - private System.Windows.Forms.GroupBox groupBox2; - private WinFormControl.UDataGridView taskDataGrid; - private System.Windows.Forms.DataGridViewTextBoxColumn T_Item; - private System.Windows.Forms.DataGridViewTextBoxColumn T_Need; - private System.Windows.Forms.DataGridViewTextBoxColumn T_Done; - private System.Windows.Forms.DataGridViewTextBoxColumn T_Last; - private WinFormControl.ULabel GoodsLabel; - private System.Windows.Forms.SplitContainer splitContainer1; - private WinFormControl.UTimerLabel uTimerLabel1; - private System.Windows.Forms.ComboBox productBatchSelect; - private System.Windows.Forms.ComboBox workUnitSelect; - private WinFormControl.ULabel uLabel1; - private WinFormControl.ULabel uLabel2; - private WinFormControl.NetStateWatch netStateWatch1; + } + + #endregion + + private WinFormControl.ULabel uLabel3; + private System.Windows.Forms.GroupBox groupBox2; + private WinFormControl.UDataGridView taskDataGrid; + private System.Windows.Forms.DataGridViewTextBoxColumn T_Item; + private System.Windows.Forms.DataGridViewTextBoxColumn T_Need; + private System.Windows.Forms.DataGridViewTextBoxColumn T_Done; + private System.Windows.Forms.DataGridViewTextBoxColumn T_Last; + private WinFormControl.ULabel GoodsLabel; + private System.Windows.Forms.SplitContainer splitContainer1; + private WinFormControl.UTimerLabel uTimerLabel1; + private System.Windows.Forms.ComboBox productBatchSelect; + private System.Windows.Forms.ComboBox workUnitSelect; + private WinFormControl.ULabel uLabel1; + private WinFormControl.ULabel uLabel2; + private WinFormControl.NetStateWatch netStateWatch1; private System.Windows.Forms.SplitContainer splitContainer2; - private System.Windows.Forms.GroupBox groupBox1; - private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2; - private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; - private Controls.ColorButton rePrintBtn; - private Controls.ColorButton closeBtn; - private Controls.ColorButton goodsSetBtn; - private Controls.ColorButton deleteBtn; + private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + private Controls.WeightControl uWeightControl1; + private Controls.ColorButton rePrintBtn; + private Controls.ColorButton closeBtn; + private Controls.ColorButton goodsSetBtn; + private Controls.ColorButton deleteBtn; private System.Windows.Forms.Label msglbl; private System.Windows.Forms.CheckBox barPrintCheck; private Controls.ColorButton logBtn; @@ -752,13 +699,5 @@ private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel4; private System.Windows.Forms.Label label3; private WinFormControl.ULabel butcherDateBox; - private Controls.ColorButton weightSwitch; - private Controls.ColorButton zeroBtn; - private Controls.RoundPanel roundPanel2; - private System.Windows.Forms.Label lblChengZhong; - private System.Windows.Forms.Timer timer1; - private System.IO.Ports.SerialPort serialPort1; - private System.Windows.Forms.Label labelStable; - private System.Windows.Forms.Label labelZero; - } + } } \ No newline at end of file diff --git a/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs b/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs index 3beefe7..2d8f343 100644 --- a/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs +++ b/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.cs @@ -1,105 +1,102 @@ -using ButcherFactory.BO; -using ButcherFactory.BO.LocalBL; -using ButcherFactory.BO.Rpcs; -using ButcherFactory.BO.Utils; -using ButcherFactory.Dialogs; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using System.Windows.Forms; -using WinFormControl; -using ButcherFactory.Utils; -using NotAuto = ButcherFactory.SegmentProduction_; -using ButcherFactory.Controls; -using System.Runtime.InteropServices; - -namespace ButcherFactory.SegmentProductionAuto_ -{ - public partial class SegmentProductionAutoForm : Form, IWithRoleForm - { - public List RoleName - { - //get { return new List { (short)设备类别.分割生产自动化 }; } - get { return new List { (short)设备类别.分割生产 }; } - } - - public Form Generate() - { - return this; - } - - Thread uploadData; - Thread checkInStoreState; - Thread initTask; +using ButcherFactory.BO; +using ButcherFactory.BO.LocalBL; +using ButcherFactory.BO.Rpcs; +using ButcherFactory.BO.Utils; +using ButcherFactory.Dialogs; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Windows.Forms; +using WinFormControl; +using ButcherFactory.Utils; +using NotAuto = ButcherFactory.SegmentProduction_; +using ButcherFactory.Controls; + +namespace ButcherFactory.SegmentProductionAuto_ +{ + public partial class SegmentProductionAutoForm : Form, IWithRoleForm + { + public List RoleName + { + //get { return new List { (short)设备类别.分割生产自动化 }; } + get { return new List { (short)设备类别.分割生产 }; } + } + + public Form Generate() + { + return this; + } + + Thread uploadData; + Thread checkInStoreState; + Thread initTask; BindingList historyList; BindingList deleteList; - BindingList allCode; - Dictionary> goodsSetDic; - long? batchID; - DateTime? batchDate; - DateTime butcherDate = DateTime.Today; - NotAuto.SegmentProductionFormConfig config; - List identityList; - List specialGoodsCodes; - public SegmentProductionAutoForm() - { - InitializeComponent(); - butcherDateBox.Text = butcherDate.ToString("yyyy-MM-dd"); + BindingList allCode; + Dictionary> goodsSetDic; + long? batchID; + DateTime? batchDate; + DateTime butcherDate = DateTime.Today; + NotAuto.SegmentProductionFormConfig config; + List identityList; + List specialGoodsCodes; + public SegmentProductionAutoForm() + { + InitializeComponent(); + butcherDateBox.Text = butcherDate.ToString("yyyy-MM-dd"); netStateWatch1.GetConnectState = () => LoginUtil.TestConnection(500); - this.FormClosing += SegmentProductionAutoForm_FormClosing; - workUnitSelect.SelectedIndexChanged += delegate - { - if (workUnitSelect.SelectedValue == null) - config.WorkUnitID = null; - else - config.WorkUnitID = (long)workUnitSelect.SelectedValue; - XmlUtil.SerializerObjToFile(config); - }; - productBatchSelect.SelectedIndexChanged += delegate - { - if (productBatchSelect.SelectedValue == null) - { - batchID = null; - batchDate = null; - } - else - { - var entity = productBatchSelect.SelectedItem as ProductBatch; - batchID = entity.ID; - batchDate = entity.Date; - } - }; + this.FormClosing += SegmentProductionAutoForm_FormClosing; + workUnitSelect.SelectedIndexChanged += delegate + { + if (workUnitSelect.SelectedValue == null) + config.WorkUnitID = null; + else + config.WorkUnitID = (long)workUnitSelect.SelectedValue; + XmlUtil.SerializerObjToFile(config); + }; + productBatchSelect.SelectedIndexChanged += delegate + { + if (productBatchSelect.SelectedValue == null) + { + batchID = null; + batchDate = null; + } + else + { + var entity = productBatchSelect.SelectedItem as ProductBatch; + batchID = entity.ID; + batchDate = entity.Date; + } + }; } void SegmentProductionAutoForm_FormClosing(object sender, FormClosingEventArgs e) - { + { if (initTask != null && initTask.IsAlive) initTask.Abort(); if (uploadData != null && uploadData.IsAlive) uploadData.Abort(); if (checkInStoreState != null && checkInStoreState.IsAlive) checkInStoreState.Abort(); - if (Utils.mPortOpened) - closePort(); } - public WeightDetails mCache; - - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - initTask = new Thread(LoadBind); - initTask.Start(); - - checkInStoreState = new Thread(CheckInStored); - checkInStoreState.Start(); - + public WeightDetails mCache; + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + initTask = new Thread(LoadBind); + initTask.Start(); + + checkInStoreState = new Thread(CheckInStored); + checkInStoreState.Start(); + uploadData = new Thread(UpLoadLocalData); uploadData.Start(); mCache = XmlUtil.DeserializeFromFile(); @@ -111,268 +108,252 @@ namespace ButcherFactory.SegmentProductionAuto_ var del = new List(); if (mCache.Cache == null) { - mCache.Cache = new Dictionary>(); + mCache.Cache = new Dictionary>(); } foreach (var item in mCache.Cache) { - if (item.Value == null || item.Value.Count == 0) - { - del.Add(item.Key); - } + if (item.Value == null || item.Value.Count == 0) + { + del.Add(item.Key); + } } foreach (var v in del) { - mCache.Cache.Remove(v); + mCache.Cache.Remove(v); } wDic = mCache.Cache; _freshTotalCode = SegmentProductionBL.InitFreshTotalCode(); _stayTotalCode = SegmentProductionBL.InitStayTotalCode(); identityList = SegmentProductionBL.GetGoodsIdentify(); + } + + void LoadBind() + { + BLUtil.DeleteLocalDb(); + SegmentProductionBL.DeleteBefore(); + GetBasicInfo(); + } - } - - void LoadBind() - { - BLUtil.DeleteLocalDb(); - SegmentProductionBL.DeleteBefore(); - GetBasicInfo(); - } - - bool ok = false; - bool bind = false; - void GetBasicInfo() - { - while (!ok) - { - try - { - var changed = BaseInfoSyncRpc.SyncGoodsByTag(ApplyClient.分割品); - changed = BaseInfoSyncRpc.SyncBaseInfo() || changed; - changed = BaseInfoSyncRpc.SyncProductBatch(1) || changed; - changed = BaseInfoSyncRpc.SyncGoodsIdentify(out identityList) || changed; - ok = true; - if (changed || !bind) - BindBasicInfo(); - this.Invoke(new Action(() => - { - msglbl.Text = string.Empty; - })); - } - catch (Exception ex) - { - - if (!bind) - { - BindBasicInfo(); - bind = true; + bool ok = false; + bool bind = false; + void GetBasicInfo() + { + while (!ok) + { + try + { + var changed = BaseInfoSyncRpc.SyncGoodsByTag(ApplyClient.分割品); + changed = BaseInfoSyncRpc.SyncBaseInfo() || changed; + changed = BaseInfoSyncRpc.SyncProductBatch(1) || changed; + changed = BaseInfoSyncRpc.SyncGoodsIdentify(out identityList) || changed; + ok = true; + if (changed || !bind) + BindBasicInfo(); + this.Invoke(new Action(() => + { + msglbl.Text = string.Empty; + })); + } + catch (Exception ex) + { + + if (!bind) + { + BindBasicInfo(); + bind = true; } var msg = ex.Message ?? string.Empty; msglbl.Text = "ERROR:" + msg; - LogUtil.WriteErrorFile(msg, "分割品车间称重计数"); - } - Thread.Sleep(500); - } - } - - void BindBasicInfo() + LogUtil.WriteErrorFile(msg, "分割品车间称重计数"); + } + Thread.Sleep(500); + } + } + + void BindBasicInfo() { - this.BeginInvoke(new Action(() => - { - productBatchSelect.EBindComboBox(null, 6, "Date"); - config = XmlUtil.DeserializeFromFile(); - var m = config.WorkUnitID; - workUnitSelect.EBindComboBox(x => x.ID == m, top: 100); - - BindGoods(); - BindGrid(); - })); - } - - void BindGoods() - { - goodsSetDic = FormClientGoodsSetBL.GetSelectedDetail(); - flowLayoutPanel1.Controls.Clear(); - flowLayoutPanel2.Controls.Clear(); - foreach (var item in goodsSetDic) - { - var btn = new ColorButton() { Width = 100, Height = 62, Text = item.Key, Font = new Font("宋体", 15), Margin = new Padding(15, 3, 15, 0), EnableGroup = true }; - btn.Click += GroupGoodsSetClick; - flowLayoutPanel1.Controls.Add(btn); - } - } - + this.BeginInvoke(new Action(() => + { + productBatchSelect.EBindComboBox(null, 6, "Date"); + config = XmlUtil.DeserializeFromFile(); + var m = config.WorkUnitID; + workUnitSelect.EBindComboBox(x => x.ID == m, top: 100); + + BindGoods(); + BindGrid(); + })); + } + + void BindGoods() + { + goodsSetDic = FormClientGoodsSetBL.GetSelectedDetail(); + flowLayoutPanel1.Controls.Clear(); + flowLayoutPanel2.Controls.Clear(); + foreach (var item in goodsSetDic) + { + var btn = new ColorButton() { Width = 100, Height = 62, Text = item.Key, Font = new Font("宋体", 15), Margin = new Padding(15, 3, 15, 0), EnableGroup = true }; + btn.Click += GroupGoodsSetClick; + flowLayoutPanel1.Controls.Add(btn); + } + } + Color goodsColor = Color.FromArgb(250, 120, 24); string groupKey = string.Empty; public Dictionary> wDic = new Dictionary>(); void GroupGoodsSetClick(object sender, EventArgs e) { - flowLayoutPanel2.Controls.Clear(); - var groupBtn = sender as ColorButton; - groupKey = groupBtn.Text; - var arr = goodsSetDic[groupKey]; - foreach (var item in arr) + flowLayoutPanel2.Controls.Clear(); + var groupBtn = sender as ColorButton; + groupKey = groupBtn.Text; + var arr = goodsSetDic[groupKey]; + foreach (var item in arr) + { + var bTag = new ButtonTag(); + if ((item.EachNumber ?? 0) > 0) { - var bTag = new ButtonTag(); - if ((item.EachNumber ?? 0) > 0) + bTag.Label.MaxCount = item.EachNumber.Value; + if (wDic.ContainsKey(item.Goods_ID)) + { + var l = wDic[item.Goods_ID]; + bTag.Label.Text = string.Format("{0}-{1}", item.EachNumber.Value, l.Count); + } + else + { + bTag.Label.Text = string.Format("{0}-0", item.EachNumber.Value); + } + ClientGoodsSet_Detail g = item; + bTag.Button.Click += delegate + { + if (batchID == null) { - bTag.Label.MaxCount = item.EachNumber.Value; - if (wDic.ContainsKey(item.Goods_ID)) - { - var l = wDic[item.Goods_ID]; - bTag.Label.Text = string.Format("{0}-{1}", item.EachNumber.Value, l.Count); - } - else - { - bTag.Label.Text = string.Format("{0}-0", item.EachNumber.Value); - } - ClientGoodsSet_Detail g = item; - bTag.Button.Click += delegate - { - if (batchID == null) { - MessageBox.Show("请先选择批次!"); - return; - } - if (g.GoodsType == 1 && !g.NoTotalCode) - { - if (_totalCode == null || _codePanel == null) - { - MessageBox.Show("请先选择总码!"); - return; - } - } - if (!status.StableStatus) - { - MessageBox.Show("称重稳定后再操作!"); - return; - } - decimal weight = 0; - if (!decimal.TryParse(lblChengZhong.Text, out weight)) { - MessageBox.Show("重量错误,是否未归零!"); - return; - } -//#if DEBUG -// if (weight == 0) -// weight = (g.StandardWeightLow ?? 4.0m) + 0.1m; -//#endif - if (weight <= 0) - { - //weight = 10; - MessageBox.Show("重量必须大于0"); - return; - } - if (g.StandardWeight.HasValue) - { - if (weight < (g.StandardWeightLow ?? 0) || weight > (g.StandardWeightUp ?? 0)) - { - MessageBox.Show(string.Format("重量必须在{0:#0.######}-{1:#0.######}之间", g.StandardWeightLow, g.StandardWeightUp)); - return; - } - weight = g.StandardWeight.Value; - } - List l = null; - if (wDic.ContainsKey(g.Goods_ID)) - { - l = wDic[g.Goods_ID]; - if (l.Count >= g.EachNumber.Value) - { - l.Clear(); - } - l.Add(weight); - } - else - { - wDic.Add(g.Goods_ID, l = new List() { weight }); - } - bTag.Label.MinCount = l.Count(); - if (l.Count >= g.EachNumber.Value) - { - weight = l.Sum(x => x); - InsertSegmentProduction(g, weight); - } - mCache.Cache = wDic; - XmlUtil.SerializerObjToFile(mCache); - }; - - bTag.Label.Click += delegate - { - List l = new List(0); - if (wDic.ContainsKey(g.Goods_ID)) - { - l = wDic[g.Goods_ID]; - } - new WeightView(this, bTag).ShowDialog(); - }; + MessageBox.Show("请先选择批次!"); + return; } - else + if (g.GoodsType == 1 && !g.NoTotalCode) { - bTag.Label.Visible = false; - bTag.Button.Click += GoodsBtnClick; + if (_totalCode == null || _codePanel == null) + { + MessageBox.Show("请先选择总码!"); + return; + } } - - bTag.Button.Tag = item; - if (item.SelectedIdentify != null) { - bTag.identityButton.Text = item.SelectedIdentify.Identify; + var weight = uWeightControl1.Weight; + //#if DEBUG + // if (weight == 0) + // weight = (g.StandardWeightLow ?? 4.0m) + 0.1m; + //#endif + if (weight <= 0) + { + //weight = 10; + MessageBox.Show("重量必须大于0"); + return; } - item.Identify = identityList.Where(x => x.Goods_ID == item.Goods_ID); - if (item.Identify.Any()) + if (g.StandardWeight.HasValue) { - bTag.identityButton.Click += delegate + if (weight < (g.StandardWeightLow ?? 0) || weight > (g.StandardWeightUp ?? 0)) { - new IdentifySelectionDialog(item).ShowDialog(); - if (item.SelectedIdentify != null) - { - bTag.identityButton.Text = item.SelectedIdentify.Identify; - } - else { - bTag.identityButton.Text = "选择标识"; - } - }; + MessageBox.Show(string.Format("重量必须在{0:#0.######}-{1:#0.######}之间", g.StandardWeightLow, g.StandardWeightUp)); + return; + } + weight = g.StandardWeight.Value; } - else { - bTag.identityButton.Enabled = false; + List l = null; + if (wDic.ContainsKey(g.Goods_ID)) + { + l = wDic[g.Goods_ID]; + if (l.Count >= g.EachNumber.Value) + { + l.Clear(); + } + l.Add(weight); } - bTag.Button.Text = item.Goods_Name; - bTag.Button.Font = new Font("黑体", 12, FontStyle.Bold); - bTag.Button.BackColor = Color.Black; - bTag.Button.Margin = new Padding(10, 10, 10, 35); - bTag.Button.PlaySound = true; - bTag.Button.ForeColor = Color.White; - bTag.Button.Width = 140; - bTag.Button.Height = 90; - flowLayoutPanel2.Controls.Add(bTag); + else + { + wDic.Add(g.Goods_ID, l = new List() { weight }); + } + bTag.Label.MinCount = l.Count(); + if (l.Count >= g.EachNumber.Value) + { + weight = l.Sum(x => x); + InsertSegmentProduction(g, weight); + } + mCache.Cache = wDic; + XmlUtil.SerializerObjToFile(mCache); + }; + + bTag.Label.Click += delegate + { + List l = new List(0); + if (wDic.ContainsKey(g.Goods_ID)) + { + l = wDic[g.Goods_ID]; + } + new WeightView(this, bTag).ShowDialog(); + }; } - } - - void GoodsBtnClick(object sender, EventArgs e) - { - if (batchID == null) - throw new Exception("请先选择批次"); - var btn = sender as ColorButton; - var detail = btn.Tag as ClientGoodsSet_Detail; - if (!status.StableStatus) - { - MessageBox.Show("称重稳定后再操作!"); - return; - } - decimal weight = 0; - if (!decimal.TryParse(lblChengZhong.Text, out weight)) - { - MessageBox.Show("重量错误,是否未归零!"); - return; + else + { + bTag.Label.Visible = false; + bTag.Button.Click += GoodsBtnClick; + } + + bTag.Button.Tag = item; + if (item.SelectedIdentify != null) + { + bTag.identityButton.Text = item.SelectedIdentify.Identify; + } + item.Identify = identityList.Where(x => x.Goods_ID == item.Goods_ID); + if (item.Identify.Any()) + { + bTag.identityButton.Click += delegate + { + new IdentifySelectionDialog(item).ShowDialog(); + if (item.SelectedIdentify != null) + { + bTag.identityButton.Text = item.SelectedIdentify.Identify; + } + else + { + bTag.identityButton.Text = "选择标识"; + } + }; + } + else + { + bTag.identityButton.Enabled = false; + } + bTag.Button.Text = item.Goods_Name; + bTag.Button.Font = new Font("黑体", 15, FontStyle.Bold); + bTag.Button.BackColor = Color.Black; + bTag.Button.Margin = new Padding(20, 10, 20, 35); + bTag.Button.PlaySound = true; + bTag.Button.ForeColor = Color.White; + bTag.Button.Width = 140; + bTag.Button.Height = 90; + flowLayoutPanel2.Controls.Add(bTag); } + } + + void GoodsBtnClick(object sender, EventArgs e) + { + if (batchID == null) + throw new Exception("请先选择批次"); + var btn = sender as ColorButton; + var detail = btn.Tag as ClientGoodsSet_Detail; + var weight = uWeightControl1.Weight; //#if DEBUG // if (weight == 0) // weight = (detail.StandardWeightLow ?? 4.0m) + 0.1m; //#endif if (weight <= 0) - throw new Exception("重量必须大于0"); + throw new Exception("重量必须大于0"); if (detail.StandardWeight.HasValue) { - if (weight < (detail.StandardWeightLow ?? 0) || weight > (detail.StandardWeightUp ?? 0)) - throw new Exception(string.Format("重量必须在{0:#0.######}-{1:#0.######}之间", detail.StandardWeightLow, detail.StandardWeightUp)); - weight = detail.StandardWeight.Value; + if (weight < (detail.StandardWeightLow ?? 0) || weight > (detail.StandardWeightUp ?? 0)) + throw new Exception(string.Format("重量必须在{0:#0.######}-{1:#0.######}之间", detail.StandardWeightLow, detail.StandardWeightUp)); + weight = detail.StandardWeight.Value; } if (specialGoodsCodes.Contains(detail.Goods_Code)) { @@ -380,7 +361,7 @@ namespace ButcherFactory.SegmentProductionAuto_ if (dialog.ShowDialog() != DialogResult.OK) return; } - InsertSegmentProduction(detail, weight); + InsertSegmentProduction(detail, weight); } private void InsertSegmentProduction(ClientGoodsSet_Detail detail, decimal weight) @@ -531,111 +512,111 @@ namespace ButcherFactory.SegmentProductionAuto_ ColorButton _labelBt; private ColorButton initSegmentBt(SegmentProduction entity, ColorButton parent, TotalCode tCode) { - var bt = new ColorButton() { Text = entity.ShortCode }; - bt.Tag = entity; - bt.Width = 98; - bt.Height = 35; - bt.Font = new Font("黑体", 15, FontStyle.Bold); - bt.ForeColor = Color.Black; - bt.BackColor = System.Drawing.SystemColors.ButtonFace; - - bt.SelectedColor = Color.Cyan; - bt.Click += delegate - { - bt.Selected = !bt.Selected; - if (bt.Selected) - { - current = entity; - _labelBt = bt; - GoodsLabel.Text = entity.Goods_Name; - if (_codePanel != null) - { - _codePanel. Selected = false; - _codePanel. Invalidate(); - } - parent .Selected = true; - parent. Invalidate(); - _totalCode = tCode; - _codePanel = parent; - } - else - { - _labelBt = null; - current = null; - GoodsLabel.Text = ""; - } - foreach (var bt2 in segmentButtons) - { - if (bt2.Text != entity.ShortCode && bt2.Selected) - { - bt2.Selected = false; - bt2.Invalidate(); - } - } + var bt = new ColorButton() { Text = entity.ShortCode }; + bt.Tag = entity; + bt.Width = 98; + bt.Height = 35; + bt.Font = new Font("黑体", 15, FontStyle.Bold); + bt.ForeColor = Color.Black; + bt.BackColor = System.Drawing.SystemColors.ButtonFace; + + bt.SelectedColor = Color.Cyan; + bt.Click += delegate + { + bt.Selected = !bt.Selected; + if (bt.Selected) + { + current = entity; + _labelBt = bt; + GoodsLabel.Text = entity.Goods_Name; + if (_codePanel != null) + { + _codePanel.Selected = false; + _codePanel.Invalidate(); + } + parent.Selected = true; + parent.Invalidate(); + _totalCode = tCode; + _codePanel = parent; + } + else + { + _labelBt = null; + current = null; + GoodsLabel.Text = ""; + } + foreach (var bt2 in segmentButtons) + { + if (bt2.Text != entity.ShortCode && bt2.Selected) + { + bt2.Selected = false; + bt2.Invalidate(); + } + } - }; - segmentButtons.Add(bt); - return bt; + }; + segmentButtons.Add(bt); + return bt; } void RefreshTask(object obj) { - var entity = obj as SegmentProduction; - var list = SegmentProductionBL.GetProductTask(batchDate ?? DateTime.Today, entity); - this.Invoke(new Action(() => - { - taskDataGrid.DataSource = list; - taskDataGrid.Refresh(); - })); + var entity = obj as SegmentProduction; + var list = SegmentProductionBL.GetProductTask(batchDate ?? DateTime.Today, entity); + this.Invoke(new Action(() => + { + taskDataGrid.DataSource = list; + taskDataGrid.Refresh(); + })); } List codeButtons = new List(0); - List segmentButtons = new List(0); - - void BindGrid() - { + List segmentButtons = new List(0); + + void BindGrid() + { historyList = SegmentProductionBL.GetListByState(true); deleteList = SegmentProductionBL.GetInStoreList(); allCode = SegmentProductionBL.GetTotalCode(DateTime.Now); RefreshCodePanel(); - - var first = historyList.FirstOrDefault(); - if (first != null) - GoodsLabel.Text = first.Goods_Name; + + var first = historyList.FirstOrDefault(); + if (first != null) + GoodsLabel.Text = first.Goods_Name; } private void RefreshCodePanel() { - flowLayoutPanel3.Controls.Clear(); - codeButtons.Clear(); - flowLayoutPanel4.Controls.Clear(); - foreach (var item in allCode) + flowLayoutPanel3.Controls.Clear(); + codeButtons.Clear(); + flowLayoutPanel4.Controls.Clear(); + foreach (var item in allCode) + { + if (item.GoodsType == 0 || (item.GoodsType == 1 && item.NoTotalCode)) { - if (item.GoodsType == 0 || (item.GoodsType == 1 && item.NoTotalCode)) - { - } - else - { - if (deleteList.Contains(item.ID)) - { - continue; - } - } - - var n = new ColorButton(); - AddCodeButton(n, item); - - flowLayoutPanel3.Controls.Add(n); } - } - - void UpLoadLocalData() - { - while (true) - { - try + else + { + if (deleteList.Contains(item.ID)) + { + continue; + } + } + + var n = new ColorButton(); + AddCodeButton(n, item); + + flowLayoutPanel3.Controls.Add(n); + } + } + + void UpLoadLocalData() + { + while (true) + { + try { if (netStateWatch1.NetState) { @@ -647,156 +628,156 @@ namespace ButcherFactory.SegmentProductionAuto_ MessageBox.Show(msg + "请检查原因!"); })); } - } - } + } + } catch { - } - Thread.Sleep(2000); - } - } - - private void CheckInStored() - { - while (true) - { - try - { - if (netStateWatch1.NetState) - { - if (historyList!=null && historyList.Any()) + } + Thread.Sleep(2000); + } + } + + private void CheckInStored() + { + while (true) + { + try + { + if (netStateWatch1.NetState) + { + if (historyList != null && historyList.Any()) { - int c = 50; - if (historyList.Count() < 50) - { - c = historyList.Count; - } - var arr = historyList.Reverse().Take(c); - var inStored = SegmentProductionBL.GetInStoreState(arr.Select(x => x.BarCode).ToList()); - var tag = arr.Where(x => inStored.Contains(x.BarCode)); - if (tag.Any()) - { - SegmentProductionBL.SetInStored(tag.Select(x => x.ID).ToList()); - this.Invoke(new Action(() => + int c = 50; + if (historyList.Count() < 50) + { + c = historyList.Count; + } + var arr = historyList.Reverse().Take(c); + var inStored = SegmentProductionBL.GetInStoreState(arr.Select(x => x.BarCode).ToList()); + var tag = arr.Where(x => inStored.Contains(x.BarCode)); + if (tag.Any()) + { + SegmentProductionBL.SetInStored(tag.Select(x => x.ID).ToList()); + this.Invoke(new Action(() => { var groupByTotal = tag.GroupBy(x => x.TotalCode_ID); foreach (var item2 in groupByTotal) { - var d = item2.FirstOrDefault(); + var d = item2.FirstOrDefault(); //鲜品不删除总码 - if (d.GoodsType == 0) + if (d.GoodsType == 0) + { + if (_freshPanel != null) { - if (_freshPanel != null) + var list = new List(); + foreach (var t in item2) { - var list = new List(); - foreach (var t in item2) + foreach (ColorButton item in flowLayoutPanel4.Controls) { - foreach (ColorButton item in flowLayoutPanel4.Controls) + var tagItem = (SegmentProduction)item.Tag; + if (tagItem.BarCode == t.BarCode) { - var tagItem = (SegmentProduction)item.Tag; - if (tagItem.BarCode == t.BarCode) - { - list.Add(item); - break; - } + list.Add(item); + break; } } - foreach (var item in list) - { - flowLayoutPanel4.Controls.Remove(item); - } } - continue; + foreach (var item in list) + { + flowLayoutPanel4.Controls.Remove(item); + } } - else if (d.GoodsType == 1 && d.NoTotalCode)//暂存区不删除总码 + continue; + } + else if (d.GoodsType == 1 && d.NoTotalCode)//暂存区不删除总码 + { + if (_stayPanel != null) { - if (_stayPanel != null) + var list = new List(); + foreach (var t in item2) { - var list = new List(); - foreach (var t in item2) + foreach (ColorButton item in flowLayoutPanel4.Controls) { - foreach (ColorButton item in flowLayoutPanel4.Controls) + var tagItem = (SegmentProduction)item.Tag; + if (tagItem.BarCode == t.BarCode) { - var tagItem = (SegmentProduction)item.Tag; - if (tagItem.BarCode == t.BarCode) - { - list.Add(item); - break; - } + list.Add(item); + break; } } - foreach (var item in list) - { - flowLayoutPanel4.Controls.Remove(item); - } } - continue; - } - var f = codeButtons.FirstOrDefault(x => ((TotalCode)x.Tag).ID == item2.Key); - if (f != null) - { - flowLayoutPanel3.Controls.Remove(f); - codeButtons.Remove(f); - } - if (_codePanel != null && _totalCode.ID == item2.Key) - { - flowLayoutPanel4.Controls.Clear(); - _codePanel = null; - _totalCode = null; + foreach (var item in list) + { + flowLayoutPanel4.Controls.Remove(item); + } } - } - - foreach (var item in tag) + continue; + } + var f = codeButtons.FirstOrDefault(x => ((TotalCode)x.Tag).ID == item2.Key); + if (f != null) + { + flowLayoutPanel3.Controls.Remove(f); + codeButtons.Remove(f); + } + if (_codePanel != null && _totalCode.ID == item2.Key) + { + flowLayoutPanel4.Controls.Clear(); + _codePanel = null; + _totalCode = null; + } + } + + foreach (var item in tag) historyList.Remove(item); - - })); - } - } - } + + })); + } + } + } } catch (Exception ex) { this.Invoke(new Action(() => - { - var msg = ex.Message ?? string.Empty; - msglbl.Text = "ERROR:" + msg; - LogUtil.WriteErrorFile(msg, "分割品车间称重计数"); - })); - } - Thread.Sleep(5000); - } + { + var msg = ex.Message ?? string.Empty; + msglbl.Text = "ERROR:" + msg; + LogUtil.WriteErrorFile(msg, "分割品车间称重计数"); + })); + } + Thread.Sleep(5000); + } } private void closeBtn_Click(object sender, EventArgs e) { - var unSyncCount = SegmentProductionBL.GetUnSyncCount(); - bool close = true; - if (unSyncCount > 0) + var unSyncCount = SegmentProductionBL.GetUnSyncCount(); + bool close = true; + if (unSyncCount > 0) + { + if (MessageBox.Show(string.Format("{0}条数据等待上传,确认关闭?", unSyncCount), "关闭确认", MessageBoxButtons.OKCancel) != DialogResult.OK) { - if (MessageBox.Show(string.Format("{0}条数据等待上传,确认关闭?", unSyncCount), "关闭确认", MessageBoxButtons.OKCancel) != DialogResult.OK) - { - close = false; - } + close = false; } - Thread.Sleep(500); - if (close) - Close(); - } - - private void goodsSetBtn_Click(object sender, EventArgs e) - { - new ClientGoodsSetDialog().ShowDialog(); - BindGoods(); - } - - private void rePrintBtn_Click(object sender, EventArgs e) - { - if (barPrintCheck.Checked) - { - if (historyList.Count == 0) - throw new Exception("请先选择要补打的记录"); + } + Thread.Sleep(500); + if (close) + Close(); + } + + private void goodsSetBtn_Click(object sender, EventArgs e) + { + new ClientGoodsSetDialog().ShowDialog(); + BindGoods(); + } + + private void rePrintBtn_Click(object sender, EventArgs e) + { + if (barPrintCheck.Checked) + { + if (historyList.Count == 0) + throw new Exception("请先选择要补打的记录"); SegmentProduction item; if (current != null) @@ -804,97 +785,97 @@ namespace ButcherFactory.SegmentProductionAuto_ else item = historyList.First(); var template = config.Template; - var goodsInfo = SegmentProductionBL.GetGoodsInfo(item.Goods_ID); + var goodsInfo = SegmentProductionBL.GetGoodsInfo(item.Goods_ID); if (goodsInfo != null && goodsInfo.Item1.HasValue) { if (goodsInfo.Item1 == 0) template = "SegmentProductionPrint.html"; else - template = "SegmentProductionPrint1.html"; - } + template = "SegmentProductionPrint1.html"; + } NotAuto.SegmentProductionPrint.Print(item, batchDate, template); var log = new SegmentLog(item.BarCode, "补打"); log.Message = string.Format("存货名称:{0} 重量:{1:#0.###}", item.Goods_Name, item.Weight); - SegmentProductionBL.InsertLog(log); - } - } - - private void templateBtn_Click(object sender, EventArgs e) - { - new TemplateSelector(config).ShowDialog(); + SegmentProductionBL.InsertLog(log); + } + } + + private void templateBtn_Click(object sender, EventArgs e) + { + new TemplateSelector(config).ShowDialog(); } private void deleteBtn_Click(object sender, EventArgs e) { - //if (_totalCode == null || _codePanel == null) - if (current != null) - { - if (MessageBox.Show("确定删除选中记录?", "删除确认", MessageBoxButtons.OKCancel) != DialogResult.OK) - return; - - if (current.CreateTime.AddMinutes(1) < DateTime.Now) - { - MessageBox.Show("已超出可删除时间范围"); - return; - } - SegmentProduction d = current; - SegmentProductionBL.Delete(d); - historyList.Remove(d); - if (_labelBt != null) - { - var parent=_labelBt.Parent; - parent.Controls.Remove(_labelBt); - } - - var thd = new Thread(new ParameterizedThreadStart(RefreshTask)); - thd.Start(d); - current = null; + //if (_totalCode == null || _codePanel == null) + if (current != null) + { + if (MessageBox.Show("确定删除选中记录?", "删除确认", MessageBoxButtons.OKCancel) != DialogResult.OK) + return; + + if (current.CreateTime.AddMinutes(1) < DateTime.Now) + { + MessageBox.Show("已超出可删除时间范围"); + return; } - else if (_totalCode != null && _codePanel != null) + SegmentProduction d = current; + SegmentProductionBL.Delete(d); + historyList.Remove(d); + if (_labelBt != null) { - var deleteList = historyList.Where(x => x.TotalCode_ID == _totalCode.ID).ToList(); - if (deleteList.Count > 0) - { - MessageBox.Show("总码下已有条码,不允许直接删除总码"); - return; - } - if (_totalCode.GoodsType == 0) - { - MessageBox.Show("鲜品总码不允许删除"); - return; - } - else if (_totalCode.GoodsType == 1 && _totalCode.NoTotalCode) - { - MessageBox.Show("暂存区总码不允许删除"); - return; - } - SegmentProductionBL.DeleteTotalCode(_totalCode); - allCode.Remove(_totalCode); - codeButtons.Remove(_codePanel ); - foreach (var item in deleteList) - { - historyList.Remove(item); - var thd = new Thread(new ParameterizedThreadStart(RefreshTask)); - thd.Start(item); - } - flowLayoutPanel3.Controls.Remove(_codePanel); - // RefreshCodePanel(); - current = null; - if (allCode.Count > 0) - { - _totalCode = allCode[0]; - _codePanel = (ColorButton)flowLayoutPanel3.Controls[0]; - _codePanel.Selected = true; - _codePanel.Invalidate(); - BindflowLayoutPanel(_codePanel, _totalCode); - } - else - { - _totalCode = null; - _codePanel = null; - } + var parent = _labelBt.Parent; + parent.Controls.Remove(_labelBt); + } + var thd = new Thread(new ParameterizedThreadStart(RefreshTask)); + thd.Start(d); + current = null; + } + else if (_totalCode != null && _codePanel != null) + { + var deleteList = historyList.Where(x => x.TotalCode_ID == _totalCode.ID).ToList(); + if (deleteList.Count > 0) + { + MessageBox.Show("总码下已有条码,不允许直接删除总码"); + return; + } + if (_totalCode.GoodsType == 0) + { + MessageBox.Show("鲜品总码不允许删除"); + return; + } + else if (_totalCode.GoodsType == 1 && _totalCode.NoTotalCode) + { + MessageBox.Show("暂存区总码不允许删除"); + return; + } + SegmentProductionBL.DeleteTotalCode(_totalCode); + allCode.Remove(_totalCode); + codeButtons.Remove(_codePanel); + foreach (var item in deleteList) + { + historyList.Remove(item); + var thd = new Thread(new ParameterizedThreadStart(RefreshTask)); + thd.Start(item); } + flowLayoutPanel3.Controls.Remove(_codePanel); + // RefreshCodePanel(); + current = null; + if (allCode.Count > 0) + { + _totalCode = allCode[0]; + _codePanel = (ColorButton)flowLayoutPanel3.Controls[0]; + _codePanel.Selected = true; + _codePanel.Invalidate(); + BindflowLayoutPanel(_codePanel, _totalCode); + } + else + { + _totalCode = null; + _codePanel = null; + } + + } } @@ -925,13 +906,13 @@ namespace ButcherFactory.SegmentProductionAuto_ private void ViewTaskBtn_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(groupKey)) - throw new Exception("请选择存货分组"); - if (batchID == null) + throw new Exception("请选择存货分组"); + if (batchID == null) throw new Exception("请先选择批次"); if (goodsSetDic == null) throw new Exception("请选择存货分组"); var arr = goodsSetDic[groupKey]; - if(arr.Count==0) + if (arr.Count == 0) throw new Exception("分组中没有任何存货"); 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(); @@ -968,333 +949,150 @@ namespace ButcherFactory.SegmentProductionAuto_ private void colorButton1_Click(object sender, EventArgs e) { - var n = new ColorButton(); - - var tCode = SegmentProductionBL.InsertTotalCode(new TotalCode()); - allCode.Insert(0, tCode); - AddCodeButton(n, tCode,true); - flowLayoutPanel4.Controls.Clear(); - flowLayoutPanel3.Controls.Add(n); - flowLayoutPanel3.Controls.SetChildIndex(n, 2); + var n = new ColorButton(); + + var tCode = SegmentProductionBL.InsertTotalCode(new TotalCode()); + allCode.Insert(0, tCode); + AddCodeButton(n, tCode, true); + flowLayoutPanel4.Controls.Clear(); + flowLayoutPanel3.Controls.Add(n); + flowLayoutPanel3.Controls.SetChildIndex(n, 2); } private void AddCodeButton(ColorButton n, TotalCode tCode, bool add = false) { - n .Tag = tCode; - if (tCode.GoodsType == 0) - { - n.Text = "鲜品"; - _freshPanel = n; - } - else if (tCode.GoodsType == 1 && tCode.NoTotalCode) - { - n.Text = "暂存区"; - _stayPanel = n; - } - else - n.Text = tCode.ShortCode; - n .Click += delegate - { - - n .Selected = !n.Selected; - if (n .Selected) - { - current = null; - _codePanel = n; - _totalCode = tCode; - if (_labelBt != null) - { - _labelBt.Selected = false; - _labelBt.Invalidate(); - } - _labelBt = null; - - BindflowLayoutPanel(n, tCode); - } - else - { - flowLayoutPanel4.Controls.Clear(); - _codePanel = null; - _totalCode = null; - } - foreach (var bt in codeButtons) - { - if (bt.Text != n.Text && bt.Selected) - { - bt.Selected = false; - bt.Invalidate(); - } - } - - }; - if (add) - { - _codePanel = n; - n .Selected = true; - _totalCode = tCode; - foreach (var bt in codeButtons) - { - if (bt.Selected) - { - bt.Selected = false; - bt.Invalidate(); - } - } - } - n.BackColor = Color.LightGray; - n.Font = new Font("黑体", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - n.ForeColor = Color.Black; - // n.Location = new Point(3, 3); - //n.Name = "Button"; - n.SelectedColor = Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128))))); - n.Size = new Size(99, 40); - //n.TabIndex = 1; - n.UseVisualStyleBackColor = false; - - codeButtons.Add(n ); - } - - private void BindflowLayoutPanel(ColorButton tButton, TotalCode tCode) - { - var details = historyList.Where(x => x.TotalCode_ID == tCode.ID); - flowLayoutPanel4.Controls.Clear(); - foreach (var d in details) - { - flowLayoutPanel4.Controls.Add(initSegmentBt(d, tButton, tCode)); - } - } - - private void colorButton2_Click(object sender, EventArgs e) - { - if (_totalCode == null || _codePanel == null) - { - throw new Exception(string.Format("请先选择总码!")); - } - var dmos= historyList.Where(x => x.TotalCode_ID == _totalCode.ID).ToArray(); - if (dmos.Length == 0) - { - throw new Exception(string.Format("此码不包含任何产品!")); - } - foreach (var item in dmos) - { - item.TotalCode_Code = _totalCode.BarCode; - } - NotAuto.SegmentSumCodePrint.Print(dmos, "SegmentSumCode.html"); - var log = new SegmentLog(dmos[0].TotalCode_Code, "总码"); - log.Message = string.Format("总码:{0} ", dmos[0].TotalCode_Code); - SegmentProductionBL.InsertLog(log); - } - - private const int CP_NOCLOSE_BUTTON = 0x200; - - protected override CreateParams CreateParams - { - - get - { - - CreateParams myCp = base.CreateParams; - - myCp.ClassStyle = myCp.ClassStyle | CP_NOCLOSE_BUTTON; - - return myCp; - - } - - } - - private void butcherDateBox_MouseClick(object sender, MouseEventArgs e) - { - var simpleLbl = sender as Label; - var cs = new CalendarSelecter(); - if (cs.ShowDialog() == true) + n.Tag = tCode; + if (tCode.GoodsType == 0) { - butcherDate = cs.Result; - butcherDateBox.Text = butcherDate.ToString("yyyy-MM-dd"); + n.Text = "鲜品"; + _freshPanel = n; } - } - - WeightStatus status = new WeightStatus(); - #region 称相关 - private void init() - { - zeroBtn.Enabled = false; - // weightSwitch.Enabled = false; - System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;//忽略程序跨越线程运行导致的错误.没有此句将会产生错误 - } - - private void weightSwitch_Click(object sender, EventArgs e) - { - this.lblChengZhong.Text = "0.00"; - if (Utils.mPortOpened)//关闭动作 + else if (tCode.GoodsType == 1 && tCode.NoTotalCode) { - if (CallLibrary.unbindScale() == 1) - { - Utils.mPortOpened = false; //串口打开标记 - closePort(); - } + n.Text = "暂存区"; + _stayPanel = n; } else + n.Text = tCode.ShortCode; + n.Click += delegate { - if (!Utils.mPortOpened) - { - openPort(); - } - } - weightSwitch.Text = Utils.mPortOpened ? "停止称重" : "启用称重"; - } - #region 打开 关闭 串口 - private void openPort() - { - try - { - int port = 3; - int baudrate = 9600; - if (CallLibrary.sendPort(port, baudrate) == 1) + n.Selected = !n.Selected; + if (n.Selected) { - Utils.mPortOpened = true; //串口打开标记 - timer1.Enabled = true; - zeroBtn.Enabled = true; - //this.labelStatus.Text = Utils.rm.GetString("comOpen"); + current = null; + _codePanel = n; + _totalCode = tCode; + if (_labelBt != null) + { + _labelBt.Selected = false; + _labelBt.Invalidate(); + } + _labelBt = null; - //Console.WriteLine("Open port Complete."); + BindflowLayoutPanel(n, tCode); } else { - Utils.mPortOpened = false; //串口打开标记 - timer1.Enabled = false; - MessageBox.Show("串口打开失败"); - // this.labelStatus.Text = Utils.rm.GetString("comFail"); - // Console.WriteLine("Open port fail ."); + flowLayoutPanel4.Controls.Clear(); + _codePanel = null; + _totalCode = null; } - } - catch (Exception ex) + foreach (var bt in codeButtons) + { + if (bt.Text != n.Text && bt.Selected) + { + bt.Selected = false; + bt.Invalidate(); + } + } + + }; + if (add) { - MessageBox.Show("" + ex); + _codePanel = n; + n.Selected = true; + _totalCode = tCode; + foreach (var bt in codeButtons) + { + if (bt.Selected) + { + bt.Selected = false; + bt.Invalidate(); + } + } } + n.BackColor = Color.LightGray; + n.Font = new Font("黑体", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + n.ForeColor = Color.Black; + // n.Location = new Point(3, 3); + //n.Name = "Button"; + n.SelectedColor = Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128))))); + n.Size = new Size(99, 40); + //n.TabIndex = 1; + n.UseVisualStyleBackColor = false; + + codeButtons.Add(n); } - private void closePort() + private void BindflowLayoutPanel(ColorButton tButton, TotalCode tCode) { - timer1.Enabled = false; - Utils.mPortOpened = false; - // this.labelStatus.Text = Utils.rm.GetString("comClose"); - this.zeroBtn.Enabled = false; - - this.labelZero.BackColor = Color.White; - this.labelZero.ForeColor = Color.Black; - this.labelStable.BackColor = Color.White; - this.labelStable.ForeColor = Color.Black; - status.TareStatus = false; + var details = historyList.Where(x => x.TotalCode_ID == tCode.ID); + flowLayoutPanel4.Controls.Clear(); + foreach (var d in details) + { + flowLayoutPanel4.Controls.Add(initSegmentBt(d, tButton, tCode)); + } } - #endregion - private void zeroBtn_Click(object sender, EventArgs e) + private void colorButton2_Click(object sender, EventArgs e) { - if (CallLibrary.SendZero() == 1) + if (_totalCode == null || _codePanel == null) { - //MessageBox.Show("Zero is successful"); - // MessageBox.Show(Utils.rm.GetString("zeroIsOk")); + throw new Exception(string.Format("请先选择总码!")); } - else + var dmos = historyList.Where(x => x.TotalCode_ID == _totalCode.ID).ToArray(); + if (dmos.Length == 0) { - MessageBox.Show(Utils.rm.GetString("zeroisFail")); + throw new Exception(string.Format("此码不包含任何产品!")); } + foreach (var item in dmos) + { + item.TotalCode_Code = _totalCode.BarCode; + } + NotAuto.SegmentSumCodePrint.Print(dmos, "SegmentSumCode.html"); + var log = new SegmentLog(dmos[0].TotalCode_Code, "总码"); + log.Message = string.Format("总码:{0} ", dmos[0].TotalCode_Code); + SegmentProductionBL.InsertLog(log); } - #endregion - private void SegmentProductionAutoForm_Load(object sender, EventArgs e) - { - init(); - } + private const int CP_NOCLOSE_BUTTON = 0x200; - #region 重量处理 - string netWeight = string.Empty; - private void timer1_Tick(object sender, EventArgs e) + protected override CreateParams CreateParams { - try + + get { - timer1.Interval = 100; - if (Utils.mPortOpened) - { - IntPtr stringNet = CallLibrary.getStringNet(); - netWeight = Marshal.PtrToStringAnsi(stringNet); //重量 + CreateParams myCp = base.CreateParams; - Console.WriteLine("weight data:" + netWeight); + myCp.ClassStyle = myCp.ClassStyle | CP_NOCLOSE_BUTTON; + + return myCp; - weightNet(netWeight); - if (CallLibrary.isZero() != 1) - { - this.labelZero.BackColor = Color.White; - this.labelZero.ForeColor = Color.Black; - status.ZeroStatus = false; - } - else - { - this.labelZero.BackColor = Color.Green; - this.labelZero.ForeColor = Color.White; - status.ZeroStatus = true; - } - //稳定 - if (CallLibrary.isStable() != 1) - { - this.labelStable.BackColor = Color.White; - this.labelStable.ForeColor = Color.Black; - status.StableStatus = false; - } - else - { - this.labelStable.BackColor = Color.Green; - this.labelStable.ForeColor = Color.White; - status.StableStatus = true; - } - if (CallLibrary.isTare() != 1) - { - status.TareStatus = false; - } - else - { - status.TareStatus = true; - } - } - else - { - this.lblChengZhong.Text = "0.00"; - this.labelZero.BackColor = Color.White; - //this.labelStatus.BackColor = Color.White; - //this.labelStatus.ForeColor = Color.Black; - } - } - catch //(Exception ex) - { - //Console.WriteLine(ex); } + } - private void weightNet(string netWeight) + private void butcherDateBox_MouseClick(object sender, MouseEventArgs e) { - if (netWeight != null) + var simpleLbl = sender as Label; + var cs = new CalendarSelecter(); + if (cs.ShowDialog() == true) { - if (!netWeight.Contains("--UL--") && !netWeight.Contains("--OL--")) - { - this.lblChengZhong.Text = double.Parse(netWeight).ToString("0.00"); - } - else - { - if (netWeight.Contains("--UL--")) - { - this.lblChengZhong.Text = "--UL--"; - } - else if (netWeight.Contains("--OL--")) - { - this.lblChengZhong.Text = "--OL--"; - } - } + butcherDate = cs.Result; + butcherDateBox.Text = butcherDate.ToString("yyyy-MM-dd"); } } - - #endregion - } -} + } +} diff --git a/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.resx b/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.resx index e4198b0..08a9e5f 100644 --- a/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.resx +++ b/ButcherFactory.Form/SegmentProductionAuto_/SegmentProductionAutoForm.resx @@ -120,10 +120,4 @@ True - - 216, 16 - - - 306, 16 - \ No newline at end of file