public APIResult SaveAnswerShopInfo(AnswerShopInfo answerShopInfo) { try { answerService.SaveAnswerShopInfo(answerShopInfo); // 提交进店信息,同时更新状态 ReCheckStatus status = new ReCheckStatus(); status.InUserId = answerShopInfo.InUserId; status.ProjectId = answerShopInfo.ProjectId; status.ShopId = answerShopInfo.ShopId; status.StatusCode = "S0"; recheckService.SaveRecheckStatus(status); return(new APIResult() { Status = true, Body = "" }); } catch (Exception ex) { return(new APIResult() { Status = false, Body = ex.Message.ToString() }); } }
public void SaveRecheckStatus(ReCheckStatus status) { ReCheckStatus findOne = db.ReCheckStatus.Where(x => (x.ProjectId == status.ProjectId && x.ShopId == status.ShopId && x.StatusCode == status.StatusCode)).FirstOrDefault(); if (findOne == null) { status.InDateTime = DateTime.Now; db.ReCheckStatus.Add(status); } db.SaveChanges(); }
public APIResult SaveRecheckStatus(ReCheckStatus recheckStatus) { try { // 提交审核时,验证 if (recheckStatus.StatusCode == "S1") { List <ReCheckStatus> recheckStatusList_S1 = recheckService.GetShopRecheckStatusInfo(recheckStatus.ProjectId.ToString(), recheckStatus.ShopId.ToString(), "S1"); if (recheckStatusList_S1 != null && recheckStatusList_S1.Count > 0) { throw new Exception("已提交审核,请勿重复提交"); } List <AnswerDto> answerList = answerService.GetShopScoreInfo_NotAnswer(recheckStatus.ProjectId.ToString(), recheckStatus.ShopId.ToString()); if (answerList != null && answerList.Count > 0) { throw new Exception("存在未打分的题目,请先打分完毕"); } } // 复审修改完毕时验证 if (recheckStatus.StatusCode == "S4") { // 验证是否所有题目都进行了同意与否操作 bool modifyFinish = true; List <RecheckDto> notPassRecheckList = recheckModifyService.GetRecheckInfo(recheckStatus.ProjectId.ToString(), recheckStatus.ShopId.ToString(), "", false, null); foreach (RecheckDto recheck in notPassRecheckList) { if (recheck.AgreeCheck == null) { modifyFinish = false; break; } } if (!modifyFinish) { throw new Exception("存在未进行同意与否操作的题目"); } // 验证是否已经复审完毕 List <RecheckStatusDto> recheckStatusList = recheckService.GetShopRecheckStatus(recheckStatus.ProjectId.ToString(), recheckStatus.ShopId.ToString()); if (recheckStatusList == null || (recheckStatusList != null && recheckStatusList.Count > 0 && recheckStatusList[0].Status_S3 == "")) { throw new Exception("该经销商还未复审完毕,不能进行提交"); } // 验证是否已经提交过复审修改完毕 List <ReCheckStatus> recheckStatusList_S4 = recheckService.GetShopRecheckStatusInfo(recheckStatus.ProjectId.ToString(), recheckStatus.ShopId.ToString(), "S4"); if (recheckStatusList_S4 != null && recheckStatusList_S4.Count > 0) { throw new Exception("已复审修改完毕,请勿重复提交"); } } // 仲裁 if (recheckStatus.StatusCode == "S5") { List <ReCheckStatus> recheckStatusList_S4 = recheckService.GetShopRecheckStatusInfo(recheckStatus.ProjectId.ToString(), recheckStatus.ShopId.ToString(), "S4"); if (recheckStatusList_S4 == null || recheckStatusList_S4.Count == 0) { throw new Exception("该经销商还未复审修改完毕"); } List <ReCheckStatus> recheckStatusList_S5 = recheckService.GetShopRecheckStatusInfo(recheckStatus.ProjectId.ToString(), recheckStatus.ShopId.ToString(), "S5"); if (recheckStatusList_S5 != null && recheckStatusList_S5.Count > 0) { throw new Exception("已仲裁完毕,请勿重复提交"); } } // 督导抽查 if (recheckStatus.StatusCode == "S6") { // 验证是否已经复审完毕 List <RecheckStatusDto> recheckStatusList = recheckService.GetShopRecheckStatus(recheckStatus.ProjectId.ToString(), recheckStatus.ShopId.ToString()); if (recheckStatusList == null || (recheckStatusList != null && recheckStatusList.Count > 0 && recheckStatusList[0].Status_S3 == "")) { throw new Exception("该经销商还未复审完毕,不能进行提交"); } List <ReCheckStatus> recheckStatusList_S6 = recheckService.GetShopRecheckStatusInfo(recheckStatus.ProjectId.ToString(), recheckStatus.ShopId.ToString(), "S6"); if (recheckStatusList_S6 != null && recheckStatusList_S6.Count > 0) { throw new Exception("该经销商已复审抽查完毕,请勿重复提交"); } } // 项目经理抽查 if (recheckStatus.StatusCode == "S7") { // 验证是否已经复审完毕 List <RecheckStatusDto> recheckStatusList = recheckService.GetShopRecheckStatus(recheckStatus.ProjectId.ToString(), recheckStatus.ShopId.ToString()); if (recheckStatusList == null || (recheckStatusList != null && recheckStatusList.Count > 0 && recheckStatusList[0].Status_S3 == "")) { throw new Exception("该经销商还未复审完毕,不能进行提交"); } List <ReCheckStatus> recheckStatusList_S6 = recheckService.GetShopRecheckStatusInfo(recheckStatus.ProjectId.ToString(), recheckStatus.ShopId.ToString(), "S7"); if (recheckStatusList_S6 != null && recheckStatusList_S6.Count > 0) { throw new Exception("该经销商已复审抽查完毕,请勿重复提交"); } } recheckService.SaveRecheckStatus(recheckStatus); return(new APIResult() { Status = true, Body = "" }); } catch (Exception ex) { return(new APIResult() { Status = false, Body = ex.Message.ToString() }); } }