using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using XYY.Core.Standard.Mvc;
using XYY.Model.Standard.Channel;
using XYY.Service.Standard.Channel;
using XYY.Service.Standard.Order;

namespace XYY.Api.Order.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class BoxBatchOutController : ApiControllerBase
    {
        IBoxService _boxService;
        IChannelService _channelService;
        public BoxBatchOutController(IBoxService boxService, IChannelService channelService)
        {
            _boxService = boxService;
            _channelService = channelService;
        }

        public async Task<ApiJsonModel<Logistics_BoxOutBatch>> Scan(string boxNumber, string channelName)
        {
            var model = await _boxService.Scan(boxNumber, channelName);
            return ApiJsonModel<Logistics_BoxOutBatch>.OK(model);
        }
         

        public async Task<ApiJsonModel<Logistics_BoxOutBatch>> CanScan(string boxNumber)
        {
            var model = await _boxService.CanScan(boxNumber);
            return ApiJsonModel<Logistics_BoxOutBatch>.OK(model);
        }

        public async Task<ApiJsonModel<Logistics_BoxOutBatch>> GetLastScanBatch()
        {
            var model = await _boxService.GetLastScanBatch();
            return ApiJsonModel<Logistics_BoxOutBatch>.OK(model);
        }



        public async Task<ApiJsonModel> CreateBZB(BZBBoxInfo boxInfo)
        {
            await _boxService.SetYPDJ(boxInfo);
            return ApiJsonModel.OK();
        }

        public async Task<ApiJsonModel> EndScan()
        {
            await _boxService.EndScan();
            return ApiJsonModel.OK();
        }


    }
}
