public string GetPnrNo(int orderid, string email)
        {
            string isServer = AppSettingsHelper.GetAppSettings(AppSettingsEnum.IsServer);

            if (isServer != "T")//如果不是生产环境,不定位
            {
                return(string.Empty);
            }
            FltOrderEntity orderEntity = _fltOrderDal.Find <FltOrderEntity>(orderid);

            if ((orderEntity.ProcessStatus & 1) == 1)//如果已经定位,则不再定位
            {
                return(string.Empty);
            }
            string pnrNo = _doPnrNoBll.DoPnrNo(orderid, orderEntity.CreateOid);

            if (!string.IsNullOrEmpty(pnrNo))
            {
                //定位成功之后,设置已定位
                orderEntity.ProcessStatus = orderEntity.ProcessStatus + 1;
                _fltOrderDal.Update(orderEntity, new string[] { "ProcessStatus" });
                _fltOrderLogDal.Insert(new FltOrderLogEntity()
                {
                    OrderId = orderEntity.OrderId,
                    LogTime = DateTime.Now,
                    LogType = "修改订单",
                    Oid     = "sys",
                    Remark  = "线上订单,设置已定位" + pnrNo
                });
            }
            else
            {
                if (!string.IsNullOrEmpty(email))
                {
                    string url = string.Format("http://192.168.1.188/orderprocess/Flt_order.asp?orderid={0}",
                                               orderid);
                    string content = string.Format("订单号:<a  href='{0}' >{1}</a>", url, orderid);
                    new TaskFactory().StartNew(() =>
                    {
                        EmailHelper.SendEmail("", "国内机票定位异常", null, null, content, email);
                    });
                }
            }
            return(pnrNo);
        }
示例#2
0
        public int CancelOnlineCorpOrder(int orderId, int cid, string remark)
        {
            FltOrderEntity orderEntity = _fltOrderDal.Find <FltOrderEntity>(orderId);

            if (orderEntity == null)
            {
                throw new Exception("查无此订单");
            }
            if (cid != orderEntity.Cid)
            {
                throw new Exception("查无此订单");
            }
            if (orderEntity.Orderstatus == "C")
            {
                throw new Exception("此订单已取消");
            }

            if ((orderEntity.ProcessStatus & 8) == 8)
            {
                throw new Exception("此订单已经出票,不能取消");
            }


            FltOrderLogEntity log = new FltOrderLogEntity()
            {
                OrderId = orderEntity.OrderId,
                LogTime = DateTime.Now,
                LogType = "修改订单"
            };

            orderEntity.Orderstatus = "C";
            orderEntity.CancelType  = "C";
            orderEntity.Remark      = (orderEntity.Remark ?? "") + ",客户自行取消";
            orderEntity.Oid         = "sys";
            log.Remark = "操作人:" + cid + ",原因:" + remark;

            _fltOrderDal.Update(orderEntity, new string[] { "Orderstatus", "CancelType", "Remark", "Oid" });

            _fltOrderLogDal.Insert(log);

            return(0);
        }
