Example #1
0
 //增加计划明细
 private void AddPlanHistories(Plan NewPlan)
 {
     for (int i = NewPlan.PlanHistories.Count() - 1; i >= 0; i--)
     {
         var NewPlanHistory = NewPlan.PlanHistories.ElementAt(i);
         if (!NewPlanHistory.IsSubmit) continue;
         //处理航空公司
         NewPlanHistory.Airlines = null;
         //更新计划飞机
         UpdatePlanAircraft(NewPlanHistory.PlanAircraft);
         NewPlanHistory.PlanAircraft = null;
         //处理计划历史相关历史数据
         UpdatePlanHistoryRelativeHistory(NewPlanHistory);
         //处理计划明细
         PlanHistory OriginPlanHistory = this._FE.PlanHistories.Where(q => q.PlanHistoryID == NewPlanHistory.PlanHistoryID).FirstOrDefault();
         if (OriginPlanHistory != null)
         {
             //更新计划明细
             NewPlanHistory.Plan = null;
             this.Update<PlanHistory>(_FE, OriginPlanHistory, NewPlanHistory);
         }
         else
         {
             //增加计划明细
             NewPlanHistory.Plan = null;
             this._FE.PlanHistories.Add(NewPlanHistory);
         }
     }
 }
Example #2
0
 /// <summary>
 /// 更新计划
 /// </summary>
 /// <param name="NewPlanHistory"></param>
 private void UpdatePlan(PlanHistory NewPlanHistory)
 {
     if (NewPlanHistory.PlanID != null)
     {
         Plan OriginPlan = this._FE.Plans.Where(q => q.PlanID == NewPlanHistory.PlanID).FirstOrDefault();
         if (OriginPlan == null)
         {
             Plan NewPlan = new Plan();
             NewPlan.PlanID = NewPlanHistory.PlanID;
             NewPlan.AirlinesID = NewPlanHistory.AirlinesID;
             if (NewPlanHistory.Annual != null)
             {
                 NewPlan.AnnualID = NewPlanHistory.Annual.AnnualID;
             }
             else
             {
                 Annual annual = this._FE.Annuals.Where(p => p.Year == DateTime.Today.Year).FirstOrDefault();
                 NewPlan.AnnualID = annual.AnnualID;
             }
             //增加计划历史
             this._FE.Plans.Add(NewPlan);
         }
     }
 }
Example #3
0
        /// <summary>
        /// 创建当前新版本计划
        /// </summary>
        /// <param name="title"></param>
        /// <param name="service"></param>
        /// <returns></returns>
        internal Plan CreateNewVersionPlan(string title, IFleetService service)
        {
            // 获取当前计划
            var curPlan = service.CurrentPlan;
            // 从当前计划复制生成新版本计划
            var planNew = new Plan
                {
                    PlanID = Guid.NewGuid(),
                    Title = title,
                    CreateDate = DateTime.Now,
                    Annual = curPlan.Annual,
                    Airlines = curPlan.Airlines,
                    VersionNumber = curPlan.VersionNumber + 1,
                    Status = (int)PlanStatus.Draft,
                    PublishStatus = (int)PlanPublishStatus.Draft,
                };
            // 从当前计划往新版本计划复制运营计划
            curPlan.PlanHistories.OfType<OperationPlan>().Select(op => new OperationPlan
                {
                    Plan = planNew,
                    PlanHistoryID = Guid.NewGuid(),
                    PlanAircraft = op.PlanAircraft,
                    Airlines = op.Airlines,
                    AircraftType = op.AircraftType,
                    ApprovalHistory = op.ApprovalHistory,
                    IsSubmit = op.IsSubmit,
                    IsValid = op.IsValid,
                    ActionCategory = op.ActionCategory,
                    TargetCategory = op.TargetCategory,
                    Annual = op.Annual,
                    PerformMonth = op.PerformMonth,
                    SeatingCapacity = op.SeatingCapacity,
                    CarryingCapacity = op.CarryingCapacity,
                    OperationHistory = op.OperationHistory,
                }).ToList().ForEach(op => planNew.PlanHistories.Add(op));
            // 从当前计划往新版本计划复制变更计划
            curPlan.PlanHistories.OfType<ChangePlan>().Select(cp => new ChangePlan
                {
                    PlanID = planNew.PlanID,
                    PlanHistoryID = Guid.NewGuid(),
                    PlanAircraft = cp.PlanAircraft,
                    Airlines = cp.Airlines,
                    AircraftType = cp.AircraftType,
                    ApprovalHistory = cp.ApprovalHistory,
                    IsSubmit = cp.IsSubmit,
                    IsValid = cp.IsValid,
                    ActionCategory = cp.ActionCategory,
                    TargetCategory = cp.TargetCategory,
                    Annual = cp.Annual,
                    PerformMonth = cp.PerformMonth,
                    SeatingCapacity = cp.SeatingCapacity,
                    CarryingCapacity = cp.CarryingCapacity,
                    AircraftBusiness = cp.AircraftBusiness,
                }).ToList().ForEach(cp => planNew.PlanHistories.Add(cp));

            service.EntityContainer.GetEntitySet<Plan>().Add(planNew);
            service.SetCurrentPlan();
            return planNew;
        }
