private async void GetImpPlanOrResultDetail(List <RequestParameter> param)
        {
            try
            {
                if (param != null)
                {
                    foreach (var item in param)
                    {
                        if (item.Name.ToUpper() == "IMPROVEMENTID")
                        {
                            improvementId = item.Value;
                        }
                        if (item.Name.ToUpper() == "IMPRESULTID")
                        {
                            impResultId = item.Value;
                        }
                        if (item.Name.ToUpper() == "TPID")
                        {
                            tPId = item.Value;
                        }
                        if (item.Name.ToUpper() == "ITEMID")
                        {
                            itemId = item.Value;
                        }
                        if (item.Name.ToUpper() == "PLANAPPROALYN")
                        {
                            planApproalYN = item.Value;
                        }
                        if (item.Name.ToUpper() == "PLANSTATUS")
                        {
                            planStatus = item.Value;
                        }
                        if (item.Name.ToUpper() == "ALLOCATEYN")
                        {
                            allocateYN = item.Value;
                        }
                    }
                    MessagingCenter.Send <string>(planStatus + "§" + planApproalYN + "§" + allocateYN, MessageConst.IMPROVE_PLANCOMMIT_SETCONTROLROLE);
                    if ((allocateYN.ToUpper() == "FALSE" && CommonContext.Account.UserType == "S") || CommonContext.Account.UserType == "D")
                    {
                        ImpPlanCommitPageTitle = "改善计划提交";
                    }
                    else
                    {
                        ImpPlanCommitPageTitle = "改善计划审批";
                    }
                    if (_commonHelper.IsNetWorkConnected() == true)
                    {
                        try
                        {
                            _commonFun.ShowLoading("查询中...");
                            var result = await _improveService.GetImpPlanOrResultDetail(improvementId, "A", impResultId, tPId, itemId);// ("14", "A", "3", "21", "7");

                            if (result.ResultCode == Module.ResultType.Success)
                            {
                                _commonFun.HideLoading();
                                var impPlanDetailData = CommonHelper.DecodeString <ImpPlanDetailDto>(result.Body);
                                if (impPlanDetailData == null)
                                {
                                    _commonFun.AlertLongText("查询失败,请重试。");
                                    return;
                                }

                                ImpPlanContent = impPlanDetailData.ImprovementPlan;
                                if (!string.IsNullOrWhiteSpace(impPlanDetailData.ExpectedTime))
                                {
                                    ImpPlanCompleteDate    = DateTime.Parse(impPlanDetailData.ExpectedTime);
                                    ImpPlanCompleteDateStr = ImpPlanCompleteDate.ToString("yyyy-MM-dd");
                                }
                                else
                                {
                                    ImpPlanCompleteDateStr = "";
                                }
                                if (CommonContext.Account.UserType == "S")
                                {
                                    if (impPlanDetailData.SPlanStatus == "D" || impPlanDetailData.SPlanStatus == "E")
                                    {
                                        ServerApplyYN = impPlanDetailData.SPlanStatus == "D" ? 1 : 0;
                                    }
                                }
                                ServerApplyYNName = impPlanDetailData.SPlanStatusName;
                                ServerApplyMemo   = impPlanDetailData.DisApprovalPlan;
                                if (CommonContext.Account.UserType == "Z")
                                {
                                    if (impPlanDetailData.RPlanStatus == "G" || impPlanDetailData.RPlanStatus == "F")
                                    {
                                        AreaApplyYN = impPlanDetailData.RPlanStatus == "G" ? 0 : 1;
                                    }
                                }
                                AreaApplyYNName      = impPlanDetailData.RPlanStatusName;
                                AreaApplyMemo        = impPlanDetailData.RegionApprovalPlan;
                                ImpPlanAttachList    = impPlanDetailData.AttachList;
                                PlanStatus           = impPlanDetailData.PlanStatus;
                                FeedbackTime         = impPlanDetailData.FeedbackTime;
                                FeedbackRegionTime   = impPlanDetailData.FeedbackRegionTime;
                                oldImpPlanAttachList = new List <AttachDto>();
                                oldImpPlanAttachList.AddRange(ImpPlanAttachList);
                                LstHeight = ImpPlanAttachList.Count * _lstRowHeight;
                            }
                            else
                            {
                                _commonFun.HideLoading();
                                _commonFun.AlertLongText("查询失败,请重试。 " + result.Msg);
                                return;
                            }
                        }
                        catch (OperationCanceledException)
                        {
                            _commonFun.HideLoading();
                            _commonFun.AlertLongText("请求超时。");
                            return;
                        }
                        catch (Exception)
                        {
                            _commonFun.HideLoading();
                            _commonFun.AlertLongText("查询异常,请重试。");
                            return;
                        }
                        finally
                        {
                            _commonFun.HideLoading();
                        }
                    }
                    else
                    {
                        _commonFun.AlertLongText("网络连接异常。");
                        return;
                    }
                }
                else
                {
                    _commonFun.AlertLongText("查询失败,请重试。");
                    return;
                }
            }
            catch (Exception)
            {
                _commonFun.AlertLongText("操作异常,请重试。-->ImpPlanCommitViewModel");
                return;
            }
        }
