| 
					
				 | 
			
			
				@@ -157,6 +157,7 @@ namespace OASystem.Infrastructure.Repositories.Groups 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             BeginTran(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             int id = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             var grp_Decrease = _mapper.Map<Grp_DecreasePayments>(dto); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //处理费用总计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (grp_Decrease.FeeTotal == 0.00M) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -164,25 +165,18 @@ namespace OASystem.Infrastructure.Repositories.Groups 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             List<TeamRateDescAddCurrencyIdView> teamRates = await _teamRateRep.PostGroupTeamRateItemByDiIdAndCTableId(1, dto.DiId, 98); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var teamRate = teamRates.Where(it => it.CurrencyId == grp_Decrease.Currency).FirstOrDefault(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (teamRate == null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return new JsonView() { Code = 400, Msg = $"添加失败!团组汇率未设置{_sqlSugar.Queryable<Sys_SetData>().First(it => it.IsDel == 0 && it.Id == grp_Decrease.Currency)?.Name ?? ""}该币种汇率!" }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (dto.Status == 1)//添加 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                string selectSql = string.Format(@"select * from Grp_DecreasePayments where PriceName='{0}' and IsDel={1} and DiId={2}" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                                , dto.PriceName, 0, dto.DiId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //var DecreasePayments = await _sqlSugar.SqlQueryable<Grp_DecreasePayments>(selectSql).FirstAsync();//查询是否存在 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //if (DecreasePayments != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //    return new JsonView() { Code = 400, Msg = "该数据已存在,请勿重复添加!" }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //else//不存在,可添加 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 id = await AddAsyncReturnId(grp_Decrease); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (id < 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    RollbackTran(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    return new JsonView() { Code = 400, Msg = "添加失败!" }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //进行C表添加 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                #region C表赋值 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Grp_CreditCardPayment C = new Grp_CreditCardPayment(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 C.PayDId = dto.PayDId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 C.ConsumptionPatterns = ""; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -192,11 +186,7 @@ namespace OASystem.Infrastructure.Repositories.Groups 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 C.CardholderName = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 C.PayMoney = grp_Decrease.FeeTotal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 C.PaymentCurrency = grp_Decrease.Currency; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //当天汇率 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //if (!string.IsNullOrEmpty(hfRate.Value)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //    C.DayRate = hfRate.Value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //C.DayRate = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 C.CompanyBankNo = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 C.OtherBankName = dto.OtherBankName; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 C.OtherSideNo = dto.OtherSideNo; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -231,27 +221,19 @@ namespace OASystem.Infrastructure.Repositories.Groups 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 C.ExceedBudget = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //C.RMBPrice = 0.00f; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //设置该团组的汇率 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                var 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) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (teamRate.CurrencyCode.Equals("CNY")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (teamRate.CurrencyCode.Equals("CNY")) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        C.DayRate = 1.0000M; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        C.RMBPrice = C.PayMoney; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        C.DayRate = teamRate.Rate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        C.RMBPrice = C.PayMoney * C.DayRate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    C.DayRate = 1.0000M; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    C.RMBPrice = C.PayMoney; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    RollbackTran(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    return new JsonView() { Code = 400, Msg = $"添加失败!团组汇率未设置{_sqlSugar.Queryable<Sys_SetData>().First(it => it.IsDel == 0 && it.Id == grp_Decrease.Currency)?.Name ?? ""}该币种汇率!" }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    C.DayRate = teamRate.Rate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    C.RMBPrice = C.PayMoney * C.DayRate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                #endregion  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 int cId = await _sqlSugar.Insertable(C).ExecuteReturnIdentityAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (cId > 1) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -283,6 +265,89 @@ namespace OASystem.Infrastructure.Repositories.Groups 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     #endregion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    #region 世运会自动审核处理 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (dto.DiId == 2590) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        bool isAuto = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        var spPriceName = dto.PriceName.Split('-').ToArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        var expression = Expressionable.Create<Grp_GamesBudgetMaster>() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                        .And(x => x.IsDel == 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (spPriceName.Length >= 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            expression.And(x => x.T0 == spPriceName[0]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                      .And(x => x.CalculationContent == spPriceName[1]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            var setting = _sqlSugar.Queryable<Grp_GamesBudgetMaster>() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                    .First(expression.ToExpression()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (setting != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                var dbList = _sqlSugar.Queryable<Grp_DecreasePayments>() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            .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) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                if (dto.Currency != 836) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    var rate = teamRates.Where(it => it.CurrencyId == grp_Decrease.Currency).FirstOrDefault(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    if (rate != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        //dto.Price *= rate.Rate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        dto.FeeTotal *= rate.Rate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                //现有金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                var sumPrice = dbList.Sum(x => x.RMBPrice); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                //现有数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                //var sumCount = dbList.Sum(x => x.Quantity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                var availableAmount = setting.ItemTotal - sumPrice; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                //var availableQuantity = setting.Quantity - sumCount; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                if (availableAmount > 0)  // && availableQuantity > 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    //单价计算 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    //var settingPrice = setting.UnitPrice; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    //if (int.TryParse(setting.CycleUnit, out int cycleUnit)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    //{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    //    settingPrice *= cycleUnit; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    //} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    if (dto.FeeTotal <= availableAmount) //dto.Price <= settingPrice &&  && dto.Quantity <= setting.Quantity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        isAuto = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (isAuto) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            _sqlSugar.Updateable<Grp_CreditCardPayment>() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                .SetColumns(a => new Grp_CreditCardPayment 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    IsAuditGM = 3, //自动审核通过 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    AuditGMOperate = 4, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    AuditGMDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                .Where(a => a.CId == id && a.CTable == 98 && a.DIId == 2590) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                .ExecuteCommand(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    #endregion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     CommitTran(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     var data = new { ccpId = cId, sign = 1, dataId = id }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     return new JsonView() { Code = 200, Msg = "添加成功!", Data = data }; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -290,7 +355,6 @@ namespace OASystem.Infrastructure.Repositories.Groups 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 RollbackTran(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return new JsonView() { Code = 400, Msg = "添加失败!" }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                // } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             else if (dto.Status == 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -326,9 +390,6 @@ namespace OASystem.Infrastructure.Repositories.Groups 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (res) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    //设置该团组的汇率 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    var teamRate = teamRates.Where(it => it.CurrencyId == grp_Decrease.Currency).FirstOrDefault(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if (teamRate != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         if (teamRate.CurrencyCode.Equals("CNY")) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -342,11 +403,6 @@ namespace OASystem.Infrastructure.Repositories.Groups 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             grp_CreditCardPayment.RMBPrice = grp_CreditCardPayment.PayMoney * grp_CreditCardPayment.DayRate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        RollbackTran(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        return new JsonView() { Code = 400, Msg = "修改失败!" }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //2025-04-07 第四次更改 PayDId == 72(刷卡) IsPay == 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     int isPay = 0; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -370,8 +426,92 @@ namespace OASystem.Infrastructure.Repositories.Groups 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             //IsAuditGM = auto ? 3 : grp_CreditCardPayment.IsAuditGM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         .ExecuteCommandAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if (CTable > 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        #region 世运会自动审核处理 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (dto.DiId == 2590) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            bool isAuto = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            var spPriceName = dto.PriceName.Split('-').ToArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            var expression = Expressionable.Create<Grp_GamesBudgetMaster>() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                            .And(x => x.IsDel == 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (spPriceName.Length >= 2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                expression.And(x => x.T0 == spPriceName[0]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                          .And(x => x.CalculationContent == spPriceName[1]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                var setting = _sqlSugar.Queryable<Grp_GamesBudgetMaster>() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                        .First(expression.ToExpression()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                if (setting != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    var dbList = _sqlSugar.Queryable<Grp_DecreasePayments>() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                .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) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    if (dto.Currency != 836) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        var rate = teamRates.Where(it => it.CurrencyId == grp_Decrease.Currency).FirstOrDefault(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        if (rate != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            //dto.Price *= rate.Rate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            dto.FeeTotal *= rate.Rate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    //现有金额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    var sumPrice = dbList.Sum(x => x.RMBPrice); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    //现有数量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    //var sumCount = dbList.Sum(x => x.Quantity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    var availableAmount = setting.ItemTotal - sumPrice; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    //var availableQuantity = setting.Quantity - sumCount; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    if (availableAmount > 0)  // && availableQuantity > 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        //单价计算 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        //var settingPrice = setting.UnitPrice; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        //if (int.TryParse(setting.CycleUnit, out int cycleUnit)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        //{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        //    settingPrice *= cycleUnit; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        //} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        if (dto.FeeTotal <= availableAmount) //dto.Price <= settingPrice &&  && dto.Quantity <= setting.Quantity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            isAuto = true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if (isAuto) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                _sqlSugar.Updateable<Grp_CreditCardPayment>() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    .SetColumns(a => new Grp_CreditCardPayment 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        IsAuditGM = 3, //自动审核通过 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        AuditGMOperate = 4, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        AuditGMDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    .Where(a => a.CId == dto.Id && a.CTable == 98 && a.DIId == 2590) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    .ExecuteCommand(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        #endregion 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         CommitTran(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         var data = new { ccpId = grp_CreditCardPayment.Id, sign = 2, dataId = grp_Decrease.Id }; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -380,6 +520,7 @@ namespace OASystem.Infrastructure.Repositories.Groups 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             RollbackTran(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return new JsonView() { Code = 400, Msg = MsgTips.Fail }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 |