Commit 88eba714 by lizefeng

优化周转表查询

parent 42bb61a8
......@@ -69,18 +69,23 @@ where 1=1 ";
string sqlCount = @"select count(1)
from dc_auto_turnover as dat
left join dc_base_warehouse as t3 on dat.warehouse_code = t3.warehouse_code
left join dc_base_tort as t8 on dat.bailun_sku = t8.bailun_sku
";
DynamicParameters parameters = new DynamicParameters();
if ((!string.IsNullOrWhiteSpace(m.warehousetype)) || m.warehousearea > 0 || (!string.IsNullOrEmpty(m.warehouse_code)))
{
sqlCount += " left join dc_base_warehouse as t3 on dat.warehouse_code = t3.warehouse_code ";
}
if (m.monitor_status != null)
{
sqlCount += " left join dc_auto_config_sku_warehouse as t5 on dat.bailun_sku = t5.bailun_sku and dat.warehouse_code = t5.warehouse_code ";
}
if (m.has_tort != null)
{
sqlCount += " left join dc_base_tort as t8 on dat.bailun_sku = t8.bailun_sku ";
}
sqlCount += " where 1=1 ";
if (m.has_tort != null)
......@@ -177,6 +182,13 @@ left join dc_base_tort as t8 on dat.bailun_sku = t8.bailun_sku
sql += " and ( dat.abroad_inbound_delivery >0 and dat.transfer_bale_delivery >0 and dat.transfer_delivery >0 ) ";
sqlCount += " and ( dat.abroad_inbound_delivery >0 and dat.transfer_bale_delivery >0 and dat.transfer_delivery >0 ) ";
}
if (!string.IsNullOrEmpty(m.warehouse_code))
{
sql += " and dat.warehouse_code='" + m.warehouse_code + "'";
sqlCount += " and dat.warehouse_code='" + m.warehouse_code + "'";
}
else
{
if (!string.IsNullOrWhiteSpace(m.warehousetype))
{
sql += " and t3.hq_type=" + $"'{m.warehousetype}'";
......@@ -187,10 +199,6 @@ left join dc_base_tort as t8 on dat.bailun_sku = t8.bailun_sku
sql += " and t3.area_id=" + m.warehousearea;
sqlCount += " and t3.area_id=" + m.warehousearea;
}
if (!string.IsNullOrEmpty(m.warehouse_code))
{
sql += " and dat.warehouse_code='" + m.warehouse_code + "'";
sqlCount += " and dat.warehouse_code='" + m.warehouse_code + "'";
}
if (m.out_of_stock.HasValue)
......
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