using BPA.SAAS.Manage.Application.DataBase.Dtos.Batching;
using BPA.SAAS.Manage.Application.DataBase.Interface;
using BPA.SAAS.Manage.Core.Base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.SAAS.Manage.Application.DataBase
{
    [ApiDescriptionSettings("Batching", Tag = "物料基础信息")]
    public class BatchingServices: IDynamicApiController
    {
        IBatchingService _batchingService;
        public BatchingServices(IBatchingService batchingService)
        {
            _batchingService= batchingService;
        }
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/batching/getpage")]
        public async Task<PageUtil> GetBatchingList(BatchingListQuery dto)
        {
            return await _batchingService.GetBatchingList(dto);
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/batching/add")]
        public async Task<bool> AddBatching(BatchingInfoDto dto)
        {
            return await _batchingService.AddBatching(dto);
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/batching/update")]
        public async Task<bool> UpdateBatching(BatchingInfoDto dto)
        {
            return await _batchingService.UpdateBatching(dto);
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="Ids"></param>
        /// <returns></returns>
        [HttpPost("/api/batching/delete")]
        public async Task<bool> BatchDelBatching(List<string> Ids)
        {
            return await _batchingService.BatchDelBatching(Ids);
        }
        /// <summary>
        /// 物料列表
        /// </summary>
        /// <returns></returns>
        [HttpGet("/api/batching/getbatchinglist")]
        public async Task<Dictionary<string, object>> GetBatchingList()
        {
            return await _batchingService.GetBatchingList();
        }
        /// <summary>
        /// 物料列表
        /// </summary>
        /// <returns></returns>
        [HttpGet("/api/batching/getbatchingselectlist")]
        public async Task<List<BatchingList>> GetBatchingSelectList()
        {
            return await _batchingService.GetBatchingSelectList();
        }
        [HttpPost("/api/batching/updatebatchingstatus")]
        public async Task<bool> UpdateBatchingStatus(BatchingStatusDto dto)
        {
            return await _batchingService.UpdateBatchingStatus(dto);
        }
        /// <summary>
        /// 物料类型列表
        /// </summary>
        /// <returns></returns>
        [HttpGet("/api/batching/getbatchingtypelist")]
        public async Task<List<dynamic>> GetBatchingTypeList()
        {
            return await _batchingService.GetBatchingTypeList();
        }
        /// <summary>
        /// 添加物料类型
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/batching/addbatchingtype")]
        public async Task<bool> AddBatchingType(BatchingTypeDto dto)
        {
            return await _batchingService.AddBatchingType(dto);
        }
        /// <summary>
        /// 删除物料类型
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet("/api/batching/batchtypedel")]
        public async Task<bool> BatchTypeDel(string id)
        {
            return await _batchingService.BatchTypeDel(id);
        }
        /// <summary>
        /// 物料单位列表
        /// </summary>
        /// <returns></returns>
        [HttpGet("/api/batching/getbatchinguintList")]
        public async Task<List<dynamic>> GetBatchingUintList()
        {
            return await _batchingService.GetBatchingUintList();
        }
        /// <summary>
        /// 查询物料单位（外部接口）
        /// </summary>
        /// <returns></returns>
        [HttpGet("/api/batching/getbatchinguintlist_alm")]
        [AllowAnonymous]
        public async Task<List<dynamic>> GetBatchingUintList_alm()
        {
            return await _batchingService.GetBatchingUintList_alm();
        }
        /// <summary>
        /// 查询物料分类（外部接口）
        /// </summary>
        /// <returns></returns>
        [HttpGet("/api/batching/getbatchingtypelist_alm")]
        [AllowAnonymous]
        public async Task<List<dynamic>> GetBatchingTypeList_alm()
        {
            return await _batchingService.GetBatchingTypeList_alm();
        }
        /// <summary>
        /// 添加物料物料单位
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpPost("/api/batching/addbatchinguint")]
        public async Task<bool> AddBatchingUint(BatchingUintDto dto)
        {
            return await _batchingService.AddBatchingUint(dto);
        }
        /// <summary>
        /// 删除物料单位
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet("/api/batching/batchinguintdel")]
        public async Task<bool> BatchingUintDel(string id)
        {
            return await _batchingService.BatchingUintDel(id);
        }
        [HttpGet("/api/batching/getbytypebatching")]
        public async Task<List<BatchingView>> GetByTypeBatching()
        {
            return await _batchingService.GetByTypeBatching();
        }
    }
}
