public async void SaveImprovementItem() { try { if (PlanStatus == "B" || PlanStatus == "D" || (allocateYN.ToUpper() == "FALSE" && planApproalYN.ToUpper() == "TRUE" && PlanStatus == "F")) { //改善计划内容 if (string.IsNullOrWhiteSpace(ImpPlanContent)) { _commonFun.AlertLongText("请输入改善计划内容"); return; } } else if ((PlanStatus == "C" || PlanStatus == "F") && allocateYN.ToUpper() == "TRUE")//Modify by dong.limin 2017-2-23 13:36:29 { if (ServerApplyYN.ToString() != impServerApplyYNStr) { _commonFun.AlertLongText("请选择审核类型"); return; } if (string.IsNullOrWhiteSpace(ServerApplyMemo)) { _commonFun.AlertLongText("请输入审核意见内容"); return; } } else if (PlanStatus == "E" && planApproalYN.ToUpper() == "TRUE")//Modify by dong.limin 2017-2-23 13:36:29 { if (AreaApplyYN.ToString() != impAreaApplyYNStr) { _commonFun.AlertLongText("请选择审核类型"); return; } if (string.IsNullOrWhiteSpace(AreaApplyMemo)) { _commonFun.AlertLongText("请输入审核意见内容"); return; } } if (_commonHelper.IsNetWorkConnected() == true) { try { _commonFun.ShowLoading("提交中..."); string saveStatus = ""; if (allocateYN.ToUpper() == "TRUE") { if (impServerApplyYNStr == "1") { if (PlanStatus == "D") { saveStatus = "C"; planContent = ImpPlanContent; } else { saveStatus = "D"; planContent = ServerApplyMemo; } } else if (impAreaApplyYNStr == "1") { if (PlanStatus == "F") { saveStatus = "E"; planContent = ServerApplyMemo; } else { saveStatus = "F"; planContent = AreaApplyMemo; } } else if (impAreaApplyYNStr == "0") { saveStatus = "G"; planContent = AreaApplyMemo; } else if (impServerApplyYNStr == "0") { saveStatus = "E"; planContent = ServerApplyMemo; } else { saveStatus = "C"; planContent = ImpPlanContent; } } else { if (impAreaApplyYNStr == "1") { if (PlanStatus == "F") { saveStatus = "E"; planContent = ImpPlanContent; } else { saveStatus = "F"; planContent = AreaApplyMemo; } } else if (impAreaApplyYNStr == "0") { saveStatus = "G"; planContent = AreaApplyMemo; } else { if (planApproalYN.ToUpper() == "TRUE") { saveStatus = "E"; } else { saveStatus = "G"; } planContent = ImpPlanContent; } } var result = await _improveService.SaveImprovementItem(planContent, ImpPlanCompleteDate.ToString("yyyyMMdd HH:mm:ss"), improvementId, CommonContext.Account.UserId, ImpPlanAttachList, saveStatus); if (result.ResultCode == Module.ResultType.Success) { //_commonFun.HideLoading(); //_commonFun.AlertLongText("提交完毕。 "); //Device.BeginInvokeOnMainThread(async () => { await Navigation.PopAsync(); //}); //MessagingCenter.Send<ImpPlanCommitPage>(new ImpPlanCommitPage(), "PlanCommitPopBack"); MessagingCenter.Send <string>("A", MessageConst.IMPROVE_PLANLSTDATA_GET); MessagingCenter.Send <String>("", MessageConst.IMPROVE_IMPPLANORRESULTDATA_GET); MessagingCenter.Send <string>("", "MessagePageReSearch");// 给消息页发消息 } else { _commonFun.HideLoading(); _commonFun.AlertLongText("提交失败,请重试。 " + result.Msg); return; } } catch (OperationCanceledException) { _commonFun.HideLoading(); _commonFun.AlertLongText("请求超时。"); return; } catch (Exception) { _commonFun.HideLoading(); return; } finally { _commonFun.HideLoading(); } } else { _commonFun.AlertLongText("网络连接异常。"); return; } } catch (Exception) { _commonFun.AlertLongText("操作异常,请重试。-->ImpPlanCommitViewModel"); return; } }
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; } }