using DOAN.Admin.WebApi.Filters;
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
{
///
/// 周计划表接口
///
private readonly IProweekplanManageService _proweekplanManageService;
public ProweekplanManageController(IProweekplanManageService proweekplanManageService)
{
_proweekplanManageService = proweekplanManageService;
}
//TODO excel导入计划
///
/// 导入周计划
///
/// 使用IFromFile必须使用name属性否则获取不到文件
/// 导入成功数 若-1 则excel读取异常
[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);
}
int response = _proweekplanManageService.ImportExcel(formFile, HttpContext.GetName());
return SUCCESS(response);
}
//TODO 导出模板
///
/// 生产工单导入模板下载 workorder 启用(9/14)
///
///
[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);
}
//TODO 查询计划列表 年周零件号
}
}