Esempio n. 1
0
        /// <summary>
        /// 利用dkcode 与 里程初始化,潜在问题,要求在同一个链中,dkcode一致,目前数据库中的里程描述description不正确
        /// </summary>
        /// <param name="s"></param>
        /// <param name="SerialNo"></param>
        /// <param name="projID"></param>
        /// <param name="profName"></param>
        /// <param name="ProjectName"></param>
        /// <param name="SegmentName"></param>
        /// <param name="DKCode"></param>
        /// <param name="Mileage_Start"></param>
        /// <param name="Mileage_Mid"></param>
        /// <param name="Mileage_End"></param>
        /// <param name="dt"></param>
        /// <param name="AvgProgress"></param>
        /// <param name="dir"></param>
        /// <param name="labelFile"></param>
        /// <param name="length"></param>
        public CRailwayProject(CRailwayScene s, string SerialNo, int projID, string profName, string ProjectName, string SegmentName, string DKCode,
                               double Mileage_Start, double Mileage_Mid, double Mileage_End,
                               //string Mileage_Start_Des, string Mileage_Mid_Des, string Mileage_End_Des,
                               DateTime dt, double AvgProgress, double dir, string labelFile)
        {
            mScene           = s;
            ProfessionalName = profName;
            mProjectID       = projID;
            mProjectName     = ProjectName;
            mSegmentName     = SegmentName;
            mSerialNo        = SerialNo;
            mDKCode          = DKCode;

            Mileage_Start_Ds = CRailwayLineList.CombiDKCode(DKCode, Mileage_Start);
            //Mileage_Mid_Ds = Mileage_Mid_Des;
            Mileage_End_Ds = CRailwayLineList.CombiDKCode(DKCode, Mileage_End);;

            ///Doing
            //DataSet ds = CServerWrapper.findProjHistory(mSerialNo);

            //if (ds != null)
            //{
            //    PrintDataTable(ds.Tables[0]);
            //    PrintDataTable(ds.Tables[1]);
            //}
            //else
            //{
            //    Console.WriteLine("None Data " + ProjectName);
            //}

            ///FIXME, 描述在数据库中不准确,待修正
            double tmp;

            //mScene.mMiddleLines.parseDKCode(Mileage_Start_Des, out mDKCode_Start, out tmp);
            //mScene.mMiddleLines.parseDKCode(Mileage_Mid_Des, out mDKCode_Mid, out tmp);
            //mScene.mMiddleLines.parseDKCode(Mileage_End_Des, out mDKCode_End, out tmp);

            mMileage_Start = Mileage_Start;
            mMileage_Mid   = Mileage_Mid;
            mMileage_End   = Mileage_End;

            mIsValid  = mScene.mMiddleLines.getPosbAndLengthByDKCode(mDKCode, mMileage_Mid, out mLongitude_Mid, out mLatitude_Mid, out mAltitude_Mid, out mHeading_Mid, out tmp);
            mIsValid &= mScene.mMiddleLines.getPosbAndLengthByDKCode(mDKCode, mMileage_Start, out mLongitude_Start, out mLatitude_Start, out mAltitude_Start, out mHeading_Start, out mGlobalMileage);
            mIsValid &= mScene.mMiddleLines.getPosbAndLengthByDKCode(mDKCode, mMileage_End, out mLongitude_End, out mLatitude_End, out mAltitude_End, out mHeading_End, out tmp);

            mUpdateTime = dt;

            mDirection  = dir;
            mLabelImage = labelFile;
            mLength     = Math.Abs(mMileage_End - mMileage_Start); //FIXME 目前是导入,不同DKCode的线路如何求解
            mds         = CServerWrapper.findProjHistory(mSerialNo);
            getFXProgress();
        }
