/// <summary> /// 获取基础数据 /// </summary> /// <param name="travelParam"></param> /// <returns></returns> public List <AVHData> GetBasic(List <QueryParam> travelParam) { // IbeService ibe = new IbeService(); List <AVHData> result = new List <AVHData>(); try { if (travelParam.Count == 1)//单程 { QueryParam queryParam = travelParam[0]; AVHData avhData = new AVHData(); FDData fdData = new FDData(); Parallel.Invoke( () => avhData = new IbeService(queryParam).GetAvh(queryParam.FromCode, queryParam.ToCode, DateTime.Parse(queryParam.FlyDate), queryParam.CarrierCode), () => fdData = new IbeService(queryParam).GetFD(queryParam.FromCode, queryParam.ToCode, DateTime.Parse(queryParam.FlyDate), queryParam.CarrierCode) ); //补全数据 avhData = BuQuanAVH(avhData, fdData); result.Add(avhData); } else if (travelParam.Count == 2)//往返或者联程 { // IbeService ibeBack = new IbeService(); QueryParam fromParam = travelParam[0]; AVHData fromParamAvhData = new AVHData(); FDData fromParamFdData = new FDData(); QueryParam toParam = travelParam[1]; AVHData toParamAvhData = new AVHData(); FDData toParamFdData = new FDData(); Parallel.Invoke( () => fromParamAvhData = new IbeService(fromParam).GetAvh(fromParam.FromCode, fromParam.ToCode, DateTime.Parse(fromParam.FlyDate), fromParam.CarrierCode), () => fromParamFdData = new IbeService(fromParam).GetFD(fromParam.FromCode, fromParam.ToCode, DateTime.Parse(fromParam.FlyDate), fromParam.CarrierCode) //() => toParamAvhData = ibeBack.GetAvh(toParam.FromCode, toParam.ToCode, DateTime.Parse(toParam.FlyDate), toParam.CarrierCode), //() => toParamFdData = ibeBack.GetFD(toParam.FromCode, toParam.ToCode, DateTime.Parse(toParam.FlyDate), toParam.CarrierCode) ); Parallel.Invoke( () => toParamAvhData = new IbeService(toParam).GetAvh(toParam.FromCode, toParam.ToCode, DateTime.Parse(toParam.FlyDate), toParam.CarrierCode), () => toParamFdData = new IbeService(toParam).GetFD(toParam.FromCode, toParam.ToCode, DateTime.Parse(toParam.FlyDate), toParam.CarrierCode) ); //补全数据 fromParamAvhData = BuQuanAVH(fromParamAvhData, fromParamFdData); toParamAvhData = BuQuanAVH(toParamAvhData, toParamFdData); result.Add(fromParamAvhData); result.Add(toParamAvhData); } } catch (Exception ex) { //记录日志 log.WriteLog("GetBasic", "异常信息:" + ex.Message + "\r\n"); } return(result); }
/// <summary> /// 补全数据 /// </summary> /// <param name="avhData"></param> /// <param name="fdData"></param> /// <returns></returns> public AVHData BuQuanAVH(AVHData avhData, FDData fdData) { try { if (avhData.IbeData.Count > 0 && fdData.FdRow.Count > 0) { // TestData test = new TestData(); List <AirplainType> listAirplainType = new List <AirplainType>(); try { //mgHelper.All<AirplainType>().ToList();// listAirplainType = test.GetAirplainType(); } catch (Exception) { listAirplainType = new List <AirplainType>(); } //所有的baseCabin List <BaseCabin> allBaseCabin = test.GetBaseCabin(""); decimal TaxFee = 0m;//机建费 for (int i = 0; i < avhData.IbeData.Count; i++) { //空舱位 if (avhData.IbeData[i].IBESeat == null || avhData.DicYSeatPrice == null) { continue; } //Y舱价格 if (!avhData.DicYSeatPrice.ContainsKey(avhData.IbeData[i].CarrierCode)) { if (fdData.YFdRow.ContainsKey(avhData.IbeData[i].CarrierCode)) { avhData.DicYSeatPrice.Add(avhData.IbeData[i].CarrierCode, fdData.YFdRow[avhData.IbeData[i].CarrierCode].SeatPrice); } } //查找机建费 AirplainType airplainType = listAirplainType.Find(p => p.Code == avhData.IbeData[i].AirModel); if (airplainType != null) { TaxFee = airplainType.TaxFee; } else { try { AirplainType _airplainType = new AirplainType() { Code = avhData.IbeData[i].AirModel, TaxFee = 50m }; //补全机型机建 //mgHelper.Add<AirplainType>(); if (!test.ExistAirplainType(_airplainType.Code)) { test.ExecuteSQL(string.Format("insert into AirplainType(Code,TaxFee) values('{0}',{1})", _airplainType.Code, _airplainType.TaxFee)); } } catch (Exception) { } } for (int j = 0; j < avhData.IbeData[i].IBESeat.Count; j++) { FdRow fdRow = fdData.FdRow.Where(p => p.CarrierCode == avhData.IbeData[i].CarrierCode && p.Seat == avhData.IbeData[i].IBESeat[j].Seat).FirstOrDefault(); if (fdRow != null) { //燃油 avhData.IbeData[i].ADultFuleFee = fdRow.ADultFuleFee; avhData.IbeData[i].ChildFuleFee = fdRow.ADultFuleFee; //机建费 从数据库中读取 暂时假数据 if (TaxFee != 0) { avhData.IbeData[i].TaxFee = TaxFee; } //舱位价 avhData.IbeData[i].IBESeat[j].SeatPrice = fdRow.SeatPrice; //折扣 avhData.IbeData[i].IBESeat[j].Rebate = fdRow.Rebate; } else { try { //从数据库中获取 //BaseCabin baseCabin = mgHelper.Query<BaseCabin>(p => p.CarrierCode == avhData.IbeData[i].CarrierCode && p.Code == avhData.IbeData[i].IBESeat[j].Seat).FirstOrDefault(); //List<BaseCabin> baseCabinList = test.GetBaseCabin(string.Format(" CarrierCode='{0}' and Code='{1}' ", avhData.IbeData[i].CarrierCode, avhData.IbeData[i].IBESeat[j].Seat)); List <BaseCabin> baseCabinList = allBaseCabin.Where(m => m.CarrierCode == avhData.IbeData[i].CarrierCode && m.Code == avhData.IbeData[i].IBESeat[j].Seat).ToList(); BaseCabin baseCabin = null; if (baseCabinList != null && baseCabinList.Count > 0) { baseCabin = baseCabinList[0]; } if (baseCabin != null && avhData.DicYSeatPrice.ContainsKey(avhData.IbeData[i].CarrierCode) && avhData.DicYSeatPrice[avhData.IbeData[i].CarrierCode] != 0m) { //折扣 avhData.IbeData[i].IBESeat[j].Rebate = baseCabin.Rebate; //舱位价 avhData.IbeData[i].IBESeat[j].SeatPrice = dataBill.MinusCeilTen((baseCabin.Rebate / 100) * avhData.DicYSeatPrice[avhData.IbeData[i].CarrierCode]); } fdRow = fdData.FdRow.Where(p => p.ADultFuleFee != 0).FirstOrDefault(); //取这条航线的燃油 但不精确 avhData.IbeData[i].ADultFuleFee = fdRow.ADultFuleFee; avhData.IbeData[i].ChildFuleFee = fdRow.ADultFuleFee; //机建费 从数据库中读取 暂时假数据 avhData.IbeData[i].TaxFee = TaxFee; } catch (Exception) { } } } } } } catch (Exception ex) { //记录日志 log.WriteLog("BuQuanAVH", "异常信息:" + ex.Message + "\r\n"); } return(avhData); }
private bool Filter(PolicyCache policy, List <string> InterfaceCode, List <AVHData> avhList, AVHData avhData, TravelType travelType, DateTime flyDate, DayOfWeek[] WeekendTimes, int i, int k) { bool Issuc = false; try { //出发城市 if (!(policy.FromCityCode != null && policy.FromCityCode.Contains(avhData.QueryParam.FromCode))) { return(Issuc); } //到达城市 if (!(policy.ToCityCode != null && policy.ToCityCode.Contains(avhData.QueryParam.ToCode))) { return(Issuc); } //乘机有效期 if (!(flyDate > policy.CheckinTime.FromTime && flyDate < policy.CheckinTime.EndTime)) { return(Issuc); } //出票有效期 //if (!(flyDate > policy.IssueTime.FromTime && flyDate < policy.IssueTime.EndTime)) //{ // return Issuc; //} //适用星期 if (policy.SuitableWeek.Length > 0) { if (!policy.SuitableWeek.Contains(flyDate.DayOfWeek)) { return(Issuc); } } //承运人 if (policy.CarrierCode.ToUpper() != avhData.IbeData[i].CarrierCode) { return(Issuc); } //适用舱位 if (policy.CabinSeatCode.Length == 0 || !policy.CabinSeatCode.Contains(avhData.IbeData[i].IBESeat[k].Seat)) { return(Issuc); } if (policy.Applay == EnumApply.Apply) { //适用航班号 if (policy.SuitableFlightNo.Length == 0 || !policy.SuitableFlightNo.Contains(avhData.IbeData[i].FlightNo) ) { return(Issuc); } } else if (policy.Applay == EnumApply.NotApply) { //排除航班号 if (policy.ExceptedFlightNo.Length > 0 && policy.ExceptedFlightNo.Contains(avhData.IbeData[i].FlightNo)) { return(Issuc); } } //第二程 if (avhList.Count > 1) { string carryCode = avhData.IbeData[i].CarrierCode; string flightNo = avhData.IbeData[i].FlightNo; string seat = avhData.IbeData[i].IBESeat[k].Seat; var IbeRowList = avhList[1].IbeData.Where(p => p.CarrierCode.ToUpper().Trim() == carryCode.ToUpper().Trim()).ToList(); //承运人 if (policy.CarrierCode.ToUpper() != carryCode || IbeRowList == null) { return(Issuc); } int seatCount = IbeRowList.Where(p => p.IBESeat.Where(p1 => p1.Seat == seat).Count() > 0).Count(); //适用舱位 if (policy.CabinSeatCode.Length == 0 || seatCount == 0 ) { return(Issuc); } } if (InterfaceCode.Contains(policy.PlatformCode)) { ////适用航班号 //if (policy.SuitableFlightNo.Length > 0) //{ // if (!policy.SuitableFlightNo.Contains(avhData.IbeData[i].FlightNo)) // { // return Issuc; // } //} ////排除航班号 //if (policy.ExceptedFlightNo.Length > 0 && policy.ExceptedFlightNo.Contains(avhData.IbeData[i].FlightNo)) //{ // return Issuc; //} //上下班时间 //周六周日 if (WeekendTimes.Contains(System.DateTime.Now.DayOfWeek)) { if (!(DateTime.Compare(DateTime.Parse(policy.ServiceTime.WeekendTime.FromTime.ToString("HH:mm:ss")), DateTime.Parse(System.DateTime.Now.ToString("HH:mm:ss"))) < 0 && DateTime.Compare(DateTime.Parse(policy.ServiceTime.WeekendTime.EndTime.ToString("HH:mm:ss")), DateTime.Parse(System.DateTime.Now.ToString("HH:mm:ss"))) > 0 )) { return(Issuc); } } else { //周一至周五 if (!(DateTime.Compare(DateTime.Parse(policy.ServiceTime.WeekTime.FromTime.ToString("HH:mm:ss")), DateTime.Parse(System.DateTime.Now.ToString("HH:mm:ss"))) < 0 && DateTime.Compare(DateTime.Parse(policy.ServiceTime.WeekTime.EndTime.ToString("HH:mm:ss")), DateTime.Parse(System.DateTime.Now.ToString("HH:mm:ss"))) > 0 )) { return(Issuc); } } } //.... } catch (Exception ex) { log.WriteLog("MatchPolicy_1", "异常信息:" + ex.Message + ex.StackTrace + "\r\n"); } Issuc = true; return(Issuc); }
/// <summary> /// 获取航班数据 /// </summary> /// <param name="avhList"></param> /// <param name="PolicyList"></param> /// <returns></returns> public List <AVHData> MatchPolicy(string code, List <AVHData> avhList, TravelType travelType, List <PolicyCache> PolicyList) { DataBill dataBill = new DataBill(); try { //PolicyList = PolicyList.Where(p => p.PlatformCode == "系统").ToList(); if (avhList != null && PolicyList != null && avhList.Count > 0 && PolicyList.Count > 0) { //周六至周日 DayOfWeek[] WeekendTimes = new DayOfWeek[] { DayOfWeek.Saturday, DayOfWeek.Sunday }; //调整缓存政策 PolicyList = PolicyCacheSetting(PolicyList); PolicyList = DeductionSetting(code, avhList, PolicyList); List <string> codeList = ObjectFactory.GetAllInstances <IPlatform>().Select(p => p.Code).ToList(); for (int i = 0; i < avhList.Count; i++) { AVHData avhData = avhList[i]; DateTime flyDate = DateTime.Parse(avhData.QueryParam.FlyDate); //循环IBE数据 for (int j = 0; j < avhData.IbeData.Count; j++) { //排除没有舱位的 if (avhData.IbeData[j].IBESeat == null || avhData.IbeData[j].IBESeat.Count() == 0) { continue; } //循环舱位 每个舱位可能对应多条政策 取最优的一条 List <IbeSeat> addRowList = new List <IbeSeat>(); for (int k = 0; k < avhData.IbeData[j].IBESeat.Count; k++) { avhData.IbeData[j].IBESeat[k].IbeSeatPrice = avhData.IbeData[j].IBESeat[k].SeatPrice; if (avhData.DicYSeatPrice != null && avhData.DicYSeatPrice.ContainsKey(avhData.IbeData[j].CarrierCode) ) { if (avhData.IbeData[j].IBESeat[k].SeatPrice > 0) { avhData.IbeData[j].IBESeat[k].Commission = dataBill.GetCommission(avhData.IbeData[j].IBESeat[k].Policy, avhData.IbeData[j].IBESeat[k].SeatPrice, avhData.IbeData[j].IBESeat[k].ReturnMoney); } } else { //没有Y舱直接过滤 continue; } //每个舱位可能对应多条政策 政策过滤 var result = PolicyList.Where(p => Filter(p, codeList, avhList, avhData, travelType, flyDate, WeekendTimes, j, k)).ToList(); #region 特价舱位匹配政策 //if (avhList.Count == 1)//暂时只适用单程 if (true) { //特价舱位 不通的特价类型的多条政策 List <PolicyCache> spPolicyList = result.Where(p => p.PolicySpecialType != EnumPolicySpecialType.Normal).OrderByDescending(p => p.Point).ToList();//.FirstOrDefault(); if (spPolicyList != null && spPolicyList.Count > 0) { //获取4种类型政策最优的特价 List <PolicyCache> spList = new List <PolicyCache>(); PolicyCache spDynamicSpecial = spPolicyList.Where(p => p.PolicySpecialType == EnumPolicySpecialType.DynamicSpecial).OrderByDescending(p => p.Point).FirstOrDefault(); if (spDynamicSpecial != null) { spList.Add(spDynamicSpecial); } PolicyCache spFixedSpecial = spPolicyList.Where(p => p.PolicySpecialType == EnumPolicySpecialType.FixedSpecial).OrderByDescending(p => p.Point).FirstOrDefault(); if (spFixedSpecial != null) { spList.Add(spFixedSpecial); } PolicyCache spDownSpecial = spPolicyList.Where(p => p.PolicySpecialType == EnumPolicySpecialType.DownSpecial).OrderByDescending(p => p.Point).FirstOrDefault(); if (spDownSpecial != null) { spList.Add(spDownSpecial); } PolicyCache spDiscountOnDiscount = spPolicyList.Where(p => p.PolicySpecialType == EnumPolicySpecialType.DiscountOnDiscount).OrderByDescending(p => p.Point).FirstOrDefault(); if (spDiscountOnDiscount != null) { spList.Add(spDiscountOnDiscount); } //循环克隆一份舱位 spList.ForEach(spPolicy => { IbeSeat ibeSeat = avhData.IbeData[j].IBESeat[k].Clone() as IbeSeat; if (ibeSeat != null) { ibeSeat.Policy = spPolicy.Point; ibeSeat.PolicySpecialType = spPolicy.PolicySpecialType; ibeSeat.SpecialPriceOrDiscount = spPolicy.SpecialPriceOrDiscount; ibeSeat.PolicyRMK = spPolicy.Remark; ibeSeat.PolicyId = spPolicy.PolicyId; ibeSeat.PlatformCode = spPolicy.PlatformCode; //处理特价 if (spPolicy.PolicySpecialType == EnumPolicySpecialType.FixedSpecial) { //固定特价不为0时 更改舱位价为固定特价 if (ibeSeat.SpecialPriceOrDiscount != 0) { ibeSeat.SeatPrice = ibeSeat.SpecialPriceOrDiscount; } } else if (spPolicy.PolicySpecialType == EnumPolicySpecialType.DownSpecial) { //直降 直降不为0时 舱位价中减除直降的价格 if (ibeSeat.SpecialPriceOrDiscount != 0) { ibeSeat.SeatPrice -= ibeSeat.SpecialPriceOrDiscount; } } else if (spPolicy.PolicySpecialType == EnumPolicySpecialType.DiscountOnDiscount) { //折上折 折扣不为0 在现有的舱位价上根据折扣再次计算 if (ibeSeat.SpecialPriceOrDiscount != 0) { decimal zk = ibeSeat.SpecialPriceOrDiscount / 100; ibeSeat.SeatPrice *= zk; //进到十位 ibeSeat.SeatPrice = dataBill.CeilAddTen((int)ibeSeat.SeatPrice); } } //舱位价小于0时为0处理 if (ibeSeat.SeatPrice <= 0) { ibeSeat.SeatPrice = 0; } ibeSeat.Commission = dataBill.GetCommission(spPolicy.Point, ibeSeat.SeatPrice, ibeSeat.ReturnMoney); //屏蔽非单程的非动态特价 //if (avhList.Count > 1 && ibeSeat.PolicySpecialType != EnumPolicySpecialType.DynamicSpecial) // return; //添加到集合 addRowList.Add(ibeSeat); } }); } } #endregion //普通舱位 PolicyCache policy = result.Where(p => p.PolicySpecialType == EnumPolicySpecialType.Normal).OrderByDescending(p => p.Point).FirstOrDefault(); if (policy != null) { //排除异地政策为0的显示 if (policy.PolicySourceType == EnumPolicySourceType.Share && policy.OldPoint == 0) { continue; } avhData.IbeData[j].IBESeat[k].Policy = policy.Point; avhData.IbeData[j].IBESeat[k].PolicySpecialType = policy.PolicySpecialType; avhData.IbeData[j].IBESeat[k].SpecialPriceOrDiscount = policy.SpecialPriceOrDiscount; avhData.IbeData[j].IBESeat[k].PolicyRMK = policy.Remark; avhData.IbeData[j].IBESeat[k].PolicyId = policy.PolicyId; avhData.IbeData[j].IBESeat[k].PlatformCode = policy.PlatformCode; avhData.IbeData[j].IBESeat[k].Commission = dataBill.GetCommission(policy.Point, avhData.IbeData[j].IBESeat[k].SeatPrice, avhData.IbeData[j].IBESeat[k].ReturnMoney); } } if (addRowList.Count > 0) { avhData.IbeData[j].IBESeat.AddRange(addRowList.ToArray()); } } } } } catch (Exception ex) { //记录日志 log.WriteLog("MatchPolicy", "异常信息:" + ex.Message + "\r\n"); } return(avhList); }
/// <summary> /// 获取IBE数据 /// </summary> /// <param name="FromCode"></param> /// <param name="ToCode"></param> /// <param name="FlyDate"></param> /// <returns></returns> public AVHData GetAvh(string FromCode, string ToCode, DateTime FlyDate, string carrayCode) { AVHData ibeData = new AVHData(); //记录日志 StringBuilder sbLog = new StringBuilder(); sbLog.Append("参数:\r\nFromCode=" + FromCode + "\r\n ToCode=" + ToCode + "\r\n FlyDate=" + FlyDate.ToString("yyyy-MM-dd HH:mm:ss") + (carrayCode != null ? carrayCode : "")); try { ibeData.IbeData = new List <IBERow>(); ibeData.QueryParam = new QueryParam() { FromCode = FromCode, ToCode = ToCode, FlyDate = FlyDate.ToString("yyy-MM-dd"), FlyTime = "00:00:00" }; string strData = string.Empty; if (useProxyQuery == 0) { IBEService.WebService1SoapClient ibe = new IBEService.WebService1SoapClient(); strData = ibe.getIBEAVData(ibeData.QueryParam.FromCode, ibeData.QueryParam.ToCode, ibeData.QueryParam.FlyDate, ibeData.QueryParam.FlyTime); } else if (useProxyQuery == 1) { FlightService flightService = ObjectFactory.GetInstance <FlightService>(); strData = flightService.GetAV(this.QueryParam.Code, ibeData.QueryParam.FromCode, ibeData.QueryParam.ToCode, carrayCode, ibeData.QueryParam.FlyDate, "0000"); } ibeData.AVHString = strData; if (!strData.Contains("NoRoutingException")) { string[] IbeArray = strData.Split(new string[] { "^" }, StringSplitOptions.RemoveEmptyEntries); if (IbeArray != null && IbeArray.Length > 0) { string[] strRow = null; foreach (string row in IbeArray) { strRow = row.ToUpper().Split(','); if (strRow.Length >= 15) { IBERow ibeRow = new IBERow(); try { //检测日期格式是否正确 DateTime.Parse(strRow[0]); } catch { strRow[0] = ibeData.QueryParam.FlyDate; } ibeRow.FlyDate = strRow[0]; ibeRow.StartTime = strRow[1]; ibeRow.EndTime = strRow[2]; ibeRow.CarrierCode = strRow[3].Trim(new char[] { '*' }); //过滤航空公司 if (!string.IsNullOrEmpty(carrayCode)) { if (ibeRow.CarrierCode != carrayCode.ToUpper()) { continue; } } ibeRow.FlightNo = strRow[4].Trim(new char[] { '*' }); if (!string.IsNullOrEmpty(strRow[5]) && strRow[5].Split('*')[0].Trim() != "") { string strSeat = strRow[5].Split('*')[0].Trim(); string pattern = "((?<Seat>[0-9A-Z])(?<SeatSymbol>[0-9A-Z]))"; MatchCollection mchs = Regex.Matches(strSeat, pattern, RegexOptions.IgnoreCase | RegexOptions.Compiled); ibeRow.IBESeat = new List <IbeSeat>(); foreach (Match item in mchs) { if (item.Success) { IbeSeat ibeseat = new IbeSeat(); ibeseat.Seat = item.Groups["Seat"].Value.Trim(); ibeseat.SeatSymbol = item.Groups["SeatSymbol"].Value.Trim(); if (ibeseat.SeatSymbol == "A") { ibeseat.SeatCount = ">9"; } else if (char.IsNumber(ibeseat.SeatSymbol[0])) { ibeseat.SeatCount = ibeseat.SeatSymbol; } else { ibeseat.SeatCount = "0"; } //过滤没有位置的舱位 int mSeatCount = 0; int.TryParse(ibeseat.SeatCount.Replace(">", ""), out mSeatCount); if (mSeatCount > 0) { ibeseat = SetDefaultData(ibeseat); //去重 if (!ibeRow.IBESeat.Exists(p => p.Seat == ibeseat.Seat)) { ibeRow.IBESeat.Add(ibeseat); } } } } } ibeRow.FromCode = strRow[6]; ibeRow.ToCode = strRow[7]; ibeRow.AirModel = strRow[8]; ibeRow.IsStop = strRow[9].Trim() == "1" ? true : false; ibeRow.IsMeals = strRow[10].Trim() == "1" ? true : false; ibeRow.IsElectronicTicket = strRow[11].Trim() == "1" ? true : false; ibeRow.IsShareFlight = (strRow[12].Trim().ToLower() == "1" || strRow[12].Trim().ToLower() == "true") ? true : false; //处理子舱位 ibeRow.ChildSeat = strRow[13].Trim(); if (!string.IsNullOrEmpty(ibeRow.ChildSeat)) { string pattern = "((?<Seat>[0-9A-Z]1)(?<SeatSymbol>[0-9A-Z]))"; MatchCollection mchs = Regex.Matches(ibeRow.ChildSeat, pattern, RegexOptions.IgnoreCase | RegexOptions.Compiled); if (ibeRow.IBESeat == null) { ibeRow.IBESeat = new List <IbeSeat>(); } foreach (Match item in mchs) { if (item.Success) { IbeSeat ibeseat = new IbeSeat(); ibeseat.Seat = item.Groups["Seat"].Value.Trim(); ibeseat.SeatSymbol = item.Groups["SeatSymbol"].Value.Trim(); if (ibeseat.SeatSymbol == "A") { ibeseat.SeatCount = ">9"; } else if (char.IsNumber(ibeseat.SeatSymbol[0])) { ibeseat.SeatCount = ibeseat.SeatSymbol; } else { ibeseat.SeatCount = "0"; } //过滤没有位置的舱位 int mSeatCount = 0; int.TryParse(ibeseat.SeatCount.Replace(">", ""), out mSeatCount); if (mSeatCount > 0) { ibeseat = SetDefaultData(ibeseat); //去重 if (!ibeRow.IBESeat.Exists(p => p.Seat == ibeseat.Seat)) { ibeRow.IBESeat.Add(ibeseat); } } } } } string strFromCityT1 = strRow[14].Trim(); if (strFromCityT1.Length == 2) { strFromCityT1 = strFromCityT1.Substring(0, 1); } else if (strFromCityT1.Length == 3) { if (strFromCityT1.StartsWith("D")) { strFromCityT1 = strFromCityT1.Substring(0, 1); } else { strFromCityT1 = strFromCityT1.Substring(0, 2); } } else { if ((strFromCityT1.Length >= 2)) { strFromCityT1 = strFromCityT1.Substring(0, 2); } } ibeRow.FromCityT1 = getHZL(ibeRow.FromCode, ibeRow.CarrierCode, strFromCityT1); string strToCityT1 = strRow[14].Trim(); if (strToCityT1.Length == 2) { strToCityT1 = strToCityT1.Substring(1, 1); } else if (strToCityT1.Length == 3) { if (strToCityT1.StartsWith("D")) { strToCityT1 = strToCityT1.Substring(1, 2); } else { strToCityT1 = strToCityT1.Substring(2, 1); } } else { if ((strToCityT1.Length >= 4)) { strToCityT1 = strToCityT1.Substring(2, 2); } } ibeRow.ToCityT1 = getHZL(ibeRow.ToCode, ibeRow.CarrierCode, strToCityT1); if (ibeRow.IsShareFlight) { if (IsOpenShareflght)//过滤共享航班 { //过去完后添加集合 ibeData.IbeData.Add(ibeRow); } } else { //添加集合 ibeData.IbeData.Add(ibeRow); } } } } } else { sbLog.Append("IBE异常信息:" + strData + "\r\n"); } } catch (Exception ex) { sbLog.Append("异常信息:" + ex.Message + "\r\n"); //记录日志 log.WriteLog("GetAvh", sbLog.ToString()); } return(ibeData); }