using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Mvc;
|
using WIDESEA_Core;
|
using WIDESEA_Core.BaseController;
|
using WIDESEA_DTO.Stock;
|
using WIDESEA_ITaskInfoService;
|
using WIDESEA_Model.Models;
|
|
namespace WIDESEA_WMSServer.Controllers.TaskInfo
|
{
|
/// <summary>
|
/// 任务历史
|
/// </summary>
|
[Route("api/Task_Hty")]
|
[ApiController]
|
public class Task_HtyController : ApiBaseController<ITask_HtyService, Dt_Task_Hty>
|
{
|
public Task_HtyController(ITask_HtyService service) : base(service)
|
{
|
}
|
|
/// <summary>
|
/// 删除旧的历史任务数据
|
/// </summary>
|
/// <param name="keepMonths">保留的月数,默认为3个月(本月+后两个月)</param>
|
/// <returns>删除的记录数</returns>
|
[HttpGet, Route("DeleteOldHistory")]
|
[AllowAnonymous]
|
public IActionResult DeleteOldHistory(int keepMonths = 3)
|
{
|
try
|
{
|
int result = Service.DeleteOldTaskHistory(keepMonths);
|
return Ok(new { Success = true, Message = "历史任务删除成功", DeletedCount = result });
|
}
|
catch (Exception ex)
|
{
|
return Ok(new { Success = false, Message = "历史任务删除失败: " + ex.Message });
|
}
|
}
|
}
|
}
|