| | |
| | | return alarmname; |
| | | } |
| | | |
| | | |
| | | |
| | | public IImportFromFileInEditor GetImportObject(string data, out string msg) |
| | | { |
| | | msg = ""; |
| | |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Action, $"产品{p.PID}_{p.SEQUENCE}工位{measureBind.WorkPosition}的第{measureBind.CheckIndex}检测完成,{msg}"); |
| | | } |
| | | }); |
| | | |
| | | |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Error, $"{measureBind.WorkPosition},产品{string.Join(",", products.Select(u => u.PID))}的NG图片保存异常,{ex.GetExceptionMessage()}"); |
| | | } |
| | | |
| | | } |
| | | }); |
| | | } |
| | |
| | | }); |
| | | } |
| | | |
| | | |
| | | public void ReplyPlcData(WorkPositionSet p, List<bool> result) |
| | | { |
| | | if (p.plcresult != 0) |
| | |
| | | }); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | #endregion |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Action, $"打印机打印{str}"); |
| | | int ttwith = 240; |
| | | int ttheigh = 80; |
| | | Printmessage = str; |
| | |
| | | label3 = new Label(); |
| | | textBox8 = new TextBox(); |
| | | button4 = new Button(); |
| | | button7 = new Button(); |
| | | textBox9 = new TextBox(); |
| | | label4 = new Label(); |
| | | label5 = new Label(); |
| | | textBox10 = new TextBox(); |
| | | label6 = new Label(); |
| | | textBox11 = new TextBox(); |
| | | label7 = new Label(); |
| | | textBox12 = new TextBox(); |
| | | label8 = new Label(); |
| | | textBox13 = new TextBox(); |
| | | SuspendLayout(); |
| | | // |
| | | // button2 |
| | | // |
| | | button2.Location = new Point(229, 51); |
| | | button2.Location = new Point(177, 51); |
| | | button2.Margin = new Padding(3, 2, 3, 2); |
| | | button2.Name = "button2"; |
| | | button2.Size = new Size(93, 46); |
| | | button2.TabIndex = 1; |
| | | button2.Text = "预览"; |
| | | button2.Text = "S6预览"; |
| | | button2.UseVisualStyleBackColor = true; |
| | | button2.Click += button2_Click; |
| | | // |
| | | // button1 |
| | | // |
| | | button1.Location = new Point(27, 51); |
| | | button1.Location = new Point(51, 51); |
| | | button1.Margin = new Padding(3, 2, 3, 2); |
| | | button1.Name = "button1"; |
| | | button1.Size = new Size(93, 46); |
| | | button1.TabIndex = 2; |
| | | button1.Text = "S5打印条码"; |
| | | button1.Text = "S6打印条码"; |
| | | button1.UseVisualStyleBackColor = true; |
| | | button1.Click += button1_Click; |
| | | // |
| | |
| | | // |
| | | // button3 |
| | | // |
| | | button3.Location = new Point(27, 101); |
| | | button3.Location = new Point(27, 178); |
| | | button3.Margin = new Padding(2); |
| | | button3.Name = "button3"; |
| | | button3.Size = new Size(69, 33); |
| | |
| | | // |
| | | // textBox2 |
| | | // |
| | | textBox2.Location = new Point(27, 138); |
| | | textBox2.Location = new Point(27, 215); |
| | | textBox2.Margin = new Padding(3, 2, 3, 2); |
| | | textBox2.Name = "textBox2"; |
| | | textBox2.Size = new Size(269, 21); |
| | |
| | | // |
| | | // richTextBox1 |
| | | // |
| | | richTextBox1.Location = new Point(328, 26); |
| | | richTextBox1.Location = new Point(444, 26); |
| | | richTextBox1.Name = "richTextBox1"; |
| | | richTextBox1.Size = new Size(270, 509); |
| | | richTextBox1.Size = new Size(203, 509); |
| | | richTextBox1.TabIndex = 9; |
| | | richTextBox1.Text = ""; |
| | | // |
| | | // textBox3 |
| | | // |
| | | textBox3.Location = new Point(82, 195); |
| | | textBox3.Location = new Point(82, 256); |
| | | textBox3.Margin = new Padding(3, 2, 3, 2); |
| | | textBox3.Name = "textBox3"; |
| | | textBox3.Size = new Size(151, 21); |
| | |
| | | // |
| | | // textBox4 |
| | | // |
| | | textBox4.Location = new Point(82, 231); |
| | | textBox4.Location = new Point(82, 281); |
| | | textBox4.Margin = new Padding(3, 2, 3, 2); |
| | | textBox4.Name = "textBox4"; |
| | | textBox4.Size = new Size(151, 21); |
| | |
| | | // |
| | | // textBox5 |
| | | // |
| | | textBox5.Location = new Point(82, 267); |
| | | textBox5.Location = new Point(82, 306); |
| | | textBox5.Margin = new Padding(3, 2, 3, 2); |
| | | textBox5.Name = "textBox5"; |
| | | textBox5.Size = new Size(151, 21); |
| | |
| | | // |
| | | // textBox6 |
| | | // |
| | | textBox6.Location = new Point(82, 303); |
| | | textBox6.Location = new Point(82, 331); |
| | | textBox6.Margin = new Padding(3, 2, 3, 2); |
| | | textBox6.Name = "textBox6"; |
| | | textBox6.Size = new Size(151, 21); |
| | |
| | | // |
| | | // textBox7 |
| | | // |
| | | textBox7.Location = new Point(82, 339); |
| | | textBox7.Location = new Point(82, 356); |
| | | textBox7.Margin = new Padding(3, 2, 3, 2); |
| | | textBox7.Name = "textBox7"; |
| | | textBox7.Size = new Size(151, 21); |
| | |
| | | // |
| | | // textBox8 |
| | | // |
| | | textBox8.Location = new Point(82, 375); |
| | | textBox8.Location = new Point(82, 381); |
| | | textBox8.Margin = new Padding(3, 2, 3, 2); |
| | | textBox8.Name = "textBox8"; |
| | | textBox8.Size = new Size(151, 21); |
| | |
| | | // |
| | | // button4 |
| | | // |
| | | button4.Location = new Point(126, 51); |
| | | button4.Location = new Point(51, 116); |
| | | button4.Margin = new Padding(3, 2, 3, 2); |
| | | button4.Name = "button4"; |
| | | button4.Size = new Size(93, 46); |
| | |
| | | button4.UseVisualStyleBackColor = true; |
| | | button4.Click += button4_Click; |
| | | // |
| | | // button7 |
| | | // |
| | | button7.Location = new Point(177, 116); |
| | | button7.Margin = new Padding(3, 2, 3, 2); |
| | | button7.Name = "button7"; |
| | | button7.Size = new Size(93, 46); |
| | | button7.TabIndex = 20; |
| | | button7.Text = "S9预览"; |
| | | button7.UseVisualStyleBackColor = true; |
| | | button7.Click += button7_Click; |
| | | // |
| | | // textBox9 |
| | | // |
| | | textBox9.Location = new Point(355, 29); |
| | | textBox9.Margin = new Padding(3, 2, 3, 2); |
| | | textBox9.Name = "textBox9"; |
| | | textBox9.Size = new Size(70, 21); |
| | | textBox9.TabIndex = 21; |
| | | textBox9.Text = "320"; |
| | | // |
| | | // label4 |
| | | // |
| | | label4.AutoSize = true; |
| | | label4.Location = new Point(276, 29); |
| | | label4.Name = "label4"; |
| | | label4.Size = new Size(67, 13); |
| | | label4.TabIndex = 22; |
| | | label4.Text = "S9打印长度"; |
| | | // |
| | | // label5 |
| | | // |
| | | label5.AutoSize = true; |
| | | label5.Location = new Point(276, 65); |
| | | label5.Name = "label5"; |
| | | label5.Size = new Size(67, 13); |
| | | label5.TabIndex = 24; |
| | | label5.Text = "S9打印宽度"; |
| | | // |
| | | // textBox10 |
| | | // |
| | | textBox10.Location = new Point(355, 65); |
| | | textBox10.Margin = new Padding(3, 2, 3, 2); |
| | | textBox10.Name = "textBox10"; |
| | | textBox10.Size = new Size(70, 21); |
| | | textBox10.TabIndex = 23; |
| | | textBox10.Text = "160"; |
| | | // |
| | | // label6 |
| | | // |
| | | label6.AutoSize = true; |
| | | label6.Location = new Point(276, 101); |
| | | label6.Name = "label6"; |
| | | label6.Size = new Size(67, 13); |
| | | label6.TabIndex = 26; |
| | | label6.Text = "S9打印比例"; |
| | | // |
| | | // textBox11 |
| | | // |
| | | textBox11.Location = new Point(355, 101); |
| | | textBox11.Margin = new Padding(3, 2, 3, 2); |
| | | textBox11.Name = "textBox11"; |
| | | textBox11.Size = new Size(70, 21); |
| | | textBox11.TabIndex = 25; |
| | | textBox11.Text = "0.85"; |
| | | // |
| | | // label7 |
| | | // |
| | | label7.AutoSize = true; |
| | | label7.Location = new Point(276, 133); |
| | | label7.Name = "label7"; |
| | | label7.Size = new Size(73, 13); |
| | | label7.TabIndex = 28; |
| | | label7.Text = "S9打印起始X"; |
| | | // |
| | | // textBox12 |
| | | // |
| | | textBox12.Location = new Point(355, 133); |
| | | textBox12.Margin = new Padding(3, 2, 3, 2); |
| | | textBox12.Name = "textBox12"; |
| | | textBox12.Size = new Size(70, 21); |
| | | textBox12.TabIndex = 27; |
| | | textBox12.Text = "10"; |
| | | // |
| | | // label8 |
| | | // |
| | | label8.AutoSize = true; |
| | | label8.Location = new Point(276, 167); |
| | | label8.Name = "label8"; |
| | | label8.Size = new Size(73, 13); |
| | | label8.TabIndex = 30; |
| | | label8.Text = "S9打印起始Y"; |
| | | // |
| | | // textBox13 |
| | | // |
| | | textBox13.AccessibleName = ""; |
| | | textBox13.Location = new Point(355, 167); |
| | | textBox13.Margin = new Padding(3, 2, 3, 2); |
| | | textBox13.Name = "textBox13"; |
| | | textBox13.Size = new Size(70, 21); |
| | | textBox13.TabIndex = 29; |
| | | textBox13.Text = "-10"; |
| | | // |
| | | // UIPrinter |
| | | // |
| | | AutoScaleDimensions = new SizeF(6F, 13F); |
| | | AutoScaleMode = AutoScaleMode.Font; |
| | | Controls.Add(label8); |
| | | Controls.Add(textBox13); |
| | | Controls.Add(label7); |
| | | Controls.Add(textBox12); |
| | | Controls.Add(label6); |
| | | Controls.Add(textBox11); |
| | | Controls.Add(label5); |
| | | Controls.Add(textBox10); |
| | | Controls.Add(label4); |
| | | Controls.Add(textBox9); |
| | | Controls.Add(button7); |
| | | Controls.Add(button4); |
| | | Controls.Add(textBox8); |
| | | Controls.Add(label3); |
| | |
| | | private Label label3; |
| | | private TextBox textBox8; |
| | | private Button button4; |
| | | private Button button7; |
| | | private TextBox textBox9; |
| | | private Label label4; |
| | | private Label label5; |
| | | private TextBox textBox10; |
| | | private Label label6; |
| | | private TextBox textBox11; |
| | | private Label label7; |
| | | private TextBox textBox12; |
| | | private Label label8; |
| | | private TextBox textBox13; |
| | | } |
| | | } |
| | |
| | | { |
| | | base.OnProcessUpdated(); |
| | | printDocument1.PrintPage += new PrintPageEventHandler(printDocument_Print); |
| | | printDocument2.PrintPage += new PrintPageEventHandler(printDocument_Print1); |
| | | textBox1.Text = "C229M2508250500002"; |
| | | } |
| | | |
| | |
| | | PrintDocument printDocument1 = new PrintDocument(); |
| | | int ttwith = (int)(60 * 4); |
| | | int ttheigh = (int)(20 * 4); |
| | | |
| | | PrintDocument printDocument2 = new PrintDocument(); |
| | | int ttwith1 = (int)(80 * 4); |
| | | int ttheigh1 = (int)(40 * 4); |
| | | |
| | | string message = ""; |
| | | |
| | | public void StartPrint(string str) |
| | |
| | | { |
| | | try |
| | | { |
| | | ttwith = 240; |
| | | ttheigh = 80; |
| | | ttwith1 = textBox9.Text.ToInt(); |
| | | ttheigh1 = textBox10.Text.ToInt(); |
| | | message = str; |
| | | |
| | | if (string.IsNullOrEmpty(message)) |
| | |
| | | //this.printDocument1.PrintController = new System.Drawing.Printing.StandardPrintController(); |
| | | //this.printDocument1.Print(); |
| | | |
| | | this.printDocument1.DefaultPageSettings.PrinterSettings.PrinterName = "Honeywell PX240S (300 dpi)1"; |
| | | this.printDocument1.DefaultPageSettings.PaperSize = new PaperSize("Custum", ttwith, ttheigh); |
| | | this.printDocument2.DefaultPageSettings.PrinterSettings.PrinterName = "Honeywell PX240S (300 dpi)1"; |
| | | this.printDocument2.DefaultPageSettings.PaperSize = new PaperSize("Custum", ttwith, ttheigh); |
| | | |
| | | this.printDocument1.PrintController = new System.Drawing.Printing.StandardPrintController(); |
| | | this.printDocument1.Print(); |
| | | this.printDocument2.PrintController = new System.Drawing.Printing.StandardPrintController(); |
| | | this.printDocument2.Print(); |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | //private void printDocument_Print(object sender, PrintPageEventArgs e) |
| | | //{ |
| | | // Font fntTxt = new Font("黑体", 15, System.Drawing.FontStyle.Bold);//正文文字 |
| | | // System.Drawing.Brush brush = new SolidBrush(System.Drawing.Color.Black);//画刷 |
| | | // try |
| | | // { |
| | | // string numvalue = message; |
| | | private void printDocument_Print1(object sender, PrintPageEventArgs e) |
| | | { |
| | | Font fntTxt = new Font("黑体", 15, System.Drawing.FontStyle.Bold);//正文文字 |
| | | System.Drawing.Brush brush = new SolidBrush(System.Drawing.Color.Black);//画刷 |
| | | try |
| | | { |
| | | string numvalue = message; |
| | | |
| | | // float Scale = (float)0.95; |
| | | // int startX = 10; |
| | | // int startY = 25; |
| | | float Scale = textBox11.Text.ToFloat(); |
| | | ///(float)0.85; |
| | | int startX = textBox12.Text.ToInt(); |
| | | //10; |
| | | int startY = textBox13.Text.ToInt(); |
| | | // -20; |
| | | |
| | | // //int length = 320 * Scale; |
| | | // //int height = 160 * Scale; |
| | | // var g = e.Graphics; |
| | | //int length = 320 * Scale; |
| | | //int height = 160 * Scale; |
| | | var g = e.Graphics; |
| | | |
| | | // Font font = new Font("Arial", 8 * Scale);//设置字体颜色 |
| | | // Font font2 = new Font("Arial", 11 * Scale);//设置字体颜色 |
| | | // Font font3 = new Font("Arial", 36 * Scale);//设置字体颜色 |
| | | // Font font4 = new Font("Arial", 12 * Scale);//设置字体颜色 |
| | | Font font = new Font("Arial", 8 * Scale);//设置字体颜色 |
| | | Font font2 = new Font("Arial", 11 * Scale);//设置字体颜色 |
| | | Font font3 = new Font("Arial", 36 * Scale);//设置字体颜色 |
| | | Font font4 = new Font("Arial", 12 * Scale);//设置字体颜色 |
| | | |
| | | |
| | | // Pen p = new Pen(Color.Black, Scale);//定义了一个黑色,宽度为1的画笔 |
| | | // g.Clear(Color.White); |
| | | // g.DrawRectangle(p, startX * Scale, startY * Scale, 70 * Scale, 20 * Scale);//在画板上画矩形,起始坐标为(10,10),宽为80,高为20 |
| | | // g.DrawRectangle(p, startX * Scale, startY * Scale, 280 * Scale, 20 * Scale);//在画板上画矩形,起始坐标为(90,10),宽为80,高为20 |
| | | // g.DrawString("厂商", font, brush, (startX + 20) * Scale, (startY + 5) * Scale);// |
| | | // g.DrawString("嘉彰科技", font2, brush, (startX + 140) * Scale, (startY + 4) * Scale); |
| | | Pen p = new Pen(Color.Black, Scale);//定义了一个黑色,宽度为1的画笔 |
| | | g.Clear(Color.White); |
| | | g.DrawRectangle(p, startX * Scale, startY * Scale, 70 * Scale, 20 * Scale);//在画板上画矩形,起始坐标为(10,10),宽为80,高为20 |
| | | g.DrawRectangle(p, startX * Scale, startY * Scale, 280 * Scale, 20 * Scale);//在画板上画矩形,起始坐标为(90,10),宽为80,高为20 |
| | | g.DrawString("厂商", font, brush, (startX + 20) * Scale, (startY + 5) * Scale);// |
| | | g.DrawString("嘉彰科技", font2, brush, (startX + 140) * Scale, (startY + 4) * Scale); |
| | | |
| | | |
| | | // //第二行数据 |
| | | // g.DrawRectangle(p, startX * Scale, (startY + 20) * Scale, 70 * Scale, 20 * Scale); |
| | | // g.DrawRectangle(p, startX * Scale, (startY + 20) * Scale, 280 * Scale, 20 * Scale); |
| | | // g.DrawString("品名", font, brush, (startX + 20) * Scale, (startY + 25) * Scale); |
| | | // g.DrawString(@"COVER LG208H-RC100 #2", font4, brush, (startX + 71) * Scale, (startY + 22) * Scale); |
| | | //第二行数据 |
| | | g.DrawRectangle(p, startX * Scale, (startY + 20) * Scale, 70 * Scale, 20 * Scale); |
| | | g.DrawRectangle(p, startX * Scale, (startY + 20) * Scale, 280 * Scale, 20 * Scale); |
| | | g.DrawString("品名", font, brush, (startX + 20) * Scale, (startY + 25) * Scale); |
| | | g.DrawString(@"COVER LG208I-RC100 #1", font4, brush, (startX + 71) * Scale, (startY + 22) * Scale); |
| | | |
| | | // //第三行数据 |
| | | // g.DrawRectangle(p, startX * Scale, (startY + 40) * Scale, 70 * Scale, 20 * Scale); |
| | | // g.DrawRectangle(p, startX * Scale, (startY + 40) * Scale, 280 * Scale, 20 * Scale); |
| | | // g.DrawString("料号", font, brush, (startX + 20) * Scale, (startY + 45) * Scale); |
| | | // g.DrawString(@"436LG208I000", font2, brush, (startX + 130) * Scale, (startY + 43) * Scale); |
| | | //第三行数据 |
| | | g.DrawRectangle(p, startX * Scale, (startY + 40) * Scale, 70 * Scale, 20 * Scale); |
| | | g.DrawRectangle(p, startX * Scale, (startY + 40) * Scale, 280 * Scale, 20 * Scale); |
| | | g.DrawString("料号", font, brush, (startX + 20) * Scale, (startY + 45) * Scale); |
| | | g.DrawString(@"436LG208J000", font2, brush, (startX + 130) * Scale, (startY + 43) * Scale); |
| | | |
| | | // //第四行数据 |
| | | // g.DrawRectangle(p, startX * Scale, (startY + 60) * Scale, 70 * Scale, 20 * Scale); |
| | | // g.DrawRectangle(p, startX * Scale, (startY + 60) * Scale, 210 * Scale, 20 * Scale); |
| | | // g.DrawString("数量", font, brush, (startX + 20) * Scale, (startY + 65) * Scale); |
| | | // g.DrawString(@"50PCS", font2, brush, (startX + 120) * Scale, (startY + 62) * Scale); |
| | | //第四行数据 |
| | | g.DrawRectangle(p, startX * Scale, (startY + 60) * Scale, 70 * Scale, 20 * Scale); |
| | | g.DrawRectangle(p, startX * Scale, (startY + 60) * Scale, 210 * Scale, 20 * Scale); |
| | | g.DrawString("数量", font, brush, (startX + 20) * Scale, (startY + 65) * Scale); |
| | | g.DrawString(@"50PCS", font2, brush, (startX + 120) * Scale, (startY + 62) * Scale); |
| | | |
| | | // //第五行数据 |
| | | // g.DrawRectangle(p, startX * Scale, (startY + 80) * Scale, 70 * Scale, 20 * Scale); |
| | | // g.DrawRectangle(p, startX * Scale, (startY + 80) * Scale, 210 * Scale, 20 * Scale); |
| | | // g.DrawString("生产日期", font, brush, (startX + 10) * Scale, (startY + 85) * Scale); |
| | | // g.DrawString($"{DateTime.Now.ToString("yyyy.MM.dd")}", font2, brush, (startX + 105) * Scale, (startY + 82) * Scale); |
| | | //第五行数据 |
| | | g.DrawRectangle(p, startX * Scale, (startY + 80) * Scale, 70 * Scale, 20 * Scale); |
| | | g.DrawRectangle(p, startX * Scale, (startY + 80) * Scale, 210 * Scale, 20 * Scale); |
| | | g.DrawString("生产日期", font, brush, (startX + 10) * Scale, (startY + 85) * Scale); |
| | | g.DrawString($"{DateTime.Now.ToString("yyyy.MM.dd")}", font2, brush, (startX + 105) * Scale, (startY + 82) * Scale); |
| | | |
| | | // //第六行数据 |
| | | // g.DrawRectangle(p, startX * Scale, (startY + 100) * Scale, 70 * Scale, 20 * Scale); |
| | | // g.DrawRectangle(p, startX * Scale, (startY + 100) * Scale, 140 * Scale, 20 * Scale); |
| | | // g.DrawRectangle(p, startX * Scale, (startY + 100) * Scale, 210 * Scale, 20 * Scale); |
| | | // g.DrawString("MARK1", font, brush, (startX + 15) * Scale, (startY + 104) * Scale); |
| | | // g.DrawString("MARK2", font, brush, (startX + 155) * Scale, (startY + 104) * Scale); |
| | | //第六行数据 |
| | | g.DrawRectangle(p, startX * Scale, (startY + 100) * Scale, 70 * Scale, 20 * Scale); |
| | | g.DrawRectangle(p, startX * Scale, (startY + 100) * Scale, 140 * Scale, 20 * Scale); |
| | | g.DrawRectangle(p, startX * Scale, (startY + 100) * Scale, 210 * Scale, 20 * Scale); |
| | | g.DrawString("MARK1", font, brush, (startX + 15) * Scale, (startY + 104) * Scale); |
| | | g.DrawString("MARK2", font, brush, (startX + 155) * Scale, (startY + 104) * Scale); |
| | | |
| | | |
| | | // //侧面 |
| | | // g.DrawRectangle(p, (startX + 210) * Scale, (startY + 60) * Scale, 70 * Scale, 60 * Scale); |
| | | // g.DrawString(@"#2", font3, brush, (startX + 210) * Scale, (startY + 62) * Scale); |
| | | // } |
| | | // catch (Exception ee) |
| | | // { |
| | | // MessageBox.Show(ee.Message); |
| | | // } |
| | | //} |
| | | //侧面 |
| | | g.DrawRectangle(p, (startX + 210) * Scale, (startY + 60) * Scale, 70 * Scale, 60 * Scale); |
| | | g.DrawString(@"#1", font3, brush, (startX + 210) * Scale, (startY + 62) * Scale); |
| | | } |
| | | catch (Exception ee) |
| | | { |
| | | MessageBox.Show(ee.Message); |
| | | } |
| | | } |
| | | |
| | | private void printDocument_Print222(object sender, PrintPageEventArgs e) |
| | | { |
| | |
| | | DialogResult res = printPreviewDialog1.ShowDialog(); |
| | | printPreviewDialog1.Document.Dispose(); |
| | | } |
| | | private void button7_Click(object sender, EventArgs e) |
| | | { |
| | | ttwith1 = textBox9.Text.ToInt(); |
| | | |
| | | ttheigh1 = textBox10.Text.ToInt(); |
| | | |
| | | message = textBox1.Text; |
| | | if (string.IsNullOrEmpty(message)) |
| | | { |
| | | MessageBox.Show("打印内容不可为空"); |
| | | return; |
| | | } |
| | | PrintPreviewDialog printPreviewDialog1 = new PrintPreviewDialog(); |
| | | this.printDocument2.DefaultPageSettings.PrinterSettings.PrinterName = "Honeywell PX240S (300 dpi)"; |
| | | this.printDocument2.DefaultPageSettings.PaperSize = new PaperSize("Custum", ttwith1, ttheigh1); |
| | | //this.printDocument1.PrintPage += new PrintPageEventHandler(this.printDocument_Print); |
| | | printPreviewDialog1.Document = printDocument2; |
| | | DialogResult res = printPreviewDialog1.ShowDialog(); |
| | | printPreviewDialog1.Document.Dispose(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | CommonLogger.LogAsync(DateTime.Now, EnumHelper.LogLevel.Exception, $"RabbitMQ 物料 返回数据为 {Msg}"); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | return msg; |
| | | } |
| | | |
| | | string barcodeNow; |
| | | |
| | | [ProcessMethod("ImageCheck", "ReadBarcode2", "读栏具码", InvokeType.TestInvoke)] |
| | | public ResponseMessage ReadBarcode2(IOperationConfig config, IDevice invokeDevice, IDevice sourceDevice) |
| | | { |
| | |
| | | |
| | | if (ConfigAOI1.ISupMES) |
| | | { |
| | | //string zword = mqtt.MESForBasketAsync("2", "DS02217", barcode, "1", num.ToString()).Result; |
| | | string zwordstr = Task.Run(() => mqtt.MESForBasketAsync("2", "DS02217", barcode, "1", ConfigAOI1.mesnum2.ToString())).Result; |
| | | |
| | | ConfigAOI1.mesnum2++; |
| | | if (ConfigAOI1.ISokMes) |
| | | if (barcode == barcodeNow) |
| | | { |
| | | Plc1.WriteSingleAddress(1524, 1, out _); |
| | | Plc1.WriteSingleAddress(1514, 1, out _); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Information, $"已强制读栏具码运行设备"); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Information, $"重复读码,已强制读栏具码运行设备"); |
| | | } |
| | | else |
| | | { |
| | | try |
| | | string zwordstr = Task.Run(() => mqtt.MESForBasketAsync("2", "DS02217", barcode, "1", ConfigAOI1.mesnum2.ToString())).Result; |
| | | |
| | | ConfigAOI1.mesnum2++; |
| | | if (ConfigAOI1.ISokMes) |
| | | { |
| | | var obj = JsonConvert.DeserializeObject<AutoLineMacQueueBak>(zwordstr); |
| | | if (!string.IsNullOrEmpty(obj.zwoid) && obj.zstatus == "200") |
| | | Plc1.WriteSingleAddress(1524, 1, out _); |
| | | Plc1.WriteSingleAddress(1514, 1, out _); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Information, $"已强制读栏具码运行设备"); |
| | | } |
| | | else |
| | | { |
| | | try |
| | | { |
| | | ConfigAOI1.zwoid = obj.zwoid; |
| | | Plc1.WriteSingleAddress(1524, 1, out _); |
| | | Plc1.WriteSingleAddress(1514, 1, out _); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Information, $"RabbitMQ zwoid获取成功 {obj.zstatus} {obj.zwoid} "); |
| | | } |
| | | else |
| | | { |
| | | try |
| | | var obj = JsonConvert.DeserializeObject<AutoLineMacQueueBak>(zwordstr); |
| | | if (!string.IsNullOrEmpty(obj.zwoid) && obj.zstatus == "200") |
| | | { |
| | | if (zwordstr.Contains("version错误")) |
| | | ConfigAOI1.zwoid = obj.zwoid; |
| | | Plc1.WriteSingleAddress(1524, 1, out _); |
| | | Plc1.WriteSingleAddress(1514, 1, out _); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Information, $"RabbitMQ zwoid获取成功 {obj.zstatus} {obj.zwoid} "); |
| | | |
| | | barcodeNow = barcode; |
| | | } |
| | | else |
| | | { |
| | | try |
| | | { |
| | | Regex reg = new Regex("[0-9]+", RegexOptions.IgnoreCase | RegexOptions.Singleline, TimeSpan.FromSeconds(2)); |
| | | MatchCollection matches = reg.Matches(obj.zerrmsg); |
| | | if (matches[0] != null && matches.Count == 3) |
| | | if (zwordstr.Contains("version错误")) |
| | | { |
| | | ConfigAOI1.mesnum2 = int.Parse(matches[0].Value)+1; |
| | | } |
| | | else |
| | | { |
| | | ConfigAOI1.mesnum2 = 0; |
| | | Regex reg = new Regex("[0-9]+", RegexOptions.IgnoreCase | RegexOptions.Singleline, TimeSpan.FromSeconds(2)); |
| | | MatchCollection matches = reg.Matches(obj.zerrmsg); |
| | | if (matches[0] != null && matches.Count == 3) |
| | | { |
| | | ConfigAOI1.mesnum2 = int.Parse(matches[0].Value) + 1; |
| | | } |
| | | else |
| | | { |
| | | ConfigAOI1.mesnum2 = 0; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | } |
| | | Plc1.WriteSingleAddress(1524, 2, out _); |
| | | Plc1.WriteSingleAddress(1514, 1, out _); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Information, $"RabbitMQ zwoid获取失败 {zwordstr} "); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Plc1.WriteSingleAddress(1524, 2, out _); |
| | | Plc1.WriteSingleAddress(1514, 1, out _); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Information, $"RabbitMQ zwoid获取失败 {zwordstr} "); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Exception, $"RabbitMQ zwoid获取异常 返回数据为 {zwordstr},异常错误{ex.GetExceptionMessage()}"); |
| | | } |
| | | } |
| | | catch(Exception ex) |
| | | { |
| | | Plc1.WriteSingleAddress(1524, 2, out _); |
| | | Plc1.WriteSingleAddress(1514, 1, out _); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Exception, $"RabbitMQ zwoid获取异常 返回数据为 {zwordstr},异常错误{ex.GetExceptionMessage()}"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | else |
| | | { |
| | |
| | | M141Config.numpro = 0; |
| | | } |
| | | M141Config.numpro++; |
| | | if (M141Config.mesnum2 >= 50) |
| | | { |
| | | M141Config.mesnum2 = 0; |
| | | } |
| | | M141Config.mesnum2++; |
| | | var tems = Task.Run(() => mqtt.MESForProduceAsync(pro, M141Config.mesnum2.ToString(), M141Config.numpro, endtray)).Result; |
| | | if (tems == null) |
| | | { |
| | |
| | | |
| | | Plc3 = invokeDevice as PLCBase; |
| | | |
| | | bool Issuccess = false; |
| | | |
| | | bool Issuccess = false; |
| | | bool Issuccess1 = false; |
| | | |
| | | //LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"产品信息记录保存触发"); |
| | | |
| | | var plcnum = Plc3.Read(2100, 1, out _); |
| | | |
| | | Issuccess = GetProImformation(plcnum[0]); |
| | | |
| | | |
| | | var plcnum = Plc3.Read(2100, 1, out _); |
| | | var plcnum1 = Plc3.Read(2102, 1, out _); |
| | | //上传MES |
| | | Issuccess = GetProImformation(plcnum[0]); |
| | | Issuccess1 = GetProImformation(plcnum1[0]); |
| | | |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"产品信息记录保存触发 获取PLC序号{plcnum[0]}和{plcnum1[0]}"); |
| | |
| | | |
| | | private bool GetProImformation(int PLC_order) |
| | | { |
| | | bool reasult = false; |
| | | if (PLC_order == 0) |
| | | { |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"PLC反馈机械手吸盘无产品"); |
| | |
| | | var plist = mysqlhelper.GetProductList(PLC_order + "_1"); |
| | | if (plist != null) |
| | | { |
| | | if (!M141Config.Productioncode.Any(u => u.PID == plist[0].PID)) |
| | | ProductModel newp = new ProductModel(); |
| | | newp.SEQUENCE = plist[0].SEQUENCE; |
| | | newp.PID = plist[0].PID; |
| | | newp.BasketCode = plist[0].BasketCode; |
| | | newp.Zword = plist[0].Zword; |
| | | newp.Result = "OK"; |
| | | newp.SN = plist[0].SN; |
| | | string tary_ID = string.Empty; |
| | | //正常上传 |
| | | reasult = UptoMES(newp, "N", out tary_ID); |
| | | if (!string.IsNullOrEmpty(tary_ID)) |
| | | { |
| | | int num = M141Config.Productioncode.Count + 1; |
| | | M141Config.Productioncode.Add(new ProductionID |
| | | M141Config.MES_codes.Add(new MES_code |
| | | { |
| | | Uptomesid = num, |
| | | PID = plist[0].PID, |
| | | SEQUENCE = plist[0].SEQUENCE, |
| | | BasketCode = plist[0].BasketCode, |
| | | Zword = plist[0].Zword, |
| | | //newp.Result = "OK"; |
| | | SN = plist[0].SN |
| | | Printers_code = tary_ID |
| | | }); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"产品{plist[0].PID}数据记录成功"); |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Error, $"产品{plist[0].PID}数据重复,记录失败"); |
| | | return false; |
| | | } |
| | | //isStartclear = true; |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Action, $"MES上传产品{plist[0].PID}时获取到条码{tary_ID}"); |
| | | } |
| | | return reasult; |
| | | //if (!M141Config.Productioncode.Any(u => u.PID == plist[0].PID)) |
| | | //{ |
| | | // int num = M141Config.Productioncode.Count + 1; |
| | | // M141Config.Productioncode.Add(new ProductionID |
| | | // { |
| | | // Uptomesid = num, |
| | | // PID = plist[0].PID, |
| | | // SEQUENCE = plist[0].SEQUENCE, |
| | | // BasketCode = plist[0].BasketCode, |
| | | // Zword = plist[0].Zword, |
| | | // //newp.Result = "OK"; |
| | | // SN = plist[0].SN |
| | | // }); |
| | | // LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"产品{plist[0].PID}数据记录成功"); |
| | | // return true; |
| | | //} |
| | | //else |
| | | //{ |
| | | // LogAsync(DateTime.Now, EnumHelper.LogLevel.Error, $"产品{plist[0].PID}数据重复,记录失败"); |
| | | // return false; |
| | | //} |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 产品零盘上传启动标识 |
| | | /// </summary> |
| | | private bool isStartclear =false; |
| | | ///// <summary> |
| | | ///// 产品零盘上传启动标识 |
| | | ///// </summary> |
| | | //private bool isStartclear =false; |
| | | |
| | | [ProcessMethod("", "MEStogetcode", "MES上传整批数据并获取条码", InvokeType.TestInvoke)] |
| | | public ResponseMessage MEStogetcode(IOperationConfig config, IDevice invokeDevice, IDevice sourceDevice) |
| | |
| | | bool Issuccess = false; |
| | | bool Issuccess1 = false; |
| | | |
| | | // LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"产品信息上传mes触发"); |
| | | var plcnum = Plc3.Read(2100, 1, out _); |
| | | Issuccess = GetProImformation(plcnum[0]); |
| | | |
| | | var plcnum = Plc3.Read(2100, 1, out _); |
| | | var plcnum1 = Plc3.Read(2102, 1, out _); |
| | | Issuccess1 = GetProImformation(plcnum1[0]); |
| | | |
| | | |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"产品信息上传mes触发,获取PLC序号{plcnum[0]}和{plcnum1[0]}"); |
| | | |
| | | string saveTary_ID= string.Empty; |
| | | |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"产品信息上传MES触发,产品信息数量为:{M141Config.Productioncode.Count}"); |
| | | |
| | | if (M141Config.Productioncode.Count == 50) |
| | | { |
| | | //产品正常上传 |
| | | while (M141Config.Productioncode.Count>0) |
| | | if (plcnum[0] != 0 && plcnum1[0] != 0) |
| | | { |
| | | //正常上传一片产品 |
| | | Issuccess = GetProImformation(plcnum[0]); |
| | | //最后一片产品判断是否需要上传尾盘零数 |
| | | if (M141Config.MES_codes.Count>0) |
| | | { |
| | | //需要上传尾盘 |
| | | var plist = mysqlhelper.GetProductList(plcnum1[0] + "_1"); |
| | | ProductModel newp = new ProductModel(); |
| | | newp.SEQUENCE = M141Config.Productioncode[0].SEQUENCE; |
| | | newp.PID = M141Config.Productioncode[0].PID; |
| | | newp.BasketCode = M141Config.Productioncode[0].BasketCode; |
| | | newp.Zword = M141Config.Productioncode[0].Zword; |
| | | newp.SEQUENCE = plist[0].SEQUENCE; |
| | | newp.PID = plist[0].PID; |
| | | newp.BasketCode = plist[0].BasketCode; |
| | | newp.Zword = plist[0].Zword; |
| | | newp.Result = "OK"; |
| | | newp.SN = M141Config.Productioncode[0].SN; |
| | | newp.SN = plist[0].SN; |
| | | string tary_ID = string.Empty; |
| | | bool isok = true; |
| | | if (M141Config.Productioncode.Count==1) |
| | | //正常上传 |
| | | Issuccess1 = UptoMES(newp, "Y", out tary_ID); |
| | | |
| | | if (!string.IsNullOrEmpty(tary_ID)) |
| | | { |
| | | if (isStartclear) |
| | | { |
| | | |
| | | isok = UptoMES(newp, "Y", out tary_ID); |
| | | isStartclear = false; |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"产品{newp.PID}启动零盘尾数上传"); |
| | | } |
| | | else |
| | | { |
| | | isok = UptoMES(newp, "N", out tary_ID); |
| | | } |
| | | StartPrint(tary_ID, "Honeywell PX240S (300 dpi)"); |
| | | M141Config.MES_codes.Clear(); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"条码:{tary_ID}零盘尾数已触发S6打印并且保存"); |
| | | M141Config.mesnum2 = 0; |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | //不需要上传尾盘 |
| | | var plist = mysqlhelper.GetProductList(plcnum1[0] + "_1"); |
| | | ProductModel newp = new ProductModel(); |
| | | newp.SEQUENCE = plist[0].SEQUENCE; |
| | | newp.PID = plist[0].PID; |
| | | newp.BasketCode = plist[0].BasketCode; |
| | | newp.Zword = plist[0].Zword; |
| | | newp.Result = "OK"; |
| | | newp.SN = plist[0].SN; |
| | | string tary_ID = string.Empty; |
| | | //正常上传 |
| | | Issuccess1 = UptoMES(newp, "N", out tary_ID); |
| | | |
| | | if (!string.IsNullOrEmpty(tary_ID)) |
| | | { |
| | | StartPrint(tary_ID, "Honeywell PX240S (300 dpi)"); |
| | | M141Config.MES_codes.Clear(); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"条码:{tary_ID}已触发S6打印并且保存"); |
| | | } |
| | | else |
| | | { |
| | | isok = UptoMES(newp, "N", out tary_ID); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Error, $"条码:{tary_ID}已触发S6打印并且保存"); |
| | | } |
| | | |
| | | if (!isok) |
| | | { |
| | | Plc3.WriteSingleAddress(2120, 2, out _); |
| | | return msg; |
| | | } |
| | | if (M141Config.Isprint && !string.IsNullOrEmpty(tary_ID)) |
| | | { |
| | | if (M141Config.Productioncode.Count == 1) |
| | | { |
| | | saveTary_ID = tary_ID; |
| | | StartPrint(tary_ID, "Honeywell PX240S (300 dpi)"); |
| | | M141Config.MES_codes.Add(new MES_code |
| | | { |
| | | Printers_code = tary_ID |
| | | }); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"条码:{tary_ID}已触发S6打印并且保存"); |
| | | } |
| | | else |
| | | { |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Error, $"条码:{tary_ID}不是在最后一件产品获取,启动零盘清除复位产品上传动作"); |
| | | isStartclear = true; |
| | | } |
| | | |
| | | } |
| | | M141Config.Productioncode.RemoveAt(0); |
| | | } |
| | | M141Config.Productioncode.Clear(); |
| | | } |
| | | else if (M141Config.Productioncode.Count > 50) |
| | | else if (plcnum1[0] == 0 && plcnum[0] != 0) |
| | | { |
| | | //中途有产品被取走导致条码大于实际数量 |
| | | for (int i = 0; i < 50; i++) |
| | | Issuccess =true; |
| | | if (M141Config.MES_codes.Count > 0) |
| | | { |
| | | //需要上传尾盘 |
| | | var plist = mysqlhelper.GetProductList(plcnum[0] + "_1"); |
| | | ProductModel newp = new ProductModel(); |
| | | int count = M141Config.Productioncode.Count; |
| | | newp.SEQUENCE = M141Config.Productioncode[count - 1].SEQUENCE; |
| | | newp.PID = M141Config.Productioncode[count - 1].PID; |
| | | newp.BasketCode = M141Config.Productioncode[count - 1].BasketCode; |
| | | newp.Zword = M141Config.Productioncode[count - 1].Zword; |
| | | newp.SEQUENCE = plist[0].SEQUENCE; |
| | | newp.PID = plist[0].PID; |
| | | newp.BasketCode = plist[0].BasketCode; |
| | | newp.Zword = plist[0].Zword; |
| | | newp.Result = "OK"; |
| | | newp.SN = M141Config.Productioncode[count - 1].SN; |
| | | newp.SN = plist[0].SN; |
| | | string tary_ID = string.Empty; |
| | | bool isok = true; |
| | | if (i==49) |
| | | { |
| | | if (isStartclear) |
| | | { |
| | | isok = UptoMES(newp, "Y", out tary_ID); |
| | | isStartclear = false; |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"产品{newp.PID}启动零盘尾数上传"); |
| | | } |
| | | else |
| | | { |
| | | isok = UptoMES(newp, "N", out tary_ID); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //正常上传 |
| | | Issuccess1 = UptoMES(newp, "Y", out tary_ID); |
| | | |
| | | isok = UptoMES(newp, "N", out tary_ID); |
| | | } |
| | | if (!isok) |
| | | if (!string.IsNullOrEmpty(tary_ID)) |
| | | { |
| | | Plc3.WriteSingleAddress(2120, 2, out _); |
| | | return msg; |
| | | StartPrint(tary_ID, "Honeywell PX240S (300 dpi)"); |
| | | M141Config.MES_codes.Clear(); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"条码:{tary_ID}零盘尾数已触发S6打印并且保存"); |
| | | M141Config.mesnum2 = 0; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //不需要上传尾盘 |
| | | var plist = mysqlhelper.GetProductList(plcnum[0] + "_1"); |
| | | ProductModel newp = new ProductModel(); |
| | | newp.SEQUENCE = plist[0].SEQUENCE; |
| | | newp.PID = plist[0].PID; |
| | | newp.BasketCode = plist[0].BasketCode; |
| | | newp.Zword = plist[0].Zword; |
| | | newp.Result = "OK"; |
| | | newp.SN = plist[0].SN; |
| | | string tary_ID = string.Empty; |
| | | //正常上传 |
| | | Issuccess1 = UptoMES(newp, "N", out tary_ID); |
| | | |
| | | if (!string.IsNullOrEmpty(tary_ID)) |
| | | { |
| | | StartPrint(tary_ID, "Honeywell PX240S (300 dpi)"); |
| | | M141Config.MES_codes.Clear(); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"条码:{tary_ID}已触发S6打印并且保存"); |
| | | } |
| | | } |
| | | } |
| | | else if(plcnum[0] == 0 && plcnum1[0] != 0) |
| | | { |
| | | Issuccess = true; |
| | | if (M141Config.MES_codes.Count > 0) |
| | | { |
| | | //需要上传尾盘 |
| | | var plist = mysqlhelper.GetProductList(plcnum1[0] + "_1"); |
| | | ProductModel newp = new ProductModel(); |
| | | newp.SEQUENCE = plist[0].SEQUENCE; |
| | | newp.PID = plist[0].PID; |
| | | newp.BasketCode = plist[0].BasketCode; |
| | | newp.Zword = plist[0].Zword; |
| | | newp.Result = "OK"; |
| | | newp.SN = plist[0].SN; |
| | | string tary_ID = string.Empty; |
| | | //正常上传 |
| | | Issuccess1 = UptoMES(newp, "Y", out tary_ID); |
| | | |
| | | if (!string.IsNullOrEmpty(tary_ID)) |
| | | { |
| | | StartPrint(tary_ID, "Honeywell PX240S (300 dpi)"); |
| | | M141Config.MES_codes.Clear(); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"条码:{tary_ID}零盘尾数已触发S6打印并且保存"); |
| | | M141Config.mesnum2 = 0; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //不需要上传尾盘 |
| | | var plist = mysqlhelper.GetProductList(plcnum1[0] + "_1"); |
| | | ProductModel newp = new ProductModel(); |
| | | newp.SEQUENCE = plist[0].SEQUENCE; |
| | | newp.PID = plist[0].PID; |
| | | newp.BasketCode = plist[0].BasketCode; |
| | | newp.Zword = plist[0].Zword; |
| | | newp.Result = "OK"; |
| | | newp.SN = plist[0].SN; |
| | | string tary_ID = string.Empty; |
| | | //正常上传 |
| | | Issuccess1 = UptoMES(newp, "N", out tary_ID); |
| | | |
| | | if (!string.IsNullOrEmpty(tary_ID)) |
| | | { |
| | | StartPrint(tary_ID, "Honeywell PX240S (300 dpi)"); |
| | | M141Config.MES_codes.Clear(); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"条码:{tary_ID}已触发S6打印并且保存"); |
| | | |
| | | } |
| | | if (M141Config.Isprint && !string.IsNullOrEmpty(tary_ID)) |
| | | { |
| | | if (i == 49) |
| | | { |
| | | saveTary_ID = tary_ID; |
| | | StartPrint(tary_ID, "Honeywell PX240S (300 dpi)"); |
| | | M141Config.MES_codes.Add(new MES_code |
| | | { |
| | | Printers_code = tary_ID |
| | | }); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"条码:{tary_ID}已触发S6打印并且保存"); |
| | | } |
| | | else |
| | | { |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Error, $"条码:{tary_ID}不是在最后一件产品获取,启动零盘清除复位产品上传动作"); |
| | | isStartclear = true; |
| | | } |
| | | |
| | | } |
| | | M141Config.Productioncode.RemoveAt(count - 1); |
| | | } |
| | | M141Config.Productioncode.Clear(); |
| | | } |
| | | else if (M141Config.Productioncode.Count > 0 && M141Config.Productioncode.Count < 50) |
| | | |
| | | if (Issuccess && Issuccess1) |
| | | { |
| | | //产品缺少需要清除零盘 |
| | | while (M141Config.Productioncode.Count > 0) |
| | | { |
| | | ProductModel newp = new ProductModel(); |
| | | newp.SEQUENCE = M141Config.Productioncode[0].SEQUENCE; |
| | | newp.PID = M141Config.Productioncode[0].PID; |
| | | newp.BasketCode = M141Config.Productioncode[0].BasketCode; |
| | | newp.Zword = M141Config.Productioncode[0].Zword; |
| | | newp.Result = "OK"; |
| | | newp.SN = M141Config.Productioncode[0].SN; |
| | | string tary_ID = string.Empty; |
| | | bool isok = false; |
| | | |
| | | if (M141Config.Productioncode.Count==1) |
| | | { |
| | | isok = UptoMES(newp, "Y", out tary_ID); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"产品{newp.PID}启动零盘尾数上传"); |
| | | } |
| | | else |
| | | { |
| | | isok = UptoMES(newp, "N", out tary_ID); |
| | | } |
| | | if (!isok) |
| | | { |
| | | Plc3.WriteSingleAddress(2120, 2, out _); |
| | | return msg; |
| | | } |
| | | if (M141Config.Isprint && !string.IsNullOrEmpty(tary_ID)) |
| | | { |
| | | if (M141Config.Productioncode.Count == 1) |
| | | { |
| | | saveTary_ID = tary_ID; |
| | | StartPrint(tary_ID, "Honeywell PX240S (300 dpi)"); |
| | | M141Config.MES_codes.Add(new MES_code |
| | | { |
| | | Printers_code = tary_ID |
| | | }); |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"条码:{tary_ID}已触发S6打印并且保存"); |
| | | } |
| | | else |
| | | { |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Error, $"条码:{tary_ID}不是在最后一件产品获取,启动零盘清除复位产品上传动作"); |
| | | isStartclear = true; |
| | | } |
| | | } |
| | | M141Config.Productioncode.RemoveAt(0); |
| | | } |
| | | M141Config.Productioncode.Clear(); |
| | | Plc3.WriteSingleAddress(2120, 1, out _); |
| | | } |
| | | else if (M141Config.Productioncode.Count == 0) |
| | | else |
| | | { |
| | | if (M141Config.Isprint && !string.IsNullOrEmpty(saveTary_ID)) |
| | | { |
| | | StartPrint(saveTary_ID, "Honeywell PX240S (300 dpi)"); |
| | | } |
| | | Plc3.WriteSingleAddress(2120, 2, out _); |
| | | } |
| | | Plc3.WriteSingleAddress(2120, 1, out _); |
| | | return msg; |
| | | |
| | | return msg; |
| | | } |
| | | |
| | | [ProcessMethod("", "MESup1", "MES上传进料口空篮", InvokeType.TestInvoke)] |