优化
This commit is contained in:
@@ -295,7 +295,7 @@ namespace WMS.Web.Domain.Services.Public
|
||||
|
||||
//2.时间条件:可能还有其它条件
|
||||
//var beginTime = DateTime.Now.AddDays(-2).ToString("yyyy-MM-dd 00:00:00");
|
||||
var beginTime= Convert.ToDateTime("2024-03-01 00:00:00");//正式环境 从3月1好开始
|
||||
var beginTime = Convert.ToDateTime("2024-03-01 00:00:00");//正式环境 从3月1好开始
|
||||
var endTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
//3.获取金蝶其他入库订单:拼接参数和条件
|
||||
var query = new ErpBillQueryDto(token_result.Data);
|
||||
@@ -813,10 +813,10 @@ namespace WMS.Web.Domain.Services.Public
|
||||
var materials = _memoryCache.Get<List<ErpMaterialDto>>(_erpOptions.cache_materail_key);
|
||||
if (materials == null || materials.Count == 0)
|
||||
{
|
||||
var mats= await _materialsRepositories.GetEntityList(100008);
|
||||
var mats = await _materialsRepositories.GetEntityList(100008);
|
||||
if (mats == null || mats.Count == 0)
|
||||
return await this.BillQueryForMaterialPagedList();
|
||||
else
|
||||
else
|
||||
{
|
||||
var beginTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
_logger.LogInformation($"物料拉取-开始时间:{beginTime}");
|
||||
@@ -839,7 +839,7 @@ namespace WMS.Web.Domain.Services.Public
|
||||
_memoryCache.Set(_erpOptions.cache_materail_key, erp_materials_list, new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromMinutes(DateTimeUtil.GetTotalMinutesTimeSpan())));
|
||||
var endTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
_logger.LogInformation($"物料拉取-结束时间:{endTime}");
|
||||
_logger.LogInformation($"物料拉取-总条数:{erp_materials_list.Count}");
|
||||
_logger.LogInformation($"物料拉取-本地数据库-总条数:{erp_materials_list.Count}");
|
||||
return ResultList<ErpMaterialDto>.ReSuccess(erp_materials_list);
|
||||
}
|
||||
|
||||
@@ -874,28 +874,14 @@ namespace WMS.Web.Domain.Services.Public
|
||||
if (mater == null)
|
||||
{
|
||||
//2.1没有的话:去金蝶取
|
||||
//mater = await this.BillQueryForMaterialById(id);
|
||||
var ent = await _materialsRepositories.Get(id);
|
||||
if (ent != null)
|
||||
mater = await this.BillQueryForMaterialById(id);
|
||||
if (mater != null)
|
||||
{
|
||||
var linshi_mat= await _materialsRepositories.Get(ent.MaterialNumber, 100008);
|
||||
if (linshi_mat != null)
|
||||
{
|
||||
mater = new ErpMaterialDto();
|
||||
mater.MaterialId = ent.MaterialId;
|
||||
mater.MaterialName = linshi_mat.MaterialName;
|
||||
mater.MaterialNumber = linshi_mat.MaterialNumber;
|
||||
mater.Specifications = linshi_mat.Specifications;
|
||||
mater.BaseUnitId = linshi_mat.BaseUnitId;
|
||||
mater.BaseUnitName = linshi_mat.BaseUnitName;
|
||||
mater.BaseUnitNumber = linshi_mat.BaseUnitNumber;
|
||||
mater.BarCode = linshi_mat.BarCode;
|
||||
mater.OrgId = linshi_mat.OrgId;
|
||||
//把取到的数据放集合中并重新给缓存
|
||||
materials.Add(mater);
|
||||
_memoryCache.Set(_erpOptions.cache_materail_key, materials, new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromMinutes(DateTimeUtil.GetTotalMinutesTimeSpan())));
|
||||
return Result<ErpMaterialDto>.ReSuccess(mater);
|
||||
}
|
||||
//把取到的数据放集合中并重新给缓存
|
||||
materials.Add(mater);
|
||||
_memoryCache.Set(_erpOptions.cache_materail_key, materials, new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromMinutes(DateTimeUtil.GetTotalMinutesTimeSpan())));
|
||||
return Result<ErpMaterialDto>.ReSuccess(mater);
|
||||
|
||||
}
|
||||
else
|
||||
return Result<ErpMaterialDto>.ReSuccess(null);
|
||||
@@ -911,7 +897,7 @@ namespace WMS.Web.Domain.Services.Public
|
||||
private async Task<ResultList<ErpMaterialDto>> BillQueryForMaterialPagedList()
|
||||
{
|
||||
//2.先登录金蝶-拿到token
|
||||
var token_result = await this.Init();
|
||||
var token_result = await this.Init();
|
||||
if (!token_result.IsSuccess)
|
||||
return ResultList<ErpMaterialDto>.ReFailure(token_result);
|
||||
|
||||
@@ -982,8 +968,8 @@ namespace WMS.Web.Domain.Services.Public
|
||||
_logger.LogInformation("物料拉取->错误的Json:" + error_josn);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -994,7 +980,7 @@ namespace WMS.Web.Domain.Services.Public
|
||||
private async Task<ErpMaterialDto> BillQueryForMaterialById(int id)
|
||||
{
|
||||
//2.先登录金蝶-拿到token
|
||||
var token_result = await this.Init();
|
||||
var token_result = await this.Init();
|
||||
if (!token_result.IsSuccess)
|
||||
return null;
|
||||
|
||||
@@ -1052,7 +1038,7 @@ namespace WMS.Web.Domain.Services.Public
|
||||
_logger.LogInformation("物料拉取按ID->错误的Json:" + error_josn);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1069,7 +1055,7 @@ namespace WMS.Web.Domain.Services.Public
|
||||
{
|
||||
|
||||
//2.先登录金蝶-拿到token
|
||||
var token_result = await this.Init();
|
||||
var token_result = await this.Init();
|
||||
if (!token_result.IsSuccess)
|
||||
return ResultList<ErpOrgDto>.ReFailure(token_result);
|
||||
|
||||
@@ -1137,7 +1123,7 @@ namespace WMS.Web.Domain.Services.Public
|
||||
{
|
||||
|
||||
//2.先登录金蝶-拿到token
|
||||
var token_result = await this.Init();
|
||||
var token_result = await this.Init();
|
||||
if (!token_result.IsSuccess)
|
||||
return ResultList<ErpSupplierDto>.ReFailure(token_result);
|
||||
|
||||
@@ -1204,7 +1190,7 @@ namespace WMS.Web.Domain.Services.Public
|
||||
{
|
||||
|
||||
//2.先登录金蝶-拿到token
|
||||
var token_result = await this.Init();
|
||||
var token_result = await this.Init();
|
||||
if (!token_result.IsSuccess)
|
||||
return ResultList<ErpCustomerDto>.ReFailure(token_result);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user