Commit 02c68578 by guanzhenshan

调整提示信息

parent 7fd00e73
......@@ -7,21 +7,21 @@ namespace Bailun.DC.LogicWareHouse
{
class Program
{
static async Task Main(string[] args)
{
Console.WriteLine("进入 每日同步SKU仓库库存+销量统计信息");
new Services().Save();
var builder = new HostBuilder().ConfigureServices((hostContext, services) =>
{
services.AddHostedService<Services>();
});
await builder.RunConsoleAsync();
}
//static void Main(string[] args)
//static async Task Main(string[] args)
//{
// Console.WriteLine("进入 每日同步SKU仓库库存+销量统计信息");
// new Services().Save();
// var builder = new HostBuilder().ConfigureServices((hostContext, services) =>
// {
// services.AddHostedService<Services>();
// });
// await builder.RunConsoleAsync();
//}
static void Main(string[] args)
{
new Services().Save();
}
}
}
......@@ -4295,29 +4295,11 @@ namespace Bailun.DC.Services
public List<dc_base_oms_order> ListPlatformRefund(DateTime? start, DateTime? end, int? companyid, string platform, string website, bool isUSD)
{
var sqlparam = new DynamicParameters();
var sql = $"select t1.platform_type,{(isUSD? "sum(t1.amount_refund_usd)" : "sum(t1.amount_refund_rmb)")} as amount_refund from dc_base_crm_refund t1 join dc_base_oms_order t2 on t1.origin_order_id=t2.origin_order_id and t2.bailun_order_status!='Canceled' and t1.bailun_account_id and t2.bailun_account_id ";
var sql1 = $" union all select t1.platform_type,{(isUSD ? "sum(t1.amount_refund_usd)" : "sum(t1.amount_refund_rmb)")} as amount_refund from dc_base_crm_refund t1 join dc_base_oms_order t2 on t1.origin_order_id=t2.transaction_id and t2.bailun_order_status!='Canceled' and t1.bailun_account_id and t2.bailun_account_id ";
sql += " where t1.is_deleted=0 and t1.is_freeze=0 and t1.platform_type!='Ebay' ";
sql1 += " where t1.is_deleted=0 and t1.is_freeze=0 and t1.platform_type='Ebay' ";
//合并订单的退款数据 非Ebay
var sql01 = $@" union all select t01.platform_type,{(isUSD ? "sum(t01.amount_refund_usd)" : "sum(t01.amount_refund_rmb)")} as amount_refund from (
select t1.amount_refund_rmb,t1.amount_refund_usd,t1.platform_type,t2.aftermerged_bailun_order_no from dc_base_crm_refund t1
join dc_base_oms_order t2 on t1.origin_order_id=t2.origin_order_id and t2.aftermerged_bailun_order_no != '' and t1.bailun_account_id and t2.bailun_account_id
where t1.is_deleted=0 and t1.is_freeze=0 and t1.platform_type!='Ebay' ";
//合并订单的退款数据 Ebay
var sql02 = $@" union all select t01.platform_type,{(isUSD ? "sum(t01.amount_refund_usd)" : "sum(t01.amount_refund_rmb)")} as amount_refund from (
select t1.amount_refund_rmb,t1.amount_refund_usd,t1.platform_type,t2.aftermerged_bailun_order_no from dc_base_crm_refund t1
join dc_base_oms_order t2 on t1.origin_order_id=t2.transaction_id and t2.aftermerged_bailun_order_no !='' and t1.bailun_account_id and t2.bailun_account_id
where t1.is_deleted=0 and t1.is_freeze=0 and t1.platform_type='Ebay' ";
var sql = $"select t1.platform_type,{(isUSD? "sum(t1.amount_refund_usd)" : "sum(t1.amount_refund_rmb)")} as amount_refund from dc_base_crm_refund t1 where t1.order_status!='Canceled' and t1.is_deleted=0 and is_freeze=0 ";
if (companyid.HasValue && companyid.Value != 0)
{
sql += " and t1.company_id="+companyid.Value;
sql1 += " and t1.company_id=" + companyid.Value;
sql01 += " and t1.company_id=" + companyid.Value;
sql02 += " and t1.company_id=" + companyid.Value;
}
if (!string.IsNullOrWhiteSpace(platform))
......@@ -4325,71 +4307,26 @@ namespace Bailun.DC.Services
sql += " and t1.platform_type=@platform_type";
sqlparam.Add("platform_type", platform);
sql1 += " and t1.platform_type=@platform_type1";
sqlparam.Add("platform_type1", platform);
sql01 += " and t1.platform_type=@platform_type01";
sqlparam.Add("platform_type01", platform);
sql02 += " and t1.platform_type=@platform_type02";
sqlparam.Add("platform_type02", platform);
}
if (!string.IsNullOrWhiteSpace(website))
{
sql += " and t1.website=@website";
sqlparam.Add("website", website);
sql1 += " and t1.website=@website1";
sqlparam.Add("website1", website);
sql01 += " and t1.website=@website01";
sqlparam.Add("website01", website);
sql02 += " and t1.website=@website02";
sqlparam.Add("website02", website);
}
if (start.HasValue)
{
sql += " and t1.refund_time>=@start";
sqlparam.Add("start", start.Value);
sql1 += " and t1.refund_time>=@start1";
sqlparam.Add("start1", start.Value);
sql01 += " and t1.refund_time>=@start01";
sqlparam.Add("start01", start.Value);
sql02 += " and t1.refund_time>=@start02";
sqlparam.Add("start02", start.Value);
}
if (end.HasValue)
{
sql += " and t1.refund_time<@end";
sqlparam.Add("end", end.Value.AddDays(1));
sql1 += " and t1.refund_time<@end1";
sqlparam.Add("end1", end.Value.AddDays(1));
sql01 += " and t1.refund_time<@end01";
sqlparam.Add("end01", end.Value.AddDays(1));
sql02 += " and t1.refund_time<@end02";
sqlparam.Add("end02", end.Value.AddDays(1));
}
sql += " group by t1.platform_type";
sql1 += " group by t1.platform_type";
sql01 += @" ) t01
join dc_base_oms_order t02 on t01.aftermerged_bailun_order_no = t02.bailun_order_id and t02.bailun_order_status != 'Canceled'
group by t01.platform_type";
sql02 += @" ) t01
join dc_base_oms_order t02 on t01.aftermerged_bailun_order_no = t02.bailun_order_id and t02.bailun_order_status != 'Canceled'
group by t01.platform_type";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
......@@ -4398,21 +4335,10 @@ namespace Bailun.DC.Services
cn.Open();
}
var obj = cn.Query<dc_base_oms_order>(sql+sql1+sql01+sql02, sqlparam, null, true, 2 * 60);
var list = new List<dc_base_oms_order>();
foreach (var item in obj.AsList().GroupBy(a=>a.platform_type))
{
list.Add(new dc_base_oms_order {
platform_type = item.Key,
amount_refund = item.Sum(a=>a.amount_refund),
});
}
var obj = cn.Query<dc_base_oms_order>(sql, sqlparam, null, true, 2 * 60);
return list;
return obj.AsList();
}
}
#endregion
......
......@@ -26,13 +26,13 @@ namespace Bailun.DC.SkuDailyPurchaseAndSales
try
{
var now = DateTime.Now;
Console.WriteLine("开始计算服务 " + now.ToString("yyyy-MM-dd HH:mm:ss"));
if (now.Hour == 23 && now.Minute == 59)
{
Console.WriteLine("开始计算服务 " + now.ToString("yyyy-MM-dd HH:mm:ss"));
Init(DateTime.Parse(now.ToShortDateString()),now);
}
Console.WriteLine("计算结束 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
......
......@@ -15,5 +15,7 @@ namespace Bailun.DC.Web.Areas.ExportFile.Controllers
}
}
}
\ No newline at end of file
......@@ -16,7 +16,6 @@ namespace Bailun.DC.Web.Areas.ExportFile.Controllers
public ActionResult PurchaseAndAllot(DateTime start, DateTime end)
{
return View();
}
......
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