供应商信息
This commit is contained in:
@@ -870,6 +870,26 @@
|
||||
业务组织(使用组织)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Core.Dto.Erp.Supplier.ErpSupplierDto">
|
||||
<summary>
|
||||
erp供应商基础数据
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.Erp.Supplier.ErpSupplierDto.Id">
|
||||
<summary>
|
||||
ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.Erp.Supplier.ErpSupplierDto.Number">
|
||||
<summary>
|
||||
编码
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.Erp.Supplier.ErpSupplierDto.Name">
|
||||
<summary>
|
||||
名称
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Core.Dto.Erp.TakeStock.ErpTakeStockSaveDto">
|
||||
<summary>
|
||||
盘点单
|
||||
|
||||
@@ -1618,6 +1618,12 @@
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.IService.Public.IErpService.BillQueryForSupplier">
|
||||
<summary>
|
||||
供应商
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.IService.Public.IErpService.BillQueryForStock">
|
||||
<summary>
|
||||
获取仓库信息
|
||||
@@ -2420,6 +2426,12 @@
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.Public.ErpService.BillQueryForSupplier">
|
||||
<summary>
|
||||
erp:供应商
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.Public.ErpService.BillQueryForStock">
|
||||
<summary>
|
||||
获取仓库
|
||||
|
||||
27
src/WMS.Web.Core/Dto/Erp/Supplier/ErpSupplierDto.cs
Normal file
27
src/WMS.Web.Core/Dto/Erp/Supplier/ErpSupplierDto.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WMS.Web.Core.Dto.Erp.Supplier
|
||||
{
|
||||
/// <summary>
|
||||
/// erp供应商基础数据
|
||||
/// </summary>
|
||||
public class ErpSupplierDto
|
||||
{
|
||||
/// <summary>
|
||||
/// ID
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 编码
|
||||
/// </summary>
|
||||
public string Number { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ using WMS.Web.Core.Dto.Erp;
|
||||
using WMS.Web.Core.Dto.Erp.Org;
|
||||
using WMS.Web.Core.Dto.Erp.OutStock;
|
||||
using WMS.Web.Core.Dto.Erp.Purchase;
|
||||
using WMS.Web.Core.Dto.Erp.Supplier;
|
||||
using WMS.Web.Core.Internal.Results;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
|
||||
@@ -60,6 +61,12 @@ namespace WMS.Web.Domain.IService.Public
|
||||
/// <returns></returns>
|
||||
Task<ResultList<ErpOrgDto>> BillQueryForOrg();
|
||||
|
||||
/// <summary>
|
||||
/// 供应商
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<ResultList<ErpSupplierDto>> BillQueryForSupplier();
|
||||
|
||||
/// <summary>
|
||||
/// 获取仓库信息
|
||||
/// </summary>
|
||||
|
||||
@@ -15,6 +15,7 @@ using WMS.Web.Core.Dto.Erp;
|
||||
using WMS.Web.Core.Dto.Erp.Org;
|
||||
using WMS.Web.Core.Dto.Erp.OutStock;
|
||||
using WMS.Web.Core.Dto.Erp.Purchase;
|
||||
using WMS.Web.Core.Dto.Erp.Supplier;
|
||||
using WMS.Web.Core.Dto.Erp.TakeStock;
|
||||
using WMS.Web.Core.Internal.Results;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
@@ -318,6 +319,76 @@ namespace WMS.Web.Domain.Services.Public
|
||||
return ResultList<ErpOrgDto>.ReFailure(ResultCodes.ErpOrgError);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// erp:供应商
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<ResultList<ErpSupplierDto>> BillQueryForSupplier()
|
||||
{
|
||||
try
|
||||
{
|
||||
//1.获取缓存中的物料数据;
|
||||
var cache_key = "erp_supplier_list";
|
||||
var suppliers = _memoryCache.Get<List<ErpSupplierDto>>(cache_key);
|
||||
if (suppliers == null || suppliers.Count == 0)
|
||||
{
|
||||
|
||||
//2.先登录金蝶-拿到token
|
||||
var token_result = await this.Init();
|
||||
if (!token_result.IsSuccess)
|
||||
return ResultList<ErpSupplierDto>.ReFailure(token_result);
|
||||
|
||||
//3.获取金蝶供应商:拼接参数和条件
|
||||
var query = new ErpBillQueryDto(token_result.Data);
|
||||
var param = new ErpBillQueryParamDto(FormIdParam.BD_Supplier.ToString());
|
||||
param.FieldKeys = "FSupplierId,FNumber,FName";
|
||||
param.Limit = 10000;
|
||||
//查询条件:备注其中的条件值以金蝶的值为准!!!
|
||||
param.FilterString = "";
|
||||
|
||||
//备注:因为供应商数据不是很多,就不能和获取物料一样循环获取;组织这里就获取10000条数据就行了
|
||||
var beginTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
_logger.LogInformation($"供应商拉取-开始时间:{beginTime}");
|
||||
//4.参数json化
|
||||
query.Data = JsonConvert.SerializeObject(param);
|
||||
var json = JsonConvert.SerializeObject(query);
|
||||
|
||||
//5.请求查询接口并返回数据
|
||||
var result_json = await _client.ExecuteBillQueryAsync(json);
|
||||
var result = JsonConvert.DeserializeObject<List<List<string>>>(result_json);
|
||||
|
||||
var endTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
_logger.LogInformation($"供应商拉取-结束时间:{endTime}");
|
||||
//6.拼装
|
||||
var list = new List<ErpSupplierDto>();
|
||||
foreach (var item in result)
|
||||
{
|
||||
var lis = new ErpSupplierDto();
|
||||
lis.Id = int.Parse(item[0]);
|
||||
lis.Number = item[1];
|
||||
lis.Name = item[2];
|
||||
list.Add(lis);
|
||||
|
||||
}
|
||||
//5.物料集合进行缓存
|
||||
_memoryCache.Set(cache_key, list, new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromHours(12)));
|
||||
_logger.LogInformation($"供应商拉取-总条数:{list.Count}");
|
||||
return ResultList<ErpSupplierDto>.ReSuccess(list);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return ResultList<ErpSupplierDto>.ReSuccess(suppliers);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return ResultList<ErpSupplierDto>.ReFailure(ResultCodes.ErpSupplierError);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取仓库
|
||||
/// </summary>
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace WMS.Web.Domain.Values
|
||||
public static ValueTuple<int, string> ContrastError = (80003, "箱物料对应的采购订单匹配失败,请核对后再试!");
|
||||
|
||||
public static ValueTuple<int, string> ErpOrgError = (80004, "获取Erp相关组织数据失败,请稍候再试!");
|
||||
public static ValueTuple<int, string> ErpSupplierError = (80005, "获取Erp相关供应商数据失败,请稍候再试!");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user