Beispiel #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;
     }
 }
Beispiel #2
0
 //查询服务器数据库
 private void GetDataFromService(int pageNum)
 {
     if (!Utils.CheckUser())
     {
         return;
     }
     // 验证查询时间
     try
     {
         if (Convert.ToDateTime(this.dtEndTime.Text) < Convert.ToDateTime(this.dtStartTime.Text))
         {
             MessageBox.Show("结束时间不能小于开始时间", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             return;
         }
     }
     catch
     {
         MessageBox.Show("时间格式有误", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     try
     {
         SplashScreenManager.ShowForm(typeof(DevWaitForm));
         FuelDataService.VehicleBasicInfo[] queryInfoArr = Utils.service.QueryApplyDelInfo(Utils.userId, Utils.password, pageNum, 20, tbVin.Text, tbClxh.Text, tbClzl.Text, cbRllx.Text, dtStartTime.Text, dtEndTime.Text, this.GetTimeType());
         if (queryInfoArr != null && queryInfoArr.Length > 0)
         {
             List <VehicleBasicInfo> vbis = Utils.FuelInfoS2C(queryInfoArr);
             for (int i = 0; i < vbis.Count; i++)
             {
                 VehicleBasicInfo vbi = vbis[i];
                 if (rpeht.ContainsKey(vbi.App_Vin))
                 {
                     rpeht.Remove(vbi.App_Vin);
                 }
                 rpeht.Add(vbi.App_Vin, vbi.EntityList);
                 vbi.EntityList = null;
             }
             dataCount = queryInfoArr.Length;
             gcApplyDelQuery.DataSource = vbis;
         }
         else
         {
             gcApplyDelQuery.DataSource = null;
         }
     }
     catch (Exception e)
     {
         MessageBox.Show("错误:" + e.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     finally
     {
         SplashScreenManager.CloseForm();
     }
 }
Beispiel #3
0
        //双击查看详细信息
        private void gcApplyUpOTQuery_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            ColumnView       cv  = (ColumnView)gcApplyUpOTQuery.FocusedView;
            VehicleBasicInfo vbi = (VehicleBasicInfo)cv.GetFocusedRow();

            if (vbi == null)
            {
                return;
            }

            // 弹出详细信息窗口
            JbxxViewForm jvf = new JbxxViewForm();

            setControlValue(jvf, "tbvin", vbi.App_Vin, false);
            setControlValue(jvf, "tbHgspbm", vbi.Hgspbm, false);
            setControlValue(jvf, "tbQcscqy", vbi.Qcscqy, false);
            setControlValue(jvf, "tbJkqczjxs", vbi.Jkqczjxs, false);
            setControlValue(jvf, "tbClxh", vbi.Clxh, false);
            setControlValue(jvf, "tbClzl", vbi.Clzl, false);
            setControlValue(jvf, "tbRllx", vbi.Rllx, false);
            setControlValue(jvf, "tbZczbzl", vbi.Zczbzl.ToString(), false);
            setControlValue(jvf, "tbZgcs", vbi.Zgcs.ToString(), false);
            setControlValue(jvf, "tbLtgg", vbi.Ltgg, false);
            setControlValue(jvf, "tbZj", vbi.Zj.ToString(), false);
            setControlValue(jvf, "tbClzzrq", vbi.Clzzrq.ToString(), false);
            setControlValue(jvf, "tbTymc", vbi.Tymc, false);
            setControlValue(jvf, "tbYyc", vbi.Yyc, false);
            setControlValue(jvf, "tbZwps", vbi.Zwps.ToString(), false);
            setControlValue(jvf, "tbZdsjzzl", vbi.Zdsjzzl.ToString(), false);
            setControlValue(jvf, "tbEdzk", vbi.Edzk.ToString(), false);
            setControlValue(jvf, "tbLj", vbi.Lj.ToString(), false);
            setControlValue(jvf, "tbQdxs", vbi.Qdxs, false);
            setControlValue(jvf, "tbJyjgmc", vbi.Jyjgmc, false);
            setControlValue(jvf, "tbJybgbh", vbi.Jybgbh, false);
            setControlValue(jvf, "tbQtxx", vbi.Qtxx, false);

            // 获取燃料信息
            FuelDataModel.RllxParamEntity[] rpelist = this.rpeht[vbi.App_Vin];
            for (int i = 0; rpelist != null && i < rpelist.Length; i++)
            {
                FuelDataModel.RllxParamEntity rpe = rpelist[i];
                setControlValue(jvf, rpe.Param_Code, rpe.Param_Value, false);
            }

            (jvf.Controls.Find("tc", true)[0] as XtraTabControl).SelectedTabPageIndex = 0;
            jvf.MaximizeBox = false;
            jvf.MinimizeBox = false;
            Utils.SetFormMid(jvf);
            jvf.setVisible("btnbaocun", false);
            jvf.setVisible("btnbaocunshangbao", false);
            jvf.setVisible("btnPrint", false);
            jvf.ShowDialog();
        }
Beispiel #4
0
        public static void SelectObjItem(object obj, bool flg)
        {
            GridView dgv = obj as GridView;
            List <VehicleBasicInfo> dv = (List <VehicleBasicInfo>)dgv.DataSource;

            if (dv != null)
            {
                for (int i = 0; i < dv.Count; i++)
                {
                    VehicleBasicInfo vInfo = dv[i];
                    vInfo.Check = flg;
                }
                dgv.PostEditor();
                dgv.RefreshData();
            }
        }
Beispiel #5
0
        // 将client端的VehicleBasicInfo array对象转换为web service端对象
        public static List <VehicleBasicInfo> FuelInfoS2C(FuelDataService.VehicleBasicInfo[] serviceBasicList)
        {
            List <VehicleBasicInfo> clientBasicList = new List <VehicleBasicInfo>();

            foreach (FuelDataService.VehicleBasicInfo serviceBasic in serviceBasicList)
            {
                List <RllxParamEntity> clientEntityList = new List <RllxParamEntity>();

                foreach (FuelDataService.RllxParamEntity serviceEntity in serviceBasic.EntityList)
                {
                    RllxParamEntity clientEntity = new RllxParamEntity();
                    ConvertObj <FuelDataService.RllxParamEntity, RllxParamEntity>(serviceEntity, clientEntity);
                    clientEntityList.Add(clientEntity);
                }

                VehicleBasicInfo clientBasic = new VehicleBasicInfo();
                Utils.BasicInfoW2C(serviceBasic, clientBasic);

                clientBasic.EntityList = clientEntityList.ToArray();
                clientBasicList.Add(clientBasic);
            }

            return(clientBasicList);
        }
Beispiel #6
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);
            }
        }
Beispiel #7
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("上报出错!");
            }
        }
        // 保时捷——导出Excel
        private void extractDataAndExport()
        {
            ProcessForm pf = new ProcessForm();

            pf.Show();
            //获取显示的车辆型号和日期信息
            CafcService.StatisticsData[] dataSource = (CafcService.StatisticsData[]) this.gcStatistic.DataSource;
            int total = 0;

            foreach (CafcService.StatisticsData sd in dataSource)
            {
                total += sd.Sl;
            }
            pf.TotalMax = total;
            pf.ShowProcessBar();
            //根据型号和日期(需要把开始日期和结束日期设为月份的第一天和最后一天)从服务器获取车型详细参数
            List <FuelDataService.VehicleBasicInfo> listVB = new List <FuelDataService.VehicleBasicInfo>();
            string startTime = this.dtStartTime.Text.Trim();
            string endTime   = this.dtEndTime.Text.Trim();
            int    pageCount = 1;

            while (true)
            {
                try
                {
                    FuelDataService.VehicleBasicInfo[] fuelData = Utils.service.QueryUploadedFuelData(Utils.userId, Utils.password, pageCount, 500, string.Empty, String.Empty, string.Empty, string.Empty, startTime, endTime, "MANUFACTURE_TIME");
                    if (fuelData != null)
                    {
                        if (fuelData.Length == 0)
                        {
                            break;
                        }
                        listVB.AddRange(fuelData);
                        pageCount++;
                        pf.progressBarControl1.Properties.Step = fuelData.Length;
                        pf.progressBarControl1.PerformStep();
                        Application.DoEvents();
                    }
                    else
                    {
                        break;
                    }
                }
                catch (WebException ex)
                {
                    MessageBox.Show("请本地检测网络");
                    return;
                }
            }
            pf.Close();
            //}
            if (listVB.Count == 0)
            {
                return;
            }
            //转换成为本地结构
            List <VehicleBasicInfo> listConvertedVB = Utils.FuelInfoS2C(listVB.ToArray());
            //将信息转化成datatable然后导出到excel当中
            DataTable dtOutput = new DataTable();

            String[] header = new String[] { "VIN", "CLXH", "TYMC", "RLLX", "EDZK", "ZWPS", "BSQXS", "ZCZBZL", "CLZZRQ", "ZHGKRLXHL", "LJ", "LTGG", "UPDATETIME" };
            foreach (String s in header)
            {
                dtOutput.Columns.Add(s);
            }
            foreach (VehicleBasicInfo vb in listConvertedVB)
            {
                DataRow dr = dtOutput.NewRow();
                foreach (DataColumn dc in dtOutput.Columns)
                {
                    String         columnName = dc.ColumnName;
                    bool           found      = false;
                    PropertyInfo[] properties = new VehicleBasicInfo().GetType().GetProperties();
                    foreach (PropertyInfo pi in properties)
                    {
                        if (pi.Name.Equals(columnName, StringComparison.OrdinalIgnoreCase))
                        {
                            object result = pi.GetValue(vb, null);
                            if (result is DateTime)
                            {
                                DateTime dt = (DateTime)result;
                                dr[columnName] = dt.ToString("yyyy-MM-dd");
                            }
                            else
                            {
                                dr[columnName] = pi.GetValue(vb, null);
                            }
                            found = true;

                            break;
                        }
                    }
                    if (!found)
                    {
                        RllxParamEntity[] rllxParams = vb.EntityList;
                        if (rllxParams == null || rllxParams.Length == 0)
                        {
                            continue;
                        }
                        foreach (RllxParamEntity rpe in rllxParams)
                        {
                            if (rpe.Param_Code.Contains(columnName))
                            {
                                dr[columnName] = rpe.Param_Value;
                                break;
                            }
                        }
                    }
                }
                dtOutput.Rows.Add(dr);
            }
            PorscheUtils utils = new PorscheUtils(true);

            utils.ExportExcel(dtOutput, this, PorscheUtils.CLMXExport);
        }
