Commit 1a0f2c21 by lizefeng

监控广州03手机的缺货

parent 5068f1c5
...@@ -14,12 +14,6 @@ namespace AutoGeneratePurchaseAdvise ...@@ -14,12 +14,6 @@ namespace AutoGeneratePurchaseAdvise
Console.WriteLine("采购建议计算任务启动..."); Console.WriteLine("采购建议计算任务启动...");
// 创建采购计划 // 创建采购计划
//PurchaseAdviseServices.Generate(); //PurchaseAdviseServices.Generate();
//PurchaseAdviseServices.AutoPushBuySys();
//purchase_advise.ImportJITShortageDetailed(0);
//PurchaseAdviseServices.Generate();
//PurchaseAdviseServices.Generate();
//new DailyServices().GenerateData();
//PurchaseAdviseServices.Generate();
var builder = new HostBuilder().ConfigureServices((hostContext, services) => var builder = new HostBuilder().ConfigureServices((hostContext, services) =>
{ {
services.AddHostedService<GeneratePurchaseAdviseBackgroundService>(); services.AddHostedService<GeneratePurchaseAdviseBackgroundService>();
......
...@@ -95,7 +95,8 @@ select ...@@ -95,7 +95,8 @@ select
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 view_goods_moq as t7 on t6.product_inner_code = t7.product_inner_code and t1.warehouse_code = t7.warehouse_code and t6.suppliers_id = t7.suppliers_id left join view_goods_moq as t7 on t6.product_inner_code = t7.product_inner_code and t1.warehouse_code = t7.warehouse_code and t6.suppliers_id = t7.suppliers_id
where t6.`status`=2 and t1.warehouse_code!='BLGZ03' and (t1.history_fourteenday_sales>0 or t1.quantity_out_stock>0 ) and ( t5.`status`=0 or t5.`status` is null ) and t7.sum_quantity_init_advise>0 and ( t6.buyer_name not in ('赵美聪','张莹霞','张莹霞1','冯兆欣') or t1.warehouse_code not in ('GZBLWH','GZBLYS') ) where t6.`status`=2 and t1.warehouse_code!='BLGZ03' and (t1.history_fourteenday_sales>0 or t1.quantity_out_stock>0 ) and ( t5.`status`=0 or t5.`status` is null ) and t7.sum_quantity_init_advise>0
and ( t6.buyer_name not in ('赵美聪','张莹霞','张莹霞1','冯兆欣') or t1.warehouse_code not in ('GZBLWH','GZBLYS') )
) as t1 where t1.quantity_final_advise>0 ) as t1 where t1.quantity_final_advise>0
) )
...@@ -158,7 +159,8 @@ where t2.`status`=2 and t1.bailun_sku = t2.bailun_sku and quantity_final_advise= ...@@ -158,7 +159,8 @@ where t2.`status`=2 and t1.bailun_sku = t2.bailun_sku and quantity_final_advise=
} }
} }
} }
//ImportFuZhuangShortageDetailed(mainID);
ImportShoujiShortageDetailed(mainID);
} }
...@@ -301,6 +303,58 @@ where t2.`status`=2 and t1.bailun_sku = t2.bailun_sku and quantity_final_advise= ...@@ -301,6 +303,58 @@ where t2.`status`=2 and t1.bailun_sku = t2.bailun_sku and quantity_final_advise=
return mainID; return mainID;
} }
/// <summary>
/// 导入缺货明细 (服装)
/// </summary>
/// <param name="mainID"></param>
public static int ImportShoujiShortageDetailed(int mainID)
{
if (mainID <= 0)
{
mainID = purchase_advise.Add(new dc_auto_purchase_advise { create_time = DateTime.Now, no = purchase_advise.GenerateOrderNo() }) ?? 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`)
(
select
t1.bailun_sku,
t1.warehouse_code as 'warehouse_code',
-1 as 'quantity_init_advise', -- 原始采购建议数量 new
( (t7.quantity_out_stock) - ( ((case when t7.quantity_out_stock>0 then 0 else (t1.usable_stock+t1.occupy_order) end )) + (t1.quantity_transfer) + (t7.quantity_purchase) ) ) 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
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
where t6.`status`=2 and ( t6.buyer_name in ('陈嘉雯1') and t1.warehouse_code in ('BLGZ03') )
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)
) ", new { main_id = mainID }, commandTimeout: 0);
return mainID;
}
/// <summary> /// <summary>
/// 冗余扣减 /// 冗余扣减
......
...@@ -187,7 +187,7 @@ namespace AutoTurnOver.Services ...@@ -187,7 +187,7 @@ namespace AutoTurnOver.Services
/// <summary> /// <summary>
/// 自动推送采购单 /// 自动推送采购单
/// </summary> /// </summary>
/// <param name="type">1:张莹霞 2:赵美聪</param> /// <param name="type">1:张莹霞 2:赵美聪 3:陈嘉雯1 </param>
public static void AutoPushBuySys(int type) public static void AutoPushBuySys(int type)
{ {
// 生产jit采购建议 // 生产jit采购建议
...@@ -195,15 +195,14 @@ namespace AutoTurnOver.Services ...@@ -195,15 +195,14 @@ namespace AutoTurnOver.Services
if (type==1) { if (type==1) {
mainID = purchase_advise.ImportJITShortageDetailed(0); mainID = purchase_advise.ImportJITShortageDetailed(0);
} }
else else if(type==2)
{ {
mainID = purchase_advise.ImportFuZhuangShortageDetailed(0); mainID = purchase_advise.ImportFuZhuangShortageDetailed(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>();
try try
{ {
// 推送 张莹霞 广州01 仓的数据
var total = 0; var total = 0;
datas.AddRange(PurchaseAdviseServices.DetailList(new dc_auto_purchase_advise_detailed_search_dto { main_id = mainID, end_date = DateTime.Now, start_date = DateTime.Now, ispush = false, purchase_user = "张莹霞", warehouse_code = "GZBLWH" }, 0, int.MaxValue, ref total)); datas.AddRange(PurchaseAdviseServices.DetailList(new dc_auto_purchase_advise_detailed_search_dto { main_id = mainID, end_date = DateTime.Now, start_date = DateTime.Now, ispush = false, purchase_user = "张莹霞", warehouse_code = "GZBLWH" }, 0, int.MaxValue, ref total));
datas.AddRange(PurchaseAdviseServices.DetailList(new dc_auto_purchase_advise_detailed_search_dto { main_id = mainID, end_date = DateTime.Now, start_date = DateTime.Now, ispush = false, purchase_user = "张莹霞1", warehouse_code = "GZBLWH" }, 0, int.MaxValue, ref total)); datas.AddRange(PurchaseAdviseServices.DetailList(new dc_auto_purchase_advise_detailed_search_dto { main_id = mainID, end_date = DateTime.Now, start_date = DateTime.Now, ispush = false, purchase_user = "张莹霞1", warehouse_code = "GZBLWH" }, 0, int.MaxValue, ref total));
......
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