private void btnOK_Click(object sender, EventArgs e) { Model.TT_LoadWeight MLW = new TT_LoadWeight(); BLL.TT_LoadWeight BLW = new CoalTraffic.BLL.TT_LoadWeight(); if (strCurrentMenu != "Person") { MLW.LoadWeight = decimal.Parse(lblDigital.Text.Trim()); MLW.NetWeight = MLW.LoadWeight - Convert.ToDecimal(txtEmptyWeight.Text.Trim()); } else { #region 验证数据的正确性 if (txtHandDigital.Text.Trim() != "" && CommonMethod.IsDecimal(CommonMethod.ToDBC(txtHandDigital.Text.Trim()))) { if (Convert.ToDecimal(CommonMethod.ToDBC(txtHandDigital.Text.Trim())) < Convert.ToDecimal(lblDigital.Text.Trim())) { alSound.Alarm("你输入的重车重量不能小于磅秤重量"); txtHandDigital.Text = ""; return; } else { MLW.LoadWeight = Convert.ToDecimal(CommonMethod.ToDBC(txtHandDigital.Text.Trim())); MLW.NetWeight = MLW.LoadWeight - Convert.ToDecimal(txtEmptyWeight.Text.Trim()); } } else { alSound.Alarm("你输入的重车重量格式不对"); txtHandDigital.Text = ""; return; } #endregion } if (MLW.NetWeight > 0.00m) { #region 读取与煤矿相关的信息 SqlParameter[] parameter = { new SqlParameter("@CollCode", SqlDbType.VarChar,10), new SqlParameter("@CoalKindCode", SqlDbType.VarChar,4) }; parameter[0].Value = strCollCode; parameter[1].Value = strCoalKindCode; DataSet dstColieryAccount = DbHelperSQL.RunProcedure("PT_ColieryAccountJudge", parameter, "ColieryAccount"); #endregion string strLeastValue = dstColieryAccount.Tables["ColieryAccount"].Rows[0]["ReturnValue"].ToString(); string isConnection = ini.IniReadValue("Connection", "isConnection"); if (strLeastValue == "0") //0:正常,可过磅 { #region 视频抓图 if (StaticParameter.IsVideo == "1") { if (byteFrontImage == null && byteBackImage == null && byteUpImage == null && byteRoomImage == null) { strFrontImage = Guid.NewGuid().ToString().Replace("-", ""); strBackImage = Guid.NewGuid().ToString().Replace("-", ""); strUpImage = Guid.NewGuid().ToString().Replace("-", ""); strRoomImage = Guid.NewGuid().ToString().Replace("-", ""); byteFrontImage = this.videoFrontImage.CapturePic(); byteBackImage = this.videoBackImage.CapturePic(); byteUpImage = this.videoUpImage.CapturePic(); byteRoomImage = this.videoRoomImage.CapturePic(); } } #endregion #region 实例化重车过磅 string strWeightCode = strRoomCode + DateTime.Now.ToString("yyyyMMddHHmmss"); MLW.WeightCode = strWeightCode; MLW.TrafficCode = strWeightCode; MLW.NavicertCode = ""; MLW.MarkedCardCode = strMarkedCardCode; MLW.RemoteCardCode = ""; MLW.CollCode = strCollCode; MLW.CollName = strCollName; MLW.CoalKindCode = strCoalKindCode; MLW.CoalKindName = strCoalKindName; MLW.CarOwnerName = txtCarOwnerName.Text.Trim(); MLW.CarNo = txtCarNo.Text.Trim(); MLW.CarType = ""; MLW.EmptyWeight = decimal.Parse(txtEmptyWeight.Text.Trim()); MLW.OverWeight = 0.0m; MLW.RoomCode = strRoomCode; MLW.RoomName = strRoomName; MLW.BangType = "散煤" + strBangType + "过磅"; MLW.Operator = StaticParameter.UserName; MLW.WeightTime = DateTime.Now; MLW.RandomCode = CommonMethod.getRandom(4); MLW.CustomerName = "运煤去向"; MLW.TaxType = "正常扣税"; MLW.IsFirstSite = "1"; MLW.FrontImage = strFrontImage; MLW.BackImage = strBackImage; MLW.UpImage = strUpImage; MLW.RoomImage = strRoomImage; MLW.FrontImageContent = byteFrontImage; MLW.BackImageContent = byteBackImage; MLW.UpImageContent = byteUpImage; MLW.RoomImageContent = byteRoomImage; MLW.TaxObject = ConfigurationManager.AppSettings["TaxObject"].ToString(); MLW.EmptyCode = strEmptyCode; #endregion if (BLW.Add(MLW) != "") { if (BLW.Add(MLW) != "-1") { #region 当联网的时:插入同步sql语句到服务器,sql语句本地执行 if (isConnection == "0") { string strSqlLocal = "PT_LoadWeight '" + MLW.WeightCode + "','" + MLW.TrafficCode + "','" + MLW.NavicertCode + "','" + MLW.MarkedCardCode + "','" + MLW.RemoteCardCode + "'," + "'" + MLW.CollCode + "','" + MLW.CollName + "','" + MLW.CoalKindCode + "','" + MLW.CoalKindName + "','" + MLW.CarOwnerName + "'," + "'" + MLW.CarNo + "','" + MLW.CarType + "','" + MLW.LoadWeight + "','" + MLW.EmptyWeight + "','" + MLW.NetWeight + "'," + "'" + MLW.OverWeight + "','" + MLW.RoomCode + "','" + MLW.RoomName + "','" + MLW.BangType + "','" + MLW.Operator + "'," + "'" + MLW.WeightTime + "','" + MLW.RandomCode + "','" + MLW.CustomerName + "','" + MLW.TaxType + "','" + MLW.TaxObject + "'," + "'" + MLW.IsFirstSite + "','" + MLW.FrontImage + "','" + MLW.BackImage + "','" + MLW.UpImage + "','" + MLW.RoomImage + "'," + "null,null,null,null,'" + MLW.EmptyCode + "'"; string sqlInsert = "insert [NetWorkDisconnectionLog] (ID, SQLcontext, datetime, IP) values (@ID,@SQLcontext,@datetime,@IP)"; SqlParameter[] sqlpars = new SqlParameter[] { new SqlParameter("@ID",DateTime.Now.ToString("yyyyMMddHHmmss")), new SqlParameter("@SQLcontext",strSqlLocal.ToString()), new SqlParameter("@datetime",DateTime.Now.ToString()), new SqlParameter("@IP",ini.IniReadValue("Connection","LServer")) }; DbHelperSQL.ExecuteSql(sqlInsert, sqlpars); //插入同步sql语句 DbHelperSQL.ExecuteSql2(strSqlLocal.ToString(), "1");//sql语句本地执行 } #endregion #region 当断网时,添加重车过磅sql语句 string strSql = "PT_LoadWeight '" + MLW.WeightCode + "','" + MLW.TrafficCode + "','" + MLW.NavicertCode + "','" + MLW.MarkedCardCode + "','" + MLW.RemoteCardCode + "'," + "'" + MLW.CollCode + "','" + MLW.CollName + "','" + MLW.CoalKindCode + "','" + MLW.CoalKindName + "','" + MLW.CarOwnerName + "'," + "'" + MLW.CarNo + "','" + MLW.CarType + "','" + MLW.LoadWeight + "','" + MLW.EmptyWeight + "','" + MLW.NetWeight + "'," + "'" + MLW.OverWeight + "','" + MLW.RoomCode + "','" + MLW.RoomName + "','" + MLW.BangType + "','" + MLW.Operator + "'," + "'" + MLW.WeightTime + "','" + MLW.RandomCode + "','" + MLW.CustomerName + "','" + MLW.TaxType + "','" + MLW.TaxObject + "'," + "'" + MLW.IsFirstSite + "','" + MLW.FrontImage + "','" + MLW.BackImage + "','" + MLW.UpImage + "','" + MLW.RoomImage + "'," + "null,null,null,null,'" + MLW.EmptyCode + "'"; if (isConnection == "1") { 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 string strErro = ""; if (StaticParameter.IsHaveMarkedCard == "1") { strErro = "并回收标识卡"; } alSound.Alarm("散煤过磅成功,点击确定打印散煤过磅单" + strErro + ""); CommonMethod.MessageBox("散煤过磅成功,点击确定打印散煤过磅单" + strErro + "!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); #region 打印相关 Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); string strFileName = ""; if (StaticParameter.ReportFile == "FuYuan.") { strFileName = "ZiChang."; } else { strFileName = StaticParameter.ReportFile; } Type type = assembly.GetType("CoalTraffic.Report." + strFileName + "SpreadWeightPrint"); object obj = Activator.CreateInstance(type, MLW.WeightCode, true); Form formToShow = (Form)obj; formToShow.ShowDialog(); #endregion } else { alSound.Alarm("账户余额已不足本车的扣款,请通知" + txtCollName.Text.Trim() + "速来交费"); MessageBox.Show("账户余额已不足本车的扣款,请通知" + txtCollName.Text.Trim() + "速来交费!", "天大天科", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } else { if (isConnection == "0") { ini.IniWriteValue("Connection", "isConnection", CommonMethod.ToDBC("1")); MessageBox.Show("系统与服务器断开连接,请联系中心机房!", "天大天科", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); Application.ExitThread(); Application.Exit(); } else { alSound.Alarm("数据连接字符串库异常"); MessageBox.Show("数据连接字符串库异常", "天大天科", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); InsertState = 0; InsertBadReCordInfo("异常", strRoomName + "的数据库异常"); } } } else if (strLeastValue == "1") { alSound.Alarm("煤矿余额低于下限,不能继续过磅"); MessageBox.Show("煤矿余额低于下限,不能继续过磅", "天大天科", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else if (strLeastValue == "2") { alSound.Alarm("该煤矿不生产该煤种,不能继续过磅"); MessageBox.Show("该煤矿不生产该煤种,不能继续过磅", "天大天科", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); InsertState = 0; InsertBadReCordInfo("异常", strCollName + "不生产" + strCoalKindName); } else if (strLeastValue == "-1") { alSound.Alarm("该煤矿不存在,不能继续过磅"); MessageBox.Show("数据连接字符串库异常", "天大天科", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); InsertState = 0; InsertBadReCordInfo("异常", "编号为:" + strCollCode + "的煤矿不存在"); } this.ClearAllControl(); ClearUserControl(); } else { alSound.Alarm("煤炭净重异常"); MessageBox.Show("煤炭净重异常", "天大天科", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); InsertState = 0; InsertBadReCordInfo("异常", "车牌号为:" + txtCarNo.Text.Trim() + "车辆的煤炭净重异常"); } }
private void btnOK_Click(object sender, EventArgs e) { CoalTraffic.Model.TT_LoadWeight model = new CoalTraffic.Model.TT_LoadWeight(); if (cmbCustomers.SelectedValue.ToString() != "-1") { if (strCurrentMenu == "Auto") { model.LoadWeight = Convert.ToDecimal(lblDigital.Text); model.NetWeight = Convert.ToDecimal(lblDigital.Text) - Convert.ToDecimal(txtEmptyWeight.Text.Trim()); } else { #region ��֤���ݵ���ȷ�� if (txtHandDigital.Text.Trim() != "" && CommonMethod.IsDecimal(CommonMethod.ToDBC(txtHandDigital.Text.Trim()))) { if (Convert.ToDecimal(CommonMethod.ToDBC(txtHandDigital.Text.Trim())) < Convert.ToDecimal(lblDigital.Text.Trim())) { alarmSound.Alarm("��������س���������С�ڰ�������"); txtHandDigital.Text = ""; return; } else { model.LoadWeight = Convert.ToDecimal(CommonMethod.ToDBC(this.txtHandDigital.Text.Trim())); model.NetWeight = Convert.ToDecimal(CommonMethod.ToDBC(this.txtHandDigital.Text.Trim())) - Convert.ToDecimal(txtEmptyWeight.Text.Trim()); } } else { alarmSound.Alarm("��������س�������ʽ����"); txtHandDigital.Text = ""; return; } #endregion } if (model.NetWeight > 0.00m) { #region ��ȡ��ú����ص���Ϣ SqlParameter[] parameter = { new SqlParameter("@CollCode", SqlDbType.VarChar,10), new SqlParameter("@CoalKindCode", SqlDbType.VarChar,4) }; parameter[0].Value = strCollCode; parameter[1].Value = strCoalKindCode; DataSet dstColieryAccount = DbHelperSQL.RunProcedure("PT_ColieryAccountJudge", parameter, "ColieryAccount"); #endregion string strLeastValue = dstColieryAccount.Tables["ColieryAccount"].Rows[0]["ReturnValue"].ToString(); if (strLeastValue == "0") //0���������ɹ��� { #region ��Ƶץͼ //ץͼ��Ϣ byte[] byteFrontImage = null; byte[] byteBackImage = null; byte[] byteUpImage = null; byte[] byteRoomImage = null; //ͼƬ�洢��SYS_FileSave������ string strFrontImage = ""; string strBackImage = ""; string strUpImage = ""; string strRoomImage = ""; if (strIsVideo == "1") { strFrontImage = Guid.NewGuid().ToString().Replace("-", ""); strBackImage = Guid.NewGuid().ToString().Replace("-", ""); strUpImage = Guid.NewGuid().ToString().Replace("-", ""); strRoomImage = Guid.NewGuid().ToString().Replace("-", ""); byteFrontImage = ((DHVideo)Form1.PF.Controls["videoFrontImage"]).CapturePic(); byteBackImage = ((DHVideo)Form1.PF.Controls["videoBackImage"]).CapturePic(); byteUpImage = ((DHVideo)Form1.PF.Controls["videoUpImage"]).CapturePic(); byteRoomImage = ((DHVideo)Form1.PF.Controls["videoRoomImage"]).CapturePic(); } #endregion #region ʵ�����س� string strWeightCode = strRoomCode + DateTime.Now.ToString("yyyyMMddHHmmss"); model.WeightCode = strWeightCode; model.TrafficCode = strWeightCode; model.NavicertCode = strNavicertCode; model.MarkedCardCode = strMardedCardCode; model.RemoteCardCode = strRemoteCode; model.CollCode = strCollCode; model.CollName = this.txtCollName.Text.Trim(); model.CoalKindCode = strCoalKindCode; model.CoalKindName = this.txtKindName.Text; model.CarOwnerName = strCarOwnerName; model.CarNo = txtCarNo.Text; model.CarType = txtCarType.Text; model.EmptyWeight = Convert.ToDecimal(txtEmptyWeight.Text); model.OverWeight = 0; model.RoomCode = strRoomCode; model.RoomName = strRoomName; model.BangType = strBangType; model.Operator = StaticParameter.UserName; model.WeightTime = DateTime.Now; model.RandomCode = CommonMethod.getRandom(4); model.CustomerName = cmbCustomers.SelectedValue.ToString(); model.IsFirstSite = "1"; model.TaxType = "�س�������˰"; model.FrontImage = strFrontImage; model.BackImage = strBackImage; model.UpImage = strUpImage; model.RoomImage = strRoomImage; model.FrontImageContent = byteFrontImage; model.BackImageContent = byteBackImage; model.UpImageContent = byteUpImage; model.RoomImageContent = byteRoomImage; model.TaxObject = ConfigurationManager.AppSettings["TaxObject"].ToString(); model.EmptyCode = strEmptyCode; #endregion if (bll.Add(model) != "") { #region ��ӳɹ���������ͬ�� try { string strSql = "PT_LoadWeight '" + model.WeightCode + "','" + model.TrafficCode + "','" + model.NavicertCode + "','" + model.MarkedCardCode + "','" + model.RemoteCardCode + "'," + "'" + model.CollCode + "','" + model.CollName + "','" + model.CoalKindCode + "','" + model.CoalKindName + "','" + model.CarOwnerName + "'," + "'" + model.CarNo + "','" + model.CarType + "','" + model.LoadWeight + "','" + model.EmptyWeight + "','" + model.NetWeight + "'," + "'" + model.OverWeight + "','" + model.RoomCode + "','" + model.RoomName + "','" + model.BangType + "','" + model.Operator + "'," + "'" + model.WeightTime + "','" + model.RandomCode + "','" + model.CustomerName + "','" + model.TaxType + "','" + model.TaxObject + "'," + "'" + model.IsFirstSite + "','" + model.FrontImage + "','" + model.BackImage + "','" + model.UpImage + "','" + model.RoomImage + "'," + "'" + model.FrontImageContent + "','" + model.BackImageContent + "','" + model.UpImageContent + "','" + model.RoomImageContent + "','" + model.EmptyCode + "'"; MC.AddNewSqlText(MC.CheckStation + MC.Prefix + "TT_LoadWeight" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix + strSql); /********************************************************/ //Add By ����ӭ ��BSʵʱ��ط�������Ϣ���з����س�������Ϣ /********************************************************/ string loadMessage = model.RoomName + "," + model.CarOwnerName + "," + model.CoalKindName + "," + model.NavicertCode + "," + model.NetWeight.ToString() + "," + model.WeightTime.ToString();//������Ϣ��ʽ����������,����������ú������,�˿��ţ�ú̿���أ�����ʱ�� RealTimeMonitor monitor = new RealTimeMonitor();//������Ϣ monitor.SendEmptyWeightMessage(loadMessage); /********************************************************/ } catch { } #endregion string strErro = ""; if (strIsHaveMarkedCard == "1") { strErro = "�����ձ�ʶ��"; } alarmSound.Alarm("�����ɹ�,���ȷ����ӡ�س�������" + strErro + ""); CommonMethod.MessageBox("�����ɹ�,���ȷ����ӡ�س�������" + strErro + "!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); new CoalTraffic.Report.LoadWeightPrint(strWeightCode, true).ShowDialog(); } else { this.alarmSound.Alarm("��վ�����ݿ��쳣"); InsertState = 0; InsertBadReCordInfo("�쳣", txtCarNo.Text.Trim(), ini.IniReadValue("RoomSetting", "RoomName") + "�����ݿ��쳣"); } } else if (strLeastValue == "1") { alarmSound.Alarm("ú������������,���ܼ�������"); } else if (strLeastValue == "2") { alarmSound.Alarm("��ú��������ú��,���ܼ�������"); InsertState = 0; InsertBadReCordInfo("�쳣", txtCarNo.Text.Trim(), strCollName + "������" + strCoalKindName); } else if (strLeastValue == "-1") { alarmSound.Alarm("��ú����,���ܼ�������"); InsertState = 0; InsertBadReCordInfo("�쳣", txtCarNo.Text.Trim(), "���Ϊ��" + strCollCode + "��ú����"); } btnOK.Enabled = false; ClearAll(); if (strCard == "IC") icCard.FactoryCodeInitValue = ""; } else { alarmSound.Alarm("ú̿�����쳣"); InsertState = 0; InsertBadReCordInfo("�쳣", txtCarNo.Text.Trim(), "���ƺ�Ϊ��" + txtCarNo.Text.Trim() + "������ú̿�����쳣"); } } else { alarmSound.Alarm("��ѡ���ջ���λ"); } }
private void btnOK_Click(object sender, EventArgs e) { Model.TT_LoadWeight MLW = new TT_LoadWeight(); BLL.TT_LoadWeight BLW = new CoalTraffic.BLL.TT_LoadWeight(); if (strCurrentMenu != "Person") { MLW.LoadWeight = decimal.Parse(lblDigital.Text.Trim()); MLW.NetWeight = MLW.LoadWeight - Convert.ToDecimal(txtEmptyWeight.Text.Trim()); } else { #region 验证数据的正确性 if (txtHandDigital.Text.Trim() != "" && CommonMethod.IsDecimal(CommonMethod.ToDBC(txtHandDigital.Text.Trim()))) { if (Convert.ToDecimal(CommonMethod.ToDBC(txtHandDigital.Text.Trim())) < Convert.ToDecimal(lblDigital.Text.Trim())) { alSound.Alarm("你输入的重车重量不能小于磅秤重量"); txtHandDigital.Text = ""; return; } else { MLW.LoadWeight = Convert.ToDecimal(CommonMethod.ToDBC(txtHandDigital.Text.Trim())); MLW.NetWeight = MLW.LoadWeight - Convert.ToDecimal(txtEmptyWeight.Text.Trim()); } } else { alSound.Alarm("你输入的重车重量格式不对"); txtHandDigital.Text = ""; return; } #endregion } if (MLW.NetWeight > 0.00m) { #region 读取与煤矿相关的信息 SqlParameter[] parameter = { new SqlParameter("@CollCode", SqlDbType.VarChar,10), new SqlParameter("@CoalKindCode", SqlDbType.VarChar,4) }; parameter[0].Value = strCollCode; parameter[1].Value = strCoalKindCode; DataSet dstColieryAccount = DbHelperSQL.RunProcedure("PT_ColieryAccountJudge", parameter, "ColieryAccount"); #endregion string strLeastValue = dstColieryAccount.Tables["ColieryAccount"].Rows[0]["ReturnValue"].ToString(); if (strLeastValue == "0") //0:正常,可过磅 { #region 视频抓图 if (StaticParameter.IsVideo == "1") { if (byteFrontImage == null && byteBackImage == null && byteUpImage == null && byteRoomImage == null) { strFrontImage = Guid.NewGuid().ToString().Replace("-", ""); strBackImage = Guid.NewGuid().ToString().Replace("-", ""); strUpImage = Guid.NewGuid().ToString().Replace("-", ""); strRoomImage = Guid.NewGuid().ToString().Replace("-", ""); byteFrontImage = this.videoFrontImage.CapturePic(); byteBackImage = this.videoBackImage.CapturePic(); byteUpImage = this.videoUpImage.CapturePic(); byteRoomImage = this.videoRoomImage.CapturePic(); } } #endregion #region 实例化重车过磅 string strWeightCode = strRoomCode + DateTime.Now.ToString("yyyyMMddHHmmss"); MLW.WeightCode = strWeightCode; MLW.TrafficCode = strWeightCode; MLW.NavicertCode = ""; MLW.MarkedCardCode = strMarkedCardCode; MLW.RemoteCardCode = ""; MLW.CollCode = strCollCode; MLW.CollName = strCollName; MLW.CoalKindCode = strCoalKindCode; MLW.CoalKindName = strCoalKindName; MLW.CarOwnerName = txtCarOwnerName.Text.Trim(); MLW.CarNo = txtCarNo.Text.Trim(); MLW.CarType = ""; MLW.EmptyWeight = decimal.Parse(txtEmptyWeight.Text.Trim()); MLW.OverWeight = 0.0m; MLW.RoomCode = strRoomCode; MLW.RoomName = strRoomName; MLW.BangType = "散煤" + strBangType + "过磅"; MLW.Operator = StaticParameter.UserName; MLW.WeightTime = DateTime.Now; MLW.RandomCode = CommonMethod.getRandom(4); MLW.CustomerName = "运煤去向"; MLW.TaxType = "正常扣税"; MLW.IsFirstSite = "1"; MLW.FrontImage = strFrontImage; MLW.BackImage = strBackImage; MLW.UpImage = strUpImage; MLW.RoomImage = strRoomImage; MLW.FrontImageContent = byteFrontImage; MLW.BackImageContent = byteBackImage; MLW.UpImageContent = byteUpImage; MLW.RoomImageContent = byteRoomImage; MLW.TaxObject = ConfigurationManager.AppSettings["TaxObject"].ToString(); MLW.EmptyCode = strEmptyCode; #endregion if (BLW.Add(MLW) != "") { if (BLW.Add(MLW) != "-1") { #region 数据上传 try { //MSMQClient MC = new MSMQClient(); string strSql = "PT_LoadWeight '" + MLW.WeightCode + "','" + MLW.TrafficCode + "','" + MLW.NavicertCode + "','" + MLW.MarkedCardCode + "','" + MLW.RemoteCardCode + "'," + "'" + MLW.CollCode + "','" + MLW.CollName + "','" + MLW.CoalKindCode + "','" + MLW.CoalKindName + "','" + MLW.CarOwnerName + "'," + "'" + MLW.CarNo + "','" + MLW.CarType + "','" + MLW.LoadWeight + "','" + MLW.EmptyWeight + "','" + MLW.NetWeight + "'," + "'" + MLW.OverWeight + "','" + MLW.RoomCode + "','" + MLW.RoomName + "','" + MLW.BangType + "','" + MLW.Operator + "'," + "'" + MLW.WeightTime + "','" + MLW.RandomCode + "','" + MLW.CustomerName + "','" + MLW.TaxType + "','" + MLW.TaxObject + "'," + "'" + MLW.IsFirstSite + "','" + MLW.FrontImage + "','" + MLW.BackImage + "','" + MLW.UpImage + "','" + MLW.RoomImage + "'," + "null,null,null,null,'" + MLW.EmptyCode + "'"; MC.AddNewSqlText(MC.AllStation + MC.Prefix + "TT_LoadWeight" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix + strSql); //发送图片 string strIsSendPicToRoom = StaticParameter.IsSendPicToRoom; int iSend = MC.ServerStation; //是否发送磅房 if (strIsSendPicToRoom == "1") iSend = MC.AllStation; string strPic = ""; if (MLW.FrontImageContent != null) { strPic = iSend + MC.Prefix + "Sys_FileSave" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix + MLW.FrontImage + ",jpg," + Convert.ToBase64String(MLW.FrontImageContent, 0, MLW.FrontImageContent.Length); MC.AddNewSqlText(strPic); } if (MLW.BackImageContent != null) { strPic = iSend + MC.Prefix + "Sys_FileSave" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix + MLW.BackImage + ",jpg," + Convert.ToBase64String(MLW.BackImageContent, 0, MLW.BackImageContent.Length); MC.AddNewSqlText(strPic); } if (MLW.UpImageContent != null) { strPic = iSend + MC.Prefix + "Sys_FileSave" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix + MLW.UpImage + ",jpg," + Convert.ToBase64String(MLW.UpImageContent, 0, MLW.UpImageContent.Length); MC.AddNewSqlText(strPic); } if (MLW.RoomImageContent != null) { strPic = iSend + MC.Prefix + "Sys_FileSave" + MC.Prefix + MC.AddFlg + MC.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm;ss") + MC.Prefix + MLW.RoomImage + ",jpg," + Convert.ToBase64String(MLW.RoomImageContent, 0, MLW.RoomImageContent.Length); MC.AddNewSqlText(strPic); } } catch { } #endregion string strErro = ""; if (StaticParameter.IsHaveMarkedCard == "1") { strErro = "并回收标识卡"; } alSound.Alarm("散煤过磅成功,点击确定打印散煤过磅单" + strErro + ""); CommonMethod.MessageBox("散煤过磅成功,点击确定打印散煤过磅单" + strErro + "!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); string strFileName = ""; if (StaticParameter.ReportFile == "FuYuan.") { strFileName = "ZiChang."; } else { strFileName = StaticParameter.ReportFile; } Type type = assembly.GetType("CoalTraffic.Report." + strFileName + "SpreadWeightPrint"); object obj = Activator.CreateInstance(type, MLW.WeightCode, true); Form formToShow = (Form)obj; formToShow.ShowDialog(); } else { alSound.Alarm("账户余额已不足本车的扣款,请通知" + txtCollName.Text.Trim() + "速来交费"); } } else { alSound.Alarm("数据库异常"); InsertState = 0; InsertBadReCordInfo("异常", strRoomName + "的数据库异常"); } } else if (strLeastValue == "1") { alSound.Alarm("煤矿余额低于下限,不能继续过磅"); } else if (strLeastValue == "2") { alSound.Alarm("该煤矿不生产该煤种,不能继续过磅"); InsertState = 0; InsertBadReCordInfo("异常",strCollName + "不生产" + strCoalKindName); } else if (strLeastValue == "-1") { alSound.Alarm("该煤矿不存在,不能继续过磅"); InsertState = 0; InsertBadReCordInfo("异常", "编号为:" + strCollCode + "的煤矿不存在"); } this.ClearAllControl(); ClearUserControl(); } else { alSound.Alarm("煤炭净重异常"); InsertState = 0; InsertBadReCordInfo("异常", "车牌号为:" + txtCarNo.Text.Trim() + "车辆的煤炭净重异常"); } }
/// <summary> /// �õ�һ������ʵ�� /// </summary> public CoalTraffic.Model.TT_LoadWeight GetModel(string WeightCode) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 WeightCode,TrafficCode,NavicertCode,MarkedCardCode,RemoteCardCode,CollCode,CollName,CoalKindCode,CoalKindName,CarOwnerName,CarNo,CarType,LoadWeight,EmptyWeight,NetWeight,OverWeight,TaxAmount,FundAmount,RoomCode,RooName,BangType,Operator,WeightTime,RandomCode,CustomerName,TaxType,IsFirstSite,FrontImage,BackImage,UpImage,RoomImage,TaxGroup from TT_LoadWeight "); strSql.Append(" where WeightCode=@WeightCode "); SqlParameter[] parameters = { new SqlParameter("@WeightCode", SqlDbType.VarChar,50)}; parameters[0].Value = WeightCode; CoalTraffic.Model.TT_LoadWeight model = new CoalTraffic.Model.TT_LoadWeight(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { model.WeightCode=ds.Tables[0].Rows[0]["WeightCode"].ToString(); model.TrafficCode=ds.Tables[0].Rows[0]["TrafficCode"].ToString(); model.NavicertCode=ds.Tables[0].Rows[0]["NavicertCode"].ToString(); model.MarkedCardCode=ds.Tables[0].Rows[0]["MarkedCardCode"].ToString(); model.RemoteCardCode=ds.Tables[0].Rows[0]["RemoteCardCode"].ToString(); model.CollCode=ds.Tables[0].Rows[0]["CollCode"].ToString(); model.CollName = ds.Tables[0].Rows[0]["CollName"].ToString(); model.CoalKindCode=ds.Tables[0].Rows[0]["CoalKindCode"].ToString(); model.CoalKindName=ds.Tables[0].Rows[0]["CoalKindName"].ToString(); model.CarOwnerName=ds.Tables[0].Rows[0]["CarOwnerName"].ToString(); model.CarNo=ds.Tables[0].Rows[0]["CarNo"].ToString(); model.CarType=ds.Tables[0].Rows[0]["CarType"].ToString(); if(ds.Tables[0].Rows[0]["LoadWeight"].ToString()!="") { model.LoadWeight=decimal.Parse(ds.Tables[0].Rows[0]["LoadWeight"].ToString()); } if(ds.Tables[0].Rows[0]["EmptyWeight"].ToString()!="") { model.EmptyWeight=decimal.Parse(ds.Tables[0].Rows[0]["EmptyWeight"].ToString()); } if(ds.Tables[0].Rows[0]["NetWeight"].ToString()!="") { model.NetWeight=decimal.Parse(ds.Tables[0].Rows[0]["NetWeight"].ToString()); } if(ds.Tables[0].Rows[0]["OverWeight"].ToString()!="") { model.OverWeight=decimal.Parse(ds.Tables[0].Rows[0]["OverWeight"].ToString()); } if(ds.Tables[0].Rows[0]["TaxAmount"].ToString()!="") { model.TaxAmount=decimal.Parse(ds.Tables[0].Rows[0]["TaxAmount"].ToString()); } if(ds.Tables[0].Rows[0]["FundAmount"].ToString()!="") { model.FundAmount=decimal.Parse(ds.Tables[0].Rows[0]["FundAmount"].ToString()); } model.RoomCode=ds.Tables[0].Rows[0]["RoomCode"].ToString(); model.RoomName = ds.Tables[0].Rows[0]["RoomName"].ToString(); model.BangType=ds.Tables[0].Rows[0]["BangType"].ToString(); model.Operator=ds.Tables[0].Rows[0]["Operator"].ToString(); if(ds.Tables[0].Rows[0]["WeightTime"].ToString()!="") { model.WeightTime=DateTime.Parse(ds.Tables[0].Rows[0]["WeightTime"].ToString()); } model.RandomCode=ds.Tables[0].Rows[0]["RandomCode"].ToString(); model.CustomerName=ds.Tables[0].Rows[0]["CustomerName"].ToString(); model.TaxType=ds.Tables[0].Rows[0]["TaxType"].ToString(); model.IsFirstSite=ds.Tables[0].Rows[0]["IsFirstSite"].ToString(); model.FrontImage=ds.Tables[0].Rows[0]["FrontImage"].ToString(); model.BackImage=ds.Tables[0].Rows[0]["BackImage"].ToString(); model.UpImage=ds.Tables[0].Rows[0]["UpImage"].ToString(); model.RoomImage=ds.Tables[0].Rows[0]["RoomImage"].ToString(); if(ds.Tables[0].Rows[0]["TaxGroup"].ToString()!="") { model.TaxGroup=decimal.Parse(ds.Tables[0].Rows[0]["TaxGroup"].ToString()); } return model; } else { return null; } }