| 123456789101112131415161718192021222324252627282930313233343536373839 |
- using Admin.NET.Plugin.AiDOP.Dto.S8;
- using Admin.NET.Plugin.AiDOP.Service.S8;
- namespace Admin.NET.Plugin.AiDOP.Controllers.S8;
- [ApiController]
- [Route("api/aidop/s8/reports")]
- [NonUnify]
- public class AdoS8ReportsController : ControllerBase
- {
- private readonly S8ManualReportService _svc;
- public AdoS8ReportsController(S8ManualReportService svc) => _svc = svc;
- [HttpGet("form-options")]
- public async Task<IActionResult> FormOptionsAsync([FromQuery] long tenantId = 1, [FromQuery] long factoryId = 1) =>
- Ok(await _svc.GetFormOptionsAsync(tenantId, factoryId));
- [HttpPost]
- public async Task<IActionResult> CreateAsync([FromBody] AdoS8ManualReportCreateDto dto)
- {
- try { return Ok(await _svc.CreateAsync(dto)); }
- catch (S8BizException ex) { return BadRequest(new { message = ex.Message }); }
- }
- [HttpGet("{id:long}")]
- public async Task<IActionResult> GetAsync(long id)
- {
- var e = await _svc.GetAsync(id);
- return e == null ? NotFound() : Ok(e);
- }
- [HttpPost("{id:long}/attachments")]
- public async Task<IActionResult> AttachmentsAsync(long id, [FromBody] AdoS8AttachmentCreateDto dto)
- {
- try { return Ok(await _svc.AddAttachmentAsync(id, dto)); }
- catch (S8BizException ex) { return BadRequest(new { message = ex.Message }); }
- }
- }
|