Commit acfe36cc by 泽锋 李

data_id 修复字段更改异常

parent 759dd617
...@@ -18,8 +18,8 @@ namespace AutoGeneratePurchaseAdvise ...@@ -18,8 +18,8 @@ namespace AutoGeneratePurchaseAdvise
try try
{ {
purchase_advise.ReplaceLogistics(DateTime.Now); //purchase_advise.ReplaceLogistics(DateTime.Now);
//purchase_advise.WaitReplaceLogisticsTask();
} }
catch (Exception ex) catch (Exception ex)
{ {
......
...@@ -40,7 +40,7 @@ GROUP BY t1.bailun_sku,t1.warehouse_code,t1.supplier_id ", new { c_time = DateT ...@@ -40,7 +40,7 @@ GROUP BY t1.bailun_sku,t1.warehouse_code,t1.supplier_id ", new { c_time = DateT
parameters.Add("time", DateTime.Now.AddDays(0 - day).ToString("yyyy-MM-dd 00:00:00")); parameters.Add("time", DateTime.Now.AddDays(0 - day).ToString("yyyy-MM-dd 00:00:00"));
return _connection.Query<temp_sku_dto>(@"select t2.hq_type,tsku.sku as 'bailun_sku',t1.targetwareno as 'warehouse_code' return _connection.Query<temp_sku_dto>(@"select t2.hq_type,tsku.sku as 'bailun_sku',t1.targetwareno as 'warehouse_code'
from dc_base_transfer_info as t1 from dc_base_transfer_info as t1
left join dc_base_transfer_info_skus as tsku on t1.data_id = tsku.dataid left join dc_base_transfer_info_skus as tsku on t1.dataid = tsku.dataid
left join dc_base_warehouse as t2 on t1.targetwareno = t2.warehouse_code left join dc_base_warehouse as t2 on t1.targetwareno = t2.warehouse_code
where t1.isdeleted=0 and t1.`timestamp`>=@c_time where t1.isdeleted=0 and t1.`timestamp`>=@c_time
GROUP BY tsku.sku,t1.targetwareno ", new { c_time = DateTime.Now.AddDays(-7) }); GROUP BY tsku.sku,t1.targetwareno ", new { c_time = DateTime.Now.AddDays(-7) });
......
...@@ -171,7 +171,8 @@ order by t1.start_time desc ...@@ -171,7 +171,8 @@ order by t1.start_time desc
INSERT into dc_auto_purchase_advise_detailed(`bailun_sku`,`source_warehouse_code`,`warehouse_code`,`quantity_init_advise`,`quantity_final_advise`, INSERT into dc_auto_purchase_advise_detailed(`bailun_sku`,`source_warehouse_code`,`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`, `product_inner_code`,`goods_quantity_init_advise`,`goods_moq`,`good_sku_codes`,`goods_history_fourteenday_sales`,`history_fourteenday_sales`,
`quantity_actual`,`main_id`, `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`) `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`,`auto_replace_logistics_task_id`,`logistics_code`)
( (
select * from ( select * from (
select select
...@@ -218,13 +219,16 @@ select ...@@ -218,13 +219,16 @@ select
case when t6.buyer_name in ('张莹霞','张莹霞1') and t1.warehouse_code='GZBLWH' then 1 case when t6.buyer_name in ('张莹霞','张莹霞1') and t1.warehouse_code='GZBLWH' then 1
else 0 else 0
end end
) as 'purchase_type_jit' ) as 'purchase_type_jit',
t1.auto_replace_logistics_task_id,
tr_task.logistics_code
from dc_auto_turnover as t1 from dc_auto_turnover 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_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_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
left join dc_auto_jit_tag as t8 on t1.tag_id = t8.id left join dc_auto_jit_tag as t8 on t1.tag_id = t8.id
left join dc_auto_replace_logistics_task as tr_task on t1.auto_replace_logistics_task_id = tr_task.id
where t1.gmt_modified>=@btime 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.`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 ( and (
......
...@@ -176,6 +176,16 @@ namespace AutoTurnOver.Models ...@@ -176,6 +176,16 @@ namespace AutoTurnOver.Models
/// </summary> /// </summary>
public decimal? quantity_out_stock_other { get; set; } public decimal? quantity_out_stock_other { get; set; }
public string remarks { get; set; } public string remarks { get; set; }
/// <summary>
/// 切换渠道任务id
/// </summary>
public int? auto_replace_logistics_task_id { get; set; }
/// <summary>
/// 推荐发送的渠道
/// </summary>
public string logistics_code { get; set; }
} }
......
...@@ -20,13 +20,17 @@ namespace AutoTurnOver.Services ...@@ -20,13 +20,17 @@ namespace AutoTurnOver.Services
{ {
try try
{ {
// 检查是否有可以切换渠道的sku
purchase_advise.ReplaceLogistics(date);
//等待后台重算任务
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" }); var mainID = purchase_advise.Add(new dc_auto_purchase_advise { create_time = DateTime.Now, no = purchase_advise.GenerateOrderNo() ,buy_sys_plan_no = "Generate" });
if (mainID == null) throw new Exception("创建采购建议失败"); if (mainID == null) throw new Exception("创建采购建议失败");
purchase_advise.ImportDetailed(mainID.Value,date); purchase_advise.ImportDetailed(mainID.Value,date);
// 把
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -107,18 +111,19 @@ namespace AutoTurnOver.Services ...@@ -107,18 +111,19 @@ namespace AutoTurnOver.Services
/// <param name="datas"></param> /// <param name="datas"></param>
/// <param name="user"></param> /// <param name="user"></param>
/// <param name="is_skip_error">是否跳过异常</param> /// <param name="is_skip_error">是否跳过异常</param>
public static void PushBuySys(List<dc_auto_purchase_advise_detailed_dto> datas, UserData user,bool is_skip_error,string remarks = "") public static void PushBuySys(List<dc_auto_purchase_advise_detailed_dto> original_datas, UserData user,bool is_skip_error,string remarks = "")
{ {
lock (_push_lock) lock (_push_lock)
{ {
try try
{ {
//查询最近一个采购建议 //查询最近一个采购建议
// if (original_datas == null)
if (datas == null)
{ {
return; return;
} }
var json_datas = original_datas.ToJson().ToObject<List<dc_auto_purchase_advise_detailed_dto>>();
var datas = json_datas;
List<string> planNos = new List<string>(); List<string> planNos = new List<string>();
DateTime now = DateTime.Now; DateTime now = DateTime.Now;
// 查询未推送成功的采购建议的明细 // 查询未推送成功的采购建议的明细
......
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