Commit 68540e0a by 泽锋 李

 sku这里加两个字段,本月结余和上月结余,就是正负相加,并且现金流字段放在前面

每个sku现金流计算过程怎么弹出的是补货的dashboard (加一个加号的图标,用于查看现金流详情,点击sku,去到aims页面)
另外aims可能有个bug(周转页面)
点击数字查看计算明细
周付的改成下周五付(这个需要晚上重新跑一遍流水才能看到最新数据)
parent 28a8fc54
...@@ -78,7 +78,7 @@ namespace AutoTurnOver.DB ...@@ -78,7 +78,7 @@ namespace AutoTurnOver.DB
web_site = order_item.website web_site = order_item.website
}; };
item5.occur_time_year_month_no = $"{item5.occur_time.Year}-{item5.occur_time.Month}-{item5.data_type}-{item5.platform_type}-{item5.web_site}"; item5.occur_time_year_month_no = $"{item5.occur_time.Year}-{item5.occur_time.Month}-{item5.data_type}-{item5.platform_type}-{item5.web_site}";
item5.pay_time = CalculationPayTime(configs, item5.occur_time, item5.data_type, item5.platform_type,item5.web_site); item5.pay_time = CalculationPayTime(configs, item5.occur_time, item5.data_type, item5.platform_type, item5.web_site);
item5.pay_time_year_month_no = $"{item5.pay_time.Year}-{item5.pay_time.Month}-{item5.data_type}-{item5.platform_type}-{item5.web_site}"; item5.pay_time_year_month_no = $"{item5.pay_time.Year}-{item5.pay_time.Month}-{item5.data_type}-{item5.platform_type}-{item5.web_site}";
item5.id = conn.QuerySingleOrDefault<int?>(" select id from dc_report_cash_flow_log where data_type=@data_type and bailun_sku=@bailun_sku and item_no=@item_no ", new item5.id = conn.QuerySingleOrDefault<int?>(" select id from dc_report_cash_flow_log where data_type=@data_type and bailun_sku=@bailun_sku and item_no=@item_no ", new
{ {
...@@ -160,7 +160,7 @@ namespace AutoTurnOver.DB ...@@ -160,7 +160,7 @@ namespace AutoTurnOver.DB
web_site = order_item.website web_site = order_item.website
}; };
item7.occur_time_year_month_no = $"{item7.occur_time.Year}-{item7.occur_time.Month}-{item7.data_type}-{item7.platform_type}-{item7.web_site}"; item7.occur_time_year_month_no = $"{item7.occur_time.Year}-{item7.occur_time.Month}-{item7.data_type}-{item7.platform_type}-{item7.web_site}";
item7.pay_time = CalculationPayTime(configs, item7.occur_time, item7.data_type, item7.platform_type,item7.web_site); item7.pay_time = CalculationPayTime(configs, item7.occur_time, item7.data_type, item7.platform_type, item7.web_site);
item7.pay_time_year_month_no = $"{item7.pay_time.Year}-{item7.pay_time.Month}-{item7.data_type}-{item7.platform_type}-{item7.web_site}"; item7.pay_time_year_month_no = $"{item7.pay_time.Year}-{item7.pay_time.Month}-{item7.data_type}-{item7.platform_type}-{item7.web_site}";
item7.id = conn.QuerySingleOrDefault<int?>(" select id from dc_report_cash_flow_log where data_type=@data_type and bailun_sku=@bailun_sku and item_no=@item_no ", new item7.id = conn.QuerySingleOrDefault<int?>(" select id from dc_report_cash_flow_log where data_type=@data_type and bailun_sku=@bailun_sku and item_no=@item_no ", new
{ {
...@@ -201,7 +201,7 @@ namespace AutoTurnOver.DB ...@@ -201,7 +201,7 @@ namespace AutoTurnOver.DB
web_site = order_item.website web_site = order_item.website
}; };
item6.occur_time_year_month_no = $"{item6.occur_time.Year}-{item6.occur_time.Month}-{item6.data_type}-{item6.platform_type}-{item6.web_site}"; item6.occur_time_year_month_no = $"{item6.occur_time.Year}-{item6.occur_time.Month}-{item6.data_type}-{item6.platform_type}-{item6.web_site}";
item6.pay_time = CalculationPayTime(configs, item6.occur_time, item6.data_type, item6.platform_type,item6.web_site); item6.pay_time = CalculationPayTime(configs, item6.occur_time, item6.data_type, item6.platform_type, item6.web_site);
item6.pay_time_year_month_no = $"{item6.pay_time.Year}-{item6.pay_time.Month}-{item6.data_type}-{item6.platform_type}-{item6.web_site}"; item6.pay_time_year_month_no = $"{item6.pay_time.Year}-{item6.pay_time.Month}-{item6.data_type}-{item6.platform_type}-{item6.web_site}";
item6.id = conn.QuerySingleOrDefault<int?>(" select id from dc_report_cash_flow_log where data_type=@data_type and bailun_sku=@bailun_sku and item_no=@item_no ", new item6.id = conn.QuerySingleOrDefault<int?>(" select id from dc_report_cash_flow_log where data_type=@data_type and bailun_sku=@bailun_sku and item_no=@item_no ", new
{ {
...@@ -242,7 +242,7 @@ namespace AutoTurnOver.DB ...@@ -242,7 +242,7 @@ namespace AutoTurnOver.DB
web_site = order_item.website web_site = order_item.website
}; };
item3.occur_time_year_month_no = $"{item3.occur_time.Year}-{item3.occur_time.Month}-{item3.data_type}-{item3.platform_type}-{item3.web_site}"; item3.occur_time_year_month_no = $"{item3.occur_time.Year}-{item3.occur_time.Month}-{item3.data_type}-{item3.platform_type}-{item3.web_site}";
item3.pay_time = CalculationPayTime(configs, item3.occur_time, item3.data_type, item3.platform_type,item3.web_site); item3.pay_time = CalculationPayTime(configs, item3.occur_time, item3.data_type, item3.platform_type, item3.web_site);
item3.pay_time_year_month_no = $"{item3.pay_time.Year}-{item3.pay_time.Month}-{item3.data_type}-{item3.platform_type}-{item3.web_site}"; item3.pay_time_year_month_no = $"{item3.pay_time.Year}-{item3.pay_time.Month}-{item3.data_type}-{item3.platform_type}-{item3.web_site}";
item3.id = conn.QuerySingleOrDefault<int?>(" select id from dc_report_cash_flow_log where data_type=@data_type and bailun_sku=@bailun_sku and item_no=@item_no ", new item3.id = conn.QuerySingleOrDefault<int?>(" select id from dc_report_cash_flow_log where data_type=@data_type and bailun_sku=@bailun_sku and item_no=@item_no ", new
{ {
...@@ -283,7 +283,7 @@ namespace AutoTurnOver.DB ...@@ -283,7 +283,7 @@ namespace AutoTurnOver.DB
web_site = order_item.website web_site = order_item.website
}; };
item2.occur_time_year_month_no = $"{item2.occur_time.Year}-{item2.occur_time.Month}-{item2.data_type}-{item2.platform_type}-{item2.web_site}"; item2.occur_time_year_month_no = $"{item2.occur_time.Year}-{item2.occur_time.Month}-{item2.data_type}-{item2.platform_type}-{item2.web_site}";
item2.pay_time = CalculationPayTime(configs, item2.occur_time, item2.data_type, item2.platform_type,item2.web_site); item2.pay_time = CalculationPayTime(configs, item2.occur_time, item2.data_type, item2.platform_type, item2.web_site);
item2.pay_time_year_month_no = $"{item2.pay_time.Year}-{item2.pay_time.Month}-{item2.data_type}-{item2.platform_type}-{item2.web_site}"; item2.pay_time_year_month_no = $"{item2.pay_time.Year}-{item2.pay_time.Month}-{item2.data_type}-{item2.platform_type}-{item2.web_site}";
item2.id = conn.QuerySingleOrDefault<int?>(" select id from dc_report_cash_flow_log where data_type=@data_type and bailun_sku=@bailun_sku and item_no=@item_no ", new item2.id = conn.QuerySingleOrDefault<int?>(" select id from dc_report_cash_flow_log where data_type=@data_type and bailun_sku=@bailun_sku and item_no=@item_no ", new
{ {
...@@ -324,7 +324,7 @@ namespace AutoTurnOver.DB ...@@ -324,7 +324,7 @@ namespace AutoTurnOver.DB
web_site = order_item.website web_site = order_item.website
}; };
item1.occur_time_year_month_no = $"{item1.occur_time.Year}-{item1.occur_time.Month}-{item1.data_type}-{item1.platform_type}-{item1.web_site}"; item1.occur_time_year_month_no = $"{item1.occur_time.Year}-{item1.occur_time.Month}-{item1.data_type}-{item1.platform_type}-{item1.web_site}";
item1.pay_time = CalculationPayTime(configs, item1.occur_time, item1.data_type, item1.platform_type,item1.web_site); item1.pay_time = CalculationPayTime(configs, item1.occur_time, item1.data_type, item1.platform_type, item1.web_site);
item1.pay_time_year_month_no = $"{item1.pay_time.Year}-{item1.pay_time.Month}-{item1.data_type}-{item1.platform_type}-{item1.web_site}"; item1.pay_time_year_month_no = $"{item1.pay_time.Year}-{item1.pay_time.Month}-{item1.data_type}-{item1.platform_type}-{item1.web_site}";
item1.id = conn.QuerySingleOrDefault<int?>(" select id from dc_report_cash_flow_log where data_type=@data_type and bailun_sku=@bailun_sku and item_no=@item_no ", new item1.id = conn.QuerySingleOrDefault<int?>(" select id from dc_report_cash_flow_log where data_type=@data_type and bailun_sku=@bailun_sku and item_no=@item_no ", new
{ {
...@@ -365,7 +365,7 @@ namespace AutoTurnOver.DB ...@@ -365,7 +365,7 @@ namespace AutoTurnOver.DB
web_site = order_item.website web_site = order_item.website
}; };
item.occur_time_year_month_no = $"{item.occur_time.Year}-{item.occur_time.Month}-{item.data_type}-{item.platform_type}-{item.web_site}"; item.occur_time_year_month_no = $"{item.occur_time.Year}-{item.occur_time.Month}-{item.data_type}-{item.platform_type}-{item.web_site}";
item.pay_time = CalculationPayTime(configs, item.occur_time, item.data_type, item.platform_type,item.web_site); item.pay_time = CalculationPayTime(configs, item.occur_time, item.data_type, item.platform_type, item.web_site);
item.pay_time_year_month_no = $"{item.pay_time.Year}-{item.pay_time.Month}-{item.data_type}-{item.platform_type}-{item.web_site}"; item.pay_time_year_month_no = $"{item.pay_time.Year}-{item.pay_time.Month}-{item.data_type}-{item.platform_type}-{item.web_site}";
item.id = conn.QuerySingleOrDefault<int?>(" select id from dc_report_cash_flow_log where data_type=@data_type and bailun_sku=@bailun_sku and item_no=@item_no ", new item.id = conn.QuerySingleOrDefault<int?>(" select id from dc_report_cash_flow_log where data_type=@data_type and bailun_sku=@bailun_sku and item_no=@item_no ", new
{ {
...@@ -394,10 +394,10 @@ namespace AutoTurnOver.DB ...@@ -394,10 +394,10 @@ namespace AutoTurnOver.DB
} }
Console.WriteLine($" 开始写入第 {page} 页数据 , 预计 写入 {addList.Count} 条 , 更新 {updateList.Count} 条, 最大id {updateList.Max(s=>s.item_no)}, 最小id {updateList.Min(s => s.item_no)} "); Console.WriteLine($" 开始写入第 {page} 页数据 , 预计 写入 {addList.Count} 条 , 更新 {updateList.Count} 条, 最大id {updateList.Max(s => s.item_no)}, 最小id {updateList.Min(s => s.item_no)} ");
if (addList != null && addList.Count >= 1) if (addList != null && addList.Count >= 1)
{ {
BatchInsertDatas(conn,addList); BatchInsertDatas(conn, addList);
} }
if (updateList != null && updateList.Count >= 1) if (updateList != null && updateList.Count >= 1)
{ {
...@@ -434,7 +434,7 @@ namespace AutoTurnOver.DB ...@@ -434,7 +434,7 @@ namespace AutoTurnOver.DB
sqlSb.Append($"('{item.web_site}','{item.warehouse_code}','{item.platform_type}','{item.bailun_sku}',{item.data_type},{item.pay_type},{item.val},'{item.occur_time.ToString("yyyy-MM-dd HH:mm:ss")}','{item.pay_time.ToString("yyyy-MM-dd HH:mm:ss")}','{item.no}','{item.item}','{item.item_no}','{item.remarks}',{(item.is_delete)},'{item.update_time.ToString("yyyy-MM-dd HH:mm:ss")}','{item.occur_time_year_month_no}','{item.pay_time_year_month_no}' ),"); sqlSb.Append($"('{item.web_site}','{item.warehouse_code}','{item.platform_type}','{item.bailun_sku}',{item.data_type},{item.pay_type},{item.val},'{item.occur_time.ToString("yyyy-MM-dd HH:mm:ss")}','{item.pay_time.ToString("yyyy-MM-dd HH:mm:ss")}','{item.no}','{item.item}','{item.item_no}','{item.remarks}',{(item.is_delete)},'{item.update_time.ToString("yyyy-MM-dd HH:mm:ss")}','{item.occur_time_year_month_no}','{item.pay_time_year_month_no}' ),");
} }
var sql = sqlSb.ToString(); var sql = sqlSb.ToString();
sql = sql.Substring(0, sql.Length-1); sql = sql.Substring(0, sql.Length - 1);
var res = conn.Execute(sql.ToString()); var res = conn.Execute(sql.ToString());
Console.WriteLine($" 新增 {datas.Count} 条数据,耗时 {watch.ElapsedMilliseconds} 毫秒 "); Console.WriteLine($" 新增 {datas.Count} 条数据,耗时 {watch.ElapsedMilliseconds} 毫秒 ");
} }
...@@ -582,7 +582,8 @@ namespace AutoTurnOver.DB ...@@ -582,7 +582,8 @@ namespace AutoTurnOver.DB
{ {
sql += " and t1.purchase_id=@purchase_id "; sql += " and t1.purchase_id=@purchase_id ";
parameters.Add("purchase_id", purchase_id); parameters.Add("purchase_id", purchase_id);
}if (!string.IsNullOrWhiteSpace(bailun_sku)) }
if (!string.IsNullOrWhiteSpace(bailun_sku))
{ {
sql += " and t1.bailun_sku=@bailun_sku "; sql += " and t1.bailun_sku=@bailun_sku ";
parameters.Add("bailun_sku", bailun_sku); parameters.Add("bailun_sku", bailun_sku);
...@@ -600,11 +601,12 @@ namespace AutoTurnOver.DB ...@@ -600,11 +601,12 @@ namespace AutoTurnOver.DB
{ {
var occur_time = order_item.create_time ?? new DateTime(1991, 1, 1); var occur_time = order_item.create_time ?? new DateTime(1991, 1, 1);
var warehouse_code = order_item.isallot == 1 ? order_item.warehouse_into_code : order_item.warehouse_from_code; var warehouse_code = order_item.isallot == 1 ? order_item.warehouse_into_code : order_item.warehouse_from_code;
var platforms = GetPlatformShare(occur_time, conn, inventoryConfigs, warehouse_code,order_item.bailun_sku); var platforms = GetPlatformShare(occur_time, conn, inventoryConfigs, warehouse_code, order_item.bailun_sku);
if(platforms!=null && platforms.Count >= 1) if (platforms != null && platforms.Count >= 1)
{ {
// 把原本未挂载平台的数据删除 // 把原本未挂载平台的数据删除
conn.Execute(" delete from dc_report_cash_flow_log where data_type=@data_type and bailun_sku=@bailun_sku and `no`=@purchase_id and platform_type='' ", new { conn.Execute(" delete from dc_report_cash_flow_log where data_type=@data_type and bailun_sku=@bailun_sku and `no`=@purchase_id and platform_type='' ", new
{
bailun_sku = order_item.bailun_sku, bailun_sku = order_item.bailun_sku,
purchase_id = order_item.purchase_id, purchase_id = order_item.purchase_id,
data_type = (int)dc_report_cash_flow_log_data_type_enum.新增采购费用 data_type = (int)dc_report_cash_flow_log_data_type_enum.新增采购费用
...@@ -674,7 +676,7 @@ namespace AutoTurnOver.DB ...@@ -674,7 +676,7 @@ namespace AutoTurnOver.DB
platform_type = "", platform_type = "",
web_site = "", web_site = "",
remarks = $" 最新30天无订单,暂时不挂载平台 ", remarks = $" 最新30天无订单,暂时不挂载平台 ",
val = 0 - (Math.Abs(order_item.amount_paid) ), val = 0 - (Math.Abs(order_item.amount_paid)),
occur_time = order_item.create_time ?? new DateTime(1991, 1, 1), occur_time = order_item.create_time ?? new DateTime(1991, 1, 1),
warehouse_code = warehouse_code, warehouse_code = warehouse_code,
pay_type = (int)dc_report_cash_flow_log_pay_type_enum.后付, pay_type = (int)dc_report_cash_flow_log_pay_type_enum.后付,
...@@ -857,7 +859,7 @@ where t1.create_time>=@btime and t1.create_time<=@etime "; ...@@ -857,7 +859,7 @@ where t1.create_time>=@btime and t1.create_time<=@etime ";
{ {
var occur_time = order_item.create_time; var occur_time = order_item.create_time;
var platforms = GetPlatformShare(occur_time, conn, inventoryConfigs, order_item.warehouse_code, order_item.bailun_sku); var platforms = GetPlatformShare(occur_time, conn, inventoryConfigs, order_item.warehouse_code, order_item.bailun_sku);
if(platforms!=null && platforms.Count >= 1) if (platforms != null && platforms.Count >= 1)
{ {
// 把原本未挂载平台的数据删除 // 把原本未挂载平台的数据删除
conn.Execute(" delete from dc_report_cash_flow_log where data_type=@data_type and bailun_sku=@bailun_sku and `no`=@transfer_order_id and platform_type='' ", new conn.Execute(" delete from dc_report_cash_flow_log where data_type=@data_type and bailun_sku=@bailun_sku and `no`=@transfer_order_id and platform_type='' ", new
...@@ -976,12 +978,12 @@ where t1.create_time>=@btime and t1.create_time<=@etime "; ...@@ -976,12 +978,12 @@ where t1.create_time>=@btime and t1.create_time<=@etime ";
/// <summary> /// <summary>
/// 计算支付时间 /// 计算支付时间
/// </summary> /// </summary>
public static DateTime CalculationPayTime(List<dc_report_cash_flow_config> configs, DateTime occur_time, int data_type, string platform_type,string web_stite) public static DateTime CalculationPayTime(List<dc_report_cash_flow_config> configs, DateTime occur_time, int data_type, string platform_type, string web_stite)
{ {
var item_config = configs.Where(s => s.data_type == data_type var item_config = configs.Where(s => s.data_type == data_type
&& (s.platform_type == "" || s.platform_type.Equals(platform_type)) && (s.platform_type == "" || s.platform_type.Equals(platform_type))
&& (s.web_stite == "" || s.web_stite.Equals(web_stite)) && (s.web_stite == "" || s.web_stite.Equals(web_stite))
).OrderByDescending(s=>s.web_stite).FirstOrDefault(); ).OrderByDescending(s => s.web_stite).FirstOrDefault();
if (item_config == null) if (item_config == null)
{ {
return occur_time; return occur_time;
...@@ -1110,7 +1112,7 @@ GROUP BY platform_type,website"; ...@@ -1110,7 +1112,7 @@ GROUP BY platform_type,website";
ctime = occurDate.ToDayEnd(), ctime = occurDate.ToDayEnd(),
bailun_sku = bailun_sku, bailun_sku = bailun_sku,
warehouse_code = warehouse_code warehouse_code = warehouse_code
},commandTimeout:0).ToList(); }, commandTimeout: 0).ToList();
if (datas == null || datas.Count <= 0) if (datas == null || datas.Count <= 0)
{ {
...@@ -1182,20 +1184,20 @@ GROUP BY platform_type,website"; ...@@ -1182,20 +1184,20 @@ GROUP BY platform_type,website";
occur_sql = " select occur_time as 'date',sum(val) as 'val',data_type,1 as 'type',platform_type,web_site from dc_report_cash_flow_log where is_delete=0 and occur_time >=@btime and occur_time<=@etime and bailun_sku=@bailun_sku and warehouse_code = @warehouse_code "; occur_sql = " select occur_time as 'date',sum(val) as 'val',data_type,1 as 'type',platform_type,web_site from dc_report_cash_flow_log where is_delete=0 and occur_time >=@btime and occur_time<=@etime and bailun_sku=@bailun_sku and warehouse_code = @warehouse_code ";
pay_sql = " select pay_time as 'date',sum(val) as 'val',data_type,1 as 'type',platform_type,web_site from dc_report_cash_flow_log where is_delete=0 and pay_time >=@btime and pay_time<=@etime and bailun_sku=@bailun_sku and warehouse_code = @warehouse_code "; pay_sql = " select pay_time as 'date',sum(val) as 'val',data_type,1 as 'type',platform_type,web_site from dc_report_cash_flow_log where is_delete=0 and pay_time >=@btime and pay_time<=@etime and bailun_sku=@bailun_sku and warehouse_code = @warehouse_code ";
parameters.Add("bailun_sku",search.bailun_sku); parameters.Add("bailun_sku", search.bailun_sku);
parameters.Add("warehouse_code", search.warehouse_code); parameters.Add("warehouse_code", search.warehouse_code);
} }
parameters.Add("btime", btime); parameters.Add("btime", btime);
parameters.Add("etime", etime); parameters.Add("etime", etime);
if(!string.IsNullOrWhiteSpace(search.platform_type)) if (!string.IsNullOrWhiteSpace(search.platform_type))
{ {
if ("fba".Equals(search.platform_type,StringComparison.OrdinalIgnoreCase) || "amazon".Equals(search.platform_type, StringComparison.OrdinalIgnoreCase)) if ("fba".Equals(search.platform_type, StringComparison.OrdinalIgnoreCase) || "amazon".Equals(search.platform_type, StringComparison.OrdinalIgnoreCase))
{ {
occur_sql += " and platform_type in @platform_types "; occur_sql += " and platform_type in @platform_types ";
pay_sql += " and platform_type in @platform_types "; pay_sql += " and platform_type in @platform_types ";
parameters.Add("platform_types", new List<string> { "amazon","fba"}); parameters.Add("platform_types", new List<string> { "amazon", "fba" });
} }
else else
{ {
...@@ -1206,7 +1208,7 @@ GROUP BY platform_type,website"; ...@@ -1206,7 +1208,7 @@ GROUP BY platform_type,website";
} }
if(!string.IsNullOrWhiteSpace(search.web_site)) if (!string.IsNullOrWhiteSpace(search.web_site))
{ {
occur_sql += " and web_site=@web_site "; occur_sql += " and web_site=@web_site ";
pay_sql += " and web_site=@web_site "; pay_sql += " and web_site=@web_site ";
...@@ -1298,7 +1300,73 @@ GROUP BY platform_type,website"; ...@@ -1298,7 +1300,73 @@ GROUP BY platform_type,website";
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_log_dto> LogPage(dc_report_cash_flow_log_export_page_search_dto search)
{
if (search.btime == null || search.etime == null)
{
throw new Exception("时间范围必选");
}
if (search.type == null)
{
throw new Exception("时间类型必选");
}
var sql = $" select t1.*,t2.warehouse_name ,{search.type ?? 2} as 'type' from dc_report_cash_flow_log as t1 left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code where t1.is_delete=0 and `val`!=0 ";
if (search.issum)
{
sql = $" select sum(`val`) as 'val' from dc_report_cash_flow_log as t1 where t1.is_delete=0 and `val`!=0 ";
}
DynamicParameters parameters = new DynamicParameters();
if (search.type == 1)
{
sql += " and t1.occur_time>=@btime ";
sql += " and t1.occur_time<=@etime ";
}
else
{
sql += " and t1.pay_time>=@btime ";
sql += " and t1.pay_time<=@etime ";
}
parameters.Add("btime", search.btime.Value.ToDayHome());
parameters.Add("etime", search.etime.Value.ToDayEnd());
if (search.web_site != null)
{
sql += " and t1.web_site = @web_site ";
parameters.Add("web_site", search.web_site);
}
if (!string.IsNullOrWhiteSpace(search.warehouse_code))
{
sql += " and t1.warehouse_code = @warehouse_code ";
parameters.Add("warehouse_code", search.warehouse_code);
}
if (!string.IsNullOrWhiteSpace(search.platform_type))
{
sql += " and t1.platform_type = @platform_type ";
parameters.Add("platform_type", search.platform_type);
}
if (!string.IsNullOrWhiteSpace(search.bailun_sku))
{
sql += " and t1.bailun_sku = @bailun_sku ";
parameters.Add("bailun_sku", search.bailun_sku);
}
if (search.data_type != null && search.data_type.Count >= 0)
{
sql += " and t1.data_type in @data_type ";
parameters.Add("data_type", search.data_type);
}
if (search.issum)
{
return new Page<dc_report_cash_flow_log_dto>()
{
Items = new List<dc_report_cash_flow_log_dto> { _connection.QuerySingleOrDefault<dc_report_cash_flow_log_dto>(sql, parameters) }
};
}
else
{
return _connection.Page<dc_report_cash_flow_log_dto>(sql, search, parameters);
}
}
public static Page<dc_report_cash_flow_sku_group_dto> SkuView(dc_report_cash_flow_sku_group_search_dto search) public static Page<dc_report_cash_flow_sku_group_dto> SkuView(dc_report_cash_flow_sku_group_search_dto search)
{ {
......
...@@ -78,8 +78,21 @@ namespace AutoTurnOver.Models ...@@ -78,8 +78,21 @@ namespace AutoTurnOver.Models
return ((dc_report_cash_flow_log_data_type_enum)data_type).ToString(); return ((dc_report_cash_flow_log_data_type_enum)data_type).ToString();
} }
} }
public string pay_type_str
{
get
{
return ((dc_report_cash_flow_log_pay_type_enum)pay_type).ToString();
}
}
public string warehouse_name { get; set; } public string warehouse_name { get; set; }
public int type { get; set; }
public DateTime show_time { get
{
if (type == 1) return occur_time;
else return pay_time;
} }
} }
/// <summary> /// <summary>
...@@ -203,6 +216,26 @@ namespace AutoTurnOver.Models ...@@ -203,6 +216,26 @@ namespace AutoTurnOver.Models
/// </summary> /// </summary>
public int? type { get; set; } public int? type { get; set; }
public string bailun_sku { get; set; } public string bailun_sku { get; set; }
public string warehouse_code { get; set; }
public string platform_type { get; set; }
public string web_site { get; set; }
}
public class dc_report_cash_flow_log_export_page_search_dto: page_search_dto
{
public DateTime? btime { get; set; }
public bool issum { get; set; }
public DateTime? etime { get; set; }
public List<int> data_type { get; set; }
/// <summary>
/// 1 = 根据发生时间查询
/// 2 = 根据支付时间查询
/// </summary>
public int? type { get; set; }
public string bailun_sku { get; set; }
public string warehouse_code { get; set; }
public string platform_type { get; set; }
public string web_site { get; set; }
} }
public class dc_report_cash_flow_sku_group public class dc_report_cash_flow_sku_group
...@@ -211,6 +244,8 @@ namespace AutoTurnOver.Models ...@@ -211,6 +244,8 @@ namespace AutoTurnOver.Models
public string bailun_sku { get; set; } public string bailun_sku { get; set; }
public string warehouse_code { get; set; } public string warehouse_code { get; set; }
public decimal balance { get; set; } public decimal balance { get; set; }
public decimal last_balance { get; set; }
public decimal current_balance { get; set; }
public DateTime current_date_begin { get; set; } public DateTime current_date_begin { get; set; }
public DateTime current_date_end { get; set; } public DateTime current_date_end { get; set; }
public DateTime last_date_begin { get; set; } public DateTime last_date_begin { get; set; }
......
...@@ -54,6 +54,11 @@ namespace AutoTurnOver.Services ...@@ -54,6 +54,11 @@ namespace AutoTurnOver.Services
return report_cash_flow_dao.Export(search); return report_cash_flow_dao.Export(search);
} }
public Page<dc_report_cash_flow_log_dto> LogPage(dc_report_cash_flow_log_export_page_search_dto search)
{
return report_cash_flow_dao.LogPage(search);
}
public Page<dc_report_cash_flow_sku_group_dto> SkuView(dc_report_cash_flow_sku_group_search_dto 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); return report_cash_flow_dao.SkuView(search);
......
...@@ -18,7 +18,7 @@ namespace AutoTurnOver.Controllers ...@@ -18,7 +18,7 @@ namespace AutoTurnOver.Controllers
[ApiController] [ApiController]
public class CashFlowController : ControllerBase public class CashFlowController : ControllerBase
{ {
public JsonResult GetView(DateTime? btime, DateTime? etime,string platform_type,string web_site,string bailun_sku, string warehouse_code) public JsonResult GetView(DateTime? btime, DateTime? etime, string platform_type, string web_site, string bailun_sku, string warehouse_code)
{ {
report_cash_flow_view_search_dto search_data = new report_cash_flow_view_search_dto report_cash_flow_view_search_dto search_data = new report_cash_flow_view_search_dto
{ {
...@@ -38,11 +38,11 @@ namespace AutoTurnOver.Controllers ...@@ -38,11 +38,11 @@ namespace AutoTurnOver.Controllers
}); });
} }
public FileResult Export(DateTime? btime, DateTime? etime,string bailun_sku, string data_type = null,int? type = null) public FileResult Export(DateTime? btime, DateTime? etime, string bailun_sku, 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
{ {
data_type = string.IsNullOrWhiteSpace(data_type) ?new List<int> { } : data_type.Split(',').Select(s=>int.Parse(s)).ToList(), data_type = string.IsNullOrWhiteSpace(data_type) ? new List<int> { } : data_type.Split(',').Select(s => int.Parse(s)).ToList(),
btime = btime, btime = btime,
etime = etime, etime = etime,
type = type, type = type,
...@@ -104,12 +104,12 @@ namespace AutoTurnOver.Controllers ...@@ -104,12 +104,12 @@ namespace AutoTurnOver.Controllers
sidx = sort, sidx = sort,
sord = order, sord = order,
buyer_name = buyer_name, buyer_name = buyer_name,
sku_label = string.IsNullOrWhiteSpace( sku_label)?null : WebUtility.UrlDecode(sku_label), sku_label = string.IsNullOrWhiteSpace(sku_label) ? null : WebUtility.UrlDecode(sku_label),
data_type = data_type, data_type = data_type,
supplier_name = supplier_name, supplier_name = supplier_name,
product_type = product_type, product_type = product_type,
warehouse_code = warehousecode, warehouse_code = warehousecode,
monitor_status =monitor_status, monitor_status = monitor_status,
warehousearea = warehousearea, warehousearea = warehousearea,
warehousetype = warehousetype warehousetype = warehousetype
}; };
...@@ -131,5 +131,73 @@ namespace AutoTurnOver.Controllers ...@@ -131,5 +131,73 @@ namespace AutoTurnOver.Controllers
} }
} }
[HttpGet]
public JsonResult LogPage(int limit, int offset, string order, string sort, DateTime? btime, DateTime? etime, string bailun_sku, string data_type = null, int? type = null, string platform_type = null, string warehouse_code = null, string web_site = "")
{
try
{
var m = new dc_report_cash_flow_log_export_page_search_dto
{
data_type = string.IsNullOrWhiteSpace(data_type) ? new List<int> { } : data_type.Split(',').Select(s => int.Parse(s)).ToList(),
btime = btime,
etime = etime,
type = type,
bailun_sku = bailun_sku,
page = (offset / limit) + 1,
rows = limit,
platform_type = platform_type,
issum = false,
sord = order,
sidx = sort,
warehouse_code = warehouse_code,
web_site = web_site
};
var service = new Services.CashFlowServices();
var list = service.LogPage(m);
var total = list.TotalItems;
return new JsonResult(new
{
rows = list.Items,
total = total,
pagecount = list.TotalPages
});
}
catch (Exception ex)
{
return new JsonResult(new
{
message = ex.Message,
stack_trace = ex.StackTrace
});
}
}
public JsonResult LogPageSumFooter(DateTime? btime, DateTime? etime, string bailun_sku, string data_type = null, int? type = null, string platform_type = null, string warehouse_code = null, string web_site = "")
{
var m = new dc_report_cash_flow_log_export_page_search_dto
{
data_type = string.IsNullOrWhiteSpace(data_type) ? new List<int> { } : data_type.Split(',').Select(s => int.Parse(s)).ToList(),
btime = btime,
etime = etime,
type = type,
bailun_sku = bailun_sku,
page =1,
rows = 1,
platform_type = platform_type,
issum = true,
warehouse_code = warehouse_code,
web_site = web_site
};
var total = 0;
var service = new Services.CashFlowServices();
var list = service.LogPage(m);
return new JsonResult(list == null || list.Items.Count <= 0 ? new dc_report_cash_flow_log_dto() : list.Items[0]);
}
} }
} }
\ No newline at end of file
...@@ -23,7 +23,7 @@ namespace ResetOutofstock ...@@ -23,7 +23,7 @@ namespace ResetOutofstock
// throw; // throw;
//} //}
report.ResetCashFlowData(); //report.ResetCashFlowData();
var builder = new HostBuilder().ConfigureServices((hostContext, services) => var builder = new HostBuilder().ConfigureServices((hostContext, services) =>
......
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