using Microsoft.AspNetCore.Mvc;
using ZR.Admin.WebApi.Extensions;
using ZR.Admin.WebApi.Filters;
using ZR.Model.MES.wms;
using ZR.Model.MES.wms.Dto;
using ZR.Service.Business.IBusinessService;
//创建时间:2024-03-26
namespace ZR.Admin.WebApi.Controllers
{
///
/// 盘点记录
///
[Verify]
[Route("/mes/wm//WmCheckLog")]
public class WmCheckLogController : BaseController
{
///
/// 盘点记录接口
///
private readonly IWmCheckLogService _WmCheckLogService;
public WmCheckLogController(IWmCheckLogService WmCheckLogService)
{
_WmCheckLogService = WmCheckLogService;
}
///
/// 查询盘点记录列表
///
///
///
[HttpGet("list")]
[ActionPermissionFilter(Permission = "business:wmchecklog:list")]
public IActionResult QueryWmCheckLog([FromQuery] WmCheckLogQueryDto parm)
{
var response = _WmCheckLogService.GetList(parm);
return SUCCESS(response);
}
///
/// 查询盘点记录详情
///
///
///
[HttpGet("{Id}")]
[ActionPermissionFilter(Permission = "business:wmchecklog:query")]
public IActionResult GetWmCheckLog(int Id)
{
var response = _WmCheckLogService.GetInfo(Id);
var info = response.Adapt();
return SUCCESS(info);
}
///
/// 添加盘点记录
///
///
[HttpPost]
[ActionPermissionFilter(Permission = "business:wmchecklog:add")]
[Log(Title = "盘点记录", BusinessType = BusinessType.INSERT)]
public IActionResult AddWmCheckLog([FromBody] WmCheckLogDto parm)
{
var modal = parm.Adapt().ToCreate(HttpContext);
var response = _WmCheckLogService.AddWmCheckLog(modal);
return SUCCESS(response);
}
///
/// 更新盘点记录
///
///
[HttpPut]
[ActionPermissionFilter(Permission = "business:wmchecklog:edit")]
[Log(Title = "盘点记录", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateWmCheckLog([FromBody] WmCheckLogDto parm)
{
var modal = parm.Adapt().ToUpdate(HttpContext);
var response = _WmCheckLogService.UpdateWmCheckLog(modal);
return ToResponse(response);
}
///
/// 删除盘点记录
///
///
[HttpDelete("{ids}")]
[ActionPermissionFilter(Permission = "business:wmchecklog:delete")]
[Log(Title = "盘点记录", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteWmCheckLog(string ids)
{
int[] idsArr = Tools.SpitIntArrary(ids);
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
var response = _WmCheckLogService.Delete(idsArr);
return ToResponse(response);
}
}
}