Commit 9ef30b34 by 泽锋 李

无库服装采购加上 甄杰靖

parent 7012c94d
......@@ -20,24 +20,7 @@ namespace AutoGeneratePurchaseAdvise
//purchase_advise.ReplaceLogistics(DateTime.Now);
//purchase_advise.WaitReplaceLogisticsTask();
PurchaseAdviseServices.AutoPushBuySys(1);
Console.WriteLine($"开始推送 手机采购建议任务,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
PurchaseAdviseServices.AutoPushBuySys(3);
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);
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(6);
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(7);
Console.WriteLine($"结束推送 独立站采购建议任务,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
//PurchaseAdviseServices.Generate(DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 00:00:00")));
}
catch (Exception ex)
{
......
......@@ -233,7 +233,7 @@ tr_task.transport_type as 'task_transport_type'
where t1.gmt_modified>=@btime
and t6.`status`=2 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') ) and t1.warehouse_code!='BLGZ03' )
( ( t6.buyer_name not in ('赵美聪','甄杰靖','张莹霞','张莹霞1','冯兆欣') or t1.warehouse_code not in ('GZBLWH','GZBLYS') ) and t1.warehouse_code!='BLGZ03' )
or
( t1.tag_id > 0 and t8.is_eliminate = 0 )
) -- 非jit 或者 jit 备货
......@@ -247,13 +247,13 @@ tr_task.transport_type as 'task_transport_type'
_connection.Execute(@" update dc_auto_purchase_advise_detailed as t1,
dc_base_sku as t2
set t1.quantity_final_advise=2
where t2.`status`=2 and t1.bailun_sku = t2.bailun_sku and t1.quantity_final_advise=1 and t1.quantity_init_advise<=0 and ( t2.buyer_name not in ('赵美聪','张莹霞','张莹霞1') or t1.warehouse_code!='GZBLWH' ) and t1.main_id=@main_id ", new { main_id = mainID }, commandTimeout: 0);
where t2.`status`=2 and t1.bailun_sku = t2.bailun_sku and t1.quantity_final_advise=1 and t1.quantity_init_advise<=0 and ( t2.buyer_name not in ('赵美聪','甄杰靖','张莹霞','张莹霞1') or t1.warehouse_code!='GZBLWH' ) and t1.main_id=@main_id ", new { main_id = mainID }, commandTimeout: 0);
// 初始建议数为1,,系统建议数为1时 改为3 ( 只补缺货的不管 )
_connection.Execute(@" update dc_auto_purchase_advise_detailed as t1,
dc_base_sku as t2
set quantity_final_advise=3
where t2.`status`=2 and t1.bailun_sku = t2.bailun_sku and quantity_final_advise=1 and quantity_init_advise=1 and ( t2.buyer_name not in ('赵美聪','张莹霞','张莹霞1') or t1.warehouse_code!='GZBLWH' ) and main_id=@main_id ", new { main_id = mainID }, commandTimeout: 0);
where t2.`status`=2 and t1.bailun_sku = t2.bailun_sku and quantity_final_advise=1 and quantity_init_advise=1 and ( t2.buyer_name not in ('赵美聪','甄杰靖','张莹霞','张莹霞1') or t1.warehouse_code!='GZBLWH' ) and main_id=@main_id ", new { main_id = mainID }, commandTimeout: 0);
//张莹霞1 and 广州01 去掉缺货数
_connection.Execute(@" update dc_auto_purchase_advise_detailed as t1,
......@@ -533,7 +533,7 @@ t7.bailun_order_ids
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','GZBLWH') )
where t6.`status`=2 and ( t6.buyer_name in ('赵美聪','甄杰靖','赵美聪1','秦振荣','李华娟') and t1.warehouse_code in ('BLGZ03','GZBLWH') )
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)
......@@ -789,7 +789,7 @@ t8.bailun_order_ids
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',GROUP_CONCAT(bailun_order_id) as 'bailun_order_ids' from dc_base_oms_sku where warehouse_code in ('BLGZ03') and website='us' and gmt_create>@time and has_scalp=0 and has_buyer_remark = 0
and has_platsku_remark = 0 GROUP BY bailun_sku ) as t8 on t1.bailun_sku =t8.bailun_sku
where t6.`status`=2 and ( t6.buyer_name in ('赵美聪','赵美聪1','秦振荣','李华娟') and t1.warehouse_code in ('BLGZ03') )
where t6.`status`=2 and ( t6.buyer_name in ('赵美聪','甄杰靖','赵美聪1','秦振荣','李华娟') and t1.warehouse_code in ('BLGZ03') )
-- and t6.suppliers_name not in ('深圳市龙岗区平湖欧妮菲制衣厂','深圳市福田区曼戈制衣厂')
and ( t5.`status`=0 or t5.`status` is null ) and t8.quantity>0
......@@ -851,7 +851,7 @@ t8.bailun_order_ids
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',GROUP_CONCAT(bailun_order_id) as 'bailun_order_ids' from dc_base_oms_sku where warehouse_code in ('BLGZ03') and gmt_create>@time and has_scalp=0 and has_buyer_remark = 0
and has_platsku_remark = 0 GROUP BY bailun_sku ) as t8 on t1.bailun_sku =t8.bailun_sku
where t6.`status`=2 and ( t6.buyer_name in ('赵美聪','赵美聪1','秦振荣','李华娟') and t1.warehouse_code in ('BLGZ03') )
where t6.`status`=2 and ( t6.buyer_name in ('赵美聪','甄杰靖','赵美聪1','秦振荣','李华娟') and t1.warehouse_code in ('BLGZ03') )
-- and t6.suppliers_name not in ('深圳市龙岗区平湖欧妮菲制衣厂','深圳市福田区曼戈制衣厂')
and ( t5.`status`=0 or t5.`status` is null ) and t8.quantity>0
......@@ -913,7 +913,7 @@ t8.bailun_order_ids
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',GROUP_CONCAT(bailun_order_id) as 'bailun_order_ids' from dc_base_oms_sku where warehouse_code in ('BLGZ03') and gmt_create>@time and has_scalp=0 and has_buyer_remark = 0
and has_platsku_remark = 0 GROUP BY bailun_sku ) as t8 on t1.bailun_sku =t8.bailun_sku
where t6.`status`=2 and ( t6.buyer_name in ('赵美聪','赵美聪1','秦振荣','李华娟') and t1.warehouse_code in ('BLGZ03') )
where t6.`status`=2 and ( t6.buyer_name in ('赵美聪','甄杰靖','赵美聪1','秦振荣','李华娟') and t1.warehouse_code in ('BLGZ03') )
-- and t6.suppliers_name not in ('深圳市龙岗区平湖欧妮菲制衣厂','深圳市福田区曼戈制衣厂')
and ( t5.`status`=0 or t5.`status` is null ) and t8.quantity>0
......
......@@ -505,11 +505,11 @@ and t1.bailun_sku not in ('942904501')
and ( t1.quantity_purchase<=0 and (ifnull(t4.sum_unshipped_quantity,0) - ifnull(t3.sum_usable_stock,0))>0 ) -- 有缺货
and (ifnull(t4.sum_unshipped_quantity,0) - ifnull(t3.sum_usable_stock,0))>0 -- 有缺货
and ( case
when @platform!='aliexpress' then ( t2.buyer_name not in ('张莹霞','张莹霞1','赵美聪','黄镜洁','赵美聪','赵美聪1','秦振荣','李华娟','赵美聪-独立站') or t2.`status`=1 )
when @platform!='aliexpress' then ( t2.buyer_name not in ('张莹霞','张莹霞1','赵美聪','甄杰靖','黄镜洁','赵美聪','赵美聪1','秦振荣','李华娟','赵美聪-独立站') or t2.`status`=1 )
else ( t2.`status`=1 or t7.bailun_sku is null)
end
) -- 速卖通的必须要停止监控才推送
and ( ifnull(t4.sum_quantity_purchase,0)<=0 or t2.buyer_name in ('张莹霞','张莹霞1','赵美聪','黄镜洁','赵美聪','赵美聪1','秦振荣','李华娟','赵美聪-独立站')
and ( ifnull(t4.sum_quantity_purchase,0)<=0 or t2.buyer_name in ('张莹霞','张莹霞1','赵美聪','甄杰靖','黄镜洁','赵美聪','赵美聪1','秦振荣','李华娟','赵美聪-独立站')
) -- 无在途 或者 自产 (自产的有在途也要推)
and not exists ( select * from dc_auto_shortage_push_not_config where dc_auto_shortage_push_not_config.warehouse_code=t1.warehouse_code and dc_auto_shortage_push_not_config.bailun_sku=t1.bailun_sku )
";
......@@ -523,12 +523,12 @@ and not exists ( select * from dc_auto_shortage_push_not_config where dc_auto_sh
if (is_all)
{
// 全量推 只推普货
sql += " and t2.develop_time>='2020-10-01' and t2.buyer_name not in ('张莹霞','赵美聪','张莹霞') and t1.warehouse_code in ('GZBLWH') ";
sql += " and t2.develop_time>='2020-10-01' and t2.buyer_name not in ('张莹霞','赵美聪','甄杰靖','张莹霞') and t1.warehouse_code in ('GZBLWH') ";
}
else
{
// 增量推,那部分数据要剔除
sql += " and !(t2.develop_time>='2020-10-01' and t2.buyer_name not in ('张莹霞','赵美聪','张莹霞') and t1.warehouse_code in ('GZBLWH') ) ";
sql += " and !(t2.develop_time>='2020-10-01' and t2.buyer_name not in ('张莹霞','赵美聪','甄杰靖','张莹霞') and t1.warehouse_code in ('GZBLWH') ) ";
}
}
shortage_list.AddRange(conn.Query<dc_auto_shortage_push>(sql, new { platform = platform }, commandTimeout: 0));
......@@ -568,11 +568,11 @@ t1.usable_stock<=0 and t1.bailun_sku!=''
and ( t1.warehouse_code in ('GZBLWH','BLGZ03') or ( t1.warehouse_code in ('YWWH01') and ( t3.`status`=1 or t6.`status`=1 ) ) ) -- 义务仓 只要停止监控 或者停售就推送
and t1.bailun_sku not in ('942904501')
and ( case
when @platform!='aliexpress' then ( t3.buyer_name not in ('张莹霞','张莹霞1','赵美聪','黄镜洁','赵美聪','赵美聪1','秦振荣','李华娟','赵美聪-独立站') or t3.`status`=1 ) else ( t3.`status`=1 or t7.bailun_sku is null)
when @platform!='aliexpress' then ( t3.buyer_name not in ('张莹霞','张莹霞1','赵美聪','甄杰靖','黄镜洁','赵美聪','赵美聪1','秦振荣','李华娟','赵美聪-独立站') or t3.`status`=1 ) else ( t3.`status`=1 or t7.bailun_sku is null)
end
) -- 速卖通的必须要停止监控才推送
and IFNULL(t4.sum_usable_stock,0)<=0 -- 无库存
and ( @platform='ebay' or ifnull(t5.sum_quantity_purchase,0)<=0 or t3.buyer_name in ('张莹霞','张莹霞1','赵美聪','黄镜洁','赵美聪','赵美聪1','秦振荣','李华娟','赵美聪-独立站')
and ( @platform='ebay' or ifnull(t5.sum_quantity_purchase,0)<=0 or t3.buyer_name in ('张莹霞','张莹霞1','赵美聪','甄杰靖','黄镜洁','赵美聪','赵美聪1','秦振荣','李华娟','赵美聪-独立站')
) -- 无在途 或者 自产 (自产的有在途也要推)
and not exists ( select * from dc_auto_shortage_push_not_config where dc_auto_shortage_push_not_config.warehouse_code=t1.warehouse_code and dc_auto_shortage_push_not_config.bailun_sku=t1.bailun_sku )
";
......@@ -586,12 +586,12 @@ and not exists ( select * from dc_auto_shortage_push_not_config where dc_auto_sh
if (is_all)
{
// 全量推 只推普货
no_library_sql += " and t3.develop_time>='2020-10-01' and t3.buyer_name not in ('张莹霞','赵美聪','张莹霞') and t1.warehouse_code in ('GZBLWH') ";
no_library_sql += " and t3.develop_time>='2020-10-01' and t3.buyer_name not in ('张莹霞','赵美聪','甄杰靖','张莹霞') and t1.warehouse_code in ('GZBLWH') ";
}
else
{
// 增量推,那部分数据要剔除
no_library_sql += " and !(t3.develop_time>='2020-10-01' and t3.buyer_name not in ('张莹霞','赵美聪','张莹霞') and t1.warehouse_code in ('GZBLWH') ) ";
no_library_sql += " and !(t3.develop_time>='2020-10-01' and t3.buyer_name not in ('张莹霞','赵美聪','甄杰靖','张莹霞') and t1.warehouse_code in ('GZBLWH') ) ";
}
}
shortage_list.AddRange(conn.Query<dc_auto_shortage_push>(no_library_sql, new { platform = platform }, commandTimeout: 0));
......@@ -802,7 +802,7 @@ and ( t_db.hq_type!='国内仓' or
(
t1.bailun_sku not in ('942904501')
and
t2.buyer_name not in ('张莹霞','张莹霞1','赵美聪','黄镜洁','赵美聪','赵美聪1','秦振荣')
t2.buyer_name not in ('张莹霞','张莹霞1','赵美聪','甄杰靖','黄镜洁','赵美聪','赵美聪1','秦振荣')
)
)
and t_db.hq_type!='fba仓'
......@@ -837,7 +837,7 @@ and ( t_db.hq_type!='国内仓' or
(
t1.bailun_sku not in ('942904501')
and
t3.buyer_name not in ('张莹霞','张莹霞1','赵美聪','黄镜洁','赵美聪','赵美聪1','秦振荣')
t3.buyer_name not in ('张莹霞','张莹霞1','赵美聪','甄杰靖','黄镜洁','赵美聪','赵美聪1','秦振荣')
)
)
and (
......@@ -1621,9 +1621,9 @@ t1.bailun_sku,
when t1.buyer_name='李华娟' then '无库普货推荐'
when t1.buyer_name in ('张莹霞','黄境洁','古艳洋1') then '美甲'
when t1.buyer_name='张莹霞1' then '精油+美容'
when t1.buyer_name='赵美聪' and t1.source = 1 then '服装精准开发'
when t1.buyer_name='赵美聪' then '服装供应商推荐'
when t1.buyer_name!='赵美聪' and t1.source = 1 and t1.create_time>='2019-07-01 00:00:00' then '非服装精准开发'
when t1.buyer_name in ('赵美聪','甄杰靖') and t1.source = 1 then '服装精准开发'
when t1.buyer_name in ('赵美聪','甄杰靖') then '服装供应商推荐'
when t1.buyer_name not in ('赵美聪','甄杰靖') and t1.source = 1 and t1.create_time>='2019-07-01 00:00:00' then '非服装精准开发'
else '未知'
end
) as 'label'
......@@ -1782,28 +1782,6 @@ GROUP BY t1.bailun_sku_warehouse_area) as t2
set t1.first_inbound_date = t2.min_time
where t1.bailun_sku_warehouse_area=t2.bailun_sku_warehouse_area;", commandTimeout: 0);
_connection.Execute(@"-- 刷新首次采购时间
set session transaction isolation level read uncommitted;
start transaction;
update dc_base_stock as t1,
(select t1.bailun_sku,t1.warehouse_into_code as 'warehouse_code',min(t1.create_time) as 'min_time' from dc_base_purchase_details as t1
where `status`!=-1
GROUP BY t1.bailun_sku,t1.warehouse_into_code) as t2
set t1.first_purchase_date = t2.min_time
where t1.bailun_sku = t2.bailun_sku and t1.warehouse_code=t2.warehouse_code;
");
_connection.Execute(@"-- 刷新首次调拨时间
update dc_base_stock as t1,
(select t_ps.sku as 'bailun_sku',t_p.targetwareno as 'warehouse_code',min(t_p.creationtime) as 'min_time' from dc_base_transfer_info as t_p
left join dc_base_transfer_info_skus as t_ps on t_p.`dataid` = t_ps.dataid
where t_p.`isdeleted`=0
GROUP BY t_ps.sku,t_p.targetwareno) as t2
set t1.first_trans_date = t2.min_time
where t1.bailun_sku = t2.bailun_sku and t1.warehouse_code=t2.warehouse_code;
");
_connection.Execute(@" -- 刷新库存日志
set session transaction isolation level read uncommitted;
start transaction;
......@@ -2892,7 +2870,7 @@ left join (
from dc_base_purchase_7 as tp_1
GROUP BY tp_1.supplier_id
) as t3 on t2.suppliers_id = t3.supplier_id
where t2.buyer_name = '赵美聪'
where t2.buyer_name in ('赵美聪','甄杰靖')
";
string count_sql = @"
......@@ -2900,7 +2878,7 @@ select
1
from dc_base_oms_sku_7 as t1
left join dc_base_sku as t2 on t1.bailun_sku = t2.bailun_sku
where t2.buyer_name = '赵美聪'
where t2.buyer_name in ('赵美聪','甄杰靖')
";
......@@ -3716,6 +3694,28 @@ where t1.bailun_sku = t2.bailun_sku and t1.bailun_sku = t3.bailun_sku and t1.wee
/// </summary>
public static void PurchaseWeekBackUp()
{
_connection.Execute(@"-- 刷新首次采购时间
set session transaction isolation level read uncommitted;
start transaction;
update dc_base_stock as t1,
(select t1.bailun_sku,t1.warehouse_into_code as 'warehouse_code',min(t1.create_time) as 'min_time' from dc_base_purchase_details as t1
where `status`!=-1
GROUP BY t1.bailun_sku,t1.warehouse_into_code) as t2
set t1.first_purchase_date = t2.min_time
where t1.bailun_sku = t2.bailun_sku and t1.warehouse_code=t2.warehouse_code;
",commandTimeout:0);
_connection.Execute(@"-- 刷新首次调拨时间
update dc_base_stock as t1,
(select t_ps.sku as 'bailun_sku',t_p.targetwareno as 'warehouse_code',min(t_p.creationtime) as 'min_time' from dc_base_transfer_info as t_p
left join dc_base_transfer_info_skus as t_ps on t_p.`dataid` = t_ps.dataid
where t_p.`isdeleted`=0
GROUP BY t_ps.sku,t_p.targetwareno) as t2
set t1.first_trans_date = t2.min_time
where t1.bailun_sku = t2.bailun_sku and t1.warehouse_code=t2.warehouse_code;
", commandTimeout: 0);
var btime = DateTime.Now.AddDays(-7).GetWeekFirstDayMon().ToDayHome();
var etime = btime.GetWeekLastDaySun().ToDayEnd();
var eonthFirstDate = DateTime.Now.AddMonths(-1).GetMonthFirstDay();
......
......@@ -21,10 +21,10 @@ namespace AutoTurnOver.Services
try
{
// 检查是否有可以切换渠道的sku
purchase_advise.ReplaceLogistics(date);
//purchase_advise.ReplaceLogistics(date);
//等待后台重算任务
purchase_advise.WaitReplaceLogisticsTask();
//purchase_advise.WaitReplaceLogisticsTask();
// 创建一个采购计划
var mainID = purchase_advise.Add(new dc_auto_purchase_advise { create_time = DateTime.Now, no = purchase_advise.GenerateOrderNo() ,buy_sys_plan_no = "Generate" });
......
......@@ -19,21 +19,8 @@ namespace ResetOutofstock
var now = DateTime.Now;
//dc_base_supplier_dao.SynchroBailunSupplier();
//dc_auto_pick_up_goods_order_dao.GenerateOrder(DateTime.Now.AddDays(-3), DateTime.Now);
//base_supplier_holiday_time_dao.SynchroData();
//report.ResetCashFlowData();
//report.StockWeekBackUp();
//report.PurchaseWeekBackUp();
//report.CalculationSalesTrend();
//report.PurchaseWeekBackUp();
//report_cash_flow_dao.CalculationTransferOrder(now.AddMonths(-3), DateTime.Parse(now.AddDays(-1).ToString("yyyy-MM-dd 23:59:59")));
//report_cash_flow_dao.SynchroTransferCost();
//dc_auto_pick_up_goods_order_dao.GenerateOrder(DateTime.Now.AddDays(-3), DateTime.Now);
//dc_auto_pick_up_goods_order_dao.GenerateOrder(DateTime.Now.AddDays(-1), DateTime.Now);
//dc_report_finance_dao.CalculationRefund(DateTime.Now.AddYears(-1));
//dc_report_finance_dao.CalculationRaise(DateTime.Now.AddYears(-1));
//dc_report_finance_dao.CalculationAccounts(DateTime.Now.AddYears(-1));
}
catch (Exception ex)
{
......
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