This commit is contained in:
tongfei
2023-11-08 14:35:00 +08:00
parent af3efb6556
commit 48eb94f14e
2 changed files with 74 additions and 64 deletions

View File

@@ -178,6 +178,8 @@ namespace WMS.Web.Domain.Services.Public
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public async Task<ResultList<ErpMaterialDto>> BillQueryForMaterial() public async Task<ResultList<ErpMaterialDto>> BillQueryForMaterial()
{
try
{ {
//1.获取缓存中的物料数据; //1.获取缓存中的物料数据;
var cache_key = "erp_materials_list"; var cache_key = "erp_materials_list";
@@ -248,6 +250,13 @@ namespace WMS.Web.Domain.Services.Public
{ {
return ResultList<ErpMaterialDto>.ReSuccess(materials); return ResultList<ErpMaterialDto>.ReSuccess(materials);
} }
}
catch (Exception)
{
return ResultList<ErpMaterialDto>.ReFailure(ResultCodes.ErpMaterialError);
}
} }
@@ -259,7 +268,7 @@ namespace WMS.Web.Domain.Services.Public
{ {
try try
{ {
//1.获取缓存中的物料数据; //1.获取缓存中的组织数据;
var cache_key = "erp_org_list"; var cache_key = "erp_org_list";
var orgs = _memoryCache.Get<List<ErpOrgDto>>(cache_key); var orgs = _memoryCache.Get<List<ErpOrgDto>>(cache_key);
if (orgs == null || orgs.Count == 0) if (orgs == null || orgs.Count == 0)
@@ -270,7 +279,7 @@ namespace WMS.Web.Domain.Services.Public
if (!token_result.IsSuccess) if (!token_result.IsSuccess)
return ResultList<ErpOrgDto>.ReFailure(token_result); return ResultList<ErpOrgDto>.ReFailure(token_result);
//3.获取金蝶物料:拼接参数和条件 //3.获取金蝶组织:拼接参数和条件
var query = new ErpBillQueryDto(token_result.Data); var query = new ErpBillQueryDto(token_result.Data);
var param = new ErpBillQueryParamDto(FormIdParam.ORG_Organizations.ToString()); var param = new ErpBillQueryParamDto(FormIdParam.ORG_Organizations.ToString());
param.FieldKeys = "FOrgID,FNumber,FName"; param.FieldKeys = "FOrgID,FNumber,FName";
@@ -302,7 +311,7 @@ namespace WMS.Web.Domain.Services.Public
list.Add(lis); list.Add(lis);
} }
//5.物料集合进行缓存 //5.组织集合进行缓存
_memoryCache.Set(cache_key, list, new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromHours(12))); _memoryCache.Set(cache_key, list, new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromHours(12)));
_logger.LogInformation($"组织拉取-总条数:{list.Count}"); _logger.LogInformation($"组织拉取-总条数:{list.Count}");
return ResultList<ErpOrgDto>.ReSuccess(list); return ResultList<ErpOrgDto>.ReSuccess(list);

View File

@@ -37,7 +37,8 @@ namespace WMS.Web.Domain.Values
public static ValueTuple<int, string> ErpOrgError = (80004, "获取Erp相关组织数据失败请稍候再试"); public static ValueTuple<int, string> ErpOrgError = (80004, "获取Erp相关组织数据失败请稍候再试");
public static ValueTuple<int, string> ErpSupplierError = (80005, "获取Erp相关供应商数据失败请稍候再试"); public static ValueTuple<int, string> ErpSupplierError = (80005, "获取Erp相关供应商数据失败请稍候再试");
public static ValueTuple<int, string> ErpStockError = (80005, "获取Erp相关仓库数据失败请稍候再试"); public static ValueTuple<int, string> ErpStockError = (80006, "获取Erp相关仓库数据失败请稍候再试");
public static ValueTuple<int, string> ErpMaterialError = (80007, "获取Erp相关物料数据失败请稍候再试");
} }
} }