Example #4
0
        /// <summary>
        /// 创建变更计划明细
        /// 同一架计划飞机在一份计划中的明细项不得超过两条,且两条不得为同种操作类型(含运营计划与变更计划)
        /// </summary>
        /// <param name="plan"></param>
        /// <param name="planAircraft"></param>
        /// <param name="actionType"></param>
        /// <param name="service"></param>
        /// <returns></returns>
        internal ChangePlan CreateChangePlan(Plan plan, PlanAircraft planAircraft, string actionType, IFleetService service)
        {
            if (plan == null || planAircraft == null)
                return null;
            // 创建新的变更计划明细
            var planDetail = new ChangePlan
                {
                    Plan = plan,
                    ActionType = actionType,
                    PlanHistoryID = Guid.NewGuid(),
                    PlanAircraft = planAircraft,
                    AircraftType = planAircraft.AircraftType,
                    Annual = service.CurrentAnnual,
                    PerformMonth = 1,
                    Airlines = service.CurrentAirlines,
                };
            // 获取飞机的当前商业数据,赋予新创建的变更计划明细
            var abs = planAircraft.Aircraft.AircraftBusinesses;
            if (abs.Any())
            {
                var aircraftBusiness = abs.FirstOrDefault(a => a.EndDate == null);
                if (aircraftBusiness != null)
                {
                    planDetail.ActionCategory = aircraftBusiness.ImportCategory;
                    planDetail.TargetCategory = aircraftBusiness.ImportCategory;
                    planDetail.SeatingCapacity = aircraftBusiness.SeatingCapacity;
                    planDetail.CarryingCapacity = aircraftBusiness.CarryingCapacity;
                }
            }

            return planDetail;
        }
Example #5
0
        private void RefreshView()
        {
            this.CurrentPlan = this.service.CurrentPlan;
            RaisePropertyChanged(() => this.PlanTitle);
            this._needReFreshViewPlanHistory = true;
            this.RaiseViewPlanHistory();
            this._needReFreshViewPlanAircraft = true;
            this.RaiseViewPlanAircraft();

            this.RefreshButtonState();
        }
