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);
        }
Esempio n. 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);
        }
Esempio n. 3
0
        private int AddOrder(FltOrderEntity splitFromOrderEntity, FltOrderUnionEntity splitFromOrderUnionEntity,
                             FltCorpCostCenterEntity splitFromCostCenterEntity, List <FltFlightEntity> splitFromFlightEntities,
                             FltPassengerEntity splitFromPassengerEntity, bool isFirst, string oid)
        {
            FltOrderEntity      fltOrderEntity      = Mapper.Map <FltOrderEntity, FltOrderEntity>(splitFromOrderEntity);
            FltOrderUnionEntity fltOrderUnionEntity =
                Mapper.Map <FltOrderUnionEntity, FltOrderUnionEntity>(splitFromOrderUnionEntity);
            List <FltFlightEntity> fltFlightEntities =
                Mapper.Map <List <FltFlightEntity>, List <FltFlightEntity> >(splitFromFlightEntities);
            FltCorpCostCenterEntity fltCorpCostCenterEntity =
                Mapper.Map <FltCorpCostCenterEntity, FltCorpCostCenterEntity>(splitFromCostCenterEntity);
            FltPassengerEntity fltPassengerEntity =
                Mapper.Map <FltPassengerEntity, FltPassengerEntity>(splitFromPassengerEntity);

            fltOrderEntity.Payamount =
                fltFlightEntities.Sum(n => (n.SalePrice ?? 0) + n.TaxFee + (n.OilFee ?? 0) + (n.ServiceFee ?? 0));

            if (fltPassengerEntity.InsuranceCount.HasValue && fltPassengerEntity.InsuranceCount.Value > 0)
            {
                fltOrderEntity.Payamount = fltOrderEntity.Payamount +
                                           (fltPassengerEntity.InsuranceCount.Value * (fltPassengerEntity.Insurance ?? 0));
            }

            if (!isFirst)
            {
                fltOrderEntity.CreditcardfeeAmount = 0;
                fltOrderEntity.Voucheramount       = 0;
                fltOrderEntity.SendTicketAmount    = 0;
            }

            fltOrderEntity.Totalamount = fltOrderEntity.Payamount + fltOrderEntity.CreditcardfeeAmount;

            if (string.IsNullOrEmpty(fltOrderEntity.Remark))
            {
                fltOrderEntity.Remark = "无";
            }

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

            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;
            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)
            {
                fltFlightEntity.OrderId = fltOrderEntity.OrderId;
                if (string.IsNullOrEmpty(fltFlightEntity.RecordNo))
                {
                    fltFlightEntity.RecordNo = "AAAAAA";
                }
                if (string.IsNullOrEmpty(fltFlightEntity.Airportson))
                {
                    fltFlightEntity.Airportson = "----";
                }
                _fltFlightDal.Insert(fltFlightEntity);
            }

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

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

            FltOrderLogEntity log = new FltOrderLogEntity()
            {
                OrderId = fltOrderEntity.OrderId,
                LogTime = DateTime.Now,
                LogType = "新建订单",
                Remark  = "拆分订单,来源订单号:" + splitFromOrderEntity.OrderId,
                Oid     = fltOrderEntity.CreateOid
            };

            _fltOrderLogDal.Insert(log);

            return(fltOrderEntity.OrderId);
        }
Esempio n. 4
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);
        }
