using BPA.SAAS.Manage.Application.DataBase.Dtos.Bom;
using BPA.SAAS.Manage.Application.DataBase.Interface;
using BPA.SAAS.Manage.Comm.Enum;
using BPA.SAAS.Manage.Core.Base;
using BPA.SAAS.Manage.Core.DataBase;
using Microsoft.AspNetCore.Components.Forms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.SAAS.Manage.Application.DataBase
{
    [ApiDescriptionSettings("Goods", Tag = "配方管理")]
    public class BomServices: IDynamicApiController, ITransient
    {
        IBomService _bomService;
        public BomServices(IBomService bomService)
        {
            _bomService= bomService;
        }
        /// <summary>
        /// 查询所有配方信息
        /// </summary>
        /// <returns></returns>
        [HttpGet("/api/bom/getbomlist")]
        public async  Task<List<BomSelectList>> GetBomList()
        {
            return await _bomService.GetBomList();
        }

        /// <summary>
        /// 根据配方id查询配方信息
        /// </summary>
        /// <param name="bomId"></param>
        /// <returns></returns>
        [HttpGet("/api/bom/getbyidbomlist")]
        public async Task<BomList> GetBomList(string bomId)
        {
            return await _bomService.GetBomList(bomId);
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/bom/add")]
        public async Task<bool> AddBom(BomInputDto dto)
        {
            return await _bomService.AddBom(dto);
        }
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/bom/update")]
        public async Task<bool> UpdateBom(BomInputDto dto)
        {
            return await _bomService.UpdateBom(dto);
        }
        /// <summary>
        /// 更新配方详情
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/bom/updatebombatcing")]
        public async Task<bool> UpdateBomBatcing(BomBatcingInputDto dto)
        {
            return await _bomService.UpdateBomBatcing(dto);
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet("/api/bom/delete")]
        public async Task<bool> DeleteBom(string id)
        {
            return await _bomService.DeleteBom(id);
        }
        /// <summary>
        /// 添加配方分类
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/bom/addbomtype")]
        public async Task<bool> AddBomType(AddBomTypeInputDto dto)
        {
            return await _bomService.AddBomType(dto);
        }
        /// <summary>
        /// 配方分类列表
        /// </summary>
        /// <returns></returns>
        [HttpGet("/api/bom/getbomtypelist")]
        public async Task<List<dynamic>> GetBomTypeList()
        {
            return await _bomService.GetBomTypeList();
        }

        /// <summary>
        ///获取 配方列表
        /// </summary>
        /// <param name="inputDto"></param>
        /// <returns></returns>
        [HttpPost("/api/bom/BomPage")]
        public async Task<PageUtil> BomPage(BomPageInputDto inputDto)
        {
            return await _bomService.BomPage(inputDto);
        }

        /// <summary>
        /// 添加配方
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/bom/AddBom")]
        public async Task<bool> AddBom(BomCreateInputDto dto)
        {
            return await _bomService.AddBom(dto);
        }

        /// <summary>
        /// 删除配方
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/bom/DelBom")]
        public async Task<bool> DelBom(string id)
        {
            return await _bomService.DelBom(id);
        }
    }
}
