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 { /// /// 库存信息表 /// [Verify] [Route("mes/deviceManagement/Parts/DevicePartsInventory")] public class DevicePartsInventoryController : BaseController { /// /// 库存信息表接口 /// private readonly IDevicePartsInventoryService _DevicePartsInventoryService; public DevicePartsInventoryController(IDevicePartsInventoryService DevicePartsInventoryService) { _DevicePartsInventoryService = DevicePartsInventoryService; } /// /// 查询库存信息表列表 /// /// /// [HttpGet("list")] [ActionPermissionFilter(Permission = "deviceManagement:devicepartsinventory:list")] public IActionResult QueryDevicePartsInventory([FromQuery] DevicePartsInventoryQueryDto parm) { var response = _DevicePartsInventoryService.GetList(parm); return SUCCESS(response); } /// /// 查询库存信息表详情 /// /// /// [HttpGet("{InventoryId}")] [ActionPermissionFilter(Permission = "deviceManagement:devicepartsinventory:query")] public IActionResult GetDevicePartsInventory(int InventoryId) { var response = _DevicePartsInventoryService.GetInfo(InventoryId); var info = response.Adapt(); return SUCCESS(info); } /// /// 添加库存信息表 /// /// [HttpPost] [ActionPermissionFilter(Permission = "deviceManagement:devicepartsinventory:add")] [Log(Title = "库存信息表", BusinessType = BusinessType.INSERT)] public IActionResult AddDevicePartsInventory([FromBody] DevicePartsInventoryDto parm) { var modal = parm.Adapt().ToCreate(HttpContext); var response = _DevicePartsInventoryService.AddDevicePartsInventory(modal); return SUCCESS(response); } /// /// 更新库存信息表 /// /// [HttpPut] [ActionPermissionFilter(Permission = "deviceManagement:devicepartsinventory:edit")] [Log(Title = "库存信息表", BusinessType = BusinessType.UPDATE)] public IActionResult UpdateDevicePartsInventory([FromBody] DevicePartsInventoryDto parm) { var modal = parm.Adapt().ToUpdate(HttpContext); var response = _DevicePartsInventoryService.UpdateDevicePartsInventory(modal); return ToResponse(response); } /// /// 删除库存信息表 /// /// [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); } //TODO 入库 [HttpPost("entryInventory")] public IActionResult EntryInventory([FromBody] DevicePartsInventoryDto parm) { var response = _DevicePartsInventoryService.EntryInventory(parm,HttpContext.GetNickName(),parm.SupplierId); return SUCCESS(response); } //TODO 出库 [HttpPost("OutInventory")] public IActionResult OutInventory([FromBody] DevicePartsInventoryDto parm) { var response = _DevicePartsInventoryService.OutInventory(parm,HttpContext.GetNickName()); return SUCCESS(response); } //TODO 盘点 [HttpPost("CheckInventory")] public IActionResult CheckInventory([FromBody] DevicePartsInventoryDto parm) { var response = _DevicePartsInventoryService.CheckInventory(parm,HttpContext.GetNickName()); return SUCCESS(response); } } }