修复bug
This commit is contained in:
@@ -56,7 +56,7 @@ namespace WMS.Web.Domain.Services.Public
|
||||
formData.Add(new StringContent(_option.AppSecret), "appSecret");
|
||||
|
||||
var res = await _httpClientService.PostAsync<dynamic>(_option.Url + endStr, formData, null);
|
||||
|
||||
|
||||
if (res.code != "200")
|
||||
{
|
||||
_logger.LogInformation($"领星获取授权失败:{res.msg}");
|
||||
@@ -72,13 +72,13 @@ namespace WMS.Web.Domain.Services.Public
|
||||
public async Task<Result<List<LingXingStockResponse>>> GetStock()
|
||||
{
|
||||
var request = new LingXingRequest();
|
||||
var resUrl =await GetStr<LingXingRequest>("/erp/sc/data/local_inventory/warehouse", request);
|
||||
var resUrl = await GetStr<LingXingRequest>("/erp/sc/data/local_inventory/warehouse", request);
|
||||
if (!resUrl.IsSuccess) return Result<List<LingXingStockResponse>>.ReFailure(ResultCodes.LingXingUrlError);
|
||||
|
||||
var res = await _httpClientService.PostAsync<LingXingResponse<LingXingStockResponse>>(resUrl.Data, JsonConvert.SerializeObject(request), null);
|
||||
if (res.Code!=0) return Result<List<LingXingStockResponse>>.ReFailure(ResultCodes.LingXingDataError);
|
||||
|
||||
return Result<List<LingXingStockResponse>>.ReSuccess(res.Data);
|
||||
|
||||
var res = await _httpClientService.PostAsync<LingXingResponse>(resUrl.Data, JsonConvert.SerializeObject(request), null);
|
||||
if (res.Code != 0) return Result<List<LingXingStockResponse>>.ReFailure(ResultCodes.LingXingDataError);
|
||||
|
||||
return Result<List<LingXingStockResponse>>.ReSuccess(JsonConvert.DeserializeObject<List<LingXingStockResponse>>(res.Data.ToString()));
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取即使库存
|
||||
@@ -88,19 +88,31 @@ namespace WMS.Web.Domain.Services.Public
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task<Result<List<LingXingInventoryResponse>>> GetInventory(LingXingInventoryRequest dto)
|
||||
{
|
||||
var resUrl = await GetStr<LingXingRequest>("/erp/sc/routing/data/local_inventory/inventoryDetails", dto);
|
||||
var resUrl = await GetStr<LingXingInventoryRequest>("/erp/sc/routing/data/local_inventory/inventoryDetails", dto);
|
||||
if (!resUrl.IsSuccess) return Result<List<LingXingInventoryResponse>>.ReFailure(ResultCodes.LingXingUrlError);
|
||||
|
||||
var res = await _httpClientService.PostAsync<LingXingResponse<LingXingInventoryResponse>>(resUrl.Data, JsonConvert.SerializeObject(dto), null);
|
||||
List<LingXingInventoryResponse> list = new List<LingXingInventoryResponse>();
|
||||
var res = await _httpClientService.PostAsync<LingXingResponse>(resUrl.Data, JsonConvert.SerializeObject(dto), null);
|
||||
if (res.Code != 0) return Result<List<LingXingInventoryResponse>>.ReFailure(ResultCodes.LingXingDataError);
|
||||
list.AddRange(JsonConvert.DeserializeObject<List<LingXingInventoryResponse>>(res.Data.ToString()));
|
||||
|
||||
return Result<List<LingXingInventoryResponse>>.ReSuccess(res.Data);
|
||||
int num = res.Total / 800;
|
||||
for (int i = 1; i <= num; i++)
|
||||
{
|
||||
dto.offset = i;
|
||||
if (i == num) dto.length = res.Total - (num * 800);
|
||||
resUrl = await GetStr<LingXingInventoryRequest>("/erp/sc/routing/data/local_inventory/inventoryDetails", dto);
|
||||
if (!resUrl.IsSuccess) return Result<List<LingXingInventoryResponse>>.ReFailure(ResultCodes.LingXingUrlError);
|
||||
res = await _httpClientService.PostAsync<LingXingResponse>(resUrl.Data, JsonConvert.SerializeObject(dto), null);
|
||||
if (res.Code != 0) return Result<List<LingXingInventoryResponse>>.ReFailure(ResultCodes.LingXingDataError);
|
||||
list.AddRange(JsonConvert.DeserializeObject<List<LingXingInventoryResponse>>(res.Data.ToString()));
|
||||
}
|
||||
return Result<List<LingXingInventoryResponse>>.ReSuccess(list.Where(w => w.Product_Total > 0 && w.Product_Valid_Num > 0).ToList());
|
||||
}
|
||||
#region 基础函数
|
||||
public async Task<Result<string>> GetStr<T>(string urlStr,T data)
|
||||
public async Task<Result<string>> GetStr<T>(string urlStr, T data)
|
||||
{
|
||||
var res = await Login();
|
||||
if (!res.IsSuccess)return res;
|
||||
if (!res.IsSuccess) return res;
|
||||
|
||||
LxSignInfo lxSign = new LxSignInfo();
|
||||
|
||||
@@ -131,7 +143,7 @@ namespace WMS.Web.Domain.Services.Public
|
||||
//KeyValueInfo<string, string> keys = new KeyValueInfo<string, string>();
|
||||
//keys.Key = item.Name;
|
||||
//keys.Value = JsonConvert.SerializeObject(ssdata[$"{item.Name}"]);
|
||||
|
||||
|
||||
//if (ssdata[$"{item.Name}"] == null) { list.Add(keys); continue; }
|
||||
//if (string.IsNullOrEmpty(ssdata[$"{item.Name}"].ToString()))
|
||||
//{
|
||||
|
||||
Reference in New Issue
Block a user