Ejemplo n.º 1
0
        private decimal ApplyRefundObj(Order order)
        {
            RefundOrScrapApplyformView applyformView = null;

            if (_refundType == "-1")
            {
                applyformView = new ScrapApplyformView();
            }
            else
            {
                applyformView = new RefundApplyformView()
                {
                    RefundType = (RefundType)int.Parse(_refundType)
                };
            }
            var            app      = Service.ApplyformQueryService.QueryApplyforms(order.Id);
            string         pid      = "";
            string         vid      = "";
            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))
                        {
                            throw new InterfaceInvokeException("9", "当前订单中存在不同的编码");
                        }
                        foreach (var f in _voyages.Split('^'))
                        {
                            if (f.Split('|').Count() < 3)
                            {
                                throw new InterfaceInvokeException("1", "航班信息");
                            }
                            if (f.Split('|')[0].Length != 6)
                            {
                                throw new InterfaceInvokeException("1", "城市对");
                            }
                            var departure  = f.Split('|')[0].Substring(0, 3).ToUpper();
                            var arrival    = f.Split('|')[0].Substring(3, 3).ToUpper();
                            var flightNo   = f.Split('|')[1];
                            var flightTime = f.Split('|')[2];
                            var ff         = o.Flights.FirstOrDefault(i => i.Departure.Code == departure && i.Arrival.Code == arrival && i.FlightNo == flightNo && i.TakeoffTime.Date == DateTime.Parse(flightTime));
                            if (ff != null)
                            {
                                if (!vid.Split(',').Contains(ff.Id.ToString()))
                                {
                                    if (vid != "")
                                    {
                                        vid += "," + ff.Id.ToString();
                                    }
                                    else
                                    {
                                        vid += ff.Id.ToString();
                                    }
                                }
                            }
                        }
                        break;
                    }
                }
            }
            if (pid == "")
            {
                throw new InterfaceInvokeException("9", "当前订单中没有找到对应的乘机人信息");
            }
            if (vid == "")
            {
                throw new InterfaceInvokeException("9", "当前订单中没有找到对应的航班信息");
            }
            if (!_pnrCode.Any())
            {
                throw new InterfaceInvokeException("9", "当前订单中没有找到对应的编码信息");
            }

            applyformView.PNR        = _pnrCode.FirstOrDefault();
            applyformView.Passengers = ApplyOrder.getPassengers(pid);
            applyformView.Reason     = _reason;
            foreach (var item in ApplyOrder.getRefundVoyages(vid))
            {
                applyformView.AddVoyage(item);
            }
            string lockErrorMsg = "";

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

            releaseLock(order.Id);
            return(apply.Id);
        }
Ejemplo n.º 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);
        }