Example #6
0
 private void UpdateAirlinesForPlan(Plan NewPlan)
 {
     if (!this._FE.Owners.Any(p => p.OwnerID == NewPlan.AirlinesID))
     {
         //航空公司不存在
         if (NewPlan.Airlines != null)
         {
             NewPlan.Airlines.OperationHistories = null;
             NewPlan.Airlines.OwnershipHistorys = null;
             NewPlan.Airlines.Requests = null;
             NewPlan.Airlines.SubOperationHistories = null;
             NewPlan.Airlines.Plans = null;
             NewPlan.Airlines.SubAirlines = null;
             NewPlan.Airlines.MailAddresses = null;
             this._FE.Owners.Add(NewPlan.Airlines);
         }
     }
     //处理航空公司
     NewPlan.Airlines = null;
 }
 /// <summary>
 ///  获取计划完成情况
 /// </summary>
 /// <param name="currentPlan">当前计划</param>
 public void GetPlanPerforms(Plan currentPlan)
 {
     decimal planPerformCount = 0; //计划总完成的情况
     decimal planTotalCount = 0; //计划总项
     if (currentPlan.PlanHistories == null || currentPlan.PlanHistories.Count == 0)
     {
         Performance = 0;
     }
     else
     {
         planPerformCount += currentPlan.PlanHistories.OfType<OperationPlan>().Count(p => p.Annual.Year == System.DateTime.Now.Year && p.OperationHistory != null);
         planPerformCount += currentPlan.PlanHistories.OfType<ChangePlan>().Count(p => p.Annual.Year == System.DateTime.Now.Year && p.AircraftBusiness != null);
         planTotalCount = currentPlan.PlanHistories.Count(p => p.Annual.Year == System.DateTime.Now.Year);
         Performance = planTotalCount == 0 ? 0 : Math.Round(planPerformCount * 100 / planTotalCount, 2);
     }
 }
Example #8
0
 private void RefreshView()
 {
     this.CurrentPlan = this.service.CurrentPlan;
     this._needReFreshViewPlanHistory = true;
     RaiseViewPlanHistory();
     this._needReFreshViewRequest = true;
     RaiseViewRequest();
     if (this.SelRequest == null)
     {
         this.SelRequest = ViewRequest.LastOrDefault();
         this.RefreshButtonState();
     }
 }
Example #9
0
        //删除计划历史明细
        private void DeletePlanHistories(Plan NewPlan, Plan OriginPlan)
        {
            if (OriginPlan == null) return;
            //获取原申请明细
            ICollection<PlanHistory> OriginPlanHistories = this._FE.PlanHistories.Where(p => p.PlanID == OriginPlan.PlanID).ToList();
            //对原申请明细进行处理, 不在新申请明细中的需要删除
            for (int i = OriginPlanHistories.Count() - 1; i >= 0; i--)
            {
                var OriginPlanHistory = OriginPlanHistories.ElementAt(i);

                if (!NewPlan.PlanHistories.Any(p => p.PlanHistoryID == OriginPlanHistory.PlanHistoryID))
                {
                    //断开与该计划明细的关系 TODO
                    DeletePlanHistoryRelation(OriginPlanHistory);
                    //删除该申请明细
                    this._FE.PlanHistories.Remove(OriginPlanHistory);
                }
            }
        }
Example #10
0
 //更新计划明细
 private void UpdatePlanHistories(Plan NewPlan, Plan OriginPlan)
 {
     foreach (var NewPlanHistory in NewPlan.PlanHistories)
     {
         PlanHistory OriginPlanHistory = OriginPlan.PlanHistories.Where(q => q.PlanHistoryID == NewPlanHistory.PlanHistoryID).FirstOrDefault();
         if (OriginPlanHistory != null)
         {
             //更新计划飞机
             UpdatePlanAircraft(NewPlanHistory.PlanAircraft);
             //更新计划明细
             NewPlanHistory.ApprovalHistoryID = null;
             NewPlanHistory.ApprovalHistory = null;
             this._FE.Update<PlanHistory>(OriginPlanHistory, NewPlanHistory);
         }
         else
         {
             //更新计划飞机
             UpdatePlanAircraft(NewPlanHistory.PlanAircraft);
             //增加计划明细
             NewPlanHistory.PlanAircraft = null;
             NewPlanHistory.Plan = null;
             NewPlanHistory.ApprovalHistory = null;
             NewPlanHistory.ApprovalHistoryID = null;
             this._FE.PlanHistories.Add(NewPlanHistory);
         }
     }
 }
