public ActionResult Add(SupervisorLogView model) { ResultView <int> view = new ResultView <int>(); model.CrtCompanyId = CurrentUser.UserId; model.CrtCompanyName = CurrentUser.UserName; var ProjectIds = model.ProjectId.Value; var CompanyNames = model.CrtCompanyName; //表单校验 if (string.IsNullOrEmpty(model.ProjectName)) { view.Flag = false; view.Message = "请选择监理日志所属项目!"; return(Json(view)); } //施工单位 string builder = Request.Form["Builder"]; if (string.IsNullOrWhiteSpace(builder)) { view.Flag = false; view.Message = "请填写现场施工单位情况!"; return(Json(view)); } string jsonData = JsonConvert.SerializeObject(null); List <LogAtillsoners> workCompanys = JsonConvert.DeserializeObject <List <LogAtillsoners> >(builder); if (workCompanys == null || !workCompanys.Any()) { view.Flag = false; view.Message = "请填写现场施工单位情况!"; return(Json(view)); } foreach (var item in workCompanys) { Epm_SupervisorLogCompany com = new Epm_SupervisorLogCompany(); com.CompanyId = item.companyId.Value; //供应商ID com.CompanyName = item.companyName; //供应商姓名 com.ManagerName = item.managerName; //姓名 Epm_ProjectlLogName projectlLogName = new Epm_ProjectlLogName(); try { projectlLogName.personid = item.ManagerId.Value; } catch (Exception ex) { } projectlLogName.name = item.managerName; projectlLogName.type = item.workPeopleTypeName; com.ProjectlLogName.Add(projectlLogName); Epm_AttendanceList attendanceList = new Epm_AttendanceList(); attendanceList.bepresent = item.bepresent; attendanceList.name = item.managerName; attendanceList.permit = item.permit; attendanceList.workPeopleTypeName = item.workPeopleTypeName; com.AttendanceList.Add(attendanceList); model.SupervisorLogCompanys.Add(com); } //上传附件 string fileDataJson = Request.Form["fileDataJson"];//获取上传文件json字符串 if (!string.IsNullOrEmpty(fileDataJson)) { model.Attachs = JsonConvert.DeserializeObject <List <Base_Files> >(fileDataJson);//将文件信息json字符 } else { view.Flag = false; view.Message = "请上传附件!"; return(Json(view)); } string fileDataJsonFile = Request.Form["fileDataJsonWorkId"]; if (!string.IsNullOrEmpty(fileDataJsonFile)) { List <WorkView> workViewList = JsonConvert.DeserializeObject <List <WorkView> >(fileDataJsonFile); List <WorkUploadRealSceneView> sceneList = new List <WorkUploadRealSceneView>(); if (workViewList.Count > 0) { foreach (var item in workViewList) { if (item.Type == 2 && item.workFile == "[]") { view.Flag = false; view.Message = "请上传作业实景!"; return(Json(view)); } else { WorkUploadRealSceneView scene = new WorkUploadRealSceneView(); if (item.Type == 1) { scene.Id = item.Id; scene.Type = item.Type; scene.Attachs = null; } else { scene.Id = item.Id; scene.Type = item.Type; scene.Attachs = JsonConvert.DeserializeObject <List <Base_Files> >(item.workFile); } sceneList.Add(scene); } } model.SenceList = sceneList; } } Result <int> result = new Result <int>(); using (ClientSiteClientProxy proxy = new ClientSiteClientProxy(ProxyEx(Request))) { model.SubmitTime = DateTime.Now; result = proxy.AddSupervisorLogNew(model, null); } return(Json(result.ToResultView())); }