Exemple #1
0
 /// <summary>
 /// 申请改期
 /// </summary>
 /// <param name="orderId">订单号</param>
 /// <param name="pnrCode">编码(小编码|大编码)</param>
 /// <param name="passengers">乘机人(乘机人id,以','隔开)</param>
 /// <param name="voyages">航段(航段id|新航班号|新航班日期,以','隔开)</param>
 /// <param name="remark">改期备注</param>
 public string ApplyPostpone(decimal orderId, string pnrCode, string passengers, string voyages, string remark, string carrair)
 {
     try
     {
         var applyformView = new PostponeApplyformView()
         {
             PNR        = getPNRPair(pnrCode),
             Passengers = getPassengers(passengers),
             Reason     = remark
         };
         var flightChangeLimit = SystemDictionaryService.Query(SystemDictionaryType.FlightChangeLimit);
         var limit             = LimitItem.Parse(flightChangeLimit);
         foreach (var item in getPostponeVoyages(voyages))
         {
             bool isTodayFlight = DateTime.Today == item.NewFlightDate.Date;
             foreach (LimitItem l in limit)
             {
                 if (carrair.ToUpper() != l.Carrair.ToUpper())
                 {
                     continue;
                 }
                 if (item.NewFlightDate >= l.LimitFrom && item.NewFlightDate <= l.LimitTo && (!isTodayFlight || !l.ToTodayEnable))
                 {
                     var aline = FoundationService.Airlines.FirstOrDefault(p => p.Code.Value == l.Carrair);
                     throw new CustomException("由于[" + aline.ShortName + "]原因,该客票已被航空公司限制改期,无法改期,请让乘机人自行致电航空公司或到航空公司直营柜台办理改期");
                 }
             }
             applyformView.AddItem(item);
         }
         var applyform = OrderProcessService.Apply(orderId, applyformView, CurrentUser, BasePage.OwnerOEMId) as PostponeApplyform;
         releaseLock(orderId);
         return(OK);
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
 }
Exemple #2
0
        private decimal ApplyPostponeOrder(ChinaPay.B3B.Service.Order.Domain.Order order, string passengers, string reason, string voyages)
        {
            string         pid      = "";
            List <PNRPair> _pnrCode = new List <PNRPair>();

            foreach (var item in passengers.Split('^'))
            {
                foreach (var o in order.PNRInfos)
                {
                    var j = o.Passengers.FirstOrDefault(i => i.Name == item);
                    if (j != null)
                    {
                        if (pid != "")
                        {
                            pid += "," + j.Id.ToString();
                        }
                        else
                        {
                            pid += j.Id.ToString();
                        }
                        _pnrCode.Add(o.Code);
                        if (!_pnrCode.Contains(o.Code))
                        {
                            InterfaceInvokeException.ThrowCustomMsgException("当前订单中存在不同的编码");
                        }
                        break;
                    }
                }
            }
            if (pid == "")
            {
                InterfaceInvokeException.ThrowCustomMsgException("当前订单中没有找到对应的乘机人信息");
            }
            if (!_pnrCode.Any())
            {
                InterfaceInvokeException.ThrowCustomMsgException("当前订单中没有找到对应的编码信息");
            }
            var ids           = ApplyOrder.getPassengers(pid);
            var applyformView = new PostponeApplyformView()
            {
                PNR        = _pnrCode.FirstOrDefault(),
                Passengers = ids,
                Reason     = reason
            };
            var flightChangeLimit = SystemDictionaryService.Query(SystemDictionaryType.FlightChangeLimit);
            var limit             = LimitItem.Parse(flightChangeLimit);



            foreach (var item in getPostponeVoyages(voyages, order))
            {
                bool isTodayFlight = DateTime.Today == item.NewFlightDate.Date;
                foreach (LimitItem l in limit)
                {
                    if (order.PNRInfos.First().Flights.First().Carrier.Code != l.Carrair.ToUpper())
                    {
                        continue;
                    }
                    if (item.NewFlightDate >= l.LimitFrom && item.NewFlightDate <= l.LimitTo && (!isTodayFlight || !l.ToTodayEnable))
                    {
                        var aline = FoundationService.Airlines.FirstOrDefault(p => p.Code.Value == l.Carrair);
                        InterfaceInvokeException.ThrowCustomMsgException("由于[" + aline.ShortName + "]原因,该客票已被航空公司限制改期,无法改期,请让乘机人自行致电航空公司或到航空公司直营柜台办理改期");
                    }
                }
                applyformView.AddItem(item);
            }
            string lockErrorMsg = "";

            Lock(order.Id, Service.Locker.LockRole.Purchaser, "申请退改签", out lockErrorMsg);
            if (!string.IsNullOrEmpty(lockErrorMsg))
            {
                InterfaceInvokeException.ThrowCustomMsgException(lockErrorMsg);
            }
            var apply = Service.OrderProcessService.Apply(order.Id, applyformView, Employee, Guid.Empty);

            releaseLock(order.Id);
            return(apply.Id);
        }