2024-05-28 11:29:50 +08:00
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
2024-06-03 18:26:07 +08:00
|
|
|
|
using ZR.Service.MES.dev.IService;
|
|
|
|
|
|
using ZR.Model.MES.dev.Dto;
|
2024-05-28 11:29:50 +08:00
|
|
|
|
using ZR.Admin.WebApi.Filters;
|
|
|
|
|
|
using ZR.Model.MES.dev.Dto;
|
|
|
|
|
|
using ZR.Model.MES.dev;
|
|
|
|
|
|
|
|
|
|
|
|
//创建时间:2024-05-28
|
|
|
|
|
|
namespace ZR.Admin.WebApi.Controllers
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 报修单
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[Verify]
|
|
|
|
|
|
[Route("business/DeviceRepair")]
|
|
|
|
|
|
public class DeviceRepairController : BaseController
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 报修单接口
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private readonly IDeviceRepairService _DeviceRepairService;
|
|
|
|
|
|
|
|
|
|
|
|
public DeviceRepairController(IDeviceRepairService DeviceRepairService)
|
|
|
|
|
|
{
|
|
|
|
|
|
_DeviceRepairService = DeviceRepairService;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 查询报修单列表
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="parm"></param>
|
|
|
|
|
|
/// <returns></returns>
|
2024-06-17 10:38:03 +08:00
|
|
|
|
[HttpPost("list")]
|
2024-05-28 11:29:50 +08:00
|
|
|
|
[ActionPermissionFilter(Permission = "business:devicerepair:list")]
|
2024-06-17 10:38:03 +08:00
|
|
|
|
public IActionResult QueryDeviceRepair([FromBody] DeviceRepairQueryDto parm)
|
2024-05-28 11:29:50 +08:00
|
|
|
|
{
|
|
|
|
|
|
var response = _DeviceRepairService.GetList(parm);
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 查询报修单详情
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="Id"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet("{Id}")]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "business:devicerepair:query")]
|
|
|
|
|
|
public IActionResult GetDeviceRepair(string Id)
|
|
|
|
|
|
{
|
|
|
|
|
|
var response = _DeviceRepairService.GetInfo(Id);
|
|
|
|
|
|
|
|
|
|
|
|
var info = response.Adapt<DeviceRepair>();
|
|
|
|
|
|
return SUCCESS(info);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 添加报修单
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "business:devicerepair:add")]
|
|
|
|
|
|
[Log(Title = "报修单", BusinessType = BusinessType.INSERT)]
|
|
|
|
|
|
public IActionResult AddDeviceRepair([FromBody] DeviceRepairDto parm)
|
|
|
|
|
|
{
|
|
|
|
|
|
var modal = parm.Adapt<DeviceRepair>().ToCreate(HttpContext);
|
|
|
|
|
|
|
|
|
|
|
|
var response = _DeviceRepairService.AddDeviceRepair(modal);
|
|
|
|
|
|
|
|
|
|
|
|
return SUCCESS(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 更新报修单
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpPut]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "business:devicerepair:edit")]
|
|
|
|
|
|
[Log(Title = "报修单", BusinessType = BusinessType.UPDATE)]
|
|
|
|
|
|
public IActionResult UpdateDeviceRepair([FromBody] DeviceRepairDto parm)
|
|
|
|
|
|
{
|
|
|
|
|
|
var modal = parm.Adapt<DeviceRepair>().ToUpdate(HttpContext);
|
|
|
|
|
|
var response = _DeviceRepairService.UpdateDeviceRepair(modal);
|
|
|
|
|
|
|
|
|
|
|
|
return ToResponse(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 删除报修单
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpDelete("{ids}")]
|
|
|
|
|
|
[ActionPermissionFilter(Permission = "business:devicerepair:delete")]
|
|
|
|
|
|
[Log(Title = "报修单", BusinessType = BusinessType.DELETE)]
|
|
|
|
|
|
public IActionResult DeleteDeviceRepair(string ids)
|
|
|
|
|
|
{
|
|
|
|
|
|
string[] idsArr = ids.Split(',');
|
|
|
|
|
|
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
|
|
|
|
|
|
|
|
|
|
|
var response = _DeviceRepairService.Delete(idsArr);
|
|
|
|
|
|
|
|
|
|
|
|
return ToResponse(response);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|