/// <summary> /// 提交完成 /// 并进入结果显示 /// </summary> private void GoToResultView() { CompleteExamModel model = new CompleteExamModel() { exam_attend_id = (string.IsNullOrEmpty(GlobalUser.AttendPaperItemId) || GlobalUser.SelectExamAttend.exam_attend_id < 1) ? GlobalUser.AttendPaperItemId : GlobalUser.SelectExamAttend.exam_attend_id.ToString(), }; ApiType api = ApiType.CompleteExam; if (GlobalUser.MenuType == MenuType.Task) { api = ApiType.CompleteUserTask; } //完成练习 作业 训练 var result = WebApiProxy.GetHtmlRespInfo(model, api, GlobalUser.USER.Token); if (result.retCode == 0) { _dispatcherTimer.Stop(); //移除 ErrScore结果数据 GlobalUser.CheckErrorScoreSource(User.Mobile, GlobalUser.SelectPaperNumber.Split(new[] { "#" }, StringSplitOptions.RemoveEmptyEntries)[0], GlobalUser.AttendPaperItemId, true); this.Cleanup(); GlobalUser.DoneItemExam = true; BindExamResultUC(); } else { _dispatcherTimer.Stop(); //操作失败 //todo ResubmitAnswerDialog dialog = new ResubmitAnswerDialog(); DialogHost.Show(dialog, "ExamMainDialog"); //ResubmitDialogClosingEventHandler ErrMsgLog msgInfo = new ErrMsgLog(); msgInfo.user = GlobalUser.USER.Mobile; msgInfo.msginfo = "作答正常完成,提交 Complete 失败"; msgInfo.error = result.retHtml; msgInfo.isErr = true; Log4NetHelper.Error(msgInfo .ToJson()); //$"[user:{GlobalUser.USER?.Mobile},msg:作答正常完成,未正常返回统计消息,data:{result.retHtml}]"); { Log_Data log = new Log_Data(); log.log_desc = Log_Type.PC_Complete_Error.ToString(); log.log_text = msgInfo.ToJson(); //$"[user:{GlobalUser.USER?.Mobile},msg:作答正常完成,未正常返回统计消息,data:{result.retHtml}]";// $"{GlobalUser.USER?.Mobile}-作答正常完成,未正常返回统计消息---{result.retMsg}"; log.log_device = JsonHelper.ToJson(GlobalUser.MACHINEINFO.GetDevice()); WebApiProxy.GetHtmlRespInfo(log, ApiType.SysLog, null, "Post"); } } }
private void DispatcherTimer_Tick(object sender, EventArgs e) { if (GlobalUser.DoneScore == ScoreType.ScoreSuccess) { if (GetCompleteResult()) { //记录完整 展示 评分和答题窗口 _dispatcherTimer.Stop(); CompleteExamModel model = new CompleteExamModel() { exam_attend_id = (GlobalUser.SelectExamAttend == null || GlobalUser.SelectExamAttend.exam_attend_id < 1) ? GlobalUser.AttendPaperItemId : GlobalUser.SelectExamAttend.exam_attend_id.ToString(), }; //完成练习 var result = WebApiProxy.GetHtmlRespInfo(model, ApiType.CompleteExam, GlobalUser.USER.Token); if (result.retCode == 0) { _dispatcherTimer.Stop(); BindExamResultUC(); } else { _dispatcherTimer.Stop(); //操作失败 //todo ResubmitAnswerDialog dialog = new ResubmitAnswerDialog(); DialogHost.Show(dialog, "ExamMainDialog");//ResubmitDialogClosingEventHandler Log4NetHelper.Error("评分正常完成,未正常返回统计消息---" + result.retMsg); } } else { if (_reCheckResult < 1) { //记录完整 展示 评分和答题窗口 _dispatcherTimer.Stop(); //操作失败 //todo ResubmitAnswerDialog dialog = new ResubmitAnswerDialog(); DialogHost.Show(dialog, "ExamMainDialog");//ResubmitDialogClosingEventHandler Log4NetHelper.Error("评分异常,未正常返回结果消息"); } _reCheckResult--; } } if (_timeOut <= 0) { _dispatcherTimer.Stop(); // 评分失败 if (GlobalUser.DoneScore != ScoreType.ScoreSuccess) { //超时后处理操作 //todo ResubmitAnswerDialog dialog = new ResubmitAnswerDialog(); DialogHost.Show(dialog, "ExamMainDialog");//ResubmitDialogClosingEventHandler } } _timeOut = _timeOut - _dispatcherTimer.Interval.Seconds; }
private void DispatcherTimer_Tick(object sender, EventArgs e) { if (GlobalUser.MainWin == null) { _dispatcherTimer.Stop(); return; } _timeOut = _timeOut - _dispatcherTimer.Interval.Seconds; var allCount = GlobalUser.SelectPaperInfo.paper_detail.Sum(s => s.info.Sum(s1 => s1.items.Where(w => w.answers.Count > 0).Count())); var overCount = GlobalUser.ErrScoreInfo?.Count > 0 ? GlobalUser.ErrScoreInfo.Count : 1; ProgressValue = Convert.ToInt32(100 * (allCount - overCount) / allCount); TxtProgressValue = $"打分中{ProgressValue}%..."; //检查是否有评分(上传结果)异常,每个异常评分 执行超过3(SubmitNum-1)次 if (_timeOut > 0 && GlobalUser.ErrScoreInfo?.Keys.Count > 0 && GlobalUser.DoneScore != ScoreType.Scoring) { foreach (var key in GlobalUser.ErrScoreInfo.Keys) { //var key = GlobalUser.ErrScoreInfo?.Keys.FirstOrDefault(); if (GlobalUser.ErrScoreInfo[key].SubmitNum < 999) { Messenger.Default.Send(GlobalUser.ErrScoreInfo[key], "ExamScoreNavi"); return; } } } //保存 更新 ErrScore结果数据 GlobalUser.UpdateErrScore(User.Mobile, GlobalUser.SelectPaperNumber, GlobalUser.AttendPaperItemId); if (GlobalUser.ErrScoreInfo?.Count > 0 && GlobalUser.DoneScore != ScoreType.Scoring && _timeOut <= 0) { _dispatcherTimer.Stop(); //重评失败 无法操作 //判断有无 SubmitNum==999 无法重评 重新作答 if (GlobalUser.ErrScoreInfo.Values.Any(w => w.SubmitNum == 999)) { //显示重新 作答窗口 var view1 = new ScoreServiceErrDialog(); //view1.DataContext = new ScoreServiceErrDialogVM(); //打开 对话框 //DialogHost.Show(view1, "ExamMainDialog", ExamClosingEventHandler); ErrDialogContent = view1; IsErrDialogOpen = true; return; } //显示 重新评分窗口 var view2 = new ScoreNetErrDialog(); //view2.DataContext = new ScoreNetErrDialogVM(); //打开 对话框 //DialogHost.Show(view2, "ExamMainDialog", ExamClosingEventHandler); ErrDialogContent = view2; IsErrDialogOpen = true; return; } if (GlobalUser.DoneScore == ScoreType.ScoreSuccess) { //确认线上消息 返回完成进度100% --> true if (GetCompleteResult()) { //记录完整 展示 评分和答题窗口 _dispatcherTimer.Stop(); GoToResultView(); return; } else { if (_reCheckResult < 0) { //记录完整 展示 评分和答题窗口 _dispatcherTimer.Stop(); //操作失败 //todo ResubmitAnswerDialog dialog = new ResubmitAnswerDialog(); DialogHost.Show(dialog, "ExamMainDialog");//ResubmitDialogClosingEventHandler ErrMsgLog msgInfo = new ErrMsgLog(); msgInfo.user = GlobalUser.USER.Mobile; msgInfo.msginfo = "等待超时,作答正常完成,未正常返回结果消息"; msgInfo.isErr = true; Log4NetHelper.Error(msgInfo.ToJson());//$"[user:{GlobalUser.USER?.Mobile},msg:作答正常完成,未正常返回结果消息]"); { Log_Data log = new Log_Data(); log.log_desc = Log_Type.PC_Complete_Error.ToString(); log.log_text = msgInfo.ToJson();//$"[user:{GlobalUser.USER?.Mobile},msg:作答正常完成,未正常返回结果消息]";// $"评分异常,未正常返回结果消息"; log.log_device = JsonHelper.ToJson(GlobalUser.MACHINEINFO.GetDevice()); WebApiProxy.GetHtmlRespInfo(log, ApiType.SysLog, null, "Post"); } return; } _reCheckResult--; } } if (GlobalUser.DoneScore == ScoreType.ScoreFailure && (GlobalUser.ErrScoreInfo == null || !GlobalUser.ErrScoreInfo.Any())) { //记录完整 展示 评分和答题窗口 _dispatcherTimer.Stop(); if (GetCompleteResult()) { GoToResultView(); return; } else { //操作失败 //todo ResubmitAnswerDialog dialog = new ResubmitAnswerDialog(); DialogHost.Show(dialog, "ExamMainDialog"); //ResubmitDialogClosingEventHandler return; } } if (_timeOut <= 0) { _dispatcherTimer.Stop(); // 评分失败 if (GlobalUser.DoneScore != ScoreType.ScoreSuccess) { //超时后处理操作 //todo ResubmitAnswerDialog dialog = new ResubmitAnswerDialog(); DialogHost.Show(dialog, "ExamMainDialog");//ResubmitDialogClosingEventHandler return; } } }