Bladeren bron

世运会自动审核条件改为判断总金额

yuanrf 2 weken geleden
bovenliggende
commit
d83134efa6
1 gewijzigde bestanden met toevoegingen van 42 en 25 verwijderingen
  1. 42 25
      OASystem/OASystem.Infrastructure/Repositories/Groups/DecreasePaymentsRepository.cs

+ 42 - 25
OASystem/OASystem.Infrastructure/Repositories/Groups/DecreasePaymentsRepository.cs

@@ -275,7 +275,8 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
                         if (spPriceName.Length >= 2)
                         {
-                            expression.And(x => x.T0 == spPriceName[0] && x.CalculationContent == spPriceName[1]);
+                            expression.And(x => x.T0 == spPriceName[0])
+                                      .And(x => x.CalculationContent == spPriceName[1]);
 
                             var setting = _sqlSugar.Queryable<Grp_GamesBudgetMaster>()
                                                     .First(expression.ToExpression());
@@ -283,7 +284,13 @@ namespace OASystem.Infrastructure.Repositories.Groups
                             if (setting != null)
                             {
                                 var dbList = _sqlSugar.Queryable<Grp_DecreasePayments>()
-                                            .Where(x => x.IsDel == 0 && x.PriceName.Contains(spPriceName[0]) && x.PriceName.Contains(spPriceName[1]) && x.Id != id)
+                                            .LeftJoin<Grp_CreditCardPayment>((x, a) => x.Id == a.CId && a.IsDel == 0 && a.CTable == 98 && a.DIId == dto.DiId)
+                                            .Where((x, a) => x.IsDel == 0 && x.PriceName.Contains(spPriceName[0]) && x.PriceName.Contains(spPriceName[1]) && x.Id != id)
+                                            .Select((x, a) => new
+                                            {
+                                                x,
+                                                a.RMBPrice,
+                                            })
                                             .ToList();
 
                                 //币种问题 (836 CNY)
@@ -292,29 +299,31 @@ namespace OASystem.Infrastructure.Repositories.Groups
                                     var rate = teamRates.Where(it => it.CurrencyId == grp_Decrease.Currency).FirstOrDefault();
                                     if (rate != null)
                                     {
-                                        dto.Price *= rate.Rate;
+                                        //dto.Price *= rate.Rate;
                                         dto.FeeTotal *= rate.Rate;
                                     }
                                 }
 
                                 //现有金额
-                                var sumPrice = dbList.Sum(x => x.FeeTotal);
+                                var sumPrice = dbList.Sum(x => x.RMBPrice);
+
                                 //现有数量
-                                var sumCount = dbList.Sum(x => x.Quantity);
+                                //var sumCount = dbList.Sum(x => x.Quantity);
 
                                 var availableAmount = setting.ItemTotal - sumPrice;
-                                var availableQuantity = setting.Quantity - sumCount;
+                                //var availableQuantity = setting.Quantity - sumCount;
 
-                                if (availableAmount > 0 && availableQuantity > 0)
+                                if (availableAmount > 0)  // && availableQuantity > 0
                                 {
 
-                                    var settingPrice = setting.UnitPrice;
-                                    if (int.TryParse(setting.CycleUnit, out int cycleUnit))
-                                    {
-                                        settingPrice *= cycleUnit;
-                                    }
+                                    //单价计算
+                                    //var settingPrice = setting.UnitPrice;
+                                    //if (int.TryParse(setting.CycleUnit, out int cycleUnit))
+                                    //{
+                                    //    settingPrice *= cycleUnit;
+                                    //}
 
-                                    if (dto.Price <= settingPrice && dto.FeeTotal <= availableAmount && dto.Quantity <= setting.Quantity)
+                                    if (dto.FeeTotal <= availableAmount) //dto.Price <= settingPrice &&  && dto.Quantity <= setting.Quantity
                                     {
                                         isAuto = true;
                                     }
@@ -439,7 +448,13 @@ namespace OASystem.Infrastructure.Repositories.Groups
                                 if (setting != null)
                                 {
                                     var dbList = _sqlSugar.Queryable<Grp_DecreasePayments>()
-                                                .Where(x => x.IsDel == 0 && x.PriceName.Contains(spPriceName[0]) && x.PriceName.Contains(spPriceName[1]) && x.Id != dto.Id)
+                                                .LeftJoin<Grp_CreditCardPayment>((x,a) => x.Id == a.CId && a.IsDel == 0 && a.CTable == 98 && a.DIId == dto.DiId )
+                                                .Where((x, a) => x.IsDel == 0 && x.PriceName.Contains(spPriceName[0]) && x.PriceName.Contains(spPriceName[1]) && x.Id != dto.Id)
+                                                .Select((x, a) => new
+                                                {
+                                                    x,
+                                                    a.RMBPrice,
+                                                })
                                                 .ToList();
 
                                     //币种问题 (836 CNY)
@@ -448,29 +463,31 @@ namespace OASystem.Infrastructure.Repositories.Groups
                                         var rate = teamRates.Where(it => it.CurrencyId == grp_Decrease.Currency).FirstOrDefault();
                                         if (rate != null)
                                         {
-                                            dto.Price *= rate.Rate;
+                                            //dto.Price *= rate.Rate;
                                             dto.FeeTotal *= rate.Rate;
                                         }
                                     }
 
                                     //现有金额
-                                    var sumPrice = dbList.Sum(x => x.FeeTotal);
+                                    var sumPrice = dbList.Sum(x => x.RMBPrice);
+                                    
                                     //现有数量
-                                    var sumCount = dbList.Sum(x => x.Quantity);
+                                    //var sumCount = dbList.Sum(x => x.Quantity);
 
                                     var availableAmount = setting.ItemTotal - sumPrice;
-                                    var availableQuantity = setting.Quantity - sumCount;
+                                    //var availableQuantity = setting.Quantity - sumCount;
 
-                                    if (availableAmount > 0 && availableQuantity > 0)
+                                    if (availableAmount > 0)  // && availableQuantity > 0
                                     {
 
-                                        var settingPrice = setting.UnitPrice;
-                                        if (int.TryParse(setting.CycleUnit, out int cycleUnit))
-                                        {
-                                            settingPrice *= cycleUnit;
-                                        }
+                                        //单价计算
+                                        //var settingPrice = setting.UnitPrice;
+                                        //if (int.TryParse(setting.CycleUnit, out int cycleUnit))
+                                        //{
+                                        //    settingPrice *= cycleUnit;
+                                        //}
 
-                                        if (dto.Price <= settingPrice && dto.FeeTotal <= availableAmount && dto.Quantity <= setting.Quantity)
+                                        if (dto.FeeTotal <= availableAmount) //dto.Price <= settingPrice &&  && dto.Quantity <= setting.Quantity
                                         {
                                             isAuto = true;
                                         }