78 lines
2.6 KiB
C#
Raw Normal View History

2025-08-29 13:09:14 +08:00
using DOAN.Admin.WebApi.Filters;
2025-09-05 11:44:50 +08:00
using DOAN.Model;
2025-09-05 11:38:27 +08:00
using DOAN.Model.MES.product.Dto;
2025-08-29 13:09:14 +08:00
using DOAN.Service.MES.group.IService;
using DOAN.Service.MES.product;
using DOAN.Service.MES.product.IService;
using Microsoft.AspNetCore.Mvc;
namespace DOAN.WebApi.Controllers.MES.product
{
[Verify]
[Route("mes/productManagement/ProReportwork")]
public class ProweekplanManageController : BaseController
{
/// <summary>
/// 周计划表接口
/// </summary>
private readonly IProweekplanManageService _proweekplanManageService;
public ProweekplanManageController(IProweekplanManageService proweekplanManageService)
{
_proweekplanManageService = proweekplanManageService;
}
2025-09-05 11:45:11 +08:00
//TODO 查询计划列表 年周零件号
[HttpPost("searchWeekplan")]
[Log(Title = "查询计划列表 年周零件号", BusinessType = BusinessType.EXPORT, IsSaveRequestData = true, IsSaveResponseData = false)]
public IActionResult SearchWeekplan([FromBody] WeekplanQueryDto weekplanQuery)
{
PagedInfo<ProWeeklyPlanAndDateDto> result = _proweekplanManageService.SearchWeekplan(weekplanQuery);
return SUCCESS(result);
}
2025-08-29 13:09:14 +08:00
//TODO excel导入计划
/// <summary>
/// 导入周计划
/// </summary>
/// <param name="formFile">使用IFromFile必须使用name属性否则获取不到文件</param>
/// <returns>导入成功数 若-1 则excel读取异常</returns>
[HttpPost("importWeekplan")]
[Log(Title = "生产工单导入", BusinessType = BusinessType.IMPORT, IsSaveRequestData = false, IsSaveResponseData = true)]
[AllowAnonymous]
public IActionResult ImportData([FromForm(Name = "file")] IFormFile formFile)
{
if (formFile == null)
{
return SUCCESS(null);
}
2025-09-05 11:44:50 +08:00
int result = _proweekplanManageService.ImportExcel(formFile, HttpContext.GetName());
2025-08-29 13:09:14 +08:00
2025-09-05 11:44:50 +08:00
return SUCCESS(result);
2025-08-29 13:09:14 +08:00
}
//TODO 导出模板
/// <summary>
/// 生产工单导入模板下载 workorder 启用9/14
/// </summary>
/// <returns></returns>
[HttpGet("importTemplate")]
[Log(Title = "生产周计划导入模板", BusinessType = BusinessType.EXPORT, IsSaveRequestData = true, IsSaveResponseData = false)]
[AllowAnonymous]
public IActionResult ImportTemplateExcel()
{
(string, string) result = DownloadImportTemplate("weekplan");
return ExportExcel(result.Item2, result.Item1);
}
}
}