Commit f2e5c856 by lizefeng

广州03服装的 中午1点那次推单,只推美国的增量需求

parent 7f903f4c
...@@ -69,7 +69,7 @@ namespace AutoGeneratePurchaseAdvise ...@@ -69,7 +69,7 @@ namespace AutoGeneratePurchaseAdvise
if (ApiServices.GetSchedulings()) if (ApiServices.GetSchedulings())
{ {
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(2); PurchaseAdviseServices.AutoPushBuySys(5);
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")}");
} }
......
...@@ -363,7 +363,7 @@ where t2.`status`=2 and t1.bailun_sku = t2.bailun_sku and quantity_final_advise= ...@@ -363,7 +363,7 @@ where t2.`status`=2 and t1.bailun_sku = t2.bailun_sku and quantity_final_advise=
left join dc_auto_config_sku_warehouse as t5 on t1.bailun_sku = t5.bailun_sku and t1.warehouse_code = t5.warehouse_code left join dc_auto_config_sku_warehouse as t5 on t1.bailun_sku = t5.bailun_sku and t1.warehouse_code = t5.warehouse_code
left join dc_base_sku as t6 on t1.bailun_sku = t6.bailun_sku left join dc_base_sku as t6 on t1.bailun_sku = t6.bailun_sku
left join dc_mid_transit as t7 on t1.bailun_sku = t7.bailun_sku and t1.warehouse_code = t7.warehouse_code left join dc_mid_transit as t7 on t1.bailun_sku = t7.bailun_sku and t1.warehouse_code = t7.warehouse_code
where t6.`status`=2 and ( t6.buyer_name in ('赵美聪') and t1.warehouse_code in ('GZBLWH','BLGZ03') ) where t6.`status`=2 and ( t6.buyer_name in ('赵美聪') and t1.warehouse_code in ('BLGZ03') )
and ( t5.`status`=0 or t5.`status` is null ) and ( t5.`status`=0 or t5.`status` is null )
and ((case when t7.quantity_out_stock>0 then 0 else (t1.usable_stock+t1.occupy_order) end ) + t7.quantity_transfer + t7.quantity_purchase < t7.quantity_out_stock) and ((case when t7.quantity_out_stock>0 then 0 else (t1.usable_stock+t1.occupy_order) end ) + t7.quantity_transfer + t7.quantity_purchase < t7.quantity_out_stock)
...@@ -372,6 +372,62 @@ where t2.`status`=2 and t1.bailun_sku = t2.bailun_sku and quantity_final_advise= ...@@ -372,6 +372,62 @@ where t2.`status`=2 and t1.bailun_sku = t2.bailun_sku and quantity_final_advise=
} }
/// <summary> /// <summary>
/// 服装增量采购
/// </summary>
/// <param name="mainID"></param>
/// <returns></returns>
public static int ImportFuZhuangShortageIncreaseDetailed(int mainID)
{
// 查询上一次推送建议的时间
var last_date = _connection.QueryFirstOrDefault<DateTime>(" select * from dc_auto_purchase_advise where type=1 order by create_time desc limit 1 ");
if (mainID <= 0)
{
mainID = purchase_advise.Add(new dc_auto_purchase_advise { create_time = DateTime.Now, no = purchase_advise.GenerateOrderNo(),type = 1 }) ?? 0;
}
_connection.Execute(@" INSERT into dc_auto_purchase_advise_detailed(`bailun_sku`,`warehouse_code`,`quantity_init_advise`,`quantity_final_advise`,
`product_inner_code`,`goods_quantity_init_advise`,`goods_moq`,`good_sku_codes`,`goods_history_fourteenday_sales`,`history_fourteenday_sales`,
`quantity_actual`,`main_id`,
`forecast_formula`,`fit_forecast_formula`,`turnover_days`,`supplier_delivery`,`inspection_delivery`,`transfer_delivery`,`sales_upper_limit`,`ispush`,`type`,`suppliers_id`,`quantity_out_stock`,`purchase_type_jit`)
(
select
t1.bailun_sku,
t1.warehouse_code as 'warehouse_code',
-1 as 'quantity_init_advise', -- 原始采购建议数量 new
t8.quantity as 'quantity_final_advise', -- 计算moq之后的数量 new
t6.product_inner_code as 'product_inner_code', -- 内部商品编码 new
0 as 'goods_quantity_init_advise', -- 商品本次的建议下单数量 new
0 as 'goods_moq', -- 商品的moq new
0 as 'good_sku_codes', -- 商品涉及的下单所有sku new
0 as 'goods_history_fourteenday_sales', -- 商品的最近14日总日均销量
-1 as 'history_fourteenday_sales', -- sku的最近14日日均
0 as 'quantity_actual', -- 真实下单数量
@main_id as 'main_id',
t2.forecast_formula as 'forecast_formula',
t2.fit_forecast_formula as 'fit_forecast_formula',
0 as 'turnover_days',
0 as 'supplier_delivery',
0 as inspection_delivery,
0 as transfer_delivery,
0 as sales_upper_limit,
0 as 'ispush',
2 as 'type',
t6.suppliers_id,
t7.quantity_out_stock,
0 as 'purchase_type_jit'
from dc_base_stock as t1
left join dc_auto_sales as t2 on t1.bailun_sku = t2.bailun_sku and t1.warehouse_code = t2.warehouse_code
left join dc_auto_config_sku_warehouse as t5 on t1.bailun_sku = t5.bailun_sku and t1.warehouse_code = t5.warehouse_code
left join dc_base_sku as t6 on t1.bailun_sku = t6.bailun_sku
left join dc_mid_transit as t7 on t1.bailun_sku = t7.bailun_sku and t1.warehouse_code = t7.warehouse_code
left join ( select bailun_sku,sum(bailun_sku_quantity_ordered) as 'quantity' from dc_base_oms_sku where warehouse_code in ('BLGZ03') and website='us' and create_time>@time GROUP BY bailun_sku ) as t8 on t1.bailun_sku =t8.bailun_sku
where t6.`status`=2 and ( t6.buyer_name in ('赵美聪') and t1.warehouse_code in ('BLGZ03') )
and ( t5.`status`=0 or t5.`status` is null ) and t8.quantity>0
) ", new { main_id = mainID, time = last_date }, commandTimeout: 0);
return mainID;
}
/// <summary>
/// 导入缺货明细 (手机) /// 导入缺货明细 (手机)
/// </summary> /// </summary>
/// <param name="mainID"></param> /// <param name="mainID"></param>
......
...@@ -27,6 +27,12 @@ namespace AutoTurnOver.Models ...@@ -27,6 +27,12 @@ namespace AutoTurnOver.Models
public string buy_sys_plan_no { get; set; } public string buy_sys_plan_no { get; set; }
public DateTime? push_time { get; set; } public DateTime? push_time { get; set; }
/// <summary>
/// 类型
/// 1 = 广州03 服装
/// </summary>
public int? type { get; set; }
} }
/// <summary> /// <summary>
......
...@@ -209,6 +209,10 @@ namespace AutoTurnOver.Services ...@@ -209,6 +209,10 @@ namespace AutoTurnOver.Services
{ {
mainID = purchase_advise.ImportJITShortageDetailed1(0); mainID = purchase_advise.ImportJITShortageDetailed1(0);
} }
else if (type == 5)
{
mainID = purchase_advise.ImportFuZhuangShortageIncreaseDetailed(0);
}
List<dc_auto_purchase_advise_detailed_dto> datas = new List<dc_auto_purchase_advise_detailed_dto>(); List<dc_auto_purchase_advise_detailed_dto> datas = new List<dc_auto_purchase_advise_detailed_dto>();
var total = 0; var total = 0;
......
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