From a769e6c7116d15074039f5e20db9cbdeb9e6608c Mon Sep 17 00:00:00 2001 From: tongfei <244188119@qq.com> Date: Sat, 28 Oct 2023 09:00:15 +0800 Subject: [PATCH] =?UTF-8?q?erp=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/WMS.Web.Core/Dto/Erp/Org/ErpOrgDto.cs | 6 ++++++ .../Services/Public/ErpService.cs | 21 +++++-------------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/WMS.Web.Core/Dto/Erp/Org/ErpOrgDto.cs b/src/WMS.Web.Core/Dto/Erp/Org/ErpOrgDto.cs index d80a8212..f422e4af 100644 --- a/src/WMS.Web.Core/Dto/Erp/Org/ErpOrgDto.cs +++ b/src/WMS.Web.Core/Dto/Erp/Org/ErpOrgDto.cs @@ -4,6 +4,9 @@ using System.Text; namespace WMS.Web.Core.Dto.Erp.Org { + /// + /// 金蝶组织-基本信息 + /// public class ErpOrgDto { /// @@ -11,6 +14,9 @@ namespace WMS.Web.Core.Dto.Erp.Org /// public int Id { get; set; } + /// + /// 名称 + /// public string Name { get; set; } } } diff --git a/src/WMS.Web.Domain/Services/Public/ErpService.cs b/src/WMS.Web.Domain/Services/Public/ErpService.cs index 1c599f86..65b079c6 100644 --- a/src/WMS.Web.Domain/Services/Public/ErpService.cs +++ b/src/WMS.Web.Domain/Services/Public/ErpService.cs @@ -53,21 +53,10 @@ namespace WMS.Web.Domain.Services.Public this._client = new ERPGWSoapClient(binding, address); try { - var appId = "wms"; - var cache_key = "erp_accesstoken_"+ appId; - var cache_value = _memoryCache.Get(cache_key); - if (!string.IsNullOrEmpty(cache_value)) - return Result.ReSuccess(cache_value); - else - { - var result = await this._client.ValidateSystemAsync(this._erpOptions.UserName, this._erpOptions.Password, this._erpOptions.ErpId, appId); - if (result == null) - return Result.ReFailure(ResultCodes.Erp_Login_Error); - - _memoryCache.Set(cache_key, true, new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromMinutes(30))); - return Result.ReSuccess(result.AccessToken); - } - + var result = await this._client.ValidateSystemAsync(this._erpOptions.UserName, this._erpOptions.Password, this._erpOptions.ErpId, ""); + if (result == null) + return Result.ReFailure(ResultCodes.Erp_Login_Error); + return Result.ReSuccess(result.AccessToken); } catch (Exception ex) { @@ -84,7 +73,7 @@ namespace WMS.Web.Domain.Services.Public try { var token_result = await this.Init(); - if(!token_result.IsSuccess) + if (!token_result.IsSuccess) return ResultList.ReFailure(token_result); var query = new ErpBillQueryDto(token_result.Data);