using HslCommunication.WebSocket;
|
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Mvc;
|
using System.Collections.Generic;
|
using WIDESEA_Core;
|
using WIDESEA_DTO.Basic;
|
using WIDESEAWCS_Core;
|
using WIDESEAWCS_Core.BaseController;
|
using WIDESEAWCS_IBasicInfoRepository;
|
using WIDESEAWCS_IBasicInfoService;
|
using WIDESEAWCS_Model.Models;
|
|
namespace WIDESEA_WMSServer.Controllers.Basic
|
{
|
/// <summary>
|
/// 货位
|
/// </summary>
|
[Route("api/LocationInfo")]
|
[ApiController]
|
public class LocationInfoController : ApiBaseController<ILocationInfoService, Dt_LocationInfo>
|
{
|
private readonly ILocationInfoRepository _repository;
|
public LocationInfoController(ILocationInfoService service, ILocationInfoRepository repository) : base(service)
|
{
|
_repository = repository;
|
}
|
|
/// <summary>
|
/// 货位分配
|
/// </summary>
|
/// <param name="roadwayNo"></param>
|
/// <param name="palletType"></param>
|
/// <returns></returns>
|
[HttpPost, HttpGet, Route("AssignLocation"), AllowAnonymous]
|
public Dt_LocationInfo? AssignLocation()
|
{
|
return Service.AssignLocation();
|
}
|
|
/// <summary>
|
/// 初始化货位
|
/// </summary>
|
/// <returns></returns>
|
[HttpPost, Route("InitializationLocation"), AllowAnonymous]
|
public WebResponseContent InitializationLocation([FromBody] InitializationLocationDTO initializationLocationDTO)
|
{
|
return Service.InitializationLocation(initializationLocationDTO);
|
}
|
/// <summary>
|
/// 启用货位
|
/// </summary>
|
/// <param name="keys"></param>
|
/// <returns></returns>
|
[HttpPost, Route("LocationEnableStatus")]
|
public WebResponseContent LocationEnableStatus([FromBody] int[] keys)
|
{
|
return Service.LocationEnableStatus(keys); ;
|
}
|
|
/// <summary>
|
/// 禁用货位
|
/// </summary>
|
/// <param name="keys"></param>
|
/// <returns></returns>
|
[HttpPost, Route("LocationDisableStatus")]
|
public WebResponseContent LocationDisableStatus([FromBody] int[] keys)
|
{
|
return Service.LocationDisableStatus(keys); ;
|
}
|
[HttpPost,HttpGet , Route("GetLocationStatus")]
|
public WebResponseContent GetLocationStatus(int row)
|
{
|
List<int> layers = _repository.QueryData(x => x.Row == row).Select(x => x.Layer).Distinct().ToList();
|
List<object> listObj=new List<object>();
|
foreach (var item in layers)
|
{
|
|
object locationObj = _repository.QueryData(x => x.Row == row && x.Layer== item).OrderBy(x => x.Columns).Select(x => new
|
{
|
barCode = x.PalletCode,
|
layer=x.Layer.ToString().PadLeft(2, '0'),
|
row=x.Row.ToString().PadLeft(2, '0'),
|
column = x.Columns.ToString().PadLeft(2, '0'),
|
locationCode = x.LocationCode,
|
location_lock=x.LocationStatus
|
}).ToList();
|
object obj = new { layer=item, locationObj };
|
listObj.Add(obj);
|
}
|
|
return WebResponseContent.Instance.OK("成功", listObj);
|
}
|
[HttpPost, HttpGet, Route("GetRow")]
|
public WebResponseContent GetRow()
|
{
|
List<int> listRow=_repository.QueryData().Select(x=>x.Row).Distinct().ToList();
|
return WebResponseContent.Instance.OK("成功",listRow);
|
}
|
}
|
}
|