Commit 4fd980d4 by 泽锋 李

fix

parent aaffccff
...@@ -36,6 +36,7 @@ namespace AutoGeneratePurchaseAdvise ...@@ -36,6 +36,7 @@ namespace AutoGeneratePurchaseAdvise
//PurchaseAdviseServices.AutoPushBuySys(4); //PurchaseAdviseServices.AutoPushBuySys(4);
//PurchaseAdviseServices.AutoPushBuySys(4); //PurchaseAdviseServices.AutoPushBuySys(4);
//purchase_advise.ReplaceLogistics(DateTime.Now, "935619301", "MMDUKFBA"); //purchase_advise.ReplaceLogistics(DateTime.Now, "935619301", "MMDUKFBA");
//PurchaseAdviseServices.Generate(DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 00:00:00")));
} }
catch (Exception ex) catch (Exception ex)
{ {
......
...@@ -50,6 +50,8 @@ namespace AutoTurnOver.DB ...@@ -50,6 +50,8 @@ namespace AutoTurnOver.DB
// 寻找有没有满足条件的物流方案 // 寻找有没有满足条件的物流方案
foreach (var item in ouDatas) foreach (var item in ouDatas)
{ {
try
{
// 查询物流方案 // 查询物流方案
var logisticsDatas = ApiUtility.GetFilterLogisticsAssignLineList(new Models.ApiDto.api_logistic_query_input_dto() var logisticsDatas = ApiUtility.GetFilterLogisticsAssignLineList(new Models.ApiDto.api_logistic_query_input_dto()
{ {
...@@ -61,10 +63,10 @@ namespace AutoTurnOver.DB ...@@ -61,10 +63,10 @@ namespace AutoTurnOver.DB
if (logisticsDatas != null && logisticsDatas.Count >= 1) if (logisticsDatas != null && logisticsDatas.Count >= 1)
{ {
// 查询最快的物流渠道 // 查询最快的物流渠道
var avgs = ApiUtility.GetLmsOrderTransferAvg(new Models.ApiDto.api_lms_order_transfer_sku_requst_dto {warehouse_code = item.warehouse_code, country = item.country_code, logistics_code = string.Join(",", logisticsDatas.Select(s=>s.Line_Code)) }).Where(s=>s.avg_put_days!=null).ToList(); var avgs = ApiUtility.GetLmsOrderTransferAvg(new Models.ApiDto.api_lms_order_transfer_sku_requst_dto { warehouse_code = item.warehouse_code, country = item.country_code, logistics_code = string.Join(",", logisticsDatas.Select(s => s.Line_Code)) }).Where(s => s.avg_put_days != null).ToList();
if (avgs != null) if (avgs != null)
{ {
var selectItem = avgs.Where(s=>s.avg_put_days!=null).Where(s => s.avg_put_days + s.avg_sign_days <= item.surplus_allocation_days).OrderByDescending(s => s.avg_sign_days + s.avg_put_days).FirstOrDefault(); var selectItem = avgs.Where(s => s.avg_put_days != null).Where(s => s.avg_put_days + s.avg_sign_days <= item.surplus_allocation_days).OrderByDescending(s => s.avg_sign_days + s.avg_put_days).FirstOrDefault();
// 有时效符合条件的物流可用 // 有时效符合条件的物流可用
if (selectItem != null) if (selectItem != null)
{ {
...@@ -83,7 +85,7 @@ namespace AutoTurnOver.DB ...@@ -83,7 +85,7 @@ namespace AutoTurnOver.DB
remarks += " 未配置 "; remarks += " 未配置 ";
} }
remarks += $" \n 默认时效 调拨天数: {item.transfer_delivery} , 入库天数:{item.abroad_inbound_delivery} 预计入库:{DateTime.Now.AddDays(item.payment_before_delivery + item.inspection_delivery + item.supplier_delivery + (int)Math.Round(item.transfer_delivery) + (int)Math.Round(item.abroad_inbound_delivery, 0)).ToString("yyyy-MM-dd")}"; remarks += $" \n 默认时效 调拨天数: {item.transfer_delivery} , 入库天数:{item.abroad_inbound_delivery} 预计入库:{DateTime.Now.AddDays(item.payment_before_delivery + item.inspection_delivery + item.supplier_delivery + (int)Math.Round(item.transfer_delivery) + (int)Math.Round(item.abroad_inbound_delivery, 0)).ToString("yyyy-MM-dd")}";
remarks += $" \n 当前推荐物流平均时效 调拨天数: {Math.Round(selectItem.avg_sign_days)} , 入库天数:{Math.Round(selectItem.avg_put_days.Value,0)} \n 预计入库 :{DateTime.Now.AddDays(item.payment_before_delivery + item.inspection_delivery + item.supplier_delivery + (int)Math.Round(selectItem.avg_sign_days) + (int)Math.Round(selectItem.avg_put_days.Value, 0)).ToString("yyyy-MM-dd")} "; remarks += $" \n 当前推荐物流平均时效 调拨天数: {Math.Round(selectItem.avg_sign_days)} , 入库天数:{Math.Round(selectItem.avg_put_days.Value, 0)} \n 预计入库 :{DateTime.Now.AddDays(item.payment_before_delivery + item.inspection_delivery + item.supplier_delivery + (int)Math.Round(selectItem.avg_sign_days) + (int)Math.Round(selectItem.avg_put_days.Value, 0)).ToString("yyyy-MM-dd")} ";
_connection.Insert(new dc_auto_replace_logistics_task _connection.Insert(new dc_auto_replace_logistics_task
{ {
bailun_sku = item.bailun_sku, bailun_sku = item.bailun_sku,
...@@ -108,6 +110,17 @@ namespace AutoTurnOver.DB ...@@ -108,6 +110,17 @@ namespace AutoTurnOver.DB
} }
} }
} }
catch (Exception ex)
{
_connection.Insert(new dc_task_error_log {
date =DateTime.Now,
message = item.ToJson() + " --- "+ex.Message,
stack_trace = ex.StackTrace,
task_name = "空运切换异常"
});
}
}
} }
......
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