/// <summary> /// 创建一个审核过程 /// </summary> /// <param name="validationErrors">返回的错误信息</param> /// <param name="db">数据库上下文</param> /// <param name="entity">一个审核过程</param> /// <returns></returns> public bool Create(ref ValidationErrors validationErrors, THEREVIEWPROCESS entity) { try { repository.Create(entity); return(true); } catch (Exception ex) { validationErrors.Add(ex.Message); ExceptionsHander.WriteExceptions(ex); } return(false); }
/// <summary> /// 创建 /// </summary> /// <param name="entity">实体对象</param> /// <returns></returns> public Common.ClientResult.Result Post([FromBody] THEREVIEWPROCESS entity) { Common.ClientResult.Result result = new Common.ClientResult.Result(); if (entity != null && ModelState.IsValid) { //string currentPerson = GetCurrentPerson(); //entity.CreateTime = DateTime.Now; //entity.CreatePerson = currentPerson; entity.ID = Result.GetNewId(); string returnValue = string.Empty; if (m_BLL.Create(ref validationErrors, entity)) { LogClassModels.WriteServiceLog(Suggestion.InsertSucceed + ",审核过程的信息的Id为" + entity.ID, "审核过程" );//写入日志 result.Code = Common.ClientCode.Succeed; result.Message = Suggestion.InsertSucceed; return(result); //提示创建成功 } else { if (validationErrors != null && validationErrors.Count > 0) { validationErrors.All(a => { returnValue += a.ErrorMessage; return(true); }); } LogClassModels.WriteServiceLog(Suggestion.InsertFail + ",审核过程的信息," + returnValue, "审核过程" );//写入日志 result.Code = Common.ClientCode.Fail; result.Message = Suggestion.InsertFail + returnValue; return(result); //提示插入失败 } } result.Code = Common.ClientCode.FindNull; result.Message = Suggestion.InsertFail + ",请核对输入的数据的格式"; //提示输入的数据的格式不对 return(result); }
/// <summary> /// 根据ID获取数据模型 /// </summary> /// <param name="id">编号</param> /// <returns></returns> public THEREVIEWPROCESS Get(string id) { THEREVIEWPROCESS item = m_BLL.GetById(id); return(item); }
public Common.ClientResult.Result SheIsPi([FromBody] PREPARE_SCHEME entity) { Common.ClientResult.OrderTaskGong result = new Common.ClientResult.OrderTaskGong(); if (entity != null && ModelState.IsValid) { //数据校验 Common.Account account = GetCurrentAccount(); string currentPerson = GetCurrentPerson(); entity.UPDATETIME = DateTime.Now; entity.UPDATEPERSON = currentPerson; string returnValue = string.Empty; List <APPLIANCE_LABORATORY> APPlist = m_BLL2.GetByRefAPPLIANCE_DETAIL_INFORMATIOID(entity.APPLIANCE_DETAIL_INFORMATIONID); THEREVIEWPROCESS SH = new THEREVIEWPROCESS(); //审核操作记录 THEAPPROVALPROCESS SP = new THEAPPROVALPROCESS(); //审批操作记录 APPLIANCE_LABORATORY applianceOne = APPlist.Find(f => f.PREPARE_SCHEMEID == entity.ID); APPLIANCE_LABORATORY applianceTwo = null; if (APPlist.Remove(applianceOne)) { applianceTwo = APPlist.FirstOrDefault(); } APPLIANCE_DETAIL_INFORMATION adi = m_BLL3.GetById(applianceOne.APPLIANCE_DETAIL_INFORMATIONID); if (entity.SHPI == "H") { entity.AUDITTIME = DateTime.Now;//审核时间 entity.AUDITTEPERSON = currentPerson; if (entity.ISAGGREY == "不同意") { entity.REPORTSTATUS = Common.REPORTSTATUS.审核驳回.ToString(); entity.REPORTSTATUSZI = Common.REPORTSTATUS.审核驳回.GetHashCode().ToString(); if (applianceTwo != null) { applianceOne.ISRECEIVE = Common.ISRECEIVE.是.ToString(); m_BLL2.EditField(ref validationErrors, applianceOne); applianceTwo.ISRECEIVE = Common.ISRECEIVE.否.ToString(); m_BLL2.EditField(ref validationErrors, applianceTwo); } else { applianceOne.ISRECEIVE = Common.ISRECEIVE.是.ToString(); m_BLL2.EditField(ref validationErrors, applianceOne); } } else if (entity.ISAGGREY == "同意") { entity.REPORTSTATUS = Common.REPORTSTATUS.待批准.ToString(); entity.REPORTSTATUSZI = Common.REPORTSTATUS.待批准.GetHashCode().ToString(); if (adi.APPLIANCE_RECIVE == "是") { applianceOne.ORDER_STATUS = Common.ORDER_STATUS.试验完成.ToString(); //自己改变状态 applianceOne.EQUIPMENT_STATUS_VALUUMN = Common.ORDER_STATUS.试验完成.GetHashCode().ToString(); //自己改变状态 } if (applianceTwo != null) { applianceOne.ISRECEIVE = Common.ISRECEIVE.否.ToString(); m_BLL2.EditField(ref validationErrors, applianceOne); applianceTwo.ISRECEIVE = Common.ISRECEIVE.是.ToString(); m_BLL2.EditField(ref validationErrors, applianceTwo); } else { applianceOne.ISRECEIVE = Common.ISRECEIVE.否.ToString(); m_BLL2.EditField(ref validationErrors, applianceOne); } } #region 审核过程记录 SH.ID = Result.GetNewId(); //id SH.CREATEPERSON = account.PersonName; //审核者 SH.CREATETIME = DateTime.Now; //审核时间 SH.REVIEWCONCLUSION = entity.ISAGGREY; SH.REVIEWCONCLUSIONZI = entity.AUDITOPINION; //审核意见 SH.PREPARE_SCHEMEID = entity.ID; if (!m_BLL4.Create(ref validationErrors, SH)) { if (validationErrors != null && validationErrors.Count > 0) { validationErrors.All(a => { returnValue += a.ErrorMessage; return(true); }); } LogClassModels.WriteServiceLog(Suggestion.UpdateFail + ",预备方案信息的Id为" + entity.ID, "审核过程记录");//写入日志 } #endregion } else if (entity.SHPI == "P") { entity.APPROVALDATE = DateTime.Now; entity.APPROVALEPERSON = currentPerson; if (entity.APPROVALISAGGREY == "不同意") { entity.REPORTSTATUS = Common.REPORTSTATUS.批准驳回.ToString(); entity.REPORTSTATUSZI = Common.REPORTSTATUS.批准驳回.GetHashCode().ToString(); if (applianceTwo != null) { if (applianceTwo.ORDER_STATUS == Common.ORDER_STATUS.已分配.ToString()) { applianceOne.ISRECEIVE = Common.ISRECEIVE.是.ToString(); applianceTwo.ISRECEIVE = Common.ISRECEIVE.否.ToString(); } else if (applianceTwo.ORDER_STATUS == Common.ORDER_STATUS.已领取.ToString()) { applianceOne.ISRECEIVE = Common.ISRECEIVE.否.ToString(); applianceTwo.ISRECEIVE = Common.ISRECEIVE.是.ToString(); } else if (applianceTwo.PREPARE_SCHEME.REPORTSTATUS == Common.REPORTSTATUS.待批准.ToString()) { applianceOne.ISRECEIVE = Common.ISRECEIVE.是.ToString(); applianceTwo.ISRECEIVE = Common.ISRECEIVE.否.ToString(); } else if (applianceTwo.PREPARE_SCHEME.REPORTSTATUS == Common.REPORTSTATUS.已批准.ToString()) { applianceOne.ISRECEIVE = Common.ISRECEIVE.是.ToString(); applianceTwo.ISRECEIVE = Common.ISRECEIVE.否.ToString(); } else if (applianceTwo.PREPARE_SCHEME.REPORTSTATUS == Common.REPORTSTATUS.批准驳回.ToString()) { applianceOne.ISRECEIVE = Common.ISRECEIVE.否.ToString(); applianceTwo.ISRECEIVE = Common.ISRECEIVE.是.ToString(); } m_BLL2.EditField(ref validationErrors, applianceOne); m_BLL2.EditField(ref validationErrors, applianceTwo); } else { applianceOne.ISRECEIVE = Common.ISRECEIVE.是.ToString(); m_BLL2.EditField(ref validationErrors, applianceOne); } } else if (entity.APPROVALISAGGREY == "同意") { entity.REPORTSTATUS = Common.REPORTSTATUS.已批准.ToString(); entity.REPORTSTATUSZI = Common.REPORTSTATUS.已批准.GetHashCode().ToString(); if (adi != null) { if (adi.APPLIANCE_RECIVE == "是") { applianceOne.ORDER_STATUS = Common.ORDER_STATUS.待入库.ToString(); applianceOne.EQUIPMENT_STATUS_VALUUMN = Common.ORDER_STATUS.待入库.GetHashCode().ToString(); } else { applianceOne.ORDER_STATUS = Common.ORDER_STATUS.器具未收.ToString(); applianceOne.EQUIPMENT_STATUS_VALUUMN = Common.ORDER_STATUS.器具未收.GetHashCode().ToString(); } } applianceOne.ISRECEIVE = Common.ISRECEIVE.否.ToString(); m_BLL2.EditField(ref validationErrors, applianceOne); } #region 审批过程记录 SP.ID = Result.GetNewId(); //id SP.CREATEPERSON = account.Name; //审核者 SP.CREATETIME = DateTime.Now; //审核时间 SP.APPROVALCONCLUSION = entity.APPROVALISAGGREY; SP.PREPARE_SCHEMEID = entity.ID; SP.APPROVALCONCLUSIONZI = entity.APPROVAL;//审批意见 if (!m_BLL5.Create(ref validationErrors, SP)) { if (validationErrors != null && validationErrors.Count > 0) { validationErrors.All(a => { returnValue += a.ErrorMessage; return(true); }); } LogClassModels.WriteServiceLog(Suggestion.UpdateFail + ",预备方案信息的Id为" + entity.ID, "审批过程记录");//写入日志 } #endregion } bool HE = false; if (!string.IsNullOrEmpty(applianceOne.ORDER_STATUS) || !string.IsNullOrEmpty(entity.REPORTSTATUS)) { HE = m_BLL.EditField(ref validationErrors, entity);//器具明细修改 } try { if (entity.REPORTSTATUS == Common.REPORTSTATUS.待批准.ToString() || entity.REPORTSTATUS == Common.REPORTSTATUS.已批准.ToString()) { Langben.Report.ReportBLL rBLL = new Langben.Report.ReportBLL(); string err = ""; rBLL.AddQianMing(entity.ID, entity.REPORTSTATUS, out err); } } catch (Exception ex) { } if (HE) { LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",预备方案信息的Id为" + entity.ID, "预备方案" );//写入日志 result.Code = Common.ClientCode.Succeed; result.Message = Suggestion.UpdateSucceed; result.Id = entity.ID; return(result); //提示更新成功 } else { if (validationErrors != null && validationErrors.Count > 0) { validationErrors.All(a => { returnValue += a.ErrorMessage; return(true); }); } LogClassModels.WriteServiceLog(Suggestion.UpdateFail + ",预备方案信息的Id为" + entity.ID + "," + returnValue, "预备方案" );//写入日志 result.Code = Common.ClientCode.Fail; result.Message = Suggestion.UpdateFail + returnValue; return(result); //提示更新失败 } } result.Code = Common.ClientCode.FindNull; result.Message = Suggestion.UpdateFail + "请核对输入的数据的格式"; return(result); //提示输入的数据的格式不对 }