2025-03-31 15:56:38 +08:00

119 lines
4.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Microsoft.AspNetCore.Mvc;
using DOAN.Admin.WebApi.Filters;
using DOAN.Model.MES.mm.line;
using DOAN.Model.MES.mm.line.Dto;
using DOAN.Service.MES.mm.line.IService;
//创建时间2025-03-21
namespace DOAN.WebApi.Controllers.MES.mm.line
{
/// <summary>
/// mm_line_inventory
/// </summary>
[Verify]
[Route("mes/materialManagement/MmLineInventory")]
public class MmLineInventoryController : BaseController
{
/// <summary>
/// mm_line_inventory接口
/// </summary>
private readonly IMmLineInventoryService _MmLineInventoryService;
public MmLineInventoryController(IMmLineInventoryService MmLineInventoryService)
{
_MmLineInventoryService = MmLineInventoryService;
}
/// <summary>
/// 查询mm_line_inventory列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
[HttpGet("list")]
[ActionPermissionFilter(Permission = "business:mmlineinventory:list")]
public IActionResult QueryMmLineInventory([FromQuery] MmLineInventoryQueryDto parm)
{
var response = _MmLineInventoryService.GetList(parm);
return SUCCESS(response);
}
/// <summary>
/// 查询mm_line_inventory详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
[HttpGet("{Id}")]
[ActionPermissionFilter(Permission = "business:mmlineinventory:query")]
public IActionResult GetMmLineInventory(string Id)
{
var response = _MmLineInventoryService.GetInfo(Id);
var info = response.Adapt<MmLineInventory>();
return SUCCESS(info);
}
/// <summary>
/// 添加mm_line_inventory
/// </summary>
/// <returns></returns>
[HttpPost]
[ActionPermissionFilter(Permission = "business:mmlineinventory:add")]
[Log(Title = "mm_line_inventory", BusinessType = BusinessType.INSERT)]
public IActionResult AddMmLineInventory([FromBody] MmLineInventoryDto parm)
{
var modal = parm.Adapt<MmLineInventory>().ToCreate(HttpContext);
var response = _MmLineInventoryService.AddMmLineInventory(modal);
return SUCCESS(response);
}
/// <summary>
/// 更新mm_line_inventory
/// </summary>
/// <returns></returns>
[HttpPut]
[ActionPermissionFilter(Permission = "business:mmlineinventory:edit")]
[Log(Title = "mm_line_inventory", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateMmLineInventory([FromBody] MmLineInventoryDto parm)
{
var modal = parm.Adapt<MmLineInventory>().ToUpdate(HttpContext);
var response = _MmLineInventoryService.UpdateMmLineInventory(modal);
return ToResponse(response);
}
/// <summary>
/// 删除mm_line_inventory
/// </summary>
/// <returns></returns>
[HttpDelete("{ids}")]
[ActionPermissionFilter(Permission = "business:mmlineinventory:delete")]
[Log(Title = "mm_line_inventory", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteMmLineInventory(string ids)
{
string[] idsArr = Tools.SpitStrArrary(ids);
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
var response = _MmLineInventoryService.Delete(idsArr);
return ToResponse(response);
}
/// <summary>
/// 盘点
/// </summary>
/// <returns></returns>
[HttpGet("stocktakeLineMaterial")]
[AllowAnonymous]
public IActionResult putInLineMaterial([FromQuery] string Id, decimal newStocktakingNum)
{
var response = _MmLineInventoryService.stocktakeLineMaterial(Id, newStocktakingNum);
var info = response.Adapt<MmLineInventory>();
return SUCCESS(info);
}
}
}