| | |
| | | using System.Collections.Generic; |
| | | using System.Diagnostics; |
| | | using System.Drawing.Imaging; |
| | | using System.Drawing.Printing; |
| | | using System.IO; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using Windows.ApplicationModel.Appointments; |
| | | using Windows.Devices.PointOfService; |
| | | using ZXing; |
| | | using ZXing.QrCode; |
| | | using static Bro.Common.Helper.EnumHelper; |
| | | using static Bro.Process.ProcessControl; |
| | | using static Org.BouncyCastle.Math.EC.ECCurve; |
| | |
| | | ThHeartPlc.IsBackground = true; |
| | | ThHeartPlc.Start(); |
| | | } |
| | | |
| | | printDocument1.PrintPage += new PrintPageEventHandler(printDocument_Print); |
| | | } |
| | | |
| | | public override void ProcessRunStateChanged() |
| | |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Error, $"未设置plc"); |
| | | } |
| | | _errorSpec = M141Config.SpecCollection.FirstOrDefault(u => u.Code == M141Config.CheckErrorSpecCode) as Spec; |
| | | |
| | | |
| | | |
| | | //InitialProductList(); |
| | | |
| | |
| | | if (obj.zstatus == "200") |
| | | { |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Assist, $"产品{pList[0].PID}数据上传MES成功 {Msgreceice}"); |
| | | |
| | | if (M141Config.Isprint && !string.IsNullOrEmpty(obj.tary_label)) |
| | | { |
| | | StartPrint(obj.tary_label); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | return new ResponseMessage(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | #region 打印机相关 |
| | | PrintDocument printDocument1 = new PrintDocument(); |
| | | string Printmessage = ""; |
| | | |
| | | public void StartPrint(string str) |
| | | { |
| | | try |
| | | { |
| | | int ttwith = 320; |
| | | int ttheigh = 160; |
| | | Printmessage = str; |
| | | |
| | | this.printDocument1.DefaultPageSettings.PrinterSettings.PrinterName = "Honeywell PX240S (300 dpi)"; |
| | | this.printDocument1.DefaultPageSettings.PaperSize = new PaperSize("Custum", ttwith, ttheigh); |
| | | |
| | | this.printDocument1.PrintController = new System.Drawing.Printing.StandardPrintController(); |
| | | this.printDocument1.Print(); |
| | | |
| | | } |
| | | catch |
| | | { |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | //C229M2508250500002 |
| | | 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 |
| | | { |
| | | var g = e.Graphics; |
| | | g.Clear(Color.White); |
| | | BarcodeWriter writer = new BarcodeWriter(); |
| | | writer.Format = BarcodeFormat.QR_CODE; |
| | | QrCodeEncodingOptions options = new QrCodeEncodingOptions() |
| | | { |
| | | DisableECI = true,//设置内容编码 |
| | | CharacterSet = "UTF-8", //设置二维码的宽度和高度 |
| | | Width = 123, |
| | | Height = 123, |
| | | Margin = 1//设置二维码的边距,单位不是固定像素 |
| | | }; |
| | | |
| | | writer.Options = options; |
| | | Bitmap map = writer.Write(Printmessage); |
| | | e.Graphics.DrawImage(map, new System.Drawing.Point(90, 10)); |
| | | |
| | | // 在二维码下方画内容文字 |
| | | using (Font font = new Font("Arial", 10)) |
| | | using (Brush brush3 = new SolidBrush(Color.Black)) |
| | | { |
| | | // 让文字居中到二维码下方 |
| | | SizeF textSize = e.Graphics.MeasureString(Printmessage, font); |
| | | float textX = 90 + (map.Width - textSize.Width) / 2; |
| | | float textY = 10 + map.Height; |
| | | |
| | | e.Graphics.DrawString(Printmessage, font, brush3, textX, textY); |
| | | } |
| | | |
| | | } |
| | | catch (Exception ee) |
| | | { |
| | | |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Exception, ee.ToString()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | public class DefectNGRecord |