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_ITaskInfoService;
namespace WIDESEAWCS_Server.Controllers.WMS
{
[Route("api/[controller]")]
[ApiController]
public class WMSController : ControllerBase
{
private readonly ITaskService _taskService;
public WMSController(ITaskService taskService)
{
_taskService = taskService;
}
///
/// WMS下发任务
///
///
///
[HttpPost, Route("ReceiveTask"), AllowAnonymous]
public object ReceiveWMSTask([FromBody] List 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
};
}
}
///
/// 取消任务
///
///
///
[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
};
}
}
///
/// 修改任务优先级
///
///
///
[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
};
}
}
///
/// 修改库位分区
///
///
///
[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
};
}
}
///
/// 区域库位信息查询
///
/// 区域号
///
[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
};
}
}
}
}