Commit 340fb341 by guanzhenshan

解决尾程费统计不准的问题

parent 0ec69b21
...@@ -22,7 +22,7 @@ namespace Bailun.DC.HappenAmount ...@@ -22,7 +22,7 @@ namespace Bailun.DC.HappenAmount
//static void Main(string[] args) //static void Main(string[] args)
//{ //{
// var start = DateTime.Parse("2020-04-06"); // var start = DateTime.Parse("2020-04-19");
// while (start.AddDays(1) < DateTime.Now) // while (start.AddDays(1) < DateTime.Now)
// { // {
// new Services().Init(start, start.AddDays(1)); // new Services().Init(start, start.AddDays(1));
......
...@@ -184,8 +184,8 @@ namespace Bailun.DC.HappenAmount ...@@ -184,8 +184,8 @@ namespace Bailun.DC.HappenAmount
m.tl_amount_pay = m.hl_amount_pay; m.tl_amount_pay = m.hl_amount_pay;
//发生额 //发生额
sqlhappen = $@"select sum(t2.cost_tail*t1.quantity_shipped) from dc_base_oms_pick t1 sqlhappen = $@"select sum(t2.cost_logistics*t1.quantity_shipped) from dc_base_oms_pick t1
join dc_base_oms_sku t2 on t1.bailun_sku = t2.bailun_sku and t1.origin_order_id = t2.origin_order_id and t2.bailun_order_status != 'Canceled' and t2.has_scalp = 0 and t2.has_delete = 0 and t2.has_innersale = 0 and t2.company_id = 1 and t2.cost_tail > 0 join dc_base_oms_sku t2 on t1.bailun_sku = t2.bailun_sku and t1.origin_order_id = t2.origin_order_id and t2.bailun_order_status != 'Canceled' and t2.has_scalp = 0 and t2.has_delete = 0 and t2.has_innersale = 0 and t2.company_id = 1 and t2.cost_logistics > 0
where t1.shipping_time >= '{start.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.shipping_time < '{end.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.has_delete = 0 and t1.company_id = 1 and t1.shipping_status = 'TotalShipping'"; where t1.shipping_time >= '{start.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.shipping_time < '{end.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.has_delete = 0 and t1.company_id = 1 and t1.shipping_status = 'TotalShipping'";
m.tl_amount_happen += cn.QueryFirstOrDefault<decimal?>(sqlhappen,null,null,2*60)??0; m.tl_amount_happen += cn.QueryFirstOrDefault<decimal?>(sqlhappen,null,null,2*60)??0;
......
...@@ -37,7 +37,7 @@ namespace Bailun.DC.MonthSaleProfit ...@@ -37,7 +37,7 @@ namespace Bailun.DC.MonthSaleProfit
Console.WriteLine("任务运行完成 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); Console.WriteLine("任务运行完成 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
} }
else if (now.Minute == 59) else if (now.Hour%6==0 && now.Minute == 59)
{ {
Console.WriteLine("开始启动更新服务" + DateTime.Now); Console.WriteLine("开始启动更新服务" + DateTime.Now);
Update(DateTime.Now); Update(DateTime.Now);
......
...@@ -2373,8 +2373,8 @@ namespace Bailun.DC.Services ...@@ -2373,8 +2373,8 @@ namespace Bailun.DC.Services
/// <returns></returns> /// <returns></returns>
public List<dc_base_oms_pick> ListTailLogisticHappen(BtTableParameter parameter, DateTime start, DateTime end, ref int total) public List<dc_base_oms_pick> ListTailLogisticHappen(BtTableParameter parameter, DateTime start, DateTime end, ref int total)
{ {
var sql = $@"select t1.origin_order_id,pick_order_id,tracking_order_id,t1.bailun_sku,(t2.cost_tail*t1.quantity_shipped) cost_tail,shipping_time from dc_base_oms_pick t1 var sql = $@"select t1.origin_order_id,pick_order_id,tracking_order_id,t1.bailun_sku,(t2.cost_logistics*t1.quantity_shipped) cost_tail,shipping_time from dc_base_oms_pick t1
join dc_base_oms_sku t2 on t1.bailun_sku = t2.bailun_sku and t1.origin_order_id = t2.origin_order_id and t2.bailun_order_status != 'Canceled' and t2.has_scalp = 0 and t2.has_delete = 0 and t2.has_innersale = 0 and t2.company_id = 1 and t2.cost_tail > 0 join dc_base_oms_sku t2 on t1.bailun_sku = t2.bailun_sku and t1.origin_order_id = t2.origin_order_id and t2.bailun_order_status != 'Canceled' and t2.has_scalp = 0 and t2.has_delete = 0 and t2.has_innersale = 0 and t2.company_id = 1 and t2.cost_logistics > 0
where t1.shipping_time >= '{start.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.shipping_time < '{end.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss")}' and t1.has_delete = 0 and t1.company_id = 1 and t1.shipping_status = 'TotalShipping'"; where t1.shipping_time >= '{start.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.shipping_time < '{end.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss")}' and t1.has_delete = 0 and t1.company_id = 1 and t1.shipping_status = 'TotalShipping'";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
...@@ -2407,8 +2407,8 @@ namespace Bailun.DC.Services ...@@ -2407,8 +2407,8 @@ namespace Bailun.DC.Services
/// <returns></returns> /// <returns></returns>
public dc_base_oms_pick ListTailLogisticHappenCount(DateTime start, DateTime end) public dc_base_oms_pick ListTailLogisticHappenCount(DateTime start, DateTime end)
{ {
var sql = $@"select sum(t2.cost_tail*t1.quantity_shipped) cost_tail from dc_base_oms_pick t1 var sql = $@"select sum(t2.cost_logistics*t1.quantity_shipped) cost_tail from dc_base_oms_pick t1
join dc_base_oms_sku t2 on t1.bailun_sku = t2.bailun_sku and t1.origin_order_id = t2.origin_order_id and t2.bailun_order_status != 'Canceled' and t2.has_scalp = 0 and t2.has_delete = 0 and t2.has_innersale = 0 and t2.company_id = 1 and t2.cost_tail > 0 join dc_base_oms_sku t2 on t1.bailun_sku = t2.bailun_sku and t1.origin_order_id = t2.origin_order_id and t2.bailun_order_status != 'Canceled' and t2.has_scalp = 0 and t2.has_delete = 0 and t2.has_innersale = 0 and t2.company_id = 1 and t2.cost_logistics > 0
where t1.shipping_time >= '{start.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.shipping_time < '{end.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss")}' and t1.has_delete = 0 and t1.company_id = 1 and t1.shipping_status = 'TotalShipping'"; where t1.shipping_time >= '{start.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.shipping_time < '{end.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss")}' and t1.has_delete = 0 and t1.company_id = 1 and t1.shipping_status = 'TotalShipping'";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
...@@ -2434,7 +2434,7 @@ namespace Bailun.DC.Services ...@@ -2434,7 +2434,7 @@ namespace Bailun.DC.Services
/// <returns></returns> /// <returns></returns>
public List<Models.Orders.dc_base_oms_sku> ListTailLogisticSale(BtTableParameter parameter, DateTime start, DateTime end, ref int total) public List<Models.Orders.dc_base_oms_sku> ListTailLogisticSale(BtTableParameter parameter, DateTime start, DateTime end, ref int total)
{ {
var sql = $"select platform_type,origin_order_id,bailun_sku,(cost_tail*bailun_sku_quantity_ordered) as cost_tail,paid_time from dc_base_oms_sku t1 where paid_time>='{start.ToString("yyyy-MM-dd HH:mm:ss")}' and paid_time<'{end.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss")}' and bailun_order_status!='Canceled' and has_scalp=0 and has_delete=0 and has_innersale=0 and company_id=1 and cost_logistics>0"; var sql = $"select platform_type,origin_order_id,bailun_sku,(cost_logistics*bailun_sku_quantity_ordered) as cost_tail,paid_time from dc_base_oms_sku t1 where paid_time>='{start.ToString("yyyy-MM-dd HH:mm:ss")}' and paid_time<'{end.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss")}' and bailun_order_status!='Canceled' and has_scalp=0 and has_delete=0 and has_innersale=0 and company_id=1 and cost_logistics>0";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{ {
......
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