From da1e7eecd85d698237ec26e54eab930e91e50ba8 Mon Sep 17 00:00:00 2001 From: "ruoxing.wang" <88384874@qq.com> Date: Tue, 23 Jul 2024 10:51:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E5=A1=91=E6=89=93=E7=A0=81=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E5=BC=80=E5=8F=91=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- InjectionPC/FrmBarCodeNew.Designer.cs | 655 +++++++ InjectionPC/FrmBarCodeNew.cs | 1723 +++++++++++++++++ InjectionPC/FrmLogin.Designer.cs | 40 +- InjectionPC/FrmLogin.cs | 16 +- InjectionPC/InjectionPC.csproj | 11 +- InjectionPC/Program.cs | 55 + .../{111 - 副本2.grf => 111 - 副本.grf} | Bin InjectionSearch/Form1.Designer.cs | 43 +- InjectionSearch/Form1.cs | 7 +- InjectionSearch/FrmBarCodeSearch.cs | 1 + .../FrmBarCodeSearchNew.Designer.cs | 445 +++++ InjectionSearch/FrmBarCodeSearchNew.cs | 566 ++++++ InjectionSearch/InjectionSearch.csproj | 12 + InjectionSearch/Program.cs | 56 + InjectionSearch/Report/P02 - 副本.grf | Bin 0 -> 3270 bytes MESClassLibrary/BLL/BasicInfo/StationBLL.cs | 14 + MESClassLibrary/BLL/User/UserBLL.cs | 2 +- MESClassLibrary/DAL/BasicDAL.cs | 41 + MESClassLibrary/DAL/BasicInfo/StationDAL.cs | 18 + PaintingPrintBarCode/Login.Designer.cs | 40 +- PunchAssemble/PunchAndWeld/BusinessHelper.cs | 2 +- 21 files changed, 3690 insertions(+), 57 deletions(-) create mode 100644 InjectionPC/FrmBarCodeNew.Designer.cs create mode 100644 InjectionPC/FrmBarCodeNew.cs rename InjectionPC/Report/{111 - 副本2.grf => 111 - 副本.grf} (100%) create mode 100644 InjectionSearch/FrmBarCodeSearchNew.Designer.cs create mode 100644 InjectionSearch/FrmBarCodeSearchNew.cs create mode 100644 InjectionSearch/Report/P02 - 副本.grf diff --git a/InjectionPC/FrmBarCodeNew.Designer.cs b/InjectionPC/FrmBarCodeNew.Designer.cs new file mode 100644 index 0000000..9578b79 --- /dev/null +++ b/InjectionPC/FrmBarCodeNew.Designer.cs @@ -0,0 +1,655 @@ +namespace InjectionPC +{ + partial class FrmBarCodeNew + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows 窗体设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmBarCodeNew)); + GlacialComponents.Controls.GLColumn glColumn1 = new GlacialComponents.Controls.GLColumn(); + GlacialComponents.Controls.GLColumn glColumn2 = new GlacialComponents.Controls.GLColumn(); + GlacialComponents.Controls.GLColumn glColumn3 = new GlacialComponents.Controls.GLColumn(); + GlacialComponents.Controls.GLColumn glColumn4 = new GlacialComponents.Controls.GLColumn(); + this.panel1 = new System.Windows.Forms.Panel(); + this.label2 = new System.Windows.Forms.Label(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.comboBox1 = new System.Windows.Forms.ComboBox(); + this.label5 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.glacialList1 = new GlacialComponents.Controls.GlacialList(); + this.label11 = new System.Windows.Forms.Label(); + this.label12 = new System.Windows.Forms.Label(); + this.label13 = new System.Windows.Forms.Label(); + this.panel2 = new System.Windows.Forms.Panel(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.label17 = new System.Windows.Forms.Label(); + this.label16 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.label15 = new System.Windows.Forms.Label(); + this.comboBox2 = new System.Windows.Forms.ComboBox(); + this.label14 = new System.Windows.Forms.Label(); + this.label18 = new System.Windows.Forms.Label(); + this.label19 = new System.Windows.Forms.Label(); + this.label20 = new System.Windows.Forms.Label(); + this.label21 = new System.Windows.Forms.Label(); + this.timer1 = new System.Windows.Forms.Timer(this.components); + this.panel3 = new System.Windows.Forms.Panel(); + this.button2 = new System.Windows.Forms.Button(); + this.button1 = new System.Windows.Forms.Button(); + this.textBox3 = new System.Windows.Forms.TextBox(); + this.label22 = new System.Windows.Forms.Label(); + this.panel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.panel2.SuspendLayout(); + this.panel3.SuspendLayout(); + this.SuspendLayout(); + // + // panel1 + // + this.panel1.Controls.Add(this.label2); + this.panel1.Controls.Add(this.pictureBox1); + this.panel1.Controls.Add(this.label1); + this.panel1.Location = new System.Drawing.Point(2, 2); + this.panel1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(2338, 159); + this.panel1.TabIndex = 0; + // + // label2 + // + this.label2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label2.Font = new System.Drawing.Font("宋体", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label2.Location = new System.Drawing.Point(1980, 9); + this.label2.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(350, 146); + this.label2.TabIndex = 3; + this.label2.Text = "2019-05-29 10:30:31"; + this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label2.Click += new System.EventHandler(this.label2_Click); + // + // pictureBox1 + // + this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); + this.pictureBox1.Location = new System.Drawing.Point(7, 7); + this.pictureBox1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(308, 146); + this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pictureBox1.TabIndex = 2; + this.pictureBox1.TabStop = false; + // + // label1 + // + this.label1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label1.Font = new System.Drawing.Font("宋体", 36F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label1.Location = new System.Drawing.Point(315, 9); + this.label1.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(1669, 146); + this.label1.TabIndex = 1; + this.label1.Text = "注塑车间条码打印new"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // label3 + // + this.label3.BackColor = System.Drawing.Color.DeepSkyBlue; + this.label3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label3.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label3.Location = new System.Drawing.Point(9, 156); + this.label3.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(308, 90); + this.label3.TabIndex = 1; + this.label3.Text = "用户信息:"; + this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // label4 + // + this.label4.BackColor = System.Drawing.Color.DeepSkyBlue; + this.label4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label4.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label4.Location = new System.Drawing.Point(319, 156); + this.label4.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(200, 90); + this.label4.TabIndex = 2; + this.label4.Text = "班组:"; + this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // comboBox1 + // + this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox1.Font = new System.Drawing.Font("宋体", 32F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.comboBox1.FormattingEnabled = true; + this.comboBox1.Items.AddRange(new object[] { + "A班", + "B班"}); + this.comboBox1.Location = new System.Drawing.Point(521, 159); + this.comboBox1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); + this.comboBox1.Name = "comboBox1"; + this.comboBox1.Size = new System.Drawing.Size(246, 83); + this.comboBox1.TabIndex = 3; + // + // label5 + // + this.label5.BackColor = System.Drawing.Color.DeepSkyBlue; + this.label5.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label5.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label5.Location = new System.Drawing.Point(768, 159); + this.label5.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(200, 90); + this.label5.TabIndex = 4; + this.label5.Text = "工位:"; + this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // label6 + // + this.label6.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label6.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label6.Location = new System.Drawing.Point(970, 163); + this.label6.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(264, 90); + this.label6.TabIndex = 5; + this.label6.Text = "IM01"; + this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // label7 + // + this.label7.BackColor = System.Drawing.Color.DeepSkyBlue; + this.label7.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label7.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label7.Location = new System.Drawing.Point(1238, 163); + this.label7.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(200, 90); + this.label7.TabIndex = 6; + this.label7.Text = "用户:"; + this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // label8 + // + this.label8.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label8.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label8.Location = new System.Drawing.Point(1437, 163); + this.label8.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(224, 90); + this.label8.TabIndex = 7; + this.label8.Text = "cy"; + this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // label9 + // + this.label9.BackColor = System.Drawing.Color.DeepSkyBlue; + this.label9.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label9.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label9.Location = new System.Drawing.Point(1657, 163); + this.label9.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(328, 90); + this.label9.TabIndex = 8; + this.label9.Text = "质量录入"; + this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label9.Click += new System.EventHandler(this.label9_Click); + // + // label10 + // + this.label10.BackColor = System.Drawing.Color.DeepSkyBlue; + this.label10.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label10.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label10.Location = new System.Drawing.Point(9, 247); + this.label10.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(308, 1087); + this.label10.TabIndex = 9; + this.label10.Text = "打印记录:"; + this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // glacialList1 + // + this.glacialList1.AllowColumnResize = true; + this.glacialList1.AllowMultiselect = false; + this.glacialList1.AlternateBackground = System.Drawing.Color.DarkGreen; + this.glacialList1.AlternatingColors = false; + this.glacialList1.AutoHeight = true; + this.glacialList1.BackColor = System.Drawing.SystemColors.ControlLightLight; + this.glacialList1.BackgroundStretchToFit = true; + glColumn1.ActivatedEmbeddedType = GlacialComponents.Controls.GLActivatedEmbeddedTypes.None; + glColumn1.CheckBoxes = false; + glColumn1.ImageIndex = -1; + glColumn1.Name = "Column1"; + glColumn1.NumericSort = false; + glColumn1.Text = "条码"; + glColumn1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; + glColumn1.Width = 350; + glColumn2.ActivatedEmbeddedType = GlacialComponents.Controls.GLActivatedEmbeddedTypes.None; + glColumn2.CheckBoxes = false; + glColumn2.ImageIndex = -1; + glColumn2.Name = "Column2"; + glColumn2.NumericSort = false; + glColumn2.Text = "产品名称"; + glColumn2.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; + glColumn2.Width = 320; + glColumn3.ActivatedEmbeddedType = GlacialComponents.Controls.GLActivatedEmbeddedTypes.None; + glColumn3.CheckBoxes = false; + glColumn3.ImageIndex = -1; + glColumn3.Name = "Column3"; + glColumn3.NumericSort = false; + glColumn3.Text = "打印方式"; + glColumn3.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; + glColumn3.Width = 150; + glColumn4.ActivatedEmbeddedType = GlacialComponents.Controls.GLActivatedEmbeddedTypes.None; + glColumn4.CheckBoxes = false; + glColumn4.ImageIndex = -1; + glColumn4.Name = "Column4"; + glColumn4.NumericSort = false; + glColumn4.Text = "打印时间"; + glColumn4.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; + glColumn4.Width = 270; + this.glacialList1.Columns.AddRange(new GlacialComponents.Controls.GLColumn[] { + glColumn1, + glColumn2, + glColumn3, + glColumn4}); + this.glacialList1.ControlStyle = GlacialComponents.Controls.GLControlStyles.Normal; + this.glacialList1.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.glacialList1.FullRowSelect = true; + this.glacialList1.GridColor = System.Drawing.Color.DeepSkyBlue; + this.glacialList1.GridLines = GlacialComponents.Controls.GLGridLines.gridBoth; + this.glacialList1.GridLineStyle = GlacialComponents.Controls.GLGridLineStyles.gridSolid; + this.glacialList1.GridTypes = GlacialComponents.Controls.GLGridTypes.gridNormal; + this.glacialList1.HeaderHeight = 40; + this.glacialList1.HeaderVisible = true; + this.glacialList1.HeaderWordWrap = false; + this.glacialList1.HotColumnTracking = false; + this.glacialList1.HotItemTracking = false; + this.glacialList1.HotTrackingColor = System.Drawing.Color.LightGray; + this.glacialList1.HoverEvents = false; + this.glacialList1.HoverTime = 1; + this.glacialList1.ImageList = null; + this.glacialList1.ItemHeight = 50; + this.glacialList1.ItemWordWrap = false; + this.glacialList1.Location = new System.Drawing.Point(317, 248); + this.glacialList1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); + this.glacialList1.Name = "glacialList1"; + this.glacialList1.Selectable = true; + this.glacialList1.SelectedTextColor = System.Drawing.Color.White; + this.glacialList1.SelectionColor = System.Drawing.Color.Lime; + this.glacialList1.ShowBorder = true; + this.glacialList1.ShowFocusRect = false; + this.glacialList1.Size = new System.Drawing.Size(2017, 1087); + this.glacialList1.SortType = GlacialComponents.Controls.SortTypes.InsertionSort; + this.glacialList1.SuperFlatHeaderColor = System.Drawing.Color.White; + this.glacialList1.TabIndex = 10; + this.glacialList1.Text = "glacialList1"; + this.glacialList1.Click += new System.EventHandler(this.glacialList1_Click); + // + // label11 + // + this.label11.BackColor = System.Drawing.Color.DeepSkyBlue; + this.label11.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label11.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label11.Location = new System.Drawing.Point(9, 1335); + this.label11.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(308, 440); + this.label11.TabIndex = 11; + this.label11.Text = "打印信息:"; + this.label11.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // label12 + // + this.label12.BackColor = System.Drawing.Color.DeepSkyBlue; + this.label12.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label12.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label12.Location = new System.Drawing.Point(317, 1335); + this.label12.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(132, 440); + this.label12.TabIndex = 12; + this.label12.Text = "暂停打印"; + this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label12.Click += new System.EventHandler(this.label12_Click); + // + // label13 + // + this.label13.BackColor = System.Drawing.Color.DeepSkyBlue; + this.label13.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label13.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label13.Location = new System.Drawing.Point(449, 1335); + this.label13.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(132, 440); + this.label13.TabIndex = 13; + this.label13.Text = "下一计划"; + this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label13.Click += new System.EventHandler(this.label13_Click); + // + // panel2 + // + this.panel2.BackColor = System.Drawing.Color.Aquamarine; + this.panel2.Controls.Add(this.textBox2); + this.panel2.Controls.Add(this.label17); + this.panel2.Controls.Add(this.label16); + this.panel2.Controls.Add(this.textBox1); + this.panel2.Controls.Add(this.label15); + this.panel2.Controls.Add(this.comboBox2); + this.panel2.Controls.Add(this.label14); + this.panel2.Location = new System.Drawing.Point(583, 1335); + this.panel2.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(1351, 441); + this.panel2.TabIndex = 14; + // + // textBox2 + // + this.textBox2.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox2.Location = new System.Drawing.Point(306, 262); + this.textBox2.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(303, 65); + this.textBox2.TabIndex = 6; + this.textBox2.Click += new System.EventHandler(this.textBox2_Click); + // + // label17 + // + this.label17.AutoSize = true; + this.label17.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label17.Location = new System.Drawing.Point(68, 273); + this.label17.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label17.Name = "label17"; + this.label17.Size = new System.Drawing.Size(178, 51); + this.label17.TabIndex = 5; + this.label17.Text = "数量:"; + // + // label16 + // + this.label16.AutoSize = true; + this.label16.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label16.Location = new System.Drawing.Point(693, 147); + this.label16.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(238, 51); + this.label16.TabIndex = 4; + this.label16.Text = "(yyMMdd)"; + // + // textBox1 + // + this.textBox1.Enabled = false; + this.textBox1.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.textBox1.Location = new System.Drawing.Point(308, 142); + this.textBox1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(301, 65); + this.textBox1.TabIndex = 3; + // + // label15 + // + this.label15.AutoSize = true; + this.label15.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label15.Location = new System.Drawing.Point(70, 156); + this.label15.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label15.Name = "label15"; + this.label15.Size = new System.Drawing.Size(178, 51); + this.label15.TabIndex = 2; + this.label15.Text = "批次:"; + // + // comboBox2 + // + this.comboBox2.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.comboBox2.FormattingEnabled = true; + this.comboBox2.Location = new System.Drawing.Point(308, 33); + this.comboBox2.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); + this.comboBox2.Name = "comboBox2"; + this.comboBox2.Size = new System.Drawing.Size(879, 59); + this.comboBox2.TabIndex = 1; + // + // label14 + // + this.label14.AutoSize = true; + this.label14.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label14.Location = new System.Drawing.Point(70, 40); + this.label14.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(178, 51); + this.label14.TabIndex = 0; + this.label14.Text = "产品:"; + // + // label18 + // + this.label18.BackColor = System.Drawing.Color.DeepSkyBlue; + this.label18.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label18.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label18.Location = new System.Drawing.Point(2070, 1335); + this.label18.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label18.Name = "label18"; + this.label18.Size = new System.Drawing.Size(132, 440); + this.label18.TabIndex = 15; + this.label18.Text = "补打"; + this.label18.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label18.Visible = false; + this.label18.Click += new System.EventHandler(this.label18_Click); + // + // label19 + // + this.label19.BackColor = System.Drawing.Color.DeepSkyBlue; + this.label19.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label19.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label19.Location = new System.Drawing.Point(1936, 1335); + this.label19.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label19.Name = "label19"; + this.label19.Size = new System.Drawing.Size(132, 440); + this.label19.TabIndex = 16; + this.label19.Text = "手工打印"; + this.label19.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label19.Click += new System.EventHandler(this.label19_Click); + // + // label20 + // + this.label20.BackColor = System.Drawing.Color.DeepSkyBlue; + this.label20.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label20.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label20.Location = new System.Drawing.Point(2204, 1335); + this.label20.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label20.Name = "label20"; + this.label20.Size = new System.Drawing.Size(132, 440); + this.label20.TabIndex = 17; + this.label20.Text = "删除条码"; + this.label20.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label20.Visible = false; + this.label20.Click += new System.EventHandler(this.label20_Click); + // + // label21 + // + this.label21.BackColor = System.Drawing.Color.DeepSkyBlue; + this.label21.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label21.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label21.Location = new System.Drawing.Point(1982, 163); + this.label21.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label21.Name = "label21"; + this.label21.Size = new System.Drawing.Size(350, 86); + this.label21.TabIndex = 18; + this.label21.Text = "停机录入"; + this.label21.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label21.Click += new System.EventHandler(this.label21_Click); + // + // timer1 + // + this.timer1.Enabled = true; + this.timer1.Interval = 5000; + this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + // + // panel3 + // + this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panel3.Controls.Add(this.button2); + this.panel3.Controls.Add(this.button1); + this.panel3.Controls.Add(this.textBox3); + this.panel3.Controls.Add(this.label22); + this.panel3.Location = new System.Drawing.Point(939, 971); + this.panel3.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); + this.panel3.Name = "panel3"; + this.panel3.Size = new System.Drawing.Size(965, 96); + this.panel3.TabIndex = 19; + // + // button2 + // + this.button2.Location = new System.Drawing.Point(765, 35); + this.button2.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(138, 40); + this.button2.TabIndex = 3; + this.button2.Text = "取消"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(567, 35); + this.button1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(138, 40); + this.button1.TabIndex = 2; + this.button1.Text = "确定"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // textBox3 + // + this.textBox3.Location = new System.Drawing.Point(149, 35); + this.textBox3.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); + this.textBox3.Name = "textBox3"; + this.textBox3.Size = new System.Drawing.Size(319, 31); + this.textBox3.TabIndex = 1; + this.textBox3.UseSystemPasswordChar = true; + this.textBox3.Click += new System.EventHandler(this.textBox3_Click); + this.textBox3.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBox3_KeyDown); + // + // label22 + // + this.label22.AutoSize = true; + this.label22.Location = new System.Drawing.Point(48, 42); + this.label22.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); + this.label22.Name = "label22"; + this.label22.Size = new System.Drawing.Size(73, 21); + this.label22.TabIndex = 0; + this.label22.Text = "密码:"; + // + // FrmBarCodeNew + // + this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(2317, 1724); + this.Controls.Add(this.panel3); + this.Controls.Add(this.label21); + this.Controls.Add(this.label20); + this.Controls.Add(this.label19); + this.Controls.Add(this.label18); + this.Controls.Add(this.panel2); + this.Controls.Add(this.label13); + this.Controls.Add(this.label12); + this.Controls.Add(this.label11); + this.Controls.Add(this.glacialList1); + this.Controls.Add(this.label10); + this.Controls.Add(this.label9); + this.Controls.Add(this.label8); + this.Controls.Add(this.label7); + this.Controls.Add(this.label6); + this.Controls.Add(this.label5); + this.Controls.Add(this.comboBox1); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.panel1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); + this.Name = "FrmBarCodeNew"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Form1"; + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FrmBarCode_FormClosed); + this.Load += new System.EventHandler(this.FrmBarCodeNew_Load); + this.panel1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.panel2.ResumeLayout(false); + this.panel2.PerformLayout(); + this.panel3.ResumeLayout(false); + this.panel3.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.ComboBox comboBox1; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.Label label10; + private GlacialComponents.Controls.GlacialList glacialList1; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.Label label17; + private System.Windows.Forms.Label label16; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Label label15; + private System.Windows.Forms.ComboBox comboBox2; + private System.Windows.Forms.Label label14; + private System.Windows.Forms.Label label18; + private System.Windows.Forms.Label label19; + private System.Windows.Forms.Label label20; + private System.Windows.Forms.Label label21; + private System.Windows.Forms.Timer timer1; + private System.Windows.Forms.Panel panel3; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.TextBox textBox3; + private System.Windows.Forms.Label label22; + + } +} + diff --git a/InjectionPC/FrmBarCodeNew.cs b/InjectionPC/FrmBarCodeNew.cs new file mode 100644 index 0000000..c66ad23 --- /dev/null +++ b/InjectionPC/FrmBarCodeNew.cs @@ -0,0 +1,1723 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Configuration; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using MESClassLibrary.BLL.BasicInfo; +using System.Net.NetworkInformation; +using System.IO; +using GlacialComponents.Controls; +using MESClassLibrary.Model; +using grdesLib; +using grproLib; +using System.Configuration; +using System.Diagnostics; +using System.Diagnostics.Eventing.Reader; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Threading; +using MESClassLibrary.BLL.Log; +using MESClassLibrary.DAL; +using MESClassLibrary.EFModel; + +namespace InjectionPC +{ + public partial class FrmBarCodeNew : Form + { + private string _printTemplateName = string.Empty; + private DataTable _stationTable = null; + + public FrmBarCodeNew() + { + InitializeComponent(); + } + private bool _weightOutLine = false; + public string oldTime = "", newTime = "",tempTime=""; + public static bool IsStart = true; + public string planID = ""; + public static string code_g = ""; + private SynchronizationContext _syncontext = SynchronizationContext.Current; + + private void FrmBarCodeNew_Load(object sender, EventArgs e) + { + try + { + _printTemplateName = Application.StartupPath + "\\Report\\111 - 副本.grf"; + var serverUrl = "http://10.60.101.10:8013/"; + var updateXmlFileName = "InjectionUpdate.xml"; + var updater = new AutoUpdater(); + if (updater.CheckUpdateLoad(serverUrl, updateXmlFileName)) + { + Environment.Exit(0); + } + + //string serialNo = BasicDAL.GetSjBarCodeSerialNo("2200000175240319", "240716"); + _syncontext = SynchronizationContext.Current; + + Control.CheckForIllegalCrossThreadCalls = false; + Thread t = new Thread(new ThreadStart(TimeGo)); + t.Start(); + timer1.Interval = Program.interVal; + ; + label6.Text = Program.station; + label8.Text = Program.OperatorName; + panel3.Visible = false; + textBox3.Text = ""; + //comboBox1.Text = "A班"; + initProduct(); + + initBarCode(); + DateTime aa = GetDateTime(); + + if (aa.Hour >= 8 && aa.Hour < 20) + { + Program.Shift = "A班"; + Program.ProductDate = aa.ToString("yyyy-MM-dd"); + } + else + { + Program.Shift = "B班"; + if (aa.Hour >= 0 && aa.Hour < 8) + { + Program.ProductDate =aa.AddDays(-1).ToString("yyyy-MM-dd"); + //Program.ProductDate = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"); + } + else + { + Program.ProductDate = aa.ToString("yyyy-MM-dd"); + //Program.ProductDate = DateTime.Now.ToString("yyyy-MM-dd"); + } + } + comboBox1.Text = Program.Shift; + + textBox1.Text = Program.ProductDate.Substring(2, 2) + Program.ProductDate.Substring(5, 2) + + Program.ProductDate.Substring(8, 2); + if (IsStart == false) + { + timer1.Enabled = false; + label12.Text = "开始打印"; + label12.BackColor = System.Drawing.Color.Gray; + } + + else + { + timer1.Enabled = true; + label12.Text = "暂停打印"; + label12.BackColor = System.Drawing.Color.DeepSkyBlue; + } + + StationBLL sbll = new StationBLL(); + _stationTable = sbll.SearchAllInfo(); + } + catch (Exception ex) + { + LogErrBLL.AddInfo(ex.ToString(),MethodBase.GetCurrentMethod()); + } + + } + + private void initProduct() + { + comboBox2.Items.Clear(); + + ProductBLL bll=new ProductBLL(); + + DataTable dt = bll.SearchInfoByType("2000", Program.station); + if (dt != null && dt.Rows.Count > 0) + { + for (int i = 0; i < dt.Rows.Count; i++) + { + comboBox2.Items.Add(dt.Rows[i]["ProductName"].ToString()); + } + } + dt.Dispose(); + } + + private void initBarCode () + { + BarCodeBLL bll=new BarCodeBLL(); + + glacialList1.Items.Clear(); + DataTable dt = bll.SearchInfo(Program.station); + if (dt != null && dt.Rows.Count > 0) + { + for (int i = 0; i < dt.Rows.Count; i++) + { + glacialList1.Items.Add(i.ToString()); + glacialList1.Items[i].SubItems[0].Text = dt.Rows[i]["BarCode"].ToString(); + glacialList1.Items[i].SubItems[1].Text = dt.Rows[i]["ProductName"].ToString(); + glacialList1.Items[i].SubItems[2].Text = dt.Rows[i]["PrintType"].ToString(); + glacialList1.Items[i].SubItems[3].Text = dt.Rows[i]["CreateTime"].ToString() == "" ? "" : Convert.ToDateTime(dt.Rows[i]["CreateTime"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"); + //glacialList1.Items[i].SubItems[3].Text = dt.Rows[i]["CreateTime"].ToString() == "" ? "" : dt.Rows[i]["CreateTime"].ToString("yyyy-MM-dd HH:mm:ss.fff"); + //glacialList1.Refresh(); + } + } + } + + private void label9_Click(object sender, EventArgs e) + { + //this.Hide(); + Form fr=new FrmQuality(); + fr.Show(); + } + + private void TimeGo() + { + System.Timers.Timer timer = new System.Timers.Timer(); + timer.Interval = 1000; + timer.Enabled = true; + timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Tick); + } + + private void timer_Tick(object sender, EventArgs e) + { + _syncontext.Send(rst1 => + { + label2.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + Thread.Sleep(500); + }, null); + + } + + private void timer1_Tick(object sender, EventArgs e) + { + BarCodeBLL Barbll = new BarCodeBLL(); + BarCodeModel md = new BarCodeModel(); + timer1.Stop(); + Ping p1 = new Ping(); + bool status = false; + string code = "",OneCode=""; + //NewOneCode 左门槛 NewOneCode1右门槛 + string newcode = "", newcode1 = "", NewOneCode = "", NewOneCode1 = "", printerName = "", rfilename = "", reportName=""; + string[] part=new string[3]; + GridppReport report = new GridppReport(); + long a = 0; + + ProductOfInjectionBLL pbll = new ProductOfInjectionBLL(); + ProductOfInjectionModel pmd = new ProductOfInjectionModel(); + InjectionPlanBLL bll = new InjectionPlanBLL(); + BarCodeBLL brbll = new BarCodeBLL(); + ProductBLL productBll =new ProductBLL(); + + DataTable pdt3 = null; + + + DateTime aa = GetDateTime(); + + if (aa.Hour >= 8 && aa.Hour < 20) + { + Program.Shift = "A班"; + Program.ProductDate = aa.ToString("yyyy-MM-dd"); + } + else + { + Program.Shift = "B班"; + if (aa.Hour >= 0 && aa.Hour < 8) + { + Program.ProductDate = aa.AddDays(-1).ToString("yyyy-MM-dd"); + //Program.ProductDate = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"); + } + else + { + Program.ProductDate = aa.ToString("yyyy-MM-dd"); + //Program.ProductDate = DateTime.Now.ToString("yyyy-MM-dd"); + } + } + + comboBox1.Text = Program.Shift; + textBox1.Text = Program.ProductDate.Substring(2, 2) + Program.ProductDate.Substring(5, 2) + + Program.ProductDate.Substring(8, 2); + LogHelper.WriteLog(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); + try + { + PingReply reply = p1.Send(Program.IP); //发送主机名或Ip地址 + StringBuilder sbuilder; + if (reply.Status == IPStatus.Success || Program.WeightOutLine==true) + { + //读取称重文件 +#warning 测试时将WeightOutLine设置为true可以进行下去 + if (Program.WeightOutLine == true) + { + status = true; + } + else + { + status = Upload.DoConnComputer(Program.IP, Program.WeightFolder, Program.WeightUser, Program.WeightPsw); + } + if (status) + { + //DirectoryInfo theFolder = new DirectoryInfo(@"\\192.168.1.16\aa"); + //DirectoryInfo theFolder = new DirectoryInfo(@"\\" + Program.IP + "\\UserData"); + DirectoryInfo theFolder = new DirectoryInfo(@"\\" + Program.IP + "\\" + Program.WeightFolder); + //string filename = theFolder.ToString() + "\\ProdHisFile.csv"; + string filename = theFolder.ToString() + "\\" + Program.WeightFile; +#warning 测试时将WeightOutLine设置为true可以进行下去 + if (Program.WeightOutLine == true) + { + filename = Application.StartupPath + "\\Report\\称重.xlsx"; + oldTime = "2024-06-24 13:22:08"; + } + FileInfo fl = new FileInfo(filename); + + + if (oldTime == "" || oldTime == "none") + { + oldTime = fl.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss"); + tempTime = oldTime; + } + else + { + newTime = fl.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss"); + tempTime=newTime; + TimeSpan s = Convert.ToDateTime(tempTime) - Convert.ToDateTime(oldTime); + if (s.TotalSeconds<50) + { + timer1.Interval = Program.interVal; + timer1.Start(); + return; + } + else + { + if (newTime != oldTime) + { + #region 生成打印条码 1、当前计划的存货代码2、barcode表根据存货代码查找今天的流水 + + DataTable dt = bll.SearchInfoByName(Program.station);//获取当前计划 + if (dt != null && dt.Rows.Count > 0) + { + planID = dt.Rows[0]["InjectionPlanID"].ToString(); + DataTable dt2 = null; + if (dt.Rows[0]["ProductName"].ToString().IndexOf("门槛") != -1) + { + //插入两条数据,一个左门槛,一个右门槛 + //dt2 = brbll.SearchInfoByStock(dt.Rows[0]["StockNo"].ToString().Trim());//BarCode最大值 + //if (dt2 != null && dt2.Rows.Count > 0) + //{ + // code = dt2.Rows[0]["BarCode"].ToString().Trim(); + // newcode = code.Substring(0, code.Length - 4) + + // (Convert.ToInt32(code.Substring(code.Length - 4, 4)) + 1).ToString() + // .PadLeft(4, '0'); + // OneCode = dt2.Rows[0]["OneBarCode"].ToString().Trim(); + // NewOneCode = OneCode.Substring(0, OneCode.Length - 4) + (Convert.ToInt32(OneCode.Substring(OneCode.Length - 4, 4)) + 1).ToString().PadLeft(4, '0'); + //} + //else + //{ + // ReloadProduceDate(); + // //按照二维码的生成规则 + // newcode = dt.Rows[0]["PartNo"].ToString().Trim() + "." + Program.ProductDate.Substring(2, 2) + Program.ProductDate.Substring(5, 2) + Program.ProductDate.Substring(8, 2) + "." + "0001"; + // NewOneCode = dt.Rows[0]["StockNo"].ToString().Trim() + Program.ProductDate.Substring(2, 2) + Program.ProductDate.Substring(5, 2) + Program.ProductDate.Substring(8, 2) + "0001"; + //} + + string batch = Program.ProductDate.Substring(2, 2) + Program.ProductDate.Substring(5, 2) + Program.ProductDate.Substring(8, 2); + NewOneCode = BasicDAL.GetSjBarCodeSerialNo(dt.Rows[0]["StockNo"].ToString().Trim(), batch); + newcode = dt.Rows[0]["PartNo"].ToString().Trim() + "." + batch + "." + NewOneCode.Substring(16, 4); + + ProductBLL prbll = new ProductBLL(); + DataTable prdt = null; + if (dt.Rows[0]["ProductName"].ToString().IndexOf("左") != -1) + { + #region 计划为左门槛 + //左门槛,同时生成一个右门槛条码 + + //t_Product内容 + prdt = prbll.SearchInfoByProductName( + dt.Rows[0]["ProductName"].ToString().TrimEnd() + .Substring(0, dt.Rows[0]["ProductName"].ToString().TrimEnd().Length - 3) + "右门槛"); + if (prdt != null && prdt.Rows.Count > 0) + { + //根据存货代码,查询tb_BarCode最大值 + //dt2 = brbll.SearchInfoByStock(prdt.Rows[0]["StockNo"].ToString().Trim()); + //if (dt2 != null && dt2.Rows.Count > 0) + //{ + // code = dt2.Rows[0]["BarCode"].ToString().Trim(); + // newcode1 = code.Substring(0, code.Length - 4) + + // (Convert.ToInt32(code.Substring(code.Length - 4, 4)) + 1).ToString() + // .PadLeft(4, '0'); + // OneCode = dt2.Rows[0]["OneBarCode"].ToString().Trim(); + // NewOneCode1 = OneCode.Substring(0, OneCode.Length - 4) + (Convert.ToInt32(OneCode.Substring(OneCode.Length - 4, 4)) + 1).ToString().PadLeft(4, '0'); + //} + //else + //{ + // //按照二维码的生成规则 + // newcode1 = prdt.Rows[0]["PartNo"].ToString().Trim() + "." + Program.ProductDate.Substring(2, 2) + Program.ProductDate.Substring(5, 2) + Program.ProductDate.Substring(8, 2) + "." + "0001"; + // NewOneCode1 = prdt.Rows[0]["StockNo"].ToString().Trim() + Program.ProductDate.Substring(2, 2) + Program.ProductDate.Substring(5, 2) + Program.ProductDate.Substring(8, 2) + "0001"; + //} + + string batch1 = Program.ProductDate.Substring(2, 2) + Program.ProductDate.Substring(5, 2) + Program.ProductDate.Substring(8, 2); + NewOneCode1 = BasicDAL.GetSjBarCodeSerialNo(prdt.Rows[0]["StockNo"].ToString().Trim(), batch1); + newcode1 = prdt.Rows[0]["PartNo"].ToString().Trim() + "." + batch1 + "." + NewOneCode1.Substring(16, 4); + + #region 如果顺序号不一致取最大的 + //if (Convert.ToInt32(newcode.Substring(newcode.Length - 4, 4)) != + // Convert.ToInt32(newcode1.Substring(newcode1.Length - 4, 4))) + //{ + // if (Convert.ToInt32(newcode.Substring(newcode.Length - 4, 4)) > Convert.ToInt32(newcode1.Substring(newcode1.Length - 4, 4))) + // { + // newcode1 = newcode1.Substring(0, newcode1.Length - 4) + + // newcode.Substring(newcode.Length - 4, 4); + // NewOneCode1 = NewOneCode1.Substring(0, NewOneCode1.Length - 4) + newcode.Substring(newcode.Length - 4, 4); + // } + // else + // { + // newcode = newcode.Substring(0, newcode.Length - 4) + newcode1.Substring(newcode1.Length - 4, 4); + // NewOneCode = NewOneCode.Substring(0, NewOneCode.Length - 4) + newcode1.Substring(newcode1.Length - 4, 4); + // } + //} + #endregion + + #region 插入tb_barcode表记录 + + part = newcode.Split('.'); + md.ID = Guid.NewGuid().ToString(); + md.StationID = dt.Rows[0]["StationID"].ToString(); + md.OneBarCode = NewOneCode; + md.BarCode = newcode; + md.StockNo = dt.Rows[0]["StockNo"].ToString(); + md.PrintType = 0; + md.PlanID = planID; + md.BatchNo = textBox1.Text; + + DataTable pdt = productBll.SearchIsImportByStockNo(NewOneCode.Substring(0, 10)); + if (pdt != null && pdt.Rows.Count > 0) + { + if (pdt.Rows[0]["isImport"].ToString() == "1") + { + md.Import = "国产料Kingfa"; + } + else + { + md.Import = ""; + } + } + + if (Barbll.Add_Info(md)) + { + #region 打印条码 左 + + //filename = @"D:\111 - 副本.grf"; + filename = _printTemplateName; + DataTable headTable = new DataTable(); + headTable.Columns.Add("StationNo"); + headTable.Columns.Add("OneBarCode"); + headTable.Columns.Add("BarCode"); + headTable.Columns.Add("ProductName"); + headTable.Columns.Add("IsImport"); + DataRow row = headTable.NewRow(); + row["StationNo"] = Program.station; + + row["OneBarCode"] = NewOneCode; + row["BarCode"] = newcode; + row["ProductName"] = dt.Rows[0]["ProductName"]+";"; + row["IsImport"] = md.Import; + reportName = ConfigurationManager.AppSettings["Printer1"]; + headTable.Rows.Add(row); + + //ReportHelper rp = new ReportHelper(filename, headTable, null, + // (int)GRPaperOrientation.grpoDefault, 1, reportName); + //rp.Report.Print(false); + + //string filename_label = Application.StartupPath + "\\Report\\111 - 副本.grf"; + MyReport report2 = new MyReport(filename, headTable, null, reportName); + report2.Report.Printer.PrinterName = reportName; + report2.Report.Print(false); + + #endregion + + LogHelper.WriteLog("打印时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ";" + NewOneCode); + + Barbll.Update_Info(md); + } + else + { + MessageBox.Show("连接数据库超时!"); + timer1.Interval = Program.interVal; + timer1.Start(); + return; + } + + #endregion + + #region 插入tb_barcode表记录,另一侧 + + part = newcode.Split('.'); + md.ID = Guid.NewGuid().ToString(); + md.StationID = dt.Rows[0]["StationID"].ToString(); + md.OneBarCode = NewOneCode1; + md.BarCode = newcode1; + md.StockNo = prdt.Rows[0]["StockNo"].ToString().Trim(); + md.PrintType = 0; + md.PlanID = planID; + md.BatchNo = textBox1.Text; + + DataTable pdt1 = productBll.SearchIsImportByStockNo(NewOneCode.Substring(0, 10)); + if (pdt1 != null && pdt1.Rows.Count > 0) + { + if (pdt1.Rows[0]["isImport"].ToString() == "1") + { + md.Import = "国产料Kingfa"; + } + else + { + md.Import = ""; + } + } + + if (Barbll.Add_Info(md)) + { + #region 打印条码 右 + + //filename = @"D:\111 - 副本.grf"; + filename = _printTemplateName; + DataTable headTable1 = new DataTable(); + headTable1.Columns.Add("StationNo"); + headTable1.Columns.Add("OneBarCode"); + headTable1.Columns.Add("BarCode"); + headTable1.Columns.Add("ProductName"); + headTable1.Columns.Add("IsImport"); + DataRow row1 = headTable1.NewRow(); + row1["StationNo"] = Program.station; + row1["OneBarCode"] = NewOneCode1; + row1["BarCode"] = newcode1; + row1["ProductName"] = dt.Rows[0]["ProductName"].ToString().TrimEnd() + .Substring(0, dt.Rows[0]["ProductName"].ToString().TrimEnd().Length - 3) + "右门槛"+";"; + row1["IsImport"] = md.Import; + reportName = ConfigurationManager.AppSettings["Printer2"]; + headTable1.Rows.Add(row1); + + //ReportHelper rp1 = new ReportHelper(filename, headTable1, null, + // (int)GRPaperOrientation.grpoDefault, 1, reportName); + //rp1.Report.Print(false); + + MyReport report2 = new MyReport(filename, headTable1, null, reportName); + report2.Report.Printer.PrinterName = reportName; + report2.Report.Print(false); + + #endregion + + LogHelper.WriteLog("打印时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ";" + NewOneCode1); + + Barbll.Update_Info(md); + } + else + { + MessageBox.Show("连接数据库超时!"); + timer1.Interval = Program.interVal; + timer1.Start(); + return; + } + + #endregion + } + #endregion + } + + else + { + #region 计划为右门槛 + + prdt = prbll.SearchInfoByProductName( + dt.Rows[0]["ProductName"].ToString().TrimEnd() + .Substring(0, dt.Rows[0]["ProductName"].ToString().TrimEnd().Length - 3) + "左"); + if (prdt != null && prdt.Rows.Count > 0) + { + //dt2 = brbll.SearchInfoByStock(prdt.Rows[0]["StockNo"].ToString().Trim()); + //if (dt2 != null && dt2.Rows.Count > 0) + //{ + // code = dt2.Rows[0]["BarCode"].ToString().Trim(); + // newcode1 = code.Substring(0, code.Length - 4) + + // (Convert.ToInt32(code.Substring(code.Length - 4, 4)) + 1).ToString() + // .PadLeft(4, '0'); + // OneCode = dt2.Rows[0]["OneBarCode"].ToString().Trim(); + // NewOneCode1 = OneCode.Substring(0, OneCode.Length - 4) + (Convert.ToInt32(OneCode.Substring(OneCode.Length - 4, 4)) + 1).ToString().PadLeft(4, '0'); + //} + //else + //{ + // ReloadProduceDate(); + // //按照二维码的生成规则 + // newcode1 = prdt.Rows[0]["PartNo"].ToString().Trim() + "." + Program.ProductDate.Substring(2, 2) + Program.ProductDate.Substring(5, 2) + Program.ProductDate.Substring(8, 2) + "." + "0001"; + // NewOneCode1 = prdt.Rows[0]["StockNo"].ToString().Trim() + Program.ProductDate.Substring(2, 2) + Program.ProductDate.Substring(5, 2) + Program.ProductDate.Substring(8, 2) + "0001"; + //} + + string batch1 = Program.ProductDate.Substring(2, 2) + Program.ProductDate.Substring(5, 2) + Program.ProductDate.Substring(8, 2); + NewOneCode1 = BasicDAL.GetSjBarCodeSerialNo(prdt.Rows[0]["StockNo"].ToString().Trim(), batch1); + newcode1 = prdt.Rows[0]["PartNo"].ToString().Trim() + "." + batch1 + "." + NewOneCode1.Substring(16, 4); + + + #region 如果顺序号不一致取最大的 + //if (Convert.ToInt32(newcode.Substring(newcode.Length - 4, 4)) != + // Convert.ToInt32(newcode1.Substring(newcode1.Length - 4, 4))) + //{ + // if (Convert.ToInt32(newcode.Substring(newcode.Length - 4, 4)) > Convert.ToInt32(newcode1.Substring(newcode1.Length - 4, 4))) + // { + // newcode1 = newcode1.Substring(0, newcode1.Length - 4) + + // newcode.Substring(newcode.Length - 4, 4); + // NewOneCode1 = NewOneCode1.Substring(0, NewOneCode1.Length - 4) + newcode.Substring(newcode.Length - 4, 4); + // } + // else + // { + // newcode = newcode.Substring(0, newcode.Length - 4) + newcode1.Substring(newcode1.Length - 4, 4); + // NewOneCode = NewOneCode.Substring(0, NewOneCode.Length - 4) + newcode1.Substring(newcode1.Length - 4, 4); + // } + //} + #endregion + + #region 插入tb_barcode表记录 + + part = newcode.Split('.'); + md.ID = Guid.NewGuid().ToString(); + md.StationID = dt.Rows[0]["StationID"].ToString(); + md.OneBarCode = NewOneCode; + md.BarCode = newcode; + md.StockNo = dt.Rows[0]["StockNo"].ToString(); + md.PrintType = 0; + md.PlanID = planID; + md.BatchNo = textBox1.Text; + + DataTable pdt = productBll.SearchIsImportByStockNo(NewOneCode.Substring(0, 10)); + if (pdt != null && pdt.Rows.Count > 0) + { + if (pdt.Rows[0]["isImport"].ToString() == "1") + { + md.Import = "国产料Kingfa"; + } + else + { + md.Import = ""; + } + } + + if (Barbll.Add_Info(md)) + { + #region 打印条码 右 + + //filename = @"D:\111 - 副本.grf"; + filename = _printTemplateName; + DataTable headTable = new DataTable(); + headTable.Columns.Add("StationNo"); + headTable.Columns.Add("OneBarCode"); + headTable.Columns.Add("newcode"); + headTable.Columns.Add("ProductName"); + headTable.Columns.Add("IsImport"); + DataRow row = headTable.NewRow(); + row["StationNo"] = Program.station; + row["OneBarCode"] = NewOneCode; + row["BarCode"] = newcode; + row["ProductName"] = dt.Rows[0]["ProductName"].ToString()+";"; + row["IsImport"] = md.Import; + reportName = ConfigurationManager.AppSettings["Printer2"]; + headTable.Rows.Add(row); + + //ReportHelper rp = new ReportHelper(filename, headTable, null, + // (int)GRPaperOrientation.grpoDefault, 1, reportName); + //rp.Report.Print(false); + + MyReport report2 = new MyReport(filename, headTable, null, reportName); + report2.Report.Printer.PrinterName = reportName; + report2.Report.Print(false); + #endregion + + LogHelper.WriteLog("打印时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ";" + NewOneCode); + + Barbll.Update_Info(md); + } + else + { + MessageBox.Show("连接数据库超时!"); + timer1.Interval = Program.interVal; + timer1.Start(); + return; + } + + #endregion + + #region 插入tb_barcode表记录 + + part = newcode.Split('.'); + md.ID = Guid.NewGuid().ToString(); + md.StationID = dt.Rows[0]["StationID"].ToString(); + md.OneBarCode = NewOneCode1; + md.BarCode = newcode1; + md.StockNo = prdt.Rows[0]["StockNo"].ToString(); + md.PrintType = 0; + md.PlanID = planID; + md.BatchNo = textBox1.Text; + + DataTable pdt2 = productBll.SearchIsImportByStockNo(NewOneCode.Substring(0, 10)); + if (pdt2 != null && pdt2.Rows.Count > 0) + { + if (pdt2.Rows[0]["isImport"].ToString() == "1") + { + md.Import = "国产料Kingfa"; + } + else + { + md.Import = ""; + } + } + + if (Barbll.Add_Info(md)) + { + #region 打印条码 左 + + //filename = @"D:\111 - 副本.grf"; + filename = _printTemplateName; + DataTable headTable1 = new DataTable(); + headTable1.Columns.Add("StationNo"); + headTable1.Columns.Add("OneBarCode"); + headTable1.Columns.Add("newcode"); + headTable1.Columns.Add("ProductName"); + headTable1.Columns.Add("IsImport"); + DataRow row1 = headTable1.NewRow(); + row1["StationNo"] = Program.station; + row1["OneBarCode"] = NewOneCode1; + row1["BarCode"] = newcode1; + row1["ProductName"] = dt.Rows[0]["ProductName"].ToString().TrimEnd() + .Substring(0, dt.Rows[0]["ProductName"].ToString().TrimEnd().Length - 3) + "左门槛"+";"; + row1["IsImport"] = md.Import; + reportName = ConfigurationManager.AppSettings["Printer1"]; + headTable1.Rows.Add(row1); + + //ReportHelper rp1 = new ReportHelper(filename, headTable1, null, + // (int)GRPaperOrientation.grpoDefault, 1, reportName); + //rp1.Report.Print(false); + + MyReport report2 = new MyReport(filename, headTable1, null, reportName); + report2.Report.Printer.PrinterName = reportName; + report2.Report.Print(false); + #endregion + + LogHelper.WriteLog("打印时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ";" + NewOneCode1); + + Barbll.Update_Info(md); + } + else + { + MessageBox.Show("连接数据库超时!"); + timer1.Interval = Program.interVal; + timer1.Start(); + return; + } + + #endregion + + } + #endregion + } + } + else + { + #region 不是门槛 + + //dt2 = brbll.SearchInfoByStock(dt.Rows[0]["StockNo"].ToString().Trim()); + //if (dt2 != null && dt2.Rows.Count > 0) + //{ + // code = dt2.Rows[0]["BarCode"].ToString().Trim(); + // newcode = code.Substring(0, code.Length - 4) + + // (Convert.ToInt32(code.Substring(code.Length - 4, 4)) + 1).ToString() + // .PadLeft(4, '0'); + // OneCode = dt2.Rows[0]["OneBarCode"].ToString().Trim(); + // NewOneCode = OneCode.Substring(0, OneCode.Length - 4) + (Convert.ToInt32(OneCode.Substring(OneCode.Length - 4, 4)) + 1).ToString().PadLeft(4, '0'); + //} + //else + //{ + // ReloadProduceDate(); + // //按照二维码的生成规则 + // newcode = dt.Rows[0]["PartNo"].ToString().Trim() + "." + Program.ProductDate.Substring(2, 2) + Program.ProductDate.Substring(5, 2) + Program.ProductDate.Substring(8, 2) + "." + "0001"; + // NewOneCode = dt.Rows[0]["StockNo"].ToString().Trim() + Program.ProductDate.Substring(2, 2) + Program.ProductDate.Substring(5, 2) + Program.ProductDate.Substring(8, 2) + "0001"; + //} + + string batch = Program.ProductDate.Substring(2, 2) + Program.ProductDate.Substring(5, 2) + Program.ProductDate.Substring(8, 2); + NewOneCode = BasicDAL.GetSjBarCodeSerialNo(dt.Rows[0]["StockNo"].ToString().Trim(), batch); + newcode = dt.Rows[0]["PartNo"].ToString().Trim() + "." + batch + "." + NewOneCode.Substring(16, 4); + + + //dt2.Dispose(); + //插入tb_barcode表记录 + + part = newcode.Split('.'); + md.ID = Guid.NewGuid().ToString(); + md.StationID = dt.Rows[0]["StationID"].ToString(); + md.OneBarCode = NewOneCode; + md.BarCode = newcode; + md.StockNo = dt.Rows[0]["StockNo"].ToString(); + md.PrintType = 0; + md.PlanID = planID; + md.BatchNo = textBox1.Text; + + DataTable pdt = productBll.SearchIsImportByStockNo(NewOneCode.Substring(0, 10));//查tb_Product表信息 + if (pdt != null && pdt.Rows.Count > 0) + { + if (pdt.Rows[0]["isImport"].ToString() == "1") + { + md.Import = "国产料Kingfa"; + } + else + { + md.Import = ""; + } + } + if (Barbll.Add_Info(md)) + { + #region 打印条码 + + //filename = @"D:\111 - 副本.grf"; + filename = _printTemplateName; + DataTable headTable = new DataTable(); + headTable.Columns.Add("StationNo"); + headTable.Columns.Add("OneBarCode"); + headTable.Columns.Add("BarCode"); + headTable.Columns.Add("ProductName"); + headTable.Columns.Add("IsImport"); + DataRow row = headTable.NewRow(); + row["StationNo"] = Program.station; + + row["OneBarCode"] = NewOneCode; + row["BarCode"] = newcode; + row["ProductName"] = dt.Rows[0]["ProductName"]+";"; + row["IsImport"] = md.Import; + reportName = ConfigurationManager.AppSettings["Printer1"]; + headTable.Rows.Add(row); + + ReportHelper rp = new ReportHelper(filename, headTable, null, + (int)GRPaperOrientation.grpoDefault, 1, reportName); + rp.Report.Print(false); + + #endregion + + LogHelper.WriteLog("打印时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ";" + NewOneCode); + + Barbll.Update_Info(md);//更新打印时间 + } + else + { + MessageBox.Show("连接数据库超时!"); + timer1.Interval = Program.interVal; + timer1.Start(); + return; + } + + #endregion + } + } + + #endregion + oldTime = newTime; + } + } + } + + initBarCode(); + + } + else + { + MessageBox.Show("连接称重仪失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + timer1.Interval = Program.interVal; + timer1.Start(); + } + } + else + { + MessageBox.Show("连接称重仪失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + timer1.Interval = Program.interVal; + timer1.Start(); + } + } + catch (Exception ex) + { + LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); + MessageBox.Show(ex.ToString(), "提示", MessageBoxButtons.OK); + + //MessageBox.Show("数据库连接失败!", "提示", MessageBoxButtons.OK); + timer1.Interval = Program.interVal; + timer1.Start(); + + } + timer1.Interval = Program.interVal; + timer1.Start(); + } + void ReloadProduceDate() + { + if (DateTime.Parse(Program.ProductDate).ToString("yyyy-MM-dd") != DateTime.Now.ToString("yyyy-MM-dd")) + { + FrmLogin.SetProductDate(); + } + } + + private void label12_Click(object sender, EventArgs e) + { + try + { + if (label12.Text == "暂停打印") + { + DialogResult result = MessageBox.Show("确认暂停打印?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); + if (result == DialogResult.OK) + { + timer1.Stop(); + IsStart = false; + label12.Text = "开始打印"; + label12.BackColor = System.Drawing.Color.Gray; + } + else + { + return; + } + } + + else + { + DialogResult result = MessageBox.Show("确认开始打印?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); + if (result == DialogResult.OK) + { + IsStart = true; + timer1.Start(); + label12.Text = "暂停打印"; + label12.BackColor = System.Drawing.Color.DeepSkyBlue; + } + else + { + return; + } + } + } + catch (Exception ex) + { + LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); + } + } + + /// + /// 手工打印 + /// + /// + /// + private void label19_Click(object sender, EventArgs e) + { + string code = "",stationID="",OneCode=""; + string newcode = "", partNo = "", stockNo = "", NewOneCode = "", filename = "", reportName = "", ProductName=""; + + try + { + #region 数据合法性判断 + + if (comboBox2.Text.Trim() == "") + { + MessageBox.Show("请选择产品!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + + if (textBox1.Text.Trim() == "") + { + MessageBox.Show("请输入批次!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + + if (textBox1.Text.Trim().Length != 6) + { + MessageBox.Show("批次格式不正确!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + + if (textBox2.Text.Trim() == "") + { + MessageBox.Show("请输入数量!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + if (!IsNumeric(textBox2.Text.Trim())) + { + MessageBox.Show("数量格式不正确!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + + if (Convert.ToInt32(textBox2.Text.Trim()) > 10) + { + MessageBox.Show("数量不能大于10!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + + #endregion + + #region 获取工位编号 + + //StationBLL sbll = new StationBLL(); + //DataTable sdt = sbll.SearchInfoByNo(Program.station); + //if (sdt != null && sdt.Rows.Count > 0) + //{ + // stationID = sdt.Rows[0]["StationID"].ToString(); + //} + //sdt.Dispose(); + + List stationList = _stationTable.AsEnumerable().Where(p => p.Field("StationNo") == Program.station).ToList(); + if (stationList != null && stationList.Count > 0) + { + stationID = stationList[0]["StationID"].ToString(); + } + + #endregion + + DialogResult result = MessageBox.Show("确定手工打印条码?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); + if (result == DialogResult.OK) + { + #region 生成条码 + + ProductBLL pbll = new ProductBLL(); + + //查询零件号 + DataTable pdt = pbll.SearchInfoByName(comboBox2.Text, "2000");//tb_product + if (pdt != null && pdt.Rows.Count > 0) + { + partNo = pdt.Rows[0]["PartNo"].ToString().Trim(); + stockNo = pdt.Rows[0]["StockNo"].ToString().Trim(); + //ProductName = pdt.Rows[0]["ProductName"].ToString().Trim(); + } + + pdt.Dispose(); + + + + //根据零件号、批次号查找 + + BarCodeBLL bll = new BarCodeBLL(); + BarCodeModel md = new BarCodeModel(); + + for (int i = 1; i <= Convert.ToInt32(textBox2.Text.Trim()); i++) + { + + string batch = textBox1.Text.Trim(); + NewOneCode = BasicDAL.GetSjBarCodeSerialNo(stockNo, batch); + newcode = partNo + "." + batch + "." + NewOneCode.Substring(16, 4); + string[] part = newcode.Split('.'); + //存入tb_BarCode表 + md.ID = Guid.NewGuid().ToString(); + md.StationID = stationID; + md.OneBarCode = NewOneCode; + md.BarCode = newcode; + + md.StockNo = stockNo; + md.PrintType = 1; + md.BatchNo = textBox1.Text.Trim(); + + DataTable pdt1 = pbll.SearchIsImportByStockNo(NewOneCode.Substring(0, 10)); + if (pdt1 != null && pdt1.Rows.Count > 0) + { + if (pdt1.Rows[0]["isImport"].ToString() == "1") + { + md.Import = "国产料Kingfa"; + } + else + { + md.Import = ""; + } + } + + if (bll.Add_Info(md)) + { + #region 打印条码 + + //filename = @"D:\111 - 副本.grf"; + filename = _printTemplateName; + DataTable headTable = new DataTable(); + headTable.Columns.Add("StationNo"); + headTable.Columns.Add("OneBarCode"); + headTable.Columns.Add("BarCode"); + headTable.Columns.Add("ProductName"); + headTable.Columns.Add("IsImport"); + DataRow row = headTable.NewRow(); + row["StationNo"] = Program.station; + + row["OneBarCode"] = NewOneCode; + row["BarCode"] = newcode; + row["ProductName"] = comboBox2.Text + ";"; + row["IsImport"] = md.Import; + if (comboBox2.Text.Contains("右")) + { + reportName = ConfigurationManager.AppSettings["Printer2"]; + } + else + { + reportName = ConfigurationManager.AppSettings["Printer1"]; + } + + headTable.Rows.Add(row); + + ReportHelper rp = new ReportHelper(filename, headTable, null, + (int)GRPaperOrientation.grpoDefault, 1, reportName); + rp.Report.Print(false); + + #endregion + + LogHelper.WriteLog("打印时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ";" + NewOneCode); + + bll.Update_Info(md); + } + else + { + MessageBox.Show("连接数据库超时!"); + return; + } + } + + + + + // DataTable dt = bll.SearchSerialNoByBarCode(stockNo, textBox1.Text.Trim()); //tb_barCode stockNo和批次 + ////tb_barcode有历史记录 + // if (dt != null && dt.Rows.Count > 0) + // { + // OneCode = dt.Rows[0]["OneBarCode"].ToString().Trim(); + // code = dt.Rows[0]["BarCode"].ToString().TrimEnd(); + // for (int i = 1; i <= Convert.ToInt32(textBox2.Text.Trim()); i++) + // { + // newcode = code.Substring(0, code.Length - 4) + + // (Convert.ToInt32(code.Substring(code.Length - 4, 4)) + i) + // .ToString() + // .PadLeft(4, '0'); + // NewOneCode = OneCode.Substring(0, OneCode.Length - 4) + + // (Convert.ToInt32(OneCode.Substring(OneCode.Length - 4, 4)) + i).ToString() + // .PadLeft(4, '0'); + + + + + // string[] part = newcode.Split('.'); + // //存入tb_BarCode表 + // md.ID = Guid.NewGuid().ToString(); + // md.StationID = stationID; + // md.OneBarCode = NewOneCode; + // md.BarCode = newcode; + + // md.StockNo = stockNo; + // md.PrintType = 1; + // md.BatchNo=textBox1.Text.Trim(); + + // DataTable pdt1 = pbll.SearchIsImportByStockNo(NewOneCode.Substring(0, 10)); + // if (pdt1 != null && pdt1.Rows.Count > 0) + // { + // if (pdt1.Rows[0]["isImport"].ToString() == "1") + // { + // md.Import = "国产料Kingfa"; + // } + // else + // { + // md.Import = ""; + // } + // } + + // if ( bll.Add_Info(md)) + // { + // #region 打印条码 + + // filename = @"D:\111 - 副本.grf"; + // filename = _printTemplateName; + // DataTable headTable = new DataTable(); + // headTable.Columns.Add("StationNo"); + // headTable.Columns.Add("OneBarCode"); + // headTable.Columns.Add("BarCode"); + // headTable.Columns.Add("ProductName"); + // headTable.Columns.Add("IsImport"); + // DataRow row = headTable.NewRow(); + // row["StationNo"] = Program.station; + + // row["OneBarCode"] = NewOneCode; + // row["BarCode"] = newcode; + // row["ProductName"] = comboBox2.Text + ";"; + // row["IsImport"] = md.Import; + // if (comboBox2.Text.Contains("右")) + // { + // reportName = ConfigurationManager.AppSettings["Printer2"]; + // } + // else + // { + // reportName = ConfigurationManager.AppSettings["Printer1"]; + // } + + // headTable.Rows.Add(row); + + // ReportHelper rp = new ReportHelper(filename, headTable, null, + // (int)GRPaperOrientation.grpoDefault, 1, reportName); + // rp.Report.Print(false); + + // #endregion + + // LogHelper.WriteLog("打印时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ";" + NewOneCode); + + // bll.Update_Info(md); + // } + // else + // { + // MessageBox.Show("连接数据库超时!"); + // return; + // } + + // #region 更新产量表、计划表 + + // //ProductOfInjectionBLL InjectionBll = new ProductOfInjectionBLL(); + // //ProductOfInjectionModel pmd = new ProductOfInjectionModel(); + + + // //pmd.ID = Guid.NewGuid().ToString(); + // //pmd.StationID = md.StationID; + // //pmd.ProductDate = Program.ProductDate; + // //pmd.ClassName = Program.Shift; + // //pmd.StockNo = md.StockNo; + // //pmd.PartNo = part[0]; + // //pmd.ProductCount = 1; + // //pmd.BadCount = 0; + // //pmd.PlanID = planID; + // //DataTable pdt1 = InjectionBll.SearchCountByInfo(md.StationID, Program.ProductDate, comboBox1.Text, + // // md.StockNo, part[0]); + + // //if (pdt1 != null && pdt1.Rows.Count > 0) + // //{ + // // //跟新 + // // InjectionBll.Update_Info(pmd); + // //} + // //else + // //{ + + // // //插入 + // // InjectionBll.Add_Info(pmd); + // //} + // //pdt1.Dispose(); + + // #region 注释掉 + + // //InjectionPlanBLL ibll = new InjectionPlanBLL(); + // //InjectionPlanModel imd = new InjectionPlanModel(); + + // //imd.CompleteCount = 1; + // //imd.StationID = md.StationID; + // //imd.StockNo = md.StockNo; + // //ibll.UpdateCount(imd); + + // #endregion + + // #endregion + // } + // } + // else + // { + // for (int i = 1; i <= Convert.ToInt32(textBox2.Text.Trim()); i++) + // { + // newcode = partNo + "." + textBox1.Text.Trim() + "." + i.ToString().PadLeft(4, '0'); + // NewOneCode = stockNo + textBox1.Text.Trim() + i.ToString().PadLeft(4, '0'); + // string[] part = newcode.Split('.'); + // //存入tb_BarCode表 + // md.ID = Guid.NewGuid().ToString(); + // md.StationID = stationID; + // md.StockNo = stockNo; + // md.OneBarCode = NewOneCode; + // md.BarCode = newcode; + // md.PrintType = 1; + // md.BatchNo = textBox1.Text; + + // DataTable pdt1 = pbll.SearchIsImportByStockNo(NewOneCode.Substring(0, 10)); //tb_Product表 是否进口(Import) + // if (pdt1 != null && pdt1.Rows.Count > 0) + // { + // if (pdt1.Rows[0]["isImport"].ToString() == "1") + // { + // md.Import = "国产料Kingfa"; + // } + // else + // { + // md.Import = ""; + // } + // } + + // if ( bll.Add_Info(md)) + // { + // #region 打印条码 + + // filename = @"D:\111 - 副本.grf"; + // filename = _printTemplateName; + // DataTable headTable = new DataTable(); + // headTable.Columns.Add("StationNo"); + // headTable.Columns.Add("OneBarCode"); + // headTable.Columns.Add("BarCode"); + // headTable.Columns.Add("ProductName"); + // headTable.Columns.Add("IsImport"); + // DataRow row = headTable.NewRow(); + // row["StationNo"] = Program.station; + + // row["OneBarCode"] = NewOneCode; + // row["BarCode"] = newcode; + // row["ProductName"] = comboBox2.Text + ";"; + // row["IsImport"] = md.Import; + // if (comboBox2.Text.Contains("右")) + // { + // reportName = ConfigurationManager.AppSettings["Printer2"]; + // } + // else + // { + // reportName = ConfigurationManager.AppSettings["Printer1"]; + // } + + // headTable.Rows.Add(row); + + // ReportHelper rp = new ReportHelper(filename, headTable, null, + // (int)GRPaperOrientation.grpoDefault, 1, reportName); + // rp.Report.Print(false); + + // #endregion + + // LogHelper.WriteLog("打印时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ";" + NewOneCode); + + // bll.Update_Info(md); + // } + // else + // { + // MessageBox.Show("连接数据库超时!"); + // return; + // } + + // #region 更新产量表、计划表 + + // //ProductOfInjectionBLL InjectionBll = new ProductOfInjectionBLL(); + // //ProductOfInjectionModel pmd = new ProductOfInjectionModel(); + + // //pmd.ID = Guid.NewGuid().ToString(); + // //pmd.StationID = md.StationID; + // //pmd.ProductDate = Program.ProductDate; + // //pmd.ClassName = Program.Shift; + // //pmd.StockNo = md.StockNo; + // //pmd.PartNo = part[0]; + // //pmd.ProductCount = 1; + // //pmd.BadCount = 0; + // //pmd.PlanID = planID; + // //DataTable pdt1 = InjectionBll.SearchCountByInfo(md.StationID, Program.ProductDate, comboBox1.Text, + // // md.StockNo, part[0]); + + // //if (pdt1 != null && pdt1.Rows.Count > 0) + // //{ + // // //跟新 + // // InjectionBll.Update_Info(pmd); + // //} + // //else + // //{ + + // // //插入 + // // InjectionBll.Add_Info(pmd); + // //} + // //pdt1.Dispose(); + + // #region 注释掉 + + // //InjectionPlanBLL ibll = new InjectionPlanBLL(); + // //InjectionPlanModel imd = new InjectionPlanModel(); + + // //imd.CompleteCount = 1; + // //imd.StationID = md.StationID; + // //imd.StockNo = md.StockNo; + // //ibll.UpdateCount(imd); + + // #endregion + + // #endregion + + // } + // } + + #endregion + + initBarCode(); + } + else + { + return; + } + } + catch (Exception ex) + { + LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); + } + + } + + private static bool IsNumeric(string str) + { + System.Text.RegularExpressions.Regex reg1 = new System.Text.RegularExpressions.Regex(@"^[0-9]\d*$"); + return reg1.IsMatch(str); + } + + /// + /// 补打条码 + /// + /// + /// + private void label18_Click(object sender, EventArgs e) + { + textBox3.Text = ""; + panel3.Visible = true; + } + + + public DateTime GetDateTime() + { + string sql = ""; + DateTime time; + DataTable dt; + try + { + sql = @"select convert(char(23),getdate(),121) as time"; + + dt = SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, null).Tables[0]; + if (dt != null && dt.Rows.Count > 0) + { + //time = Convert.ToDateTime(dt.Rows[0]["time"].ToString()); + time = DateTime.ParseExact(dt.Rows[0]["time"].ToString(), "yyyy-MM-dd HH:mm:ss.fff", + System.Globalization.CultureInfo.CurrentCulture); + + } + else + { + time = DateTime.Now; + } + return time; + } + catch (Exception ex) + { + LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); + return DateTime.Now; + } + } + + private void ReportInitialize() + { + + } + + private void ReportFetchRecord() + { + + } + + /// + /// 切换一下计划 + /// + /// + /// + private void label13_Click(object sender, EventArgs e) + { + string stationID = "",nextPlan=""; + InjectionPlanBLL bll = new InjectionPlanBLL(); + InjectionPlanModel md = new InjectionPlanModel(); + + try + { + #region 获取下一计划 + + DataTable dt = bll.NextSearchInfoByName(Program.station); + if (dt != null && dt.Rows.Count > 1) + { + nextPlan = dt.Rows[1]["ProductName"].ToString(); + } + else + { + nextPlan = "暂无下一计划,请联系计划员"; + } + + #endregion + DialogResult result = MessageBox.Show("确定切换下一计划:"+nextPlan, "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); + if (result == DialogResult.OK) + { + #region 获取工位编号 + + //StationBLL sbll = new StationBLL(); + //DataTable sdt = sbll.SearchInfoByNo(Program.station); + //if (sdt != null && sdt.Rows.Count > 0) + //{ + // stationID = sdt.Rows[0]["StationID"].ToString(); + //} + //sdt.Dispose(); + + List stationList = _stationTable.AsEnumerable().Where(p => p.Field("StationNo") == Program.station).ToList(); + if (stationList != null && stationList.Count > 0) + { + stationID = stationList[0]["StationID"].ToString(); + } + #endregion + + #region 更新计划完成 + + md.StationID = stationID; + bll.UpdateFinish(md); + + #endregion + MessageBox.Show("操作成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + else + { + MessageBox.Show("取消操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + } + catch (Exception ex) + { + LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); + } + + + } + + /// + /// 手动删除 + /// + /// + /// + private void label20_Click(object sender, EventArgs e) + { + BarCodeBLL bll=new BarCodeBLL(); + BarCodeModel md=new BarCodeModel(); + + try + { + if (glacialList1.SelectedItems.Count == 0) + { + MessageBox.Show("请选择要补打的条码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + else + { + GlacialComponents.Controls.GLItem gv; + gv = glacialList1.SelectedItems[0] as GlacialComponents.Controls.GLItem; + md.BarCode = gv.Text; + + bll.DelBarCode(md); + initBarCode(); + } + } + catch (Exception ex) + { + LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); + } + + } + + private void label21_Click(object sender, EventArgs e) + { + Form fr=new FrmDown(); + fr.Show(); + //this.Hide(); + } + + private void label2_Click(object sender, EventArgs e) + { + Environment.Exit(0); + } + + private void textBox2_Click(object sender, EventArgs e) + { + //Process.Start(@"C:\windows\system32\osk.exe"); + ShowInputPanel(); + } + + private const Int32 WM_SYSCOMMAND = 274; + + private const UInt32 SC_CLOSE = 61536; + + [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] + + private static extern bool PostMessage(IntPtr hWnd, int Msg, int wParam, int lParam); + + [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] + + private static extern bool PostMessage(IntPtr hWnd, int Msg, uint wParam, uint lParam); + + [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] + + private static extern bool PostMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam); + + [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] + + private static extern IntPtr FindWindow(string lpClassName, string lpWindowName); + + [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] + + private static extern int RegisterWindowMessage(string lpString); + + + + //显示屏幕键盘 + + public static int ShowInputPanel() + { + + try + { + + dynamic file = "C:\\Program Files\\Common Files\\microsoft shared\\ink\\TabTip.exe"; + + if (!System.IO.File.Exists(file)) + + return -1; + + Process.Start(file); + + //return SetUnDock(); //不知SetUnDock()是什么,所以直接注释返回1 + + return 1; + + } + + catch (Exception) + { + + return 255; + + } + + } + + private void button1_Click(object sender, EventArgs e) + { + if (textBox3.Text.Trim() != ConfigurationManager.AppSettings["Psw"]) + { + MessageBox.Show("密码不正确!", "提示", MessageBoxButtons.OK); + textBox3.SelectAll(); + return; + } + else + { + panel3.Visible = false; + textBox3.Text = ""; + string code = "",productName="", reportName=""; + BarCodeModel md = new BarCodeModel(); + BarCodeBLL bll = new BarCodeBLL(); + ProductBLL pbll = new ProductBLL(); + try + { + if (code_g=="") + { + MessageBox.Show("请选择要补打的条码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + else + { + //GlacialComponents.Controls.GLItem gv; + //gv = glacialList1.SelectedItems[0] as GlacialComponents.Controls.GLItem; + //code = gv.Text; + + DataTable dt = bll.SearchInfoByBarCode(code_g); + if (dt != null && dt.Rows.Count > 0) + { + md.ID = Guid.NewGuid().ToString(); + md.BarCode = code_g; + md.StationID = dt.Rows[0]["StationID"].ToString(); + md.StockNo = dt.Rows[0]["StockNo"].ToString(); + md.OneBarCode = dt.Rows[0]["OneBarCode"].ToString(); + md.PrintType = 2; + //md.CreateTime = GetDateTime(); + + DataTable pdt = pbll.SearchIsImportByStockNo(md.StockNo); + if (pdt != null && pdt.Rows.Count > 0) + { + productName = pdt.Rows[0]["ProductName"].ToString(); + if (pdt.Rows[0]["isImport"].ToString() == "1") + { + md.Import = "国产料Kingfa"; + } + else + { + md.Import = ""; + } + } + + } + dt.Dispose(); + if (bll.Add_Info(md)) + { + #region 打印条码 + + //string filename = @"D:\111 - 副本.grf"; + string filename = _printTemplateName; + DataTable headTable = new DataTable(); + headTable.Columns.Add("StationNo"); + headTable.Columns.Add("OneBarCode"); + headTable.Columns.Add("BarCode"); + headTable.Columns.Add("ProductName"); + headTable.Columns.Add("IsImport"); + DataRow row = headTable.NewRow(); + row["StationNo"] = Program.station; + row["OneBarCode"] = md.OneBarCode; + row["BarCode"] = code_g; + row["ProductName"] = productName+";"; + row["IsImport"] = md.Import; + if (productName.Contains("右")) + { + reportName = ConfigurationManager.AppSettings["Printer2"]; + } + else + { + reportName = ConfigurationManager.AppSettings["Printer1"]; + } + + headTable.Rows.Add(row); + + ReportHelper rp = new ReportHelper(filename, headTable, null, + (int)GRPaperOrientation.grpoDefault, 1, reportName); + rp.Report.Print(false); + + #endregion + + bll.Update_Info(md); + } + else + { + MessageBox.Show("连接数据库超时!"); + return; + } + + glacialList1.SelectedItems.Clear(); + initBarCode(); + } + } + catch (Exception ex) + { + LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); + } + } + } + + private void button2_Click(object sender, EventArgs e) + { + textBox3.Text = ""; + panel3.Visible = false; + } + + private void textBox3_Click(object sender, EventArgs e) + { + ShowInputPanel(); + } + + private void FrmBarCode_FormClosed(object sender, FormClosedEventArgs e) + { + Environment.Exit(0); + } + + private void glacialList1_Click(object sender, EventArgs e) + { + code_g = ""; + if (glacialList1.SelectedItems.Count == 0) + { + code_g = ""; + } + else + { + GlacialComponents.Controls.GLItem gv; + gv = glacialList1.SelectedItems[0] as GlacialComponents.Controls.GLItem; + code_g = gv.Text; + } + } + + private void textBox3_KeyDown(object sender, KeyEventArgs e) + { + + } + + } +} diff --git a/InjectionPC/FrmLogin.Designer.cs b/InjectionPC/FrmLogin.Designer.cs index 3aa7d71..768ad1e 100644 --- a/InjectionPC/FrmLogin.Designer.cs +++ b/InjectionPC/FrmLogin.Designer.cs @@ -43,9 +43,10 @@ // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label1.Location = new System.Drawing.Point(216, 194); + this.label1.Location = new System.Drawing.Point(396, 340); + this.label1.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(66, 19); + this.label1.Size = new System.Drawing.Size(117, 34); this.label1.TabIndex = 0; this.label1.Text = "用户名"; // @@ -54,28 +55,31 @@ this.label2.AutoSize = true; this.label2.BackColor = System.Drawing.Color.Transparent; this.label2.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label2.Location = new System.Drawing.Point(216, 247); + this.label2.Location = new System.Drawing.Point(396, 432); + this.label2.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(47, 19); + this.label2.Size = new System.Drawing.Size(83, 34); this.label2.TabIndex = 1; this.label2.Text = "密码"; // // textBox1 // this.textBox1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.textBox1.Location = new System.Drawing.Point(296, 185); + this.textBox1.Location = new System.Drawing.Point(543, 324); + this.textBox1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(159, 29); + this.textBox1.Size = new System.Drawing.Size(288, 45); this.textBox1.TabIndex = 2; this.textBox1.Click += new System.EventHandler(this.textBox1_Click); // // textBox2 // this.textBox2.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.textBox2.Location = new System.Drawing.Point(296, 247); + this.textBox2.Location = new System.Drawing.Point(543, 432); + this.textBox2.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); this.textBox2.Name = "textBox2"; this.textBox2.PasswordChar = '*'; - this.textBox2.Size = new System.Drawing.Size(159, 29); + this.textBox2.Size = new System.Drawing.Size(288, 45); this.textBox2.TabIndex = 3; this.textBox2.Click += new System.EventHandler(this.textBox2_Click); // @@ -83,11 +87,12 @@ // this.button1.BackColor = System.Drawing.Color.LightSkyBlue; this.button1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.button1.Location = new System.Drawing.Point(231, 306); + this.button1.Location = new System.Drawing.Point(424, 536); + this.button1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(84, 38); + this.button1.Size = new System.Drawing.Size(154, 66); this.button1.TabIndex = 4; - this.button1.Text = "登陆"; + this.button1.Text = "登录"; this.button1.UseVisualStyleBackColor = false; this.button1.Click += new System.EventHandler(this.button1_Click); // @@ -95,9 +100,10 @@ // this.button2.BackColor = System.Drawing.Color.LightSkyBlue; this.button2.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.button2.Location = new System.Drawing.Point(387, 306); + this.button2.Location = new System.Drawing.Point(710, 536); + this.button2.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(83, 38); + this.button2.Size = new System.Drawing.Size(152, 66); this.button2.TabIndex = 5; this.button2.Text = "取消"; this.button2.UseVisualStyleBackColor = false; @@ -108,8 +114,9 @@ this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill; this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); this.pictureBox1.Location = new System.Drawing.Point(0, 0); + this.pictureBox1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(703, 453); + this.pictureBox1.Size = new System.Drawing.Size(1289, 793); this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox1.TabIndex = 6; this.pictureBox1.TabStop = false; @@ -117,9 +124,9 @@ // // FrmLogin // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(703, 453); + this.ClientSize = new System.Drawing.Size(1289, 793); this.Controls.Add(this.label2); this.Controls.Add(this.textBox1); this.Controls.Add(this.textBox2); @@ -127,6 +134,7 @@ this.Controls.Add(this.button2); this.Controls.Add(this.label1); this.Controls.Add(this.pictureBox1); + this.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); this.Name = "FrmLogin"; this.Text = "登录"; this.Load += new System.EventHandler(this.FrmLogin_Load); diff --git a/InjectionPC/FrmLogin.cs b/InjectionPC/FrmLogin.cs index 8622a77..bc493ca 100644 --- a/InjectionPC/FrmLogin.cs +++ b/InjectionPC/FrmLogin.cs @@ -91,10 +91,18 @@ namespace InjectionPC DataTable dt=bll.SearchInfoByNameAndPsw(textBox1.Text.Trim(),stationID,textBox2.Text.Trim()); if (dt!=null && dt.Rows.Count >0) { - this.Visible = false; - Form fr=new FrmBarCode(); - //Form fr = new FrmQuality(); - fr.Show(); + try + { + this.Visible = false; + //Form fr = new FrmBarCode(); + Form fr=new FrmBarCodeNew(); + //Form fr = new FrmQuality(); + fr.Show(); + } + catch(Exception ex) + { + + } } else diff --git a/InjectionPC/InjectionPC.csproj b/InjectionPC/InjectionPC.csproj index 34d2467..c065a4c 100644 --- a/InjectionPC/InjectionPC.csproj +++ b/InjectionPC/InjectionPC.csproj @@ -86,6 +86,12 @@ Form1.cs + + Form + + + FrmBarCodeNew.cs + Form @@ -119,6 +125,9 @@ Form1.cs + + FrmBarCodeNew.cs + FrmBarCode.cs @@ -153,7 +162,7 @@ Settings.settings True - + PreserveNewest diff --git a/InjectionPC/Program.cs b/InjectionPC/Program.cs index aadaaa7..2b810b9 100644 --- a/InjectionPC/Program.cs +++ b/InjectionPC/Program.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Windows.Forms; using System.Data; using System.Data.SqlClient; +using System.Text; namespace InjectionPC { @@ -37,6 +38,16 @@ namespace InjectionPC { bool isRuned; System.Threading.Mutex mutex = new System.Threading.Mutex(true, "OnlyRunOneInstance", out isRuned); + + //处理UI线程异常 + + Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); + + //处理非UI线程异常 + + AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); + + if (isRuned) { Application.EnableVisualStyles(); @@ -92,5 +103,49 @@ namespace InjectionPC } } } + static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) + { + string str = GetExceptionMsg(e.Exception, e.ToString()); + MessageBox.Show(str); + //LogManager.WriteLog(str); + } + + + + static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) + { + string str = GetExceptionMsg(e.ExceptionObject as Exception, e.ToString()); + MessageBox.Show(str); + //LogManager.WriteLog(str); + } + static string GetExceptionMsg(Exception ex, string backStr) + + { + StringBuilder sb = new StringBuilder(); + + sb.AppendLine("****************************异常文本****************************"); + + sb.AppendLine("【出现时间】:" + DateTime.Now.ToString()); + + if (ex != null) + { + sb.AppendLine("【异常类型】:" + ex.GetType().Name); + + sb.AppendLine("【异常信息】:" + ex.Message); + + sb.AppendLine("【堆栈调用】:" + ex.StackTrace); + + } + else + { + + sb.AppendLine("【未处理异常】:" + backStr); + + } + + sb.AppendLine("***************************************************************"); + + return sb.ToString(); + } } } diff --git a/InjectionPC/Report/111 - 副本2.grf b/InjectionPC/Report/111 - 副本.grf similarity index 100% rename from InjectionPC/Report/111 - 副本2.grf rename to InjectionPC/Report/111 - 副本.grf diff --git a/InjectionSearch/Form1.Designer.cs b/InjectionSearch/Form1.Designer.cs index 72359c5..da3bd2c 100644 --- a/InjectionSearch/Form1.Designer.cs +++ b/InjectionSearch/Form1.Designer.cs @@ -42,9 +42,10 @@ // pictureBox1 // this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); - this.pictureBox1.Location = new System.Drawing.Point(1, 0); + this.pictureBox1.Location = new System.Drawing.Point(2, 0); + this.pictureBox1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(704, 456); + this.pictureBox1.Size = new System.Drawing.Size(1291, 798); this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox1.TabIndex = 0; this.pictureBox1.TabStop = false; @@ -54,27 +55,30 @@ this.label2.AutoSize = true; this.label2.BackColor = System.Drawing.Color.Transparent; this.label2.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label2.Location = new System.Drawing.Point(224, 234); + this.label2.Location = new System.Drawing.Point(411, 410); + this.label2.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(47, 19); + this.label2.Size = new System.Drawing.Size(83, 34); this.label2.TabIndex = 7; this.label2.Text = "密码"; // // textBox1 // this.textBox1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.textBox1.Location = new System.Drawing.Point(304, 172); + this.textBox1.Location = new System.Drawing.Point(557, 301); + this.textBox1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(159, 29); + this.textBox1.Size = new System.Drawing.Size(288, 45); this.textBox1.TabIndex = 8; // // textBox2 // this.textBox2.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.textBox2.Location = new System.Drawing.Point(304, 234); + this.textBox2.Location = new System.Drawing.Point(557, 410); + this.textBox2.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); this.textBox2.Name = "textBox2"; this.textBox2.PasswordChar = '*'; - this.textBox2.Size = new System.Drawing.Size(159, 29); + this.textBox2.Size = new System.Drawing.Size(288, 45); this.textBox2.TabIndex = 9; this.textBox2.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBox2_KeyDown); // @@ -82,11 +86,12 @@ // this.button1.BackColor = System.Drawing.Color.LightSkyBlue; this.button1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.button1.Location = new System.Drawing.Point(239, 293); + this.button1.Location = new System.Drawing.Point(438, 513); + this.button1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(84, 38); + this.button1.Size = new System.Drawing.Size(154, 66); this.button1.TabIndex = 10; - this.button1.Text = "登陆"; + this.button1.Text = "登录"; this.button1.UseVisualStyleBackColor = false; this.button1.Click += new System.EventHandler(this.button1_Click); // @@ -94,28 +99,31 @@ // this.button2.BackColor = System.Drawing.Color.LightSkyBlue; this.button2.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.button2.Location = new System.Drawing.Point(395, 293); + this.button2.Location = new System.Drawing.Point(724, 513); + this.button2.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(83, 38); + this.button2.Size = new System.Drawing.Size(152, 66); this.button2.TabIndex = 11; this.button2.Text = "取消"; this.button2.UseVisualStyleBackColor = false; + this.button2.Click += new System.EventHandler(this.button2_Click); // // label1 // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label1.Location = new System.Drawing.Point(224, 181); + this.label1.Location = new System.Drawing.Point(411, 317); + this.label1.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(66, 19); + this.label1.Size = new System.Drawing.Size(117, 34); this.label1.TabIndex = 6; this.label1.Text = "用户名"; // // FrmLogin // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(703, 453); + this.ClientSize = new System.Drawing.Size(1289, 793); this.Controls.Add(this.label2); this.Controls.Add(this.textBox1); this.Controls.Add(this.textBox2); @@ -123,6 +131,7 @@ this.Controls.Add(this.button2); this.Controls.Add(this.label1); this.Controls.Add(this.pictureBox1); + this.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); this.Name = "FrmLogin"; this.Text = "登录"; ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); diff --git a/InjectionSearch/Form1.cs b/InjectionSearch/Form1.cs index 6284b51..f9c0ccb 100644 --- a/InjectionSearch/Form1.cs +++ b/InjectionSearch/Form1.cs @@ -66,7 +66,7 @@ namespace InjectionSearch DataTable dt = bll.SearchInfoByNameAndPsw(textBox1.Text.Trim(), stationID, textBox2.Text.Trim()); if (dt != null && dt.Rows.Count > 0) { - Form fr = new FrmBarCodeSearch(); + Form fr = new FrmBarCodeSearchNew(); fr.Show(); this.Hide(); } @@ -106,5 +106,10 @@ namespace InjectionSearch Login(); } } + + private void button2_Click(object sender, EventArgs e) + { + this.Close(); + } } } diff --git a/InjectionSearch/FrmBarCodeSearch.cs b/InjectionSearch/FrmBarCodeSearch.cs index c0d98b1..b12ac9d 100644 --- a/InjectionSearch/FrmBarCodeSearch.cs +++ b/InjectionSearch/FrmBarCodeSearch.cs @@ -65,6 +65,7 @@ namespace InjectionSearch private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { + if (string.IsNullOrEmpty(comboBox1.Text) || comboBox1.Text.Length<10) return; string stockNo = comboBox1.Text.Substring(0, 10); ProductBLL bll=new ProductBLL(); diff --git a/InjectionSearch/FrmBarCodeSearchNew.Designer.cs b/InjectionSearch/FrmBarCodeSearchNew.Designer.cs new file mode 100644 index 0000000..9e8c42c --- /dev/null +++ b/InjectionSearch/FrmBarCodeSearchNew.Designer.cs @@ -0,0 +1,445 @@ +namespace InjectionSearch +{ + partial class FrmBarCodeSearchNew + { + /// + /// 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() + { + GlacialComponents.Controls.GLColumn glColumn1 = new GlacialComponents.Controls.GLColumn(); + GlacialComponents.Controls.GLColumn glColumn2 = new GlacialComponents.Controls.GLColumn(); + GlacialComponents.Controls.GLColumn glColumn3 = new GlacialComponents.Controls.GLColumn(); + GlacialComponents.Controls.GLColumn glColumn4 = new GlacialComponents.Controls.GLColumn(); + GlacialComponents.Controls.GLColumn glColumn5 = new GlacialComponents.Controls.GLColumn(); + GlacialComponents.Controls.GLColumn glColumn6 = new GlacialComponents.Controls.GLColumn(); + this.label1 = new System.Windows.Forms.Label(); + this.comboBox1 = new System.Windows.Forms.ComboBox(); + this.label2 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.panel1 = new System.Windows.Forms.Panel(); + this.comboBox2 = new System.Windows.Forms.ComboBox(); + this.label7 = new System.Windows.Forms.Label(); + this.label16 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.textBox4 = new System.Windows.Forms.TextBox(); + this.label4 = new System.Windows.Forms.Label(); + this.textBox3 = new System.Windows.Forms.TextBox(); + this.label19 = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.label18 = new System.Windows.Forms.Label(); + this.panel3 = new System.Windows.Forms.Panel(); + this.button1 = new System.Windows.Forms.Button(); + this.label6 = new System.Windows.Forms.Label(); + this.textBox5 = new System.Windows.Forms.TextBox(); + this.glacialList1 = new GlacialComponents.Controls.GlacialList(); + this.panel1.SuspendLayout(); + this.panel3.SuspendLayout(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold); + this.label1.Location = new System.Drawing.Point(90, 59); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(103, 29); + this.label1.TabIndex = 0; + this.label1.Text = "产品:"; + // + // comboBox1 + // + this.comboBox1.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold); + this.comboBox1.FormattingEnabled = true; + this.comboBox1.Location = new System.Drawing.Point(222, 57); + this.comboBox1.Name = "comboBox1"; + this.comboBox1.Size = new System.Drawing.Size(627, 37); + this.comboBox1.TabIndex = 1; + this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold); + this.label2.Location = new System.Drawing.Point(85, 109); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(133, 29); + this.label2.TabIndex = 2; + this.label2.Text = "零件号:"; + // + // textBox1 + // + this.textBox1.Enabled = false; + this.textBox1.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold); + this.textBox1.Location = new System.Drawing.Point(222, 101); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(239, 41); + this.textBox1.TabIndex = 3; + // + // textBox2 + // + this.textBox2.Enabled = false; + this.textBox2.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold); + this.textBox2.Location = new System.Drawing.Point(222, 152); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(627, 41); + this.textBox2.TabIndex = 4; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold); + this.label3.Location = new System.Drawing.Point(90, 163); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(103, 29); + this.label3.TabIndex = 5; + this.label3.Text = "原料:"; + // + // panel1 + // + this.panel1.BackColor = System.Drawing.Color.Aquamarine; + this.panel1.Controls.Add(this.comboBox2); + this.panel1.Controls.Add(this.label7); + this.panel1.Controls.Add(this.label16); + this.panel1.Controls.Add(this.label5); + this.panel1.Controls.Add(this.textBox4); + this.panel1.Controls.Add(this.label4); + this.panel1.Controls.Add(this.textBox3); + this.panel1.Controls.Add(this.label1); + this.panel1.Controls.Add(this.label3); + this.panel1.Controls.Add(this.comboBox1); + this.panel1.Controls.Add(this.textBox2); + this.panel1.Controls.Add(this.label2); + this.panel1.Controls.Add(this.textBox1); + this.panel1.Location = new System.Drawing.Point(185, 541); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(936, 317); + this.panel1.TabIndex = 6; + // + // comboBox2 + // + this.comboBox2.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold); + this.comboBox2.FormattingEnabled = true; + this.comboBox2.Location = new System.Drawing.Point(222, 8); + this.comboBox2.Name = "comboBox2"; + this.comboBox2.Size = new System.Drawing.Size(206, 37); + this.comboBox2.TabIndex = 12; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold); + this.label7.Location = new System.Drawing.Point(90, 16); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(103, 29); + this.label7.TabIndex = 11; + this.label7.Text = "机台:"; + // + // label16 + // + this.label16.AutoSize = true; + this.label16.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label16.Location = new System.Drawing.Point(490, 210); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(141, 29); + this.label16.TabIndex = 10; + this.label16.Text = "(yyMMdd)"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold); + this.label5.Location = new System.Drawing.Point(86, 259); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(103, 29); + this.label5.TabIndex = 8; + this.label5.Text = "数量:"; + // + // textBox4 + // + this.textBox4.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold); + this.textBox4.Location = new System.Drawing.Point(222, 259); + this.textBox4.Name = "textBox4"; + this.textBox4.Size = new System.Drawing.Size(239, 41); + this.textBox4.TabIndex = 9; + this.textBox4.Text = "1000"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold); + this.label4.Location = new System.Drawing.Point(80, 219); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(133, 29); + this.label4.TabIndex = 6; + this.label4.Text = "批次号:"; + // + // textBox3 + // + this.textBox3.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold); + this.textBox3.Location = new System.Drawing.Point(222, 207); + this.textBox3.Name = "textBox3"; + this.textBox3.Size = new System.Drawing.Size(239, 41); + this.textBox3.TabIndex = 7; + // + // label19 + // + this.label19.BackColor = System.Drawing.Color.DeepSkyBlue; + this.label19.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label19.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label19.Location = new System.Drawing.Point(1186, 541); + this.label19.Name = "label19"; + this.label19.Size = new System.Drawing.Size(73, 317); + this.label19.TabIndex = 17; + this.label19.Text = "打印条码"; + this.label19.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label19.Click += new System.EventHandler(this.label19_Click); + // + // label11 + // + this.label11.BackColor = System.Drawing.Color.DeepSkyBlue; + this.label11.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label11.Font = new System.Drawing.Font("宋体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label11.Location = new System.Drawing.Point(2, 541); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(182, 317); + this.label11.TabIndex = 18; + this.label11.Text = "打印信息:"; + this.label11.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // label10 + // + this.label10.BackColor = System.Drawing.Color.DeepSkyBlue; + this.label10.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label10.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label10.Location = new System.Drawing.Point(2, 66); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(182, 475); + this.label10.TabIndex = 19; + this.label10.Text = "打印记录:"; + this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // label18 + // + this.label18.BackColor = System.Drawing.Color.DeepSkyBlue; + this.label18.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.label18.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.label18.Location = new System.Drawing.Point(1114, 541); + this.label18.Name = "label18"; + this.label18.Size = new System.Drawing.Size(73, 317); + this.label18.TabIndex = 20; + this.label18.Text = "补打"; + this.label18.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.label18.Click += new System.EventHandler(this.label18_Click); + // + // panel3 + // + this.panel3.BackColor = System.Drawing.SystemColors.Control; + this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panel3.Controls.Add(this.button1); + this.panel3.Controls.Add(this.label6); + this.panel3.Controls.Add(this.textBox5); + this.panel3.Location = new System.Drawing.Point(2, 2); + this.panel3.Name = "panel3"; + this.panel3.Size = new System.Drawing.Size(1250, 61); + this.panel3.TabIndex = 22; + // + // button1 + // + this.button1.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold); + this.button1.Location = new System.Drawing.Point(1074, 10); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(95, 43); + this.button1.TabIndex = 6; + this.button1.Text = "查询"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold); + this.label6.Location = new System.Drawing.Point(477, 12); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(133, 29); + this.label6.TabIndex = 4; + this.label6.Text = "条码号:"; + // + // textBox5 + // + this.textBox5.Font = new System.Drawing.Font("宋体", 21.75F, System.Drawing.FontStyle.Bold); + this.textBox5.Location = new System.Drawing.Point(626, 9); + this.textBox5.Name = "textBox5"; + this.textBox5.Size = new System.Drawing.Size(415, 41); + this.textBox5.TabIndex = 5; + // + // glacialList1 + // + this.glacialList1.AllowColumnResize = true; + this.glacialList1.AllowMultiselect = false; + this.glacialList1.AlternateBackground = System.Drawing.Color.DarkGreen; + this.glacialList1.AlternatingColors = false; + this.glacialList1.AutoHeight = true; + this.glacialList1.BackColor = System.Drawing.SystemColors.ControlLightLight; + this.glacialList1.BackgroundStretchToFit = true; + glColumn1.ActivatedEmbeddedType = GlacialComponents.Controls.GLActivatedEmbeddedTypes.None; + glColumn1.CheckBoxes = false; + glColumn1.ImageIndex = -1; + glColumn1.Name = "Column1"; + glColumn1.NumericSort = false; + glColumn1.Text = "条码"; + glColumn1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; + glColumn1.Width = 200; + glColumn2.ActivatedEmbeddedType = GlacialComponents.Controls.GLActivatedEmbeddedTypes.None; + glColumn2.CheckBoxes = false; + glColumn2.ImageIndex = -1; + glColumn2.Name = "Column2"; + glColumn2.NumericSort = false; + glColumn2.Text = "产品名称"; + glColumn2.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; + glColumn2.Width = 150; + glColumn3.ActivatedEmbeddedType = GlacialComponents.Controls.GLActivatedEmbeddedTypes.None; + glColumn3.CheckBoxes = false; + glColumn3.ImageIndex = -1; + glColumn3.Name = "Column3"; + glColumn3.NumericSort = false; + glColumn3.Text = "打印方式"; + glColumn3.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; + glColumn3.Width = 80; + glColumn4.ActivatedEmbeddedType = GlacialComponents.Controls.GLActivatedEmbeddedTypes.None; + glColumn4.CheckBoxes = false; + glColumn4.ImageIndex = -1; + glColumn4.Name = "Column4"; + glColumn4.NumericSort = false; + glColumn4.Text = "打印时间"; + glColumn4.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; + glColumn4.Width = 220; + glColumn5.ActivatedEmbeddedType = GlacialComponents.Controls.GLActivatedEmbeddedTypes.None; + glColumn5.CheckBoxes = false; + glColumn5.ImageIndex = -1; + glColumn5.Name = "Column2x"; + glColumn5.NumericSort = false; + glColumn5.Text = "原料名称"; + glColumn5.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; + glColumn5.Width = 250; + glColumn6.ActivatedEmbeddedType = GlacialComponents.Controls.GLActivatedEmbeddedTypes.None; + glColumn6.CheckBoxes = false; + glColumn6.ImageIndex = -1; + glColumn6.Name = "Column3x"; + glColumn6.NumericSort = false; + glColumn6.Text = "原料批次"; + glColumn6.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; + glColumn6.Width = 160; + this.glacialList1.Columns.AddRange(new GlacialComponents.Controls.GLColumn[] { + glColumn1, + glColumn2, + glColumn3, + glColumn4, + glColumn5, + glColumn6}); + this.glacialList1.ControlStyle = GlacialComponents.Controls.GLControlStyles.Normal; + this.glacialList1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.glacialList1.FullRowSelect = true; + this.glacialList1.GridColor = System.Drawing.Color.DeepSkyBlue; + this.glacialList1.GridLines = GlacialComponents.Controls.GLGridLines.gridBoth; + this.glacialList1.GridLineStyle = GlacialComponents.Controls.GLGridLineStyles.gridSolid; + this.glacialList1.GridTypes = GlacialComponents.Controls.GLGridTypes.gridNormal; + this.glacialList1.HeaderHeight = 40; + this.glacialList1.HeaderVisible = true; + this.glacialList1.HeaderWordWrap = false; + this.glacialList1.HotColumnTracking = false; + this.glacialList1.HotItemTracking = false; + this.glacialList1.HotTrackingColor = System.Drawing.Color.LightGray; + this.glacialList1.HoverEvents = false; + this.glacialList1.HoverTime = 1; + this.glacialList1.ImageList = null; + this.glacialList1.ItemHeight = 21; + this.glacialList1.ItemWordWrap = false; + this.glacialList1.Location = new System.Drawing.Point(185, 65); + this.glacialList1.Name = "glacialList1"; + this.glacialList1.Selectable = true; + this.glacialList1.SelectedTextColor = System.Drawing.Color.White; + this.glacialList1.SelectionColor = System.Drawing.Color.Lime; + this.glacialList1.ShowBorder = true; + this.glacialList1.ShowFocusRect = false; + this.glacialList1.Size = new System.Drawing.Size(1074, 473); + this.glacialList1.SortType = GlacialComponents.Controls.SortTypes.InsertionSort; + this.glacialList1.SuperFlatHeaderColor = System.Drawing.Color.White; + this.glacialList1.TabIndex = 23; + this.glacialList1.Text = "glacialList1"; + // + // FrmBarCodeSearch + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1264, 861); + this.Controls.Add(this.glacialList1); + this.Controls.Add(this.panel3); + this.Controls.Add(this.label18); + this.Controls.Add(this.label10); + this.Controls.Add(this.label11); + this.Controls.Add(this.label19); + this.Controls.Add(this.panel1); + this.Name = "FrmBarCodeSearch"; + this.Text = "条码信息"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmBarCodeSearch_FormClosing); + this.Load += new System.EventHandler(this.FrmBarCodeSearch_Load); + this.panel1.ResumeLayout(false); + this.panel1.PerformLayout(); + this.panel3.ResumeLayout(false); + this.panel3.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.ComboBox comboBox1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.TextBox textBox4; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.TextBox textBox3; + private System.Windows.Forms.Label label16; + private System.Windows.Forms.Label label19; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.Label label18; + private System.Windows.Forms.Panel panel3; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.TextBox textBox5; + private GlacialComponents.Controls.GlacialList glacialList1; + private System.Windows.Forms.ComboBox comboBox2; + private System.Windows.Forms.Label label7; + } +} \ No newline at end of file diff --git a/InjectionSearch/FrmBarCodeSearchNew.cs b/InjectionSearch/FrmBarCodeSearchNew.cs new file mode 100644 index 0000000..349efb8 --- /dev/null +++ b/InjectionSearch/FrmBarCodeSearchNew.cs @@ -0,0 +1,566 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Configuration; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using grproLib; +using MESClassLibrary.BLL.BasicInfo; +using MESClassLibrary.BLL.Log; +using MESClassLibrary.DAL; +using MESClassLibrary.Model; +using DataTable = System.Data.DataTable; + +namespace InjectionSearch +{ + public partial class FrmBarCodeSearchNew : Form + { + private string _printTemplateName = string.Empty; + private DataTable _stationTable = null; + public FrmBarCodeSearchNew() + { + InitializeComponent(); + _printTemplateName = Application.StartupPath + "\\Report\\P02 - 副本.grf"; + } + + private void initProduct() + { + comboBox1.Items.Clear(); + + ProductBLL bll = new ProductBLL(); + + DataTable dt = bll.SearchInfoAllByType("2000"); + if (dt != null && dt.Rows.Count > 0) + { + for (int i = 0; i < dt.Rows.Count; i++) + { + comboBox1.Items.Add(dt.Rows[i]["StockNo"].ToString() +"--"+dt.Rows[i]["ProductName"].ToString()); + } + } + dt.Dispose(); + } + + private void initBarCode() + { + BarCodeBLL bll = new BarCodeBLL(); + + glacialList1.Items.Clear(); + DataTable dt = bll.SearchBarCode(); + if (dt != null && dt.Rows.Count > 0) + { + for (int i = 0; i < dt.Rows.Count; i++) + { + glacialList1.Items.Add(i.ToString()); + glacialList1.Items[i].SubItems[0].Text = dt.Rows[i]["BarCode"].ToString(); + glacialList1.Items[i].SubItems[1].Text = dt.Rows[i]["ProductName"].ToString(); + glacialList1.Items[i].SubItems[2].Text = dt.Rows[i]["PrintType"].ToString(); + glacialList1.Items[i].SubItems[3].Text = dt.Rows[i]["PrintTime"].ToString() == "" ? "" : Convert.ToDateTime(dt.Rows[i]["PrintTime"].ToString()).ToString("yyyy-MM-dd HH:mm:ss.fff"); + glacialList1.Items[i].SubItems[4].Text = dt.Rows[i]["MaterialName"].ToString(); + glacialList1.Items[i].SubItems[5].Text = dt.Rows[i]["BatchNo"].ToString(); + } + } + } + + private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(comboBox1.Text) || comboBox1.Text.Length < 10) return; + string stockNo = comboBox1.Text.Substring(0, 10); + + ProductBLL bll=new ProductBLL(); + BomBLL bombll=new BomBLL(); + + DataTable dt = bll.SearchInfoByStock(stockNo); + if (dt != null && dt.Rows.Count > 0) + { + textBox1.Text = dt.Rows[0]["PartNo"].ToString(); + dt.Dispose(); + } + else + { + textBox1.Text = ""; + } + + DataTable dt1 = bombll.SearchBom(textBox1.Text); + if (dt1 != null && dt1.Rows.Count > 0) + { + textBox2.Text = dt1.Rows[0]["PartNo2"].ToString(); + dt.Dispose(); + } + else + { + textBox2.Text = ""; + } + } + + private void FrmBarCodeSearch_Load(object sender, EventArgs e) + { + initProduct(); + initBarCode(); + comboBox2.Items.Clear(); + comboBox2.Items.Add("IM01"); + comboBox2.Items.Add("IM02"); + comboBox2.Items.Add("IM03"); + comboBox2.Items.Add("IM04"); + comboBox2.Items.Add("IM05"); + comboBox2.Items.Add("IM06"); + + StationBLL sbll = new StationBLL(); + _stationTable = sbll.SearchAllInfo(); + + } + private void label18_Click(object sender, EventArgs e) + { + string code = ""; + BarCodeModel md = new BarCodeModel(); + BarCodeBLL bll = new BarCodeBLL(); + ProductBLL pbll=new ProductBLL(); + + try + { + if (glacialList1.SelectedItems.Count == 0) + { + MessageBox.Show("请选择要补打的条码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + else + { + GlacialComponents.Controls.GLItem gv; + gv = glacialList1.SelectedItems[0] as GlacialComponents.Controls.GLItem; + code = gv.Text; + + DataTable dt = bll.SearchInfoByBarCode(code); + if (dt != null && dt.Rows.Count > 0) + { + md.ID = Guid.NewGuid().ToString(); + md.BarCode = code; + md.StationID = Program.StationID; + md.StockNo = dt.Rows[0]["StockNo"].ToString(); + md.OneBarCode = dt.Rows[0]["OneBarCode"].ToString(); + md.StationID2 = dt.Rows[0]["StationID"].ToString(); + md.PrintType = 2; + + DataTable pdt = pbll.SearchIsImportByStockNo(md.StockNo); + if (pdt != null && pdt.Rows.Count > 0) + { + if (pdt.Rows[0]["isImport"].ToString() == "1") + { + md.Import = "国产料Kingfa"; + } + else + { + md.Import = ""; + } + } + //if (md.StockNo == "2200000064" || md.StockNo == "2200000093" || md.StockNo == "2200000096" || + // md.StockNo == "2200000052") + //{ + // md.Import = "国产料Kingfa"; + //} + //else + //{ + // md.Import = ""; + //} + } + dt.Dispose(); + bll.Add_Info(md); + + #region 打印条码 + + GridppReport report = new GridppReport(); + + report.Register(""); + //report.LoadFromFile(@"D:\P02 - 副本.grf"); + report.LoadFromFile(_printTemplateName); + report.ConnectionString = ConfigurationManager.ConnectionStrings["report"].ToString(); + + //report.PrintPreview(true); + report.Print(false); + #endregion + + bll.Update_Info(md); + initBarCode(); + } + } + catch (Exception ex) + { + LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); + } + + } + + public DateTime GetDateTime() + { + string sql = ""; + DateTime time; + DataTable dt; + try + { + sql = @"select getdate() as time"; + + dt = SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, null).Tables[0]; + if (dt != null && dt.Rows.Count > 0) + { + time = Convert.ToDateTime(dt.Rows[0]["time"].ToString()); + + } + else + { + time = DateTime.Now; + } + return time; + } + catch (Exception ex) + { + LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); + return DateTime.Now; + } + } + + private static bool IsNumeric(string str) + { + System.Text.RegularExpressions.Regex reg1 = new System.Text.RegularExpressions.Regex(@"^[0-9]\d*$"); + return reg1.IsMatch(str); + } + + private void label19_Click(object sender, EventArgs e) + { + string code = "", stationID = "", OneCode = ""; + string newcode = "", partNo = "", stockNo = "", NewOneCode = ""; + + try + { + #region 数据合法性判断 + if (comboBox2.Text.Trim() == "") + { + MessageBox.Show("请选择机台!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + + if (comboBox1.Text.Trim() == "") + { + MessageBox.Show("请选择产品!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + + if (textBox3.Text.Trim() == "") + { + MessageBox.Show("请输入批次!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + if (textBox3.Text.Trim().Length != 6) + { + MessageBox.Show("输入批次格式错误(yyMMdd)!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + DateTime dt = DateTime.Now; + if (DateTime.TryParse("20" + textBox3.Text.Trim().Substring(0, 2) + "-" + textBox3.Text.Trim().Substring(2, 2) + "-" + textBox3.Text.Trim().Substring(4, 2), out dt) == false) + { + MessageBox.Show("批次格式错误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + + if (textBox4.Text.Trim() == "") + { + MessageBox.Show("请输入数量!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + if (textBox1.Text.Trim() == "") + { + MessageBox.Show("零件号不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + if (!IsNumeric(textBox4.Text.Trim())) + { + MessageBox.Show("数量格式不正确!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + + if (Convert.ToInt32(textBox4.Text.Trim()) > 1000) + { + MessageBox.Show("数量不能大于1000!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + return; + } + + + #endregion + + #region 获取工位编号 + + // StationBLL sbll = new StationBLL(); + // DataTable sdt = sbll.SearchInfoByNo(comboBox2.Text.Trim()); + List stationList = _stationTable.AsEnumerable().Where(p => p.Field("StationNo") == comboBox2.Text.Trim()).ToList(); + if (stationList != null && stationList.Count > 0) + { + stationID = stationList[0]["StationID"].ToString(); + } + //sdt.Dispose(); + #endregion + + DialogResult result = MessageBox.Show("确定手工打印条码?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); + if (result == DialogResult.OK) + { + #region 生成条码 + + ProductBLL pbll = new ProductBLL(); + + //查询零件号 + stockNo = comboBox1.Text.Substring(0, 10); + partNo = textBox1.Text.Trim(); + + //根据零件号、批次号查找 + + BarCodeBLL bll = new BarCodeBLL(); + BarCodeModel md = new BarCodeModel(); + + for (int i = 1; i <= Convert.ToInt32(textBox4.Text.Trim()); i++) + { + string batch = textBox3.Text.Trim(); + NewOneCode = BasicDAL.GetSjBarCodeSerialNo(stockNo, batch); + newcode = partNo + "." + batch + "." + NewOneCode.Substring(16, 4); + string[] part = newcode.Split('.'); + //存入tb_BarCode表 + md.ID = Guid.NewGuid().ToString(); + md.StationID = Program.StationID; + md.StationID2 = stationID; + md.OneBarCode = NewOneCode; + md.BarCode = newcode; + md.BatchNo = batch; + + md.StockNo = stockNo; + md.PrintType = 1; + + DataTable pdt = pbll.SearchIsImportByStockNo(stockNo); + if (pdt != null && pdt.Rows.Count > 0) + { + if (pdt.Rows[0]["isImport"].ToString() == "1") + { + md.Import = "国产料Kingfa"; + } + else + { + md.Import = ""; + } + } + + if (bll.Add_Info(md)) + { + #region 打印条码 + + GridppReport report = new GridppReport(); + + report.Register(""); + //report.LoadFromFile(@"D:\P02.grf"); + //report.LoadFromFile(@"D:\P02 - 副本.grf"); + report.LoadFromFile(_printTemplateName); + report.ConnectionString = ConfigurationManager.ConnectionStrings["report"].ToString(); + + //report.PrintPreview(true); + report.Print(false); + + #endregion + + bll.Update_Info(md); + } + + + } + + + // //DataTable dt = bll.SearchSerialNoByBarCode(partNo + "." + textBox3.Text.Trim()); + // //DataTable dt = bll.SearchInfoByStock(stockNo); + // DataTable dt = bll.SearchSerialNoByBarCode(stockNo, textBox3.Text.Trim()); + //if (dt != null && dt.Rows.Count > 0) + //{ + // OneCode = dt.Rows[0]["OneBarCode"].ToString().Trim(); + // code = dt.Rows[0]["BarCode"].ToString().TrimEnd(); + // for (int i = 1; i <= Convert.ToInt32(textBox4.Text.Trim()); i++) + // { + // newcode = code.Substring(0, code.Length - 4) + + // (Convert.ToInt32(code.Substring(code.Length - 4, 4)) + i) + // .ToString() + // .PadLeft(4, '0'); + // NewOneCode = OneCode.Substring(0, OneCode.Length - 4) + + // (Convert.ToInt32(OneCode.Substring(OneCode.Length - 4, 4)) + i).ToString() + // .PadLeft(4, '0'); + // string[] part = newcode.Split('.'); + // //存入tb_BarCode表 + // md.ID = Guid.NewGuid().ToString(); + // md.StationID = Program.StationID; + // md.StationID2 = stationID; + // md.OneBarCode = NewOneCode; + // md.BarCode = newcode; + // md.BatchNo= textBox3.Text.Trim(); + + // md.StockNo = stockNo; + // md.PrintType = 1; + + // DataTable pdt = pbll.SearchIsImportByStockNo(stockNo); + // if (pdt != null && pdt.Rows.Count > 0) + // { + // if (pdt.Rows[0]["isImport"].ToString() == "1") + // { + // md.Import = "国产料Kingfa"; + // } + // else + // { + // md.Import = ""; + // } + // } + + // //if (NewOneCode.Substring(0, 10) == "2200000064" || + // // NewOneCode.Substring(0, 10) == "2200000093" || + // // NewOneCode.Substring(0, 10) == "2200000096" || + // // NewOneCode.Substring(0, 10) == "2200000084" || + // // NewOneCode.Substring(0, 10) == "2200000090" || + // // NewOneCode.Substring(0, 10) == "2200000052") + // //{ + // // md.Import = "国产料Kingfa"; + // //} + // //else + // //{ + // // md.Import = ""; + // //} + + // if (bll.Add_Info(md)) + + // { + // #region 打印条码 + + // GridppReport report = new GridppReport(); + + // report.Register(""); + // //report.LoadFromFile(@"D:\P02.grf"); + // report.LoadFromFile(@"D:\P02 - 副本.grf"); + // report.ConnectionString = ConfigurationManager.ConnectionStrings["report"].ToString(); + + // //report.PrintPreview(true); + // report.Print(false); + + // #endregion + + // bll.Update_Info(md); + // } + // } + //} + //else + //{ + // for (int i = 1; i <= Convert.ToInt32(textBox4.Text.Trim()); i++) + // { + // newcode = partNo + "." + textBox3.Text.Trim() + "." + i.ToString().PadLeft(4, '0'); + // NewOneCode = stockNo + textBox3.Text.Trim() + i.ToString().PadLeft(4, '0'); + // string[] part = newcode.Split('.'); + // //存入tb_BarCode表 + // md.ID = Guid.NewGuid().ToString(); + // md.StationID = Program.StationID; + // md.StationID2 = stationID; + // md.StockNo = stockNo; + // md.OneBarCode = NewOneCode; + // md.BarCode = newcode; + // md.PrintType = 1; + // md.BatchNo = textBox3.Text.Trim(); + + // DataTable pdt = pbll.SearchIsImportByStockNo(stockNo); + // if (pdt != null && pdt.Rows.Count > 0) + // { + // if (pdt.Rows[0]["isImport"].ToString() == "1") + // { + // md.Import = "国产料Kingfa"; + // } + // else + // { + // md.Import = ""; + // } + // } + + // bll.Add_Info(md); + + // #region 打印条码 + + // GridppReport report = new GridppReport(); + + // report.Register(""); + // //report.LoadFromFile(@"D:\P02.grf"); + // report.LoadFromFile(@"D:\P02 - 副本.grf"); + // report.ConnectionString = ConfigurationManager.ConnectionStrings["report"].ToString(); + + // //report.PrintPreview(true); + // report.Print(false); + + // #endregion + + // bll.Update_Info(md); + // } + //} + + #endregion + + initBarCode(); + } + else + { + return; + } + } + catch (Exception ex) + { + LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); + } + } + + private void button1_Click(object sender, EventArgs e) + { + BarCodeBLL bll = new BarCodeBLL(); + DataTable dt = null; + + try + { + glacialList1.Items.Clear(); + if (textBox5.Text.Trim() == "") + { + dt = bll.SearchBarCode(); + } + else + { + if (textBox5.Text.Trim().Length == 20) + { + dt = bll.SearchBarCodeByOne(textBox5.Text.Trim()); + } + else + { + dt = bll.SearchBarCodeByTwo(textBox5.Text.Trim()); + } + } + + + if (dt != null && dt.Rows.Count > 0) + { + for (int i = 0; i < dt.Rows.Count; i++) + { + glacialList1.Items.Add(i.ToString()); + glacialList1.Items[i].SubItems[0].Text = dt.Rows[i]["BarCode"].ToString(); + glacialList1.Items[i].SubItems[1].Text = dt.Rows[i]["ProductName"].ToString(); + glacialList1.Items[i].SubItems[2].Text = dt.Rows[i]["PrintType"].ToString(); + glacialList1.Items[i].SubItems[3].Text = dt.Rows[i]["PrintTime"].ToString() == "" ? "" : Convert.ToDateTime(dt.Rows[i]["PrintTime"].ToString()).ToString("yyyy-MM-dd HH:mm:ss.fff"); + glacialList1.Items[i].SubItems[4].Text = dt.Rows[i]["MaterialName"].ToString(); + glacialList1.Items[i].SubItems[5].Text = dt.Rows[i]["BatchNo"].ToString(); + } + } + + } + catch (Exception ex) + { + LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); + } + } + + private void FrmBarCodeSearch_FormClosing(object sender, FormClosingEventArgs e) + { + Application.Exit(); + } + } +} diff --git a/InjectionSearch/InjectionSearch.csproj b/InjectionSearch/InjectionSearch.csproj index bb6cf89..279feaf 100644 --- a/InjectionSearch/InjectionSearch.csproj +++ b/InjectionSearch/InjectionSearch.csproj @@ -70,6 +70,12 @@ Form1.cs + + Form + + + FrmBarCodeSearchNew.cs + Form @@ -81,6 +87,9 @@ Form1.cs + + FrmBarCodeSearchNew.cs + FrmBarCodeSearch.cs @@ -103,6 +112,9 @@ Settings.settings True + + PreserveNewest + diff --git a/InjectionSearch/Program.cs b/InjectionSearch/Program.cs index effe2d2..a8b5df8 100644 --- a/InjectionSearch/Program.cs +++ b/InjectionSearch/Program.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Data.SqlClient; using System.Linq; +using System.Text; using System.Threading.Tasks; using System.Windows.Forms; @@ -27,6 +28,14 @@ namespace InjectionSearch bool isRuned; System.Threading.Mutex mutex = new System.Threading.Mutex(true, "OnlyRunOneInstance", out isRuned); + //处理UI线程异常 + + Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); + + //处理非UI线程异常 + + AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); + if (isRuned) { Application.EnableVisualStyles(); @@ -39,5 +48,52 @@ namespace InjectionSearch MessageBox.Show("程序已启动!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } + + static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) + { + string str = GetExceptionMsg(e.Exception, e.ToString()); + MessageBox.Show(str); + //LogManager.WriteLog(str); + } + + + + static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) + { + string str = GetExceptionMsg(e.ExceptionObject as Exception, e.ToString()); + MessageBox.Show(str); + //LogManager.WriteLog(str); + } + static string GetExceptionMsg(Exception ex, string backStr) + { + StringBuilder sb = new StringBuilder(); + + sb.AppendLine("****************************异常文本****************************"); + + sb.AppendLine("【出现时间】:" + DateTime.Now.ToString()); + + if (ex != null) + { + + sb.AppendLine("【异常类型】:" + ex.GetType().Name); + + sb.AppendLine("【异常信息】:" + ex.Message); + + sb.AppendLine("【堆栈调用】:" + ex.StackTrace); + + } + + else + + { + + sb.AppendLine("【未处理异常】:" + backStr); + + } + + sb.AppendLine("***************************************************************"); + + return sb.ToString(); + } } } diff --git a/InjectionSearch/Report/P02 - 副本.grf b/InjectionSearch/Report/P02 - 副本.grf new file mode 100644 index 0000000000000000000000000000000000000000..b33490ae80d240fc904af71623254efb18de4f37 GIT binary patch literal 3270 zcmdT`yKWOf6s0v1{}3sK8?>6;_1fNI3gQqFDa0nWNP$u;_K+;HcdYS5N~kE1kN}B- z2BiuhBt$_=0TDlw1XAS}m^-hXjU6YBXmGLi-nnxhXU;w2vmd{jkDrn*pIawG%J{9D zrH6!#Qkvm%SRkagH)xpWFW#Ge|vp&_zpsq+UYZbeH0;tZX+;k zkaTOC;|h{*4UuX@IQGMeSiGC{#8Zcq1rTO~1W{G)PkVeDNAPo5hl1a$KYa(=XBs$3b_{vPtyK9mO?$IpmoxvtS71kn{qcx4cgxsWDNm=zy_90 zZL*e0zVZMr@KpXQoD4>Dt%M0kxxxWVa*u+!t&U-hN~Cp`b3VT(ix0U$@&F;U4gJ#)H9%MI<6up4z!D4Cq^Dn z9zGkA(!N*M@0!=SLC2E09<0M*YR^U@XR}2|DIkm2Xl9l=WS8UeqxqZw^P8$i!(HbT zbRUvX-37Xkp}>)I zBy2F|0y$KR!{Pg^=1)VP;XV{n{bK z<>Jga z4IzXZEE(E^ydt8uYX{Nu(lQ0pDRUMWJT*h?QU8~dRx#boG-*%DfDx)PRC N6Y9k3OFre}#$Rj~3<>}M literal 0 HcmV?d00001 diff --git a/MESClassLibrary/BLL/BasicInfo/StationBLL.cs b/MESClassLibrary/BLL/BasicInfo/StationBLL.cs index e6e0d42..0162a18 100644 --- a/MESClassLibrary/BLL/BasicInfo/StationBLL.cs +++ b/MESClassLibrary/BLL/BasicInfo/StationBLL.cs @@ -191,5 +191,19 @@ namespace MESClassLibrary.BLL.BasicInfo return null; } } + public DataTable SearchAllInfo() + { + StationDAL db = new StationDAL(); + + try + { + return db.SearchInfoByNo(); + } + catch (Exception ex) + { + LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); + return null; + } + } } } diff --git a/MESClassLibrary/BLL/User/UserBLL.cs b/MESClassLibrary/BLL/User/UserBLL.cs index 8f6a9f4..bd8e602 100644 --- a/MESClassLibrary/BLL/User/UserBLL.cs +++ b/MESClassLibrary/BLL/User/UserBLL.cs @@ -28,7 +28,7 @@ namespace MESClassLibrary.BLL.User } #endregion - #region 登陆 + #region 登录 //DataTable dt = db.Search_UserInfoByUP(md.Username, Tool.MD5encryption(md.Password)); DataTable dt = db.Search_UserInfoByUP(md.Username, md.Password); if (dt != null && dt.Rows.Count > 0) diff --git a/MESClassLibrary/DAL/BasicDAL.cs b/MESClassLibrary/DAL/BasicDAL.cs index 658e526..a3032bd 100644 --- a/MESClassLibrary/DAL/BasicDAL.cs +++ b/MESClassLibrary/DAL/BasicDAL.cs @@ -47,5 +47,46 @@ namespace MESClassLibrary.DAL } } + /// + /// 生成流水号 + /// + /// 类型 + /// 流水号长度 + /// + public static string GetBillNo(string type, int len) + { + string sql = $"exec p_GetBillNo '{type}'"; + + DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql).Tables[0]; + + int ret = Convert.ToInt32(dt.Rows[0]["value"].ToString()); + + return ret.ToString().PadLeft(len, '0'); + } + + /// + /// 生成最新的注塑条码 + /// + /// + /// + /// + public static string GetSjBarCodeSerialNo(string stockNo,string batch) + { + if(stockNo.Length != 10) + { + throw new Exception($"生成塑件条码错误,因为存货代码[{stockNo}]格式不正确,必须10位长度."); + } + string s = GetBillNo(stockNo + batch, 4); + string sjBarCode = stockNo + batch + s; + try + { + SqlHelper.ExecuteNonQuery(SqlHelper.GetConnSting(), CommandType.Text, $" insert into tb_BarCodeUnique(OneBarCode) values('{sjBarCode}')"); + return sjBarCode; + } + catch(Exception ex) + { + return GetSjBarCodeSerialNo(stockNo, batch); + } + } } } diff --git a/MESClassLibrary/DAL/BasicInfo/StationDAL.cs b/MESClassLibrary/DAL/BasicInfo/StationDAL.cs index b2ae940..a89fc03 100644 --- a/MESClassLibrary/DAL/BasicInfo/StationDAL.cs +++ b/MESClassLibrary/DAL/BasicInfo/StationDAL.cs @@ -25,6 +25,24 @@ namespace MESClassLibrary.DAL.BasicInfo param[0] = new SqlParameter("@StationNo", SqlDbType.VarChar); param[0].Value = station; + return SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, param).Tables[0]; + + } + catch (Exception ex) + { + LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); + return null; + } + } + public DataTable SearchInfoByNo() + { + try + { + string sql = @"select * from " + TableName ; + + SqlParameter[] param = new SqlParameter[0]; + + return SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, param).Tables[0]; } diff --git a/PaintingPrintBarCode/Login.Designer.cs b/PaintingPrintBarCode/Login.Designer.cs index 7cf77c4..4d153f7 100644 --- a/PaintingPrintBarCode/Login.Designer.cs +++ b/PaintingPrintBarCode/Login.Designer.cs @@ -44,26 +44,29 @@ this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill; this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); this.pictureBox1.Location = new System.Drawing.Point(0, 0); + this.pictureBox1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(703, 453); + this.pictureBox1.Size = new System.Drawing.Size(1289, 793); this.pictureBox1.TabIndex = 0; this.pictureBox1.TabStop = false; // // textBox1 // this.textBox1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.textBox1.Location = new System.Drawing.Point(294, 191); + this.textBox1.Location = new System.Drawing.Point(539, 334); + this.textBox1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(159, 29); + this.textBox1.Size = new System.Drawing.Size(288, 45); this.textBox1.TabIndex = 4; // // label1 // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label1.Location = new System.Drawing.Point(216, 194); + this.label1.Location = new System.Drawing.Point(396, 340); + this.label1.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(66, 19); + this.label1.Size = new System.Drawing.Size(117, 34); this.label1.TabIndex = 3; this.label1.Text = "用户名"; // @@ -72,30 +75,33 @@ this.label2.AutoSize = true; this.label2.BackColor = System.Drawing.Color.Transparent; this.label2.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.label2.Location = new System.Drawing.Point(214, 241); + this.label2.Location = new System.Drawing.Point(392, 422); + this.label2.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(47, 19); + this.label2.Size = new System.Drawing.Size(83, 34); this.label2.TabIndex = 6; this.label2.Text = "密码"; // // textBox2 // this.textBox2.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.textBox2.Location = new System.Drawing.Point(294, 241); + this.textBox2.Location = new System.Drawing.Point(539, 422); + this.textBox2.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); this.textBox2.Name = "textBox2"; this.textBox2.PasswordChar = '*'; - this.textBox2.Size = new System.Drawing.Size(159, 29); + this.textBox2.Size = new System.Drawing.Size(288, 45); this.textBox2.TabIndex = 7; // // button1 // this.button1.BackColor = System.Drawing.Color.LightSkyBlue; this.button1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.button1.Location = new System.Drawing.Point(229, 300); + this.button1.Location = new System.Drawing.Point(420, 525); + this.button1.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(84, 38); + this.button1.Size = new System.Drawing.Size(154, 66); this.button1.TabIndex = 8; - this.button1.Text = "登陆"; + this.button1.Text = "登录"; this.button1.UseVisualStyleBackColor = false; this.button1.Click += new System.EventHandler(this.button1_Click); // @@ -103,9 +109,10 @@ // this.button2.BackColor = System.Drawing.Color.LightSkyBlue; this.button2.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.button2.Location = new System.Drawing.Point(381, 300); + this.button2.Location = new System.Drawing.Point(699, 525); + this.button2.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(83, 38); + this.button2.Size = new System.Drawing.Size(152, 66); this.button2.TabIndex = 9; this.button2.Text = "取消"; this.button2.UseVisualStyleBackColor = false; @@ -113,9 +120,9 @@ // // Login // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 21F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(703, 453); + this.ClientSize = new System.Drawing.Size(1289, 793); this.Controls.Add(this.label2); this.Controls.Add(this.textBox2); this.Controls.Add(this.button1); @@ -123,6 +130,7 @@ this.Controls.Add(this.textBox1); this.Controls.Add(this.label1); this.Controls.Add(this.pictureBox1); + this.Margin = new System.Windows.Forms.Padding(6, 5, 6, 5); this.Name = "Login"; this.Text = "登录"; ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); diff --git a/PunchAssemble/PunchAndWeld/BusinessHelper.cs b/PunchAssemble/PunchAndWeld/BusinessHelper.cs index 3d2d4f5..6d60afe 100644 --- a/PunchAssemble/PunchAndWeld/BusinessHelper.cs +++ b/PunchAssemble/PunchAndWeld/BusinessHelper.cs @@ -10,7 +10,7 @@ namespace PunchAndWeld public class BusinessHelper { /// - /// 补打 + /// 补打标签后 /// /// public static void SetRePrint(TextBox tb)