Example #11
0
        /// <summary>
        /// 设置计划是否为当前值
        /// </summary>
        /// <param name="planNew"></param>
        private void SetPlanIsCurrentVersion(Plan planNew)
        {
            // 获取需要修改的计划
            IEnumerable<Plan> allPlan = this._FE.Plans.Where(q => q.AnnualID == planNew.AnnualID && q.AirlinesID == planNew.AirlinesID && q.PlanID != planNew.PlanID);
            if (allPlan.Count() > 0)
            {
                //当前年度当前航空公司已存在
                if (allPlan.Any(p => p.ManageFlagCargo == true && p.ManageFlagPnr == true))
                {
                    //存在被民航局已通过的计划,则当前版本不更新为最新的版本
                    planNew.IsCurrentVersion = false;

                }
                else  //不存在民航局审阅的计划
                {
                    //遍及计划,使以前的版本都变成false,新的计划IsCurrentVersion为true
                    allPlan.ToList().ForEach
                        (
                        ap =>
                        {
                            ap.IsCurrentVersion = false;
                            this._FE.Update<Plan>(ap);
                        }
                        );

                }
            }
        }
Example #12
0
 /// <summary>
 ///计划执行情况
 /// </summary>
 /// <param name="currentPlan"></param>
 /// <param name="plans"></param>
 /// <returns></returns>
 private List<PlanHistory> GetPerformPlanHistory(Plan currentPlan)
 {
     //获取当年执行情况
     Func<PlanHistory, bool> funcPlanHisotry = p => p.Annual.Year == currentPlan.Annual.Year;
     return currentPlan.PlanHistories.ToList().Where(funcPlanHisotry).ToList(); ;
 }
Example #13
0
        /// <summary>
        ///  获取计划完成情况
        /// </summary>
        /// <param name="currentPlan">当前计划</param>
        public void GetPlanPerforms(Plan currentPlan)
        {
            decimal planPerformCount = 0; //计划总完成的情况
            decimal planTotalCount = 0; //计划总项
            if (currentPlan.PlanHistories == null || currentPlan.PlanHistories.Count == 0)
            {
                Performance = 0;
            }
            else
            {
                //运营计划的某年执行情况
                Func<OperationPlan, bool> exprOperationPlanImportAndExport = p =>
                    {
                        var performPlan = p as OperationPlan;
                        var isCurrentYearPerform = performPlan.OperationHistory != null &&
                                                   ((performPlan.OperationHistory.StartDate != null &&
                                                     performPlan.OperationHistory.StartDate.Value.Year ==
                                                     currentPlan.Annual.Year) ||
                                                    (performPlan.OperationHistory.EndDate != null &&
                                                     performPlan.OperationHistory.EndDate.Value.Year ==
                                                     currentPlan.Annual.Year));

                        return p.Annual.Year == currentPlan.Annual.Year && isCurrentYearPerform;
                    };
                //变更计划某年执行情况
                Func<ChangePlan, bool> exprChangePlanImportAndExport = p =>
                    {
                        var performPlan = p as ChangePlan;
                        var isCurrentYearPerform = performPlan.AircraftBusiness != null &&
                                                   ((performPlan.AircraftBusiness.StartDate != null &&
                                                     performPlan.AircraftBusiness.StartDate.Value.Year ==
                                                     currentPlan.Annual.Year) ||
                                                    (performPlan.AircraftBusiness.EndDate != null &&
                                                     performPlan.AircraftBusiness.EndDate.Value.Year ==
                                                     currentPlan.Annual.Year));

                        return p.Annual.Year == currentPlan.Annual.Year && isCurrentYearPerform;
                    };
                //运营计划执行统计
                planPerformCount += currentPlan.PlanHistories.OfType<OperationPlan>().Count(exprOperationPlanImportAndExport);
                //变更计划执行统计
                planPerformCount += currentPlan.PlanHistories.OfType<ChangePlan>().Count(exprChangePlanImportAndExport);
                //某年计划执行条数
                planTotalCount = GetPerformPlanHistory(currentPlan).Count;
                //统计执行百分比
                Performance = planTotalCount == 0 ? 0 : Math.Round(planPerformCount * 100 / planTotalCount, 2);
            }
        }
