Commit 4a9608c2 by guanzhenshan

增加公司id判断

parent 8d05bd75
...@@ -130,7 +130,27 @@ namespace Bailun.DC.Services ...@@ -130,7 +130,27 @@ namespace Bailun.DC.Services
} }
} }
sql += $@" where t1.has_delete=0 and t1.shipping_status='TotalShipping' and 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")}'"; sql += $@" where t1.company_id={companyid} and t1.has_delete=0 and t1.shipping_status='TotalShipping' and 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")}'";
sql += $@" union all
select t1.origin_order_id,t1.bailun_order_id as pick_order_id,'' as logistics_order_id,t1.create_time as shipping_time,t1.warehouse_code,t1.warehouse_name,t1.bailun_sku,t1.bailun_sku_quantity_ordered as quantity_shipped,(t1.bailun_sku_quantity_ordered*t1.bailun_sku_unit_price) as amount from dc_base_oms_sku t1 ";
if (!string.IsNullOrWhiteSpace(skucategoryids))
{
var arr = skucategoryids.Split('|').Where(a => !string.IsNullOrEmpty(a)).ToList();
if (arr.Count > 0)
{
sql += " join dc_base_sku t2 on t1.bailun_sku=t2.bailun_sku";
var s = string.Join(",", arr);
if (!string.IsNullOrEmpty(s))
{
sql += " and t2.category_simple_id in (" + s + ") ";
}
}
}
sql += $@" where t1.company_id={companyid} and t1.create_time>='{start.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.create_time<'{end.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss")}' and t1.bailun_order_status!='Canceled' and t1.has_scalp=0 and t1.has_delete=0 and t1.has_cancle=0 and platform_type='FBA'";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{ {
......
...@@ -85,13 +85,13 @@ namespace Bailun.DC.SkuDailyPurchaseAndSales ...@@ -85,13 +85,13 @@ namespace Bailun.DC.SkuDailyPurchaseAndSales
sql = $@"select tb.warehouse_code,tb.warehouse_name,tb.bailun_sku,sum(count) count,sum(amount) amount from (select t1.warehouse_code,t3.warehouse_name,t1.bailun_sku,sum(t1.quantity_shipped) count,sum(t1.quantity_shipped*t2.unit_price) amount from dc_base_oms_pick t1 sql = $@"select tb.warehouse_code,tb.warehouse_name,tb.bailun_sku,sum(count) count,sum(amount) amount from (select t1.warehouse_code,t3.warehouse_name,t1.bailun_sku,sum(t1.quantity_shipped) count,sum(t1.quantity_shipped*t2.unit_price) amount from dc_base_oms_pick t1
left join dc_base_sku t2 on t1.bailun_sku=t2.bailun_sku left join dc_base_sku t2 on t1.bailun_sku=t2.bailun_sku
left join dc_base_warehouse t3 on t1.warehouse_code=t3.warehouse_code left join dc_base_warehouse t3 on t1.warehouse_code=t3.warehouse_code
where t1.has_delete=0 and t1.shipping_status='TotalShipping' and t1.shipping_time>='{start.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.shipping_time<'{end.ToString("yyyy-MM-dd HH:mm:ss")}' where t1.company_id=1 and t1.has_delete=0 and t1.shipping_status='TotalShipping' and t1.shipping_time>='{start.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.shipping_time<'{end.ToString("yyyy-MM-dd HH:mm:ss")}'
group by t1.warehouse_code,t1.bailun_sku group by t1.warehouse_code,t1.bailun_sku
union all union all
select t1.warehouse_code,t3.warehouse_name,t1.bailun_sku,sum(t1.bailun_sku_quantity_ordered) count,sum(t1.bailun_sku_quantity_ordered*t2.unit_price) amount from dc_base_oms_sku t1 select t1.warehouse_code,t3.warehouse_name,t1.bailun_sku,sum(t1.bailun_sku_quantity_ordered) count,sum(t1.bailun_sku_quantity_ordered*t2.unit_price) amount from dc_base_oms_sku t1
left join dc_base_sku t2 on t1.bailun_sku=t2.bailun_sku left join dc_base_sku t2 on t1.bailun_sku=t2.bailun_sku
left join dc_base_warehouse t3 on t1.warehouse_code=t3.warehouse_code left join dc_base_warehouse t3 on t1.warehouse_code=t3.warehouse_code
where t1.paid_time>='{start.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.paid_time<'{end.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.bailun_order_status!='Canceled' and t1.has_scalp=0 and t1.has_delete=0 and t1.has_cancle=0 and platform_type='FBA' where t1.company_id=1 and t1.create_time>='{start.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.create_time<'{end.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.bailun_order_status!='Canceled' and t1.has_scalp=0 and t1.has_delete=0 and t1.has_cancle=0 and platform_type='FBA'
group by t1.warehouse_code,t1.bailun_sku) tb group by t1.warehouse_code,t1.bailun_sku) tb
group by tb.bailun_sku,tb.warehouse_code"; group by tb.bailun_sku,tb.warehouse_code";
var objShipping = cn.Query<Models.mSkuCount>(sql, null, null, true, 2 * 60).AsList(); var objShipping = cn.Query<Models.mSkuCount>(sql, null, null, true, 2 * 60).AsList();
......
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