using Microsoft.AspNetCore.Mvc;
using DOAN.Model.PBL.Dto;
using DOAN.Model.PBL;
using DOAN.Service.PBL.IService;
using DOAN.Admin.WebApi.Filters;
//创建时间:2024-09-23
namespace DOAN.Admin.WebApi.Controllers.PBL
{
///
/// 料架表
///
[Verify]
[Route("PBL/Storagelocation")]
public class StoragelocationController : BaseController
{
///
/// 料架表接口
///
private readonly IStoragelocationService _StoragelocationService;
public StoragelocationController(IStoragelocationService StoragelocationService)
{
_StoragelocationService = StoragelocationService;
}
///
/// 查询料架表列表
///
///
///
[HttpGet("list")]
[ActionPermissionFilter(Permission = "storagelocation:list")]
public IActionResult QueryStoragelocation([FromQuery] StoragelocationQueryDto parm)
{
var response = _StoragelocationService.GetList(parm);
return SUCCESS(response);
}
///
/// 查询料架表列表(零件号聚合)
///
///
///
[HttpGet("listByPartnumber")]
[ActionPermissionFilter(Permission = "storagelocation:list")]
public IActionResult QueryListByPartnumber()
{
var response = _StoragelocationService.GetPartNumberList();
return SUCCESS(response);
}
///
/// 查询料架表详情
///
///
///
[HttpGet("{Id}")]
[ActionPermissionFilter(Permission = "storagelocation:query")]
public IActionResult GetStoragelocation(int Id)
{
var response = _StoragelocationService.GetInfo(Id);
var info = response.Adapt();
return SUCCESS(info);
}
///
/// 添加料架表
///
///
[HttpPost]
[ActionPermissionFilter(Permission = "storagelocation:add")]
[Log(Title = "料架表", BusinessType = BusinessType.INSERT)]
public IActionResult AddStoragelocation([FromBody] StoragelocationDto parm)
{
var modal = parm.Adapt().ToCreate(HttpContext);
var response = _StoragelocationService.AddStoragelocation(modal);
return SUCCESS(response);
}
///
/// 更新料架表
///
///
[HttpPut]
[ActionPermissionFilter(Permission = "storagelocation:edit")]
[Log(Title = "料架表", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateStoragelocation([FromBody] StoragelocationDto parm)
{
var modal = parm.Adapt().ToUpdate(HttpContext);
var response = _StoragelocationService.UpdateStoragelocation(modal);
return ToResponse(response);
}
///
/// 删除料架表
///
///
[HttpPost("delete/{ids}")]
[ActionPermissionFilter(Permission = "storagelocation:delete")]
[Log(Title = "料架表", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteStoragelocation([FromRoute]string ids)
{
var idArr = Tools.SplitAndConvert(ids);
return ToResponse(_StoragelocationService.Delete(idArr));
}
///
/// 获取料架下拉数据
///
///
[HttpGet("GetRackCodeOptions")]
[AllowAnonymous]
public IActionResult GetRackCodeOptions()
{
var response = _StoragelocationService.GetRackCodeOptions();
return SUCCESS(response);
}
///
/// 获取BOM中的零件号下拉
///
///
[HttpGet("GetPartNumberOptions")]
[AllowAnonymous]
public IActionResult GetPartNumberOptions()
{
var response = _StoragelocationService.GetPartNumberOptions();
return SUCCESS(response);
}
///
/// 修改料架的零件号
///
///
[HttpGet("UpdateRackPartNumber")]
[AllowAnonymous]
public IActionResult UpdateRackPartNumber(string rackCode, int layerNum, string partnumber)
{
var response = _StoragelocationService.UpdateRackPartNumber(rackCode,layerNum,partnumber);
return SUCCESS(response);
}
}
}