using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Tiger.Model;
using Rhea.Common;
using Tiger.Model.SeaStone.Shelf;
using System.Threading;
using SqlSugar;
using Tiger.Model.Minsun;
using Tiger.IBusiness;
using Autofac;
namespace Tiger.Api.Controllers.Test
{
///
/// 测试控制器
///
public partial class TestController : ControllerBase
{
///
///
///
private readonly IInventroyInfo _IInventroyInfo = DI.Resolve();
private readonly IDbBackup _DbBackup = DI.Resolve();
[HttpPost]
public async Task SendMail([FromBody] ApiAction action)
{
_IMailServiceApi.SendMail(action.Data?.BodyEntity, action.Data?.SendServerConfigEntity);
//EmailHelper email = new EmailHelper(action.Data?.SendServerConfigEntity.SenderAccount, action.Data?.SendServerConfigEntity.SenderPassword);
//email.SendEmail(action.Data?.BodyEntity);
return Ok(action.GetResponse());
}
///
/// 物料入库信息 物料名称、物料代码、物料供应商、数量、库位、储位、批次、入库时间
///
///
///
[HttpPost]
public async Task GetInStoreInfoAsync(iParams param)
{
ApiAction response = new();
try
{
response = response.GetResponse(_IInventroyInfo.GetInStoreInfo(param));
}
catch (System.Exception ex)
{
response = response.GetResponse().CatchExceptionWithLog(ex);
}
return Ok(response);
}
///
/// 物料出库信息 领料单号、领料料号、数量、库位、储位、出库时间
///
///
///
[HttpPost]
public async Task GetOutStoreInfoAsync(iParams param)
{
ApiAction response = new();
try
{
response = response.GetResponse(_IInventroyInfo.GetOutStoreInfo(param));
}
catch (System.Exception ex)
{
response = response.GetResponse().CatchExceptionWithLog(ex);
}
return Ok(response);
}
///
/// 物料库存信息
///
///
///
[HttpPost]
public async Task GetStorageInfo(iParamsBase param)
{
ApiAction response = new();
try
{
response = response.GetResponse(_IInventroyInfo.GetStorageInfo(param));
}
catch (System.Exception ex)
{
response = response.GetResponse().CatchExceptionWithLog(ex);
}
return Ok(response);
}
[HttpPost]
public async Task ExcuteDbBackup([FromBody] ApiAction action)
{
ApiAction response = new();
try
{
response = response.GetResponse(_DbBackup.ExcuteBackupBat(action?.Data.ToString()));
}
catch (System.Exception ex)
{
response = response.GetResponse().CatchExceptionWithLog(ex);
}
return Ok(response);
}
}
}