Example #14
0
 private void RefreshView()
 {
     this.CurrentPlan = this.service.CurrentPlan;
     RaisePropertyChanged(() => this.PlanTitle);
     var selHistory = this.SelPlanHistory;
     this._needReFreshViewAircraft = true;
     this.RaiseViewAircraft();
     this._needReFreshViewPlanHistory = true;
     this.RaiseViewPlanHistory();
     this.SelPlanHistory = selHistory ??
                           ViewPlanHistory.FirstOrDefault(ph => ph.PlanAircraft.Status != (int)ManageStatus.Operation);
     this.RefreshButtonState();
 }
Example #15
0
        /// <summary>
        /// 创建新年度计划
        /// </summary>
        /// <param name="title"></param>
        /// <param name="service"></param>
        /// <returns></returns>
        internal Plan CreateNewYearPlan(string title, IFleetService service)
        {
            // 打开新年度
            var newAnnual =
                service.EntityContainer.GetEntitySet<Annual>()
                       .FirstOrDefault(a => a.Year == service.CurrentAnnual.Year + 1);
            if (newAnnual == null)
            {
                RadWindow.Alert(new DialogParameters
                {
                    Header = "提醒",
                    OkButtonContent = "确认",
                    Content = new TextBlock
                        {
                            Text = "新年度不能为空!",
                            FontFamily = new FontFamily("Microsoft YaHei UI"),
                            FontSize = 13,
                            TextWrapping = TextWrapping.Wrap,
                            Width = 250,
                        },
                });
                return null;
            }
            service.CurrentAnnual.IsOpen = false;
            newAnnual.IsOpen = true;
            service.SetCurrentAnnual();
            // 获取当前计划
            var curPlan = service.CurrentPlan;
            // 从当前计划复制生成新年度计划
            var planNew = new Plan
                {
                    PlanID = Guid.NewGuid(),
                    Title = title,
                    CreateDate = DateTime.Now,
                    Annual = newAnnual,
                    Airlines = curPlan.Airlines,
                    VersionNumber = 1,
                    Status = (int)PlanStatus.Draft,
                    PublishStatus = (int)PlanPublishStatus.Draft,
                };
            //获取需要滚动到下一年度的计划明细项
            var planHistories = (curPlan == null || curPlan.PlanHistories == null) ? null
                                        : curPlan.PlanHistories.Where(o => o.PlanAircraft == null ||
                                           (o.PlanAircraft != null && (o.PlanAircraft.Status != (int)ManageStatus.Prepare
                                                                       && o.PlanAircraft.Status != (int)ManageStatus.Operation
                                                                       && o.PlanAircraft.Status != (int)ManageStatus.Retired)));

            // 从当前计划往新版本计划复制运营计划
            var operationPlans = planHistories.OfType<OperationPlan>()
                                        .Where(op => op.OperationHistory == null || op.OperationHistory.EndDate == null)
                                        .Select(op => new OperationPlan
                                            {
                                                Plan = planNew,
                                                PlanHistoryID = Guid.NewGuid(),
                                                PlanAircraft = op.PlanAircraft,
                                                Airlines = op.Airlines,
                                                AircraftType = op.AircraftType,
                                                ApprovalHistory = op.ApprovalHistory,
                                                IsSubmit = op.IsSubmit,
                                                IsValid = op.IsValid,
                                                ActionCategory = op.ActionCategory,
                                                TargetCategory = op.TargetCategory,
                                                Annual = op.Annual,
                                                PerformMonth = op.PerformMonth,
                                                SeatingCapacity = op.SeatingCapacity,
                                                CarryingCapacity = op.CarryingCapacity,
                                                OperationHistory = op.OperationHistory,
                                            }).ToList();
            operationPlans.ForEach(op => planNew.PlanHistories.Add(op));
            // 从当前计划往新版本计划复制变更计划
            var changePlans = planHistories.OfType<ChangePlan>()
                                     .Where(cp => cp.AircraftBusiness == null || cp.AircraftBusiness.EndDate == null)
                                     .Select(cp => new ChangePlan
                                         {
                                             PlanID = planNew.PlanID,
                                             PlanHistoryID = Guid.NewGuid(),
                                             PlanAircraft = cp.PlanAircraft,
                                             Airlines = cp.Airlines,
                                             AircraftType = cp.AircraftType,
                                             ApprovalHistory = cp.ApprovalHistory,
                                             IsSubmit = cp.IsSubmit,
                                             IsValid = cp.IsValid,
                                             ActionCategory = cp.ActionCategory,
                                             TargetCategory = cp.TargetCategory,
                                             Annual = cp.Annual,
                                             PerformMonth = cp.PerformMonth,
                                             SeatingCapacity = cp.SeatingCapacity,
                                             CarryingCapacity = cp.CarryingCapacity,
                                             AircraftBusiness = cp.AircraftBusiness,
                                         }).ToList();
            changePlans.ForEach(cp => planNew.PlanHistories.Add(cp));
            service.EntityContainer.GetEntitySet<Plan>().Add(planNew);
            service.SetCurrentPlan();
            return planNew;
        }
