增加日志

This commit is contained in:
18942506660
2024-10-24 09:54:46 +08:00
parent 90c2dad7d5
commit 98674ceced
5 changed files with 32 additions and 6 deletions

View File

@@ -121,10 +121,10 @@ namespace WMS.Web.Api.Controllers
//var list = await _erpService.BillQueryForInventory(request);
//var b33 = await _juShuiTanService.GetStock();
//var b = b33.Data.Where(w => w.Id == 10923342).FirstOrDefault();
//await _juShuiTanService.GetTest();
//await _juShuiTanService.GetTest();
//string codes = "AD";
//var b = await _erpInventoryService.GetInventory(codes);
//var bcd=await _productInventoryService.Refresh();
var bcd=await _productInventoryService.JuShuiTan();
//LingXingResponse<LingXingStockResponse> r = new LingXingResponse<LingXingStockResponse>();

View File

@@ -18,6 +18,7 @@ using WMS.Web.Core.Help;
using WMS.Web.Core.Internal.Results;
using WMS.Web.Domain.IService.Public;
using WMS.Web.Domain.Options;
using WMS.Web.Domain.Values;
namespace WMS.Web.Domain.Services.Public
{
@@ -57,7 +58,10 @@ namespace WMS.Web.Domain.Services.Public
JObject resData = JObject.Parse(resContent);
if (Convert.ToInt32(resData["code"]) != 0)
{
_logger.LogInformation($"聚水潭获取仓库失败:{resData["msg"].ToString()}");
return Result<List<JuShuiTanInventoryResponse>>.ReFailure(ResultCodes.JuShuiTanDataError);
}
string json = resData["data"]["datas"].ToString();
var datas = JsonConvert.DeserializeObject<List<JuShuiTanStockResponse>>(json);
list.AddRange(datas);
@@ -70,7 +74,10 @@ namespace WMS.Web.Domain.Services.Public
resData = JObject.Parse(resContent);
if (Convert.ToInt32(resData["code"]) != 0)
{
_logger.LogInformation($"聚水潭获取仓库失败:{resData["msg"].ToString()}");
return Result<List<JuShuiTanInventoryResponse>>.ReFailure(ResultCodes.JuShuiTanDataError);
}
json = resData["data"]["datas"].ToString();
datas = JsonConvert.DeserializeObject<List<JuShuiTanStockResponse>>(json);
list.AddRange(datas);
@@ -90,13 +97,16 @@ namespace WMS.Web.Domain.Services.Public
JuShuiTanInventoryRequst request = new JuShuiTanInventoryRequst();
request.wms_co_id = id;//10923342;
request.page_size = 100;
request.modified_begin = DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd HH:mm:ss");
request.modified_begin = DateTime.Now.AddDays(-6).AddHours(-23).ToString("yyyy-MM-dd HH:mm:ss");
request.modified_end = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
var resContent = PostUrl("/open/inventory/query", JsonConvert.SerializeObject(request));
JObject resData = JObject.Parse(resContent);
if (Convert.ToInt32(resData["code"]) != 0)
{
_logger.LogInformation($"聚水潭获取即时库存失败:{resData["msg"].ToString()}");
return Result<List<JuShuiTanInventoryResponse>>.ReFailure(ResultCodes.JuShuiTanDataError);
}
string json = resData["data"]["inventorys"].ToString();
var datas = JsonConvert.DeserializeObject<List<JuShuiTanInventoryResponse>>(json);
list.AddRange(datas);
@@ -109,7 +119,10 @@ namespace WMS.Web.Domain.Services.Public
resData = JObject.Parse(resContent);
if (Convert.ToInt32(resData["code"]) != 0)
{
_logger.LogInformation($"聚水潭获取即时库存失败:{resData["msg"].ToString()}");
return Result<List<JuShuiTanInventoryResponse>>.ReFailure(ResultCodes.JuShuiTanDataError);
}
json = resData["data"]["inventorys"].ToString();
datas = JsonConvert.DeserializeObject<List<JuShuiTanInventoryResponse>>(json);
list.AddRange(datas);

View File

@@ -107,7 +107,11 @@ namespace WMS.Web.Domain.Services.Public
if (!resUrl.IsSuccess) return Result<List<LingXingSellerResponse>>.ReFailure(ResultCodes.LingXingUrlError);
var res = await _httpClientService.GetAsync<LingXingResponse>(resUrl.Data);
if (res.Code != 0) return Result<List<LingXingSellerResponse>>.ReFailure(ResultCodes.LingXingDataError);
if (res.Code != 0)
{
_logger.LogInformation($"领星获取数据失败{res.Message}");
return Result<List<LingXingSellerResponse>>.ReFailure(ResultCodes.LingXingDataError);
}
var list = JsonConvert.DeserializeObject<List<LingXingSellerResponse>>(res.Data.ToString());
//设置缓存
@@ -128,7 +132,11 @@ namespace WMS.Web.Domain.Services.Public
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) return Result<List<LingXingInventoryResponse>>.ReFailure(ResultCodes.LingXingDataError);
if (res.Code != 0)
{
_logger.LogInformation($"领星获取数据失败{res.Message}");
return Result<List<LingXingInventoryResponse>>.ReFailure(ResultCodes.LingXingDataError);
}
list.AddRange(JsonConvert.DeserializeObject<List<LingXingInventoryResponse>>(res.Data.ToString()));
int num = res.Total / 800;
@@ -139,7 +147,11 @@ namespace WMS.Web.Domain.Services.Public
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);
if (res.Code != 0)
{
_logger.LogInformation($"领星获取数据失败{res.Message}");
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());

View File

@@ -101,5 +101,6 @@ namespace WMS.Web.Domain.Values
public static ValueTuple<int, string> LingXingTokenError = (810001, "获取领星授权失败");
public static ValueTuple<int, string> LingXingUrlError = (810002, "拼接领星请求参数失败");
public static ValueTuple<int, string> LingXingDataError = (810003, "请求领星数据失败");
public static ValueTuple<int, string> JuShuiTanDataError = (810004, "请求聚水潭数据失败");
}
}