|
@@ -23,11 +23,13 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
{
|
|
|
private readonly IMapper _mapper;
|
|
|
private readonly TeamRateRepository _teamRateRep;
|
|
|
- public DecreasePaymentsRepository(SqlSugarClient sqlSugar, IMapper mapper, TeamRateRepository teamRateRep)
|
|
|
+ private readonly SetDataRepository _setDataRepository;
|
|
|
+ public DecreasePaymentsRepository(SqlSugarClient sqlSugar, IMapper mapper, TeamRateRepository teamRateRep, SetDataRepository setDataRepository )
|
|
|
: base(sqlSugar)
|
|
|
{
|
|
|
this._mapper = mapper;
|
|
|
_teamRateRep = teamRateRep;
|
|
|
+ this._setDataRepository = setDataRepository;
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 根据团组Id查询数据
|
|
@@ -159,6 +161,70 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
grp_Decrease.FeeTotal = grp_Decrease.Price * grp_Decrease.Price;
|
|
|
}
|
|
|
|
|
|
+ //根据成本判断自动审核
|
|
|
+ #region 根据成本判断自动审核
|
|
|
+
|
|
|
+ var auto = false;
|
|
|
+ if (dto.IsSelect == 1)
|
|
|
+ {
|
|
|
+ var costInfo = _sqlSugar.Queryable<Grp_GroupCostParameter>()
|
|
|
+ .LeftJoin<Grp_DelegationInfo>((a, b) => b.IsDel == 0 && b.Id == a.DiId)
|
|
|
+ .Where((a, b) => a.DiId == dto.DiId && a.IsDel == 0 && a.CostType == "A")
|
|
|
+ .Select((a,b) => new
|
|
|
+ {
|
|
|
+ a.Currency,
|
|
|
+ a.CostType,
|
|
|
+ a.Rate,
|
|
|
+ b.VisitPNumber,
|
|
|
+ })
|
|
|
+ .First();
|
|
|
+
|
|
|
+ if (costInfo != null)
|
|
|
+ {
|
|
|
+ //获取团组成本
|
|
|
+ var groupCostPrice_Decimal = _sqlSugar.Queryable<Grp_GroupCost>()
|
|
|
+ .Where(x => x.Diid == dto.DiId && x.IsDel == 0 && x.TE != 0)
|
|
|
+ .Sum(x => x.TE);
|
|
|
+ groupCostPrice_Decimal *= costInfo.VisitPNumber;
|
|
|
+
|
|
|
+ var costPrice_Decimal = groupCostPrice_Decimal;
|
|
|
+ var dtoPrice_Decimal = dto.FeeTotal;
|
|
|
+ var costInfoCurr_Bool = int.TryParse(costInfo.Currency, out int costInfoCurr_Int);
|
|
|
+
|
|
|
+ if(costInfoCurr_Int != dto.Currency)
|
|
|
+ {
|
|
|
+ if (costInfoCurr_Bool)
|
|
|
+ {
|
|
|
+ costPrice_Decimal *= costInfo.Rate;
|
|
|
+
|
|
|
+ //获取其他款项汇率
|
|
|
+ var rate_Object = await _setDataRepository.PostCurrencyByDiid(dto.DiId, 98, dto.Currency);
|
|
|
+ if (rate_Object != null && rate_Object.Code == 0) {
|
|
|
+ var currInfo = (rate_Object.Data as CurrencyInfo);
|
|
|
+ if (currInfo != null)
|
|
|
+ {
|
|
|
+ dtoPrice_Decimal *= currInfo.Rate;
|
|
|
+ if (costPrice_Decimal > dtoPrice_Decimal)
|
|
|
+ {
|
|
|
+ auto = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (costPrice_Decimal > dtoPrice_Decimal)
|
|
|
+ {
|
|
|
+ auto = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
List<TeamRateDescAddCurrencyIdView> teamRates = await _teamRateRep.PostGroupTeamRateItemByDiIdAndCTableId(1, dto.DiId, 98);
|
|
|
if (dto.Status == 1)//添加
|
|
|
{
|
|
@@ -207,7 +273,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
C.IsAuditMF = 0;
|
|
|
C.AuditMFOperate = 0;
|
|
|
C.AuditMFDate = "";
|
|
|
- C.IsAuditGM = 0;
|
|
|
+ C.IsAuditGM = auto ? 3 : 0;
|
|
|
C.AuditGMOperate = 21;
|
|
|
C.AuditGMDate = "";
|
|
|
|
|
@@ -331,7 +397,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer,
|
|
|
DayRate = grp_CreditCardPayment.DayRate,
|
|
|
RMBPrice = grp_CreditCardPayment.RMBPrice,
|
|
|
-
|
|
|
+ IsAuditGM = auto ? 3 : grp_CreditCardPayment.IsAuditGM
|
|
|
})
|
|
|
.ExecuteCommandAsync();
|
|
|
if (CTable > 0)
|