2023-08-16 09:51:28 +08:00
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
using System.Diagnostics.CodeAnalysis;
|
|
|
|
|
|
using ZR.Admin.WebApi.Extensions;
|
|
|
|
|
|
using ZR.Model.mes.md;
|
|
|
|
|
|
using ZR.Service.mes.md;
|
|
|
|
|
|
using ZR.Service.mes.md.IService;
|
|
|
|
|
|
namespace ZR.Admin.WebApi.Controllers.mes.md
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
[Route("mes/md/device")]
|
|
|
|
|
|
public class MdDeviceController : BaseController
|
|
|
|
|
|
{
|
|
|
|
|
|
IMdDeviceService deviceService;
|
|
|
|
|
|
public MdDeviceController(IMdDeviceService deviceService)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.deviceService = deviceService;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
///
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="pageNum"></param>
|
|
|
|
|
|
/// <param name="pageSize"></param>
|
|
|
|
|
|
/// <param name="deviceCode"></param>
|
|
|
|
|
|
/// <param name="deviceName"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
[HttpGet("list")]
|
|
|
|
|
|
public IActionResult List(int pageNum, int pageSize, string deviceCode = "", string deviceName = "")
|
|
|
|
|
|
{
|
|
|
|
|
|
(int, List<MdDevice>) data = deviceService.GetAll(deviceCode, deviceName, pageNum, pageSize);
|
|
|
|
|
|
return ToResponse(new ApiResult(200, "success", data));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[HttpPost("addDevice")]
|
|
|
|
|
|
public IActionResult AddDevice([FromBody]MdDevice device)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (device != null)
|
|
|
|
|
|
device.ToCreate(HttpContext);
|
|
|
|
|
|
int result = deviceService.AddDevice(device);
|
|
|
|
|
|
return SUCCESS(result);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[HttpPost("updateDevice")]
|
|
|
|
|
|
public IActionResult UpdateDevice([FromBody]MdDevice device)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (device != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
device.ToUpdate(HttpContext);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int result = deviceService.UpdateDevice(device);
|
|
|
|
|
|
return SUCCESS(result);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[HttpPost("delDevice")]
|
|
|
|
|
|
public IActionResult deleteWorkshop([FromBody] List<int> ids)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (ids != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
int result = deviceService.deleteDevice(ids.ToArray());
|
|
|
|
|
|
return ToResponse(result);
|
|
|
|
|
|
}
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-08 13:10:26 +08:00
|
|
|
|
|
|
|
|
|
|
[HttpGet("getworkstationList")]
|
|
|
|
|
|
public IActionResult GetworkstationList()
|
|
|
|
|
|
{
|
|
|
|
|
|
List<MdWorkstation> workstations= deviceService.getworkstationList();
|
|
|
|
|
|
return SUCCESS(workstations);
|
|
|
|
|
|
}
|
2023-08-16 09:51:28 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|