varm=cn.QueryFirstOrDefault<dc_platform_balance>($"select * from dc_platform_balance where platformcode='{item.platformcode}' and currency='{item.currency}' and delstatus=0 order by day desc limit 1");
varm=cn.QueryFirstOrDefault<dc_platform_balance>($"select * from dc_platform_balance where platformcode='{item.platformcode}' and currency='{item.currency}' and delstatus=0 order by day desc limit 1");
varsql="select id,platform_type,website,origin_order_id,bailun_order_id,seller_account,order_currency,amount_total,amount_product,amount_shipping,amount_tax,amount_adjustment,amount_gift_wrap,amount_refund,cost_total,cost_promotion,cost_platform_fee,cost_product,cost_shipping,cost_package,cost_fba_fee,cost_paypal_fee,cost_refund_commisson,cost_handle_bailun,cost_handle_platform,cost_tail,cost_first,profit_total,profit_rate,create_time,paid_time,seller_order_exchange_rate,seller_other_exchange_rate,(seller_order_exchange_rate*amount_prepaid) amount_prepaid from dc_base_oms_order where bailun_order_status!='Canceled' ";
varsql="select id,platform_type,website,origin_order_id,bailun_order_id,seller_account,order_currency,amount_total,amount_product,amount_shipping,amount_tax,amount_adjustment,amount_gift_wrap,amount_refund,cost_total,cost_promotion,cost_platform_fee,cost_product,cost_shipping,cost_package,cost_fba_fee,cost_paypal_fee,cost_refund_commisson,cost_handle_bailun,cost_handle_platform,cost_tail,cost_first,profit_total,profit_rate,create_time,paid_time,seller_order_exchange_rate,seller_other_exchange_rate,(amount_prepaid) amount_prepaid from dc_base_oms_order where bailun_order_status!='Canceled' ";
left join dc_mid_transit t2 on t1.warehouse_code=t2.warehouse_code and t1.bailun_sku=t2.bailun_sku
left join dc_mid_transit t2 on t1.warehouse_code=t2.warehouse_code and t1.bailun_sku=t2.bailun_sku
left join dc_base_sku t3 on t1.bailun_sku=t3.bailun_sku
left join dc_base_sku t3 on t1.bailun_sku=t3.bailun_sku
left join dc_base_warehouse t4 on t1.warehouse_code=t4.warehouse_code
left join dc_base_warehouse t4 on t1.warehouse_code=t4.warehouse_code
left join dc_daily_sales t5 on t1.warehouse_code=t5.warehouse_code and t1.bailun_sku =t5.bailun_sku and t5.record_date = DATE_SUB(curdate(),INTERVAL 0 DAY)
left join dc_daily_sales t5 on t1.warehouse_code=t5.warehouse_code and t1.bailun_sku =t5.bailun_sku and t5.record_date = DATE_SUB(curdate(),INTERVAL 1 DAY)
";
";
varsqlcount="select t1.warehouse_code from dc_base_stock t1 ";
if(!string.IsNullOrWhiteSpace(warehousetype))
if(!string.IsNullOrWhiteSpace(warehousetype))
{
{
sqlwhere+=" and t4.hq_type=@hq_type";
sqlwhere+=" and t4.hq_type=@hq_type";
sqlparam.Add("hq_type",warehousetype);
sqlparam.Add("hq_type",warehousetype);
sqlcount+=" left join dc_base_warehouse t4 on t1.warehouse_code=t4.warehouse_code and hq_type=@hq_type";
}
}
if(!string.IsNullOrWhiteSpace(warehouse))
if(!string.IsNullOrWhiteSpace(warehouse))
{
{
sqlwhere+="t1.warehouse_code=@warehouse_code";
sqlwhere+="t1.warehouse_code=@warehouse_code";
sqlparam.Add("warehouse_code",warehouse);
sqlparam.Add("warehouse_code",warehouse);
sqlcount+="t1.warehouse_code=@warehouse_code";
}
}
sqlwhere+=" group by t1.warehouse_code";
sqlwhere+=" group by t1.warehouse_code";
varsqlorder="";
if(!string.IsNullOrWhiteSpace(parameter.sort))
if(!string.IsNullOrWhiteSpace(parameter.sort))
{
{
sqlwhere+=" order by "+parameter.sort;
sqlorder+=" order by "+parameter.sort;
if(!string.IsNullOrWhiteSpace(parameter.order))
if(!string.IsNullOrWhiteSpace(parameter.order))
{
{
sqlwhere+=" "+parameter.order;
sqlorder+=" "+parameter.order;
}
}
}
}
...
@@ -110,7 +118,7 @@ namespace Bailun.DC.Services
...
@@ -110,7 +118,7 @@ namespace Bailun.DC.Services
cn.Open();
cn.Open();
}
}
varobj=cn.Page<Models.Stock.mLogicWarehouse>(parameter.pageIndex,parameter.limit,sql+sqlwhere,reftotal,parameter,"select count(*) from (select t1.warehouse_code from dc_base_stock t1 left join dc_mid_transit t2 on t1.warehouse_code=t2.warehouse_code and t1.bailun_sku=t2.bailun_sku left join dc_base_sku t3 on t1.bailun_sku=t3.bailun_sku left join dc_base_warehouse t4 on t1.warehouse_code=t4.warehouse_code left join dc_daily_sales t5 on t1.warehouse_code=t5.warehouse_code and t1.bailun_sku =t5.bailun_sku and t5.record_date = DATE_SUB(curdate(),INTERVAL 0 DAY)"+sqlwhere+") tb");
varobj=cn.Page<Models.Stock.mLogicWarehouse>(parameter.pageIndex,parameter.limit,sql+sqlwhere+sqlorder,reftotal,sqlparam,"select count(*) from ("+sqlcount+" group by t1.warehouse_code) tb");
returnobj.AsList();
returnobj.AsList();
}
}
}
}
...
@@ -130,7 +138,7 @@ namespace Bailun.DC.Services
...
@@ -130,7 +138,7 @@ namespace Bailun.DC.Services
left join dc_mid_transit t2 on t1.warehouse_code=t2.warehouse_code and t1.bailun_sku=t2.bailun_sku
left join dc_mid_transit t2 on t1.warehouse_code=t2.warehouse_code and t1.bailun_sku=t2.bailun_sku
left join dc_base_sku t3 on t1.bailun_sku=t3.bailun_sku
left join dc_base_sku t3 on t1.bailun_sku=t3.bailun_sku
left join dc_base_warehouse t4 on t1.warehouse_code=t4.warehouse_code
left join dc_base_warehouse t4 on t1.warehouse_code=t4.warehouse_code
left join dc_daily_sales t5 on t1.warehouse_code=t5.warehouse_code and t1.bailun_sku =t5.bailun_sku and t5.record_date = DATE_SUB(curdate(),INTERVAL 0 DAY)
left join dc_daily_sales t5 on t1.warehouse_code=t5.warehouse_code and t1.bailun_sku =t5.bailun_sku and t5.record_date = DATE_SUB(curdate(),INTERVAL 1 DAY)