Commit 9be13856 by 泽锋 李

推送海运采购建议的时候,需要推荐一条最近30天的最快物流渠道

parent b577822a
...@@ -11,6 +11,11 @@ namespace AutoTurnOver.Models.ApiDto ...@@ -11,6 +11,11 @@ namespace AutoTurnOver.Models.ApiDto
{ {
public string Line_Code { get; set; } public string Line_Code { get; set; }
public string Line_Name { get; set; } public string Line_Name { get; set; }
/// <summary>
/// 最快签收时间
/// </summary>
public int? Fast_Aging { get; set; }
public string Company_Code { get; set; } public string Company_Code { get; set; }
public string Company_Name { get; set; } public string Company_Name { get; set; }
......
...@@ -293,6 +293,7 @@ namespace AutoTurnOver.Services ...@@ -293,6 +293,7 @@ namespace AutoTurnOver.Services
DateTime now = DateTime.Now; DateTime now = DateTime.Now;
// 查询未推送成功的采购建议的明细 // 查询未推送成功的采购建议的明细
var detailList = purchase_advise.BuyDetailList(datas.Select(s => s.id).ToList(), false); var detailList = purchase_advise.BuyDetailList(datas.Select(s => s.id).ToList(), false);
var _connection = MyMySqlConnection._connection;
foreach (var item in detailList.GroupBy(s => new { s.warehouse_code,s.area_name, s.warehouse_type,s.task_transport_type })) foreach (var item in detailList.GroupBy(s => new { s.warehouse_code,s.area_name, s.warehouse_type,s.task_transport_type }))
{ {
...@@ -360,7 +361,25 @@ namespace AutoTurnOver.Services ...@@ -360,7 +361,25 @@ namespace AutoTurnOver.Services
} }
} }
//海运则自动选择一个最快的渠道
if (data.bp_sendtype == 2)
{
var base_wa = _connection.QueryFirstOrDefault<string>(" select t2.`code` from dc_base_warehouse as t1 left join dc_base_country as t2 on t1.area_name = t2.`name` where warehouse_code=@warehouse_code ", new { warehouse_code = item.Key.warehouse_code });
// 查询物流方案
var logisticsData = ApiUtility.RealTimeShipLogisticsList(new Models.ApiDto.LmsShipLogisticsRequstDto
{
endCountries = base_wa,
character_skus = item.FirstOrDefault().bailun_sku,
startPoint = "3",
transport_type = 2,
has_min_freight_unit_price = true,
has_history_order = 30
}).Where(s => s.min_freight_unit_price > 1).Where(s=>s.Fast_Aging>10).OrderBy(s=>s.Fast_Aging).FirstOrDefault();
if (logisticsData != null)
{
data.logistics_code = logisticsData.Line_Code;
}
}
data.bi_buyplandetail = item.GroupBy(s=>s.bailun_sku).Select(s => new bi_buyplandetail data.bi_buyplandetail = item.GroupBy(s=>s.bailun_sku).Select(s => new bi_buyplandetail
{ {
bd_count = s.Sum(g=> g.quantity_actual > 0 ? g.quantity_actual : g.quantity_final_advise), bd_count = s.Sum(g=> g.quantity_actual > 0 ? g.quantity_actual : g.quantity_final_advise),
......
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