81 lines
3.3 KiB
C#
81 lines
3.3 KiB
C#
|
|
using APT.BaseData.Domain.Entities;
|
|||
|
|
using APT.BaseData.Domain.Entities.FM;
|
|||
|
|
using APT.BaseData.Domain.Enums.PF;
|
|||
|
|
using APT.BaseData.Domain.IServices.FM;
|
|||
|
|
using APT.Infrastructure.Core;
|
|||
|
|
using APT.MS.Domain.Entities.FO;
|
|||
|
|
using APT.MS.Domain.Entities.LR;
|
|||
|
|
using APT.MS.Domain.Entities.WB;
|
|||
|
|
using APT.MS.Domain.Enums;
|
|||
|
|
using APT.Utility;
|
|||
|
|
using Castle.Core.Internal;
|
|||
|
|
using InfluxData.Net.InfluxDb.Models.Responses;
|
|||
|
|
using Microsoft.AspNetCore.Mvc;
|
|||
|
|
using Microsoft.CodeAnalysis.Differencing;
|
|||
|
|
using NPOI.SS.Formula.Functions;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
|
|||
|
|
namespace APT.SC.WebApi.Controllers.Api.WB
|
|||
|
|
{
|
|||
|
|
[Route("api/WB/WBSafeCheck")]
|
|||
|
|
public class WBSafeCheckController : AuthorizeApiController<T_WB_SAFE_CHECK>
|
|||
|
|
{
|
|||
|
|
IFMNotificationTaskService NotificationTaskService { get; set; }
|
|||
|
|
public WBSafeCheckController(IFMNotificationTaskService notificationTaskService)
|
|||
|
|
{
|
|||
|
|
NotificationTaskService = notificationTaskService;
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 保存
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="id"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpPost, Route("FullUpdate")]
|
|||
|
|
public JsonActionResult<bool> FullUpdate([FromBody] T_WB_SAFE_CHECK entity)
|
|||
|
|
{
|
|||
|
|
return SafeExecute(() =>
|
|||
|
|
{
|
|||
|
|
T_FM_NOTIFICATION_TASK finishNotice = null;
|
|||
|
|
T_FM_NOTIFICATION_TASK sendNotice = null;
|
|||
|
|
var Nav_Files = entity.Nav_Files;
|
|||
|
|
var Nav_Photos = entity.Nav_Photos;
|
|||
|
|
|
|||
|
|
entity.Nav_Photos = null;
|
|||
|
|
entity.Nav_Files = null;
|
|||
|
|
|
|||
|
|
if (entity.PUBLISH != null && entity.PUBLISH.Equals("SaveAndNotify"))
|
|||
|
|
{
|
|||
|
|
if (Nav_Files == null || Nav_Files.Count() < 1)
|
|||
|
|
{
|
|||
|
|
throw new Exception("必须上传检查附件");
|
|||
|
|
}
|
|||
|
|
entity.STATUS = PFStandardStatus.Archived;
|
|||
|
|
var project = GetEntity<T_WB_PROJECT_INPUT>(t => t.ID == entity.PROJECT_ID);
|
|||
|
|
var user = GetEntity<T_FM_USER>(t => t.ID == project.SCENE_USER_ID);
|
|||
|
|
entity.STATUS = PFStandardStatus.Approving;
|
|||
|
|
sendNotice = NotificationTaskService.InsertUserNoticeTaskModel("外包单位安全检查记录-审阅", entity.ID, entity.ORG_ID, user.ID, user.NAME, DateTime.Now, DateTime.Now.AddDays(7), 1, "WB027_SHOWPRINT");
|
|||
|
|
if (entity.TaskID != null && entity.TaskID != Guid.Empty)
|
|||
|
|
{
|
|||
|
|
finishNotice = NotificationTaskService.FOGetTaskFinishModel(entity.TaskID, entity.ID, "WB027_SHOWPRINT");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
UnifiedCommit(() =>
|
|||
|
|
{
|
|||
|
|
UpdateEntity(entity);
|
|||
|
|
if (Nav_Files != null && Nav_Files.Any())
|
|||
|
|
BantchSaveEntityNoCommit(Nav_Files);
|
|||
|
|
if (Nav_Photos != null && Nav_Photos.Any())
|
|||
|
|
BantchSaveEntityNoCommit(Nav_Photos);
|
|||
|
|
if (sendNotice != null)
|
|||
|
|
AddEntityNoCommit(sendNotice);
|
|||
|
|
if (finishNotice != null)
|
|||
|
|
UpdateEntityNoCommit(finishNotice);
|
|||
|
|
});
|
|||
|
|
return true;
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|