123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- using Infrastructure;
- using Infrastructure.Attribute;
- using Infrastructure.Enums;
- using Infrastructure.Model;
- using Mapster;
- using Microsoft.AspNetCore.Mvc;
- using ZR.Model.Dto;
- using ZR.Model.Models;
- using ZR.Service.Business.IBusinessService;
- using ZR.Admin.WebApi.Extensions;
- using ZR.Admin.WebApi.Filters;
- using ZR.Common;
- namespace ZR.Admin.WebApi.Controllers
- {
- /// <summary>
- /// 入库管理/退料记录表Controller
- ///
- /// @tableName in_retreat_record
- /// @author admin
- /// @date 2023-04-14
- /// </summary>
- [Verify]
- [Route("business/InRetreatRecord")]
- public class InRetreatRecordController : BaseController
- {
- /// <summary>
- /// 入库管理/退料记录表接口
- /// </summary>
- private readonly IInRetreatRecordService _InRetreatRecordService;
- public InRetreatRecordController(IInRetreatRecordService InRetreatRecordService)
- {
- _InRetreatRecordService = InRetreatRecordService;
- }
- /// <summary>
- /// 查询入库管理/退料记录表列表
- /// </summary>
- /// <param name="parm"></param>
- /// <returns></returns>
- [HttpGet("list")]
- [ActionPermissionFilter(Permission = "business:inretreatrecord:list")]
- public IActionResult QueryInRetreatRecord([FromQuery] InRetreatRecordQueryDto parm)
- {
- var response = _InRetreatRecordService.GetList(parm);
- return SUCCESS(response);
- }
- /// <summary>
- /// 查询入库管理/退料记录表详情
- /// </summary>
- /// <param name="RetreatId"></param>
- /// <returns></returns>
- [HttpGet("{RetreatId}")]
- [ActionPermissionFilter(Permission = "business:inretreatrecord:query")]
- public IActionResult GetInRetreatRecord(int RetreatId)
- {
- var response = _InRetreatRecordService.GetFirst(x => x.RetreatId == RetreatId);
- return SUCCESS(response);
- }
- /// <summary>
- /// 添加入库管理/退料记录表
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- [ActionPermissionFilter(Permission = "business:inretreatrecord:add")]
- [Log(Title = "入库管理/退料记录表", BusinessType = BusinessType.INSERT)]
- public IActionResult AddInRetreatRecord([FromBody] InRetreatRecordDto parm)
- {
- if (parm == null)
- {
- throw new CustomException("请求参数错误");
- }
- var modal = parm.Adapt<InRetreatRecord>().ToCreate(HttpContext);
- var response = _InRetreatRecordService.AddInRetreatRecord(modal);
- return ToResponse(response);
- }
- /// <summary>
- /// 更新入库管理/退料记录表
- /// </summary>
- /// <returns></returns>
- [HttpPut]
- [ActionPermissionFilter(Permission = "business:inretreatrecord:edit")]
- [Log(Title = "入库管理/退料记录表", BusinessType = BusinessType.UPDATE)]
- public IActionResult UpdateInRetreatRecord([FromBody] InRetreatRecordDto parm)
- {
- if (parm == null)
- {
- throw new CustomException("请求实体不能为空");
- }
- var modal = parm.Adapt<InRetreatRecord>().ToUpdate(HttpContext);
- var response = _InRetreatRecordService.UpdateInRetreatRecord(modal);
- return ToResponse(response);
- }
- /// <summary>
- /// 删除入库管理/退料记录表
- /// </summary>
- /// <returns></returns>
- [HttpDelete("{ids}")]
- [ActionPermissionFilter(Permission = "business:inretreatrecord:delete")]
- [Log(Title = "入库管理/退料记录表", BusinessType = BusinessType.DELETE)]
- public IActionResult DeleteInRetreatRecord(string ids)
- {
- int[] idsArr = Tools.SpitIntArrary(ids);
- if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
- var response = _InRetreatRecordService.Delete(idsArr);
- return ToResponse(response);
- }
- }
- }
|