private void txtEmptyCode_TextChanged(object sender, EventArgs e)
 {
     CoalTraffic.BLL.TT_Navicert bll = new CoalTraffic.BLL.TT_Navicert();
     DataSet ds = new DataSet();
     ds = bll.GetList("CarCode='" + this.txtEmptyCode.Text.Trim() + "'and NavicertState='1'");
     CoalTraffic.BLL.TT_CarInfo car = new CoalTraffic.BLL.TT_CarInfo();
     DataSet dscar = new DataSet();
     dscar = car.GetList("CarCode='" + this.txtEmptyCode.Text.Trim()+"'");
     if (ds.Tables[0].Rows.Count > 0)
     {
         txtRemark.Text = "原准运卡号:" + ds.Tables[0].Rows[0]["NavicertCode"].ToString() + "\r\n";
         txtRemark.Text += "原电子标签:" + dscar.Tables[0].Rows[0]["RemoteCardCode"].ToString();
     }
     else
     {
         txtRemark.Text = "";
     }
 }
        /// <summary>
        /// -补卡的方法
        /// </summary>
        public void Send()
        {
            string strError = "";
            if (txtBEmptyCode.Text.Trim() == "" || txtBCarNo.Text.Trim() == "")
                strError += "请选择车辆登记信息";
            if (IsHaveRemote == "1")
            {
                if (strReadRemoteCode == "")
                    strError += "没有读到电子标签,请刷电子标签!";
                else
                {
                    if (strReadRemoteCode.Split(',').Length > 1)
                    {
                        strError += "读到了多个电子标签,请确认周围是否只有一个电子标签";
                        txtBRemoteCard.Clear();
                    }
                }
            }
            if (strError != "")
            {
                alarmSound.Alarm(strError);
                MessageBox.Show(strError, "天大天科", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (txtBNavicertCode.Text.Trim() == "")
            {
                alarmSound.Alarm("请刷准运卡");
                MessageBox.Show("请刷准运卡", "天大天科", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            string sSQL = "select NavicertCode from TT_Navicert where NavicertCode='" + txtBNavicertCode.Text.Trim() + "'and NavicertState='1'";
            object OResult = DbHelperSQL.GetSingle(sSQL);
            if (OResult != null)
            {
                alarmSound.Alarm("此卡已经和其它车辆绑定请另外刷卡");
                MessageBox.Show("此卡已经和其它车辆绑定请另外刷卡", "天大天科", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            strNavicertCode = txtBNavicertCode.Text.Trim();

            CoalTraffic.BLL.TT_Navicert bll = new CoalTraffic.BLL.TT_Navicert();
            DataSet ds = new DataSet();
            ds = bll.GetList("CarCode='" + this.txtBEmptyCode.Text.Trim() + "'");

            if (ds.Tables[0].Rows.Count > 0)
            {
                //注销准运卡表里该条记录
                SendCard.Public.SWPublic dal = new SendCard.Public.SWPublic();
                CoalTraffic.Model.TT_Navicert model = new CoalTraffic.Model.TT_Navicert();
                model.CarCode = this.txtBEmptyCode.Text;
                model.NavicertState = "3";

                dal.Add(model);//将现有的数据注销

                //增加一条新准运卡记录
                CoalTraffic.Model.TT_Navicert model2 = new CoalTraffic.Model.TT_Navicert();
                CoalTraffic.Model.TT_CarInfo modelCarInfo = new CoalTraffic.BLL.TT_CarInfo().GetModel(txtBEmptyCode.Text.Trim().Replace("'", "''"));
                if (model2 != null)
                {
                    model2.NavicertCode = strNavicertCode;
                    model2.RoomCode = modelCarInfo.RoomCode;
                    model2.CarCode = txtBEmptyCode.Text.Trim();
                    model2.CarNo = modelCarInfo.CarNo;
                    model2.CarType = modelCarInfo.CarType;
                    model2.CarOwnerName = modelCarInfo.CarOwnerName;
                    model2.CarOwnerPhone = modelCarInfo.CarOwnerPhone;
                    model2.CarOwnerIDCard = modelCarInfo.CarOwnerIDCard;
                    model2.MostWeight = modelCarInfo.MostWeight;
                    model2.EmptyWeight = modelCarInfo.EmptyWeight;
                    model2.NavicertState = "1";
                    model2.CardType = "1";
                    model2.StartTime = DateTime.Now;
                    model2.EndTime = DateTime.MaxValue;
                    model2.SendPerson = StaticParameter.UserName;
                    model2.ClaimPersonName = txtBClaimPerson.Text.Trim();
                    model2.IsForbid = "0";
                    model2.Remark = txtBRemark.Text.Trim();
                    model2.NavicertNo = strNavicertCode;

                    #region 判断是否更新电子标签
                    if (IsHaveRemote == "1")
                    {
                        string sql = "select RemoteCardCode FROM [CoalTraffic].[dbo].[TT_CarInfo] where  CarCode='" + txtBEmptyCode.Text.Trim() + "'";
                        string result = (string)DbHelperSQL.GetSingle(sql);
                        if (!string.IsNullOrEmpty(result))
                        {
                            DialogResult refYN = MessageBox.Show("该车辆已有电子标签,是否更换该车辆的电子标签?", "天大天科", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                            if (refYN == DialogResult.Yes)
                            {
                                model2.RemoteCardCode = strReadRemoteCode.TrimEnd(',');
                            }
                            else
                            {
                                model2.RemoteCardCode = "";
                            }
                        }
                    }
                    #endregion

                }

                string strSuccess = "";
                strSuccess = dal.AddNewNcard(model2);//更新后的方法,此方法避免了将原有的电子标签更改为空
                //strSuccess = bll.Add(model2);

                if (strSuccess != "")
                {
                    //发送消息到磅房
                    //发送修改信息到队列和增加的队列。
                    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) values ('" + model2.NavicertCode + "','" + model2.RoomCode + "',");
                    sbInsert.Append("'" + model2.CarCode + "','" + model2.CarNo + "','" + model2.CarType + "','" + model2.CarOwnerName + "',");
                    sbInsert.Append("'" + model2.NavicertState + "','" + model2.CardType + "','" + model2.StartTime + "','" + model2.EndTime + "',");
                    sbInsert.Append("'" + model2.SendPerson + "','" + model2.ClaimPersonName + "','" + model2.CarOwnerPhone + "',");
                    sbInsert.Append("'" + model2.CarOwnerIDCard + "','" + model2.MostWeight + "','" + model2.EmptyWeight + "',");
                    sbInsert.Append("'" + model2.IsForbid + "','" + model2.Remark + "');");
                    sbInsert.Append("update TT_Navicert set NavicertState='3'");
                    sbInsert.Append("where CarCode='" + this.txtBEmptyCode.Text.Trim() + "'and NavicertState='1'");

                    #region 插入sql语句到同步表中
                   string sqlInsert = "insert [NetWorkDisconnectionLog] (ID, SQLcontext, datetime, IP) values (@ID,@SQLcontext,@datetime,@IP)";
                    SqlParameter[] sqlpars = new SqlParameter[]
                        {
                            new SqlParameter("@ID",DateTime.Now.ToString()),
                            new SqlParameter("@SQLcontext",sbInsert.ToString()),
                            new SqlParameter("@datetime",DateTime.Now.ToString()),
                            new SqlParameter("@IP","172.10.14.1")
                        };
                    DbHelperSQL.ExecuteSql(sqlInsert);
                    #endregion

                    alarmSound.Alarm("准运卡办理成功,即将打印办理凭证");
                    new report.NavicertCardPrint(strSuccess, true).ShowDialog();
                    ClearAllText();
                }
            }
        }
        public void Send()
        {
            if (txtBNavicertCode.Text.Trim() == "")
            {
                alarmSound.Alarm("请刷准运卡");
                return;
            }

            string sSQL = "select NavicertCode from TT_Navicert where NavicertCode='" + txtBNavicertCode.Text.Trim() + "'and NavicertState='1'";
            object OResult = DbHelperSQL.GetSingle(sSQL);
            if (OResult != null)
            {
                alarmSound.Alarm("此卡已经和其它车辆绑定请另外刷卡");
                return;
            }

            strNavicertCode = txtBNavicertCode.Text.Trim();

            CoalTraffic.BLL.TT_Navicert bll = new CoalTraffic.BLL.TT_Navicert();
            DataSet ds = new DataSet();
            ds = bll.GetList("CarCode='" + this.txtBEmptyCode.Text.Trim() + "'");

            if (ds.Tables[0].Rows.Count > 0)
            {

                //禁用准运卡表里该条记录

                CoalTraffic.Model.TT_Navicert model = new CoalTraffic.Model.TT_Navicert();
                model.NavicertCode = ds.Tables[0].Rows[0]["NavicertCode"].ToString();
                model.RoomCode = ds.Tables[0].Rows[0]["RoomCode"].ToString();
                model.CarCode = ds.Tables[0].Rows[0]["CarCode"].ToString();
                model.CarNo = ds.Tables[0].Rows[0]["CarNo"].ToString();
                model.CarType = ds.Tables[0].Rows[0]["CarType"].ToString();
                model.CarOwnerName = ds.Tables[0].Rows[0]["CarOwnerName"].ToString();
                model.CarOwnerPhone = ds.Tables[0].Rows[0]["CarOwnerPhone"].ToString();
                model.CarOwnerIDCard = ds.Tables[0].Rows[0]["CarOwnerIDCard"].ToString();
                model.MostWeight = Convert.ToDecimal( ds.Tables[0].Rows[0]["MostWeight"]);
                model.EmptyWeight = Convert.ToDecimal(ds.Tables[0].Rows[0]["EmptyWeight"]);
                model.NavicertState = "1";
                model.CardType = "1";
                model.StartTime = DateTime.Now;
                model.EndTime = DateTime.MaxValue;
                model.SendPerson = ds.Tables[0].Rows[0]["SendPerson"].ToString();
                model.ClaimPersonName = ds.Tables[0].Rows[0]["ClaimPersonName"].ToString();
                model.IsForbid = "1";
                model.Remark = ds.Tables[0].Rows[0]["Remark"].ToString()+"— 因补办被禁用";
                model.NavicertNo = ds.Tables[0].Rows[0]["NavicertCode"].ToString();

                bll.Update(model);

                //增加一条新准运卡记录
                CoalTraffic.Model.TT_Navicert model2 = new CoalTraffic.Model.TT_Navicert();
                CoalTraffic.Model.TT_CarInfo modelCarInfo = new CoalTraffic.BLL.TT_CarInfo().GetModel(txtBEmptyCode.Text.Trim().Replace("'", "''"));
                if (model2 != null)
                {
                    model2.NavicertCode = strNavicertCode;
                    model2.RoomCode = modelCarInfo.RoomCode;
                    model2.CarCode = txtBEmptyCode.Text.Trim();
                    model2.CarNo = modelCarInfo.CarNo;
                    model2.CarType = modelCarInfo.CarType;
                    model2.CarOwnerName = modelCarInfo.CarOwnerName;
                    model2.CarOwnerPhone = modelCarInfo.CarOwnerPhone;
                    model2.CarOwnerIDCard = modelCarInfo.CarOwnerIDCard;
                    model2.MostWeight = modelCarInfo.MostWeight;
                    model2.EmptyWeight = modelCarInfo.EmptyWeight;
                    model2.NavicertState = "1";
                    model2.CardType = "1";
                    model2.StartTime = DateTime.Now;
                    model2.EndTime = DateTime.MaxValue;
                    model2.SendPerson = StaticParameter.UserName;
                    model2.ClaimPersonName = txtBClaimPerson.Text.Trim();
                    model2.IsForbid = "0";
                    model2.Remark = txtBRemark.Text.Trim();
                    model2.NavicertNo = strNavicertCode;
                }

                string strSuccess = "";
                strSuccess = bll.Add(model2);
                if (strSuccess != "")
                {
                    //发送消息到磅房
                    //发送修改信息到队列和增加的队列。
                    string isConnection = ini.IniReadValue("Connection", "isConnection");
                    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) values ('" + model2.NavicertCode + "','" + model2.RoomCode + "',");
                    sbInsert.Append("'" + model2.CarCode + "','" + model2.CarNo + "','" + model2.CarType + "','" + model2.CarOwnerName + "',");
                    sbInsert.Append("'" + model2.NavicertState + "','" + model2.CardType + "','" + model2.StartTime + "','" + model2.EndTime + "',");
                    sbInsert.Append("'" + model2.SendPerson + "','" + model2.ClaimPersonName + "','" + model2.CarOwnerPhone + "',");
                    sbInsert.Append("'" + model2.CarOwnerIDCard + "','" + model2.MostWeight + "','" + model2.EmptyWeight + "',");
                    sbInsert.Append("'" + model2.IsForbid + "','" + model2.Remark + "');");
                    sbInsert.Append("update TT_Navicert set IsForbid = '1'");
                    sbInsert.Append("where CarCode='" + this.txtBEmptyCode.Text.Trim() + "'and IsForbid = '0'");
                    if (isConnection == "0")
                    {
                        mqServer.AddMsmq(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());
                    }
                    else
                    {
                        mq.AddNewSqlText(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());
                    }
                    alarmSound.Alarm("准运卡办理成功,即将打印办理凭证");
                    new Report.NavicertCardPrint(strSuccess, true,"补办").ShowDialog();
                }
            }
        }
Пример #4
0
        /// <summary>
        /// 补卡的方法
        /// </summary>
        public void Send()
        {
            if (txtBNavicertCode.Text.Trim() == "")
            {
                alarmSound.Alarm("请刷准运卡");
                return;
            }

            string sSQL = "select NavicertCode from TT_Navicert where NavicertCode='" + txtBNavicertCode.Text.Trim() + "'and NavicertState='1'";
            object OResult = DbHelperSQL.GetSingle(sSQL);
            if (OResult != null)
            {
                alarmSound.Alarm("此卡已经和其它车辆绑定请另外刷卡");
                return;
            }

            strNavicertCode = txtBNavicertCode.Text.Trim();

            CoalTraffic.BLL.TT_Navicert bll = new CoalTraffic.BLL.TT_Navicert();
            DataSet ds = new DataSet();
            ds = bll.GetList("CarCode='" + this.txtBEmptyCode.Text.Trim() + "'");

            if (ds.Tables[0].Rows.Count > 0)
            {
                //注销准运卡表里该条记录
                SendCard.Public.SWPublic dal = new SendCard.Public.SWPublic();
                CoalTraffic.Model.TT_Navicert model = new CoalTraffic.Model.TT_Navicert();
                model.CarCode = this.txtBEmptyCode.Text;
                model.NavicertState = "3";

                dal.Add(model);

                //增加一条新准运卡记录
                CoalTraffic.Model.TT_Navicert model2 = new CoalTraffic.Model.TT_Navicert();
                CoalTraffic.Model.TT_CarInfo modelCarInfo = new CoalTraffic.BLL.TT_CarInfo().GetModel(txtBEmptyCode.Text.Trim().Replace("'", "''"));
                if (model2 != null)
                {
                    model2.NavicertCode = strNavicertCode;
                    model2.RoomCode = modelCarInfo.RoomCode;
                    model2.CarCode = txtBEmptyCode.Text.Trim();
                    model2.CarNo = modelCarInfo.CarNo;
                    model2.CarType = modelCarInfo.CarType;
                    model2.CarOwnerName = modelCarInfo.CarOwnerName;
                    model2.CarOwnerPhone = modelCarInfo.CarOwnerPhone;
                    model2.CarOwnerIDCard = modelCarInfo.CarOwnerIDCard;
                    model2.MostWeight = modelCarInfo.MostWeight;
                    model2.EmptyWeight = modelCarInfo.EmptyWeight;
                    model2.NavicertState = "1";
                    model2.CardType = "1";
                    model2.StartTime = DateTime.Now;
                    model2.EndTime = DateTime.MaxValue;
                    model2.SendPerson = StaticParameter.UserName;
                    model2.ClaimPersonName = txtBClaimPerson.Text.Trim();
                    model2.IsForbid = "0";
                    model2.Remark = txtBRemark.Text.Trim();
                    model2.NavicertNo = strNavicertCode;
                }

                string strSuccess = "";
                strSuccess = bll.Add(model2);
                if (strSuccess != "")
                {
                    //发送消息到磅房
                    //发送修改信息到队列和增加的队列。
                    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) values ('" + model2.NavicertCode + "','" + model2.RoomCode + "',");
                    sbInsert.Append("'" + model2.CarCode + "','" + model2.CarNo + "','" + model2.CarType + "','" + model2.CarOwnerName + "',");
                    sbInsert.Append("'" + model2.NavicertState + "','" + model2.CardType + "','" + model2.StartTime + "','" + model2.EndTime + "',");
                    sbInsert.Append("'" + model2.SendPerson + "','" + model2.ClaimPersonName + "','" + model2.CarOwnerPhone + "',");
                    sbInsert.Append("'" + model2.CarOwnerIDCard + "','" + model2.MostWeight + "','" + model2.EmptyWeight + "',");
                    sbInsert.Append("'" + model2.IsForbid + "','" + model2.Remark + "');");
                    sbInsert.Append("update TT_Navicert set NavicertState='3'");
                    sbInsert.Append("where CarCode='" + this.txtBEmptyCode.Text.Trim() + "'and NavicertState='1'");
                    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());
                    alarmSound.Alarm("准运卡办理成功,即将打印办理凭证");
                    new report.NavicertCardPrint(strSuccess, true).ShowDialog();
                }
            }
        }
        public void Send()
        {
            #region 条件判断
            if (txtBNavicertCode.Text.Trim() == "")
            {
                alarmSound.Alarm("请刷准运卡");
                MessageBox.Show("请刷准运卡", "天大天科", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }

            string sSQL = "select NavicertCode from TT_Navicert where NavicertCode='" + txtBNavicertCode.Text.Trim() + "'and NavicertState='1'";
            object OResult = DbHelperSQL.GetSingle(sSQL);
            if (OResult != null)
            {
                alarmSound.Alarm("此卡已经和其它车辆绑定请另外刷卡");
                MessageBox.Show("此卡已经和其它车辆绑定请另外刷卡", "天大天科", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            #endregion

            strNavicertCode = txtBNavicertCode.Text.Trim();

            CoalTraffic.BLL.TT_Navicert bll = new CoalTraffic.BLL.TT_Navicert();
            DataSet ds = new DataSet();
            ds = bll.GetList("CarCode='" + this.txtBEmptyCode.Text.Trim() + "'");

            if (ds.Tables[0].Rows.Count > 0)
            {

                //禁用准运卡表里该条记录

                #region 构造原准运卡实体对象
                CoalTraffic.Model.TT_Navicert model = new CoalTraffic.Model.TT_Navicert();
                model.NavicertCode = ds.Tables[0].Rows[0]["NavicertCode"].ToString();
                model.RoomCode = ds.Tables[0].Rows[0]["RoomCode"].ToString();
                model.CarCode = ds.Tables[0].Rows[0]["CarCode"].ToString();
                model.CarNo = ds.Tables[0].Rows[0]["CarNo"].ToString();
                model.CarType = ds.Tables[0].Rows[0]["CarType"].ToString();
                model.CarOwnerName = ds.Tables[0].Rows[0]["CarOwnerName"].ToString();
                model.CarOwnerPhone = ds.Tables[0].Rows[0]["CarOwnerPhone"].ToString();
                model.CarOwnerIDCard = ds.Tables[0].Rows[0]["CarOwnerIDCard"].ToString();
                model.MostWeight = Convert.ToDecimal(ds.Tables[0].Rows[0]["MostWeight"]);
                model.EmptyWeight = Convert.ToDecimal(ds.Tables[0].Rows[0]["EmptyWeight"]);
                model.NavicertState = "1";
                model.CardType = "1";
                model.StartTime = DateTime.Now;
                model.EndTime = DateTime.MaxValue;
                model.SendPerson = ds.Tables[0].Rows[0]["SendPerson"].ToString();
                model.ClaimPersonName = ds.Tables[0].Rows[0]["ClaimPersonName"].ToString();
                model.IsForbid = "1";
                model.Remark = ds.Tables[0].Rows[0]["Remark"].ToString() + "— 因补办被禁用";
                model.NavicertNo = ds.Tables[0].Rows[0]["NavicertCode"].ToString();
                #endregion
                bll.Update(model);//禁用原有准运卡

                //增加一条新准运卡记录
                CoalTraffic.Model.TT_Navicert model2 = new CoalTraffic.Model.TT_Navicert();
                CoalTraffic.Model.TT_CarInfo modelCarInfo = new CoalTraffic.BLL.TT_CarInfo().GetModel(txtBEmptyCode.Text.Trim().Replace("'", "''"));
                #region 构造补办准运卡实体对象
                if (model2 != null)
                {
                    model2.NavicertCode = strNavicertCode;
                    model2.RoomCode = modelCarInfo.RoomCode;
                    model2.CarCode = txtBEmptyCode.Text.Trim();
                    model2.CarNo = modelCarInfo.CarNo;
                    model2.CarType = modelCarInfo.CarType;
                    model2.CarOwnerName = modelCarInfo.CarOwnerName;
                    model2.CarOwnerPhone = modelCarInfo.CarOwnerPhone;
                    model2.CarOwnerIDCard = modelCarInfo.CarOwnerIDCard;
                    model2.MostWeight = modelCarInfo.MostWeight;
                    model2.EmptyWeight = modelCarInfo.EmptyWeight;
                    model2.NavicertState = "1";
                    model2.CardType = "1";
                    model2.StartTime = DateTime.Now;
                    model2.EndTime = DateTime.MaxValue;
                    model2.SendPerson = StaticParameter.UserName;
                    model2.ClaimPersonName = txtBClaimPerson.Text.Trim();
                    model2.IsForbid = "0";
                    model2.Remark = txtBRemark.Text.Trim();
                    model2.NavicertNo = strNavicertCode;
                }

                #endregion
                string strSuccess = "";
                strSuccess = bll.Add(model2);//添加新准运卡信息

                string isConnection = ini.IniReadValue("Connection", "isConnection");

                #region 当联网的时:插入同步sql语句到服务器,sql语句本地执行
                if (isConnection == "0")
                {
                    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) values ('" + model2.NavicertCode + "','" + model2.RoomCode + "',");
                    sbInsert.Append("'" + model2.CarCode + "','" + model2.CarNo + "','" + model2.CarType + "','" + model2.CarOwnerName + "',");
                    sbInsert.Append("'" + model2.NavicertState + "','" + model2.CardType + "','" + model2.StartTime + "','" + model2.EndTime + "',");
                    sbInsert.Append("'" + model2.SendPerson + "','" + model2.ClaimPersonName + "','" + model2.CarOwnerPhone + "',");
                    sbInsert.Append("'" + model2.CarOwnerIDCard + "','" + model2.MostWeight + "','" + model2.EmptyWeight + "',");
                    sbInsert.Append("'" + model2.IsForbid + "','" + model2.Remark + "');");
                    sbInsert.Append("update TT_Navicert set IsForbid = '1'");
                    sbInsert.Append("where CarCode='" + this.txtBEmptyCode.Text.Trim() + "'and IsForbid = '0'");

                    string sqlInsertLog = "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",sbInsert.ToString()),
                            new SqlParameter("@datetime",DateTime.Now.ToString()),
                            new SqlParameter("@IP",ini.IniReadValue("Connection","LServer"))
                        };
                    DbHelperSQL.ExecuteSql(sqlInsertLog,sqlpars); //插入同步sql语句
                    DbHelperSQL.ExecuteSql2(sbInsert.ToString(), "1");//sql语句本地执行
                }
                #endregion

                if (strSuccess != "")
                {

                    #region 断网时,添加准运卡禁用和补办准运卡sql语句

                    if (isConnection == "1")
                    {
                        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) values ('" + model2.NavicertCode + "','" + model2.RoomCode + "',");
                        sbInsert.Append("'" + model2.CarCode + "','" + model2.CarNo + "','" + model2.CarType + "','" + model2.CarOwnerName + "',");
                        sbInsert.Append("'" + model2.NavicertState + "','" + model2.CardType + "','" + model2.StartTime + "','" + model2.EndTime + "',");
                        sbInsert.Append("'" + model2.SendPerson + "','" + model2.ClaimPersonName + "','" + model2.CarOwnerPhone + "',");
                        sbInsert.Append("'" + model2.CarOwnerIDCard + "','" + model2.MostWeight + "','" + model2.EmptyWeight + "',");
                        sbInsert.Append("'" + model2.IsForbid + "','" + model2.Remark + "');");
                        sbInsert.Append("update TT_Navicert set IsForbid = '1'");
                        sbInsert.Append("where CarCode='" + this.txtBEmptyCode.Text.Trim() + "'and IsForbid = '0'");
                        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",sbInsert.ToString()),
                                                                                            new SqlParameter("@datetime",DateTime.Now)
                                                                                             };
                        DbHelperSQL.ExecuteSql(sbsqlcontext.ToString(), parameters);
                    }
                    #endregion
                    alarmSound.Alarm("准运卡办理成功,即将打印办理凭证");
                    new Report.NavicertCardPrint(strSuccess, true, "补办").ShowDialog();
                }
            }
        }