Example #16
0
        /// <summary>
        /// 创建运营计划明细
        /// 同一架计划飞机在一份计划中的明细项不得超过两条,且两条不得为同种操作类型(含运营计划与变更计划)
        /// </summary>
        /// <param name="plan"></param>
        /// <param name="planAircraft"></param>
        /// <param name="actionType"></param>
        /// <param name="service"></param>
        /// <returns></returns>
        internal OperationPlan CreateOperationPlan(Plan plan, PlanAircraft planAircraft, string actionType, IFleetService service)
        {
            if (plan == null) return null;
            // 创建新的计划历史
            var planDetail = new OperationPlan
                {
                    PlanHistoryID = Guid.NewGuid(),
                    Plan = plan,
                    ActionType = actionType,
                    Airlines = service.CurrentAirlines,
                    Annual = service.CurrentAnnual,
                    PerformMonth = 1,
                };
            // 1、计划飞机为空
            if (planAircraft == null)
            {
                // 创建新的计划飞机
                var pa = new PlanAircraft
                    {
                        PlanAircraftID = Guid.NewGuid(),
                        Airlines = service.CurrentAirlines,
                        Status = (int)ManageStatus.Plan,
                        IsOwn = true
                    };
                planDetail.PlanAircraft = pa;
            }
            // 2、计划飞机非空
            else
            {
                // 获取计划飞机的所有计划明细集合
                var phs = planAircraft.PlanHistories;
                // 获取计划飞机在当前计划中的计划明细集合
                var planDetails = phs.Where(ph => ph.Plan == plan).ToList();
                // 2.1、不是针对现有飞机的计划明细
                if (planAircraft.Aircraft == null)
                {
                    if (phs.Any())
                    {
                        // 获取计划飞机的最后一条计划明细,用于复制数据
                        var planHistory =
                            phs.OrderBy(ph => ph.Annual.Year)
                               .ThenBy(ph => ph.Plan.VersionNumber)
                               .LastOrDefault();
                        if (planHistory != null)
                        {
                            // 1、计划飞机在当前计划中没有明细项
                            if (!planDetails.Any())
                            {
                                planDetail.AircraftType = planAircraft.AircraftType;
                                planDetail.ActionCategory = planHistory.ActionCategory;
                                planDetail.TargetCategory = planHistory.TargetCategory;
                                planDetail.SeatingCapacity = planHistory.SeatingCapacity;
                                planDetail.CarryingCapacity = planHistory.CarryingCapacity;
                                planAircraft.Status = (int)ManageStatus.Plan;
                            }
                            // 2、计划飞机在当前计划中已有明细项
                            else
                            {
                                planDetail.AircraftType = planAircraft.AircraftType;
                                planDetail.SeatingCapacity = -planHistory.SeatingCapacity;
                                planDetail.CarryingCapacity = -planHistory.CarryingCapacity;
                            }
                        }
                    }
                }
                // 2.2、是针对现有飞机的计划明细,肯定是退出计划,无需改变计划飞机管理状态
                else
                {
                    planDetail.AircraftType = planAircraft.AircraftType;
                    planDetail.SeatingCapacity = planAircraft.Aircraft.SeatingCapacity;
                    planDetail.CarryingCapacity = planAircraft.Aircraft.CarryingCapacity;
                }
                planDetail.PlanAircraft = planAircraft;
            }

            return planDetail;
        }
