Beispiel #1
0
        private List <PostponeApplyformView.Item> getPostponeVoyages(string voyages, ChinaPay.B3B.Service.Order.Domain.Order order)
        {
            var result = new List <PostponeApplyformView.Item>();

            foreach (var item in voyages.Split('^'))
            {
                foreach (var o in order.PNRInfos)
                {
                    var s = item.Split('|');
                    if (s.Count() != 5)
                    {
                        InterfaceInvokeException.ThrowParameterErrorException("航班信息");
                    }
                    if (s[0].Length != 6)
                    {
                        InterfaceInvokeException.ThrowParameterErrorException("城市对");
                    }
                    var departure  = s[0].Substring(0, 3).ToUpper();
                    var arrival    = s[0].Substring(3, 3).ToUpper();
                    var flightNo   = s[1];
                    var flightTime = s[2];
                    var j          = o.Flights.FirstOrDefault(i => i.Departure.Code == departure && i.Arrival.Code == arrival && i.FlightNo == flightNo && i.TakeoffTime.Date == DateTime.Parse(flightTime));
                    if (j != null)
                    {
                        if (result.FirstOrDefault(f => f.Voyage == j.Id) != null)
                        {
                            InterfaceInvokeException.ThrowCustomMsgException("当前申请的改期存在两个以上的相同航班信息,请核对航班信息");
                        }
                        result.Add(new PostponeApplyformView.Item()
                        {
                            Voyage        = j.Id,
                            NewFlightNo   = s[3],
                            NewFlightDate = DateTime.Parse(s[4])
                        });
                        break;
                    }
                    else
                    {
                        InterfaceInvokeException.ThrowCustomMsgException("当前订单中不存在[" + item + "]的航班信息,请核对航班信息是否有误");
                    }
                }
            }
            return(result);
        }
Beispiel #2
0
        private decimal ApplyRefundObj(ChinaPay.B3B.Service.Order.Domain.Order order, string refundType, string passengers, string voyages, string reason)
        {
            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))
                        {
                            InterfaceInvokeException.ThrowCustomMsgException("当前订单中存在不同的编码");
                        }
                        foreach (var f in voyages.Split('^'))
                        {
                            if (f.Split('|').Count() < 3)
                            {
                                InterfaceInvokeException.ThrowParameterErrorException("航班信息");
                            }
                            if (f.Split('|')[0].Length != 6)
                            {
                                InterfaceInvokeException.ThrowParameterErrorException("城市对");
                            }
                            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 == "")
            {
                InterfaceInvokeException.ThrowCustomMsgException("当前订单中没有找到对应的乘机人信息");
            }
            if (vid == "")
            {
                InterfaceInvokeException.ThrowCustomMsgException("当前订单中没有找到对应的航班信息");
            }
            if (!_pnrCode.Any())
            {
                InterfaceInvokeException.ThrowCustomMsgException("当前订单中没有找到对应的编码信息");
            }

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

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

            ReturnStringUtility.releaseLock(order.Id, Company, Employee);
            return(apply.Id);
        }
Beispiel #3
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);
        }