using grproLib; using InjectionPC; using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; namespace PunchingMistake { public class Printer { /// /// 小件总成装配打印总成条码 /// public static void PrintPunchAssembleBarCode( string barCode, string partNo1, string partName, string serialNo) { string filename = GetPrintFileName(); DataTable headTable = new DataTable(); headTable.Columns.Add("BarCode"); headTable.Columns.Add("PartName"); headTable.Columns.Add("PartNo"); headTable.Columns.Add("BatchNo"); headTable.Columns.Add("SerialNo"); headTable.Columns.Add("Line"); DataRow row = headTable.NewRow(); row["BarCode"] = barCode; row["PartNo"] = partNo1; row["PartName"] = partName; row["BatchNo"] = DateTime.Now.ToString("yyMMdd"); row["SerialNo"] = serialNo; row["Line"] = ConfigurationManager.AppSettings["Line"]; string printBoxName = "Printer1"; string reportName = ConfigurationManager.AppSettings[printBoxName].ToString(); headTable.Rows.Add(row); ReportHelper rp = new ReportHelper(filename, headTable, null, (int)GRPaperOrientation.grpoLandscape, 1, reportName); rp.Report.Print(false); } static string GetPrintFileName() { if (Program.station == "F01") { return System.AppDomain.CurrentDomain.BaseDirectory + "Report\\总成条码MI.grf"; } return System.AppDomain.CurrentDomain.BaseDirectory + "Report\\总成条码MI.grf"; } } }