|
|
@@ -28,10 +28,13 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
{
|
|
|
private readonly IMapper _mapper;
|
|
|
|
|
|
- public VisaPriceRepository(SqlSugarClient sqlSugar, IMapper mapper)
|
|
|
+ private readonly DelegationInfoRepository _groupRep;
|
|
|
+
|
|
|
+ public VisaPriceRepository(SqlSugarClient sqlSugar, IMapper mapper, DelegationInfoRepository groupRep)
|
|
|
: base(sqlSugar)
|
|
|
{
|
|
|
_mapper = mapper;
|
|
|
+ _groupRep = groupRep;
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -343,6 +346,24 @@ Left Join Sys_SetData as sd With(Nolock) On c.PayDId = sd.Id
|
|
|
c.RMBPrice = c.PayMoney;
|
|
|
c.DayRate = 1.0000M;
|
|
|
|
|
|
+ // 按汇率计算人名币费用
|
|
|
+ var _TeamRate = _sqlSugar.Queryable<Grp_TeamRate>().First(a => a.DiId == dto.DiId && a.IsDel == 0 && a.CTable == 80);
|
|
|
+ var currencyInfos = new List<CurrencyInfo>();
|
|
|
+ if (_TeamRate != null)
|
|
|
+ {
|
|
|
+ Sys_SetData _SetData = _sqlSugar.Queryable<Sys_SetData>().First(a => a.IsDel == 0 && a.Id == c.PaymentCurrency);
|
|
|
+ if (_SetData != null)
|
|
|
+ {
|
|
|
+ currencyInfos = CommonFun.GetCurrencyChinaToList(_TeamRate.Remark);
|
|
|
+ CurrencyInfo CurrencyRate = currencyInfos.FirstOrDefault(a => a.CurrencyCode == _SetData.Name);
|
|
|
+ if (CurrencyRate != null)
|
|
|
+ {
|
|
|
+ c.RMBPrice = c.PayMoney * Convert.ToDecimal(CurrencyRate.Rate);
|
|
|
+ c.DayRate = CurrencyRate.Rate;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//todo:费用标准需更改为 Res_VisaFeeStandardDetails
|
|
|
#region 自动审核处理
|
|
|
var isAutoAudit = false;
|
|
|
@@ -350,17 +371,32 @@ Left Join Sys_SetData as sd With(Nolock) On c.PayDId = sd.Id
|
|
|
{
|
|
|
var area = dto.Area;
|
|
|
var feeType = 0; // 0 因公 1 因私
|
|
|
- if (area.Contains("因公")) feeType = 0;
|
|
|
- else if (area.Contains("因私")) feeType = 1;
|
|
|
+ if (area.Contains("(因公)"))
|
|
|
+ {
|
|
|
+ feeType = 0;
|
|
|
+ area = area.Replace("(因公)", "");
|
|
|
+ }
|
|
|
+ else if (area.Contains("(因私)"))
|
|
|
+ {
|
|
|
+ feeType = 1;
|
|
|
+ area = area.Replace("(因私)", "");
|
|
|
+ }
|
|
|
|
|
|
var visaFeeInfo = _sqlSugar.Queryable<Res_VisaFeeStandard>()
|
|
|
- .Where(x => x.IsDel == 0 && x.FeeType == feeType && area.Contains(x.Country))
|
|
|
+ .Where(x => x.IsDel == 0 && x.FeeType == feeType && x.Country.Equals(area))
|
|
|
.First();
|
|
|
if (visaFeeInfo != null)
|
|
|
{
|
|
|
//因公默认四川省
|
|
|
+ int provinceId = 122;
|
|
|
+ var groupNames = await _groupRep.EnterExitCostGroupNameInfoAsync(dto.DiId);
|
|
|
+ if (groupNames != null)
|
|
|
+ {
|
|
|
+ provinceId = groupNames.ProvinceId;
|
|
|
+ }
|
|
|
+
|
|
|
var visaDetails = _sqlSugar.Queryable<Res_VisaFeeStandardDetails>()
|
|
|
- .Where(x => x.IsDel == 0 && x.ParentId == visaFeeInfo.Id && x.ProvinceId == 122)
|
|
|
+ .Where(x => x.IsDel == 0 && x.ParentId == visaFeeInfo.Id && x.ProvinceId == provinceId)
|
|
|
.First();
|
|
|
|
|
|
decimal visaFeePrice = 0.00M;
|
|
|
@@ -378,7 +414,7 @@ Left Join Sys_SetData as sd With(Nolock) On c.PayDId = sd.Id
|
|
|
}
|
|
|
|
|
|
var visaFeeTotalPrice = visaFeePrice * dto.VisaNumber;
|
|
|
- if (dto.VisaPrice <= visaFeeTotalPrice)
|
|
|
+ if (c.RMBPrice <= visaFeeTotalPrice)
|
|
|
{
|
|
|
isAutoAudit = true;
|
|
|
c.IsAuditGM = 3;
|
|
|
@@ -390,23 +426,6 @@ Left Join Sys_SetData as sd With(Nolock) On c.PayDId = sd.Id
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
- var _TeamRate = _sqlSugar.Queryable<Grp_TeamRate>().First(a => a.DiId == dto.DiId && a.IsDel == 0 && a.CTable == 80);
|
|
|
- var currencyInfos = new List<CurrencyInfo>();
|
|
|
- if (_TeamRate != null)
|
|
|
- {
|
|
|
- Sys_SetData _SetData = _sqlSugar.Queryable<Sys_SetData>().First(a => a.IsDel == 0 && a.Id == c.PaymentCurrency);
|
|
|
- if (_SetData != null)
|
|
|
- {
|
|
|
- currencyInfos = CommonFun.GetCurrencyChinaToList(_TeamRate.Remark);
|
|
|
- CurrencyInfo CurrencyRate = currencyInfos.FirstOrDefault(a => a.CurrencyCode == _SetData.Name);
|
|
|
- if (CurrencyRate != null)
|
|
|
- {
|
|
|
- c.RMBPrice = c.PayMoney * Convert.ToDecimal(CurrencyRate.Rate);
|
|
|
- c.DayRate = CurrencyRate.Rate;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
if (dto.Status == 1)//添加
|
|
|
{
|
|
|
var grp_Visa = _sqlSugar.Queryable<Grp_VisaInfo>()
|