using Autofac.Core;
|
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Mvc;
|
using System.Threading.Tasks;
|
using WIDESEAWCS_Core;
|
using WIDESEAWCS_DTO.WMS;
|
using WIDESEAWCS_IBasicInfoService;
|
using WIDESEAWCS_ITaskInfoService;
|
|
namespace WIDESEAWCS_Server.Controllers.WMS
|
{
|
[Route("api/[controller]")]
|
[ApiController]
|
public class WMSController : ControllerBase
|
{
|
private readonly ITaskService _taskService;
|
private readonly IStationMangerService _stationMangerService;
|
public WMSController(ITaskService taskService, IStationMangerService stationMangerService)
|
{
|
_taskService = taskService;
|
_stationMangerService = stationMangerService;
|
}
|
/// <summary>
|
/// WMS下发任务
|
/// </summary>
|
/// <param name="taskDTOs"></param>
|
/// <returns></returns>
|
[HttpPost, Route("ReceiveTask"), AllowAnonymous]
|
public object ReceiveWMSTask([FromBody] List<WMSTasksDTO> taskDTOs)
|
{
|
WebResponseContent content = _taskService.ReceiveWMSTask(taskDTOs);
|
if (!content.Status)
|
{
|
return new
|
{
|
code = "404",
|
msg = content.Message
|
};
|
}
|
else
|
{
|
return new
|
{
|
code = "0",
|
msg = content.Message,
|
data = content.Data
|
};
|
}
|
}
|
|
/// <summary>
|
/// 取消任务
|
/// </summary>
|
/// <param name="wMSCancelTask"></param>
|
/// <returns></returns>
|
[HttpPost, Route("CancelWMSTask"), AllowAnonymous]
|
public object CancelWMSTask([FromBody] WMSCancelTask wMSCancelTask)
|
{
|
WebResponseContent content = _taskService.CancelWMSTask(wMSCancelTask);
|
if (!content.Status)
|
{
|
return new
|
{
|
code = "404",
|
msg = content.Message
|
};
|
}
|
else
|
{
|
return new
|
{
|
code = "0",
|
msg = content.Message,
|
data = content.Data
|
};
|
}
|
}
|
|
/// <summary>
|
/// 修改任务优先级
|
/// </summary>
|
/// <param name="updateTaskPriority"></param>
|
/// <returns></returns>
|
[HttpPost, Route("UpdateWMSTaskPriority"), AllowAnonymous]
|
public object UpdateWMSTaskPriority([FromBody] WMSUpdateTaskPriority updateTaskPriority)
|
{
|
WebResponseContent content = _taskService.UpdateWMSTaskPriority(updateTaskPriority);
|
if (!content.Status)
|
{
|
return new
|
{
|
code = "404",
|
msg = content.Message
|
};
|
}
|
else
|
{
|
return new
|
{
|
code = "0",
|
msg = content.Message,
|
data = content.Data
|
};
|
}
|
}
|
|
/// <summary>
|
/// 修改库位分区
|
/// </summary>
|
/// <param name="WMSUpdateLocationArea"></param>
|
/// <returns></returns>
|
[HttpPost, Route("ModifyWMSLayoutZone"), AllowAnonymous]
|
public object ModifyWMSLayoutZone([FromBody] WMSUpdateLocationArea wMSUpdateLocationArea)
|
{
|
WebResponseContent content = _taskService.ModifyWMSLayoutZone(wMSUpdateLocationArea);
|
if (!content.Status)
|
{
|
return new
|
{
|
code = "404",
|
msg = content.Message
|
};
|
}
|
else
|
{
|
return new
|
{
|
code = "0",
|
msg = content.Message,
|
data = content.Data
|
};
|
}
|
}
|
|
/// <summary>
|
/// 区域库位信息查询
|
/// </summary>
|
/// <param name="AreaCode">区域号</param>
|
/// <returns></returns>
|
[HttpPost, Route("LocationInquiry"), AllowAnonymous]
|
public object LocationInquiry(string AreaCode)
|
{
|
WebResponseContent content = _taskService.LocationInquiry(AreaCode);
|
if (!content.Status)
|
{
|
return new
|
{
|
code = "404",
|
msg = content.Message
|
};
|
}
|
else
|
{
|
return new
|
{
|
code = "0",
|
msg = content.Message,
|
data = content.Data
|
};
|
}
|
}
|
}
|
}
|