Commit ebdcf81c by 泽锋 李

fix

parent d8c37074
......@@ -21,31 +21,7 @@ namespace AutoGeneratePurchaseAdvise
try
{
//PurchaseAdviseServices.AutoPushBuySys(2);
//PurchaseAdviseServices.Generate($"早上的全量周转 {DateTime.Now.ToString("HH: mm")}", DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 00:00:00")), is_clear_data: true);
//PurchaseAdviseServices.Generate($"早上的全量周转 {DateTime.Now.ToString("HH: mm")}", DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 00:00:00")), is_clear_data: false);
//PurchaseAdviseServices.Generate($"下午的补充周转 {DateTime.Now.ToString("HH: mm")}", DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 12:00:00")));
//PurchaseAdviseServices.AutoPushBuySys(4);
//{
// PurchaseAdviseServices.AutoPushBuySys(1);
// Console.WriteLine($"开始推送 服装采购建议任务,线程Id:{Thread.CurrentThread.ManagedThreadId},{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
// PurchaseAdviseServices.AutoPushBuySys(2);
// Console.WriteLine($"结束推送 服装采购建议任务,线程Id:{Thread.CurrentThread.ManagedThreadId},{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
// Console.WriteLine($"开始推送 手机采购建议任务,线程Id:{Thread.CurrentThread.ManagedThreadId},{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
// PurchaseAdviseServices.AutoPushBuySys(3);
// Console.WriteLine($"结束推送 手机采购建议任务,线程Id:{Thread.CurrentThread.ManagedThreadId},{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
// Console.WriteLine($"开始推送 义乌无库仓采购建议任务,线程Id:{Thread.CurrentThread.ManagedThreadId},{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
// PurchaseAdviseServices.AutoPushBuySys(6);
// Console.WriteLine($"结束推送 义乌无库仓采购建议任务,线程Id:{Thread.CurrentThread.ManagedThreadId},{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
// Console.WriteLine($"开始推送 独立站采购建议任务,线程Id:{Thread.CurrentThread.ManagedThreadId},{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
// PurchaseAdviseServices.AutoPushBuySys(7);
// Console.WriteLine($"结束推送 独立站采购建议任务,线程Id:{Thread.CurrentThread.ManagedThreadId},{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
//}
}
......
......@@ -1020,18 +1020,27 @@ left join dc_base_warehouse as t4 on t1.warehouse_code = t4.warehouse_code
/// 缺货推送记录
/// </summary>
/// <returns></returns>
public static List<dc_auto_shortage_push_route_dto> ShortagePushList(string platform, string bailun_sku, int offset, int limit, ref int total, DateTime? start_date, DateTime? end_date, string warehousecode, string warehousetype, int? warehousearea)
public static List<dc_auto_shortage_push_route_dto> ShortagePushList(string platform, string bailun_sku, int offset, int limit, ref int total, DateTime? start_date, DateTime? end_date, string warehousecode, string warehousetype, int? warehousearea,int type = 0)
{
var sql = @"select t1.id, t1.platform, t1.bailun_sku,t3.warehouse_name, t1.warehouse_code, t1.push_date,t2.push_time from dc_auto_shortage_push as t1
left join dc_return_goods_push as t2 on t1.id =t2.shortage_push_id
left join dc_base_warehouse as t3 on t1.warehouse_code = t3.warehouse_code
where 1=1 ";
var countSql = " select count(1) from dc_auto_shortage_push as t1 left join dc_base_warehouse as t3 on t1.warehouse_code = t3.warehouse_code where 1=1 ";
if (type == 1)
{
sql = @"select t2.id, t2.platform, t2.bailun_sku,t3.warehouse_name, t2.warehouse_code,t2.push_time
from dc_return_goods_push as t2
left join dc_base_warehouse as t3 on t1.warehouse_code = t3.warehouse_code
where 1=1 ";
countSql = " select count(1) from dc_return_goods_push as t2 left join dc_base_warehouse as t3 on t1.warehouse_code = t3.warehouse_code where 1=1 ";
}
DynamicParameters parameters = new DynamicParameters();
if (!string.IsNullOrWhiteSpace(warehousecode))
{
sql += " and t1.warehouse_code=@warehouse_code ";
countSql += " and t1.warehouse_code=@warehouse_code ";
sql += " and t3.warehouse_code=@warehouse_code ";
countSql += " and t3.warehouse_code=@warehouse_code ";
parameters.Add("warehouse_code", warehousecode);
}
if (!string.IsNullOrWhiteSpace(warehousetype))
......@@ -1048,10 +1057,20 @@ where 1=1 ";
}
if (start_date != null)
{
if (type == 0)
{
sql += " and t1.push_date>=@btime ";
countSql += " and t1.push_date>=@btime ";
parameters.Add("btime", start_date);
}
else
{
sql += " and t2.push_time>=@btime ";
countSql += " and t2.push_time>=@btime ";
parameters.Add("btime", start_date);
}
}
if (end_date != null)
{
sql += " and t1.push_date<=@etime ";
......@@ -1060,15 +1079,37 @@ where 1=1 ";
}
if (!string.IsNullOrWhiteSpace(platform))
{
if (type == 0)
{
sql += " and t1.platform=@platform ";
countSql += " and t1.platform=@platform ";
parameters.Add("platform", platform);
}
else
{
sql += " and t2.platform=@platform ";
countSql += " and t2.platform=@platform ";
parameters.Add("platform", platform);
}
}
if (!string.IsNullOrWhiteSpace(bailun_sku))
{
if (type == 0)
{
sql += " and t1.bailun_sku in @bailun_sku ";
countSql += " and t1.bailun_sku in @bailun_sku ";
parameters.Add("bailun_sku", bailun_sku.Split(','));
}
else
{
sql += " and t2.bailun_sku in @bailun_sku ";
countSql += " and t2.bailun_sku in @bailun_sku ";
parameters.Add("bailun_sku", bailun_sku.Split(','));
}
}
sql += " order by t1.id desc ";
......
......@@ -1136,6 +1136,7 @@ end
// 回货速改推送
string sql = @"select
t1.id as 'shortage_push_id',
@platform as 'platform',
t1.bailun_sku,
t1.warehouse_code,
now() as 'push_time',
......@@ -1216,7 +1217,8 @@ end
var shortage_list = new List<dc_return_goods_push>();
// 回货速改推送
string sql = @"select
t1.id as 'shortage_push_id',
0 as 'shortage_push_id',
@platform as 'platform',
t1.sku_code as 'bailun_sku',
t1.warehouse_code,
now() as 'push_time',
......
......@@ -38,5 +38,8 @@ namespace AutoTurnOver.Models
[Description("仓库国家")]
public int? warehousearea { get; set; }
[Description("数据类型")]
public int? type { get; set; }
}
}
......@@ -9,6 +9,7 @@ namespace AutoTurnOver.Models
public int id { get; set; }
public int shortage_push_id { get; set; }
public string platform { get; set; }
public string bailun_sku { get; set; }
public string buyer_name { get; set; }
......
......@@ -513,6 +513,8 @@ namespace AutoTurnOver.Services
int totalPage = (int)Math.Ceiling(datas.Count() * 1.0 / rows);
while (page <= totalPage)
{
try
{
var result = ShortagePushApi(new ShortagePush_RequestDto
{
platform = platform,
......@@ -529,6 +531,13 @@ namespace AutoTurnOver.Services
err_datas.AddRange(result.objData);
}
page++;
}
catch (Exception ex)
{
throw;
}
}
......@@ -541,12 +550,14 @@ namespace AutoTurnOver.Services
/// </summary>
private static ShortagePush_ResponseDto ShortagePushApi(ShortagePush_RequestDto data)
{
try
{
//string url = ConfigHelper.GetValue("PPS_ShortagePush");
string url = ConfigHelper.GetValue("PPS_ShortagePush2");
//string resultStr1 = HttpHelper.Request(url2, RequestType.POST, data.ToJson(), timeout: 1000 * 60 * 60 * 24, entype: "application/json");
string resultStr = HttpHelper.Request(url, RequestType.POST, data.ToJson(), timeout: 1000 * 60 * 60 * 24, entype: "application/json");
var parJson = data.ToJson();
try
{
string resultStr = HttpHelper.Request(url, RequestType.POST, parJson, timeout: 1000 * 60 * 60 * 24, entype: "application/json");
var result = resultStr.ToObj<ShortagePush_ResponseDto>();
if (result == null)
{
......
......@@ -102,9 +102,9 @@ namespace AutoTurnOver.Services
return DB.daily.RealtimeFbaList(search_data, categoryModels, ref total);
}
public List<dc_auto_shortage_push_route_dto> ShortagePushList(string platform, string bailun_sku, int offset, int limit, ref int total, DateTime? start_date, DateTime? end_date, string warehousecode, string warehousetype, int? warehousearea)
public List<dc_auto_shortage_push_route_dto> ShortagePushList(string platform, string bailun_sku, int offset, int limit, ref int total, DateTime? start_date, DateTime? end_date, string warehousecode, string warehousetype, int? warehousearea,int type=0)
{
return DB.daily.ShortagePushList(platform, bailun_sku, offset, limit,ref total, start_date, end_date, warehousecode, warehousetype, warehousearea);
return DB.daily.ShortagePushList(platform, bailun_sku, offset, limit,ref total, start_date, end_date, warehousecode, warehousetype, warehousearea,type);
}
public List<dc_aims_transfer_warehouse_log_dto> TransferWarehouseLogList(dc_aims_transfer_warehouse_log_search_dto search_data, int offset, int limit, ref int total )
......
......@@ -321,13 +321,13 @@ namespace AutoTurnOver.Controllers
/// <param name="total"></param>
/// <returns></returns>
[BrowseLog("Bailun_aims", "访问【百伦自动周转系统】->【实时数据】->【修改在线数量日志】->【搜索】页面", 0)]
public JsonResult ShortagePushList(string platform, string bailun_sku, int offset, int limit, DateTime? end_date, DateTime? start_date, string warehousecode, string warehousetype, int? warehousearea)
public JsonResult ShortagePushList(string platform, string bailun_sku, int offset, int limit, DateTime? end_date, DateTime? start_date, string warehousecode, string warehousetype, int? warehousearea,int type = 0)
{
try
{
var services = new DailyServices();
var total = 0;
var list = services.ShortagePushList(platform, bailun_sku, offset, limit, ref total, start_date, end_date, warehousecode, warehousetype, warehousearea);
var list = services.ShortagePushList(platform, bailun_sku, offset, limit, ref total, start_date, end_date, warehousecode, warehousetype, warehousearea, type);
return new JsonResult(new
{
rows = list,
......
......@@ -26,6 +26,7 @@ namespace ShortagePush
//new ReportServices().PPSReturnGoodsPush("walmart");
//new ReportServices().ShortagePushEbay(true);
//new ReportServices().PPSReturnGoodsPush("walmart");
}
catch (Exception ex)
{
......
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