|  | @@ -4228,8 +4228,7 @@ FROM
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              catch (Exception ex)
 | 
	
		
			
				|  |  |              {
 | 
	
		
			
				|  |  | -                return Ok(JsonView(false, ex.Message));
 | 
	
		
			
				|  |  | -                throw;
 | 
	
		
			
				|  |  | +                return Ok(JsonView(false, ex.Message)); 
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -16317,6 +16316,11 @@ FROM
 | 
	
		
			
				|  |  |                      x.VisaCountry,
 | 
	
		
			
				|  |  |                      x.VisaPrice,
 | 
	
		
			
				|  |  |                      x.Id,
 | 
	
		
			
				|  |  | +                    IsVisaExemption = x.IsVisaExemption == 1 ? "否" : "是", //免签
 | 
	
		
			
				|  |  | +                    IsElectronicSignature = x.IsElectronicSignature == 1 ? "否" : "是", //电子签
 | 
	
		
			
				|  |  | +                    IsVisaOnArrival = x.IsVisaOnArrival == 1 ? "否" : "是", //落地签
 | 
	
		
			
				|  |  | +                    x.VisaTime, // 一般签证时间
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |                  }).ToList(),
 | 
	
		
			
				|  |  |                  baoPi = _GroupCostParameterRepository.GetBaoPi(diid),
 | 
	
		
			
				|  |  |                  blackCodeIsTrue = _sqlSugar.Queryable<Air_TicketBlackCode>().Where(x => x.IsDel == 0 && x.DiId == diid).Any(), //create.Code == 0 ? true : false,
 | 
	
	
		
			
				|  | @@ -18605,34 +18609,54 @@ ORDER by  gctggrc.id DESC
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              List<DelegationInfoAndIsTrueView> matches = new List<DelegationInfoAndIsTrueView>();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            if (string.IsNullOrWhiteSpace(dto.Keyword))
 | 
	
		
			
				|  |  | -            {
 | 
	
		
			
				|  |  | -                matches = _sqlSugar.SqlQueryable<DelegationInfoAndIsTrueView>($@"
 | 
	
		
			
				|  |  | -                     Select  a.Id,TeamName GroupName,b.isTrue From  Grp_DelegationInfo  a left join  (select top 100 percent Diid, CASE 
 | 
	
		
			
				|  |  | -                      WHEN COUNT(*) >= 0 THEN 'True' 
 | 
	
		
			
				|  |  | -                      ELSE 'False' END as isTrue  from Grp_GroupCost where Isdel = 0 and date != '' group by Diid) b on a.Id = b.Diid
 | 
	
		
			
				|  |  | -                       Where TeamName != '' And IsDel = 0 Order By a.VisitStartDate Desc
 | 
	
		
			
				|  |  | -                   ")
 | 
	
		
			
				|  |  | -               .ToList();
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -            else
 | 
	
		
			
				|  |  | +            #region SQL语句
 | 
	
		
			
				|  |  | +            //if (string.IsNullOrWhiteSpace(dto.Keyword))
 | 
	
		
			
				|  |  | +            //{
 | 
	
		
			
				|  |  | +            //    matches = _sqlSugar.SqlQueryable<DelegationInfoAndIsTrueView>($@"
 | 
	
		
			
				|  |  | +            //         Select  a.Id,TeamName GroupName,b.isTrue From  Grp_DelegationInfo  a left join  (select top 100 percent Diid, CASE 
 | 
	
		
			
				|  |  | +            //          WHEN COUNT(*) >= 0 THEN 'True' 
 | 
	
		
			
				|  |  | +            //          ELSE 'False' END as isTrue  from Grp_GroupCost where Isdel = 0 and date != '' group by Diid) b on a.Id = b.Diid
 | 
	
		
			
				|  |  | +            //           Where TeamName != '' And IsDel = 0 Order By a.VisitStartDate Desc
 | 
	
		
			
				|  |  | +            //       ")
 | 
	
		
			
				|  |  | +            //   .ToList();
 | 
	
		
			
				|  |  | +            //}
 | 
	
		
			
				|  |  | +            //else
 | 
	
		
			
				|  |  | +            //{
 | 
	
		
			
				|  |  | +            //    string likeKey = string.Empty;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            //    foreach (var item in dto.Keyword)
 | 
	
		
			
				|  |  | +            //    {
 | 
	
		
			
				|  |  | +            //        likeKey += "%" + item;
 | 
	
		
			
				|  |  | +            //    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            //    likeKey += "%";
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            //    matches = _sqlSugar.SqlQueryable<DelegationInfoAndIsTrueView>($@"
 | 
	
		
			
				|  |  | +            //         Select  a.Id,TeamName GroupName,b.isTrue From  Grp_DelegationInfo  a left join  (select top 100 percent Diid, CASE 
 | 
	
		
			
				|  |  | +            //          WHEN COUNT(*) >= 0 THEN 'True' 
 | 
	
		
			
				|  |  | +            //          ELSE 'False' END as isTrue  from Grp_GroupCost where Isdel = 0 and date != '' group by Diid) b on a.Id = b.Diid
 | 
	
		
			
				|  |  | +            //           Where TeamName != '' And IsDel = 0 And TeamName LIKE '{likeKey}'   Order By a.VisitStartDate Desc
 | 
	
		
			
				|  |  | +            //       ")
 | 
	
		
			
				|  |  | +            //   .ToList();
 | 
	
		
			
				|  |  | +            //}
 | 
	
		
			
				|  |  | +            #endregion
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            var table = _sqlSugar.Ado.UseStoredProcedure().GetDataTable("SearchGroupByKeyword", new
 | 
	
		
			
				|  |  |              {
 | 
	
		
			
				|  |  | -                string likeKey = string.Empty;
 | 
	
		
			
				|  |  | +                @KeyWord = dto.Keyword
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -                foreach (var item in dto.Keyword)
 | 
	
		
			
				|  |  | +            if (table != null && table.Rows.Count > 0)
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                foreach (DataRow row in table.Rows)
 | 
	
		
			
				|  |  |                  {
 | 
	
		
			
				|  |  | -                    likeKey += "%" + item;
 | 
	
		
			
				|  |  | +                    matches.Add(new DelegationInfoAndIsTrueView
 | 
	
		
			
				|  |  | +                    {
 | 
	
		
			
				|  |  | +                        Id = row.Field<int>("Id"),
 | 
	
		
			
				|  |  | +                        GroupName = row.Field<string>("GroupName"),
 | 
	
		
			
				|  |  | +                        isTrue = row.Field<string>("isTrue")
 | 
	
		
			
				|  |  | +                    });
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                likeKey += "%";
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                matches = _sqlSugar.SqlQueryable<DelegationInfoAndIsTrueView>($@"
 | 
	
		
			
				|  |  | -                     Select  a.Id,TeamName GroupName,b.isTrue From  Grp_DelegationInfo  a left join  (select top 100 percent Diid, CASE 
 | 
	
		
			
				|  |  | -                      WHEN COUNT(*) >= 0 THEN 'True' 
 | 
	
		
			
				|  |  | -                      ELSE 'False' END as isTrue  from Grp_GroupCost where Isdel = 0 and date != '' group by Diid) b on a.Id = b.Diid
 | 
	
		
			
				|  |  | -                       Where TeamName != '' And IsDel = 0 And TeamName LIKE '{likeKey}'   Order By a.VisitStartDate Desc
 | 
	
		
			
				|  |  | -                   ")
 | 
	
		
			
				|  |  | -               .ToList();
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              if (matches.Any())
 | 
	
	
		
			
				|  | @@ -19280,6 +19304,85 @@ AirHotelPrice
 | 
	
		
			
				|  |  |              public int Count { get; set; }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        private class HotelSum
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            internal decimal SGR { get; set; }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            internal decimal TBR { get; set; }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            internal decimal JSES { get; set; }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            internal decimal SUITE { get; set; }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            internal decimal AllPrice {
 | 
	
		
			
				|  |  | +                get { return SGR + TBR + JSES + SUITE; }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            [HttpPost]
 | 
	
		
			
				|  |  | +        public async Task<IActionResult> QueryGroupCostCoefficient(QueryGroupCostCoefficientDto dto)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            var di = await _sqlSugar.Queryable<Grp_DelegationInfo>()
 | 
	
		
			
				|  |  | +                .FirstAsync(x => x.Id == dto.Diid && x.IsDel == 0);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            if (di == null)
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                return Ok(JsonView(false, "团组不存在!"));
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            var groupCost = _sqlSugar.Queryable<Grp_GroupCost>()
 | 
	
		
			
				|  |  | +                                     .Where(x => x.Diid == dto.Diid && x.IsDel == 0)
 | 
	
		
			
				|  |  | +                                     .ToList();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            var groupHotelNumber = _sqlSugar.Queryable<Grp_CostTypeHotelNumber>()
 | 
	
		
			
				|  |  | +                                     .Where(x => x.Diid == dto.Diid && x.IsDel == 0)
 | 
	
		
			
				|  |  | +                                     .ToList();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            var groupHotelNumberDefault = groupHotelNumber.FirstOrDefault(x => x.Type == "Default");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            HotelSum hotelSumP = new ();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            if (groupCost.Any())
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                hotelSumP.SGR = groupHotelNumberDefault.SGR > 0 ?  groupCost.Sum(x => x.SGR) * groupHotelNumberDefault.SGR : 0 ;
 | 
	
		
			
				|  |  | +                hotelSumP.TBR = groupHotelNumberDefault.TBR > 0 ? groupCost.Sum(x => x.TBR) * groupHotelNumberDefault.TBR : 0;
 | 
	
		
			
				|  |  | +                hotelSumP.JSES = groupHotelNumberDefault.JSES > 0 ? groupCost.Sum(x => x.JS_ES) * groupHotelNumberDefault.JSES : 0;
 | 
	
		
			
				|  |  | +                hotelSumP.SUITE = groupHotelNumberDefault.SUITE > 0 ? groupCost.Sum(x => x.Suite) * groupHotelNumberDefault.SUITE : 0;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            #region 地接系数
 | 
	
		
			
				|  |  | +            Func<int, decimal> coefficientByDJ = (number) =>
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                if (number < 1) return 0.00M;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                return number switch
 | 
	
		
			
				|  |  | +                {
 | 
	
		
			
				|  |  | +                    < 6 => 2.5M,
 | 
	
		
			
				|  |  | +                    6 => 2.4M,
 | 
	
		
			
				|  |  | +                    7 => 1.8M,
 | 
	
		
			
				|  |  | +                    8 => 2.0M,
 | 
	
		
			
				|  |  | +                    9 => 3.0M,
 | 
	
		
			
				|  |  | +                    10 => 1.75M,
 | 
	
		
			
				|  |  | +                    > 10 => 1.9M,
 | 
	
		
			
				|  |  | +                };
 | 
	
		
			
				|  |  | +            };
 | 
	
		
			
				|  |  | +            #endregion
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            #region 酒店系数
 | 
	
		
			
				|  |  | +            
 | 
	
		
			
				|  |  | +            #endregion
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            return Ok(JsonView(true, "查询成功", new
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                HotelSum = hotelSumP,
 | 
	
		
			
				|  |  | +                CoefficientByDJ = coefficientByDJ(di.VisitPNumber) // 示例调用
 | 
	
		
			
				|  |  | +            }));
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          #endregion
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          #region 酒店预订 New 2023-12-28 17:45
 |