Esempio n. 2
0
        /// <summary>
        /// 获取分项进度
        /// </summary>
        /// <returns>返回值:分项名称,分项进度 的队列</returns>
        public void initFXProgress(DataTable dt1 = null, DataTable dt2 = null)
        {
            int     fid;
            int     n           = 0;
            double  avgProgress = 0;
            string  dt;
            CFXProj fxp;

            if (dt1 != null && dt2 != null)
            {
                DataRow[] drsp = dt1.Select("ProjectID =" + mProjectID);
                foreach (DataRow dr in drsp)
                {
                    fid            = Convert.ToInt32(dr["ProjectDictID"]);
                    fxp            = new CFXProj(fid, dr["ProjectDictName"].ToString(), Convert.ToDouble(dr["DesignNum"]));
                    fxp.initAmount = Convert.ToDouble(dr["InitNum"]);
                    DataRow[] drs = dt2.Select("ProjectID =" + mProjectID + " and ProjectDictID = " + fid, "ReportDate asc");
                    if (drs.Count() == 1)
                    {  // 如果只有一条数据,无法图表显示
                        fxp.strDate.Add(
                            DateTime.ParseExact(drs[0]["ReportDate"].ToString(), "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture).AddDays(-30).ToString("yyyyMMdd"));
                        fxp.doneAmount.Add(0);
                    }
                    foreach (DataRow dr2 in drs)
                    {
                        fxp.strDate.Add(dr2["ReportDate"].ToString());
                        fxp.doneAmount.Add(Convert.ToDouble(dr2["DictTotal"]));
                    }
                    if (drs.Count() > 0)
                    {
                        dt = fxp.strDate.Last();
                        if (dt.CompareTo(mUpdateTime.ToString("yyyyMMdd")) > 0)  // 数据库的工程表的updateDate字段逻辑有误
                        {
                            mUpdateTime = DateTime.ParseExact(dt, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);
                        }
                        avgProgress += fxp.doneAmount.Last() / fxp.TotalAmount;
                    }
                    else
                    {
                        fxp.strDate.Add(DateTime.Now.ToString("yyyyMMdd"));
                        fxp.doneAmount.Add(Convert.ToDouble(dr["InitNum"]));  // 添加初始化量,保证每个分项工程都有数据
                        avgProgress += fxp.initAmount / fxp.TotalAmount;
                    }
                    mfx.Add(fxp);
                    n++;
                }
                //createMFX(dlt1.Select("ProjectID =" + mProjectID) , dlt2.Select("ProjectID =" + mProjectID, "ReportDate asc"));
            }
            else if (CServerWrapper.isConnected)
            {
                DataSet ds = CServerWrapper.findProjHistory(mSerialNo);
                dt1 = ds.Tables[0];
                dt2 = ds.Tables[1];
                foreach (DataRow dr in dt1.Rows)
                {
                    fid            = Convert.ToInt32(dr["ProjectDictID"]);
                    fxp            = new CFXProj(fid, dr["ProjectDictName"].ToString(), Convert.ToDouble(dr["DesignNum"]));
                    fxp.initAmount = Convert.ToDouble(dr["InitNum"]);
                    DataRow[] drs = dt2.Select("ProjectDictID = " + fid, "ReportDate asc");
                    foreach (DataRow dr2 in drs)
                    {
                        fxp.strDate.Add(dr2["ReportDate"].ToString());
                        fxp.doneAmount.Add(Convert.ToDouble(dr2["DictTotal"]));
                    }
                    if (drs.Count() > 0)
                    {
                        dt = fxp.strDate.Last();
                        if (dt.CompareTo(mUpdateTime.ToString("yyyyMMdd")) > 0)  // 数据库的工程表的updateDate字段逻辑有误
                        {
                            mUpdateTime = DateTime.ParseExact(dt, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture);
                        }
                        avgProgress += fxp.doneAmount.Last() / fxp.TotalAmount;
                    }
                    else
                    {
                        fxp.strDate.Add(DateTime.Now.ToString("yyyyMMdd"));
                        fxp.doneAmount.Add(Convert.ToDouble(dr["InitNum"]));  // 添加初始化量,保证每个分项工程都有数据
                        avgProgress += fxp.initAmount / fxp.TotalAmount;
                    }
                    mfx.Add(fxp);
                    n++;
                }
            }

            if (n > 0)
            {
                avgProgress /= n;
                mAvgProgress = avgProgress;
            }
            else
            {
                mAvgProgress = 0;
            }
        }