using Microsoft.AspNetCore.Mvc;
using WCS.BLL.Services.IService;
using WCS.BLL.Services.Service;
using WCS.Model;
using WCS.Model.ApiModel.MatBaseInfo;
using WCS.Model.ApiModel.PDAShelfLocationBindUnbind;
using WCS.Model.ApiModel.Stocktaking;

namespace WCS.WebApi.Controllers
{
    /// <summary>
    /// PDA货架绑定解绑 相关接口
    /// </summary>
    [ApiController]
    [Route("[controller]")]
    public class PDAShelfLocationBindUnbindController : ControllerBase
    {
        public IPDAShelfLocationBindUnbindService _pdaShelfLocationBindUnbindService { get; set; }
        public PDAShelfLocationBindUnbindController(IPDAShelfLocationBindUnbindService pdaShelfLocationBindUnbindService)
        {
            _pdaShelfLocationBindUnbindService = pdaShelfLocationBindUnbindService;
        }

        [Route("getLocationInfoByShelfCode")]
        [HttpPost(Name = "getLocationInfoByShelfCode")]
        public async Task<ResponseBase> getLocationInfoByShelfCode(ShelfLocationBindUnbindRequest request)
        {
            try
            {
                return await _pdaShelfLocationBindUnbindService.getLocationInfoByShelfCode(request);
            }
            catch (Exception ex)
            {
                return new ResponseCommon()
                {
                    Code = 201,
                    Message = "获取失败：" + ex.Message,
                    Data = null,
                };
            }
        }

        [Route("shelfLocationBind")]
        [HttpPost(Name = "shelfLocationBind")]
        public async Task<ResponseBase> shelfLocationBind(ShelfLocationBindUnbindRequest request)
        {
            try
            {
                return await _pdaShelfLocationBindUnbindService.shelfLocationBind(request);
            }
            catch (Exception ex)
            {
                return new ResponseCommon()
                {
                    Code = 201,
                    Message = "绑定失败：" + ex.Message,
                    Data = null,
                };
            }
        }

        [Route("shelfLocationUnBind")]
        [HttpPost(Name = "shelfLocationUnBind")]
        public async Task<ResponseBase> shelfLocationUnBind(ShelfLocationBindUnbindRequest request)
        {
            try
            {
                return await _pdaShelfLocationBindUnbindService.shelfLocationUnBind(request);
            }
            catch (Exception ex)
            {
                return new ResponseCommon()
                {
                    Code = 201,
                    Message = "解绑失败：" + ex.Message,
                    Data = null,
                };
            }
        }

    }
}
