using APT.BaseData.Domain.Entities; using APT.BaseData.Domain.Entities.FM; using APT.BaseData.Domain.Enums.PF; using APT.BaseData.Domain.IServices; using APT.BaseData.Domain.IServices.FM; using APT.Infrastructure.Core; using APT.MS.Domain.Entities.TL; using APT.MS.Domain.Enums; using APT.Utility; using Microsoft.AspNetCore.Mvc; using System; using System.Collections.Generic; using System.Linq; namespace APT.SC.WebApi.Controllers.Api.SC { [Route("api/TL/TLProjectSlopebank")] public class TLProjectSlopebankController : AuthorizeApiController { //IFMFlowPermitService MFlowPermitService { get; set; } //IFMNotificationTaskService NotificationTaskService { get; set; } //public TLProjectSlopebankController(IFMFlowPermitService mFlowPermitService, IFMNotificationTaskService notificationTaskService) //{ // MFlowPermitService = mFlowPermitService; // NotificationTaskService = notificationTaskService; //} /// /// 附件上传 /// 设计文件专家评审意见 /// /// /// [HttpPost, Route("FullUpdate")] public JsonActionResult FullUpdate([FromBody] T_TL_PROJECT_SLOPEBANK entity) { return SafeExecute(() => { var files = entity.Nav_Files;//附件 entity.Nav_Files = null; var filesProj = entity.Nav_Files_Proj;//监理记录 entity.Nav_Files_Proj = null; var filesSub = entity.Nav_Files_Sub;//验收记录 entity.Nav_Files_Sub = null; if (entity.USER_ID == Guid.Empty) { entity.USER_ID = APT.Infrastructure.Api.AppContext.CurrentSession.UserID.Value; entity.DEPARTMENT_ID = APT.Infrastructure.Api.AppContext.CurrentSession.DepartmentID; } if (entity.USER_ID != APT.Infrastructure.Api.AppContext.CurrentSession.UserID.Value) { throw new Exception("只能操作自己提交的记录!"); } if (entity.STATUS == PFStandardStatus.Archived) { if (string.IsNullOrEmpty(entity.NAMESUB)) { throw new Exception("请输入子坝名称!"); } if (entity.COUNTNUM == 0) { throw new Exception("请输入期数!"); } if (!entity.RESULT.HasValue) { throw new Exception("请选择冲刷情况!"); } } entity.Nav_Tailing = null; this.UnifiedCommit(() => { if (entity != null) UpdateEntityNoCommit(entity); if (files != null && files.Any())//附件 BantchSaveEntityNoCommit(files); if (filesProj != null && filesProj.Any())//附件 BantchSaveEntityNoCommit(filesProj); if (filesSub != null && filesSub.Any())//附件 BantchSaveEntityNoCommit(filesSub); }); return true; }); } } }