This commit is contained in:
18942506660
2024-11-05 09:48:57 +08:00
parent 5416303056
commit e0f0c786b9
4 changed files with 34 additions and 28 deletions

View File

@@ -26,6 +26,6 @@ namespace WMS.Web.Domain.IService.Public
/// 获取即时库存
/// </summary>
/// <returns></returns>
public Task<Result<List<LingXingInventoryResponse>>> GetInventory(LingXingInventoryRequest dto);
public Task<Result<List<LingXingInventoryResponse>>> GetInventory(List<int> ids);
}
}

View File

@@ -235,7 +235,7 @@ namespace WMS.Web.Domain.Services
var ids = resStock.Data.Where(w => listNames.Contains(w.Name)).Select(s => s.Id).ToList();
string strIds = string.Join(",", ids);
//获取领星库存
var resInventory = await _lingXingService.GetInventory(new Core.Dto.LingXing.LingXingInventoryRequest() { wid = strIds });
var resInventory = await _lingXingService.GetInventory(ids);
_logger.LogInformation($"拉取领星数据结果:{resInventory.IsSuccess} {resInventory.Message}");
if (!resInventory.IsSuccess) return resStock;

View File

@@ -142,13 +142,18 @@ namespace WMS.Web.Domain.Services.Public
/// <param name="dto"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public async Task<Result<List<LingXingInventoryResponse>>> GetInventory(LingXingInventoryRequest dto)
public async Task<Result<List<LingXingInventoryResponse>>> GetInventory(List<int> ids)
{
List<LingXingInventoryResponse> list = new List<LingXingInventoryResponse>();
foreach (var id in ids)
{
LingXingInventoryRequest dto = new LingXingInventoryRequest();
dto.wid = id.ToString();
//dto.length = 50;
//dto.sku = "NTONPOWER-OSP-3A2U-US-BK-4.6M";
var resUrl = await GetStr<LingXingInventoryRequest>("/erp/sc/routing/data/local_inventory/inventoryDetails", dto);
if (!resUrl.IsSuccess) return Result<List<LingXingInventoryResponse>>.ReFailure(ResultCodes.LingXingUrlError);
List<LingXingInventoryResponse> list = new List<LingXingInventoryResponse>();
var res = await _httpClientService.PostAsync<LingXingResponse>(resUrl.Data, JsonConvert.SerializeObject(dto), null);
if (res.Code != 0)
{
@@ -178,6 +183,7 @@ namespace WMS.Web.Domain.Services.Public
list.AddRange(d);
}
}
//var bcd = list.Where(w => w.SKU.Equals("NTONPOWER-OSP-3A2U-US-BK-4.6M")).ToList();
return Result<List<LingXingInventoryResponse>>.ReSuccess(list.Where(w => w.Product_Total > 0 && w.Product_Valid_Num > 0).ToList());
}