public ActionResult Edit(Epm_TzDesiginChangeApply model) { Result <int> result = new Result <int>(); string fileDataJson = Request.Form["fileDataJsonFile"];//获取上传文件json字符串 if (!string.IsNullOrEmpty(fileDataJson)) { model.TzAttachs = JsonConvert.DeserializeObject <List <Epm_TzAttachs> >(fileDataJson);//将文件信息json字符 } using (ClientSiteClientProxy proxy = new ClientSiteClientProxy(ProxyEx(Request))) { result = proxy.UpdateTzDesiginChangeApply(model); } return(Json(result.ToResultView())); }
///<summary> ///添加: ///</summary> /// <param name="model">要添加的model</param> /// <returns>受影响的行数</returns> public Result <int> AddTzDesiginChangeApply(Epm_TzDesiginChangeApply model) { Result <int> result = new Result <int>(); try { #region 建设工程设计变更申请流程 var XtWorkFlow = System.Configuration.ConfigurationManager.AppSettings.Get("XtWorkFlow"); if (model.State == (int)PreProjectState.ApprovalSuccess && XtWorkFlow == "1") { TzDesiginChangeApplyApprovalView view = new TzDesiginChangeApplyApprovalView(); var baseUser = DataOperateBasic <Base_User> .Get().GetModel(model.ApplicantID.Value); if (baseUser == null) { throw new Exception("未找到申请人相关信息!"); } if (model.UnitID != null) { var company = DataOperateBasic <Base_Company> .Get().GetModel(model.UnitID.Value); if (company == null) { throw new Exception("未获取到申请单位信息!"); } view.sub_sqdw = company.ObjeId; } else { throw new Exception("请选择申请单位!"); } view.hr_sqr = baseUser.ObjeId; view.date_sqrq = string.Format("{0:yyyy-MM-dd}", DateTime.Now); view.txt_gcmc = model.ProjectName; view.int_htzj = model.InvestmentCost.ToString(); view.int_bgzj = model.ChangeCost.ToString(); //view.sub_jswd = model.ConstructionUnit; if (model.ConstructionUnitID != null) { var company = DataOperateBasic <Base_Company> .Get().GetModel(model.ConstructionUnitID.Value); if (company == null) { throw new Exception("未获取到申请单位信息!"); } view.sub_jswd = company.ObjeId; } else { throw new Exception("请选择申请单位!"); } if (model.DepartmentID != null) { var company = DataOperateBasic <Base_Company> .Get().GetModel(model.DepartmentID.Value); if (company == null) { throw new Exception("未获取到申请部门信息!"); } view.dep_sqmb = company.ObjeId; } else { throw new Exception("请选择申请部门!"); } view.txt_lxdh = model.ConstructionUnitPeople; view.txt_sgdw = model.WorkUnit; view.txt_sgdwlxdh = model.WorkUnitPeople; view.txt_jldw = model.SupervisionUnit; view.txt_jldwlxf = model.SupervisionUnitPeople; view.txt_sjdw = model.DesignUnit; view.txt_sjdwlxdh = model.DesignUnitPeople; view.txt_bgdyy = model.ChangeCause; view.txt_bgdnr = model.ChangeContent; view.txt_gcljgc = model.ProjectChange; view.txt_bgdgq = model.Impact; if (model.HeaderID != null) { var baseUserHeaderID = DataOperateBasic <Base_User> .Get().GetModel(model.HeaderID.Value); if (baseUserHeaderID == null) { throw new Exception("未找到部门负责人相关信息!"); } view.hr_bmfzr = baseUserHeaderID.ObjeId; } if (model.LeaderID != null) { var baseUserLeaderID = DataOperateBasic <Base_User> .Get().GetModel(model.LeaderID.Value); if (baseUserLeaderID == null) { throw new Exception("未找到分管领导相关信息!"); } view.hr_fgld = baseUserLeaderID.ObjeId; } //附件 if (model.TzAttachs != null && model.TzAttachs.Any()) { //string baseFaleUrl = System.Configuration.ConfigurationManager.AppSettings.Get("XtDownloadUrl"); //foreach (var item in model.TzAttachs) //{ // string fileUrl = string.Format("{0}?fileId={1}&type={2}", baseFaleUrl, item.Id, item.TypeNo); // switch (item.TypeNo) // { // case "JSSQBG": // view.fj = fileUrl + '|' + view.fj; ; // break; // default: // break; // } //} //if (view.fj != null) //{ // view.fj = view.fj.Substring(view.fj.Length - 1); //} view.fj = XtWorkFlowSubmitService.CreateXtAttachPath(model.TzAttachs); } model.WorkFlowId = XtWorkFlowService.CreateTzChangeApplyWorkFlow(view); } #endregion //上传附件 if (model.TzAttachs != null && model.TzAttachs.Any()) { AddFilesBytzTable(model, model.TzAttachs); } SetCreateUser(model); SetCurrentUser(model); model.ApprovalNameId = model.CreateUserId; model.ApprovalName = model.CreateUserName; var rows = DataOperateBusiness <Epm_TzDesiginChangeApply> .Get().Add(model); result.Data = rows; result.Flag = EResultFlag.Success; //WriteLog(AdminModule.TzDesiginChangeApply.GetText(), SystemRight.Add.GetText(), "新增: " + model.Id); } catch (Exception ex) { result.Data = -1; result.Flag = EResultFlag.Failure; result.Exception = new ExceptionEx(ex, "AddTzDesiginChangeApply"); } return(result); }