Example #17
0
 /// <summary>
 /// 设置计划是否为当前值
 /// </summary>
 /// <param name="planNew"></param>
 private void SetPlanIsCurrentVersion(Plan planNew)
 {
     // 获取需要修改的计划
     IEnumerable<Plan> allPlan = this._FE.Plans.Where(q => q.AnnualID == planNew.AnnualID && q.AirlinesID == planNew.AirlinesID && q.PlanID != planNew.PlanID);
     if (allPlan.Count() > 0)
     {
         //当前年度当前航空公司已存在计划
         if (allPlan.Any(p => p.VersionNumber > planNew.VersionNumber))
         {
             //当前解析的计划版本如果不是最新的,这个计划的IsCurrentVersion为false
             planNew.IsCurrentVersion = false;
         }
         else  //新发送的计划版本为当前年度最新的
         {
             //遍历计划,使以前的版本都变成false,新的计划IsCurrentVersion为true
             allPlan.ToList().ForEach
                 (
                 ap =>
                 {
                     ap.IsCurrentVersion = false;
                     this.Update<Plan>(_FE, ap);
                 }
                 );
         }
     }
 }
Example #18
0
 private void SyncOperationHistroy(Plan NewPlan)
 {
     if (NewPlan == null) return;
     foreach (PlanHistory NewPlanHistory in NewPlan.PlanHistories)
     {
         try
         {
             OperationHistorySync.SyncOperationHistroy(_FE, NewPlanHistory.PlanHistoryID);
         }
         catch
         {
         }
     }
 }
 /// <summary>
 /// 获取指定计划的完成情况
 /// </summary>
 public void GetPlanPerforms(Plan currentPlan)
 {
     decimal Finish = 0; //年度的完成计划历史数
     decimal Amount = 0; //年度的所有计划历史数
     if (currentPlan == null || currentPlan.PlanHistories == null || currentPlan.PlanHistories.Count == 0)
     {
         Performance = 0;
     }
     else
     {
         var PlanHistories = currentPlan.PlanHistories.Where(p => p.Annual.Year == currentPlan.Annual.Year);
         if (PlanHistories != null && PlanHistories.Count() > 0)
         {
             //统计计划第一年的所有计划历史
             Amount = PlanHistories.Count();
             Finish = PlanHistories.OfType<OperationPlan>().Count(p => p.OperationHistory != null) +
                 PlanHistories.OfType<ChangePlan>().Count(p => p.AircraftBusiness != null);
             Performance = Math.Round(Finish * 100 / Amount, 2);
         }
     }
 }