public async Task<ActionResult> BizCheck08(BizCheck08ViewModel bizCheck08ViewModel) { ViewBag.LeftMenu = Global.Report; int questionSn = bizCheck08ViewModel.QuestionSn; if (bizCheck08ViewModel.QuestionSn > 0) { var quesMaster = await _quesMasterService.GetQuesResult1Async(questionSn); if (bizCheck08ViewModel.SubmitType == "N") { quesMaster.SaveStatus = 11; } // A1B106 : 생산설비의 운영체제 및 관리 foreach (var item in bizCheck08ViewModel.ProducEquip) { var checkItem = quesMaster.QuesResult1.SingleOrDefault(m => m.QuestionSn == questionSn && m.CheckListSn == item.CheckListSn); if (checkItem == null) { var result1 = new QuesResult1(); result1.QuestionSn = questionSn; result1.CheckListSn = item.CheckListSn; result1.AnsVal = item.AnsVal; result1.RegDt = DateTime.Now; result1.RegId = Session[Global.LoginID].ToString(); quesMaster.QuesResult1.Add(result1); } else { checkItem.AnsVal = item.AnsVal; checkItem.UpdDt = DateTime.Now; checkItem.UpdId = Session[Global.LoginID].ToString(); } } // A1B107 : 공정관리 foreach (var item in bizCheck08ViewModel.ProcessControl) { var checkItem = quesMaster.QuesResult1.SingleOrDefault(m => m.QuestionSn == questionSn && m.CheckListSn == item.CheckListSn); if (checkItem == null) { var result1 = new QuesResult1(); result1.QuestionSn = questionSn; result1.CheckListSn = item.CheckListSn; result1.AnsVal = item.AnsVal; result1.RegDt = DateTime.Now; result1.RegId = Session[Global.LoginID].ToString(); quesMaster.QuesResult1.Add(result1); } else { checkItem.AnsVal = item.AnsVal; checkItem.UpdDt = DateTime.Now; checkItem.UpdId = Session[Global.LoginID].ToString(); } } await _quesMasterService.SaveDbContextAsync(); } else { //에러처리 필요 return View(bizCheck08ViewModel); } if (bizCheck08ViewModel.SubmitType == "T") { return RedirectToAction("BizCheck08", "Report", new { @questionSn = questionSn }); } else { return RedirectToAction("BizCheck09", "Report", new { @questionSn = questionSn }); } }
public async Task<ActionResult> BizCheck08(string questionSn, string status) { ViewBag.LeftMenu = Global.Report; if (string.IsNullOrEmpty(questionSn)) { // 오류 처리해야함. return View(); } var bizCheck08 = new BizCheck08ViewModel(); // A1B106 : 생산설비의 운영체제 및 관리 var quesResult1s = await _quesResult1Service.GetQuesResult1sAsync(int.Parse(questionSn), "A1B106"); if (quesResult1s.Count() != 5) { var quesCheckList = await _quesCheckListService.GetQuesCheckListAsync("A1B106"); var quesCheckListView = Mapper.Map<List<QuesCheckListViewModel>>(quesCheckList); foreach (var item in quesCheckListView) { item.QuestionSn = int.Parse(questionSn); item.AnsVal = false; } bizCheck08.ProducEquip = quesCheckListView; } else { var quesCheckListView = Mapper.Map<List<QuesCheckListViewModel>>(quesResult1s); bizCheck08.ProducEquip = quesCheckListView; } // A1B107 : 공정관리 var quesResult1sProcess = await _quesResult1Service.GetQuesResult1sAsync(int.Parse(questionSn), "A1B107"); if (quesResult1sProcess.Count() != 5) { var quesCheckList = await _quesCheckListService.GetQuesCheckListAsync("A1B107"); var quesCheckListView = Mapper.Map<List<QuesCheckListViewModel>>(quesCheckList); foreach (var item in quesCheckListView) { item.QuestionSn = int.Parse(questionSn); item.AnsVal = false; } bizCheck08.ProcessControl = quesCheckListView; } else { var quesCheckListView = Mapper.Map<List<QuesCheckListViewModel>>(quesResult1sProcess); bizCheck08.ProcessControl = quesCheckListView; } bizCheck08.Status = status; bizCheck08.QuestionSn = int.Parse(questionSn); return View(bizCheck08); }