服务端的TigerApi 框架,基于.NET6 2024 版本
Rodney Chen
2024-03-23 5ec2816b25ccc33855c48da7f7f9305e21e6dc38
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
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
{
    /// <summary>
    /// 测试控制器
    /// </summary>
    public partial class TestController : ControllerBase
    {
        /// <summary>
        ///
        /// </summary>
        private readonly IInventroyInfo _IInventroyInfo = DI.Resolve<IInventroyInfo>();
        private readonly IDbBackup _DbBackup = DI.Resolve<IDbBackup>();
        [HttpPost]
        public async Task<IActionResult> SendMail([FromBody] ApiAction<SendMailEntity> 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());
        }
 
        /// <summary>
        /// 物料入库信息    物料名称、物料代码、物料供应商、数量、库位、储位、批次、入库时间
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IActionResult> 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);
        }
 
        /// <summary>
        /// 物料出库信息    领料单号、领料料号、数量、库位、储位、出库时间   
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IActionResult> 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);
        }
 
        /// <summary>
        /// 物料库存信息
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IActionResult> 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<IActionResult> 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);
        }
    }
}