using BPA.SAAS.Manage.Application.AExternalPlatform.BaseDto;
using BPA.SAAS.Manage.Application.AExternalPlatform.Service.Bom.Dtos;
using BPA.SAAS.Manage.Application.AExternalPlatform.Service.Bom.Services;
using BPA.SAAS.Manage.Application.DataBase.Dtos.Bom;
using BPA.SAAS.Manage.Core.Base;

namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Bom
{
    [ApiDescriptionSettings("开放平台", Tag = "配方管理"), AllowAnonymous]
    public class BomServices:IDynamicApiController
    {
        IBomService _bomService;
        public BomServices(IBomService bomService)
        {
            _bomService= bomService;
        }
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        [HttpPost("/api/ExternalPlatform/Bom/GetBomPageList")]
        public async Task<PageUtil<List<BomDto>>> GetBomPageList(BomPageQueryDto inputDto)
        {
            return await _bomService.GetBomPageList(inputDto);
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/ExternalPlatform/Bom/AddBom")]
        public async Task<bool> AddBom(BaseRequestDto<BomInsertDto> dto)
        {
            return await _bomService.AddBom(dto);
        }
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/ExternalPlatform/Bom/UpdateBom")]
        public async Task<bool> UpdateBom(BaseRequestDto<BomUpdateDto> dto)
        {
            return await _bomService.UpdateBom(dto);
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        [HttpPost("/api/ExternalPlatform/Bom/DeleteBom")]
        public async Task<bool> DeleteBom(DeleteBomDto dto)
        {
            return await _bomService.DeleteBom(dto);
        }
        /// <summary>
        /// 根据配方id查询配方详情
        /// </summary>
        /// <param name="bomId"></param>
        /// <returns></returns>
        [HttpPost("/api/ExternalPlatform/Bom/GetBomEntry")]
        public async Task<List<BomEntryDto>> GetBomEntry(BomIdDto dto)
        {
            return await _bomService.GetBomEntry(dto);
        }
        /// <summary>
        /// 添加配方详情
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/ExternalPlatform/Bom/AddBomEntry")]
        public async Task<bool> AddBomEntry(BomEntryInsertDto dto)
        {
            return await _bomService.AddBomEntry(dto);
        }
    }
}
