/// <summary> /// 加载标签文档 /// </summary> private void LoadLppx(string strHead, string startSn, string Productname, int printNum) { string mdl = string.Empty; if (this.rb_printmodel1.Checked) { mdl = "SFCSN1.lab"; } else { mdl = "SFCSN.lab"; } string labpath = string.Format(@"{0}\{1}\{2}", System.IO.Directory.GetCurrentDirectory(), "Print", mdl); if (!File.Exists(labpath)) { mFrm.ShowPrgMsg("条码档没有找找到,正在从Ftp下载..", MainParent.MsgType.Warning); FrmBLL.Ftp_MyFtp ftp = new FrmBLL.Ftp_MyFtp(); ftp.DownloadFile(mdl, System.AppDomain.CurrentDomain.BaseDirectory + "Print", mdl); mFrm.ShowPrgMsg("标签文档下载完成", MainParent.MsgType.Outgoing); } lppx = new LabelManager2.ApplicationClass(); doc = lppx.Documents.Open(labpath, true); doc.ViewMode = LabelManager2.enumViewMode.lppxViewModeSize; }
private void eventopenlablefile(string filename) { if (!Directory.Exists(System.IO.Directory.GetCurrentDirectory() + @"\Print")) { Directory.CreateDirectory(System.IO.Directory.GetCurrentDirectory() + @"\Print"); } if (!File.Exists(filename)) //判断条码文件是否存在 { this.isprinter = false; ShowMP.ShowPrgMsg("条码档没有找找到,正在从Ftp下载..", MainParent.MsgType.Warning); FrmBLL.Ftp_MyFtp ftp = new FrmBLL.Ftp_MyFtp(); ftp.DownloadFile("FEIXUN_LOT.Lab", System.AppDomain.CurrentDomain.BaseDirectory + "Print", "FEIXUN_LOT.Lab"); ShowMP.ShowPrgMsg("下载完成", MainParent.MsgType.Outgoing); // ShowMP.ShowPrgMsg("条码档没有找找到,请确认当前目录是否存在 FEIXUN_LOT.lab", MainParent.MsgType.Error); } this.isprinter = true; lbl = new ApplicationClass(); lbl.Documents.Open(labelfilepatch.Text.Trim(), false);// 调用设计好的label文件 }
private void bt_expkpmaster_Click(object sender, EventArgs e) { try { if (this.RecDr == null) { this.mFrm.ShowPrgMsg("请双击需要打印的料表编号", MainParent.MsgType.Warning); return; } if (!File.Exists(string.Format("{0}Excel\\KpMaster.xlt", System.AppDomain.CurrentDomain.BaseDirectory))) { FrmBLL.Ftp_MyFtp ftp = new FrmBLL.Ftp_MyFtp(); ftp.DownloadFile("KpMaster.xlt", System.AppDomain.CurrentDomain.BaseDirectory + "Excel", "KpMaster.xlt"); } string FileNameTemp = string.Format("{0}Excel\\待审核_{1}_{2}_{3}_{4}.xls", System.AppDomain.CurrentDomain.BaseDirectory, this.RecDr.Cells["masterId"].Value.ToString(), this.RecDr.Cells["partnumber"].Value.ToString(), this.RecDr.Cells["machine"].Value.ToString(), this.RecDr.Cells["pcbside"].Value.ToString()); FrmBLL.ClsAllExcel excel = new FrmBLL.ClsAllExcel(); this.mFrm.ShowPrgMsg("正在生成报表", MainParent.MsgType.Outgoing); excel.OpenFileName = string.Format("{0}Excel\\KpMaster.xlt", System.AppDomain.CurrentDomain.BaseDirectory); // FileNameTemp; excel.OpenExcelFile(); //SMT料站表 excel.setOneCellValue(1, 1, this.RecDr.Cells["reserve2"].Value.ToString() != "审核通过" ? "SMT料站表--待审核" : "SMT料站表"); //excel.setOneCellValue(2, 7, this.RecDr.Cells["userId"].Value.ToString());//制作人 excel.setOneCellValue(2, 2, this.RecDr.Cells["masterId"].Value.ToString()); //料表编号 excel.setOneCellValue(3, 2, this.RecDr.Cells["machine"].Value.ToString()); //机器编号 excel.setOneCellValue(4, 2, this.RecDr.Cells["partnumber"].Value.ToString()); //产品料号 excel.setOneCellValue(5, 2, this.RecDr.Cells["bomver"].Value.ToString()); //BOM版本 excel.setOneCellValue(5, 7, this.RecDr.Cells["reserve1"].Value.ToString()); //SMT程式 excel.setOneCellValue(4, 4, this.RecDr.Cells["modelname"].Value.ToString()); //产品型号 excel.setOneCellValue(5, 4, this.RecDr.Cells["pcbside"].Value.ToString()); //PCB面 for (int i = 0; i < this.dgv_ShowKPDetalt.Rows.Count - 1; i++) { excel.setOneCellValue(8 + i, 1, this.dgv_ShowKPDetalt["stationno", i].Value.ToString()); excel.setOneCellValue(8 + i, 2, this.dgv_ShowKPDetalt["kpnumber", i].Value.ToString()); excel.setOneCellValue(8 + i, 3, this.dgv_ShowKPDetalt["kpdesc", i].Value.ToString()); excel.setOneCellValue(8 + i, 4, this.dgv_ShowKPDetalt["kpdistinct", i].Value.ToString()); excel.setOneCellValue(8 + i, 5, this.dgv_ShowKPDetalt["replacegroup", i].Value.ToString()); excel.setOneCellValue(8 + i, 6, this.dgv_ShowKPDetalt["priorityclass", i].Value.ToString()); excel.setOneCellValue(8 + i, 7, this.dgv_ShowKPDetalt["loction", i].Value.ToString()); excel.setOneCellValue(8 + i, 8, this.dgv_ShowKPDetalt["_reserve", i].Value.ToString()); } excel.CellsDrawFrame(8, 1, this.dgv_ShowKPDetalt.Rows.Count - 2 + 8, 8, true, true, true, true, true, true, false, false, Excel.XlLineStyle.xlDashDot, Excel.XlBorderWeight.xlHairline, Excel.XlColorIndex.xlColorIndexNone); excel.SaveFileName = FileNameTemp; bool isView = false; if (MessageBoxEx.Show("是否预览文件?\n是 请选择[Yes] 否则请选择[NO]", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes) { isView = true; } excel.SaveAsExcel(isView); excel.CloseExcelApplication(); this.mFrm.ShowPrgMsg("报表生成完成", MainParent.MsgType.Outgoing); } catch (Exception ex) { this.mFrm.ShowPrgMsg(ex.Message, MainParent.MsgType.Error); } }