private void btnPrint_Click(object sender, EventArgs e) { try { PrinterSettings printSet = new PrinterSettings();//打印机设置 if (this.pageSet != null) { printDocument.DefaultPageSettings = this.pageSet; } printD.PrinterSettings = printSet; printD.Document = printDocument; printDocument.DocumentName = "InWeightPrint"; if (printD.ShowDialog() == DialogResult.OK) { printDocument.Print(); } //添加二次打印日志 try { string strLogID = Guid.NewGuid().ToString().Replace("-", "").ToLower(); string strPrintDate = DateTime.Now.ToString(); //BLL.TT_EmptyWeight bllEmpty = new CoalTraffic.BLL.TT_EmptyWeight(); BLL.TT_TwoPrintLog bblTwoPrint = new CoalTraffic.BLL.TT_TwoPrintLog(); if (bblTwoPrint.AddTwoPrint(strLogID, StaticParameter.UserName, strPrintDate, "TT_CarInfo", _strCarCode)) { #region 断网时,添加二次打印日志sql语句 string isConnection = ini.IniReadValue("Connection", "isConnection"); if (isConnection == "1") { StringBuilder strSql = new StringBuilder(); strSql.Append("insert TT_TwoPrintLog(LogID,Operator,PrintDate,PrintTable,PrintWeightCode) Values('" + strLogID + "','入境煤过磅',"); strSql.Append("'" + StaticParameter.UserName + "','" + strPrintDate + "','TT_CarInfo','" + _strCarCode + "')"); string id = DateTime.Now.ToString("yyyyMMddHHmmss"); StringBuilder sbsqlcontext = new StringBuilder(); sbsqlcontext.Append("insert into NetWorkDisconnection (ID, SQLcontext, DateTime) values(@id,@sqlcontext,@datetime)"); SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@id",id), new SqlParameter("@sqlcontext",strSql.ToString()), new SqlParameter("@datetime",DateTime.Now) }; DbHelperSQL.ExecuteSql(sbsqlcontext.ToString(), parameters); } #endregion } } catch { } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnPrint_Click(object sender, EventArgs e) { try { PrinterSettings printSet = new PrinterSettings();//打印机设置 if (this.pageSet != null) { printDocument.DefaultPageSettings = this.pageSet; } printD.PrinterSettings = printSet; printD.Document = printDocument; printDocument.DocumentName = "NavicertCard"; if (printD.ShowDialog() == DialogResult.OK) { printDocument.Print(); } //添加二次打印日志 try { string strLogID = Guid.NewGuid().ToString().Replace("-", "").ToLower(); string strPrintDate = DateTime.Now.ToString(); //BLL.TT_EmptyWeight bllEmpty = new CoalTraffic.BLL.TT_EmptyWeight(); BLL.TT_TwoPrintLog bblTwoPrint = new CoalTraffic.BLL.TT_TwoPrintLog(); if (bblTwoPrint.AddTwoPrint(strLogID, StaticParameter.UserName, strPrintDate, "TT_Navicert", _strNavicertCode)) { #region 数据上传 try { MSMQClient MC = new MSMQClient(); StringBuilder strSql = new StringBuilder(); strSql.Append("insert TT_TwoPrintLog(LogID,LogType,Operator,PrintDate,PrintTable,PrintWeightCode) Values('" + strLogID + "','准运卡办理',"); strSql.Append("'" + StaticParameter.UserName + "','" + strPrintDate + "','TT_Navicert','" + _strNavicertCode + "')"); MC.AddNewSqlText(MC.ServerStation + MC.Prefix + "TT_TwoPrintLog" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix + strSql.ToString()); } catch { } #endregion this.Close(); } } catch { } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnPrint_Click(object sender, EventArgs e) { try { PrinterSettings printSet = new PrinterSettings();//打印机设置 if (this.pageSet != null) { printDocument.DefaultPageSettings = this.pageSet; } printD.PrinterSettings = printSet; printD.Document = printDocument; printDocument.DocumentName = "EmptyWeight"; if (printD.ShowDialog() == DialogResult.OK) { printDocument.Print(); } //添加二次打印日志 try { string strLogID = Guid.NewGuid().ToString().Replace("-", "").ToLower(); string strPrintDate = DateTime.Now.ToString(); //BLL.TT_EmptyWeight bllEmpty = new CoalTraffic.BLL.TT_EmptyWeight(); BLL.TT_TwoPrintLog bblTwoPrint = new CoalTraffic.BLL.TT_TwoPrintLog(); if (bblTwoPrint.AddTwoPrint(strLogID, StaticParameter.UserName, strPrintDate, "TT_CarInfo", _strCarCode)) { #region 数据上传 try { MSMQClient MC = new MSMQClient(); StringBuilder strSql = new StringBuilder(); strSql.Append("insert TT_TwoPrintLog(LogID,Operator,PrintDate,PrintTable,PrintWeightCode) Values('" + strLogID + "',"); strSql.Append("'" + StaticParameter.UserName + "','" + strPrintDate + "','TT_CarInfo','" + _strCarCode + "')"); MC.AddSqlToServer(strSql.ToString()); //CoalTraffic.MessagingService.LocalWeightServiceClient loalclient = new CoalTraffic.MessagingService.LocalWeightServiceClient(); //loalclient.AddTwoPrint(strLogID, StaticParameter.UserName, strPrintDate, "TT_CarInfo", _strCarCode); } catch { } #endregion } } catch { } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnPrint_Click(object sender, EventArgs e) { try { PrinterSettings printSet = new PrinterSettings();//打印机设置 if (this.pageSet != null) { printDocument.DefaultPageSettings = this.pageSet; } printD.PrinterSettings = printSet; printD.Document = printDocument; printDocument.DocumentName = "LoadWeight"; if (printD.ShowDialog() == DialogResult.OK) { printDocument.Print(); } //添加二次打印日志 try { string strLogID = Guid.NewGuid().ToString().Replace("-", "").ToLower(); string strPrintDate = DateTime.Now.ToString(); BLL.TT_TwoPrintLog bllEmpty = new CoalTraffic.BLL.TT_TwoPrintLog(); if (bllEmpty.AddTwoPrint(strLogID, StaticParameter.UserName, strPrintDate, "TT_LoadWeight", _strWeightCode)) { #region 数据上传 MSMQClient MC = new MSMQClient(); MSMQserver mqServer = new MSMQserver(); string isConnection = ini.IniReadValue("Connection", "isConnection"); StringBuilder strSql = new StringBuilder(); strSql.Append("insert TT_TwoPrintLog(LogID,LogType,Operator,PrintDate,PrintTable,PrintWeightCode) Values('" + strLogID + "','重车过磅',"); strSql.Append("'" + StaticParameter.UserName + "','" + strPrintDate + "','TT_LoadWeight','" + _strWeightCode + "')"); if (isConnection == "0") { mqServer.AddMsmq(MC.ServerStation + MC.Prefix + "TT_TwoPrintLog" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix + strSql.ToString()); } else { MC.AddNewSqlText(MC.ServerStation + MC.Prefix + "TT_TwoPrintLog" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix + strSql.ToString()); } //CoalTraffic.MessagingService.LocalWeightServiceClient loalclient = new CoalTraffic.MessagingService.LocalWeightServiceClient(); //loalclient.AddTwoPrint(strLogID, StaticParameter.UserName, strPrintDate, "TT_LoadWeight", _strWeightCode); #endregion } this.Close(); } catch { } } catch (Exception ex) { MessageBox.Show(ex.Message); } }