示例#3
0
        /// <summary>
        /// 复制差旅订单
        /// </summary>
        /// <param name="copyFltOrderModel"></param>
        /// <returns></returns>
        public int CopyOrder(CopyFltOrderModel copyFltOrderModel)
        {
            FltOrderEntity copyFromOrderEntity = _fltOrderDal.Find <FltOrderEntity>(copyFltOrderModel.CopyFromOrderId);

            if (copyFromOrderEntity == null)
            {
                throw new Exception("复制来源订单异常");
            }
            List <FltFlightEntity> copyFromFlightEntities =
                _fltFlightDal.Query <FltFlightEntity>(n => n.OrderId == copyFltOrderModel.CopyFromOrderId, true).ToList();

            List <FltPassengerEntity> copyFromPassengerEntities =
                _fltPassengerDal.Query <FltPassengerEntity>(n => n.OrderId == copyFltOrderModel.CopyFromOrderId, true)
                .ToList();

            List <FltTicketNoEntity> copyFromTicketNoEntities =
                _fltTicketNoDal.Query <FltTicketNoEntity>(n => n.OrderId == copyFltOrderModel.CopyFromOrderId, true)
                .ToList();

            FltOrderUnionEntity copyFromOrderUnionEntity =
                _fltOrderUnionDal.Find <FltOrderUnionEntity>(copyFltOrderModel.CopyFromOrderId);

            FltCorpCostCenterEntity copyFromCostCenterEntity =
                _fltCorpCostCenterDal.Find <FltCorpCostCenterEntity>(copyFltOrderModel.CopyFromOrderId);

            FltOrderEntity          fltOrderEntity          = Mapper.Map <FltOrderEntity, FltOrderEntity>(copyFromOrderEntity);
            FltOrderUnionEntity     fltOrderUnionEntity     = Mapper.Map <FltOrderUnionEntity, FltOrderUnionEntity>(copyFromOrderUnionEntity);
            FltCorpCostCenterEntity fltCorpCostCenterEntity =
                Mapper.Map <FltCorpCostCenterEntity, FltCorpCostCenterEntity>(copyFromCostCenterEntity);

            List <FltFlightEntity> fltFlightEntities =
                Mapper.Map <List <FltFlightEntity>, List <FltFlightEntity> >(copyFromFlightEntities);
            List <FltPassengerEntity> fltPassengerEntities =
                Mapper.Map <List <FltPassengerEntity>, List <FltPassengerEntity> >(copyFromPassengerEntities);
            List <FltTicketNoEntity> fltTicketNoEntities =
                Mapper.Map <List <FltTicketNoEntity>, List <FltTicketNoEntity> >(copyFromTicketNoEntities);


            fltOrderEntity.Payamount           = copyFltOrderModel.PayAmount;
            fltOrderEntity.CreditcardfeeAmount = copyFltOrderModel.CreditCardfeeamount;
            fltOrderEntity.Voucheramount       = copyFltOrderModel.Voucheramount;
            fltOrderEntity.SendTicketAmount    = copyFltOrderModel.SendTicketamount;
            fltOrderEntity.Totalamount         = fltOrderEntity.Payamount + fltOrderEntity.CreditcardfeeAmount;
            fltOrderEntity.CreateOid           = copyFltOrderModel.CreateOid;
            if (string.IsNullOrEmpty(fltOrderEntity.Remark))
            {
                fltOrderEntity.Remark = "无";
            }

            fltOrderEntity.ReturnAccountOid  = "";
            fltOrderEntity.ReturnAccountTime = null;
            fltOrderEntity.OutTicketStatus   = "N";
            fltOrderEntity.ProcessStatus     = 1;
            fltOrderEntity.Orderstatus       = "P";

            if (string.IsNullOrEmpty(fltOrderEntity.Description))
            {
                fltOrderEntity.Description = ",";
            }
            if (string.IsNullOrEmpty(fltOrderEntity.IsOnLinePay))
            {
                fltOrderEntity.IsOnLinePay = "F";
            }
            if (string.IsNullOrEmpty(fltOrderEntity.SendTicketType))
            {
                fltOrderEntity.SendTicketType = SendTicketTypeEnum.Not.ToString();
            }

            fltOrderEntity.RealAcceptDatetime = null;
            fltOrderEntity.RealPayDatetime    = null;
            fltOrderEntity.Collectiontime     = null;
            fltOrderEntity.CollectionOid      = string.Empty;
            fltOrderEntity.PrintTicketOid     = null;
            fltOrderEntity.PrintTicketTime    = null;
            fltOrderEntity.PrintOrderTime     = null;

            if (copyFltOrderModel.CopyType == "X")//虚出复制
            {
                //判断当前原始订单是否有虚退
                int xuTuiCount = _fltRetModApplyDal.Query <FltRetModApplyEntity>(
                    n => n.OrderType.ToUpper() == "R" &&
                    n.OrderId == copyFltOrderModel.CopyFromOrderId && n.OrderStatus.ToUpper() != "C" &&
                    n.RefundType == "虚退").Count();
                if (xuTuiCount == 0)
                {
                    throw new Exception("当前订单不存在虚退,不允许虚退复制");
                }


                fltOrderEntity.OrderDate = copyFromOrderEntity.OrderDate;
                fltOrderEntity.CopyType  = "X";
                //如果当前原始订单不是虚退复制的订单
                if (string.IsNullOrEmpty(copyFromOrderEntity.CopyType))
                {
                    fltOrderEntity.CopyFromOrderId = copyFltOrderModel.CopyFromOrderId;
                }
                else
                {
                    if (copyFromOrderEntity.CopyType == "X" && copyFromOrderEntity.CopyFromOrderId.HasValue)
                    {
                        fltOrderEntity.CopyFromOrderId = copyFromOrderEntity.CopyFromOrderId;
                    }
                    else
                    {
                        fltOrderEntity.CopyFromOrderId = copyFltOrderModel.CopyFromOrderId;
                    }
                }
            }
            else
            {
                fltOrderEntity.CopyType        = "C";
                fltOrderEntity.CopyFromOrderId = copyFltOrderModel.CopyFromOrderId;
                fltOrderEntity.OrderDate       = DateTime.Now;
            }

            fltOrderEntity = _fltOrderDal.Insert(fltOrderEntity);

            if (fltOrderUnionEntity != null)
            {
                fltOrderUnionEntity.OrderId           = fltOrderEntity.OrderId;
                fltOrderUnionEntity.FivePrintId       = null;
                fltOrderUnionEntity.FivePrintLastTime = null;
                fltOrderUnionEntity.IsNeedPrintTime   = null;
                if (string.IsNullOrEmpty(fltOrderUnionEntity.IsMobile))
                {
                    fltOrderUnionEntity.IsMobile = "F";
                }
                _fltOrderUnionDal.Insert(fltOrderUnionEntity);
            }

            foreach (var fltFlightEntity in fltFlightEntities)
            {
                CopyFltFlightModel copyFltFlightModel =
                    copyFltOrderModel.FlightList.Find(n => n.Sequence == fltFlightEntity.Sequence);
                if (string.IsNullOrEmpty(fltFlightEntity.RecordNo))
                {
                    fltFlightEntity.RecordNo = "AAAAAA";
                }
                fltFlightEntity.OrderId   = fltOrderEntity.OrderId;
                fltFlightEntity.Sequence  = copyFltFlightModel.Sequence;
                fltFlightEntity.OilFee    = copyFltFlightModel.OilFee;
                fltFlightEntity.Rate      = copyFltFlightModel.Rate;
                fltFlightEntity.SalePrice = copyFltFlightModel.SalePrice;
                fltFlightEntity.TaxFee    = copyFltFlightModel.TaxFee;
                if (string.IsNullOrEmpty(fltFlightEntity.Airportson))
                {
                    fltFlightEntity.Airportson = "----";
                }
                _fltFlightDal.Insert(fltFlightEntity);
            }

            foreach (var fltPassengerEntity in fltPassengerEntities)
            {
                fltPassengerEntity.OrderId = fltOrderEntity.OrderId;
                if (string.IsNullOrEmpty(fltPassengerEntity.Remark))
                {
                    fltPassengerEntity.Remark = "无";
                }
                _fltPassengerDal.Insert(fltPassengerEntity);
            }

            if (fltTicketNoEntities != null && fltTicketNoEntities.Count > 0)
            {
                foreach (var fltTicketNoEntity in fltTicketNoEntities)
                {
                    fltTicketNoEntity.OrderId = fltOrderEntity.OrderId;
                    _fltTicketNoDal.Insert(fltTicketNoEntity);
                }
            }

            if (fltCorpCostCenterEntity != null)
            {
                fltCorpCostCenterEntity.Orderid = fltOrderEntity.OrderId;
                _fltCorpCostCenterDal.Insert <FltCorpCostCenterEntity>(fltCorpCostCenterEntity);
            }

            FltOrderLogEntity log = new FltOrderLogEntity()
            {
                OrderId = fltOrderEntity.OrderId,
                LogTime = DateTime.Now,
                LogType = "新建订单",
                Remark  = "复制订单,来源订单号:" + copyFltOrderModel.CopyFromOrderId + ",马甲订单号:" + fltOrderEntity.CopyFromOrderId,
                Oid     = fltOrderEntity.CreateOid
            };

            _fltOrderLogDal.Insert(log);


            //将原始订单设置为线上隐藏
            if (copyFltOrderModel.CopyType == "X")
            {
                copyFromOrderEntity.IsOnlineShow = 1;
                _fltOrderDal.Update(copyFromOrderEntity, new string[] { "IsOnlineShow" });
            }

            return(fltOrderEntity.OrderId);
        }
