diff --git a/.vs/WMS.Web/DesignTimeBuild/.dtbcache.v2 b/.vs/WMS.Web/DesignTimeBuild/.dtbcache.v2 index 03701273..497f3f17 100644 Binary files a/.vs/WMS.Web/DesignTimeBuild/.dtbcache.v2 and b/.vs/WMS.Web/DesignTimeBuild/.dtbcache.v2 differ diff --git a/src/WMS.Web.Api/Controllers/TestController.cs b/src/WMS.Web.Api/Controllers/TestController.cs index 93c4a50e..8c363eef 100644 --- a/src/WMS.Web.Api/Controllers/TestController.cs +++ b/src/WMS.Web.Api/Controllers/TestController.cs @@ -28,6 +28,8 @@ using System.Reflection; using WMS.Web.Domain.Services; using SkiaSharp; using Google.Protobuf.Collections; +using NPOI.SS.Formula.Functions; +using System.Text.Json; namespace WMS.Web.Api.Controllers { @@ -57,11 +59,12 @@ namespace WMS.Web.Api.Controllers private readonly IMemoryCache _memoryCache; private readonly IRedisConcurrentProcessService _redisConcurrentProcessService; private IInStockService _inStockService; + private readonly ILingXingService _lingXingService; public TestController(IErpService erpService, IInStockTaskService inStockTaskService, IBoxInventoryRepositories boxInventoryRepositories, IRedisConcurrentProcessService redisConcurrentProcessService, IBasicsRepositories transactionRepositories, IOpsService opsService, IBoxService boxService, IBasicsRepositories basicsRepositories, IMemoryCache memoryCache, IOutStockTaskRepositories outStockTaskRepositories, IOutStockTaskService outStockTaskService, IOptions options, ILoginService loginService, ISendMessageService sendMessageService, ITakeStockService takeStockService, ITakeStockRepositories takeStockRepositories, IOutStockService outStockService, IInStockTaskRepositories inStockTaskRepositories, - IWebHostEnvironment env, IMaterialService materialService, IOutStockRepositories outStockRepositories, IInStockService inStockService) + IWebHostEnvironment env, IMaterialService materialService, IOutStockRepositories outStockRepositories, IInStockService inStockService, ILingXingService lingXingService) { _inStockService = inStockService; _redisConcurrentProcessService = redisConcurrentProcessService; @@ -85,12 +88,23 @@ namespace WMS.Web.Api.Controllers _outStockService = outStockService; _outStockRepositories = outStockRepositories; _env = env; + _lingXingService = lingXingService; } [HttpGet] [Route("hj")] public async Task TestHJ() { + ////var myJson = "{\"name\":\"小明\",\"address\":\"威海\"}";//json字符串 + //var myJson= "{\"code\":\"200\",\"msg\":\"OK\",\"data\":{\"access_token\":\"05895ad6-e318-41da-9b2c-579dedd18fd1\",\"refresh_token\":\"ad9145cf-8af9-4617-9dbe-187b0ff3edf9\",\"expires_in\":7162}}"; + //var myObj = JsonConvert.DeserializeObject(myJson);//反序列化为 dynamic 对象 + //var my2 = System.Text.Json.JsonSerializer.Deserialize(myJson); + //string m = myObj.code; + //var m2 = my2.Object; + //var md = m2.code; + + await _lingXingService.GetStock(); + //List list = new List(); //list.Add("GD-02-15"); //list.Add("GD-01-15"); diff --git a/src/WMS.Web.Api/appsettings.json b/src/WMS.Web.Api/appsettings.json index 8d69e2a9..7b63d062 100644 --- a/src/WMS.Web.Api/appsettings.json +++ b/src/WMS.Web.Api/appsettings.json @@ -46,6 +46,11 @@ "UserName": "admin", "PassWord": "888888" }, + "LingXingOptions": { + "Url": "https://openapi.lingxing.com", + "AppId": "ak_QGK2J8TssERmu", + "AppSecret": "n/HUKD2wVdTbvhnFZbVBPw==" + }, "Qiniu": { "AccessKey": "dOsTum4a5qvhPTBbZRPX0pIOU7PZWRX7htKjztms", "SecretKey": "KFxsGbnErkALFfeGdMa8QWTdodJbamMX0iznLe-q", diff --git a/src/WMS.Web.Api/wwwroot/WMS.Web.Api.xml b/src/WMS.Web.Api/wwwroot/WMS.Web.Api.xml index 4a712d9a..0e430568 100644 --- a/src/WMS.Web.Api/wwwroot/WMS.Web.Api.xml +++ b/src/WMS.Web.Api/wwwroot/WMS.Web.Api.xml @@ -579,7 +579,7 @@ - + 导出 diff --git a/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml b/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml index c53adb3b..d6112558 100644 --- a/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml +++ b/src/WMS.Web.Api/wwwroot/WMS.Web.Core.xml @@ -3969,6 +3969,36 @@ wms箱ID + + + 领星登录 + + + + + id + + + + + Secret + + + + + 领星请求 + + + + + 页码 + + + + + 页条数 + + 客户端名称 diff --git a/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml b/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml index 43b9bb7b..9989a112 100644 --- a/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml +++ b/src/WMS.Web.Api/wwwroot/WMS.Web.Domain.xml @@ -4310,6 +4310,11 @@ + + + 领星服务接口 + + 登录服务接口 @@ -6271,6 +6276,43 @@ + + + 领星服务接口 + + + + + 获取所有仓库 + + + + + + 32位MD5加密 + + 要加密字符串 + 是否以小写方式返回 + + + + + AES加密 + + 需要加密的字符串 + 32位密钥 + 向量(默认偏移量) + 加密后的字符串 + + + + 类实体的属性与值转化成键值对形式 + + + + + + 创建token diff --git a/src/WMS.Web.Core/Dto/LingXing/LingXingInventoryRequest.cs b/src/WMS.Web.Core/Dto/LingXing/LingXingInventoryRequest.cs new file mode 100644 index 00000000..1f7d10d7 --- /dev/null +++ b/src/WMS.Web.Core/Dto/LingXing/LingXingInventoryRequest.cs @@ -0,0 +1,20 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; + +namespace WMS.Web.Core.Dto.LingXing +{ + /// + /// 领星即时库存 + /// + [Serializable] + public class LingXingInventoryRequest:LingXingRequest + { + /// + /// 仓库Id 1,3,234,33 + /// + [JsonProperty("offset")] + public string wid { get; set; } + } +} diff --git a/src/WMS.Web.Core/Dto/LingXing/LingXingInventoryResponse.cs b/src/WMS.Web.Core/Dto/LingXing/LingXingInventoryResponse.cs new file mode 100644 index 00000000..030c15ba --- /dev/null +++ b/src/WMS.Web.Core/Dto/LingXing/LingXingInventoryResponse.cs @@ -0,0 +1,41 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; + +namespace WMS.Web.Core.Dto.LingXing +{ + /// + /// 领星即时库存 + /// + [Serializable] + public class LingXingInventoryResponse + { + /// + /// 仓库Id + /// + [JsonProperty("wid")] + public int StockId { get; set; } + /// + /// SKU + /// + [JsonProperty("sku")] + public string SKU { get; set; } + /// + /// 店铺id + /// + [JsonProperty("seller_id")] + public string SellerId { get; set; } + /// + /// 库存总量 + /// + [JsonProperty("product_total")] + public decimal Product_Total { get; set; } + /// + /// 可用量 + /// + [JsonProperty("product_valid_num")] + public decimal Product_Valid_Num { get; set; } + + } +} diff --git a/src/WMS.Web.Core/Dto/LingXing/LingXingLoginRequest.cs b/src/WMS.Web.Core/Dto/LingXing/LingXingLoginRequest.cs new file mode 100644 index 00000000..b785544c --- /dev/null +++ b/src/WMS.Web.Core/Dto/LingXing/LingXingLoginRequest.cs @@ -0,0 +1,24 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; + +namespace WMS.Web.Core.Dto.LingXing +{ + /// + /// 领星登录 + /// + public class LingXingLoginRequest + { + /// + /// id + /// + [JsonProperty("appId")] + public string AppId { get; set; } + /// + /// Secret + /// + [JsonProperty("appSecret")] + public string AppSecret { get; set; } + } +} diff --git a/src/WMS.Web.Core/Dto/LingXing/LingXingRequest.cs b/src/WMS.Web.Core/Dto/LingXing/LingXingRequest.cs new file mode 100644 index 00000000..2c388b5a --- /dev/null +++ b/src/WMS.Web.Core/Dto/LingXing/LingXingRequest.cs @@ -0,0 +1,24 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; + +namespace WMS.Web.Core.Dto.LingXing +{ + /// + /// 领星请求 + /// + public class LingXingRequest + { + /// + /// 页码 + /// + [JsonProperty("offset")] + public int offset { get; set; } = 1; + /// + /// 页条数 + /// + [JsonProperty("ength")] + public int ength { get; set; } = 1000; + } +} diff --git a/src/WMS.Web.Core/Dto/LingXing/LingXingResponse.cs b/src/WMS.Web.Core/Dto/LingXing/LingXingResponse.cs new file mode 100644 index 00000000..99499c51 --- /dev/null +++ b/src/WMS.Web.Core/Dto/LingXing/LingXingResponse.cs @@ -0,0 +1,23 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; + +namespace WMS.Web.Core.Dto.LingXing +{ + [Serializable] + public class LingXingResponse + { + public LingXingResponse() { } + [JsonProperty("code")] + public int Code { get; set; } + [JsonProperty("message")] + public string Message { get; set; } + [JsonProperty("error_details")] + public List Error_details { get; set; } + [JsonProperty("total")] + public int Total { get; set; } + [JsonProperty("data")] + public List Data { get; set; } + } +} diff --git a/src/WMS.Web.Core/Dto/LingXing/LingXingStockResponse.cs b/src/WMS.Web.Core/Dto/LingXing/LingXingStockResponse.cs new file mode 100644 index 00000000..9d45b70d --- /dev/null +++ b/src/WMS.Web.Core/Dto/LingXing/LingXingStockResponse.cs @@ -0,0 +1,17 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; + +namespace WMS.Web.Core.Dto.LingXing +{ + [Serializable] + public class LingXingStockResponse + { + public LingXingStockResponse() { } + [JsonProperty("wid")] + public int Id { get; set; } + [JsonProperty("name")] + public string Name { get; set; } + } +} diff --git a/src/WMS.Web.Domain/IService/Public/IHttpClientService.cs b/src/WMS.Web.Domain/IService/Public/IHttpClientService.cs index 42a5e48c..6e340c73 100644 --- a/src/WMS.Web.Domain/IService/Public/IHttpClientService.cs +++ b/src/WMS.Web.Domain/IService/Public/IHttpClientService.cs @@ -13,6 +13,7 @@ namespace WMS.Web.Domain.IService.Public Task GetAsync(string url, Dictionary dicHeaders, int timeoutSecond = 180); Task PostAsync(string url, string requestBody, int timeoutSecond = 180); Task PostAsync(string url, string requestBody, Dictionary dicHeaders, int timeoutSecond = 180); + Task PostAsync(string url, HttpContent content, Dictionary dicHeaders, int timeoutSecond = 180); Task ExecuteAsync(string url, HttpMethod method, string requestBody, Dictionary dicHeaders, int timeoutSecond = 180); } } diff --git a/src/WMS.Web.Domain/IService/Public/ILingXingService.cs b/src/WMS.Web.Domain/IService/Public/ILingXingService.cs new file mode 100644 index 00000000..285487b0 --- /dev/null +++ b/src/WMS.Web.Domain/IService/Public/ILingXingService.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using WMS.Web.Core.Dto.LingXing; +using WMS.Web.Core.Internal.Results; + +namespace WMS.Web.Domain.IService.Public +{ + /// + /// 领星服务接口 + /// + public interface ILingXingService + { + /// + /// 获取领星所有仓库 + /// + /// + public Task>> GetStock(); + /// + /// 获取即时库存 + /// + /// + public Task>> GetInventory(LingXingInventoryRequest dto); + } +} diff --git a/src/WMS.Web.Domain/Options/lingXingOptions.cs b/src/WMS.Web.Domain/Options/lingXingOptions.cs new file mode 100644 index 00000000..8027ea61 --- /dev/null +++ b/src/WMS.Web.Domain/Options/lingXingOptions.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace WMS.Web.Domain.Options +{ + /// + /// 领星配置 + /// + public class lingXingOptions + { + public string Url { get; set; } + public string AppId { get; set; } + public string AppSecret { get; set; } + } +} diff --git a/src/WMS.Web.Domain/Services/Public/HttpClientService.cs b/src/WMS.Web.Domain/Services/Public/HttpClientService.cs index 016bd2dd..c88020b7 100644 --- a/src/WMS.Web.Domain/Services/Public/HttpClientService.cs +++ b/src/WMS.Web.Domain/Services/Public/HttpClientService.cs @@ -226,5 +226,20 @@ namespace WMS.Web.Domain.Services.Public if (timeoutSecond != null) httpClient.Timeout = TimeSpan.FromSeconds(timeoutSecond.Value); return httpClient; } + + public async Task PostAsync(string url, HttpContent content, Dictionary dicHeaders, int timeoutSecond = 180) + { + var client = BuildHttpClient(dicHeaders, timeoutSecond); + var response = await client.PostAsync(url, content); + var responseContent = await response.Content.ReadAsStringAsync(); + if (response.IsSuccessStatusCode) + { + var t = Newtonsoft.Json.JsonConvert.DeserializeObject(responseContent); + return t; + } + + _logger.LogError($"HttpGet:{url} Error:{responseContent}"); + throw new WebHttpException(response.StatusCode.ToString(), responseContent); + } } } diff --git a/src/WMS.Web.Domain/Services/Public/LingXingService.cs b/src/WMS.Web.Domain/Services/Public/LingXingService.cs new file mode 100644 index 00000000..537d6838 --- /dev/null +++ b/src/WMS.Web.Domain/Services/Public/LingXingService.cs @@ -0,0 +1,300 @@ +using Microsoft.Extensions.Caching.Memory; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using WMS.Web.Core.Dto; +using WMS.Web.Domain.IService.Public; +using WMS.Web.Domain.Options; +using WMS.Web.Core.Internal.Results; +using WMS.Web.Core.Dto.LingXing; +using System.Json; +using System.Net.Http; +using NPOI.POIFS.Crypt.Dsig; +using NPOI.SS.Formula.Functions; +using System.Configuration; +using System.Linq; +using System.Net; +using System.Text.RegularExpressions; +using System.Security.Cryptography; +using System.Reflection; +using WMS.Web.Core.Help; +using static System.Net.WebRequestMethods; +using WMS.Web.Domain.Values; + +namespace WMS.Web.Domain.Services.Public +{ + /// + /// 领星服务接口 + /// + public class LingXingService : ILingXingService + { + private readonly IHttpClientService _httpClientService; + private readonly ILogger _logger; + private readonly IMemoryCache _memoryCache; + private int hours = 10;//过期时间 默认10小时 + private readonly lingXingOptions _option; + + public LingXingService(IHttpClientService httpClientService, ILogger logger, + IMemoryCache memoryCache, IOptions option) + { + this._memoryCache = memoryCache; + this._httpClientService = httpClientService; + this._logger = logger; + _option = option?.Value; + } + + public async Task> Login() + { + string endStr = "/api/auth-server/oauth/access-token"; + + var formData = new MultipartFormDataContent(); + formData.Add(new StringContent(_option.AppId), "appId"); + formData.Add(new StringContent(_option.AppSecret), "appSecret"); + + var res = await _httpClientService.PostAsync(_option.Url + endStr, formData, null); + + if (res.code != "200") + { + _logger.LogInformation($"领星获取授权失败:{res.msg}"); + return Result.ReFailure(ResultCodes.LingXingTokenError); + } + string token = res.data.access_token; + return Result.ReSuccess(token); + } + /// + /// 获取所有仓库 + /// + /// + public async Task>> GetStock() + { + var request = new LingXingRequest(); + var resUrl =await GetStr("/erp/sc/data/local_inventory/warehouse", request); + if (!resUrl.IsSuccess) return Result>.ReFailure(ResultCodes.LingXingUrlError); + + var res = await _httpClientService.PostAsync>(resUrl.Data, JsonConvert.SerializeObject(request), null); + if (res.Code!=0) return Result>.ReFailure(ResultCodes.LingXingDataError); + + return Result>.ReSuccess(res.Data); + } + /// + /// 获取即使库存 + /// + /// + /// + /// + public async Task>> GetInventory(LingXingInventoryRequest dto) + { + var resUrl = await GetStr("/erp/sc/routing/data/local_inventory/inventoryDetails", dto); + if (!resUrl.IsSuccess) return Result>.ReFailure(ResultCodes.LingXingUrlError); + + var res = await _httpClientService.PostAsync>(resUrl.Data, JsonConvert.SerializeObject(dto), null); + if (res.Code != 0) return Result>.ReFailure(ResultCodes.LingXingDataError); + + return Result>.ReSuccess(res.Data); + } + #region 基础函数 + public async Task> GetStr(string urlStr,T data) + { + var res = await Login(); + if (!res.IsSuccess)return res; + + LxSignInfo lxSign = new LxSignInfo(); + + lxSign.access_token = res.Data; + lxSign.app_key = _option.AppId; + lxSign.timestamp = DateTime.Now.DateTimeToTimeStamp().ToString(); + + #region ASCII排序 + Dictionary testParamDics = new Dictionary(); + var ssi = GetEntityPropertyToDic(testParamDics, lxSign.GetType().GetProperties(), lxSign);//把签名参数实体转化为键值对 + var ssdata = GetEntityPropertyToDic(testParamDics, data.GetType().GetProperties(), data);//把参数实体转化为键值对 + + // List> list = new List>(); + Dictionary list = new Dictionary(); + //string[] arrays = new string[data]; + + foreach (var item in typeof(LxSignInfo).GetProperties()) + { + //KeyValueInfo keys = new KeyValueInfo(); + //keys.Key = item.Name; + //keys.Value = ssi[$"{item.Name}"].ToString(); + //list.Add(keys); + list.Add(item.Name, ssi[$"{item.Name}"].ToString()); + } + + foreach (var item in typeof(T).GetProperties()) + { + //KeyValueInfo keys = new KeyValueInfo(); + //keys.Key = item.Name; + //keys.Value = JsonConvert.SerializeObject(ssdata[$"{item.Name}"]); + + //if (ssdata[$"{item.Name}"] == null) { list.Add(keys); continue; } + //if (string.IsNullOrEmpty(ssdata[$"{item.Name}"].ToString())) + //{ + // continue;//跳过值为NULL的 + //} + + if (ssdata[$"{item.Name}"] == null) { list.Add(item.Name, JsonConvert.SerializeObject(ssdata[$"{item.Name}"])); continue; } + if (string.IsNullOrEmpty(ssdata[$"{item.Name}"].ToString())) + { + continue;//跳过值为NULL的 + } + + list.Add(item.Name, JsonConvert.SerializeObject(ssdata[$"{item.Name}"])); + } + + string[] arrays = new string[list.Count]; + + int i = 0; + foreach (var item in list) + { + arrays[i] = item.Key; + + i++; + } + + Array.Sort(arrays, string.CompareOrdinal); //ASCII排序 + + string sig = null; + int j = 0; + foreach (var item in arrays) + { + string key = list.Where(a => a.Key == item).ToList()[0].Key.ToString(); + string value = list.Where(a => a.Key == item).ToList()[0].Value.ToString(); + + #region 清除嵌套外的字段值的双引号 + if (value.IndexOf("{", StringComparison.OrdinalIgnoreCase) > -1) { } + else + { + value = Regex.Replace(value, @"[\""]+", "");//去掉双引号 + } + #endregion + + if (j == i - 1) + { + sig += $"{key}={value}"; + } + else + { + sig += $"{key}={value}&"; + } + + j++; + } + #endregion + + #region MD5加密转大写+AES/ECB/PKCS5PADDING加密 + //sig = Regex.Replace(sig, @"[\""]+", "");//去掉双引号 + var md5 = MD5Encrypt(sig, false); + var signs = Encrypt(md5, lxSign.app_key); + #endregion + + #region 字符转义 + + signs = WebUtility.UrlEncode(signs); + #endregion + + #region 形成签名地址 + var url = _option.Url + urlStr; + var ret = $"{url}?app_key={lxSign.app_key}&access_token={lxSign.access_token}×tamp={lxSign.timestamp}&sign={signs}"; + return Result.ReSuccess(ret); + #endregion + } + + /// + /// 32位MD5加密 + /// + /// 要加密字符串 + /// 是否以小写方式返回 + /// + public static string MD5Encrypt(string strText, bool IsLower = true) + { + MD5 md5 = new MD5CryptoServiceProvider(); + byte[] bytes = System.Text.Encoding.UTF8.GetBytes(strText); + bytes = md5.ComputeHash(bytes); + md5.Clear(); + + string ret = ""; + for (int i = 0; i < bytes.Length; i++) + { + ret += Convert.ToString(bytes[i], 16).PadLeft(2, '0'); + + } + if (IsLower == false) { return ret.PadLeft(32, '0').ToUpper(); } + return ret.PadLeft(32, '0'); + } + /// + /// AES加密 + /// + /// 需要加密的字符串 + /// 32位密钥 + ///向量(默认偏移量) + /// 加密后的字符串 + public static string Encrypt(string str, string key) + { + try + { + + Byte[] keyArray = System.Text.Encoding.UTF8.GetBytes(key); + Byte[] toEncryptArray = System.Text.Encoding.UTF8.GetBytes(str); + var rijndael = new System.Security.Cryptography.RijndaelManaged(); + rijndael.Key = keyArray; + rijndael.Mode = System.Security.Cryptography.CipherMode.ECB; + rijndael.Padding = System.Security.Cryptography.PaddingMode.PKCS7; + rijndael.IV = System.Text.Encoding.UTF8.GetBytes(key); + System.Security.Cryptography.ICryptoTransform cTransform = rijndael.CreateEncryptor(); + Byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length); + return Convert.ToBase64String(resultArray, 0, resultArray.Length); + + } + catch (Exception ex) + { + //YellowJLog("调用AES加密方法异常,异常原因:" + ex.Message, "加密异常"); + return ""; + } + } + + /// + /// 类实体的属性与值转化成键值对形式 + /// + /// + /// + /// + /// + public static Dictionary GetEntityPropertyToDic(Dictionary inParam, PropertyInfo[] infos, T Entity) + { + foreach (var info in infos) + { + var itemTpe = info.PropertyType; + //实体中有嵌套类的处理 + if (itemTpe.IsClass && !itemTpe.Name.Equals("String", StringComparison.OrdinalIgnoreCase)) + { + //if (info.GetValue(Entity) == null) continue; + //GetEntityPropertyToDic(inParam, itemTpe.GetProperties(), info.GetValue(Entity)); + //inParam.Add(info.Name, info.GetValue(JsonConvert.SerializeObject(Entity), null)); + inParam.Add(info.Name, info.GetValue(Entity, null)); + } + else + { + + inParam.Add(info.Name, info.GetValue(Entity, null)); + //sig = Regex.Replace(sig, @"[\""]+", "");//去掉双引号 + } + } + + return inParam; + } + + #endregion + } + public class LxSignInfo + { + public string access_token { get; set; } + public string app_key { get; set; } + public string timestamp { get; set; } + } +} diff --git a/src/WMS.Web.Domain/Values/ResultCodes.cs b/src/WMS.Web.Domain/Values/ResultCodes.cs index 06a356cc..046d1bbe 100644 --- a/src/WMS.Web.Domain/Values/ResultCodes.cs +++ b/src/WMS.Web.Domain/Values/ResultCodes.cs @@ -97,5 +97,9 @@ namespace WMS.Web.Domain.Values public static ValueTuple SubscribeNotificationNoData = (700001, "订阅通知信息不存在"); public static ValueTuple GetBarCodeSerialNumberError = (800001, "获取序列码异常"); + + public static ValueTuple LingXingTokenError = (810001, "获取领星授权失败"); + public static ValueTuple LingXingUrlError = (810002, "拼接领星请求参数失败"); + public static ValueTuple LingXingDataError = (810003, "请求领星数据失败"); } } diff --git a/src/WMS.Web.Repositories/DependencyInjection/AppBuilder.cs b/src/WMS.Web.Repositories/DependencyInjection/AppBuilder.cs index bde012a3..c9a72a1e 100644 --- a/src/WMS.Web.Repositories/DependencyInjection/AppBuilder.cs +++ b/src/WMS.Web.Repositories/DependencyInjection/AppBuilder.cs @@ -182,7 +182,9 @@ namespace WMS.Web.Repositories.DependencyInjection Services.Configure(Configuration.GetSection("EmailOptions")); Services.AddOptions(); Services.Configure(Configuration.GetSection("SmsOptions")); - + Services.AddOptions(); + Services.Configure(Configuration.GetSection("LingXingOptions")); + } @@ -345,6 +347,7 @@ namespace WMS.Web.Repositories.DependencyInjection Services.AddTransient(); Services.AddTransient(); Services.AddTransient(); + Services.AddTransient(); }