public OutLoadWeightPrint(string RoomName,string strWeightCode,string Carno,string Navicertcode, string CarType, string CoalKind,string InOrOut,string InWeight,string OutWeight,string OutBan,string strExceptLeft,string RandomCode,string WeightTime,string OperatorName,bool IsPrint) { InitializeComponent(); _RoomName = RoomName; _strWeightCode = strWeightCode; _Carno = Carno; _Navicertcode = Navicertcode; _CarType = CarType; _CoalKind = CoalKind; _InOrOut = InOrOut; _InWeight = InWeight; _OutWeight = OutWeight; _OutBan = OutBan; _strExceptLeft = strExceptLeft; _WeightTime = WeightTime; _IsPrint = IsPrint; _OperatorName = OperatorName; if (!_IsPrint) { _strRandomCode = CommonMethod.getRandom(4); string strUpdatesql = "update TT_OutLoadWeight set RandomCode = '" + _strRandomCode + "' where OutWeightCode = '" + strWeightCode + "'"; int IRow = DbHelperSQL.ExecuteSql(strUpdatesql); if (IRow != 0) { #region 数据上传 try { MSMQClient MC = new MSMQClient(); MSMQserver mqServer = new MSMQserver(); string isConnection = ini.IniReadValue("Connection", "isConnection"); if (isConnection == "0") { mqServer.AddMsmq(MC.AllStation + MC.Prefix + "TT_OutLoadWeight" + MC.Prefix + MC.EditFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix + strUpdatesql); } else { MC.AddNewSqlText(MC.AllStation + MC.Prefix + "TT_OutLoadWeight" + MC.Prefix + MC.EditFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix + strUpdatesql); } } catch { } #endregion } } }
public CheckSpreadWeightPrint(string strWeightCode, bool IsPrint) { InitializeComponent(); _strWeightCode = strWeightCode; _IsPrint = IsPrint; if (!_IsPrint) { string strRandomCode = CommonMethod.getRandom(4); string strUpdatesql = "update TT_LoadWeight set RandomCode = '" + strRandomCode + "' where WeightCode = '" + strWeightCode + "'"; int IRow = DbHelperSQL.ExecuteSql(strUpdatesql); if (IRow != 0) { #region 数据上传 try { MSMQClient MC = new MSMQClient(); MSMQserver mqServer = new MSMQserver(); string isConnection = ini.IniReadValue("Connection", "isConnection"); if (isConnection == "0") { mqServer.AddMsmq(MC.AllStation + MC.Prefix + "TT_LoadWeight" + MC.Prefix + MC.EditFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix + strUpdatesql); } else { MC.AddNewSqlText(MC.AllStation + MC.Prefix + "TT_LoadWeight" + MC.Prefix + MC.EditFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix + strUpdatesql); } } catch { } #endregion } } }
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); } }