153 lines
4.6 KiB
C#
153 lines
4.6 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
||
using ZR.Admin.WebApi.Extensions;
|
||
using ZR.Admin.WebApi.Filters;
|
||
using ZR.Model.Dto;
|
||
using ZR.Model.MES.mm;
|
||
using ZR.Service.mes.mm.IService;
|
||
|
||
//创建时间:2024-04-26
|
||
namespace ZR.Admin.WebApi.Controllers
|
||
{
|
||
/// <summary>
|
||
/// agv位置表
|
||
/// </summary>
|
||
[Verify]
|
||
[Route("mes/mm/MmAgvLocation")]
|
||
public class MmAgvLocationController : BaseController
|
||
{
|
||
/// <summary>
|
||
/// agv位置表接口
|
||
/// </summary>
|
||
private readonly IMmAgvLocationService _MmAgvLocationService;
|
||
|
||
public MmAgvLocationController(IMmAgvLocationService MmAgvLocationService)
|
||
{
|
||
_MmAgvLocationService = MmAgvLocationService;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询agv位置表列表
|
||
/// </summary>
|
||
/// <param name="parm"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("list")]
|
||
[ActionPermissionFilter(Permission = "materialManagement:mmagvlocation:list")]
|
||
public IActionResult QueryMmAgvLocation([FromQuery] MmAgvLocationQueryDto parm)
|
||
{
|
||
var response = _MmAgvLocationService.GetList(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 查询agv位置表详情
|
||
/// </summary>
|
||
/// <param name="Id"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("{Id}")]
|
||
[ActionPermissionFilter(Permission = "materialManagement:mmagvlocation:query")]
|
||
public IActionResult GetMmAgvLocation(int Id)
|
||
{
|
||
var response = _MmAgvLocationService.GetInfo(Id);
|
||
|
||
var info = response.Adapt<MmAgvLocation>();
|
||
return SUCCESS(info);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 添加agv位置表
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost]
|
||
[ActionPermissionFilter(Permission = "materialManagement:mmagvlocation:add")]
|
||
[Log(Title = "agv位置表", BusinessType = BusinessType.INSERT)]
|
||
public IActionResult AddMmAgvLocation([FromBody] MmAgvLocationDto parm)
|
||
{
|
||
var modal = parm.Adapt<MmAgvLocation>().ToCreate(HttpContext);
|
||
|
||
var response = _MmAgvLocationService.AddMmAgvLocation(modal);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 更新agv位置表
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPut]
|
||
[ActionPermissionFilter(Permission = "materialManagement:mmagvlocation:edit")]
|
||
[Log(Title = "agv位置表", BusinessType = BusinessType.UPDATE)]
|
||
public IActionResult UpdateMmAgvLocation([FromBody] MmAgvLocationDto parm)
|
||
{
|
||
var modal = parm.Adapt<MmAgvLocation>().ToUpdate(HttpContext);
|
||
var response = _MmAgvLocationService.UpdateMmAgvLocation(modal);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除agv位置表
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpDelete("{ids}")]
|
||
[ActionPermissionFilter(Permission = "materialManagement:mmagvlocation:delete")]
|
||
[Log(Title = "agv位置表", BusinessType = BusinessType.DELETE)]
|
||
public IActionResult DeleteMmAgvLocation(string ids)
|
||
{
|
||
int[] idsArr = Tools.SpitIntArrary(ids);
|
||
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
||
|
||
var response = _MmAgvLocationService.Delete(idsArr);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 区域信息
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpGet("listAreaOptions")]
|
||
public IActionResult ListAreaOptions()
|
||
{
|
||
var response = _MmAgvLocationService.ListAreaOptions();
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
|
||
[HttpGet("update_status")]
|
||
public IActionResult Updatestatus(int index, int status)
|
||
{
|
||
if (status == 0)
|
||
{
|
||
status = 1;
|
||
}
|
||
else if (status == 1)
|
||
{
|
||
status = 0;
|
||
}
|
||
|
||
var response = _MmAgvLocationService.Updatestatus(index, status);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 查询agv状态
|
||
/// </summary>
|
||
/// <param name="agvCode"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("call_agv_status")]
|
||
public IActionResult CallagvStatus(int agvCode)
|
||
{
|
||
if (agvCode == 0)
|
||
{
|
||
return SUCCESS(null);
|
||
}
|
||
|
||
var response = _MmAgvLocationService.CallagvStatus(agvCode);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
}
|
||
} |