101 lines
3.9 KiB
C#
101 lines
3.9 KiB
C#
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/TLOut")]
|
||
public class TLOutController : AuthorizeApiController<T_TL_OUT>
|
||
{
|
||
IFMFlowPermitService MFlowPermitService { get; set; }
|
||
IFMNotificationTaskService NotificationTaskService { get; set; }
|
||
public TLOutController(IFMFlowPermitService mFlowPermitService, IFMNotificationTaskService notificationTaskService)
|
||
{
|
||
MFlowPermitService = mFlowPermitService;
|
||
NotificationTaskService = notificationTaskService;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 附件上传
|
||
/// 设计文件专家评审意见
|
||
/// </summary>
|
||
/// <param name="entity"></param>
|
||
/// <returns></returns>
|
||
[HttpPost, Route("FullUpdate")]
|
||
public JsonActionResult<bool> FullUpdate([FromBody] T_TL_OUT entity)
|
||
{
|
||
return SafeExecute<bool>(() =>
|
||
{
|
||
var files = entity.Nav_Files;//附件
|
||
entity.Nav_Files = null;
|
||
T_TL_TAILING Tailing = 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 (entity.TAILING_ID != null)
|
||
{
|
||
Tailing = GetEntity<T_TL_TAILING>(entity.TAILING_ID.Value);
|
||
if (Tailing != null)
|
||
{
|
||
if (Tailing.STATE == TailingState.ReEnd || Tailing.STATE == TailingState.End)
|
||
{
|
||
throw new Exception("操作失败,该尾矿库状态已经为" + Tailing.STATE.GetDescription() + "!");
|
||
}
|
||
else
|
||
{
|
||
if (Tailing.STATE == TailingState.Using)
|
||
{
|
||
Tailing.STATE = TailingState.End;
|
||
}
|
||
else
|
||
{
|
||
Tailing.STATE = TailingState.ReEnd;
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
throw new Exception("获取尾矿库失败!");
|
||
}
|
||
}
|
||
if (files == null || !files.Any())
|
||
{
|
||
throw new Exception("请上传安全设施竣工验收记录!");
|
||
}
|
||
}
|
||
|
||
entity.Nav_Tailing = null;
|
||
this.UnifiedCommit(() =>
|
||
{
|
||
if (entity != null)
|
||
UpdateEntityNoCommit(entity);
|
||
if (files != null && files.Any())//附件
|
||
BantchSaveEntityNoCommit(files);
|
||
if (Tailing != null)
|
||
UpdateEntityNoCommit(Tailing);
|
||
});
|
||
return true;
|
||
});
|
||
}
|
||
}
|
||
} |