Esempio n. 5
0
        public int AddOrder(AddOrderModel fltAddOrderModel)
        {
            string json = JsonConvert.SerializeObject(fltAddOrderModel);

            LogHelper.WriteLog(json, "MojoryApiAddDomesticOrder");

            FltOrderEntity fltOrderEntity = Mapper.Map <AddOrderModel, FltOrderEntity>(fltAddOrderModel);

            fltOrderEntity.OrderDate   = DateTime.Now;
            fltOrderEntity.IsInter     = "N";
            fltOrderEntity.Oid         = fltOrderEntity.CreateOid;
            fltOrderEntity.Orderstatus = "W";

            if (!string.IsNullOrEmpty(fltOrderEntity.CreateOid) && fltOrderEntity.CreateOid.ToLower() != "sys")
            {
                fltOrderEntity.Orderstatus = "P";
            }


            fltOrderEntity.OrderType      = "T";
            fltOrderEntity.IsModandChange = "F";
            fltOrderEntity.IsTA           = "F";

            fltOrderEntity.CorpAduitId  = fltAddOrderModel.CorpAduitId;
            fltOrderEntity.CorpPolicyId = fltAddOrderModel.CorpPolicyId;

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

            string choiceReason = string.Concat(
                fltAddOrderModel.FlightList.Select(n => string.IsNullOrEmpty(n.ChoiceReason) ? "" : "/" + n.ChoiceReason)
                );

            if (!string.IsNullOrEmpty(choiceReason))
            {
                choiceReason = choiceReason.Substring(1);
            }
            if (!string.IsNullOrEmpty(choiceReason) && !choiceReason.Contains("/"))
            {
                choiceReason = "/" + choiceReason;
            }

            fltOrderEntity.ChoiceReason = choiceReason;
            fltOrderEntity.Totalamount  = fltOrderEntity.Payamount + fltOrderEntity.Voucheramount;//订单总价加上优惠的金额
            fltAddOrderModel.FlightList.ForEach(n =>
            {
                fltOrderEntity.Allport += "-" + n.Dport + n.Aport;//SHAPEK-PEKSHA
            });
            if (!string.IsNullOrEmpty(fltOrderEntity.Allport))
            {
                fltOrderEntity.Allport = fltOrderEntity.Allport.Substring(1);
            }
            fltOrderEntity.OutTicketStatus = "N";

            if (!string.IsNullOrEmpty(fltAddOrderModel.Customer?.CorpID) &&
                fltAddOrderModel.Customer?.CorpID.ToLower() == "mzl")
            {
                fltOrderEntity.BuyRemark       = fltOrderEntity.BuyRemark + "测试订单,请勿出票";
                fltOrderEntity.IsAutoOutTicket = 1;//测试公司下的订单统一转为人工出票,防止自动出票直接出票了
            }

            fltOrderEntity = _fltOrderDal.Insert(fltOrderEntity);



            FltOrderUnionEntity fltOrderUnionEntity = new FltOrderUnionEntity();

            fltOrderUnionEntity.OrderId = fltOrderEntity.OrderId;
            if (string.IsNullOrEmpty(fltOrderUnionEntity.IsMobile))
            {
                fltOrderUnionEntity.IsMobile = "F";
            }
            fltOrderUnionEntity.IsAutoInsurance = "F";
            fltOrderUnionEntity.CorpId          = fltAddOrderModel.Customer != null
                ? fltAddOrderModel.Customer.CorpID
                : string.Empty;

            fltOrderUnionEntity.CorpDepartId = fltAddOrderModel.CorpDepartId;

            string corpPolicy = string.Concat(
                fltAddOrderModel.FlightList.Select(n => string.IsNullOrEmpty(n.CorpPolicy) ? "" : "|" + n.CorpPolicy)
                );

            if (!string.IsNullOrEmpty(corpPolicy))
            {
                corpPolicy = corpPolicy.Substring(1);
            }
            if (!string.IsNullOrEmpty(corpPolicy) && !corpPolicy.Contains("|"))
            {
                corpPolicy = "|" + corpPolicy;
            }

            fltOrderUnionEntity.CorpPolicy = corpPolicy;
            if (!string.IsNullOrEmpty(fltOrderUnionEntity.CorpPolicy))
            {
                if (fltOrderUnionEntity.CorpPolicy.Contains("提前"))
                {
                    fltOrderUnionEntity.IsPolicyT = "T";
                }
                if (fltOrderUnionEntity.CorpPolicy.Contains("折以下的航班"))
                {
                    fltOrderUnionEntity.IsPolicyR = "T";
                }
                if (fltOrderUnionEntity.CorpPolicy.Contains("分钟内最低航班"))
                {
                    fltOrderUnionEntity.IsPolicyL = "T";
                }
            }
            fltOrderUnionEntity.LostAmount  = fltAddOrderModel.FlightList.Sum(n => n.LostAmount);
            fltOrderUnionEntity.ProjectId   = fltAddOrderModel.ProjectId;
            fltOrderUnionEntity.BalanceType = fltAddOrderModel.BalanceType;
            fltOrderUnionEntity.TravelType  = fltAddOrderModel.TravelType;
            _fltOrderUnionDal.Insert(fltOrderUnionEntity);

            List <FltFlightEntity> fltFlightEntities =
                Mapper.Map <List <FltFlightModel>, List <FltFlightEntity> >(fltAddOrderModel.FlightList);

            foreach (var f in fltFlightEntities)
            {
                f.OrderId  = fltOrderEntity.OrderId;
                f.RecordNo = "AAAAAA";//默认编码
                if (string.IsNullOrEmpty(f.Airportson))
                {
                    f.Airportson = "----";
                }
                f.IsInter = fltOrderEntity.IsInter;
                if (f.Class.Length > 1)
                {
                    f.Class = f.Class.Substring(0, 1);
                }
                if (!string.IsNullOrEmpty(f.ChoiceReason) && f.ChoiceReason.Trim().ToLower() == "undefined")
                {
                    f.ChoiceReason = string.Empty;
                }

                if (f.Rate.HasValue && f.Rate.Value > 1)
                {
                    f.Rate = f.Rate / 10;
                }
                if (f.FRate > 1)
                {
                    f.FRate = f.FRate / 10;
                }

                _fltFlightDal.Insert(f);
            }
            List <FltPassengerEntity> fltPassengerEntities =
                Mapper.Map <List <FltPassengerModel>, List <FltPassengerEntity> >(fltAddOrderModel.PassengerList);

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

            FltOrderLogEntity log = new FltOrderLogEntity()
            {
                OrderId = fltOrderEntity.OrderId,
                LogTime = DateTime.Now,
                LogType = "新建订单",
                Remark  =
                    "新建订单" + (string.IsNullOrEmpty(fltOrderEntity.BuyRemark) ? "" : "采购备注:" + fltOrderEntity.BuyRemark),
                Oid = "sys"
            };

            _fltOrderLogDal.Insert(log);

            return(fltOrderEntity.OrderId);
        }
Esempio n. 6
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
            });
        }