Commit aee73a53 by 泽锋 李

极速阿奴入库平均值时,剔除24号之前的单

parent 536d9127
......@@ -60,10 +60,10 @@ namespace AutoTurnOver.DB
if (logisticsDatas != null && logisticsDatas.Count >= 1)
{
// 查询最快的物流渠道
var avgs = ApiUtility.GetLmsOrderTransferAvg(new Models.ApiDto.api_lms_order_transfer_sku_requst_dto { country = item.country_code, logistics_code = string.Join(",", logisticsDatas.Select(s=>s.Line_Code)) });
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)) });
if (avgs != null)
{
var selectItem = avgs.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)
{
......@@ -82,11 +82,11 @@ namespace AutoTurnOver.DB
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 当前推荐物流平均时效 调拨天数: {Math.Round(selectItem.avg_sign_days)} , 入库天数:{Math.Round(selectItem.avg_put_days,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, 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
{
bailun_sku = item.bailun_sku,
abroad_inbound_delivery = selectItem.avg_put_days,
abroad_inbound_delivery = selectItem.avg_put_days.Value,
create_date = DateTime.Now,
error_message = "",
error_stack_trace = "",
......
......@@ -4018,10 +4018,10 @@ where t2.hq_type='fba仓'").ToList();
country_code = item.country_code,
trans_days = 15
};
var lms_avgs = ApiUtility.GetLmsOrderTransferAvg(new Models.ApiDto.api_lms_order_transfer_sku_requst_dto {transfer_type =3, country = item.country_code});
var lms_avgs = ApiUtility.GetLmsOrderTransferAvg(new Models.ApiDto.api_lms_order_transfer_sku_requst_dto {warehouse_code = item.warehouse_code, transfer_type =3, country = item.country_code}).Where(s=>s.avg_put_days!=null).ToList();
if (lms_avgs != null && lms_avgs.Count>=1)
{
data.trans_days = (int)Math.Round( lms_avgs.Min(s => s.avg_sign_days + s.avg_put_days),0);
data.trans_days = (int)Math.Round( lms_avgs.Min(s => s.avg_sign_days + s.avg_put_days.Value),0);
}
data.id = _connection.QueryFirstOrDefault<int?>(" select id from dc_auto_fastest_storage where warehouse_code=@warehouse_code and bailun_sku=@bailun_sku ",new {
warehouse_code = item.warehouse_code,
......
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