147 lines
5.1 KiB
C#
147 lines
5.1 KiB
C#
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.mes.wms.IService;
|
||
|
||
//创建时间:2024-07-25
|
||
namespace ZR.Admin.WebApi.Controllers
|
||
{
|
||
/// <summary>
|
||
/// 工艺路线-抛光 库存表
|
||
/// </summary>
|
||
[Verify]
|
||
[Route("/mes/wm/WmPolishInventory")]
|
||
public class WmPolishInventoryController : BaseController
|
||
{
|
||
/// <summary>
|
||
/// 工艺路线-抛光 库存表接口
|
||
/// </summary>
|
||
private readonly IWmPolishInventoryService _WmPolishInventoryService;
|
||
|
||
public WmPolishInventoryController(IWmPolishInventoryService WmPolishInventoryService)
|
||
{
|
||
_WmPolishInventoryService = WmPolishInventoryService;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询工艺路线-抛光 库存表列表
|
||
/// </summary>
|
||
/// <param name="parm"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("list")]
|
||
[ActionPermissionFilter(Permission = "business:wmpolishinventory:list")]
|
||
public IActionResult QueryWmPolishInventory([FromQuery] WmPolishInventoryQueryDto parm)
|
||
{
|
||
var response = _WmPolishInventoryService.GetList(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询工艺路线-抛光 库存表详情
|
||
/// </summary>
|
||
/// <param name="Id"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("{Id}")]
|
||
[ActionPermissionFilter(Permission = "business:wmpolishinventory:query")]
|
||
public IActionResult GetWmPolishInventory(string Id)
|
||
{
|
||
var response = _WmPolishInventoryService.GetInfo(Id);
|
||
|
||
var info = response.Adapt<WmPolishInventory>();
|
||
return SUCCESS(info);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 添加抛光 库存表
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost]
|
||
[ActionPermissionFilter(Permission = "business:wmpolishinventory:add")]
|
||
[Log(Title = "抛光 库存表", BusinessType = BusinessType.INSERT)]
|
||
public IActionResult AddWmPolishInventory([FromBody] WmPolishInventoryDto parm)
|
||
{
|
||
var modal = parm.Adapt<WmPolishInventory>().ToCreate(HttpContext);
|
||
|
||
var response = _WmPolishInventoryService.AddWmPolishInventory(modal);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 更新抛光 库存表
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPut]
|
||
[ActionPermissionFilter(Permission = "business:wmpolishinventory:edit")]
|
||
[Log(Title = "抛光 库存表", BusinessType = BusinessType.UPDATE)]
|
||
public IActionResult UpdateWmPolishInventory([FromBody] WmPolishInventoryDto parm)
|
||
{
|
||
var modal = parm.Adapt<WmPolishInventory>().ToUpdate(HttpContext);
|
||
var response = _WmPolishInventoryService.UpdateWmPolishInventory(modal);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除抛光 库存表
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpDelete("{ids}")]
|
||
[ActionPermissionFilter(Permission = "business:wmpolishinventory:delete")]
|
||
[Log(Title = "抛光 库存表", BusinessType = BusinessType.DELETE)]
|
||
public IActionResult DeleteWmPolishInventory(string ids)
|
||
{
|
||
string[] idsArr = ids.Split(",");
|
||
if (idsArr.Length <= 0)
|
||
{
|
||
return ToResponse(ApiResult.Error($"删除失败Id 不能为空"));
|
||
}
|
||
|
||
var response = _WmPolishInventoryService.Delete(idsArr);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 抛光手动入库
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("doWmPolishWarehousing")]
|
||
[ActionPermissionFilter(Permission = "business:wmpolishinventory:add")]
|
||
[Log(Title = "抛光手动入库", BusinessType = BusinessType.INSERT)]
|
||
public IActionResult DoWmPolishWarehousing([FromBody] WmPolishInventoryDto parm)
|
||
{
|
||
try
|
||
{
|
||
var modal = parm.Adapt<WmPolishInventory>().ToCreate(HttpContext);
|
||
var response = _WmPolishInventoryService.DoWmPolishWarehousing(modal);
|
||
return ToResponse(new ApiResult(200, "手动入库成功", response));
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
return ToResponse(new ApiResult(500, "手动入库异常:" + e.Message, e.Message));
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 物料下拉菜单查看
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpGet("getMaterialSelectOption")]
|
||
public IActionResult GetMaterialSelectOption([FromQuery] string query)
|
||
{
|
||
try
|
||
{
|
||
var response = _WmPolishInventoryService.GetMaterialSelectOption(query);
|
||
return ToResponse(new ApiResult(200, "获取成功", response));
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
return ToResponse(new ApiResult(500, "获取物料下拉菜单数据失败:" + e.Message, null));
|
||
}
|
||
}
|
||
}
|
||
}
|