Exemplo n.º 2
0
        private async void GetImproveDistributionDetail(ImprovementMngDto improvementMng)
        {
            try
            {
                string improvementId = improvementMng.ImprovementId.ToString();
                string impResultId   = improvementMng.ImpResultId.ToString();
                string tPId          = improvementMng.TPId.ToString();
                string itemId        = improvementMng.ItemId.ToString();
                if (_commonHelper.IsNetWorkConnected() == true)
                {
                    try
                    {
                        _commonFun.ShowLoading("查询中...");
                        var result = await improveService.GetImpPlanOrResultDetail(improvementId, "0", impResultId, tPId, itemId);

                        if (result.ResultCode == Module.ResultType.Success)
                        {
                            _commonFun.HideLoading();
                            var impAllocateData = CommonHelper.DecodeString <ImpAllocateDto>(result.Body);
                            if (impAllocateData != null)
                            {
                                if (CommonContext.Account.UserType == "S")
                                {
                                    if (impAllocateData.PlanStatus == "A")
                                    {
                                        IsEdit = true;
                                        IsShow = false;
                                    }
                                    else
                                    {
                                        IsEdit = false;
                                        IsShow = true;
                                    }
                                }
                                else
                                {
                                    IsEdit = false;
                                    IsShow = true;
                                }
                                ExecDepartmentName = impAllocateData.ExecDepartmentName;
                                AllocateYN         = impAllocateData.AllocateYN;
                                PlanApproal        = impAllocateData.PlanApproalYN == true ? "评估师" : "总经理";
                                ResultApproal      = impAllocateData.ResultApproalYN == true ? "评估师" : "总经理";
                                StandardList       = impAllocateData.StandardList;
                                PicList            = impAllocateData.PicList;
                                LossImageList      = impAllocateData.PicList.Count * 40;
                                PicDescList        = impAllocateData.PicDescList;
                                if (PicDescList != null)
                                {
                                    foreach (var item in PicDescList)
                                    {
                                        item.IsPreview = string.IsNullOrEmpty(item.Url) ? false : true;
                                    }
                                }
                                ImprovementCaption = impAllocateData.ImprovementCaption;
                                LostDescription    = impAllocateData.LostDescription;
                                Score             = impAllocateData.Score.ToString();
                                PlanFinishDate    = impAllocateData.PlanFinishDate;
                                ResultFinishDate  = impAllocateData.ResultFinishDate;
                                PicDescLstHeight  = 40 * PicDescList.Count + 45;
                                StandardLstHeight = 40 * StandardList.Count + 45;
                            }
                            else
                            {
                                _commonFun.HideLoading();
                                _commonFun.ShowToast("查无数据");
                            }
                        }
                        else
                        {
                            _commonFun.HideLoading();
                            _commonFun.AlertLongText("查询失败,请重试。 " + result.Msg);
                        }
                    }
                    catch (OperationCanceledException)
                    {
                        _commonFun.HideLoading();
                        _commonFun.AlertLongText("请求超时。");
                    }
                    catch (Exception)
                    {
                        _commonFun.HideLoading();
                        _commonFun.AlertLongText("查询异常,请重试。");
                    }
                    finally
                    {
                        _commonFun.HideLoading();
                    }
                }
                else
                {
                    _commonFun.AlertLongText("网络连接异常");
                }
            }
            catch (Exception)
            {
                _commonFun.AlertLongText("操作异常,请重试。-->ImproveDistributionViewModel");
                return;
            }
        }