示例#4
0
        /// <summary>
        /// 一级审核
        /// </summary>
        /// <param name="firstAudit"></param>
        /// <returns></returns>
        public AuditResultModel DoFirstAudit(AuditOrderFirst firstAudit)
        {
            FltOrderEntity    fltOrderEntity = _fltOrderDal.Find <FltOrderEntity>(_query.Id);
            FltOrderLogEntity log            = new FltOrderLogEntity()
            {
                OrderId = fltOrderEntity.OrderId,
                LogTime = DateTime.Now,
                LogType = "审批订单",
                Oid     = "sys"
            };



            #region 审批操作

            bool          isSendEmail = false;
            List <string> properties  = new List <string>();
            if (IsAgree)
            {
                bool isHasSecond = _query.FltOrder.CPIdSecond.HasValue; //是否存在二级审批

                if (!isHasSecond)
                {
                    //1.2 如果不存在二级审批,则直接通过
                    fltOrderEntity.CheckStatus = FltOrderCheckStatusEnum.W.ToString();
                    log.Remark = string.Format("已通过{0}审批", _query.AuditCustomer?.RealName);
                }
                else
                {
                    isSendEmail = true;
                    //1.2 如果存在二级审批,则发送二级审批邮件
                    fltOrderEntity.CheckStatus = FltOrderCheckStatusEnum.S.ToString();
                    log.Remark = string.Format("已通过{0}审批,待二级审核", _query.AuditCustomer?.RealName);
                }
                properties.Add("CheckStatus");
            }
            else
            {
                //2.否决审批
                //2.1 取消订单
                if ((fltOrderEntity.ProcessStatus & 8) == 8)
                {
                    throw new Exception("该订单已经出票,不能否决,请联系客服");
                }
                fltOrderEntity.CheckStatus = FltOrderCheckStatusEnum.J.ToString();
                fltOrderEntity.Orderstatus = "C";
                fltOrderEntity.CancelType  = "C";
                //log.Remark = "订单审核状态:一级审核不通过。一级审核人:" + _query.AuditCustomer?.RealName;
                log.Remark = string.Format("已被{0}拒绝", _query.AuditCustomer?.RealName);
                properties.Add("CheckStatus");
                properties.Add("CancelType");
                properties.Add("Orderstatus");
            }

            #endregion



            _fltOrderDal.Update(fltOrderEntity, properties.ToArray());
            _fltOrderLogDal.Insert(log);

            //发送邮件
            if (isSendEmail)
            {
                SendEmail(fltOrderEntity);
            }

            return(new AuditResultModel()
            {
                Code = 0,
                AuditResult = log.Remark,
                NextAuditCid = fltOrderEntity.CPIdSecond,
                OwnCid = fltOrderEntity.Cid,
                Id = fltOrderEntity.OrderId,
                OrderType = OrderSourceTypeEnum.Flt
            });
        }