Esempio n. 1
0
 // 上报
 private FuelDataService.OperateResult applyParam()
 {
     try
     {
         List <VehicleBasicInfo> lbiList = new List <VehicleBasicInfo>();
         VehicleBasicInfo        lbi     = new VehicleBasicInfo()
         {
             V_Id = "", User_Id = Utils.userId, Qcscqy = tbqcscqy.Text.Trim(), Jkqczjxs = this.tbjkqczjxs.Text.Trim(), Vin = this.tbbah.Text.Trim().ToUpper(), Hgspbm = this.tbHgspbm.Text.Trim().ToUpper(), Clxh = this.tbclxh.Text.Trim(), Clzl = this.cbclzl.Text.Trim(), Rllx = this.cbrllx.Text.Trim(), Zczbzl = this.tbzczbzl.Text.Trim(), Zgcs = this.tbzgcs.Text.Trim(), Ltgg = this.tbltgg.Text.Trim(), Zj = this.tbzj.Text.Trim(), Clzzrq = DateTime.Parse(this.dtclzzrq.Text), Tymc = this.tbtymc.Text.Trim(), Yyc = this.cbyyc.Text.Trim(), Zwps = this.tbzwps.Text.Trim(), Zdsjzzl = this.tbzdsjzzl.Text.Trim(), Edzk = this.tbedzk.Text.Trim(), Lj = this.tblj.Text.Trim(), Qdxs = this.cbqdxs.Text.Trim(), Jyjgmc = this.tbjcjgmc.Text.Trim(), Jybgbh = this.tbbgbh.Text.Trim(), Qtxx = this.tbQtxx.Text.Trim(), CreateTime = DateTime.Now, UpdateTime = DateTime.Now, Status = "0"
         };
         List <RllxParamEntity> listParam = new List <RllxParamEntity>();
         foreach (Control c in this.tlp.Controls)
         {
             if (c is TextEdit || c is DevExpress.XtraEditors.ComboBoxEdit)
             {
                 RllxParamEntity pe = new RllxParamEntity()
                 {
                     V_Id = "", Param_Code = c.Name, Vin = this.tbbah.Text.Trim().ToUpper(), Param_Value = c.Text
                 };
                 listParam.Add(pe);
             }
         }
         lbi.EntityList = listParam.ToArray();
         lbiList.Add(lbi);
         // 上报
         FuelDataService.OperateResult result = new FuelDataService.OperateResult();
         return(result = Utils.service.UploadInsertFuelDataList(Utils.userId, Utils.password, Utils.FuelInfoC2S(lbiList).ToArray(), "CATARC_CUSTOM_2012"));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 2
0
File: Utils.cs Progetto: qwdingyu/C-
        // 修改状态,返回VID.
        public static void UpdataState(FuelDataService.OperateResult result)
        {
            OperateResult        oResult = Utils.OperateResultS2C(result);
            List <NameValuePair> nvpList = new List <NameValuePair>();

            for (int i = 0; i < oResult.ResultDetail.Length; i++)
            {
                NameValuePair nvp = oResult.ResultDetail[i] as NameValuePair;
                nvpList.Add(nvp);
            }
            if (nvpList != null)
            {
                using (OracleConnection con = new OracleConnection(OracleHelper.conn))
                {
                    con.Open();
                    OracleTransaction tra = con.BeginTransaction(); //创建事务,开始执行事务
                    try
                    {
                        foreach (NameValuePair nvp in nvpList)
                        {
                            if (nvp.Value.IndexOf("VAD") != -1)
                            {
                                OracleHelper.ExecuteNonQuery(tra, String.Format("UPDATE FC_CLJBXX SET V_ID = '{0}',STATUS = '0',UPDATETIME=to_date('{1}','yyyy-mm-dd hh24:mi:ss')  WHERE VIN ='{2}'", nvp.Value, DateTime.Now, nvp.Name), null);
                            }
                        }
                        tra.Commit();
                    }
                    catch
                    {
                        tra.Rollback();
                    }
                }
            }
        }
Esempio n. 3
0
        //补传信息
        protected List <OperateResult> applyOTParamMultiRows(List <string> vinList, string reason)
        {
            // 一次最多上传50条
            int pageSize = 50;

            // 返回结果
            FuelDataService.OperateResult        result     = null;
            List <FuelDataService.OperateResult> resSerList = new List <FuelDataService.OperateResult>();
            List <FuelDataModel.OperateResult>   resCltList = new List <OperateResult>();
            // 分组上传时的临时变量
            List <string> tempList = new List <string>();

            pf.TotalMax = (int)Math.Ceiling((decimal)vinList.Count / (decimal)pageSize);
            pf.ShowProcessBar();
            try
            {
                // 补传
                if (vinList.Count > 0)
                {
                    for (int i = 0; i < vinList.Count;)
                    {
                        // 最后一组上传不足50条
                        if (vinList.Count < pageSize)
                        {
                            pageSize = vinList.Count;
                        }
                        // 截取剩余记录中的pageSize条
                        var res = vinList.Take(pageSize);
                        tempList = (from string s in res select s).ToList <string>();
                        List <VehicleBasicInfo> vbiList = Utils.GetApplyParam(tempList);
                        foreach (VehicleBasicInfo vInfo in vbiList)
                        {
                            vInfo.Reason = reason;
                        }
                        // 补传
                        result = Utils.service.UploadOverTime(Utils.userId, Utils.password, Utils.FuelInfoC2S(vbiList).ToArray(), "CATARC_CUSTOM_2012");
                        resSerList.Add(result);
                        // 移除已上传的pageSize条记录
                        var leftRes = vinList.Skip(pageSize);
                        vinList = (from string s in leftRes select s).ToList <string>();
                        pf.progressBarControl1.PerformStep();
                        Application.DoEvents();
                    }
                }
                else
                {
                    return(null);
                }
                foreach (FuelDataService.OperateResult res in resSerList)
                {
                    resCltList.Add(Utils.OperateResultS2C(res));
                }
                pf.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("补传过程发生异常:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(resCltList);
        }
Esempio n. 4
0
        //正常上报信息
        private List <OperateResult> ApplyParamMultiRows(List <string> vinList)
        {
            // 一次调用接口上传数据条数
            int pageSize = 50;

            // 返回结果
            FuelDataService.OperateResult        result     = null;
            List <FuelDataService.OperateResult> resSerList = new List <FuelDataService.OperateResult>();
            List <OperateResult> resCltList = new List <OperateResult>();
            // 分组上传时的VIN临时变量
            List <string> tempList = new List <string>();

            try
            {
                // 上报
                if (vinList.Count > 0)
                {
                    for (int i = 0; i < vinList.Count;)
                    {
                        // 最后一组上传不足50条
                        if (vinList.Count < pageSize)
                        {
                            pageSize = vinList.Count;
                        }
                        // 截取剩余记录中的pageSize条
                        var res = vinList.Take(pageSize);
                        tempList = (from string s in res select s).ToList <string>();
                        List <VehicleBasicInfo> vbiList = Utils.GetApplyParam(tempList);
                        // 上传

                        result = Utils.service.UploadInsertFuelDataList(Utils.userId, Utils.password, Utils.FuelInfoC2S(vbiList).ToArray(), "CATARC_CUSTOM_2012");


                        resSerList.Add(result);
                        // 移除已上传的pageSize条记录
                        var leftRes = vinList.Skip(pageSize);
                        vinList = (from string s in leftRes select s).ToList <string>();
                    }
                }
                else
                {
                    return(null);
                }
                // 将service端OperateResult转换为Client端
                foreach (FuelDataService.OperateResult res in resSerList)
                {
                    resCltList.Add(Utils.OperateResultS2C(res));
                }
            }
            catch (Exception ex)
            {
                LogManager.Log("UploadLog", "Error", ex.Message);
            }
            return(resCltList);
        }
Esempio n. 5
0
        private void btnbaocunshangbao_Click(object sender, EventArgs e)
        {
            if (!Utils.CheckUser())
            {
                return;
            }
            string msg = string.Empty;

            msg += this.VerifyRequired();
            msg += Utils.VerifyRLParam(this.tlp.Controls);
            try
            {
                if (!this.dxErrorProvider.HasErrors && string.IsNullOrEmpty(msg))
                {
                    saveParam(false);
                    FuelDataService.OperateResult result = applyParam(this.UploadType);
                    int count = Utils.ApplyFlg(result).Count;
                    if (count > 0)
                    {
                        this.btnPrint.Visible = false;

                        OperateResult oResult = Utils.OperateResultS2C(result);
                        NameValuePair nvp     = oResult.ResultDetail[0] as NameValuePair;
                        MessageBox.Show("备案号(VIN):" + nvp.Name + "\n信息:" + nvp.Value + "】", "上报失败", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        Utils.UpdataState(result);
                        setEnable();

                        this.btnPrint.Visible          = true;
                        this.btnbaocunshangbao.Enabled = false;
                        this.btnbaocun.Enabled         = false;
                        string strVIN = this.tbvin.Text.Trim();
                        string strVID = GetSussVID(strVIN);
                        if (strVID != null)
                        {
                            MessageBox.Show("备案号(VIN):" + strVIN + "\n反馈码(VID):" + strVID, "上报成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("请核对页面信息是否填写正确!" + msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("保存并上传失败:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 6
0
        private void btnbaocunshangbao_Click(object sender, EventArgs e)
        {
            if (!Utils.CheckUser())
            {
                return;
            }
            string msg = string.Empty;

            msg += this.VerifyRequired();
            msg += Utils.VerifyRLParam(this.tlp.Controls);
            try
            {
                if (!this.dxErrorProvider.HasErrors && string.IsNullOrEmpty(msg))
                {
                    saveParam();
                    FuelDataService.OperateResult result = applyParam();
                    int count = Utils.ApplyFlg(result).Count;
                    if (count > 0)
                    {
                        this.btnPrint.Visible = false;

                        OperateResult oResult = Utils.OperateResultS2C(result);
                        NameValuePair nvp     = oResult.ResultDetail[0] as NameValuePair;
                        MessageBox.Show(String.Format("【备案号(VIN):{0}\n信息:{1}】", nvp.Name, nvp.Value), "上报失败", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        Utils.UpdataState(result);
                        setEnable();
                        this.btnPrint.Visible          = true;
                        this.btnbaocunshangbao.Enabled = false;
                        this.btnbaocun.Enabled         = false;
                        string strVID = OracleHelper.ExecuteScalar(OracleHelper.conn, String.Format("SELECT V_ID FROM FC_CLJBXX WHERE VIN ='{0}'", this.tbbah.Text.Trim().ToUpper())).ToString();
                        if (strVID != null)
                        {
                            MessageBox.Show(String.Format("备案号(VIN):{0}\n反馈码(VID):{1}", this.tbbah.Text.Trim().ToUpper(), strVID), "上报成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("请核对页面信息是否填写正确!" + msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 7
0
File: Utils.cs Progetto: qwdingyu/C-
        // 返回上报错误项
        public static List <NameValuePair> ApplyFlg(FuelDataService.OperateResult result)
        {
            List <NameValuePair> returnList = new List <NameValuePair>();

            try
            {
                OperateResult oResult = Utils.OperateResultS2C(result);
                for (int i = 0; i < oResult.ResultDetail.Length; i++)
                {
                    NameValuePair nvp = oResult.ResultDetail[i] as NameValuePair;
                    if (nvp.Value.IndexOf("VAD") == -1)
                    {
                        returnList.Add(nvp);
                    }
                }
            }
            catch (Exception)
            {
            }
            return(returnList);
        }
Esempio n. 8
0
File: Utils.cs Progetto: qwdingyu/C-
        // 将结果集NameValue对象转换为Client端对象
        public static OperateResult OperateResultS2C(FuelDataService.OperateResult serviceResult)
        {
            if (serviceResult == null)
            {
                return(null);
            }
            OperateResult        clientResult   = new OperateResult();
            List <NameValuePair> clientPairList = new List <NameValuePair>();

            foreach (FuelDataService.NameValuePair servicePair in serviceResult.ResultDetail)
            {
                NameValuePair clientPair = new NameValuePair();
                ConvertObj <FuelDataService.NameValuePair, NameValuePair>(servicePair, clientPair);
                clientPairList.Add(clientPair);
            }

            Utils.ConvertObj <FuelDataService.OperateResult, OperateResult>(serviceResult, clientResult);
            clientResult.ResultDetail = clientPairList.ToArray();

            return(clientResult);
        }
Esempio n. 9
0
        // 申请撤销信息
        public List <OperateResult> ApplyParamMultiRows(List <string> vinList, string delReason)
        {
            // 一次最多上传50条
            int pageSize = 50;

            // 返回结果
            FuelDataService.OperateResult        result     = null;
            List <FuelDataService.OperateResult> resSerList = new List <FuelDataService.OperateResult>();
            List <FuelDataModel.OperateResult>   resCltList = new List <OperateResult>();

            // 分组上传时的临时变量
            List <string> tempList = new List <string>();

            pf.TotalMax = (int)Math.Ceiling((decimal)vinList.Count / (decimal)pageSize);
            pf.ShowProcessBar();

            try
            {
                // 上报
                if (vinList.Count > 0)
                {
                    for (int i = 0; i < vinList.Count;)
                    {
                        // 最后一组上传不足pageSize条
                        if (vinList.Count < pageSize)
                        {
                            pageSize = vinList.Count;
                        }

                        // 截取剩余记录中的pageSize条
                        var res = vinList.Take(pageSize);
                        tempList = (from string s in res select s).ToList <string>();

                        // 上传
                        result = service.ApplyDelelte(Utils.userId, Utils.password, tempList.ToArray(), delReason, "CATARC_CUSTOM_2012");
                        resSerList.Add(result);

                        // 移除已上传的pageSize条记录
                        var leftRes = vinList.Skip(pageSize);
                        vinList = (from string s in leftRes select s).ToList <string>();
                        pf.progressBarControl1.PerformStep();
                        Application.DoEvents();
                    }
                }
                else
                {
                    return(null);
                }

                foreach (FuelDataService.OperateResult res in resSerList)
                {
                    resCltList.Add(Utils.OperateResultS2C(res));
                }
                pf.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("申请撤销过程发生异常:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(resCltList);
        }
Esempio n. 10
0
        // 上报
        private FuelDataService.OperateResult applyParam()
        {
            //bool AppFlg = false;
            try
            {
                List <VehicleBasicInfo> lbiList = new List <VehicleBasicInfo>();
                VehicleBasicInfo        lbi     = new VehicleBasicInfo();
                //VehicleBasicInfo[] lbiList = new VehicleBasicInfo[1] { new VehicleBasicInfo() };
                lbi.V_Id       = "";
                lbi.User_Id    = Utils.userId;
                lbi.Qcscqy     = tbqcscqy.Text.Trim();
                lbi.Jkqczjxs   = this.tbjkqczjxs.Text.Trim();
                lbi.Vin        = this.tbbah.Text.Trim().ToUpper();
                lbi.Hgspbm     = this.tbHgspbm.Text.Trim().ToUpper();
                lbi.Clxh       = this.tbclxh.Text.Trim();
                lbi.Clzl       = this.cbclzl.Text.Trim();
                lbi.Rllx       = this.cbrllx.Text.Trim();
                lbi.Zczbzl     = this.tbzczbzl.Text.Trim();
                lbi.Zgcs       = this.tbzgcs.Text.Trim();
                lbi.Ltgg       = this.tbltgg.Text.Trim();
                lbi.Zj         = this.tbzj.Text.Trim();
                lbi.Clzzrq     = DateTime.Parse(this.dtclzzrq.Text);
                lbi.Tymc       = this.tbtymc.Text.Trim();
                lbi.Yyc        = this.cbyyc.Text.Trim();
                lbi.Zwps       = this.tbzwps.Text.Trim();
                lbi.Zdsjzzl    = this.tbzdsjzzl.Text.Trim();
                lbi.Edzk       = this.tbedzk.Text.Trim();
                lbi.Lj         = this.tblj.Text.Trim();
                lbi.Qdxs       = this.cbqdxs.Text.Trim();
                lbi.Jyjgmc     = this.tbjcjgmc.Text.Trim();
                lbi.Jybgbh     = this.tbbgbh.Text.Trim();
                lbi.Qtxx       = this.tbQtxx.Text.Trim();
                lbi.CreateTime = DateTime.Now;
                lbi.UpdateTime = DateTime.Now;
                lbi.Status     = "0";



                List <RllxParamEntity> listParam = new List <RllxParamEntity>();
                foreach (Control c in this.tlp.Controls)
                {
                    if (c is TextEdit || c is DevExpress.XtraEditors.ComboBoxEdit)
                    {
                        RllxParamEntity pe         = new RllxParamEntity();
                        string          strLabName = "lbl" + c.Name;
                        Control[]       lblc       = this.Controls.Find(strLabName, true);
                        string          paramCode  = c.Name;
                        string          paramValue = c.Text;
                        //string paramName = lblc[0].Text;

                        pe.V_Id       = "";
                        pe.Param_Code = paramCode;
                        pe.Vin        = this.tbbah.Text.Trim().ToUpper();
                        //pe.Param_Name = paramName;
                        pe.Param_Value = c.Text;

                        listParam.Add(pe);
                    }
                }
                lbi.EntityList = listParam.ToArray();
                lbiList.Add(lbi);

                // 上报
                FuelDataService.OperateResult result = new FuelDataService.OperateResult();
                return(result = service.UploadInsertFuelDataList(Utils.userId, Utils.password, Utils.FuelInfoC2S(lbiList).ToArray(), "CATARC_CUSTOM_2012"));

                //// 判断是否上报成功
                //int count = Utils.ApplyFlg(result).Count;
                //if (count > 0)
                //{
                //    AppFlg = false;
                //    this.btnPrint.Visible = false;
                //}
                //else
                //{
                //    Utils.UpdataState(result);
                //    setEnable();
                //    AppFlg = true;


                //}
                //return AppFlg;
            }
            catch (Exception ex)
            {
                throw ex;
                return(null);
            }
        }
Esempio n. 11
0
        public void UploadData(object objCon)
        {
            GridView dgv = objCon as GridView;

            try
            {
                // 取list列表选中的VIN
                ArrayList al = new ArrayList();
                dgv.PostEditor();
                string value = "";
                for (int i = 0; i < dgv.RowCount; i++)
                {
                    value = dgv.GetDataRow(i)["check"].ToString();
                    if (value == "True")
                    {
                        al.Add(dgv.GetRowCellValue(i, "VIN"));
                    }
                }

                List <VehicleBasicInfo> lbiList = new List <VehicleBasicInfo>();
                if (al.Count > 0)
                {
                    foreach (string strVin in al)
                    {
                        #region  基本信息
                        VehicleBasicInfo lbi      = new VehicleBasicInfo();
                        string           strJbSql = "SELECT * FROM FC_CLJBXX WHERE VIN = '" + strVin + "'";
                        //string stringSql = "SELECT * FROM FC_CLJBXX A JOIN RLLX_PARAM_ENTITY B ON A.V_ID = B.V_ID  WHERE A.VIN = '" + strVin + "'";
                        Object  obj = AccessHelper.ExecuteDataSet(AccessHelper.conn, strJbSql, null);
                        DataSet ds  = (DataSet)obj;
                        lbi.User_Id    = Utils.userId;
                        lbi.Qcscqy     = ds.Tables[0].Rows[0]["QCSCQY"].ToString();
                        lbi.Jkqczjxs   = ds.Tables[0].Rows[0]["JKQCZJXS"].ToString();
                        lbi.Vin        = ds.Tables[0].Rows[0]["VIN"].ToString();
                        lbi.Clxh       = ds.Tables[0].Rows[0]["CLXH"].ToString();
                        lbi.Clzl       = ds.Tables[0].Rows[0]["CLZL"].ToString();
                        lbi.Rllx       = ds.Tables[0].Rows[0]["RLLX"].ToString();
                        lbi.Zczbzl     = ds.Tables[0].Rows[0]["ZCZBZL"].ToString();
                        lbi.Zgcs       = ds.Tables[0].Rows[0]["ZGCS"].ToString();
                        lbi.Ltgg       = ds.Tables[0].Rows[0]["LTGG"].ToString();
                        lbi.Zj         = ds.Tables[0].Rows[0]["ZJ"].ToString();
                        lbi.Clzzrq     = DateTime.Parse(ds.Tables[0].Rows[0]["CLZZRQ"].ToString());
                        lbi.Tymc       = ds.Tables[0].Rows[0]["TYMC"].ToString();
                        lbi.Yyc        = ds.Tables[0].Rows[0]["YYC"].ToString();
                        lbi.Zwps       = ds.Tables[0].Rows[0]["ZWPS"].ToString();
                        lbi.Zdsjzzl    = ds.Tables[0].Rows[0]["ZDSJZZL"].ToString();
                        lbi.Edzk       = ds.Tables[0].Rows[0]["EDZK"].ToString();
                        lbi.Lj         = ds.Tables[0].Rows[0]["LJ"].ToString();
                        lbi.Qdxs       = ds.Tables[0].Rows[0]["QDXS"].ToString();
                        lbi.Jyjgmc     = ds.Tables[0].Rows[0]["JYJGMC"].ToString();
                        lbi.Jybgbh     = ds.Tables[0].Rows[0]["JYBGBH"].ToString();
                        lbi.CreateTime = DateTime.Now;
                        lbi.UpdateTime = DateTime.Now;
                        lbi.Status     = "1";
                        #endregion

                        #region
                        //string strParamSql = "SELECT A.VIN,A.PARAM_NAME,A.PARAM_VALUE,B.PARAM_CODE FROM RLLX_PARAM_ENTITY A JOIN RLLX_PARAM B ON A.PARAM_ID = B.PARAM_ID WHERE A.VIN = '" + strVin + "'";
                        string    strParamSql            = "SELECT A.VIN,A.PARAM_NAME,A.PARAM_VALUE FROM RLLX_PARAM_ENTITY A WHERE A.VIN = '" + strVin + "'";
                        Object    objParam               = AccessHelper.ExecuteDataSet(AccessHelper.conn, strParamSql, null);
                        DataSet   dsParam                = (DataSet)objParam;
                        DataTable dt                     = dsParam.Tables[0];
                        List <RllxParamEntity> listParam = new List <RllxParamEntity>();
                        foreach (DataRow dr in dt.Rows)
                        {
                            RllxParamEntity rpe = new RllxParamEntity();
                            // rpe.Param_Code = dr[""].ToString();
                            rpe.Vin = dr["VIN"].ToString();
                            //rpe.Param_Name = dr["PARAM_NAME"].ToString();
                            rpe.Param_Value = dr["PARAM_VALUE"].ToString();
                            listParam.Add(rpe);
                        }
                        lbi.EntityList = listParam.ToArray();
                        lbiList.Add(lbi);

                        FuelDataService.OperateResult result = new FuelDataService.OperateResult();
                        result = service.UploadInsertFuelDataList(Utils.userId, Utils.password, Utils.FuelInfoC2S(lbiList).ToArray(), "CATARC_CUSTOM_2012");
                        Utils.UpdataState(result);
                        #endregion
                    }
                }
                else
                {
                    MessageBox.Show("没有选中可上报数据!");
                }
            }
            catch
            {
                MessageBox.Show("上报出错!");
            }
        }