/// <summary> /// 创建一个器具明细信息_承接实验室 /// </summary> /// <param name="validationErrors">返回的错误信息</param> /// <param name="db">数据库上下文</param> /// <param name="entity">一个器具明细信息_承接实验室</param> /// <returns></returns> public bool Create(ref ValidationErrors validationErrors, APPLIANCE_LABORATORY entity) { try { repository.Create(entity); return(true); } catch (Exception ex) { validationErrors.Add(ex.Message); ExceptionsHander.WriteExceptions(ex); } return(false); }
/// <summary> /// 编辑一个器具明细信息_承接实验室(公用) /// </summary> /// <param name="validationErrors">返回的错误信息</param> /// <param name="entity">一个器具明细信息_承接实验室</param> /// <returns></returns> public bool EditField(ref ValidationErrors validationErrors, APPLIANCE_LABORATORY entity) { try { repository.EditField(db, entity); repository.Save(db); 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] APPLIANCE_LABORATORY 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); }
// PUT api/<controller>/5 /// <summary> /// 编辑 /// </summary> /// <param name="entity"></param> /// <returns></returns> public Common.ClientResult.Result Put([FromBody] APPLIANCE_LABORATORY entity) { Common.ClientResult.Result result = new Common.ClientResult.Result(); if (entity != null && ModelState.IsValid) { //数据校验 string currentPerson = GetCurrentPerson(); // entity.UPDATETIME = DateTime.Now; // entity.UPDATEPERSON = currentPerson; string returnValue = string.Empty; if (m_BLL.Edit(ref validationErrors, entity)) { LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",器具明细信息_承接实验室信息的Id为" + entity.ID, "器具明细信息_承接实验室" );//写入日志 result.Code = Common.ClientCode.Succeed; result.Message = Suggestion.UpdateSucceed; 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); //提示输入的数据的格式不对 }
/// <summary> /// 根据ID获取数据模型 /// </summary> /// <param name="id">编号</param> /// <returns></returns> public APPLIANCE_LABORATORY Get(string id) { APPLIANCE_LABORATORY item = m_BLL.GetById(id); return(item); }
public Common.ClientResult.Result EditSENDBACK([FromBody] APPLIANCE_LABORATORY entity) { Common.ClientResult.Result result = new Common.ClientResult.Result(); APPLIANCE_LABORATORY aryOne = null; if (entity != null && ModelState.IsValid) { //数据校验 Common.Account account = GetCurrentAccount(); List <APPLIANCE_LABORATORY> appory = m_BLL.GetByRefAPPLIANCE_DETAIL_INFORMATIOID(entity.APPLIANCE_DETAIL_INFORMATION.ID); aryOne = appory.Find(f => f.UNDERTAKE_LABORATORYID == account.UNDERTAKE_LABORATORYName); //选择的器具 if (!string.IsNullOrWhiteSpace(aryOne.PREPARE_SCHEMEID)) { //如果有报告产生,就不能退回 result.Code = Common.ClientCode.Fail; result.Message = "已经生成报告编号,如果器具不能检测,请完成不合格报告。"; return(result); } var currentPerson = GetCurrentAccount(); entity.BACKTIME = DateTime.Now; entity.BACKPERSON = currentPerson.PersonName; string returnValue = string.Empty; //通过前端传过来的值来判断枚举中属于什么值给器具状态值赋值 if (!string.IsNullOrEmpty(entity.ORDER_STATUS)) { if (Enum.IsDefined(typeof(Common.ORDER_STATUS), entity.ORDER_STATUS)) { entity.EQUIPMENT_STATUS_VALUUMN = Enum.Parse(typeof(Common.ORDER_STATUS), entity.ORDER_STATUS).GetHashCode().ToString(); } } entity.ID = aryOne.ID; if (m_BLL.EditField(ref validationErrors, entity)) { if (entity.ORDER_STATUS == Common.ORDER_STATUS.已退回.ToString()) //退回 { //获取委托单id APPLIANCE_DETAIL_INFORMATION appl = m_BLL2.GetById(entity.APPLIANCE_DETAIL_INFORMATION.ID); appl.ORDER_TASK_INFORMATION.ORDER_STATUS = Common.ORDER_STATUS_INFORMATION.退回.ToString(); m_BLL3.EditField(ref validationErrors, appl.ORDER_TASK_INFORMATION); LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",器具退回的Id为" + entity.ID, "器具明细信息" );//写入日志 result.Code = Common.ClientCode.Succeed; result.Message = "退回成功!"; return(result); //提示更新成功 } else if (entity.ORDER_STATUS == Common.ORDER_STATUS.待入库.ToString()) { entity.APPLIANCE_DETAIL_INFORMATION.STORAGEINSTRUCTIONS = entity.STORAGEINSTRUCTIONS.ToString(); //入库说明 if (m_BLL2.EditField(ref validationErrors, entity.APPLIANCE_DETAIL_INFORMATION)) //修改器具明细表中的入库说明 { if (appory.Remove(aryOne)) { var aryTwo = appory.FirstOrDefault(); if (aryTwo != null) { result.Message = "请通知" + aryTwo.UNDERTAKE_LABORATORYID + "该器具不能检测"; } else { result.Message = "退回成功!"; } } else { result.Message = Suggestion.UpdateSucceed; } LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",器具退回的Id为" + entity.ID, "器具明细信息" );//写入日志 result.Code = Common.ClientCode.Succeed; 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); //提示输入的数据的格式不对 }
public Common.ClientResult.Result LINGQU([FromBody] APPLIANCE_LABORATORY entity) { Common.ClientResult.Result result = new Common.ClientResult.Result(); string returnValue = string.Empty; string id = entity.APPLIANCE_DETAIL_INFORMATIONID.TrimEnd(','); string[] deleteId = id.Split(',');//截取id if (deleteId != null && deleteId.Length > 0) { Common.Account account = GetCurrentAccount(); bool qu = false; foreach (var item in deleteId) { if (GetISRECEIVE(item)) { qu = true; } else { qu = false; break; } } if (qu) { foreach (var item2 in deleteId)//修改器具状态 { APPLIANCE_DETAIL_INFORMATION appion = new APPLIANCE_DETAIL_INFORMATION(); APPLIANCE_DETAIL_INFORMATION adi = m_BLL2.GetById(item2); List <APPLIANCE_LABORATORY> listry = m_BLL.GetByRefAPPLIANCE_DETAIL_INFORMATIOID(item2); foreach (var item3 in listry) { APPLIANCE_LABORATORY app = new APPLIANCE_LABORATORY(); if (item3.UNDERTAKE_LABORATORYID == account.UNDERTAKE_LABORATORYName) { app.ORDER_STATUS = Common.ORDER_STATUS.已领取.ToString(); app.EQUIPMENT_STATUS_VALUUMN = Common.ORDER_STATUS.已领取.GetHashCode().ToString(); app.RECEIVEPERSON = account.PersonName; app.RECEIVETIME = DateTime.Now; } app.ID = item3.ID; app.ISRECEIVE = Common.ISRECEIVE.否.ToString(); if (m_BLL.EditField(ref validationErrors, app)) { LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",器具明细信息_承接实验室的Id为" + appion.ID, "器具领取状态修改");//写入日志 result.Code = Common.ClientCode.Succeed; result.Message = Suggestion.UpdateSucceed; } else { if (validationErrors != null && validationErrors.Count > 0) { validationErrors.All(a => { returnValue += a.ErrorMessage; return(true); }); } LogClassModels.WriteServiceLog(Suggestion.UpdateFail + ",器具明细信息_承接实验室的Id为" + appion.ID + "," + returnValue, "器具领取状态修改");//写入日志 result.Code = Common.ClientCode.Fail; result.Message = Suggestion.UpdateFail + returnValue; return(result); //提示更新失败 } } appion.ID = item2; if (adi.APPLIANCE_RECIVE == "是") { appion.APPLIANCE_PROGRESS = account.UNDERTAKE_LABORATORYName; } if (m_BLL2.EditField(ref validationErrors, appion)) { LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",器具明细信息信息的Id为" + appion.ID, "器具领取所在实验室修改");//写入日志 result.Code = Common.ClientCode.Succeed; result.Message = Suggestion.UpdateSucceed; } else { if (validationErrors != null && validationErrors.Count > 0) { validationErrors.All(a => { returnValue += a.ErrorMessage; return(true); }); } LogClassModels.WriteServiceLog(Suggestion.UpdateFail + ",器具明细信息信息的Id为" + appion.ID + "," + returnValue, "器具领取所在实验室修改");//写入日志 result.Code = Common.ClientCode.Fail; result.Message = Suggestion.UpdateFail + returnValue; return(result); //提示更新失败 } } } } return(result); //提示输入的数据的格式不对 }
public Common.ClientResult.Result PutSTORAGEINSTRUCTI_STATU(string id) { Common.ClientResult.Result result = new Common.ClientResult.Result(); if (id != null && ModelState.IsValid) { //数据校验 APPLIANCE_DETAIL_INFORMATION app = null; APPLIANCE_LABORATORY appry = null; foreach (var item in id.TrimEnd(',').Split(',')) { app = new APPLIANCE_DETAIL_INFORMATION(); appry = new APPLIANCE_LABORATORY(); app.UPDATEPERSON = GetCurrentPerson(); app.UPDATETIME = DateTime.Now; app.ID = item; app.STORAGEINSTRUCTI_STATU = Common.ORDER_STATUS.器具已入库.ToString(); //入库状态 app.APPLIANCE_PROGRESS = "库房"; //记录器具所在位置 //器具明细信息_承接实验室表修改器具状态 List <APPLIANCE_LABORATORY> list = m_BLL3.GetByRefAPPLIANCE_DETAIL_INFORMATIOID(item); appry.ORDER_STATUS = Common.ORDER_STATUS.器具已入库.ToString(); //器具状态 appry.EQUIPMENT_STATUS_VALUUMN = Common.ORDER_STATUS.器具已入库.GetHashCode().ToString(); //器具状态值 foreach (var ps in list) { string returnValue = string.Empty; appry.ID = ps.ID; if (m_BLL3.EditField(ref validationErrors, appry)) { LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",器具明细信息_承接实验室的Id为" + appry.ID, "器具明细信息_承接实验室信息" );//写入日志 result.Code = Common.ClientCode.Succeed; result.Message = Suggestion.UpdateSucceed; } else { if (validationErrors != null && validationErrors.Count > 0) { validationErrors.All(a => { returnValue += a.ErrorMessage; return(true); }); } LogClassModels.WriteServiceLog(Suggestion.UpdateFail + ",器具明细信息_承接实验室的Id为" + app.ID + "," + returnValue, "器具明细信息_承接实验室信息" );//写入日志 result.Code = Common.ClientCode.Fail; result.Message = Suggestion.UpdateFail + returnValue; return(result); //提示更新失败 } } //器具明细信息表的入库状态修改 string returnValue2 = string.Empty; if (m_BLL.EditField(ref validationErrors, app)) { LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",器具明细信息信息的Id为" + app.ID, "器具明细信息" );//写入日志 result.Code = Common.ClientCode.Succeed; result.Message = Suggestion.UpdateSucceed; continue; } else { if (validationErrors != null && validationErrors.Count > 0) { validationErrors.All(a => { returnValue2 += a.ErrorMessage; return(true); }); } LogClassModels.WriteServiceLog(Suggestion.UpdateFail + ",器具明细信息信息的Id为" + app.ID + "," + returnValue2, "器具明细信息" );//写入日志 result.Code = Common.ClientCode.Fail; result.Message = Suggestion.UpdateFail + returnValue2; return(result); //提示更新失败 } } return(result); } result.Code = Common.ClientCode.FindNull; result.Message = Suggestion.UpdateFail + "请核对输入的数据的格式"; return(result); //提示输入的数据的格式不对 }
public Common.ClientResult.Result PutUpdate([FromBody] ORDER_TASK_INFORMATION entity) { Common.ClientResult.OrderTaskGong result = new Common.ClientResult.OrderTaskGong(); { string currentPerson = GetCurrentPerson(); if (!string.IsNullOrEmpty(entity.ID)) { entity.CREATETIME = DateTime.Now; entity.CREATEPERSON = currentPerson; // entity.ID = Result.GetNewId(); entity.ORDER_STATUS = Common.ORDER_STATUS_INFORMATION.已分配.ToString(); APPLIANCE_LABORATORY ary = new APPLIANCE_LABORATORY(); APPLIANCE_LABORATORY ary2 = new APPLIANCE_LABORATORY(); foreach (var item in entity.APPLIANCE_DETAIL_INFORMATION)//器具信息 { item.CREATETIME = DateTime.Now; item.CREATEPERSON = currentPerson; ary = null; ary2 = null; //器具明细信息_承接实验室表添加数据 List <APPLIANCE_LABORATORY> appory = m_BLL3.GetByRefAPPLIANCE_DETAIL_INFORMATIOID(item.ID); if (appory.Count >= 2) { ary = appory[0]; ary2 = appory[1]; } else { ary = appory[0]; } if (appory.Count >= 2) { string ISRECEIVE = string.Empty; if (ary.ORDER_STATUS == Common.ORDER_STATUS.已退回.ToString()) { if (ary2.ORDER_STATUS == Common.ORDER_STATUS.已领取.ToString()) { ISRECEIVE = Common.ISRECEIVE.否.ToString(); } else { ISRECEIVE = Common.ISRECEIVE.是.ToString(); } item.APPLIANCE_LABORATORY.Add(new APPLIANCE_LABORATORY() { ID = ary.ID, UNDERTAKE_LABORATORYID = item.UNDERTAKE_LABORATORYID, ORDER_STATUS = Common.ORDER_STATUS.已分配.ToString(), EQUIPMENT_STATUS_VALUUMN = Common.ORDER_STATUS.已分配.GetHashCode().ToString(), DISTRIBUTIONPERSON = currentPerson, DISTRIBUTIONTIME = DateTime.Now, CREATEPERSON = currentPerson, CREATETIME = DateTime.Now, ISRECEIVE = ISRECEIVE }); } else if (ary2.ORDER_STATUS == Common.ORDER_STATUS.已退回.ToString()) { if (ary.ORDER_STATUS == Common.ORDER_STATUS.已领取.ToString()) { ISRECEIVE = Common.ISRECEIVE.否.ToString(); } else { ISRECEIVE = Common.ISRECEIVE.是.ToString(); } item.APPLIANCE_LABORATORY.Add(new APPLIANCE_LABORATORY() { ID = ary2.ID, UNDERTAKE_LABORATORYID = item.UNDERTAKE_LABORATORYID, ORDER_STATUS = Common.ORDER_STATUS.已分配.ToString(), EQUIPMENT_STATUS_VALUUMN = Common.ORDER_STATUS.已分配.GetHashCode().ToString(), DISTRIBUTIONPERSON = currentPerson, DISTRIBUTIONTIME = DateTime.Now, CREATEPERSON = currentPerson, CREATETIME = DateTime.Now, ISRECEIVE = ISRECEIVE }); } } else { if (ary.ORDER_STATUS == Common.ORDER_STATUS.已退回.ToString()) { item.APPLIANCE_LABORATORY.Add(new APPLIANCE_LABORATORY() { ID = ary.ID, UNDERTAKE_LABORATORYID = item.UNDERTAKE_LABORATORYID, ORDER_STATUS = Common.ORDER_STATUS.已分配.ToString(), EQUIPMENT_STATUS_VALUUMN = Common.ORDER_STATUS.已分配.GetHashCode().ToString(), DISTRIBUTIONPERSON = currentPerson, DISTRIBUTIONTIME = DateTime.Now, CREATEPERSON = currentPerson, CREATETIME = DateTime.Now, ISRECEIVE = Common.ISRECEIVE.是.ToString() }); } } } string returnValue = string.Empty; foreach (var item in entity.APPLIANCE_DETAIL_INFORMATION) { if (m_BLL2.EditField(ref validationErrors, item)) { LogClassModels.WriteServiceLog(Suggestion.InsertSucceed + ",器具明细信息的Id为" + item.ID, "委托单信息" );//写入日志 result.Code = Common.ClientCode.Succeed; result.Message = Suggestion.UpdateSucceed; } else { LogClassModels.WriteServiceLog(Suggestion.InsertSucceed + ",器具明细信息的Id为" + item.ID, "委托单信息" );//写入日志 result.Code = Common.ClientCode.Fail; result.Message = Suggestion.UpdateFail; return(result); } foreach (var item2 in item.APPLIANCE_LABORATORY) { if (m_BLL3.EditField(ref validationErrors, item2)) { LogClassModels.WriteServiceLog(Suggestion.InsertSucceed + ",器具明细信息_承接实验室的Id为" + item2.ID, "委托单信息" );//写入日志 result.Code = Common.ClientCode.Succeed; result.Message = Suggestion.UpdateSucceed; } else { LogClassModels.WriteServiceLog(Suggestion.InsertSucceed + ",器具明细信息_承接实验室的Id为" + item2.ID, "委托单信息" );//写入日志 result.Code = Common.ClientCode.Fail; result.Message = Suggestion.UpdateFail; return(result); } } } if (m_BLL.EditField(ref validationErrors, entity)) { LogClassModels.WriteServiceLog(Suggestion.InsertSucceed + ",委托单信息的信息的Id为" + entity.ID, "委托单信息" );//写入日志 result.Code = Common.ClientCode.Succeed; result.Message = Suggestion.InsertSucceed; result.Id = entity.ID; 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); //提示插入失败 } } else { } } result.Code = Common.ClientCode.FindNull; result.Message = Suggestion.InsertFail + ",请核对输入的数据的格式"; //提示输入的数据的格式不对 return(result); }
public Common.ClientResult.Result Put(string baogaoid, string qijuid, string yemian) { Common.ClientResult.Result result = new Common.ClientResult.Result(); if (baogaoid != null || qijuid != null) { //数据校验 string currentPerson = GetCurrentPerson(); string returnValue = string.Empty; #region 报告领取操作 if (!string.IsNullOrWhiteSpace(baogaoid)) { foreach (var item in baogaoid.Split('|')) { PREPARE_SCHEME prep = new PREPARE_SCHEME();//预备方案 if (!string.IsNullOrEmpty(item)) { prep.ID = item.Split('~')[0]; prep.REPORTSTATUS = Common.REPORTSTATUS.报告已领取.ToString(); //报告领取状态 prep.REPORTSTATUSZI = Common.REPORTSTATUS.报告已领取.GetHashCode().ToString(); //报告领取状态 if (m_BLL5.EditField(ref validationErrors, prep)) { result.Code = Common.ClientCode.Succeed; result.Message = Suggestion.InsertSucceed; } else { if (validationErrors != null && validationErrors.Count > 0) { validationErrors.All(a => { returnValue += a.ErrorMessage; return(true); }); } result.Code = Common.ClientCode.Fail; result.Message = Suggestion.InsertFail + returnValue; return(result); //提示创建失败 } } } } #endregion #region 器具领取操作 if (!string.IsNullOrWhiteSpace(qijuid)) { foreach (var item in qijuid.Split('|')) { APPLIANCE_LABORATORY appry = new APPLIANCE_LABORATORY(); //器具明细信息_承接实验室 APPLIANCE_DETAIL_INFORMATION appion = new APPLIANCE_DETAIL_INFORMATION(); //器具明细 if (!string.IsNullOrEmpty(item)) { appion.APPLIANCE_PROGRESS = null; //所在实验室 appion.ID = item.Split('~')[0]; //id if (!m_BLL6.EditField(ref validationErrors, appion)) //修改器具所在实验室数据 { LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",器具明细信息的Id为" + appion.ID, "器具领取"); //写入日志 result.Code = Common.ClientCode.Succeed; result.Message = Suggestion.UpdateFail; return(result); //提示创建失败 } List <APPLIANCE_LABORATORY> list = m_BLL4.GetByRefAPPLIANCE_DETAIL_INFORMATIOID(item.Split('~')[0]); foreach (var item2 in list) { appry.ID = item2.ID; appry.ORDER_STATUS = Common.ORDER_STATUS.器具已领取.ToString(); appry.EQUIPMENT_STATUS_VALUUMN = Common.ORDER_STATUS.器具已领取.GetHashCode().ToString(); if (!m_BLL4.EditField(ref validationErrors, appry)) { LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",器具明细信息_承接实验室的Id为" + appry.ID, "器具领取");//写入日志 result.Code = Common.ClientCode.Succeed; result.Message = Suggestion.UpdateFail; return(result); //提示创建失败 } } } } } #endregion return(result); } result.Code = Common.ClientCode.FindNull; result.Message = Suggestion.InsertFail + "请核对输入的数据的格式"; return(result); //提示输入的数据的格式不对 }
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); //提示输入的数据的格式不对 }
public Common.ClientResult.Result Post([FromBody] PREPARE_SCHEME entity) { Common.ClientResult.OrderTaskGong result = new Common.ClientResult.OrderTaskGong(); try { Common.Account account = GetCurrentAccount(); string putid = entity.ID; if (entity != null && ModelState.IsValid) { entity.CREATETIME = DateTime.Now; entity.CREATEPERSON = account.PersonName; //修改证书编号 entity.ID = Result.GetNewId(); string returnValue = string.Empty; APPLIANCE_LABORATORY app = new APPLIANCE_LABORATORY(); if (string.IsNullOrWhiteSpace(entity.APPLIANCE_LABORATORYID)) { LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",中间表没有id" + entity.ID, "预备方案表数据保存");//写入日志 result.Code = Common.ClientCode.Fail; result.Message = "中间表ID没取到"; return(result); //提示更新成功 } app.ID = entity.APPLIANCE_LABORATORYID; app.PREPARE_SCHEMEID = entity.ID; if (!string.IsNullOrEmpty(putid))//判断是否为第二次进入 { //修改 entity.ID = putid; if (m_BLL.EditField(ref validationErrors, entity) && m_BLL.UPTSerialNumber(entity.ID)) { LogClassModels.WriteServiceLog(Suggestion.UpdateSucceed + ",预备方案信息修改" + 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); //提示更新失败 } } else { try { if (m_BLL.Create(ref validationErrors, entity)) { LogClassModels.WriteServiceLog(Suggestion.InsertSucceed + ",预备方案的信息的Id为" + entity.ID, "预备方案保存");//写入日志 result.Code = Common.ClientCode.Succeed; result.Id = entity.ID; } else { if (validationErrors != null && validationErrors.Count > 0) { validationErrors.All(a => { returnValue += a.ErrorMessage; return(true); }); } result.Code = Common.ClientCode.Fail; result.Message = returnValue + "预备方案添加数据出错!"; result.Id = entity.ID; return(result); } } catch (Exception ex) { validationErrors.Add(ex.Message); ExceptionsHander.WriteExceptions(ex); } if (m_BLL2.EditField(ref validationErrors, app)) { LogClassModels.WriteServiceLog(Suggestion.InsertSucceed + ",中间表出错了" + app.ID, "中间表修改");//写入日志 result.Code = Common.ClientCode.Succeed; result.Id = entity.ID; } else { result.Code = Common.ClientCode.Fail; result.Message = validationErrors + "中间表修改出错了!"; result.Id = entity.ID; return(result); } if (m_BLL.UPTSerialNumber(entity.ID)) { LogClassModels.WriteServiceLog(Suggestion.InsertSucceed + ",修改编号" + entity.ID, "修改编号");//写入日志 result.Code = Common.ClientCode.Succeed; result.Id = entity.ID; } else { result.Code = Common.ClientCode.Fail; result.Message = validationErrors + "修改编号出错!"; result.Id = entity.ID; return(result); } return(result); } } } catch (Exception ex) { validationErrors.Add(ex.Message); ExceptionsHander.WriteExceptions(ex); } result.Code = Common.ClientCode.FindNull; result.Message = Suggestion.InsertFail + ",请核对输入的数据的格式"; //提示输入的数据的格式不对 return(result); }