Beispiel #1
0
        /// <summary>
        /// 保存按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, EventArgs e)
        {
            //删除
            _fixedTable = new UserFixedTable(waveformMaker.WaveformDataList[0].IndexOperator, waveformMaker.WaveformDataList[0].CitFile.iKmInc);
            _fixedTable.Clear();
            //重新保存索引库
            for (int i = 0; i < dgvMarkedPoints.Rows.Count; i++)
            {
                UserMarkedPoint markedPoint = new UserMarkedPoint();
                markedPoint.ID             = dgvMarkedPoints.Rows[i].Cells[0].Value.ToString();
                markedPoint.FilePointer    = long.Parse(dgvMarkedPoints.Rows[i].Cells[2].Value.ToString());
                markedPoint.UserSetMileage = float.Parse(dgvMarkedPoints.Rows[i].Cells[3].Value.ToString()) * 1000;
                _fixedTable.MarkedPoints.Add(markedPoint);
            }
            _fixedTable.Save();
            //创建计算后的索引库
            MilestoneFix fix = new MilestoneFix(waveformMaker.WaveformDataList[0].CitFilePath, waveformMaker.WaveformDataList[0].IndexOperator);

            try
            {
                fix.ClearMilestoneFixTable();
                fix.RunFixingAlgorithm();
                fix.SaveMilestoneFixTable();
                MessageBox.Show("保存成功!");
                btnLoad_Click(sender, e);
            }
            catch (Exception ex)
            {
                MyLogger.LogError("手动里程修正失败", ex);
                MessageBox.Show("错误:" + ex.Message);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 加载按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnLoad_Click(object sender, EventArgs e)
        {
            MilestoneFix fix = new MilestoneFix(waveformMaker.WaveformDataList[0].CitFilePath, waveformMaker.WaveformDataList[0].IndexOperator);

            fix.ReadMilestoneFixTable();
            dataGridView1.Rows.Clear();
            if (fix.FixData != null && fix.FixData.Count > 0)
            {
                for (int i = 0; i < fix.FixData.Count; i++)
                {
                    DataGridViewRow dgvr = new DataGridViewRow();
                    dgvr.CreateCells(dataGridView1);

                    dgvr.Cells[0].Value = fix.FixData[i].ID;
                    dgvr.Cells[1].Value = "";
                    dgvr.Cells[2].Value = fix.FixData[i].RealDistance / 1000.0f;
                    dgvr.Cells[3].Value = fix.FixData[i].SamplePointCount;

                    dgvr.Cells[4].Value = fix.FixData[i].SampleRate;
                    dgvr.Cells[5].Value = fix.FixData[i].MarkedStartPoint.FilePointer;
                    dgvr.Cells[6].Value = fix.FixData[i].MarkedEndPoint.FilePointer;
                    dgvr.Cells[7].Value = fix.FixData[i].MarkedStartPoint.UserSetMileage / 1000;
                    dgvr.Cells[8].Value = fix.FixData[i].MarkedEndPoint.UserSetMileage / 1000;

                    if (fix.FixData[i].SampleRate > 0.2510000 || fix.FixData[i].SampleRate < 0.2490000)
                    {
                        if (fix.FixData[i].SampleRate > 0.2510000)
                        {
                            dgvr.Cells[4].Style.ForeColor = Color.Red;
                        }
                        else
                        {
                            dgvr.Cells[4].Style.ForeColor = Color.Blue;
                        }
                        //dgvr.DefaultCellStyle.ForeColor = Color.Red;
                    }
                    else
                    {
                        dgvr.Cells[4].Style.ForeColor = Color.Black;
                    }

                    dataGridView1.Rows.Add(dgvr);
                }
            }
        }
        /// <summary>
        /// 向idf文件中写入
        /// </summary>
        /// <param name="idfFilePath"></param>
        private void WriteIdf(String idfFilePath)
        {
            bool writeResult   = false;
            bool CacluteResult = false;

            try
            {
                UserFixedTable fixedTable = new UserFixedTable(waveformMaker.WaveformDataList[0].IndexOperator, waveformMaker.WaveformDataList[0].CitFile.iKmInc);
                fixedTable.Clear();
                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    float           mile        = (int)dataGridView1.Rows[i].Cells[2].Value + (int)(dataGridView1.Rows[i].Cells[3].Value);
                    UserMarkedPoint markedPoint = new UserMarkedPoint();
                    markedPoint.ID             = (i + 1).ToString();
                    markedPoint.FilePointer    = long.Parse(dataGridView1.Rows[i].Cells[1].Value.ToString());
                    markedPoint.UserSetMileage = mile;
                    fixedTable.MarkedPoints.Add(markedPoint);
                }
                fixedTable.Save();
                writeResult = true;
            }
            catch (Exception ex)
            {
                MyLogger.logger.Error("读取里程修正表错误:" + ex.Message + ",堆栈:" + ex.StackTrace);
                MessageBox.Show("错误:" + ex.Message);
            }

            try
            {
                MilestoneFix fix = new MilestoneFix(waveformMaker.WaveformDataList[0].CitFilePath, waveformMaker.WaveformDataList[0].IndexOperator);
                fix.RunFixingAlgorithm();
                fix.SaveMilestoneFixTable();
                CacluteResult = true;
            }
            catch (Exception ex)
            {
                MyLogger.logger.Error("手动里程修正失败:" + ex.Message + ",堆栈:" + ex.StackTrace);
                MessageBox.Show("错误:" + ex.Message);
            }
            if (writeResult && CacluteResult)
            {
                MessageBox.Show("创建并且写入成功!");
            }
        }
        static void Main(string[] args)
        {
            string citFile = @"H:\工作文件汇总\铁科院\程序\轨检\data\GNHS-HANGZHOU-NANJING-14052016-175302-1减变增.cit";
            string idfFile = @"H:\工作文件汇总\铁科院\程序\轨检\data\GNHS-HANGZHOU-NANJING-14052016-175302-1减变增.idf";

            IOperator indexOperator = new IndexOperator();

            indexOperator.IndexFilePath = idfFile;

            InnerFileOperator.InnerFilePath   = @"H:\工作文件汇总\铁科院\程序\轨检\data\" + "InnerDB.idf";
            InnerFileOperator.InnerConnString = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = {0}; Persist Security Info = True; Mode = Share Exclusive; Jet OLEDB:Database Password = iicdc; ";


            MilestoneFix _mileageFix = new MilestoneFix(citFile, indexOperator);

            _mileageFix.ReadMilestoneFixTable();


            List <MileStoneFixData> listFixData = new List <MileStoneFixData>();

            listFixData = _mileageFix.FixData;
        }
Beispiel #5
0
        public void SaveChannelDataTxt(string citFilePath, string idfFilePath, string dbFilePath, string channleName, string exportTxtPath, double startMileage, double endMileage, int sampleCount, bool isChinese)
        {
            FileInformation citHeader = citProcess.GetFileInformation(citFilePath);

            List <ChannelDefinition> list = citProcess.GetChannelDefinitionList(citFilePath);

            int channelId   = 0;
            var channelItem = list.Where(s => s.sNameEn == channleName || s.sNameCh == channleName).FirstOrDefault();

            if (channelItem != null)
            {
                channelId = channelItem.sID;
            }

            if (citHeader.iKmInc == 1 && startMileage < endMileage)
            {
                double change = startMileage;
                startMileage = endMileage;
                endMileage   = change;
            }

            if (!String.IsNullOrEmpty(idfFilePath) && !String.IsNullOrEmpty(dbFilePath))
            {
                indexOperator = new IndexOperator();
                indexOperator.IndexFilePath = idfFilePath;

                InnerFileOperator.InnerFilePath   = dbFilePath;
                InnerFileOperator.InnerConnString = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = {0}; Persist Security Info = True; Mode = Share Exclusive; Jet OLEDB:Database Password = iicdc; ";

                _mileageFix = new MilestoneFix(citFilePath, indexOperator);

                _mileageFix.ReadMilestoneFixTable();

                if (_mileageFix.FixData.Count > 0)
                {
                    if (citHeader.iKmInc == 0)
                    {
                        if (startMileage >= _mileageFix.FixData[_mileageFix.FixData.Count - 1].MarkedEndPoint.UserSetMileage / 1000 ||
                            endMileage <= _mileageFix.FixData[0].MarkedStartPoint.UserSetMileage / 1000)
                        {
                            //return "";

                            throw new Exception("此里程范围内没有修正数据:start:" + startMileage + "  end:" + endMileage);
                        }
                        if (startMileage < (_mileageFix.FixData[0].MarkedStartPoint.UserSetMileage / 1000))
                        {
                            startMileage = (_mileageFix.FixData[0].MarkedStartPoint.UserSetMileage / 1000);
                        }
                        if (endMileage > _mileageFix.FixData[_mileageFix.FixData.Count - 1].MarkedEndPoint.UserSetMileage / 1000)
                        {
                            endMileage = _mileageFix.FixData[_mileageFix.FixData.Count - 1].MarkedEndPoint.UserSetMileage / 1000;
                        }
                    }
                    else if (citHeader.iKmInc == 1)
                    {
                        if (endMileage >= _mileageFix.FixData[_mileageFix.FixData.Count - 1].MarkedEndPoint.UserSetMileage / 1000 ||
                            startMileage <= _mileageFix.FixData[0].MarkedStartPoint.UserSetMileage / 1000)
                        {
                            //return "";
                            throw new Exception("此里程范围内没有修正数据:start:" + startMileage + "  end:" + endMileage);
                        }
                        if (startMileage > _mileageFix.FixData[0].MarkedStartPoint.UserSetMileage / 1000)
                        {
                            startMileage = _mileageFix.FixData[0].MarkedStartPoint.UserSetMileage / 1000;
                        }
                        if (endMileage < _mileageFix.FixData[_mileageFix.FixData.Count - 1].MarkedEndPoint.UserSetMileage / 1000)
                        {
                            endMileage = _mileageFix.FixData[_mileageFix.FixData.Count - 1].MarkedEndPoint.UserSetMileage / 1000;
                        }
                    }



                    Milestone startStone = new Milestone();
                    Milestone endStone   = new Milestone();

                    startStone = CalcMilestoneByFixedMilestone((float)startMileage * 1000, _mileageFix.FixData, citFilePath);
                    endStone   = CalcMilestoneByFixedMilestone((float)endMileage * 1000, _mileageFix.FixData, citFilePath);
                    //_mileageFix.CalcMilestoneByFixedMilestone(123);
                    //endStone = _mileageFix.CalcMilestoneByFixedMilestone((float)endMileage * 1000);

                    if (startStone.mFilePosition != -1)
                    {
                        List <double[]> dataList = new List <double[]>();

                        double[] datas = citProcess.GetOneChannelDataInRange(citFilePath, channelId, startStone.mFilePosition, endStone.mFilePosition);

                        List <Milestone> mileStoneList = citProcess.GetMileStoneByRange(citFilePath, startStone.mFilePosition, endStone.mFilePosition);

                        List <Milestone> mileStoneListNew = GetMileageReviseData(mileStoneList, _mileageFix.FixData, citFilePath);

                        var dataKm    = mileStoneListNew.Select(s => Convert.ToDouble(s.mKm)).ToArray();
                        var dataMeter = mileStoneListNew.Select(s => Convert.ToDouble(s.mMeter)).ToArray();

                        dataList.Add(dataKm);
                        dataList.Add(dataMeter);
                        dataList.Add(datas);

                        ExportData(exportTxtPath, dataList);
                    }
                }
                else
                {
                }
            }
        }
Beispiel #6
0
        /// <summary>
        /// 接口函数:计算峰峰值指标
        /// </summary>
        /// <param name="citFileName">cit文件全路径</param>
        /// <param name="citFileName">idf文件全路径</param>
        /// <returns></returns>
        private List <String> PreProcessDeviation(String citFileName, int pointCount, string idfFileName = null)
        {
            //StreamWriter sw3 = new StreamWriter("d:/peakvalue_40000.csv", true, Encoding.Default);
            //StringBuilder sbtmp = new StringBuilder();
            //sbtmp.Append("d_tt,");
            //sbtmp.Append("d_wvelo,");
            //sbtmp.Append("d_gauge,");
            //sbtmp.Append("d_wx");
            //sw3.WriteLine(sbtmp.ToString());

            List <String> dataStrList = new List <String>();

            cdlist.channelDefinitionList = cfprocess.GetChannelDefinitionList(citFileName);

            fileinfo = cfprocess.GetFileInformation(citFileName);
            //int tds = fileinfo.iChannelNumber;

            long[] position = cfprocess.GetPositons(citFileName);
            long   startPos = position[0]; //开始位置、结束位置
            long   endPos   = position[1];

            //分段读取方法////////////////////

            long totleSample = cfprocess.GetTotalSampleCount(citFileName);
            //循环次数
            int count = Convert.ToInt32(totleSample / pointCount);
            //是否有余点
            int residue = Convert.ToInt32(totleSample % pointCount);

            bool iszero = false;

            //是否执行一次
            if (count == 0)
            {
                iszero = true;
            }
            //如果有余数循环次数加1
            if (residue > 0)
            {
                count++;
            }

            for (int z = 0; z < count; z++)
            {
                if (iszero)
                {
                    endPos = cfprocess.GetAppointEndPostion(citFileName, startPos, residue);
                }
                else
                {
                    if (residue == 0)
                    {
                        endPos = cfprocess.GetAppointEndPostion(citFileName, startPos, pointCount);
                    }
                    else
                    {
                        if (z == (count - 1))
                        {
                            endPos = cfprocess.GetAppointEndPostion(citFileName, startPos, residue);
                        }
                        else
                        {
                            endPos = cfprocess.GetAppointEndPostion(citFileName, startPos, pointCount);
                        }
                    }
                }

                //分段读取方法////////////////////

                List <Milestone> allmilelist;
                //List<Milestone> milelist = cfprocess.GetAllMileStone(citFileName);
                ///分段读取使用//////////////////////////
                List <Milestone> milelist = cfprocess.GetMileStoneByRange(citFileName, startPos, endPos);
                /////////////////////////////

                //验证是否修正
                if (!String.IsNullOrEmpty(idfFileName))
                {
                    IndexOperator _op = new IndexOperator();
                    _op.IndexFilePath = idfFileName;
                    MilestoneFix mile = new MilestoneFix(citFileName, _op);
                    mile.ReadMilestoneFixTable();
                    allmilelist = mile.GetMileageReviseData(milelist);
                }
                else
                {
                    allmilelist = milelist;
                }

                //开始里程  和结束里程
                double[] d_tt = new double[allmilelist.Count];
                for (int i = 0; i < allmilelist.Count; i++)
                {
                    double obj = allmilelist[i].GetMeter() / 1000;
                    d_tt[i] = obj;
                }

                double[] d_wvelo = cfprocess.GetOneChannelDataInRange(citFileName, cdlist.GetChannelIdByName("Speed", "速度"), startPos, endPos);
                double[] d_gauge = cfprocess.GetOneChannelDataInRange(citFileName, cdlist.GetChannelIdByName("Gage", "轨距"), startPos, endPos);

                double[] d_wx = cfprocess.GetOneChannelDataInRange(citFileName, cdlist.GetChannelIdByName("L_Prof_SC", "左高低_中波"), startPos, endPos);


                //for (int i = 0; i < d_tt.Length; i++)
                //{
                //    sw3.Write(d_tt[i]);
                //    sw3.Write(",");
                //    sw3.Write(d_wvelo[i]);
                //    sw3.Write(",");
                //    sw3.Write(d_gauge[i]);
                //    sw3.Write(",");
                //    sw3.Write(d_wx[i]);
                //    sw3.Write("\n");
                //}


                List <String> tmpDataStrList = pdc.WideGaugePreProcess("左高低_中波", d_tt, d_wx, d_wvelo, d_gauge, 8.0);
                dataStrList.AddRange(tmpDataStrList);

                d_wx = cfprocess.GetOneChannelDataInRange(citFileName, cdlist.GetChannelIdByName("R_Prof_SC", "右高低_中波"), startPos, endPos);

                tmpDataStrList = pdc.WideGaugePreProcess("右高低_中波", d_tt, d_wx, d_wvelo, d_gauge, 8.0);
                dataStrList.AddRange(tmpDataStrList);

                d_wx = cfprocess.GetOneChannelDataInRange(citFileName, cdlist.GetChannelIdByName("L_Align_SC", "左轨向_中波"), startPos, endPos);

                tmpDataStrList = pdc.WideGaugePreProcess("左轨向_中波", d_tt, d_wx, d_wvelo, d_gauge, 8.0);
                dataStrList.AddRange(tmpDataStrList);

                d_wx = cfprocess.GetOneChannelDataInRange(citFileName, cdlist.GetChannelIdByName("R_Align_SC", "右轨向_中波"), startPos, endPos);

                tmpDataStrList = pdc.WideGaugePreProcess("右轨向_中波", d_tt, d_wx, d_wvelo, d_gauge, 8.0);
                dataStrList.AddRange(tmpDataStrList);

                //分段读取方法////////////////////
                startPos = endPos;
            }

            //sw3.Close();

            //分段读取方法////////////////////
            return(dataStrList);
        }
Beispiel #7
0
        /// <summary>
        /// 接口函数:计算峰峰值指标
        /// </summary>
        /// <param name="citFileName">cit文件全路径</param>
        /// <param name="citFileName">idf文件全路径</param>
        /// <returns></returns>
        private List <String> PreProcessDeviation2(String citFileName, int pointCount, string idfFileName = null)
        {
            List <String> dataStrList = new List <String>();

            cdlist.channelDefinitionList = cfprocess.GetChannelDefinitionList(citFileName);

            fileinfo = cfprocess.GetFileInformation(citFileName);
            //int tds = fileinfo.iChannelNumber;

            long[] position = cfprocess.GetPositons(citFileName);
            long   startPos = position[0]; //开始位置、结束位置
            long   endPos   = position[1];

            List <Milestone> allmilelist;
            List <Milestone> milelist = cfprocess.GetAllMileStone(citFileName);

            //验证是否修正
            if (!String.IsNullOrEmpty(idfFileName))
            {
                IndexOperator _op = new IndexOperator();
                _op.IndexFilePath = idfFileName;
                MilestoneFix mile = new MilestoneFix(citFileName, _op);
                mile.ReadMilestoneFixTable();
                allmilelist = mile.GetMileageReviseData(milelist);
            }
            else
            {
                allmilelist = milelist;
            }

            //开始里程  和结束里程
            double[] d_tt = new double[allmilelist.Count];
            for (int i = 0; i < allmilelist.Count; i++)
            {
                double obj = allmilelist[i].GetMeter() / 1000;
                d_tt[i] = obj;
            }

            double[] d_wvelo = cfprocess.GetOneChannelDataInRange(citFileName, cdlist.GetChannelIdByName("Speed", "速度"), startPos, endPos);
            double[] d_gauge = cfprocess.GetOneChannelDataInRange(citFileName, cdlist.GetChannelIdByName("Gage", "轨距"), startPos, endPos);

            double[] d_wx = cfprocess.GetOneChannelDataInRange(citFileName, cdlist.GetChannelIdByName("L_Prof_SC", "左高低_中波"), startPos, endPos);

            //StreamWriter sw2 = new StreamWriter("d:/peakvalue_all.csv", true, Encoding.Default);
            //StringBuilder sbtmp = new StringBuilder();
            //sbtmp.Append("d_tt,");
            //sbtmp.Append("d_wvelo,");
            //sbtmp.Append("d_gauge,");
            //sbtmp.Append("d_wx");
            //sw2.WriteLine(sbtmp.ToString());
            //for (int i = 0; i < d_tt.Length; i++)
            //{
            //    sw2.Write(d_tt[i]);
            //    sw2.Write(",");
            //    sw2.Write(d_wvelo[i]);
            //    sw2.Write(",");
            //    sw2.Write(d_gauge[i]);
            //    sw2.Write(",");
            //    sw2.Write(d_wx[i]);
            //    sw2.Write("\n");
            //}
            //sw2.Close();

            List <String> tmpDataStrList = pdc.WideGaugePreProcess("左高低_中波", d_tt, d_wx, d_wvelo, d_gauge, 8.0);

            dataStrList.AddRange(tmpDataStrList);

            d_wx = cfprocess.GetOneChannelDataInRange(citFileName, cdlist.GetChannelIdByName("R_Prof_SC", "右高低_中波"), startPos, endPos);

            tmpDataStrList = pdc.WideGaugePreProcess("右高低_中波", d_tt, d_wx, d_wvelo, d_gauge, 8.0);
            dataStrList.AddRange(tmpDataStrList);

            d_wx = cfprocess.GetOneChannelDataInRange(citFileName, cdlist.GetChannelIdByName("L_Align_SC", "左轨向_中波"), startPos, endPos);

            tmpDataStrList = pdc.WideGaugePreProcess("左轨向_中波", d_tt, d_wx, d_wvelo, d_gauge, 8.0);
            dataStrList.AddRange(tmpDataStrList);

            d_wx = cfprocess.GetOneChannelDataInRange(citFileName, cdlist.GetChannelIdByName("R_Align_SC", "右轨向_中波"), startPos, endPos);

            tmpDataStrList = pdc.WideGaugePreProcess("右轨向_中波", d_tt, d_wx, d_wvelo, d_gauge, 8.0);
            dataStrList.AddRange(tmpDataStrList);

            return(dataStrList);
        }
        /// <summary>
        /// 向idf文件中写入
        /// </summary>
        /// <param name="citFilePath">cit文件路径----->来自里程快速校正中的选择cit文件的按钮</param
        /// <param name="numericUpDown1">跳变允许值----->来自里程快速校正中的  跳变容许值</param>
        /// <param name="innerdbpath">内部数据库-----></param>
        private string _writeIdf(String citFilePath, int numericUpDown1, string innerdbpath)
        {
            //String idfFileName = Path.GetFileNameWithoutExtension(citFilePath) + ".idf";

            //String idfFilePath = Path.Combine(Path.GetDirectoryName(citFilePath), idfFileName);

            //if (!File.Exists(idfFilePath))
            //{
            //    //MessageBox.Show("找不到波形索引文件!");
            //    Console.WriteLine("找不到波形索引文件!");
            //    return;
            //}

            //公共方法
            ResultInfo resultInfo = new ResultInfo();

            //读取cit文件
            List <AutoIndex> autoIndexClsList = _readCit(citFilePath, numericUpDown1);

            String idfFileName = Path.GetFileNameWithoutExtension(citFilePath) + "_MileageFix" + ".idf";

            String idfFilePath = Path.Combine(Path.GetDirectoryName(citFilePath), idfFileName);

            //设置附带数据库路径和链接字符串,流程修正使用
            InnerFileOperator.InnerFilePath   = innerdbpath;
            InnerFileOperator.InnerConnString = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = {0}; Persist Security Info = True; Mode = Share Exclusive; Jet OLEDB:Database Password = iicdc; ";
            //InnerFileOperator.InnerConnString = "provider=Microsoft.Ace.OLEDB.12.0;extended properties=excel 12.0; Data Source = {0}; Persist Security Info = True; Mode = Share Exclusive; Extended Properties=Excel 12.0:Database Password = iicdc; ";

            try
            {
                _op = new IndexOperator();
                _op.IndexFilePath = idfFilePath;
                CITFileProcess  cit        = new CITFileProcess();
                FileInformation fileforma  = cit.GetFileInformation(citFilePath);
                UserFixedTable  fixedTable = new UserFixedTable(_op, fileforma.iKmInc);
                fixedTable.Clear();
                for (int i = 0; i < autoIndexClsList.Count; i++)
                {
                    float           mile        = autoIndexClsList[i].km_current + autoIndexClsList[i].meter_current;
                    UserMarkedPoint markedPoint = new UserMarkedPoint();
                    markedPoint.ID             = (i + 1).ToString();
                    markedPoint.FilePointer    = autoIndexClsList[i].milePos;
                    markedPoint.UserSetMileage = mile;
                    fixedTable.MarkedPoints.Add(markedPoint);
                }
                fixedTable.Save();

                try
                {
                    MilestoneFix fix = new MilestoneFix(citFilePath, _op);
                    fix.RunFixingAlgorithm();
                    fix.SaveMilestoneFixTable();

                    resultInfo.flag = 1;
                    resultInfo.msg  = "";
                    resultInfo.data = idfFilePath;
                }
                catch (Exception ex)
                {
                    resultInfo.flag = 0;
                    resultInfo.msg  = ex.Message;
                }
            }
            catch (Exception ex)
            {
                resultInfo.flag = 0;
                resultInfo.msg  = ex.Message;
            }

            return(JsonConvert.SerializeObject(resultInfo));
        }