コード例 #1
0
        private void OnViewSinglePlanCommand()
        {
            IsBusy = true;

            if (null == SelectProjectEntity.PlanVersionID
                || null == SelectProjectEntity.ManufactureNumber
                || string.Empty == SelectProjectEntity.PlanVersionID
                || string.Empty == SelectProjectEntity.ManufactureNumber)
            {
                Message.ErrorMessage("生产令号或版本号无效");
            }
            else
            {
                ObservableCollection<PlanEntity> planList = new ObservableCollection<PlanEntity>();
                if (GetPorjectPlanList(SelectProjectEntity, ref planList))
                {
                    if (planList.Count > 0)
                    {
                        string title = SelectProjectEntity.ProjectName + " " + SelectProjectEntity.ManufactureNumber.TrimEnd() + " " + SelectProjectEntity.PlanVersionID;
                        PlanListViewModel planListViewModel = new PlanListViewModel(title, planList, 0, departmentIdNameDictionary);
                        planListViewModel.IsReadOnly = true;
                        PlanExtraEntity planExtraEntity = null;
                        IEnumerable<plan_extra> plan_extras = from c in planManagerDomainContext.plan_extras
                                                              where c.version_id == SelectProjectEntity.PlanVersionID
                                                              && c.manufacture_number == SelectProjectEntity.ManufactureNumber.TrimEnd()
                                                              select c;
                        if (0 != plan_extras.Count())
                        {
                            planExtraEntity = new PlanExtraEntity();
                            planExtraEntity.PlanExtra = plan_extras.First<plan_extra>();
                            planExtraEntity.Update();
                            planExtraEntity.PlanExtra = null;
                        }

                        PlanListStatisticsWindow planListStatisticsWindow = new PlanListStatisticsWindow("查询计划", planListViewModel, planExtraEntity);
                        planListStatisticsWindow.Show();
                    }
                }
                else
                {
                    string errorMessage = "无相关数据(生产令号:" +
                                            SelectProjectEntity.ManufactureNumber.TrimEnd() +
                                            ",版本号" +
                                            SelectProjectEntity.PlanVersionID
                                            + ")";
                    Message.ErrorMessage(errorMessage);
                }
            }

            IsBusy = false;
        }
コード例 #2
0
        private void OnViewAllPlanCommand()
        {
            IsBusy = true;

            ObservableCollection<PlanEntity> planList = new ObservableCollection<PlanEntity>();
            foreach (ProjectEntity item in ProjectList)
            {
                if (null == item.PlanVersionID
                || null == item.ManufactureNumber
                || string.Empty == item.PlanVersionID
                || string.Empty == item.ManufactureNumber)
                {
                    continue;
                }

                GetPorjectPlanList(item, ref planList);
            }

            if (planList.Count > 0)
            {
                PlanListViewModel planListViewModel = new PlanListViewModel("所有项目计划", planList, 0, departmentIdNameDictionary);
                planListViewModel.IsReadOnly = true;
                PlanExtraEntity planExtraEntity = null;

                PlanListStatisticsWindow planListStatisticsWindow = new PlanListStatisticsWindow("查询计划", planListViewModel, planExtraEntity);
                planListStatisticsWindow.Show();
            }

            IsBusy = false;
        }