服务端的TigerApi 框架,基于.NET6 2024 版本
Rodney Chen
2024-05-31 d4c326deaa51e7d4897a84afc339684012b8cfbe
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
using Newtonsoft.Json;
using Rhea.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using Tiger.Business.SqlSugarHepler;
using Tiger.IBusiness;
using Tiger.Model;
using Tiger.Model.Entitys.WMS.DTOS;
 
namespace Tiger.Business.WMS
{
    /// <summary>
    ///
    /// </summary>
    public class StockInfoBusiness : IStockInfoBusiness
    {
        /// <summary>
        /// 从T100获取库存信息
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public List<SaleOutInfoDetailDTO> GetStockInfo(StockInputDTO input)
        {
            #region 创建请求实体
 
            var model = new BodyDTO<PayLoad<Std_Data<StockInputDTO>>>()
            {
                host = new HostDTO(),
                datakey = new DataKey()
                {
                    EntId = "88",
                    CompanyId = input.site
                },
                service = new ServiceDTO()
                {
                    name = "wms_erp_wms_getmatstock"
                },
                payload = new PayLoad<Std_Data<StockInputDTO>>()
                {
                    std_data = new Std_Data<StockInputDTO>()
                    {
                        parameter = input
                    }
                }
            };
 
            #endregion 创建请求实体
 
            #region 发起请求
 
            var result = new T100ActionResult<resultStd_data<SaleOutInfoParameter>>();
            try
            {
                var requestJson = JsonConvert.SerializeObject(model);
                var response = HttpHelper.PostAsync(BizSqlsugar.t100Url, requestJson).Result;
                result = JsonConvert.DeserializeObject<T100ActionResult<resultStd_data<SaleOutInfoParameter>>>(response.Message);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message.ToString());
            }
 
            #endregion 发起请求
 
            var data = new List<SaleOutInfoDetailDTO>();
            if (result.payload.std_data.parameter?.@return.Count() > 0)
            {
                data = result.payload.std_data.parameter?.@return.Where(i => i.inag009 != 0).ToList();
                //count = result.payload.std_data.parameter.@return.Count();
            }
            return data;
        }
    }
}