Commit c0b58793 by jianshuqin

优化:组件功能

parent a7447cdc
...@@ -425,10 +425,17 @@ namespace Bailun.DC.Services.DataWareHouse ...@@ -425,10 +425,17 @@ namespace Bailun.DC.Services.DataWareHouse
int? resultCount = entity.id > 0 ? db.Update(entity) : db.Insert(entity); int? resultCount = entity.id > 0 ? db.Update(entity) : db.Insert(entity);
if (resultCount > 0) if (resultCount > 0)
{ {
if (entity.id == 0)
{
string sql = "select max(id) from flowing_sales_fee";
entity.id = db.QueryFirstOrDefault<int>(sql);
}
result = this.ImportFlowingSalesFeeDetail(new[] { entity.id }, entity.month);
if (result.Result)
{
trans.Commit();
}
} }
trans.Commit();
result.Result = true;
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -503,7 +510,7 @@ namespace Bailun.DC.Services.DataWareHouse ...@@ -503,7 +510,7 @@ namespace Bailun.DC.Services.DataWareHouse
return result; return result;
} }
public ResultDTO ImportFlowingSalesFeeDetail(int[] feeId) public ResultDTO ImportFlowingSalesFeeDetail(int[] feeId, string month = null)
{ {
ResultDTO result = new ResultDTO(); ResultDTO result = new ResultDTO();
...@@ -521,13 +528,18 @@ namespace Bailun.DC.Services.DataWareHouse ...@@ -521,13 +528,18 @@ namespace Bailun.DC.Services.DataWareHouse
List<flowing_sales_fee_detail> listDetail = new List<flowing_sales_fee_detail>(); List<flowing_sales_fee_detail> listDetail = new List<flowing_sales_fee_detail>();
if (list?.Count > 0) if (list?.Count > 0)
{ {
sql = "select * from exchange_rate_finance where month in @month"; sql = "select * from exchange_rate_finance where month in @month";
IList<exchange_rate_finance> listRate = db.Query<exchange_rate_finance>(sql, new { month = list.Select(l => l.month).Distinct() }).ToList(); IList<exchange_rate_finance> listRate = db.Query<exchange_rate_finance>(sql, new { month = !string.IsNullOrWhiteSpace(month) ? new string[] { month } : list.Select(l => l.month).Distinct() }).ToList();
if (listRate?.Count > 0) if (listRate?.Count > 0)
{ {
DateTime date = DateTime.MinValue; DateTime date = DateTime.MinValue;
foreach (flowing_sales_fee entity in list) foreach (flowing_sales_fee entity in list)
{ {
if (!string.IsNullOrWhiteSpace(month))
{
entity.month = month;
}
if (DateTime.TryParse(entity.month, out date)) if (DateTime.TryParse(entity.month, out date))
{ {
DateTime monthTime = date; DateTime monthTime = date;
......
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