Commit 16503b6e by lizefeng

优化库存查询

parent 6ccf96e4
...@@ -239,9 +239,12 @@ from ...@@ -239,9 +239,12 @@ from
dc_base_stock as t1 dc_base_stock as t1
left join dc_base_warehouse as dbw on t1.warehouse_code = dbw.warehouse_code left join dc_base_warehouse as dbw on t1.warehouse_code = dbw.warehouse_code
left join dc_mid_transit as t4 on t1.bailun_sku = t4.bailun_sku and t1.warehouse_code = t4.warehouse_code left join dc_mid_transit as t4 on t1.bailun_sku = t4.bailun_sku and t1.warehouse_code = t4.warehouse_code
left join dc_base_tort as t5 on t1.bailun_sku = t5.bailun_sku ";
if (has_tort != null)
where 1=1"; {
sql += " left join dc_base_tort as t5 on t1.bailun_sku = t5.bailun_sku ";
}
sql += " where 1=1 ";
} }
else else
{ {
...@@ -269,18 +272,20 @@ left join dc_auto_config_sku_warehouse as t7 on t1.bailun_sku = t7.bailun_sku an ...@@ -269,18 +272,20 @@ left join dc_auto_config_sku_warehouse as t7 on t1.bailun_sku = t7.bailun_sku an
where 1=1 where 1=1
"; ";
} }
var countSql = @" var countSql = @"
select select
count(1) count(1)
from from
dc_base_stock as t1 dc_base_stock as t1
left join dc_base_warehouse as dbw on t1.warehouse_code = dbw.warehouse_code left join dc_base_warehouse as dbw on t1.warehouse_code = dbw.warehouse_code
left join dc_mid_transit as t4 on t1.bailun_sku = t4.bailun_sku and t1.warehouse_code = t4.warehouse_code
left join dc_base_tort as t5 on t1.bailun_sku = t5.bailun_sku
where 1=1
"; ";
if (has_tort != null)
{
countSql += " left join dc_base_tort as t5 on t1.bailun_sku = t5.bailun_sku ";
}
countSql += "where 1=1 ";
DynamicParameters parameters = new DynamicParameters(); DynamicParameters parameters = new DynamicParameters();
parameters.Add("time", DateTime.Now.ToString("yyyy-MM-dd 00:00:00")); parameters.Add("time", DateTime.Now.ToString("yyyy-MM-dd 00:00:00"));
......
...@@ -12,7 +12,7 @@ namespace ShortagePush ...@@ -12,7 +12,7 @@ namespace ShortagePush
static async Task Main(string[] args) static async Task Main(string[] args)
{ {
Console.WriteLine("推送缺货数据服务"); Console.WriteLine("推送缺货数据服务");
var datas = report.ShortagePush(); var datas = report.ShortagePush(true);
var builder = new HostBuilder().ConfigureServices((hostContext, services) => var builder = new HostBuilder().ConfigureServices((hostContext, services) =>
{ {
services.AddHostedService<ShortagePushBackgroundService>(); services.AddHostedService<ShortagePushBackgroundService>();
......
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