コード例 #1
0
        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;
            }
        }
コード例 #2
0
        public async void SaveImprovementResult()
        {
            try
            {
                if (ResultStatus == "A" || ResultStatus == "D" || (allocateYN.ToUpper() == "FALSE" && resultApproalYN.ToUpper() == "TRUE" && ResultStatus == "F"))
                {
                    //改善结果内容
                    if (string.IsNullOrWhiteSpace(ImpResultContent))
                    {
                        _commonFun.AlertLongText("请输入改善结果内容");
                        return;
                    }
                }
                else if ((ResultStatus == "C" || ResultStatus == "F") && allocateYN.ToUpper() == "TRUE")
                {
                    if (ServerApplyYN.ToString() != impServerApplyYNStr)
                    {
                        _commonFun.AlertLongText("请选择审核类型");
                        return;
                    }
                    if (string.IsNullOrWhiteSpace(ServerApplyMemo))
                    {
                        _commonFun.AlertLongText("请输入审核意见内容");
                        return;
                    }
                }
                else if (ResultStatus == "E" && resultApproalYN.ToUpper() == "TRUE")
                {
                    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 (ResultStatus == "D")
                                {
                                    saveStatus    = "C";
                                    resultContent = ImpResultContent;
                                }
                                else
                                {
                                    saveStatus    = "D";
                                    resultContent = ServerApplyMemo;
                                }
                            }
                            else if (impAreaApplyYNStr == "1")
                            {
                                if (ResultStatus == "F")
                                {
                                    saveStatus    = "E";
                                    resultContent = ServerApplyMemo;
                                }
                                else
                                {
                                    saveStatus    = "F";
                                    resultContent = AreaApplyMemo;
                                }
                            }
                            else if (impAreaApplyYNStr == "0")
                            {
                                saveStatus    = "G";
                                resultContent = AreaApplyMemo;
                            }
                            else if (impServerApplyYNStr == "0")
                            {
                                saveStatus    = "E";
                                resultContent = ServerApplyMemo;
                            }
                            else
                            {
                                saveStatus    = "C";
                                resultContent = ImpResultContent;
                            }
                        }
                        else
                        {
                            if (impAreaApplyYNStr == "1")
                            {
                                if (ResultStatus == "F")
                                {
                                    saveStatus    = "E";
                                    resultContent = ImpResultContent;
                                }
                                else
                                {
                                    saveStatus    = "F";
                                    resultContent = AreaApplyMemo;
                                }
                            }
                            else if (impAreaApplyYNStr == "0")
                            {
                                saveStatus    = "G";
                                resultContent = AreaApplyMemo;
                            }
                            else
                            {
                                if (resultApproalYN.ToUpper() == "TRUE")
                                {
                                    saveStatus = "E";
                                }
                                else
                                {
                                    saveStatus = "G";
                                }
                                resultContent = ImpResultContent;
                            }
                        }

                        var result = await _improveService.SaveImprovementResult(improvementId, impResultId, saveStatus, resultContent, ImpResultAttachList);

                        if (result.ResultCode == Module.ResultType.Success)
                        {
                            //_commonFun.HideLoading();
                            //_commonFun.AlertLongText("提交完毕。 ");
                            MessagingCenter.Send <string>("R", MessageConst.IMPROVE_PLANLSTDATA_GET);
                            MessagingCenter.Send <String>("", MessageConst.IMPROVE_IMPPLANORRESULTDATA_GET);
                            MessagingCenter.Send <string>("", "MessagePageReSearch");// 给消息页发消息
                            await Navigation.PopAsync();

                            //MessagingCenter.Send(this, "PlanCommitPopBack");
                        }
                        else
                        {
                            _commonFun.HideLoading();
                            _commonFun.AlertLongText("提交失败,请重试。 " + result.Msg);
                            return;
                        }
                    }
                    catch (OperationCanceledException)
                    {
                        _commonFun.HideLoading();
                        _commonFun.AlertLongText("请求超时。");
                    }
                    catch (Exception)
                    {
                        _commonFun.HideLoading();
                        return;
                    }
                    finally
                    {
                        _commonFun.HideLoading();
                    }
                }
                else
                {
                    _commonFun.AlertLongText("网络连接异常。");
                    return;
                }
            }
            catch (Exception)
            {
                _commonFun.AlertLongText("操作异常,请重试。-->ImpResultCommitViewModel");
                return;
            }
        }