Commit c729871e by jianshuqin

调整逻辑:平台月销信利润付款维度的退款取数

parent 854a7e5a
......@@ -1664,7 +1664,7 @@ namespace Bailun.DC.Services
/// <param name="start">付款开始时间</param>
/// <param name="end">付款结束时间</param>
/// <returns></returns>
public List<Models.Orders.dc_base_oms_sku> ListPlatformProfit(string platform, string website, DateTime? start, DateTime? end, DateTime? shipstart, DateTime? shipend, bool isUSD, int? companyid, string skucategoryids, int[] producttype, int? skusource, int? shippingstrategy, int statistictype, int? skunewcategoryid, DateTime? createstart = null, DateTime? createend = null, DateTime? shipmentstart = null, DateTime? shipmentend = null)
public List<Models.Orders.dc_base_oms_sku> ListPlatformProfit(string platform, string website, DateTime? start, DateTime? end, DateTime? shipstart, DateTime? shipend, bool isUSD, int? companyid, string skucategoryids, int[] producttype, int? skusource, int? shippingstrategy, int statistictype, int? skunewcategoryid, DateTime? createstart, DateTime? createend, DateTime? shipmentstart, DateTime? shipmentend, out string[] originOrderIds)
{
var str_statistic_col = "tb.platform_type";
......@@ -1900,7 +1900,7 @@ namespace Bailun.DC.Services
}
var obj = cn.Query<Models.Orders.dc_base_oms_sku>(sql, sqlparam, null, true, 2 * 60);
originOrderIds = shipmentstart.HasValue ? null : cn.Query<string>($"select distinct IF(tb.platform_type = 'Ebay',tb.transaction_id,tb.origin_order_id) as origin_order_id {sql.Substring(0, sql.LastIndexOf("group by")).Substring(sql.IndexOf("from dc_base_oms_sku tb"))}", sqlparam, null, true, 2 * 60).ToArray();
return obj.AsList();
}
......@@ -5761,7 +5761,7 @@ namespace Bailun.DC.Services
/// <param name="website"></param>
/// <param name="isUSD"></param>
/// <returns></returns>
public List<dc_base_oms_order> ListPlatformRefund(DateTime? start, DateTime? end, int? companyid, string platform, string website, bool isUSD, bool containNotShipping, int[] producttype, int? skusource, int? shippingstrategy, int statistictype)
public List<dc_base_oms_order> ListPlatformRefund(DateTime? start, DateTime? end, int? companyid, string platform, string website, bool isUSD, bool containNotShipping, int[] producttype, int? skusource, int? shippingstrategy, int statistictype, string[] originOrderIds = null)
{
var str_statistic_col = "t1.platform_type";
......@@ -5875,6 +5875,11 @@ namespace Bailun.DC.Services
{
sql += " and t1.shipping_status in ('TotalShipping','PartShipping') ";
}
else if (originOrderIds?.Length > 0)
{
sqlparam.Add("origin_order_id", originOrderIds);
sql += $" and t1.origin_order_id in @origin_order_id";
}
//从2021年12月23号后过虑 美美哒和达馨('Lagunamoon_Beauty','Lagunamoon Nail Varnish','dawarmthEU','dawarmth') 数据
sql += @" and t1.id not in (
......@@ -5909,7 +5914,6 @@ namespace Bailun.DC.Services
{
cn.Open();
}
var obj = cn.Query<dc_base_oms_order>(sql, sqlparam, null, true, 2 * 60);
return obj.AsList();
......
......@@ -1727,8 +1727,8 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
dtstart = shipstart ?? shipmentstart;
dtend = shipend ?? shipmentend;
result = _service.ListPlatformProfitByShipTime(platform, website, start, end, dtstart, dtend, currency.ToUpper() == "USD", companyid, skucategoryids, producttype, skusource, shippingstrategy, statistictype, skunewcategory);
var fbaResult = _service.ListPlatformProfit(string.IsNullOrEmpty(platform) ? "FBA" : "", website, null, null, null, null, currency.ToUpper() == "USD", companyid, skucategoryids, producttype, skusource, shippingstrategy, statistictype, skunewcategory, shipstart, shipend, shipmentstart, shipmentend);
string[] originOrderIds = null;
var fbaResult = _service.ListPlatformProfit(string.IsNullOrEmpty(platform) ? "FBA" : "", website, null, null, null, null, currency.ToUpper() == "USD", companyid, skucategoryids, producttype, skusource, shippingstrategy, statistictype, skunewcategory, shipstart, shipend, shipmentstart, shipmentend, out originOrderIds);
......@@ -1803,8 +1803,9 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
}
else
{
result = _service.ListPlatformProfit(platform, website, start, end, shipstart, shipend, currency.ToUpper() == "USD", companyid, skucategoryids, producttype, skusource, shippingstrategy, statistictype, skunewcategory);
listRefund = _service.ListPlatformRefund(dtstart, dtend, companyid, platform, website, currency.ToUpper() == "USD", true, producttype, skusource, shippingstrategy, statistictype); //包含未发货的退款金额
string[] originOrderIds = null;
result = _service.ListPlatformProfit(platform, website, start, end, shipstart, shipend, currency.ToUpper() == "USD", companyid, skucategoryids, producttype, skusource, shippingstrategy, statistictype, skunewcategory, null, null, null, null, out originOrderIds);
listRefund = _service.ListPlatformRefund(dtstart, dtend, companyid, platform, website, currency.ToUpper() == "USD", true, producttype, skusource, shippingstrategy, statistictype, originOrderIds); //包含未发货的退款金额
//针对SKU FJH-L-2 做特殊处理
if (producttype.Length > 0)
......@@ -1894,8 +1895,9 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
}
else
{
result = _service.ListPlatformProfit(platform, website, start, end, shipstart, shipend, currency.ToUpper() == "USD", companyid, skucategoryids, null, null, null, statistictype, skunewcategory);
listRefund = _service.ListPlatformRefund(dtstart, dtend, companyid, platform, website, currency.ToUpper() == "USD", true, null, null, null, statistictype); //包含未发货的退款金额
string[] originOrderIds = null;
result = _service.ListPlatformProfit(platform, website, start, end, shipstart, shipend, currency.ToUpper() == "USD", companyid, skucategoryids, null, null, null, statistictype, skunewcategory, null, null, null, null, out originOrderIds);
listRefund = _service.ListPlatformRefund(dtstart, dtend, companyid, platform, website, currency.ToUpper() == "USD", true, null, null, null, statistictype, originOrderIds); //包含未发货的退款金额
}
if (statistictype == 0)
......
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