zhuangpei-mesbackend/DOAN.Admin.WebApi/Controllers/MES/dev/Parts/DevicePartsInventoryController.cs

136 lines
4.7 KiB
C#
Raw Normal View History

2024-12-30 11:31:40 +08:00
using Microsoft.AspNetCore.Mvc;
using DOAN.Model.Dto;
using DOAN.Admin.WebApi.Filters;
using DOAN.Model.MES.dev;
using DOAN.Model.MES.dev.Dto;
using DOAN.Service.MES.dev.IService;
//创建时间2024-12-30
namespace DOAN.Admin.WebApi.Controllers
{
/// <summary>
/// 库存信息表
/// </summary>
[Verify]
[Route("mes/deviceManagement/Parts/DevicePartsInventory")]
public class DevicePartsInventoryController : BaseController
{
/// <summary>
/// 库存信息表接口
/// </summary>
private readonly IDevicePartsInventoryService _DevicePartsInventoryService;
public DevicePartsInventoryController(IDevicePartsInventoryService DevicePartsInventoryService)
{
_DevicePartsInventoryService = DevicePartsInventoryService;
}
/// <summary>
/// 查询库存信息表列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
[HttpGet("list")]
[ActionPermissionFilter(Permission = "deviceManagement:devicepartsinventory:list")]
public IActionResult QueryDevicePartsInventory([FromQuery] DevicePartsInventoryQueryDto parm)
{
var response = _DevicePartsInventoryService.GetList(parm);
return SUCCESS(response);
}
/// <summary>
/// 查询库存信息表详情
/// </summary>
/// <param name="InventoryId"></param>
/// <returns></returns>
[HttpGet("{InventoryId}")]
[ActionPermissionFilter(Permission = "deviceManagement:devicepartsinventory:query")]
public IActionResult GetDevicePartsInventory(int InventoryId)
{
var response = _DevicePartsInventoryService.GetInfo(InventoryId);
var info = response.Adapt<DevicePartsInventory>();
return SUCCESS(info);
}
/// <summary>
/// 添加库存信息表
/// </summary>
/// <returns></returns>
[HttpPost]
[ActionPermissionFilter(Permission = "deviceManagement:devicepartsinventory:add")]
[Log(Title = "库存信息表", BusinessType = BusinessType.INSERT)]
public IActionResult AddDevicePartsInventory([FromBody] DevicePartsInventoryDto parm)
{
var modal = parm.Adapt<DevicePartsInventory>().ToCreate(HttpContext);
var response = _DevicePartsInventoryService.AddDevicePartsInventory(modal);
return SUCCESS(response);
}
/// <summary>
/// 更新库存信息表
/// </summary>
/// <returns></returns>
[HttpPut]
[ActionPermissionFilter(Permission = "deviceManagement:devicepartsinventory:edit")]
[Log(Title = "库存信息表", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateDevicePartsInventory([FromBody] DevicePartsInventoryDto parm)
{
var modal = parm.Adapt<DevicePartsInventory>().ToUpdate(HttpContext);
var response = _DevicePartsInventoryService.UpdateDevicePartsInventory(modal);
return ToResponse(response);
}
/// <summary>
/// 删除库存信息表
/// </summary>
/// <returns></returns>
[HttpDelete("{ids}")]
[ActionPermissionFilter(Permission = "deviceManagement:devicepartsinventory:delete")]
[Log(Title = "库存信息表", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteDevicePartsInventory(string ids)
{
int[] idsArr = Tools.SpitIntArrary(ids);
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
var response = _DevicePartsInventoryService.Delete(idsArr);
return ToResponse(response);
}
2024-12-30 15:25:40 +08:00
//TODO 入库
[HttpPost("entryInventory")]
public IActionResult EntryInventory([FromBody] DevicePartsInventoryDto parm)
{
2024-12-30 16:20:01 +08:00
var response = _DevicePartsInventoryService.EntryInventory(parm,HttpContext.GetNickName(),parm.SupplierId);
2024-12-30 15:25:40 +08:00
return SUCCESS(response);
}
//TODO 出库
[HttpPost("OutInventory")]
public IActionResult OutInventory([FromBody] DevicePartsInventoryDto parm)
{
2024-12-30 16:20:01 +08:00
var response = _DevicePartsInventoryService.OutInventory(parm,HttpContext.GetNickName());
2024-12-30 15:25:40 +08:00
return SUCCESS(response);
}
//TODO 盘点
[HttpPost("CheckInventory")]
public IActionResult CheckInventory([FromBody] DevicePartsInventoryDto parm)
{
2024-12-30 16:20:01 +08:00
var response = _DevicePartsInventoryService.CheckInventory(parm,HttpContext.GetNickName());
2024-12-30 15:25:40 +08:00
return SUCCESS(response);
}
2024-12-30 11:31:40 +08:00
}
}