Beispiel #9
0
 // 上报
 private FuelDataService.OperateResult applyParam(string uploadType)
 {
     try
     {
         List <VehicleBasicInfo> lbiList = new List <VehicleBasicInfo>();
         VehicleBasicInfo        lbi     = new VehicleBasicInfo();
         lbi.V_Id       = "";
         lbi.User_Id    = Utils.userId;
         lbi.Qcscqy     = tbqcscqy.Text.Trim();
         lbi.Jkqczjxs   = this.tbjkqczjxs.Text.Trim();
         lbi.Vin        = this.tbvin.Text.Trim().ToUpper();
         lbi.Hgspbm     = this.tbHgspbm.Text.Trim().ToUpper();
         lbi.Clxh       = this.tbclxh.Text.Trim();
         lbi.Clzl       = this.tbclzl.Text.Trim();
         lbi.Rllx       = this.tbrllx.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.tbclzzrq.Text);
         lbi.Tymc       = this.tbtymc.Text.Trim();
         lbi.Yyc        = this.tbyyc.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.tbqdxs.Text.Trim();
         lbi.Jyjgmc     = this.tbjyjgmc.Text.Trim();
         lbi.Jybgbh     = this.tbjybgbh.Text.Trim();
         lbi.Qtxx       = this.tbQtxx.Text.Trim();
         lbi.CreateTime = DateTime.Now;
         lbi.UpdateTime = DateTime.Now;
         List <FuelDataModel.RllxParamEntity> listParam = new List <FuelDataModel.RllxParamEntity>();
         foreach (Control c in this.tlp.Controls)
         {
             if (c is TextEdit || c is DevExpress.XtraEditors.ComboBoxEdit)
             {
                 FuelDataModel.RllxParamEntity pe = new FuelDataModel.RllxParamEntity();
                 string strLabName = "lbl" + c.Name;
                 string paramCode  = c.Name;
                 pe.V_Id        = "";
                 pe.Param_Code  = paramCode;
                 pe.Vin         = this.tbvin.Text.Trim();
                 pe.Param_Value = c.Text;
                 listParam.Add(pe);
             }
         }
         lbi.EntityList = listParam.ToArray();
         lbiList.Add(lbi);
         // 上报
         if (uploadType == "UPLOADOT")
         {
             string     delReason = string.Empty;
             ReasonForm rf        = new ReasonForm();
             Utils.SetFormMid(rf);
             rf.Text = "补传原因";
             rf.ShowDialog();
             if (rf.DialogResult == DialogResult.OK)
             {
                 foreach (VehicleBasicInfo vInfo in lbiList)
                 {
                     vInfo.Reason = rf.Reason;
                 }
                 return(Utils.service.UploadOverTime(Utils.userId, Utils.password, Utils.FuelInfoC2S(lbiList).ToArray(), "CATARC_CUSTOM_2012"));
             }
             return(null);
         }
         else
         {
             return(Utils.service.UploadInsertFuelDataList(Utils.userId, Utils.password, Utils.FuelInfoC2S(lbiList).ToArray(), "CATARC_CUSTOM_2012"));
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #10
0
        //查询远程信息
        private void GetDataFromService(int pageNum)
        {
            int pageSize = Convert.ToInt32(this.spanNumber.Text);

            //验证用户
            if (!Utils.CheckUser())
            {
                MessageBox.Show("请检查用户名密码", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            // 验证查询时间:结束时间不能小于开始时间
            if (!string.IsNullOrEmpty(this.dtStartTime.Text) && !string.IsNullOrEmpty(this.dtEndTime.Text) && Convert.ToDateTime(this.dtStartTime.Text) > Convert.ToDateTime(this.dtEndTime.Text))
            {
                MessageBox.Show("结束时间不能小于开始时间", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            try
            {
                SplashScreenManager.ShowForm(typeof(DevWaitForm));
                //查询出服务器的数据
                int dataCount = Utils.service.QueryUploadedFuelDataCount(Utils.userId, Utils.password, tbVin.Text, tbClxh.Text, tbClzl.Text, cbRllx.Text, dtStartTime.Text, dtEndTime.Text, this.GetTimeType());
                FuelDataService.VehicleBasicInfo[] queryInfoArr = Utils.service.QueryUploadedFuelData(Utils.userId, Utils.password, pageNum, pageSize, tbVin.Text, tbClxh.Text, tbClzl.Text, cbRllx.Text, dtStartTime.Text, dtEndTime.Text, this.GetTimeType());
                if ((queryInfoArr != null && dataCount > 0) || (queryInfoArr == null && dataCount == 0))
                {
                    if (queryInfoArr != null)
                    {
                        List <VehicleBasicInfo> vbis = Utils.FuelInfoS2C(queryInfoArr);
                        for (int i = 0; i < vbis.Count; i++)
                        {
                            VehicleBasicInfo vbi = vbis[i];
                            if (rpeht.ContainsKey(vbi.Vin))
                            {
                                rpeht.Remove(vbi.Vin);
                            }
                            rpeht.Add(vbi.Vin, vbi.EntityList);
                            vbi.EntityList = null;
                        }
                        gcQueryCljbxx.DataSource = vbis;
                    }
                    else
                    {
                        gcQueryCljbxx.DataSource = null;
                    }
                    this.gvQueryCljbxx.BestFitColumns();
                    //页码显示信息计算
                    int pageCount = dataCount / pageSize;
                    if (dataCount % pageSize > 0)
                    {
                        pageCount++;
                    }
                    int dataLast = pageSize * pageNum;
                    if (pageNum == pageCount)
                    {
                        dataLast = dataCount;
                    }
                    this.lblSum.Text = String.Format("共{0}条", dataCount);
                    if (dataCount == 0)
                    {
                        this.labPage.Text = "当前显示0至0条";
                        this.txtPage.Text = "0/0";
                    }
                    else
                    {
                        this.labPage.Text = String.Format("当前显示{0}至{1}条", (pageSize * (pageNum - 1) + 1), dataLast);
                        this.txtPage.Text = String.Format("{0}/{1}", pageNum, pageCount);
                    }
                }
                else
                {
                    MessageBox.Show("获取数据失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("获取数据失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                SplashScreenManager.CloseForm();
            }
        }
Beispiel #11
0
        //将远程查到的数据同步到本地
        private void cmsSaveToLocal_Click(object sender, EventArgs e)
        {
            ColumnView       cv  = (ColumnView)gcQueryCljbxx.FocusedView;
            VehicleBasicInfo vbi = (VehicleBasicInfo)cv.GetFocusedRow();

            if (vbi == null)
            {
                MessageBox.Show("请选中要保存的行", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            FuelDataModel.RllxParamEntity[] rpelist = this.rpeht[vbi.Vin];
            OracleParameter clzzrq = new OracleParameter("CLZZRQ", vbi.Clzzrq)
            {
                DbType = DbType.Date
            };
            DateTime        uploadDeadlineDate = Utils.QueryUploadDeadLine(vbi.Clzzrq);
            OracleParameter uploadDeadline     = new OracleParameter("UPLOADDEADLINE", uploadDeadlineDate)
            {
                DbType = DbType.Date
            };
            OracleParameter creTime = new OracleParameter("CREATETIME", DateTime.Now)
            {
                DbType = DbType.Date
            };
            OracleParameter upTime = new OracleParameter("UPDATETIME", vbi.CreateTime)
            {
                DbType = DbType.Date
            };

            OracleParameter[] param =
            {
                new OracleParameter("V_ID",     vbi.V_Id),
                new OracleParameter("VIN",      vbi.Vin),
                new OracleParameter("HGSPBM",   string.IsNullOrEmpty(vbi.Hgspbm)?"":vbi.Hgspbm),
                new OracleParameter("USER_ID",  Utils.userId),
                new OracleParameter("QCSCQY",   vbi.Qcscqy),
                new OracleParameter("JKQCZJXS", vbi.Jkqczjxs),
                new OracleParameter("CLXH",     vbi.Clxh),
                new OracleParameter("CLZL",     vbi.Clzl),
                new OracleParameter("RLLX",     vbi.Rllx),
                new OracleParameter("ZCZBZL",   vbi.Zczbzl),
                new OracleParameter("ZGCS",     vbi.Zgcs),
                new OracleParameter("LTGG",     vbi.Ltgg),
                new OracleParameter("ZJ",       vbi.Zj),
                clzzrq,
                uploadDeadline,
                new OracleParameter("TYMC",     vbi.Tymc),
                new OracleParameter("YYC",      vbi.Yyc),
                new OracleParameter("ZWPS",     vbi.Zwps),
                new OracleParameter("ZDSJZZL",  vbi.Zdsjzzl),
                new OracleParameter("EDZK",     vbi.Edzk),
                new OracleParameter("LJ",       vbi.Lj),
                new OracleParameter("QDXS",     vbi.Qdxs),
                new OracleParameter("STATUS",   "0"),
                new OracleParameter("JYJGMC",   vbi.Jyjgmc),
                new OracleParameter("JYBGBH",   vbi.Jybgbh),
                new OracleParameter("QTXX",     string.IsNullOrEmpty(vbi.Qtxx)?"":vbi.Qtxx),
                creTime,
                upTime
            };
            using (OracleConnection con = new OracleConnection(OracleHelper.conn))
            {
                con.Open();
                OracleTransaction trans = con.BeginTransaction();
                try
                {
                    // 删除本地车辆基本信息
                    OracleHelper.ExecuteNonQuery(trans, string.Format(@"DELETE FROM FC_CLJBXX_ADC WHERE VIN='{0}'", vbi.Vin), null);
                    // 保存服务器端基本信息到本地
                    OracleHelper.ExecuteNonQuery(trans, (string)@"INSERT INTO FC_CLJBXX_ADC
                            (   V_ID,
                                VIN,
                                HGSPBM,
                                USER_ID,
                                QCSCQY,
                                JKQCZJXS,
                                CLXH,
                                CLZL,
                                RLLX,
                                ZCZBZL,
                                ZGCS,
                                LTGG,
                                ZJ,
                                CLZZRQ,
                                UPLOADDEADLINE,
                                TYMC,
                                YYC,
                                ZWPS,
                                ZDSJZZL,
                                EDZK,
                                LJ,
                                QDXS,
                                STATUS,
                                JYJGMC,
                                JYBGBH,
                                QTXX,
                                CREATETIME,
                                UPDATETIME
                            ) VALUES
                            (   :V_ID,
                                :VIN,
                                :HGSPBM,
                                :USER_ID,
                                :QCSCQY,
                                :JKQCZJXS,
                                :CLXH,
                                :CLZL,
                                :RLLX,
                                :ZCZBZL,
                                :ZGCS,
                                :LTGG,
                                :ZJ,
                                :CLZZRQ,
                                :UPLOADDEADLINE,
                                :TYMC,
                                :YYC,
                                :ZWPS,
                                :ZDSJZZL,
                                :EDZK,
                                :LJ,
                                :QDXS,
                                :STATUS,
                                :JYJGMC,
                                :JYBGBH,
                                :QTXX,
                                :CREATETIME,
                                :UPDATETIME)", param);

                    // 删除本地燃料参数信息
                    OracleHelper.ExecuteNonQuery(trans, string.Format(@"DELETE FROM RLLX_PARAM_ENTITY_ADC WHERE VIN='{0}'", vbi.Vin), null);
                    string sqlSaveParams = string.Empty;
                    foreach (RllxParamEntity entity in rpelist)
                    {
                        sqlSaveParams = @"INSERT INTO RLLX_PARAM_ENTITY_ADC (PARAM_CODE,VIN,PARAM_VALUE,V_ID) 
                            VALUES(:PARAM_CODE,:VIN,:PARAM_VALUE,:V_ID)";

                        OracleParameter[] paramList =
                        {
                            new OracleParameter("PARAM_CODE",  entity.Param_Code),
                            new OracleParameter("VIN",         entity.Vin),
                            new OracleParameter("PARAM_VALUE", entity.Param_Value),
                            new OracleParameter("V_ID",        entity.V_Id)
                        };
                        OracleHelper.ExecuteNonQuery(trans, sqlSaveParams, paramList);
                    }
                    trans.Commit();
                    MessageBox.Show("同步成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    MessageBox.Show("同步失败:" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
        }