public void ShipSystemOrder(SystemOrder systemOrder, BackgroundWorker worker, DoWorkEventArgs e) { List <PlatformOrder> platformOrderList = this.FindPlatformOrderList(systemOrder.OrderType, systemOrder.OrderNo); if (platformOrderList.Count == 0) { MessageBox.Show("该系统订单下不存在平台订单。"); return; } int successCount = 0; for (int i = 0; i < platformOrderList.Count; i++) { PlatformOrder platformOrder = platformOrderList[i]; try { ShipPlatformOrder(platformOrder, systemOrder); successCount++; worker.ReportProgress((100 * i) / platformOrderList.Count); } catch (System.Exception ex) { HandleShipException(systemOrder, platformOrder, ex); } } if (successCount == platformOrderList.Count) { e.Result = "订单发运成功。"; } else { e.Result = String.Format("订单发运失败,平台订单共{0}个,发运成功{1}个,失败{2}个", platformOrderList.Count, successCount, platformOrderList.Count - successCount); } }
private void SetInterface(string platformCode, string operatorName, string source, ref decimal TotlePaidPirce, PlatformPolicy policy, UserRelation userRealtion, ref PlatformOrder platformOrder, PnrData pnrData) { #region 接口政策信息 order.Policy.AreaCity = policy.AreaCity; order.Policy.PolicyId = policy.Id; order.Policy.PlatformCode = platformCode; order.Policy.OriginalPolicyPoint = policy.PolicyPoint; order.Policy.DownPoint = 0m; order.Policy.PaidPoint = policy.PolicyPoint; if (source != "back") { order.Policy.PolicyPoint = order.Policy.PaidPoint; } order.Policy.ReturnMoney = policy.ReturnMoney; order.Policy.IsLow = policy.IsLow; order.Policy.SeatPrice = policy.SeatPrice; order.Policy.ABFee = policy.ABFee; order.Policy.RQFee = policy.RQFee; order.Policy.Remark = policy.Remark; order.Policy.IsChangePNRCP = policy.IsChangePNRCP; order.Policy.IsSp = policy.IsSp; order.Policy.PolicyType = policy.PolicyType; order.Policy.WorkTime = policy.WorkTime; order.Policy.ReturnTicketTime = policy.ReturnTicketTime; order.Policy.AnnulTicketTime = policy.AnnulTicketTime; order.Policy.CPOffice = policy.CPOffice; order.Policy.OrderId = order.OrderId; order.Policy.PolicySourceType = EnumPolicySourceType.Interface; order.Policy.CarryCode = order.SkyWays[0].CarrayCode; order.Policy.IssueSpeed = policy.IssueSpeed; order.Policy.TodayGYCode = policy.TodayGYCode; #endregion }
public override object Execute() { //记录时间 StringBuilder sbLog = new StringBuilder(); Stopwatch watch = new Stopwatch(); try { watch.Start(); string platformCode = getParame("platformCode").ToString(); string policyId = getParame("policyId").ToString(); string operatorName = getParame("operatorName").ToString(); string source = getParame("source").ToString(); PolicyDto policyUI = source != "back" ? (getParame("policy") as PolicyDto) : null; decimal TotlePaidPirce = 0m; OldOutOrderId = order.OutOrderId; string innerPlatformCode = "系统"; DataBill databill = new DataBill(); DomesticService domesticService = ObjectFactory.GetInstance <DomesticService>(); UserRelation userRealtion = domesticService.GetUserRealtion(order.BusinessmanCode); bool IspolicyIsNull = false; if (policyUI != null) { //赋值 order.Policy = PolicyDtoPolicy(policyUI, order.Policy, source); } else { #region 原获取政策 PolicyParam policyParam = new PolicyParam(); policyParam.code = order.BusinessmanCode; policyParam.PnrContent = order.PnrContent; policyParam.OrderId = order.OrderId; policyParam.OrderType = order.OrderType; policyParam.OrderSource = order.OrderSource; policyParam.IsChangePnrTicket = order.IsChangePnrTicket; policyParam.IsDestine = order.OrderSource == EnumOrderSource.WhiteScreenDestine ? true : false; Passenger pasData = order.Passengers.Where(p => p.PassengerType != EnumPassengerType.Baby).FirstOrDefault(); if (pasData != null) { policyParam.defFare = pasData.SeatPrice.ToString(); policyParam.defTAX = pasData.ABFee.ToString(); policyParam.defRQFare = pasData.RQFee.ToString(); } if (order.Policy == null) { IspolicyIsNull = true; order.Policy = new Policy(); } Policy localPolicy = null; PlatformPolicy policy = null; PlatformOrder platformOrder = null; PolicyService policyService = ObjectFactory.GetInstance <PolicyService>(); watch.Stop(); sbLog.AppendFormat("初始话变量时间:{0}\r\n", watch.Elapsed.ToString()); watch.Restart(); if (platformCode != innerPlatformCode) { PnrData pnrData = PnrHelper.GetPnrData(order.PnrContent); policy = PlatformFactory.GetPlatformByCode(platformCode).GetPoliciesByPnrContent(order.PnrContent, order.IsLowPrice, pnrData).Find((p) => p.Id == policyId); watch.Stop(); sbLog.AppendFormat("0.调用方法【GetPlatformByCode】用时:{0}\r\n", watch.Elapsed.ToString()); watch.Restart(); if (policy == null) { localPolicy = GetLocalPolicy(policyParam, policyId, innerPlatformCode, userRealtion, IspolicyIsNull, policyService, localPolicy); watch.Stop(); sbLog.AppendFormat("1.调用方法【GetLocalPolicy】用时:{0}\r\n", watch.Elapsed.ToString()); watch.Restart(); if (localPolicy != null) { order.Policy = localPolicy; } else { throw new OrderCommException("政策发生变动,请重新获取政策!!!"); } } else { SetInterface(platformCode, operatorName, source, ref TotlePaidPirce, policy, userRealtion, ref platformOrder, pnrData); watch.Stop(); sbLog.AppendFormat("2.调用方法【SetInterface】用时:{0}\r\n", watch.Elapsed.ToString()); watch.Restart(); } } else { localPolicy = GetLocalPolicy(policyParam, policyId, innerPlatformCode, userRealtion, IspolicyIsNull, policyService, localPolicy); watch.Stop(); sbLog.AppendFormat("3.调用方法【GetLocalPolicy】用时:{0}\r\n", watch.Elapsed.ToString()); watch.Restart(); if (localPolicy == null) { PnrData pnrData = PnrHelper.GetPnrData(order.PnrContent); localPolicy = policyService.GetInterfacePolicy(policyParam, "", userRealtion, pnrData).Find((p) => p.PolicyId == policyId); watch.Stop(); sbLog.AppendFormat("4.调用方法【GetInterfacePolicy】用时:{0}\r\n", watch.Elapsed.ToString()); watch.Restart(); if (localPolicy != null) { policy.AreaCity = localPolicy.AreaCity; policy.Id = localPolicy.PolicyId; policy.PolicyPoint = localPolicy.PolicyPoint; if (source != "back") { policy.PolicyPoint = localPolicy.PaidPoint; } policy.ReturnMoney = localPolicy.ReturnMoney; policy.IsLow = localPolicy.IsLow; policy.SeatPrice = localPolicy.SeatPrice; policy.ABFee = localPolicy.ABFee; policy.RQFee = localPolicy.RQFee; policy.Remark = localPolicy.Remark; policy.IsChangePNRCP = localPolicy.IsChangePNRCP; policy.IsSp = localPolicy.IsSp; policy.PolicyType = localPolicy.PolicyType; policy.WorkTime = localPolicy.WorkTime; policy.ReturnTicketTime = localPolicy.ReturnTicketTime; policy.AnnulTicketTime = localPolicy.AnnulTicketTime; policy.CPOffice = localPolicy.CPOffice; policy.IssueSpeed = localPolicy.IssueSpeed; TotlePaidPirce = platformOrder.TotlePaidPirce; SetInterface(platformCode, operatorName, source, ref TotlePaidPirce, policy, userRealtion, ref platformOrder, pnrData); watch.Stop(); sbLog.AppendFormat("5.调用方法【GetInterfacePolicy】用时:{0}\r\n", watch.Elapsed.ToString()); watch.Restart(); } else { if (localPolicy == null) { throw new OrderCommException("政策发生变动,请重新获取政策!"); } } } else { //赋值 order.Policy = localPolicy; } } #endregion } decimal _OrderMoney = 0m; if (source != "back") { //扣点组类型 DeductionType deductionType = order.Policy.PolicySourceType == EnumPolicySourceType.Local ? DeductionType.Local : (order.Policy.PolicySourceType == EnumPolicySourceType.Share ? DeductionType.Share : DeductionType.Interface); if (policyUI != null) { order.Policy.PolicyPoint = order.Policy.PaidPoint; } PlatformDeductionParam pfDp = new PlatformDeductionParam(); foreach (SkyWay leg in order.SkyWays) { pfDp.FlyLineList.Add(new FlyLine() { CarrayCode = leg.CarrayCode, FromCityCode = leg.FromCityCode, ToCityCode = leg.ToCityCode }); } //匹配扣点规则 domesticService.MatchDeductionRole(order.Policy, pfDp, order.SkyWays[0].CarrayCode, userRealtion.deductionGroup, userRealtion, deductionType); watch.Stop(); sbLog.AppendFormat("6.调用方法【MatchDeductionRole】用时:{0}\r\n", watch.Elapsed.ToString()); watch.Restart(); //佣金 order.Policy.Commission = databill.GetCommission(order.Policy.PolicyPoint, order.Policy.SeatPrice, order.Policy.ReturnMoney); //单人支付金额 根据选择的政策 设置价格 for (int i = 0; i < order.Passengers.Count; i++) { Passenger p = order.Passengers[i]; if (p.PassengerType != EnumPassengerType.Baby) { p.SeatPrice = order.Policy.SeatPrice; p.ABFee = order.Policy.ABFee; p.RQFee = order.Policy.RQFee; p.PayMoney = databill.GetPayPrice(order.Policy.SeatPrice, order.Policy.ABFee, order.Policy.RQFee, order.Policy.PolicyPoint, order.Policy.ReturnMoney); } else { p.PayMoney = databill.GetPayPrice(p.SeatPrice, p.ABFee, p.RQFee, 0, 0); } } _OrderMoney = order.Passengers.Sum(p => p.PayMoney); order.OrderCommissionTotalMoney = order.Passengers.Sum(p => p.PassengerType != EnumPassengerType.Baby ? databill.GetCommission(order.Policy.PolicyPoint, order.Policy.SeatPrice, order.Policy.ReturnMoney) : 0); } #region 支付信息 if (order.OrderPay == null) { order.OrderPay = new OrderPay(); } order.OrderPay.OrderId = order.OrderId; order.OrderPay.PaidMoney = TotlePaidPirce; if (source != "back") { order.OrderPay.PayMoney = _OrderMoney; order.OrderMoney = _OrderMoney; order.OrderPay.PayStatus = EnumPayStatus.NoPay; } order.OrderPay.PaidStatus = EnumPaidStatus.NoPaid; order.OrderPay.TradePoundage = 0m; order.OrderPay.SystemFee = 0m; order.CpOffice = order.Policy.CPOffice; #endregion #region 根据政策扣点明细计算支付分润 if (source != "back") { domesticService.CreateBillDetails(order, userRealtion); watch.Stop(); sbLog.AppendFormat("7.调用方法【CreateBillDetails】用时:{0}\r\n", watch.Elapsed.ToString()); } #endregion order.WriteLog(new OrderLog() { OperationContent = string.Format("{0}选择政策,政策:{1},编号:{2},订单号:{3},出票速度:{4}", source, order.Policy.PolicyPoint, order.Policy.PolicyId, order.OrderId, order.Policy.IssueSpeed), OperationDatetime = DateTime.Now, OperationPerson = operatorName, IsShowLog = false }); order.WriteLog(new OrderLog() { OperationContent = string.Format("选择政策,订单号:{0},出票速度:{1}", order.OrderId, order.Policy.IssueSpeed), OperationDatetime = DateTime.Now, OperationPerson = operatorName, IsShowLog = true }); if (source == "back") { //order.ChangeStatus(EnumOrderStatus.WaitAndPaid); order.ChangeStatus(EnumOrderStatus.PayWaitCreatePlatformOrder); } else { order.ChangeStatus(EnumOrderStatus.NewOrder); } } finally { if (sbLog.ToString() != "") { new CommLog().WriteLog("NewSelectPolicyBehavior", sbLog.ToString()); } } if (order.Policy.PolicySourceType == EnumPolicySourceType.Interface) { order.Policy.Code = string.Empty; order.Policy.Name = string.Empty; order.Policy.CashbagCode = string.Empty; } return(null); }
public override object Execute() { //获取登录账号 string OperationPerson = getParame("operatorName").ToString(); string platformCode = getParame("PlatformCode").ToString(); string PlatformName = getParame("PlatformName").ToString(); //PlatformPolicy platformPolicy = null; PlatformOrder platformOrder = null; StringBuilder sblog = new StringBuilder(); try { sblog.AppendFormat("订单号:{0}\r\n", order.OrderId); if (order.Policy == null) { order.WriteLog(new OrderLog() { OperationContent = string.Format("{0}生成接口订单失败,订单号{1},失败信息:未选择政策", PlatformName, order.OrderId), OperationDatetime = System.DateTime.Now, OperationPerson = OperationPerson.ToString(), Remark = "", IsShowLog = false }); order.ChangeStatus(EnumOrderStatus.CreatePlatformFail); return null; } sblog.AppendFormat("platformCode={0}\r\n", platformCode); //PnrData pnrData = PnrHelper.GetPnrData(order.PnrContent); //platformPolicy = PlatformFactory.GetPlatformByCode(platformCode).GetPoliciesByPnrContent(order.PnrContent, order.IsLowPrice, pnrData).Find((p) => p.Id == order.Policy.PolicyId); //sblog.AppendFormat("platformPolicy==null\r\n"); //if (platformPolicy == null) //{ // order.WriteLog(new OrderLog() // { // OperationContent = string.Format("{0}生成接口订单失败,订单号{1},失败信息:政策【{2}】发生变动,未获取到对应的政策", PlatformName, order.OrderId, order.Policy.PolicyId), // OperationDatetime = System.DateTime.Now, // OperationPerson = OperationPerson.ToString(), // Remark = "", // IsShowLog = false // }); // order.ChangeStatus(EnumOrderStatus.CreatePlatformFail); // sblog.AppendFormat("{0}生成接口订单失败,订单号{1},失败信息:政策【{2}】发生变动,未获取到对应的政策", PlatformName, order.OrderId, order.Policy.PolicyId); // new CommLog().WriteLog("platformPolicyChange", sblog.ToString()); // return null; //} sblog.AppendFormat("开始CreateOrder\r\n"); platformOrder = PlatformFactory.CreateOrder(platformCode, order.IsLowPrice, order.Policy.AreaCity, order.PnrContent, order.Policy.PolicyId, order.Policy.TodayGYCode, order.OrderId, order.Policy.PolicyPoint, order.Policy.ReturnMoney, null); sblog.AppendFormat("结束CreateOrder\r\n"); } catch (Exception e) { sblog.AppendFormat("异常信息1:{0}\r\n", e.Message + e.StackTrace + e.TargetSite); try { CancelIOrder(order.Policy.PlatformCode, OperationPerson); Thread.Sleep(1000); platformOrder = PlatformFactory.CreateOrder(platformCode, order.IsLowPrice, order.Policy.AreaCity, order.PnrContent, order.Policy.PolicyId, order.Policy.TodayGYCode, order.OrderId, order.Policy.PolicyPoint, order.Policy.ReturnMoney, null); } catch (Exception ex) { sblog.AppendFormat("异常信息2:{0}\r\n", ex.Message + ex.StackTrace + ex.TargetSite); order.WriteLog(new OrderLog() { OperationContent = string.Format("{0}生成接口订单失败,订单号{1},失败信息:{2}", PlatformName, order.OrderId, ex.Message), OperationDatetime = System.DateTime.Now, OperationPerson = OperationPerson.ToString(), Remark = "", IsShowLog = false }); order.ChangeStatus(EnumOrderStatus.CreatePlatformFail); new CommLog().WriteLog("CreatePlatformOrder_Exception", sblog.ToString()); throw new OrderCommException(ex.Message); } } order.OutOrderId = platformOrder.OutOrderId; order.OrderPay = order.OrderPay == null ? new OrderPay() : order.OrderPay; order.OrderPay.OrderId = order.OrderId; order.OrderPay.PaidMoney = platformOrder.TotlePaidPirce; order.OrderPay.PaidStatus = EnumPaidStatus.NoPaid; order.WriteLog(new OrderLog() { OperationContent = string.Format("{0}生成接口订单成功,接口订单号{1}", PlatformName, order.OutOrderId), OperationDatetime = System.DateTime.Now, OperationPerson = OperationPerson.ToString(), Remark = "", IsShowLog = false }); order.ChangeStatus(EnumOrderStatus.WaitAndPaid); return null; }
private static XmlElement ToXmlElement(XmlDocument document, PlatformOrder order) { ValidateOrderState(order); XmlElement orderElement = document.CreateElement("order"); XmlElement orderIdElement = document.CreateElement("orderid"); orderIdElement.InnerText = order.OrderCode; orderElement.AppendChild(orderIdElement); // 客户编号非必填项 if (order.CustomerCode != null && !"".Equals(order.CustomerCode)) { XmlElement customerCodeElement = document.CreateElement("customercode"); customerCodeElement.InnerText = order.CustomerCode; orderElement.AppendChild(customerCodeElement); } XmlElement clctTypeElement = document.CreateElement("clcttype"); clctTypeElement.InnerText = order.ClctType; orderElement.AppendChild(clctTypeElement); XmlElement podElement = document.CreateElement("pod"); podElement.InnerText = order.Pod; orderElement.AppendChild(podElement); XmlElement untreadElement = document.CreateElement("untread"); untreadElement.InnerText = order.Untread; orderElement.AppendChild(untreadElement); // 体积重量是非必填项 if (null != order.VolWeight && !"".Equals(order.VolWeight)) { XmlElement volWeightElement = document.CreateElement("volweight"); volWeightElement.InnerText = order.VolWeight; orderElement.AppendChild(volWeightElement); } // 起始预约时间是非必填项 if (null != order.StartDate && !"".Equals(order.StartDate)) { XmlElement startDateElement = document.CreateElement("startdate"); startDateElement.InnerText = order.StartDate; orderElement.AppendChild(startDateElement); } // 终止预约时间是非必填项 if (null != order.EndDate && !"".Equals(order.EndDate)) { XmlElement endDateElement = document.CreateElement("enddate"); endDateElement.InnerText = order.EndDate; orderElement.AppendChild(endDateElement); } // 备注是非必填项 if (null != order.Remark && !"".Equals(order.Remark)) { XmlElement remarkElement = document.CreateElement("remark"); remarkElement.InnerText = order.Remark; orderElement.AppendChild(remarkElement); } // 客户自定义信息1是非必填项 if (null != order.Sku1 && !"".Equals(order.Sku1)) { XmlElement sku1Element = document.CreateElement("sku1"); sku1Element.InnerText = order.Sku1; orderElement.AppendChild(sku1Element); } // 客户自定义信息2是非必填项 if (null != order.Sku2 && !"".Equals(order.Sku2)) { XmlElement sku2Element = document.CreateElement("sku2"); sku2Element.InnerText = order.Sku2; orderElement.AppendChild(sku2Element); } // 订单条码是非必填项 if (null != order.BarCode && !"".Equals(order.BarCode)) { XmlElement barCodeElement = document.CreateElement("barcode"); barCodeElement.InnerText = order.BarCode; orderElement.AppendChild(barCodeElement); } // 打印格式是非必填项 if (null != order.PrintCode && !"".Equals(order.PrintCode)) { XmlElement printCodeElement = document.CreateElement("printcode"); printCodeElement.InnerText = order.PrintCode; orderElement.AppendChild(printCodeElement); } orderElement.AppendChild(ToSenderXmlElement(document, order.Sender)); orderElement.AppendChild(ToReceiverXmlElement(document, order.Receiver)); orderElement.AppendChild(ToCollectXmlElement(document, order.Collect)); orderElement.AppendChild(ToItemsElement(document, order.items)); return(orderElement); }
private static void ValidateOrderState(PlatformOrder order) { if (order.OrderCode == null || "".Equals(order.OrderCode)) { throw new InvalidOrderException("订单单号字段不能为空。"); } if (order.ClctType == null || "".Equals(order.ClctType)) { throw new InvalidOrderException("揽收类型字段不能为空。"); } if (order.Untread == null || "".Equals(order.Untread)) { throw new InvalidOrderException("退回类型字段不能为空。"); } if (order.Pod == null || "".Equals(order.Pod)) { throw new InvalidOrderException("是否电子签收字段不能为空。"); } if (order.Sender == null) { throw new InvalidOrderException("寄件人名址不能为空。"); } if (order.Sender.Name == null || "".Equals(order.Sender.Name)) { throw new InvalidOrderException("寄件人姓名字段不能为空。"); } if (order.Sender.PostCode == null || "".Equals(order.Sender.PostCode)) { throw new InvalidOrderException("寄件人邮编字段不能为空。"); } if (order.Sender.Country == null || "".Equals(order.Sender.Country)) { throw new InvalidOrderException("寄件人国家字段不能为空"); } if (order.Sender.Province == null || "".Equals(order.Sender.Province)) { throw new InvalidOrderException("寄件人省份字段不能为空"); } if (order.Sender.City == null || "".Equals(order.Sender.City)) { throw new InvalidOrderException("寄件人城市字段不能为空"); } if (order.Sender.County == null || "".Equals(order.Sender.County)) { throw new InvalidOrderException("寄件人区县字段不能为空"); } if (order.Sender.Street == null || "".Equals(order.Sender.Street)) { throw new InvalidOrderException("寄件人街道字段不能为空"); } if (order.Receiver == null) { throw new InvalidOrderException("收件人名址不能为空。"); } if (order.Receiver.Name == null || "".Equals(order.Receiver.Name)) { throw new InvalidOrderException("收件人姓名字段不能为空。"); } if (order.Receiver.PostCode == null || "".Equals(order.Receiver.PostCode)) { throw new InvalidOrderException("收件人邮编字段不能为空。"); } if (order.Receiver.Country == null || "".Equals(order.Receiver.Country)) { throw new InvalidOrderException("收件人国家字段不能为空"); } if (order.Receiver.Province == null || "".Equals(order.Receiver.Province)) { throw new InvalidOrderException("收件人省份字段不能为空"); } if (order.Receiver.City == null || "".Equals(order.Receiver.City)) { throw new InvalidOrderException("收件人城市字段不能为空"); } if (order.Receiver.Street == null || "".Equals(order.Receiver.Street)) { throw new InvalidOrderException("收件人街道字段不能为空"); } if (null == order.Collect) { throw new InvalidOrderException("Collet名址不能为空。"); } if (order.Collect.Name == null || "".Equals(order.Collect.Name)) { throw new InvalidOrderException("Collet姓名字段不能为空。"); } if (order.Collect.PostCode == null || "".Equals(order.Collect.PostCode)) { throw new InvalidOrderException("Collet邮编字段不能为空。"); } if (order.Collect.Country == null || "".Equals(order.Collect.Country)) { throw new InvalidOrderException("Collet国家字段不能为空"); } if (order.Collect.Province == null || "".Equals(order.Collect.Province)) { throw new InvalidOrderException("Collet省份字段不能为空"); } if (order.Collect.City == null || "".Equals(order.Collect.City)) { throw new InvalidOrderException("Collet城市字段不能为空"); } if (order.Collect.County == null || "".Equals(order.Collect.County)) { throw new InvalidOrderException("Collet区县字段不能为空"); } if (order.Collect.Street == null || "".Equals(order.Collect.Street)) { throw new InvalidOrderException("Collet街道字段不能为空"); } if (order.items == null || order.items.Count == 0) { throw new InvalidOrderException("订单货品不能为空"); } }
public override object Execute() { string areaCity = getParame("areaCity").ToString(); string platformCode = getParame("PlatformCode").ToString(); string operatorName = getParame("operatorName").ToString(); string isNotify = getParame("isNotify").ToString(); PlatformOrder platformOrder = null; try { if (order.Policy == null || order.Policy.PolicySourceType != EnumPolicySourceType.Interface) { throw new OrderCommException("该订单(" + order.OrderId + ")不是接口订单不能进行代付!"); } if (order.OrderPay.PayStatus == EnumPayStatus.NoPay) { throw new OrderCommException("该订单(" + order.OrderId + ")未支付不能进行代付操作!"); } if (order.OrderPay.PaidStatus == EnumPaidStatus.OK) { throw new OrderCommException("该订单(" + order.OrderId + ")已经代付成功,不能重复支付同一个订单"); } else { bool paidIsTest = PlatformSection.GetInstances().Platforms[0].paidIsTest; if (paidIsTest) { platformOrder = new PlatformOrder() { OrderId = order.OrderId, AreaCity = areaCity, OutOrderId = order.OutOrderId, PnrCode = order.PnrCode, TotlePaidPirce = order.OrderPay.PaidMoney, TotaSeatlPrice = order.Passengers.Sum(p => p.SeatPrice) }; PlatformFactory.Pay(platformCode, areaCity, platformOrder); order.OrderPay.PaidMethod = platformOrder.PaidMethod.ToString(); } else { //查看是否有补点 decimal bdMoney = 0m; decimal PaidMoney = 0m; decimal PayMoney = 0m; foreach (PayBillDetail payDetail in order.OrderPay.PayBillDetails) { if (payDetail.AdjustType == AdjustType.Compensation)//补点 { bdMoney += Math.Abs(payDetail.Money); } } PaidMoney = order.OrderPay.PaidMoney; PayMoney = (order.OrderPay.PayMoney + bdMoney); //代付金额高于支付金额 就不代付 if (isNotify != "手动代付" && PaidMoney > PayMoney) { throw new PayInterfaceOrderException("代付金额(" + PaidMoney + ")高于用户支付金额(" + PayMoney + "),不进行代付!"); } else { if (order.OrderPay.PaidMoney <= 0) { throw new PayInterfaceOrderException("支付金额无效!"); } else if (order.OrderPay.PayMoney <= 0) { throw new PayInterfaceOrderException("支付金额无效!"); } else { platformOrder = new PlatformOrder() { OrderId = order.OrderId, AreaCity = areaCity, OutOrderId = order.OutOrderId, PnrCode = order.PnrCode, TotlePaidPirce = order.OrderPay.PaidMoney, TotaSeatlPrice = order.Passengers.Sum(p => p.SeatPrice) }; PlatformFactory.Pay(platformCode, areaCity, platformOrder); order.OrderPay.PaidMethod = platformOrder.PaidMethod.ToString(); } } } } } catch (Exception ex) { order.WriteLog(new OrderLog() { OperationContent = string.Format("日志来源:" + isNotify + ",接口订单号{0},{1}代付失败,失败信息:{2}", order.OutOrderId, platformCode, ex.Message), OperationDatetime = DateTime.Now, OperationPerson = operatorName , IsShowLog = false }); Logger.WriteLog(LogType.INFO, platformCode + "代付失败 时间:" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + " OrderId=" + order.OrderId + " 接口订单号" + order.OutOrderId + " 异常信息=" + ex.Message + "\r\n"); throw new OrderCommException(ex.Message); } order.WriteLog(new OrderLog() { OperationContent = string.Format("日志来源:{0},{1}代付成功,接口订单号{2}", isNotify, platformCode, order.OutOrderId), OperationDatetime = DateTime.Now, OperationPerson = operatorName, IsShowLog = false }); order.OrderPay.PaidDateTime = System.DateTime.Now; //order.OrderPay.PaidStatus = EnumPaidStatus.OK; //代付成功修改状态 order.ChangeStatus(EnumOrderStatus.WaitIssue); return(null); }
private void HandleShipException(SystemOrder systemOrder, PlatformOrder platformOrder, System.Exception e) { MessageBox.Show(String.Format("发运失败,单别:{0},单号:{1},平台单号:{2},具体错误信息:\r\n{3}", systemOrder.OrderType, systemOrder.OrderNo, platformOrder.OrderCode, e.Message), "错误"); }