protected void lkAdd_Click(object sender, EventArgs e) { string strEmptyWeightID = this.gdvList.DataKeys[Convert.ToInt32(this.hdKey.Value)].Value.ToString(); TT_CarInfo tt_empty = new TT_CarInfo(); TDTK.IndustryPlatform.CoalTraffic.BLL.TT_CarInfo bllempty = new TDTK.IndustryPlatform.CoalTraffic.BLL.TT_CarInfo(); tt_empty = bllempty.GetModel(strEmptyWeightID); string strReturnValue = ""; if (tt_empty != null) { strReturnValue= strEmptyWeightID + "|" + tt_empty.CarNo + "|" + tt_empty.CarType + "|" + tt_empty.EmptyWeight + "|" + tt_empty.MostWeight + "|" + tt_empty.CarHight + "|" + tt_empty.CarLength + "|" + tt_empty.CarWidth; } ScriptManager.RegisterStartupScript(this.UpdatePanel1,Page.GetType(), "", "this.top.currForm.returnvalue='" + strReturnValue + "';this.top.currForm.close();", true); }
public static string GetEmptyWeightInfo(string strCarCode) { TT_CarInfo tt_empty = new TT_CarInfo(); TDTK.IndustryPlatform.CoalTraffic.BLL.TT_CarInfo bllempty = new TDTK.IndustryPlatform.CoalTraffic.BLL.TT_CarInfo(); tt_empty = bllempty.GetModel(strCarCode); if (tt_empty != null) { return strCarCode + "|" + tt_empty.CarNo + "|" + tt_empty.CarType + "|" + tt_empty.EmptyWeight + "|" + tt_empty.MostWeight; } else { return ""; } }
protected void btnSave_Click(object sender, ImageClickEventArgs e) { string strMsg = ""; if (this.txtEmptyCode.Text.Trim() == "") strMsg += "请输入或选择车辆编号!\\r\\n"; if (this.txtNavicertCode.Text.Trim() == "") strMsg += "请输入准运卡号!"; else { if(DbHelperSQL.Exists("Select Count(0) from TT_MarkedCard where MarkedCardCode='" + this.txtNavicertCode.Text.Trim().Replace("'", "''") + "'")) strMsg += "您输入的卡号在标识卡中已经使用"; } if (strMsg != "") { MessageBox.Show(this, strMsg); return; } SqlParameter[] parameters = { new SqlParameter("@CarNo", SqlDbType.NVarChar,20), new SqlParameter("@NavicertCode", SqlDbType.VarChar,20) }; parameters[0].Value = txtCarNo.Text.Trim(); parameters[1].Value = txtNavicertCode.Text.Trim(); DataTable dt = DbHelperSQL.TRunProcedure("PT_NavicertCardJudge", parameters); if (dt.Rows.Count > 0) { string strNavicertJudge = dt.Rows[0]["ReturnValue"].ToString(); if (strNavicertJudge != "0" && strNavicertJudge != "3") //0:已发给别人,不能办理 1:从未办理,可以办理 2:可以更新,可以办理 3:车辆已有准运卡,不能办理一张新的 { try { TDTK.IndustryPlatform.CoalTraffic.Model.TT_CarInfo modelCarInfo = new TDTK.IndustryPlatform.CoalTraffic.BLL.TT_CarInfo().GetModel(txtEmptyCode.Text.Trim().Replace("'", "''")); decimal dDiff=Convert.ToDecimal(DbHelperSQL.GetSingle("Select BusinName from Sys_Dictionary where BusinID='2' and BusinTypeID='1017'")); tt_navic.NavicertCode = this.txtNavicertCode.Text.Trim(); tt_navic.NavicertNo = (Convert.ToDecimal(tt_navic.NavicertCode) + dDiff).ToString(); tt_navic.ClaimPersonName = this.txtClaimPersonName.Text.Trim(); tt_navic.CarCode = txtEmptyCode.Text.Trim(); tt_navic.Remark = txtRemark.Text.Trim(); tt_navic.CarNo = modelCarInfo.CarNo; tt_navic.CarType = modelCarInfo.CarType; tt_navic.EmptyWeight = modelCarInfo.EmptyWeight; tt_navic.MostWeight = modelCarInfo.MostWeight; tt_navic.RoomCode = "0"; tt_navic.CarOwnerIDCard = modelCarInfo.CarOwnerIDCard; tt_navic.CarOwnerName = modelCarInfo.CarOwnerName; tt_navic.CarOwnerPhone = modelCarInfo.CarOwnerPhone; tt_navic.StartTime = DateTime.Now; tt_navic.EndTime = DateTime.MaxValue; tt_navic.NavicertState = "1"; tt_navic.CardType = "1"; tt_navic.SendPerson = CookieManager.GetCookieValue("UserName"); tt_navic.IsForbid = "0"; tt_navic.RemoteCardCode = txtReadRemoteCode.Text.Trim(); bool bolSuccess = false; if (strNavicertJudge == "1") { bolSuccess = bllNavic.Add(tt_navic); #region 数据同步到各磅房 if (bolSuccess) { //StringBuilder sbInsert = new StringBuilder(); //sbInsert.Append("insert into TT_Navicert(NavicertCode,RoomCode,CarCode,CarNo,CarType,CarOwnerName,NavicertState,"); //sbInsert.Append("CardType,StartTime,EndTime,SendPerson,ClaimPersonName,CarOwnerPhone,CarOwnerIDCard,MostWeight,"); //sbInsert.Append("EmptyWeight,IsForbid,Remark,NavicertNo) values ('" + tt_navic.NavicertCode + "','" + tt_navic.RoomCode + "',"); //sbInsert.Append("'" + tt_navic.CarCode + "','" + tt_navic.CarNo + "','" + tt_navic.CarType + "','" + tt_navic.CarOwnerName + "',"); //sbInsert.Append("'" + tt_navic.NavicertState + "','" + tt_navic.CardType + "','" + tt_navic.StartTime + "','" + tt_navic.EndTime + "',"); //sbInsert.Append("'" + tt_navic.SendPerson + "','" + tt_navic.ClaimPersonName + "','" + tt_navic.CarOwnerPhone + "',"); //sbInsert.Append("'" + tt_navic.CarOwnerIDCard + "','" + tt_navic.MostWeight + "','" + tt_navic.EmptyWeight + "',"); //sbInsert.Append("'" + tt_navic.IsForbid + "','" + tt_navic.Remark + "','"+tt_navic.NavicertNo+"');"); //if (tt_navic.RemoteCardCode != "") // sbInsert.Append("Update TT_CarInfo Set RemoteCardCode='" + tt_navic.RemoteCardCode + "' where CarCode='" + tt_navic.CarCode + "'"); //MsmqManage mq = new MsmqManage(); //string strMq = mq.AllStation + mq.Prefix + "TT_Navicert" + mq.Prefix + mq.AddFlg + mq.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + mq.Prefix + sbInsert.ToString(); //mq.AddMsmq(strMq.ToString());禁用消息队列 } #endregion } else if (strNavicertJudge == "2") { string strSql = "Select NavicertCode from TT_Navicert where CarNo='" + tt_navic.CarNo.Replace("'", "''") + "' and NavicertState='1'"; string strID = DbHelperSQL.GetSingle(strSql).ToString(); tt_navic.NavicertCode = strID; bolSuccess = bllNavic.Update(tt_navic); #region 数据同步到各磅房 if (bolSuccess) { //StringBuilder strUpdate = new StringBuilder(); //strUpdate.Append("update TT_Navicert set RoomCode='" + tt_navic.RoomCode + "',CarCode='" + tt_navic.CarCode + "',"); //strUpdate.Append("CarNo='" + tt_navic.CarNo + "',CarType='" + tt_navic.CarType + "',"); //strUpdate.Append("CarOwnerName='" + tt_navic.CarOwnerName + "',NavicertState='" + tt_navic.NavicertState + "',"); //strUpdate.Append("CardType='" + tt_navic.CardType + "',StartTime='" + tt_navic.StartTime + "',"); //strUpdate.Append("EndTime='" + tt_navic.EndTime + "',SendPerson='" + tt_navic.SendPerson + "',"); //strUpdate.Append("ClaimPersonName='" + tt_navic.ClaimPersonName + "',CarOwnerPhone='" + tt_navic.CarOwnerPhone + "',"); //strUpdate.Append("CarOwnerIDCard='" + tt_navic.CarOwnerIDCard + "',MostWeight='" + tt_navic.MostWeight + "',"); //strUpdate.Append("EmptyWeight='" + tt_navic.EmptyWeight + "',IsForbid='" + tt_navic.IsForbid + "',"); //strUpdate.Append("Remark='" + tt_navic.Remark + "' where NavicertNo='" + tt_navic.NavicertCode + "';"); //if (tt_navic.RemoteCardCode != "") // strUpdate.Append("Update TT_CarInfo Set RemoteCardCode='" + tt_navic.RemoteCardCode + "' where CarCode='" + tt_navic.CarCode + "'"); //MsmqManage mq = new MsmqManage(); //string strMq = mq.AllStation + mq.Prefix + "TT_Navicert" + mq.Prefix + mq.EditFlg + mq.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + mq.Prefix + strUpdate.ToString(); //mq.AddMsmq(strMq.ToString());禁用消息队列 } #endregion } if (bolSuccess) { ClearText(); string strTitle = ConfigurationManager.AppSettings["Customer"] + ""; string strJs = "Print('" + tt_navic.NavicertCode + "','" + strTitle + "');"; ClientScript.RegisterStartupScript(this.GetType(), "", strJs, true); } else { MessageBox.Show(this, "准运卡办理失败"); } } catch (Exception ex) { MessageBox.Show(this, ex.ToString()); } } else if (strNavicertJudge == "0") { MessageBox.Show(this, "该准运卡已发给其它车辆,不能再次办理"); } else if (strNavicertJudge == "3") { ClearText(); MessageBox.Show(this, "该车辆已有准运卡,不能再为其办理一张新的准运卡,如需更换,请先将原准运卡挂失"); } } }
protected void btnSave_Click(object sender, ImageClickEventArgs e) { string strMsg = ""; if (this.txtEmptyCode.Text.Trim() == "") strMsg += "请输入或选择车辆编号!\\r\\n"; if (this.txtNavicertCode.Text.Trim() == "") strMsg += "请输入准运卡号!"; else { //if (DbHelperSQL.Exists("Select Count(0) from TT_MarkedCard where MarkedCardCode='" + this.txtNavicertCode.Text.Trim().Replace("'", "''") + "'")) if (DbHelperSQL.Exists("select NavicertCode from TT_Navicert where NavicertCode='" + txtNavicertCode.Text.Trim() + "'")) strMsg += "您输入的卡号已经发给别的车辆,请从新输入准运卡号!"; } if (strMsg != "") { MessageBox.Show(this, strMsg); return; } SqlParameter[] parameters = { new SqlParameter("@CarNo", SqlDbType.NVarChar,20),//车牌号 new SqlParameter("@NavicertCode", SqlDbType.VarChar,20),//准运卡号 }; parameters[0].Value = txtCarNo.Text.Trim(); parameters[1].Value = txtNavicertCode.Text.Trim(); DataTable dt = DbHelperSQL.TRunProcedure("PT_NavicertCardJudge", parameters); if (dt.Rows.Count > 0) { string strNavicertJudge = dt.Rows[0]["ReturnValue"].ToString(); try { TDTK.IndustryPlatform.CoalTraffic.Model.TT_CarInfo modelCarInfo = new TDTK.IndustryPlatform.CoalTraffic.BLL.TT_CarInfo().GetModel(txtEmptyCode.Text.Trim().Replace("'", "''")); #region 禁用准运卡表里该条记录 #region 服务器禁用准运卡 bool Success = false; TDTK.IndustryPlatform.CoalTraffic.Model.TT_Navicert model = new TDTK.IndustryPlatform.CoalTraffic.Model.TT_Navicert(); string strSql = "Select NavicertCode from TT_Navicert where CarNo='" + modelCarInfo.CarNo.Replace("'", "''") + "' and NavicertState='1'"; string strID = DbHelperSQL.GetSingle(strSql).ToString(); model = bllNavic.GetModel(strID); model.IsForbid = "1"; model.Remark = "因补办被禁用"; Success = bllNavic.Update(model); #endregion #region 禁用指定的准运卡信息同步到各个磅房 if (Success) { //StringBuilder strUpdate = new StringBuilder(); //strUpdate.Append("update TT_Navicert set RoomCode='" + model.RoomCode + "',CarCode='" + model.CarCode + "',"); //strUpdate.Append("CarNo='" + model.CarNo + "',CarType='" + model.CarType + "',"); //strUpdate.Append("CarOwnerName='" + model.CarOwnerName + "',NavicertState='" + model.NavicertState + "',"); //strUpdate.Append("CardType='" + model.CardType + "',StartTime='" + model.StartTime + "',"); //strUpdate.Append("EndTime='" + model.EndTime + "',SendPerson='" + model.SendPerson + "',"); //strUpdate.Append("ClaimPersonName='" + model.ClaimPersonName + "',CarOwnerPhone='" + model.CarOwnerPhone + "',"); //strUpdate.Append("CarOwnerIDCard='" + model.CarOwnerIDCard + "',MostWeight='" + model.MostWeight + "',"); //strUpdate.Append("EmptyWeight='" + model.EmptyWeight + "',IsForbid='" + model.IsForbid + "',"); //strUpdate.Append("Remark='" + model.Remark + "' where NavicertNo='" + model.NavicertCode + "';"); //if (model.RemoteCardCode != "") // strUpdate.Append("Update TT_CarInfo Set RemoteCardCode='" + model.RemoteCardCode + "' where CarCode='" + tt_navic.CarCode + "'"); //MsmqManage mq = new MsmqManage(); //string strMq = mq.AllStation + mq.Prefix + "TT_Navicert" + mq.Prefix + mq.EditFlg + mq.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + mq.Prefix + strUpdate.ToString(); //mq.AddMsmq(strMq.ToString()); #region 禁用指定的准运卡信息同步到各个磅房 string strSQL = "update TT_Navicert set IsForbid='1',Remark='因补办被禁用' where NavicertCode=" + strID; MsmqManage mq = new MsmqManage(); string strMq = mq.AllStation + mq.Prefix + "TT_Navicert" + mq.Prefix + mq.EditFlg + mq.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + mq.Prefix + strSQL; mq.AddMsmq(strMq.ToString()); #endregion } #endregion #endregion #region 插入新的准运卡信息到服务器 decimal dDiff = Convert.ToDecimal(DbHelperSQL.GetSingle("Select BusinName from Sys_Dictionary where BusinID='2' and BusinTypeID='1017'")); tt_navic.NavicertCode = this.txtNavicertCode.Text.Trim(); tt_navic.NavicertNo = (Convert.ToDecimal(tt_navic.NavicertCode) + dDiff).ToString(); tt_navic.ClaimPersonName = this.txtClaimPersonName.Text.Trim();//领卡人 tt_navic.CarCode = txtEmptyCode.Text.Trim(); tt_navic.Remark = txtRemark.Text.Trim() + "原准运卡号:" + model.NavicertCode;//备注 tt_navic.CarNo = modelCarInfo.CarNo; tt_navic.CarType = modelCarInfo.CarType; tt_navic.EmptyWeight = modelCarInfo.EmptyWeight; tt_navic.MostWeight = modelCarInfo.MostWeight; tt_navic.RoomCode = "0"; tt_navic.CarOwnerIDCard = modelCarInfo.CarOwnerIDCard; tt_navic.CarOwnerName = modelCarInfo.CarOwnerName; tt_navic.CarOwnerPhone = modelCarInfo.CarOwnerPhone; tt_navic.StartTime = DateTime.Now; tt_navic.EndTime = DateTime.MaxValue; tt_navic.NavicertState = "1"; tt_navic.CardType = "1"; tt_navic.SendPerson = ""; //CookieManager.GetCookieValue("UserName"); tt_navic.IsForbid = "0"; tt_navic.RemoteCardCode = txtReadRemoteCode.Text.Trim();//杨朋飞---添加了电子标签补办功能 bool bolSuccess = false; #region 插入一条新信息 bolSuccess = bllNavic.Add(tt_navic); #endregion #region 插入新的准运卡数据同步到各磅房 if (bolSuccess) { //StringBuilder sbInsert = new StringBuilder(); //sbInsert.Append("insert into TT_Navicert(NavicertCode,RoomCode,CarCode,CarNo,CarType,CarOwnerName,NavicertState,"); //sbInsert.Append("CardType,StartTime,EndTime,SendPerson,ClaimPersonName,CarOwnerPhone,CarOwnerIDCard,MostWeight,"); //sbInsert.Append("EmptyWeight,IsForbid,Remark,NavicertNo) values ('" + tt_navic.NavicertCode + "','" + tt_navic.RoomCode + "',"); //sbInsert.Append("'" + tt_navic.CarCode + "','" + tt_navic.CarNo + "','" + tt_navic.CarType + "','" + tt_navic.CarOwnerName + "',"); //sbInsert.Append("'" + tt_navic.NavicertState + "','" + tt_navic.CardType + "','" + tt_navic.StartTime + "','" + tt_navic.EndTime + "',"); //sbInsert.Append("'" + tt_navic.SendPerson + "','" + tt_navic.ClaimPersonName + "','" + tt_navic.CarOwnerPhone + "',"); //sbInsert.Append("'" + tt_navic.CarOwnerIDCard + "','" + tt_navic.MostWeight + "','" + tt_navic.EmptyWeight + "',"); //sbInsert.Append("'" + tt_navic.IsForbid + "','" + tt_navic.Remark + "','" + tt_navic.NavicertNo + "');"); //if (tt_navic.RemoteCardCode != "") // sbInsert.Append("Update TT_CarInfo Set RemoteCardCode='" + tt_navic.RemoteCardCode + "' where CarCode='" + tt_navic.CarCode + "'"); //MsmqManage mq = new MsmqManage(); //string strMq = mq.AllStation + mq.Prefix + "TT_Navicert" + mq.Prefix + mq.AddFlg + mq.Prefix + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + mq.Prefix + sbInsert.ToString(); //mq.AddMsmq(strMq.ToString());禁用消息队列 } #endregion #endregion if (bolSuccess && Success)//禁用准运卡信息和插入新的准运卡信息成功 { ClearText(); string strTitle = ConfigurationManager.AppSettings["Customer"] + ""; string strJs = "Print('" + tt_navic.NavicertCode + "','" + strTitle + "');"; ClientScript.RegisterStartupScript(this.GetType(), "", strJs, true); } else { MessageBox.Show(this, "准运卡办理失败"); } } catch (Exception ex) { MessageBox.Show(this, ex.ToString()); } } }