|
@@ -22,7 +22,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
{
|
|
|
private readonly IMapper _mapper;
|
|
|
private readonly TeamRateRepository _teamRateRep;
|
|
|
- public DecreasePaymentsRepository(SqlSugarClient sqlSugar, IMapper mapper, TeamRateRepository teamRateRep)
|
|
|
+ public DecreasePaymentsRepository(SqlSugarClient sqlSugar, IMapper mapper, TeamRateRepository teamRateRep)
|
|
|
: base(sqlSugar)
|
|
|
{
|
|
|
this._mapper = mapper;
|
|
@@ -77,13 +77,13 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
{
|
|
|
DiId += item.DIId + ",";
|
|
|
}
|
|
|
- if (DiId!="0")
|
|
|
+ if (DiId != "0")
|
|
|
{
|
|
|
DiId = DiId.Substring(0, DiId.Length - 1);
|
|
|
}
|
|
|
string sql = string.Format(@"select * from Grp_DelegationInfo where Id in({0}) and IsDel={1} Order By CreateTime Desc", DiId, 0);
|
|
|
List<Grp_DelegationInfo> grp_Delegations = _sqlSugar.SqlQueryable<Grp_DelegationInfo>(sql).ToList();
|
|
|
-
|
|
|
+
|
|
|
if (grp_Delegations.Count == 0)
|
|
|
{
|
|
|
return result = new Result() { Code = -1, Msg = "查询失败!" };
|
|
@@ -137,7 +137,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
RollbackTran();
|
|
|
return new Result() { Code = -1, Msg = "添加失败!" };
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//进行C表添加
|
|
|
Grp_CreditCardPayment C = new Grp_CreditCardPayment();
|
|
|
C.PayDId = dto.PayDId;
|
|
@@ -185,7 +185,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
//C.RMBPrice = 0.00f;
|
|
|
|
|
|
//设置该团组的汇率
|
|
|
- TeamRateDescAddCurrencyIdView teamRate = teamRates.Where(it => it.CurrencyCode == grp_Decrease.Currency.ToString()).FirstOrDefault();
|
|
|
+ TeamRateDescAddCurrencyIdView teamRate = teamRates.Where(it => it.CurrencyId == grp_Decrease.Currency).FirstOrDefault();
|
|
|
//Grp_TeamRate _TeamRate = _sqlSugar.Queryable<Grp_TeamRate>().First(a => a.DiId == grp_Decrease.DiId && a.IsDel == 0 && a.CTable == 98);
|
|
|
if (teamRate != null)
|
|
|
{
|
|
@@ -202,8 +202,8 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- C.DayRate = 1.0000M;
|
|
|
- C.RMBPrice = C.PayMoney;
|
|
|
+ RollbackTran();
|
|
|
+ return new Result() { Code = -1, Msg = $"添加失败!团组汇率未设置{_sqlSugar.Queryable<Sys_SetData>().First(it => it.IsDel == 0 && it.Id == grp_Decrease.Currency)?.Name ?? ""}该币种汇率!" };
|
|
|
}
|
|
|
int cId = await _sqlSugar.Insertable(C).ExecuteReturnIdentityAsync();
|
|
|
if (cId != 0)
|
|
@@ -216,7 +216,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
RollbackTran();
|
|
|
return new Result() { Code = -1, Msg = "添加失败!" };
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -233,17 +233,17 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
});
|
|
|
if (res)
|
|
|
{
|
|
|
- Grp_CreditCardPayment grp_CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == grp_Decrease.Id && a.CTable==98 && a.CId==grp_Decrease.Id && a.IsDel == 0);
|
|
|
+ Grp_CreditCardPayment grp_CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == grp_Decrease.Id && a.CTable == 98 && a.CId == grp_Decrease.Id && a.IsDel == 0);
|
|
|
if (grp_CreditCardPayment != null)
|
|
|
{
|
|
|
//设置该团组的汇率
|
|
|
- TeamRateDescAddCurrencyIdView teamRate = teamRates.Where(it => it.CurrencyCode == grp_Decrease.Currency.ToString()).FirstOrDefault();
|
|
|
-
|
|
|
+ TeamRateDescAddCurrencyIdView teamRate = teamRates.Where(it => it.CurrencyId == grp_Decrease.Currency).FirstOrDefault();
|
|
|
+
|
|
|
if (teamRate != null)
|
|
|
{
|
|
|
if (teamRate.CurrencyCode.Equals("CNY"))
|
|
|
{
|
|
|
- grp_CreditCardPayment.DayRate = 1.0000M;
|
|
|
+ grp_CreditCardPayment.DayRate = 1.0000M;
|
|
|
grp_CreditCardPayment.RMBPrice = grp_CreditCardPayment.PayMoney;
|
|
|
}
|
|
|
else
|
|
@@ -255,8 +255,8 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- grp_CreditCardPayment.DayRate = 1M;
|
|
|
- grp_CreditCardPayment.RMBPrice = grp_Decrease.Price;
|
|
|
+ RollbackTran();
|
|
|
+ return new Result() { Code = -1, Msg = "修改失败!" };
|
|
|
}
|
|
|
int CTable = await _sqlSugar.Updateable<Grp_CreditCardPayment>()
|
|
|
.Where(a => a.Id == grp_CreditCardPayment.Id)
|
|
@@ -294,7 +294,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
return new Result() { Code = -1, Msg = "修改失败!" };
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
@@ -327,7 +327,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
{
|
|
|
DiId = "0";
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
string sql = string.Format(@"select Id,TourCode,TeamName,ClientName,VisitStartDate,VisitEndDate,VisitCountry,VisitDays,VisitPNumber from Grp_DelegationInfo where Id in({0}) and IsDel={1}", DiId, 0);
|
|
|
List<DelegationEasyView> grp_Delegations = _sqlSugar.SqlQueryable<DelegationEasyView>(sql).ToList();
|
|
|
if (grp_Delegations.Count != 0)
|
|
@@ -360,12 +360,12 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
else
|
|
|
{
|
|
|
ListViewBase<DelegationEasyView> rst = new ListViewBase<DelegationEasyView>();
|
|
|
- rst.DataList=new List<DelegationEasyView>();
|
|
|
+ rst.DataList = new List<DelegationEasyView>();
|
|
|
return result = new Result() { Code = 0, Msg = "暂无数据!", Data = rst };
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
@@ -385,8 +385,8 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
Result result = new Result() { Code = -2, Msg = "程序错误" };
|
|
|
try
|
|
|
{
|
|
|
- Grp_DecreasePayments grp_Decrease = _sqlSugar.Queryable<Grp_DecreasePayments>().First(a=>a.Id==dto.Id && a.IsDel==0);
|
|
|
- Grp_CreditCardPayment grp_CreditCard= _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == dto.Id && a.IsDel == 0 && a.CTable==98);
|
|
|
+ Grp_DecreasePayments grp_Decrease = _sqlSugar.Queryable<Grp_DecreasePayments>().First(a => a.Id == dto.Id && a.IsDel == 0);
|
|
|
+ Grp_CreditCardPayment grp_CreditCard = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == dto.Id && a.IsDel == 0 && a.CTable == 98);
|
|
|
var data = new
|
|
|
{
|
|
|
_Decrease = grp_Decrease,
|
|
@@ -401,5 +401,48 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Del
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ /// <exception cref="NotImplementedException"></exception>
|
|
|
+ public async Task<Result> _Del(int id, int userId)
|
|
|
+ {
|
|
|
+ Result result = new Result() { Code = -2, Msg = "删除失败!" };
|
|
|
+
|
|
|
+ _sqlSugar.BeginTran();
|
|
|
+
|
|
|
+ var del = await _sqlSugar.Updateable<Grp_DecreasePayments>()
|
|
|
+ .SetColumns(it => new Grp_DecreasePayments()
|
|
|
+ {
|
|
|
+ IsDel = 1,
|
|
|
+ DeleteUserId = userId,
|
|
|
+ DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
|
|
|
+ }).Where(it => it.Id == id)
|
|
|
+ .ExecuteCommandAsync();
|
|
|
+ if (del > 0)
|
|
|
+ {
|
|
|
+ var del1 = await _sqlSugar.Updateable<Grp_CreditCardPayment>()
|
|
|
+ .SetColumns(a => new Grp_CreditCardPayment()
|
|
|
+ {
|
|
|
+ IsDel = 1,
|
|
|
+ DeleteUserId = userId,
|
|
|
+ DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
|
|
|
+ })
|
|
|
+ .Where(a => a.CId == id && a.CTable == 98)
|
|
|
+ .ExecuteCommandAsync();
|
|
|
+ if (del1 > 0)
|
|
|
+ {
|
|
|
+ _sqlSugar.CommitTran();
|
|
|
+ result.Code = 0;
|
|
|
+ result.Msg = "删除成功!";
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ _sqlSugar.RollbackTran();
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|
|
|
}
|