Commit fd7ebffd by 泽锋 李

fix

parent d4dfbeca
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
using AutoTurnOver.Utility; using AutoTurnOver.Utility;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text; using System.Text;
namespace AutoTurnOver.DB namespace AutoTurnOver.DB
...@@ -71,5 +72,9 @@ namespace AutoTurnOver.DB ...@@ -71,5 +72,9 @@ namespace AutoTurnOver.DB
} }
return result.Data; return result.Data;
} }
public static List<LmsShipLogisticsDto> RealTimeShipLogisticsCompanyList()
{
return RealTimeShipLogisticsList().GroupBy(s => new { s.Company_Code }).Select(s=>new LmsShipLogisticsDto { Company_Code = s.Key.Company_Code,Company_Name = s.Max(v=>v.Company_Name)}).ToList();
}
} }
} }
using AutoTurnOver.DB.Base; using AutoTurnOver.DB.Base;
using AutoTurnOver.Models; using AutoTurnOver.Models;
using AutoTurnOver.Models.Base; using AutoTurnOver.Models.Base;
using AutoTurnOver.Models.Report;
using Bailun.ServiceFabric.Core; using Bailun.ServiceFabric.Core;
using Dapper; using Dapper;
using System; using System;
...@@ -1701,5 +1702,79 @@ and start_date<=@end_date and end_date>=@start_date ...@@ -1701,5 +1702,79 @@ and start_date<=@end_date and end_date>=@start_date
} }
#endregion #endregion
#region 物流供应商账期
public static List<dc_report_logistics_company_config_dto> LogisticsCompanyConfigPage(dc_report_logistics_company_config_search_dto m, int offset, int limit, ref int total)
{
var list = new List<dc_report_logistics_company_config_dto>();
try
{
var sql = @"select t1.* from dc_report_logistics_company_config as t1 where 1 = 1 ";
if (!string.IsNullOrWhiteSpace(m.company_code))
{
sql += " and t1.company_code=" + $"'{m.company_code}'";
}
total = _connection.ExecuteScalar<int>("select count(0) from (" + sql + ") tb1");
var obj = _connection.Query<dc_report_logistics_company_config_dto>(sql + " limit " + offset + "," + limit);
return obj.AsList();
}
catch (Exception)
{
return list;
}
}
public static string SaveLogisticsCompanyConfig(dc_report_logistics_company_config m)
{
try
{
var companyList = ApiUtility.RealTimeShipLogisticsCompanyList();
if (string.IsNullOrWhiteSpace(m.company_code))
{
throw new Exception("请选择物流供应商");
}
var commData = companyList.SingleOrDefault(s => m.company_code.Equals(s.Company_Code));
if (commData == null)
{
throw new Exception("系统异常 供应商不存在");
}
m.company_name = commData.Company_Name;
if (m.id > 0)
{
var result = _connection.Update<dc_report_logistics_company_config>(m);
return result > 0 ? "" : "保存异常,请重试!";
}
else
{
var result = _connection.Insert<dc_report_logistics_company_config>(m);
return result.HasValue && result.Value > 0 ? "" : "提交异常,请重试!";
}
}
catch (Exception ex)
{
return ex.Message;
}
}
public static dc_report_logistics_company_config GetLogisticsCompanyConfigById(int id)
{
return _connection.QueryFirstOrDefault<dc_report_logistics_company_config>("select * from dc_report_logistics_company_config where id=" + id);
}
#endregion
} }
} }
...@@ -1791,8 +1791,8 @@ sum(case when occur_time>=@btime and data_type not in (2) then val else 0 end ) ...@@ -1791,8 +1791,8 @@ sum(case when occur_time>=@btime and data_type not in (2) then val else 0 end )
sum(case when occur_time<@btime and data_type in (2) then val else 0 end ) as 'last_income', sum(case when occur_time<@btime and data_type in (2) then val else 0 end ) as 'last_income',
sum(case when occur_time<@btime and data_type not in (2) then val else 0 end ) as 'last_expend', sum(case when occur_time<@btime and data_type not in (2) then val else 0 end ) as 'last_expend',
1 as 'type' 1 as 'type'
from dc_report_cash_flow_log where occur_time>='2020-06-01 00:00:00' and data_type in (2,3,5,8,9,10) from dc_report_cash_flow_log where occur_time>=@lastBtime and data_type in (2,3,5,8,9,10)
GROUP BY occur_time_year_month_no; GROUP BY bailun_sku;
insert dc_report_cash_flow_sku_group_temp(`bailun_sku`,`balance`,`current_date_begin`,`current_date_end`,`last_date_begin`,`last_date_end`,`current_income`,`current_expend`,`last_income`,`last_expend`,`type`) insert dc_report_cash_flow_sku_group_temp(`bailun_sku`,`balance`,`current_date_begin`,`current_date_end`,`last_date_begin`,`last_date_end`,`current_income`,`current_expend`,`last_income`,`last_expend`,`type`)
select select
...@@ -1808,7 +1808,7 @@ sum(case when pay_time<@btime and data_type in (2) then val else 0 end ) as 'las ...@@ -1808,7 +1808,7 @@ sum(case when pay_time<@btime and data_type in (2) then val else 0 end ) as 'las
sum(case when pay_time<@btime and data_type not in (2) then val else 0 end ) as 'last_expend', sum(case when pay_time<@btime and data_type not in (2) then val else 0 end ) as 'last_expend',
2 as 'type' 2 as 'type'
from dc_report_cash_flow_log where pay_time>=@lastBtime and data_type in (2,3,5,8,9,10) from dc_report_cash_flow_log where pay_time>=@lastBtime and data_type in (2,3,5,8,9,10)
GROUP BY occur_time_year_month_no; GROUP BY bailun_sku;
alter table dc_report_cash_flow_sku_group rename dc_report_cash_flow_sku_groupTemp; alter table dc_report_cash_flow_sku_group rename dc_report_cash_flow_sku_groupTemp;
......
...@@ -7,6 +7,8 @@ using AutoTurnOver.Models.ApiDto; ...@@ -7,6 +7,8 @@ using AutoTurnOver.Models.ApiDto;
using AutoTurnOver.Models.Report; using AutoTurnOver.Models.Report;
using Dapper; using Dapper;
using AutoTurnOver.Utility; using AutoTurnOver.Utility;
using AutoTurnOver.DB.Base;
using AutoTurnOver.Models.Base;
namespace AutoTurnOver.DB namespace AutoTurnOver.DB
{ {
...@@ -781,7 +783,7 @@ where t1.create_time>=@btime and t1.create_time<=@etime "; ...@@ -781,7 +783,7 @@ where t1.create_time>=@btime and t1.create_time<=@etime ";
{ {
List<report_cash_flow_view_dto> datas = new List<report_cash_flow_view_dto>(); List<report_cash_flow_view_dto> datas = new List<report_cash_flow_view_dto>();
datas.Add(new report_cash_flow_view_dto { date_type = new List<int> { 1}, date_type_str = "销售数量", remarks = "", dates = new List<report_cash_flow_view_dto.date_dto>() }); datas.Add(new report_cash_flow_view_dto { date_type = new List<int> { 1}, date_type_str = "销售数量", remarks = "", dates = new List<report_cash_flow_view_dto.date_dto>() });
datas.Add(new report_cash_flow_view_dto { date_type = new List<int> { 2}, date_type_str = "销售金额", remarks = "过滤掉刷单的订单", dates = new List<report_cash_flow_view_dto.date_dto>() }); datas.Add(new report_cash_flow_view_dto { date_type = new List<int> { 2}, date_type_str = "销售金额", remarks = "过滤掉刷单的订单 ", dates = new List<report_cash_flow_view_dto.date_dto>() });
datas.Add(new report_cash_flow_view_dto { date_type = new List<int> { 3 }, date_type_str = "退款", remarks = "crm 抓取的退款数据,未区分仓库", dates = new List<report_cash_flow_view_dto.date_dto>() }); datas.Add(new report_cash_flow_view_dto { date_type = new List<int> { 3 }, date_type_str = "退款", remarks = "crm 抓取的退款数据,未区分仓库", dates = new List<report_cash_flow_view_dto.date_dto>() });
datas.Add(new report_cash_flow_view_dto { date_type = new List<int> { 4 }, date_type_str = "利润", remarks = "oms 中的订单,分摊到sku的利润,不包含广告费,上架费,退款", dates = new List<report_cash_flow_view_dto.date_dto>() }); datas.Add(new report_cash_flow_view_dto { date_type = new List<int> { 4 }, date_type_str = "利润", remarks = "oms 中的订单,分摊到sku的利润,不包含广告费,上架费,退款", dates = new List<report_cash_flow_view_dto.date_dto>() });
datas.Add(new report_cash_flow_view_dto { date_type = new List<int> { 5 }, date_type_str = "平台费用", dates = new List<report_cash_flow_view_dto.date_dto>() }); datas.Add(new report_cash_flow_view_dto { date_type = new List<int> { 5 }, date_type_str = "平台费用", dates = new List<report_cash_flow_view_dto.date_dto>() });
...@@ -870,5 +872,18 @@ where t1.create_time>=@btime and t1.create_time<=@etime "; ...@@ -870,5 +872,18 @@ where t1.create_time>=@btime and t1.create_time<=@etime ";
} }
return _connection.Query<dc_report_cash_flow_log_dto>(sql, parameters).AsList(); return _connection.Query<dc_report_cash_flow_log_dto>(sql, parameters).AsList();
} }
public static Page<dc_report_cash_flow_sku_group_dto> SkuView(dc_report_cash_flow_sku_group_search_dto search)
{
var sql = " select * from dc_report_cash_flow_sku_group as t1 where 1=1 ";
DynamicParameters parameters = new DynamicParameters();
if (!string.IsNullOrWhiteSpace(search.bailun_sku))
{
sql += " and t1.bailun_sku=@bailun_sku ";
parameters.Add("bailun_sku",search.bailun_sku);
}
return _connection.Page<dc_report_cash_flow_sku_group_dto>(sql, search, parameters);
}
} }
} }
...@@ -21,6 +21,11 @@ namespace AutoTurnOver.Models.Report ...@@ -21,6 +21,11 @@ namespace AutoTurnOver.Models.Report
} } } }
} }
public class dc_report_logistics_company_config_search_dto
{
public string company_code { get; set; }
}
/// <summary> /// <summary>
/// 1 = 周结 2= 月结 3 = 半结 4 = 预付 5=固定天数 6 = 现结 /// 1 = 周结 2= 月结 3 = 半结 4 = 预付 5=固定天数 6 = 现结
/// </summary> /// </summary>
......
using System; using AutoTurnOver.Models.Base;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
...@@ -129,6 +130,10 @@ namespace AutoTurnOver.Models ...@@ -129,6 +130,10 @@ namespace AutoTurnOver.Models
public int settlement_val { get; set; } public int settlement_val { get; set; }
} }
public class dc_report_cash_flow_config_search_dto
{
public string data_type { get; set; }
}
public class dc_report_cash_flow_config_dto: dc_report_cash_flow_config public class dc_report_cash_flow_config_dto: dc_report_cash_flow_config
{ {
public string data_type_str { get { public string data_type_str { get {
...@@ -141,10 +146,6 @@ namespace AutoTurnOver.Models ...@@ -141,10 +146,6 @@ namespace AutoTurnOver.Models
} }
public class dc_report_cash_flow_config_search_dto
{
public string data_type { get; set; }
}
public class report_cash_flow_view_dto public class report_cash_flow_view_dto
{ {
...@@ -180,4 +181,29 @@ namespace AutoTurnOver.Models ...@@ -180,4 +181,29 @@ namespace AutoTurnOver.Models
/// </summary> /// </summary>
public int? type { get; set; } public int? type { get; set; }
} }
public class dc_report_cash_flow_sku_group
{
public int id { get; set; }
public string bailun_sku { get; set; }
public decimal balance { get; set; }
public DateTime current_date_begin { get; set; }
public DateTime current_date_end { get; set; }
public DateTime last_date_begin { get; set; }
public DateTime last_date_end { get; set; }
public decimal current_income { get; set; }
public decimal current_expend { get; set; }
public decimal last_income { get; set; }
public decimal last_expend { get; set; }
public decimal type { get; set; }
}
public class dc_report_cash_flow_sku_group_dto: dc_report_cash_flow_sku_group
{
}
public class dc_report_cash_flow_sku_group_search_dto: page_search_dto
{
public string bailun_sku { get; set; }
}
} }
using AutoTurnOver.DB; using AutoTurnOver.DB;
using AutoTurnOver.Models; using AutoTurnOver.Models;
using AutoTurnOver.Models.Base;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Dynamic; using System.Dynamic;
...@@ -52,5 +53,10 @@ namespace AutoTurnOver.Services ...@@ -52,5 +53,10 @@ namespace AutoTurnOver.Services
{ {
return report_cash_flow_dao.Export(search); return report_cash_flow_dao.Export(search);
} }
public Page<dc_report_cash_flow_sku_group_dto> SkuView(dc_report_cash_flow_sku_group_search_dto search)
{
return report_cash_flow_dao.SkuView(search);
}
} }
} }
...@@ -33,7 +33,7 @@ namespace AutoTurnOver.Controllers ...@@ -33,7 +33,7 @@ namespace AutoTurnOver.Controllers
}); });
} }
public FileResult Export(DateTime? btime, DateTime? etime, string data_type = null,int? type = null) public FileResult Export(DateTime? btime, DateTime? etime, string data_type = null,int? type = null)
{ {
var m = new dc_report_cash_flow_log_export_search_dto var m = new dc_report_cash_flow_log_export_search_dto
{ {
...@@ -85,5 +85,36 @@ namespace AutoTurnOver.Controllers ...@@ -85,5 +85,36 @@ namespace AutoTurnOver.Controllers
memory.Position = 0; memory.Position = 0;
return File(memory, "text/csv", "现金流明细.csv"); return File(memory, "text/csv", "现金流明细.csv");
} }
public JsonResult GetSkuView(string bailun_sku, int offset, int limit, string order, string sort)
{
try
{
var m = new dc_report_cash_flow_sku_group_search_dto
{
bailun_sku = bailun_sku,
page = (offset / limit) + 1,
rows = limit,
sidx = sort,
sord = order,
};
var services = new CashFlowServices();
var page_data = services.SkuView(m);
return new JsonResult(new
{
rows = page_data.Items,
total = page_data.TotalItems
});
}
catch (Exception ex)
{
return new JsonResult(new
{
message = ex.Message,
stack_trace = ex.StackTrace
});
}
}
} }
} }
\ No newline at end of file
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