public LoadWeightPrint(string strWeightCode, bool IsPrint) { _strWeightCode = strWeightCode; _IsPrint = IsPrint; InitializeComponent(); taxItem = ini.IniReadValue("SysInfo", "LoadWeightTaxItem");//从配置文件读取税费项目信息 如:";重磅打印显示的税费项目 LoadWeightTaxItem=安全生产风险抵押金,国税,地税," 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(); 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 } } }
public EmptyWeightPrint(string strCarCode, bool ISPrint) { _strCarCode = strCarCode; _IsPrint = ISPrint; InitializeComponent(); if (!_IsPrint) { string strRandomCode = CommonMethod.getRandom(4); string strsql = "update TT_CarInfo set RandomCode = '" + strRandomCode + "' where CarCode = '" + strCarCode + "'"; int IRow = DbHelperSQL.ExecuteSql(strsql); if (IRow != 0) { #region 数据上传 try { MSMQClient MC = new MSMQClient(); MC.AddNewSqlText(MC.AllStation + MC.Prefix + "TT_CarInfo" + MC.Prefix + MC.EditFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix + strsql); } catch { } #endregion } } }
public SpreadWeightPrint(string strLoadWeight, bool IsPrint) { InitializeComponent(); _strLoadWeight = strLoadWeight; _IsPrint = IsPrint; if (!_IsPrint) { string strRandomCode = CommonMethod.getRandom(4); string strUpdatesql = "update TT_LoadWeight set RandomCode = '" + strRandomCode + "' where WeightCode = '" + strLoadWeight + "'"; int IRow = DbHelperSQL.ExecuteSql(strUpdatesql); if (IRow != 0) { #region 数据上传 try { MSMQClient MC = new MSMQClient(); 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 = "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); } }
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 } } }
protected void InsertBadReCordInfo(string strAlarmType, string strCarNo, string strDecript) { if (InsertState == 0) { #region 报警实体类 CoalTraffic.Model.TT_BadRecord modelBad = new CoalTraffic.Model.TT_BadRecord(); modelBad.AlarmType = strAlarmType; modelBad.BreakDate = DateTime.Now; modelBad.CarNo = strCarNo; modelBad.CollCode = ""; modelBad.Decript = ""; modelBad.NavicertCode = strNavicertCode; modelBad.RecordID = Guid.NewGuid().ToString().Replace("-", ""); modelBad.RoomCode = strRoomCode; modelBad.FrontImage = ""; modelBad.FrontImageContent = null; modelBad.RoomImage = ""; modelBad.RoomImageContent = null; modelBad.UpImage = ""; modelBad.UpImageContent = null; modelBad.BackImage = ""; modelBad.BackImageContent = null; #endregion #region 数据同步 MSMQClient MC = new MSMQClient(); StringBuilder sbInsertBR = new StringBuilder(); sbInsertBR.Append("PT_BadRecord '" + modelBad.RecordID + "','" + modelBad.NavicertCode + "','" + modelBad.RoomCode + "','" + modelBad.CarNo + "','" + modelBad.Decript + "',"); sbInsertBR.Append("'" + modelBad.BreakDate + "','" + modelBad.AlarmType + "','" + modelBad.AlarmStatus + "','" + modelBad.CollCode + "','" + modelBad.FrontImage + "',"); sbInsertBR.Append("'" + modelBad.FrontImageContent + "','" + modelBad.BackImage + "','" + modelBad.BackImageContent + "','" + modelBad.UpImage + "',"); sbInsertBR.Append("'" + modelBad.UpImageContent + "','" + modelBad.RoomImage + "','" + modelBad.RoomImageContent + "'"); MC.AddNewSqlText(sbInsertBR.ToString()); #endregion string strRecordID = new CoalTraffic.BLL.TT_BadRecord().Add(modelBad); //添加违规记录成功,上传违规记录到服务器 if (strRecordID != "") { InsertState = 0; } else { alarmSound.Alarm("该站的数据库异常"); InsertBadReCordInfo("异常", "", ini.IniReadValue("RoomSetting", "RoomName") + "的数据库异常"); InsertState = 0; } } }
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); } }
private void btnLogin_Click(object sender, EventArgs e) { MC = new MSMQClient(); if (cbxUserName.SelectedValue != null && txbPassWord.Text.Trim() != "") { string strUserCode = cbxUserName.SelectedValue.ToString(); string password = CommonMethod.MD5Crypt(txbPassWord.Text.Trim()); if (operbll.IsLoginInfo(strUserCode, password) > 0) { StaticParameter.UserCode = strUserCode; StaticParameter.UserName = cbxUserName.Text; string strLogType = "登录"; string strUserTable = "Sys_Operator"; string strUserIP = System.Net.Dns.Resolve(System.Net.Dns.GetHostName()).AddressList[0].ToString(); strUserCode = this.cbxUserName.SelectedValue.ToString(); string strUserDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); string strRemark = "登录CS调运系统"; string strSysCode = "s2000"; string strRelationID = strUserCode; StringBuilder sbsql = new StringBuilder(); sbsql.Append("insert into Sys_OperateLog (LogType,OperateTable,Operator,OperateDate,OperateIP,Remark,SysCode,RelationID)"); sbsql.Append(" values('" + strLogType + "','" + strUserTable + "','" + StaticParameter.UserName + "','" + strUserDate + "','" + strUserIP + "','" + strRemark + "','" + strSysCode + "','" + strRelationID + "')"); DbHelperSQL.ExecuteSql(sbsql.ToString()); //登陆日志上传到服务器 MC.AddNewSqlText(MC.ServerStation + MC.Prefix + "Sys_OperateLog" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix + sbsql.ToString()); if (_isFirst == "0") { this.Hide(); #region 登录成功之后选择系统 if (StaticParameter.UserCode != "0") { #region 非超级管理员登录 if (StaticParameter.FormType == "1") { new RMainForm(strUserCode).ShowDialog(); } else { new CMainForm(strUserCode).ShowDialog(); } #endregion } else { #region 超级管理员登录 if (StaticParameter.FormType == "2") { new CMainForm(strUserCode).ShowDialog(); } if (StaticParameter.FormType == "1") { new RMainForm(strUserCode).ShowDialog(); } #endregion } #endregion } else { this.DialogResult = DialogResult.OK; this.Close(); } } else { MessageBox.Show("登录验证失败,请检查用户名和密码后重新输入!", "天大天科调运系统", MessageBoxButtons.OK, MessageBoxIcon.Error); txbPassWord.Text = ""; } } else { MessageBox.Show("请检查用户名和密码后重新输入!", "天大天科调运系统", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btn_ok_Click(object sender, EventArgs e) { #region 判断信息 if (nWeight==0) { alarmSound.Alarm("没有读到车辆空皮重量或磅秤错误"); return; } if (cmbCoalName.Text=="请选择煤矿") { alarmSound.Alarm("请选择煤矿"); return; } if (cmbCoalKind.Text=="请选择煤种") { alarmSound.Alarm("请选择煤种"); return; } #endregion DateTime dtime = DateTime.Now; string strDateCode = dtime.Year.ToString() + dtime.Month.ToString() + dtime.Day.ToString() + dtime.Hour.ToString() + dtime.Minute.ToString() + dtime.Second.ToString(); string cmdText = "INSERT INTO dbo.TT_InWeight "; cmdText += "(NavicertCode,CarNo,CollCode,CollName,CoalKindCode,CoalKindName,"; cmdText += "LoadWeight,NetWeight,RoomName,Operator,BangType,BangTime,BangCode) "; cmdText += "values('"+txtNavicertCode.Text+"','"+txtCarNo.Text+"','"+cmbCoalName.SelectedValue+"','"; cmdText += cmbCoalName.Text+"','"+ cmbCoalKind.SelectedValue+"','"+cmbCoalKind.Text+"','"+decimal.Parse(txtHandDigital.Text)+"','"; cmdText+= decimal.Parse(txtNetWeight.Text)+"','"+ini.IniReadValue("RoomSetting", "RoomName")+"','"+StaticParameter.UserName+"','"+strCurrentMenu+"','"+dtime.ToString()+"','"+strDateCode+"')"; Model.TT_InWeight mdl_InWeight = new CoalTraffic.Model.TT_InWeight(); mdl_InWeight.NavicertCode = txtNavicertCode.Text; mdl_InWeight.CarNo = txtCarNo.Text; mdl_InWeight.CollCode = cmbCoalName.SelectedValue.ToString(); mdl_InWeight.CollName = cmbCoalName.Text; mdl_InWeight.CoalKindCode = cmbCoalKind.SelectedValue.ToString(); mdl_InWeight.CoalKindName = cmbCoalKind.Text; mdl_InWeight.LoadWeight = decimal.Parse(txtHandDigital.Text); mdl_InWeight.NetWeight = decimal.Parse(txtNetWeight.Text); mdl_InWeight.RoomName = ini.IniReadValue("RoomSetting", "RoomName"); mdl_InWeight.Operator = StaticParameter.UserName; mdl_InWeight.BangType = strCurrentMenu; mdl_InWeight.BangTime = dtime; mdl_InWeight.BangCode = strDateCode; mdl_InWeight.CarType = txtCarType.Text; mdl_InWeight.EmptyWeight = decimal.Parse(txt_EmpyWeight.Text); if (DbHelperSQL.ExecuteSql(cmdText)>0) { MSMQClient MC = new MSMQClient(); MC.AddNewSqlText(cmdText); txtCarNo.Text = string.Empty; MessageBox.Show("过磅成功……"); new Report.InWeightPrint(mdl_InWeight, true).ShowDialog(); ClearAllControl(); txtCarNo.Text = string.Empty; } }