using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using WCS.BLL.DbModels;
using WCS.BLL.Manager;
using WCS.BLL.Services.IService;
using WCS.BLL.Services.Service;
using WCS.DAL.Db;
using WCS.Model;
using WCS.Model.ApiModel.Home;
using WCS.Model.ApiModel.SelfCheck;

namespace WCS.WebApi.Controllers
{
    /// <summary>
    /// 自检
    /// </summary>
    [ApiController]
    [Route("[controller]")]
    public class SelfCheckController : ControllerBase
    {
        public ISelfCheckService _selfCheckService { get; set; }

        public SelfCheckController(ISelfCheckService selfCheckService)
        {
            _selfCheckService = selfCheckService;
        }

        [Route("startSelfCheckByShelfCode")]
        [HttpPost(Name = "startSelfCheckByShelfCode")]
        public async Task<ResponseBase> startSelfCheckByShelfCode(StartSelfCheckByShelfCodeRequest request)
        {
            try
            {
                return await _selfCheckService.StartSelfCheckByShelfCode(request);
            }
            catch (Exception ex)
            {
                return new ResponseBase()
                {
                    Code = 300,
                    Message = "开始自检失败：" + ex.Message,
                };
            }
        }

    }
}
