Commit ff220f7e by 泽锋 李

ebay 的缺货推送挑出来,10分钟一次

parent ffc40343
......@@ -476,7 +476,7 @@ namespace AutoTurnOver.Services
{
// 国内仓
List<string> platform1s = new List<string> {"ebay","amazon", "aliexpress", "shopee", "wish", "lazada" };
List<string> platform1s = new List<string> {"amazon", "aliexpress", "shopee", "wish", "lazada" };
foreach (var item in platform1s.Where(s=> string.IsNullOrWhiteSpace(platform) || platform==s))
{
try
......@@ -496,7 +496,7 @@ namespace AutoTurnOver.Services
}
//国外仓1
List<string> platform2s = new List<string> { "ebay", "wish" };
List<string> platform2s = new List<string> { "wish" };
List<string> rule1 = new List<string> { "GBYKD", "JZHYBLGC", "MDBLWYT", "MXBLWYT", "BLUSGDC", "GBBMHBL", "GB4PXBL", "DEBLDG", "USGCBL", "USHWBL", "US4PXBL", "AUWYTBL", "AU4PXBL", "GBWYTUK", "GBLQST" };
foreach (var item in platform2s.Where(s => string.IsNullOrWhiteSpace(platform) || platform == s))
{
......@@ -539,6 +539,42 @@ namespace AutoTurnOver.Services
}
public void ShortagePushEbay(bool is_all = false)
{
try
{
List<dc_auto_shortage_push> datas = new List<dc_auto_shortage_push>();
datas.AddRange(report.ChinaShortagePush("ebay", is_all));
var err_datas = ApiServices.ShortagePush(datas, "ebay");
// 记录推送状态
report.AddShortagePush(datas.Where(s => !err_datas.Any(e => e.warehouseCode == s.warehouse_code && s.bailun_sku == e.sku)));
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine(ex.StackTrace);
}
//国外仓1
List<string> rule1 = new List<string> { "GBYKD", "JZHYBLGC", "MDBLWYT", "MXBLWYT", "BLUSGDC", "GBBMHBL", "GB4PXBL", "DEBLDG", "USGCBL", "USHWBL", "US4PXBL", "AUWYTBL", "AU4PXBL", "GBWYTUK", "GBLQST" };
try
{
List<dc_auto_shortage_push> datas = new List<dc_auto_shortage_push>();
datas.AddRange(report.NotChinaShortagePush(rule1, "ebay", is_all));
var err_datas = ApiServices.ShortagePush(datas, "ebay");
// 记录推送状态
report.AddShortagePush(datas.Where(s => !err_datas.Any(e => e.warehouseCode == s.warehouse_code && s.bailun_sku == e.sku)));
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine(ex.StackTrace);
}
}
/// <summary>
/// 过滤掉一部分不需要改在0的数据
/// </summary>
......@@ -568,12 +604,16 @@ namespace AutoTurnOver.Services
}
public void ReturnGoodsPush(string platform = null)
{
var platform_list = new List<string> { "ebay", "amazon", "aliexpress", "shopee", "wish", "lazada","opensky", "sears", "walmart" };
var platform_list = new List<string> { "amazon", "aliexpress", "shopee", "wish", "lazada","opensky", "sears", "walmart" };
foreach (var item in platform_list.Where(s => string.IsNullOrWhiteSpace(platform) || platform == s))
{
PlatformReturnGoodsPush(item);
}
}
public void ReturnGoodsPushEaby()
{
PlatformReturnGoodsPush("ebay");
}
public void PlatformReturnGoodsPush(string platform)
{
......
......@@ -38,6 +38,29 @@ namespace ShortagePush
}
});
Task.Factory.StartNew(() => {
while (true)
{
try
{
System.Console.WriteLine($"开始推送 Ebay 改零数据,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
new ReportServices().ShortagePushEbay();
System.Console.WriteLine($"结束推送 Ebay 改零数据,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
System.Console.WriteLine($"开始推送 Ebay 回货数据,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
new ReportServices().ReturnGoodsPushEaby();
System.Console.WriteLine($"结束推送 Ebay 回货数据,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Thread.Sleep(10 * 60 * 1000);
}
});
return Task.CompletedTask;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment