Files
kunshan-bzfm-mes-backend/DOAN.Admin.WebApi/Controllers/MES/Material/productionMaterial/MmInventoryController.cs

194 lines
5.8 KiB
C#
Raw Normal View History

using Microsoft.AspNetCore.Mvc;
using DOAN.Model.BZFM.Dto;
using DOAN.Model.BZFM;
using DOAN.Service.BZFM.IBZFMService;
using DOAN.Admin.WebApi.Filters;
//创建时间2025-12-24
namespace DOAN.Admin.WebApi.Controllers.BZFM
{
/// <summary>
/// 库存表
/// </summary>
[Verify]
[Route("mes/productionMaterial/MmInventory")]
public class MmInventoryController : BaseController
{
/// <summary>
/// 库存表接口
/// </summary>
private readonly IMmInventoryService _MmInventoryService;
public MmInventoryController(IMmInventoryService MmInventoryService)
{
_MmInventoryService = MmInventoryService;
}
/// <summary>
/// 查询库存表列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
[HttpGet("list")]
[ActionPermissionFilter(Permission = "mminventory:list")]
public IActionResult QueryMmInventory([FromQuery] MmInventoryQueryDto parm)
{
var response = _MmInventoryService.GetList(parm);
return SUCCESS(response);
}
/// <summary>
/// 查询库存表详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
[HttpGet("{Id}")]
[ActionPermissionFilter(Permission = "mminventory:query")]
public IActionResult GetMmInventory(int Id)
{
var response = _MmInventoryService.GetInfo(Id);
var info = response.Adapt<MmInventoryDto>();
return SUCCESS(info);
}
/// <summary>
/// 添加库存表
/// </summary>
/// <returns></returns>
[HttpPost]
[ActionPermissionFilter(Permission = "mminventory:add")]
[Log(Title = "库存表", BusinessType = BusinessType.INSERT)]
public IActionResult AddMmInventory([FromBody] MmInventoryDto parm)
{
var modal = parm.Adapt<MmInventory>().ToCreate(HttpContext);
var response = _MmInventoryService.AddMmInventory(modal);
return SUCCESS(response);
}
/// <summary>
/// 更新库存表
/// </summary>
/// <returns></returns>
[HttpPut]
[ActionPermissionFilter(Permission = "mminventory:edit")]
[Log(Title = "库存表", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateMmInventory([FromBody] MmInventoryDto parm)
{
var modal = parm.Adapt<MmInventory>().ToUpdate(HttpContext);
var response = _MmInventoryService.UpdateMmInventory(modal);
return ToResponse(response);
}
/// <summary>
/// 删除库存表
/// </summary>
/// <returns></returns>
[HttpPost("delete/{ids}")]
[ActionPermissionFilter(Permission = "mminventory:delete")]
[Log(Title = "库存表", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteMmInventory([FromRoute]string ids)
{
var idArr = Tools.SplitAndConvert<int>(ids);
return ToResponse(_MmInventoryService.Delete(idArr));
}
/// <summary>
/// 获取物料清单下拉数据
/// </summary>
/// <returns></returns>
[HttpPost("GetMaterialOption")]
public IActionResult GetMaterialOption()
{
var response = _MmInventoryService.GetMaterialOption();
return SUCCESS(response);
}
/// <summary>
/// 获取库位下拉数据
/// </summary>
/// <returns></returns>
[HttpPost("GetLocationOption")]
public IActionResult GetLocationOption()
{
var response = _MmInventoryService.GetLocationOption();
return SUCCESS(response);
}
/// <summary>
/// 获取出/入库操作类型下拉数据
/// </summary>
/// <returns></returns>
[HttpPost("GetTransactionOption")]
public IActionResult GetTransactionOption()
{
var response = _MmInventoryService.GetTransactionOption();
return SUCCESS(response);
}
/// <summary>
/// 创建入库单
/// </summary>
/// <returns></returns>
[HttpPost("CreateInboundReceipt")]
[AllowAnonymous]
[Log(Title = "入库单", BusinessType = BusinessType.INSERT)]
public IActionResult CreateInboundReceipt([FromBody] InboundReceiptDto parm)
{
try
{
string response = _MmInventoryService.CreateInboundReceipt(parm);
if(response == "ok")
{
return ToResponse(new ApiResult(200, "ok"));
}
else
{
return ToResponse(new ApiResult(500, response));
}
}
catch (Exception)
{
throw;
}
}
/// <summary>
/// 创建出库单
/// </summary>
/// <returns></returns>
[HttpPost("CreateOutboundReceipt")]
[AllowAnonymous]
[Log(Title = "出库单", BusinessType = BusinessType.INSERT)]
public IActionResult CreateOutboundReceipt([FromBody] OutboundReceiptDto parm)
{
try
{
string response = _MmInventoryService.CreateOutboundReceipt(parm);
if (response == "ok")
{
return ToResponse(new ApiResult(200, "ok"));
}
else
{
return ToResponse(new ApiResult(500, response));
}
}
catch (Exception)
{
throw;
}
}
}
}