/// <summary> /// 通过指令查询经停城市 /// </summary> /// <param name="sdate"></param> /// <param name="flyno"></param> /// <returns></returns> private string selStops(string sdate, string flyno, string guid) { try { flyno = flyno.Replace("*", ""); string dd = DateTime.Parse(sdate).ToString("dd"); string mm = DateTime.Parse(sdate).ToString("MM"); string zhiling = "FF:" + flyno + "/" + dd + strValue(mm); //格式化编码内容类 PnrAnalysis.FormatPNR pnrformat = new PnrAnalysis.FormatPNR(); string strVale = string.Empty; ParamEx pe = new ParamEx(); pe.UsePIDChannel = this.KongZhiXiTong != null && this.KongZhiXiTong.Contains("|48|") ? 2 : 0; SendInsManage SendManage = new SendInsManage(mUser.LoginName, mCompany.UninCode, pe, this.configparam); string Office = this.configparam.Office.Split('^')[0]; strVale = SendManage.Send(zhiling, ref Office, 9); string msg = ""; LegStop ls = pnrformat.GetStop(strVale, out msg); if (msg == "") { strVale = strReturn(ls); } return(strVale + "|" + guid); } catch (Exception ex) { return(""); } }
/// <summary> /// 分离或者取消编码 /// </summary> /// <returns></returns> private string PnrHandle(Tb_Ticket_Order Order, SendInsManage SendIns, StringBuilder sbLog, List <HashObject> selList, int INFCount) { string ErrMsg = ""; try { if (Order != null && Order.PNR != "" && Order.PNR.Trim().Length == 6) { PnrAnalysis.PnrModel pnrMode = SendIns.GetPnr(Order.PNR.Trim(), out ErrMsg); if (pnrMode != null) { if (ErrMsg.Contains("授权")) { string[] strAuthArr = ErrMsg.Split('#')[1].Split('|'); ErrMsg = ""; foreach (string item in strAuthArr) { ErrMsg += "RMK TJ AUTH " + item + "<br/>"; } ErrMsg = "需要授权,授权指令:<br />" + ErrMsg; sbLog.Append("提取编码信息失败," + ErrMsg); } else { if (!pnrMode.PnrStatus.Contains("XX")) { if (pnrMode.PnrStatus.Contains("NO")) { ErrMsg = "编码(" + Order.PNR + ")状态为NO,系统取消编码失败!"; sbLog.Append(ErrMsg); } else if (pnrMode.PnrStatus.Contains("RR")) { ErrMsg = "编码(" + Order.PNR + ")状态为RR,该编码已出票,不能取消!"; sbLog.Append(ErrMsg); } else { string TicketNumber = ""; string Cmd = "", Office = "", RecvData = ""; //用于分离编码的乘客姓名 不含婴儿 List <string> pnameList = new List <string>(); //循环选择的乘机人 foreach (HashObject hashParam in selList) { if (hashParam["pasPType"].ToString() != "3") { pnameList.Add(hashParam["pasName"].ToString()); } TicketNumber = hashParam["pasTicketNum"].ToString(); if (TicketNumber != "" && !KongZhiXiTong.Contains("|69|")) { Office = hashParam["office"].ToString(); Cmd = "DETR:TN/" + TicketNumber; RecvData = SendIns.Send(Cmd, ref Office, 0); if (!RecvData.Contains("OPEN FOR USE")) { ErrMsg = "票号(" + TicketNumber + ")状态异常,不能提交申请!"; sbLog.Append(ErrMsg); break; } } } //没有出错时 if (ErrMsg == "") { if (INFCount > 0) { //编码状态不是已经出票的PNR if (pnrMode != null && !pnrMode.PnrStatus.Contains("RR")) { //有婴儿直接提交 SendIns.CancelPnr(Order.PNR, Order.Office); } } else { //编码状态不是已经出票的PNR if (pnrMode != null) { if (!pnrMode.PnrStatus.Contains("RR")) { //取消编码 if (SendIns.CancelPnr(Order.PNR, Order.Office)) { ErrMsg = ""; } else { ErrMsg = "取消编码(" + Order.PNR + ")失败!"; } } else { ErrMsg = "编码状态为RR的编码,不能取消!"; } } } } } } } } else { sbLog.Append("提取编码信息失败,系统取消编码失败!"); } } else { sbLog.Append("订单不存在!"); } } catch (Exception ex) { ErrMsg = ex.Message; } finally { } return(ErrMsg); }
/// <summary> /// 退废改签 /// </summary> /// <param name="writer"></param> /// <param name="parames"></param> public override void Update(ResponseWriter writer, System.Collections.Specialized.NameValueCollection parames) { UserLoginInfo userInfo = AuthLogin.GetUserInfo(Username); KongZhiXiTong = BaseParams.getParams(userInfo.SupParameters).KongZhiXiTong; PbProject.Logic.Order.Tb_Ticket_OrderBLL orderBll = new PbProject.Logic.Order.Tb_Ticket_OrderBLL(); string sqlWhere = " OrderID='" + CommonMethod.GetFomartString(parames["OrderID"]) + "' "; List <Tb_Ticket_Order> OrderList = baseDataManage.CallMethod("Tb_Ticket_Order", "GetList", null, new Object[] { sqlWhere }) as List <Tb_Ticket_Order>; Tb_Ticket_Order Order = OrderList != null && OrderList.Count > 0 ? OrderList[0] : null; if (Order == null) { writer.WriteEx(546, "order num err", "订单编号错误"); } else { sqlWhere = " OrderId='" + Order.OrderId + "' "; List <Tb_Ticket_Passenger> PassengerList = baseDataManage.CallMethod("Tb_Ticket_Passenger", "GetList", null, new Object[] { sqlWhere }) as List <Tb_Ticket_Passenger>; List <Tb_Ticket_SkyWay> NewSkyWayList = baseDataManage.CallMethod("Tb_Ticket_SkyWay", "GetList", null, new Object[] { sqlWhere + " order by FromDate " }) as List <Tb_Ticket_SkyWay>; //提示信息 string msg = ""; try { //申请类型3退票申请 4废票申请 5改签申请 string ApplayType = CommonMethod.GetFomartString(parames["ApplayType"]); //扩展参数 ParamEx pe = new ParamEx(); pe.UsePIDChannel = this.KongZhiXiTong != null && this.KongZhiXiTong.Contains("|48|") ? 2 : 0; //发送指令管理类 SendInsManage SendIns = new SendInsManage(userInfo.User.LoginName, userInfo.Company.UninCode, pe, userInfo.Configparam); //订单日志 StringBuilder orderLog = new StringBuilder(); #region //选择的乘客信息 List <HashObject> pasList = GetPassengerInfo(Order, PassengerList, CommonMethod.GetFomartString(parames["pasList"])); //选中的 成人 儿童 婴儿 int AdultCount = 0, CHDCount = 0, INFCount = 0; //没选中的 成人 儿童 婴儿 int NoSelAdultCount = 0, NoSelCHDCount = 0, NoSelINFCount = 0; //选择的乘机人 List <HashObject> selList = new List <HashObject>(); foreach (HashObject param in pasList) { if (param["pasIsBack"].ToString() == "0") //获取没有提交的用户 { //选择的乘客数 if (param["IsChecked"].ToString() == "1") { if (param["pasPType"].ToString() == "1") { AdultCount++; } else if (param["pasPType"].ToString() == "2") { CHDCount++; } else if (param["pasPType"].ToString() == "3") { INFCount++; } selList.Add(param); } else { if (param["pasPType"].ToString() == "1") { NoSelAdultCount++; } else if (param["pasPType"].ToString() == "2") { NoSelCHDCount++; } else if (param["pasPType"].ToString() == "3") { NoSelINFCount++; } } } } #endregion //航段信息 List <HashObject> skyList = GetSkyInfo(Order, NewSkyWayList, CommonMethod.GetFomartString(parames["skywayList"])); #region if (ApplayType != "5")//退废票 { //行程单状态判断 if (!KongZhiXiTong.Contains("|68|")) { if (string.IsNullOrEmpty(msg)) { //行程单状态判断 if (!TripIsVoid(userInfo, pasList, SendIns, out msg)) { msg = (string.IsNullOrEmpty(msg)) ? "不能提交,行程单状态异常!" : msg; } } } if (string.IsNullOrEmpty(msg)) { //票号状态判断 if (!KongZhiXiTong.Contains("|69|")) { if (string.IsNullOrEmpty(msg)) { //票号状态判断 if (!PassengerTicketIsOpen(pasList, skyList, SendIns, out msg)) { msg = (string.IsNullOrEmpty(msg)) ? "不能提交,票号状态异常!" : msg; } } } } if (string.IsNullOrEmpty(msg)) { //废票 飞机起飞两个半小时内不能提交废票操作,只能走退票通道 if (ApplayType == "4" && skyList.Count > 0) { //是否可以提交废票 1可以 0不可以 HashObject strArr = skyList[0] as HashObject; if (strArr.Count == 11 && strArr["IsFP"].ToString() == "0") { if (KongZhiXiTong != null && !KongZhiXiTong.Contains("|16|")) { msg = "飞机起飞两个半小时内不能提交废票操作,只能走退票通道"; } } } } } #endregion if (string.IsNullOrEmpty(msg)) { msg = TimeIsCommit(ApplayType, Order); } if (string.IsNullOrEmpty(msg)) { //含有没有提交的婴儿并且没有成人时 不可以提交 if (NoSelINFCount > 0 && NoSelAdultCount == 0) { msg = "婴儿订单必须有成人陪同!"; orderLog.Append("成人带婴儿订单,需要手动处理编码!"); } } if (string.IsNullOrEmpty(msg)) { string divMsg = ""; if (Order.OrderSourceType == 1)//白屏预订 { //退费票且没有婴儿 if (ApplayType != "5" && (AdultCount > 0 || CHDCount > 0)) { //开启退废票(分离、取消)编码 if (KongZhiXiTong.Contains("|32|")) { ////退废处理 判断 分离编码 和 取消编码 divMsg = PnrHandle(Order, SendIns, orderLog, selList, INFCount); } } } if (divMsg != "" && INFCount == 0) { } else { //处理退改签 msg = TGQ(userInfo, Order, NewSkyWayList, skyList, PassengerList, pasList, CommonMethod.GetFomartString(parames["remark"]), CommonMethod.GetFomartString(parames["quitReasonType"]), CommonMethod.GetFomartString(parames["reason"])); } } else { } } catch (Exception) { } finally { //解锁 orderBll.LockOrder(false, Order.id.ToString(), userInfo.User, userInfo.Company); writer.Write(msg); } } }
/// <summary> /// 票号状态是否为Open for Use 状态 true为Open for Use 否则不是 /// </summary> /// <param name="TicketNumber"></param> /// <param name="Office"></param> /// <returns></returns> private bool PassengerTicketIsOpen(List <HashObject> pasList, List <HashObject> skyList, SendInsManage SendIns, out string errMsg) { bool IsOpen = false; errMsg = ""; //第一航段 HashObject skyParam = skyList[0]; StringBuilder sbLog = new StringBuilder(); //格式化pnr类 PnrAnalysis.FormatPNR format = new PnrAnalysis.FormatPNR(); string TicketNumber = "", Office = "", Status = "", PassengerName = "", FlyDate = ""; bool IsSuc = false; if (pasList != null && pasList.Count > 0) { foreach (HashObject param in pasList) { if (param.Count == 9 && param["IsChecked"].ToString() == "1") { PassengerName = param["pasName"].ToString().Trim(); //乘机人姓名 TicketNumber = param["pasTicketNum"].ToString().Trim(); //票号 Office = param["office"].ToString().Trim(); //Office FlyDate = skyParam["FromDate"].ToString().Trim(); //乘机日期 if (TicketNumber == "") { continue; } //提取票号信息指令组合 string strInstruction = string.Format("DETR:TN/{0}", TicketNumber); //发送指令 string recvData = SendIns.Send(strInstruction, ref Office, 0); if ((recvData.ToUpper().Contains("NOT EXIST") || recvData.ToUpper().Contains("TICKET NUMBER") || recvData.ToUpper().Contains("NOT FOUND") || recvData.ToUpper().Contains("AUTHORITY") || recvData.ToUpper().Contains("没有权限")) && FlyDate != "") { //检查乘机日期 DateTime dt1 = System.DateTime.Parse("1901-01-01"); DateTime.TryParse(FlyDate, out dt1); if (DateTime.Compare(dt1, System.DateTime.Now) < 0) { //乘机日期已过期 不能提交 IsSuc = true; sbLog.AppendFormat("乘机人{0}票号{1}乘机日期已过期,不能提交申请退废票!", PassengerName, TicketNumber); break; } else { continue; } } //票号状态 Status = format.GetTicketStatus(recvData); if (Status.ToUpper() != "OPEN FOR USE") { IsSuc = true; if (Status == "") { sbLog.AppendFormat("乘机人{0}票号{1}为无效票号,不能提交申请退废票!", PassengerName, TicketNumber); } else { sbLog.AppendFormat("乘机人{0}票号({1})状态为{2},不能提交申请退废票!", PassengerName, TicketNumber, Status); } break; } } } if (!IsSuc) { IsOpen = true; } errMsg = sbLog.ToString(); } return(IsOpen); }
/// <summary> /// 该乘机人票号 提示对应的行程单是否作废 /// </summary> /// <param name="pas"></param> /// <returns></returns> private bool TripIsVoid(UserLoginInfo userInfo, List <HashObject> strList, SendInsManage SendIns, out string msg) { bool Isvoid = true; msg = ""; try { StringBuilder sbLog = new StringBuilder(); string[] OfficeNum = userInfo.Configparam.Office.Split(new string[] { "|", " ", "/", ",", ",", "\\", "#" }, StringSplitOptions.RemoveEmptyEntries); foreach (HashObject param in strList) { if (param.Count == 9 && param["IsChecked"].ToString() == "1") { string PasName = param["pasName"].ToString().Trim(); //乘机人姓名 string PasA8 = param["pasTravelNumber"].ToString().Trim(); //行程单号 string PasTicketNumber = param["pasTicketNum"].ToString().Trim(); //票号 //if (PasA8 != "") //{ //Office string office = param["office"].ToString().Trim(); //真实状态 string strInstruction = string.Format("DETR:TN/{0},F", PasTicketNumber); string recvData = SendIns.Send(strInstruction, ref office, 0); List <string> lst = new List <string>(); lst.AddRange(new string[] { "没有权限", "NOT EXIST", "TICKET NUMBER", "NOT FOUND", "NO RECORD", "超时", "无法从传输连接中读取数据" }); bool isContain = false; foreach (string item in lst) { if (recvData.ToUpper().Contains(item)) { isContain = true; break; } } if (recvData != "" && !isContain && recvData.ToUpper().Contains("RP" + PasA8)) { Isvoid = false; sbLog.AppendFormat("乘机人:{0} 票号{1}所关联的行程单号未作废<br />请先作废行程单后再操作!", PasName, PasTicketNumber); } else { if (recvData.Contains("授权")) { Isvoid = false; sbLog.AppendFormat("乘机人:{0} 票号{1}验证行程单状态失败,需授权,授权指令:RMK TJ AUTH " + (office == "" ? OfficeNum[0] : office.Trim(new char[] { '$' })), PasName, PasTicketNumber); } } // } } } msg = sbLog.ToString(); } catch (Exception) { } return(Isvoid); }
/// <summary> /// 确认订单 /// </summary> /// <param name="writer"></param> /// <param name="parames"></param> public override void Create(ResponseWriter writer, System.Collections.Specialized.NameValueCollection parames) { var userLogin = AuthLogin.GetUserInfo(Username); string adultOrderId = parames["adultOrderId"]; string childOrderId = parames["childOrderId"]; string adultPolicyGuid = parames["adultPolicyGuid"]; //成人政策guid string childPolicyGuid = parames["childPolicyGuid"]; //婴儿政策guid string remark = parames["remark"]; var adultPolicy = PolicyCacheManager.Get(adultPolicyGuid) as PolicyParamForAPI; var childPolicy = PolicyCacheManager.Get(childPolicyGuid) as PolicyParamForAPI; OrderInputParam InputParam = createOrderInputParam(adultOrderId, childOrderId); Tb_Ticket_OrderBLL orderBLL = new Tb_Ticket_OrderBLL(); if (adultPolicy == null) { writer.WriteEx(554, "Cache is disabled", "政策缓存已失效,请重新操作"); } else { #region 更新订单 主要修改价格,政策和添加订单账单明细 Bill bill = new Bill(); Data d = new Data(userLogin.Company.UninCode);//采购佣金进舍规则: 0.舍去佣金保留到元、1.舍去佣金保留到角、2.舍去佣金保留到分 string ErrMsg = ""; bool IsSuc = false; //扩展参数 ParamEx pe = new ParamEx(); pe.UsePIDChannel = userLogin.FQP.KongZhiXiTong != null && userLogin.FQP.KongZhiXiTong.Contains("|48|") ? 2 : 0; //发送指令管理类 SendInsManage SendIns = new SendInsManage(userLogin.User.LoginName, userLogin.Company.UninCode, pe, userLogin.Configparam); //提示 StringBuilder sbTip = new StringBuilder(); try { AjaxPolicyMatchOutData APM = new AjaxPolicyMatchOutData(); APM.OutPutPolicyList.Add(adultPolicy); APM.OutPutPolicyList.Add(childPolicy); //供应商Office string GYOffice = userLogin.Configparam != null?userLogin.Configparam.Office.ToUpper() : ""; if (InputParam != null && APM != null && APM.OutPutPolicyList != null && APM.OutPutPolicyList.Count > 0) { AjAxPolicyParam AdultPolicy = adultPolicy; AjAxPolicyParam ChildPolicy = childPolicy; //至少选择一条政策 成人或者儿童 if (AdultPolicy == null && ChildPolicy == null) { writer.WriteEx(567, "choose one policy at least", "请选择一条政策数据"); } else { PatInfo INFPrice = null; if (HasBaby(InputParam)) { //婴儿价格 INFPrice = GetINFPAT(); } //订单实体需要更改数据的字段名 List <string> UpdateOrderFileds = new List <string>(); //订单修改字段 UpdateOrderFileds.AddRange(new string[] { "OldRerurnMoney", "OldPolicyPoint", "OutOrderPayMoney", "A7", "A13", "A1", "A11", "PrintOffice", "CPCpyNo", "YDRemark", "PolicyId", "AirPoint", "PolicyPoint", "ReturnPoint", "PolicyMoney", "PolicyCancelTime", "PolicyReturnTime", "DiscountDetail", "PolicyType", "PolicySource", "AutoPrintFlag", "PolicyRemark", "PMFee", "ABFee", "FuelFee", "BabyFee", "PayMoney", "OrderMoney" }); //航段实体需要更改数据的字段名 List <string> UpdateSkyWayFileds = new List <string>(); //航段修改字段 UpdateSkyWayFileds.AddRange(new string[] { "SpacePrice", "ABFee", "FuelFee", "Discount" }); //乘客实体需要更改数据的字段名 List <string> UpdatePasFileds = new List <string>(); //修改乘机人 UpdatePasFileds.AddRange(new string[] { "PMFee", "ABFee", "FuelFee" }); //承运人二字码 string CarrayCode = string.Empty; string orderIDs = ""; //婴儿与编码中的婴儿个数是否不一致 true不一致 false一致 bool IsINFCheck = false; //婴儿与编码中的婴儿个数是否不一致提示 string INFCountCheckMsg = "<b class=\"red\">编码中婴儿个数与预订婴儿个数不一致,请手动补全编码中婴儿!</b>"; //Bill返回有无SQL bool IsBillOK = false; //修改实体相关的值后更新即可 for (int i = 0; i < InputParam.OrderParamModel.Count; i++) { OrderMustParamModel item = InputParam.OrderParamModel[i]; //承运人二字码 CarrayCode = item.Order.CarryCode.Split('/')[0].ToUpper().Trim(); if (orderIDs.Contains(item.Order.OrderId)) { continue; } else { orderIDs += item.Order.OrderId + "|"; } #region 设置需要更改数据的字段名集合 item.UpdateOrderFileds = UpdateOrderFileds; item.UpdateSkyWayFileds = UpdateSkyWayFileds; item.UpdatePassengerFileds = UpdatePasFileds; #endregion #region 实体处理 //订单中的总价 decimal TotalPMPrice = 0m, TotalABFare = 0, TotalRQFare = 0m; //item.Order.YDRemark = remark; //预订备注信息 item.Order.YDRemark = remark; //订单处理 成人订单政策 if (!item.Order.IsChdFlag && AdultPolicy != null) { #region 成人或者婴儿实体价格赋值 //检测白屏预订婴儿个数与编码中的婴儿个数 if (item.Order.OrderSourceType == 1 || item.Order.OrderSourceType == 5) { IsINFCheck = yudingINFCheck(InputParam.PnrInfo, item.PasList); } //婴儿价格 decimal INFPMFee = 0m, INFABFare = 0m, INFRQFare = 0m; if (INFPrice != null) { decimal.TryParse(INFPrice.Fare, out INFPMFee); decimal.TryParse(INFPrice.TAX, out INFABFare); decimal.TryParse(INFPrice.RQFare, out INFRQFare); } //成人价格 decimal PMFee = AdultPolicy.SeatPrice, ABFare = AdultPolicy.ABFare, RQFare = AdultPolicy.RQFare; #region 特价缓存处理 //特价时特价缓存处理 为特价且PAT内容不为空 if (AdultPolicy.PolicyKind == 2 && item.SkyList[0].Pat.Trim() != "") { //白屏和PNR导入 if (item.Order.OrderSourceType == 1 || item.Order.OrderSourceType == 2 || item.Order.OrderSourceType == 6 || item.Order.OrderSourceType == 10) { //特价缓存 SpecialCabinPriceInfoBLL SpBll = new SpecialCabinPriceInfoBLL(); PnrAnalysis.FormatPNR pnrformat = new PnrAnalysis.FormatPNR(); string errMsg = ""; PnrAnalysis.PatModel Pat = pnrformat.GetPATInfo(item.SkyList[0].Pat.Trim(), out errMsg); if (Pat.UninuePatList.Count > 0) { decimal m_Fare = 0m; decimal m_TAX = 0m; decimal m_RQFare = 0m; decimal.TryParse(Pat.UninuePatList[0].Fare, out m_Fare); decimal.TryParse(Pat.UninuePatList[0].TAX, out m_TAX); decimal.TryParse(Pat.UninuePatList[0].RQFare, out m_RQFare); //价格不相等 if (m_Fare != PMFee) { //存入缓存 SpBll.SaveSpPrice(item.SkyList[0].CarryCode.ToUpper(), item.SkyList[0].FlightCode, item.SkyList[0].FromDate, item.SkyList[0].FromCityCode, item.SkyList[0].ToCityCode, item.SkyList[0].Space, m_Fare, m_TAX, m_RQFare); } } } } #endregion //乘机人实体处理 for (int j = 0; j < item.PasList.Count; j++) { if (item.PasList[j].PassengerType == 1) { //成人 item.PasList[j].PMFee = PMFee; item.PasList[j].ABFee = ABFare; item.PasList[j].FuelFee = RQFare; } else { //婴儿 if (item.PasList[j].PassengerType == 3 && INFPrice != null) { item.PasList[j].PMFee = INFPMFee; item.PasList[j].ABFee = INFABFare; item.PasList[j].FuelFee = INFRQFare; } } if (item.PasList[j].PassengerType == 1 || item.PasList[j].PassengerType == 3) { //订单价格 TotalPMPrice += item.PasList[j].PMFee; TotalABFare += item.PasList[j].ABFee; TotalRQFare += item.PasList[j].FuelFee; } } //航段实体处理 //string Discount = "0"; for (int k = 0; k < item.SkyList.Count; k++) { item.SkyList[k].ABFee = ABFare; item.SkyList[k].FuelFee = RQFare; //只是单程才重新赋值 if (item.SkyList.Count == 1) { item.SkyList[k].SpacePrice = PMFee; } //item.SkyList[k].Discount = AdultPolicy.DiscountRate.ToString(); //if (Discount.Length > 10) //{ // Discount = Discount.Substring(0, 10); //} //item.SkyList[k].Discount = Discount; } //成人订单(含有婴儿) 赋值 item.Order.PMFee = TotalPMPrice; item.Order.ABFee = TotalABFare; item.Order.FuelFee = TotalRQFare; if (INFPrice != null) { //婴儿票面价 item.Order.BabyFee = INFPMFee; } item.Order.PolicyId = AdultPolicy.PolicyId; item.Order.PolicyPoint = AdultPolicy.PolicyPoint; item.Order.ReturnMoney = AdultPolicy.PolicyReturnMoney; item.Order.AirPoint = AdultPolicy.AirPoint; item.Order.ReturnPoint = AdultPolicy.ReturnPoint; item.Order.LaterPoint = AdultPolicy.LaterPoint; item.Order.PolicyMoney = AdultPolicy.PolicyYongJin; item.Order.DiscountDetail = AdultPolicy.DiscountDetail; item.Order.PolicyType = int.Parse(AdultPolicy.PolicyType); item.Order.PolicySource = int.Parse(AdultPolicy.PolicySource); item.Order.AutoPrintFlag = int.Parse(AdultPolicy.AutoPrintFlag); item.Order.PolicyCancelTime = AdultPolicy.FPGQTime; item.Order.PolicyReturnTime = AdultPolicy.PolicyReturnTime; //出票公司编号 string CPCpyNo = string.IsNullOrEmpty(AdultPolicy.CPCpyNo) ? userLogin.mSupCompany.UninCode : AdultPolicy.CPCpyNo; item.Order.CPCpyNo = CPCpyNo.Length > 12 ? CPCpyNo.Substring(0, 12) : CPCpyNo; item.Order.PolicyRemark = AdultPolicy.PolicyRemark;//政策备注 //原始政策返点 item.Order.OldPolicyPoint = AdultPolicy.OldPolicyPoint; //原始政策现返 item.Order.OldReturnMoney = AdultPolicy.OldPolicyReturnMoney; item.Order.A1 = 1; //已确认 item.Order.A2 = AdultPolicy.PolicyKind; //政策种类 item.Order.A7 = AdultPolicy.AirPoint; //航空公司返点 item.Order.A11 = AdultPolicy.PatchPonit; //补点 ////计算订单金额 //item.Order.PayMoney = d.CreateOrderPayMoney(item.Order, item.PasList); ////出票方收款金额 //item.Order.OrderMoney = d.CreateOrderOrderMoney(item.Order, item.PasList); bill.CreateOrderAndTicketPayDetailNew(item.Order, item.PasList); //出票Office if (AdultPolicy.PolicyOffice != "") { item.Order.PrintOffice = AdultPolicy.PolicyOffice; } if ((item.Order.OrderSourceType == 1 || item.Order.OrderSourceType == 2)) { //自动授权Office if (AdultPolicy.PolicyOffice.Trim().Length == 6 && !GYOffice.Contains(AdultPolicy.PolicyOffice.Trim().ToUpper())) { SendIns.AuthToOffice(item.Order.PNR, AdultPolicy.PolicyOffice, item.Order.Office, out ErrMsg); } //备注HU的A舱要添加一个指令才能入库,OSI HU CKIN SSAC/S1 if (AdultPolicy.PolicySource == "1" && AdultPolicy.PolicyType == "1" && AdultPolicy.AutoPrintFlag == "2" && item.Order.PNR.Trim().Length == 6 && item.Order.CarryCode.ToUpper().Trim() == "HU" && item.Order.Space.ToUpper().Trim() == "A") { string Office = item.Order.Office, Cmd = string.Format("RT{0}|OSI HU CKIN SSAC/S1^\\", item.Order.PNR.Trim()); SendIns.Send(Cmd, ref Office, 10); } } if (item.Order.PolicySource <= 2) { //本地政策提示 sbTip.Append("</br><ul><li>1.请于一小时内支付此订单,未支付将自动取消</li><li>2.编码内容中必须存在证件内容一项</li><li>3.PNR需要包含证件号</li><li>" + (IsINFCheck ? "4." + INFCountCheckMsg : "") + "</li></ul>"); } else { //接口和共享政策提示 if (AdultPolicy.PolicyOffice.Trim().Length == 6) { sbTip.Append("</br><ul><li>1.编码内容中必须存在证件内容一项</li><li>2.PNR需要包含证件号</li><li>3.请授权,授权指令:RMK TJ AUTH " + AdultPolicy.PolicyOffice + "</li>" + (IsINFCheck ? "4." + INFCountCheckMsg : "") + "</ul>"); } else { sbTip.Append("<ul ><li>1.编码内容中必须存在证件内容一项!</li><li>2.PNR需要包含证件号!</li>" + (IsINFCheck ? "3." + INFCountCheckMsg : "") + "</ul>"); } } #endregion } else { if (ChildPolicy != null) { #region 儿童实体赋值 //儿童订单政策 //儿童价格 decimal PMFee = ChildPolicy.SeatPrice, ABFare = ChildPolicy.ABFare, RQFare = ChildPolicy.RQFare; //乘机人实体处理 for (int j = 0; j < item.PasList.Count; j++) { if (item.PasList[j].PassengerType == 2) { //儿童 item.PasList[j].PMFee = PMFee; item.PasList[j].ABFee = ABFare; item.PasList[j].FuelFee = RQFare; //订单价格 TotalPMPrice += item.PasList[j].PMFee; TotalABFare += item.PasList[j].ABFee; TotalRQFare += item.PasList[j].FuelFee; } } //航段实体处理 //string Discount = "0"; for (int k = 0; k < item.SkyList.Count; k++) { item.SkyList[k].ABFee = ABFare; item.SkyList[k].FuelFee = RQFare; //只是单程才重新赋值 if (item.SkyList.Count == 1) { item.SkyList[k].SpacePrice = PMFee; } //Discount = ChildPolicy.DiscountRate.ToString(); //if (Discount.Length > 10) //{ // Discount = Discount.Substring(0, 10); //} //item.SkyList[k].Discount = Discount; } //儿童订单赋值 item.Order.PMFee = TotalPMPrice; item.Order.ABFee = TotalABFare; item.Order.FuelFee = TotalRQFare; //出票公司编号 string CPCpyNo = string.IsNullOrEmpty(ChildPolicy.CPCpyNo) ? userLogin.mSupCompany.UninCode : ChildPolicy.CPCpyNo; item.Order.CPCpyNo = CPCpyNo.Length > 12 ? CPCpyNo.Substring(0, 12) : CPCpyNo; item.Order.PolicyId = ChildPolicy.PolicyId; item.Order.AirPoint = ChildPolicy.AirPoint; item.Order.PolicyPoint = ChildPolicy.PolicyPoint; item.Order.ReturnPoint = ChildPolicy.ReturnPoint; item.Order.LaterPoint = ChildPolicy.LaterPoint; item.Order.ReturnMoney = ChildPolicy.PolicyReturnMoney; item.Order.PolicyMoney = ChildPolicy.PolicyYongJin; item.Order.DiscountDetail = ChildPolicy.DiscountDetail; item.Order.PolicyType = int.Parse(ChildPolicy.PolicyType); item.Order.PolicySource = int.Parse(ChildPolicy.PolicySource); item.Order.AutoPrintFlag = int.Parse(ChildPolicy.AutoPrintFlag); item.Order.PolicyCancelTime = ChildPolicy.FPGQTime; item.Order.PolicyReturnTime = ChildPolicy.PolicyReturnTime; item.Order.PolicyRemark = ChildPolicy.PolicyRemark;//政策备注 //原始政策返点 item.Order.OldPolicyPoint = ChildPolicy.OldPolicyPoint; //原始政策现返 item.Order.OldReturnMoney = ChildPolicy.OldPolicyReturnMoney; item.Order.A1 = 1; //已确认 item.Order.A7 = ChildPolicy.AirPoint; //航空公司返点 //政策种类 item.Order.A2 = ChildPolicy.PolicyKind; ////计算订单金额; //item.Order.PayMoney = d.CreateOrderPayMoney(item.Order, item.PasList); ////出票方收款金额 //item.Order.OrderMoney = d.CreateOrderOrderMoney(item.Order, item.PasList); bill.CreateOrderAndTicketPayDetailNew(item.Order, item.PasList); //出票Office if (ChildPolicy.PolicyOffice != "") { item.Order.PrintOffice = ChildPolicy.PolicyOffice; } //--------------------------------------- #endregion } } //代付返点,金额 if (item.Order.PolicySource > 2) { // 接口 取原始政策 item.Order.A7 = item.Order.OldPolicyPoint; item.Order.OutOrderPayMoney = d.CreateOrderIntfacePrice(item.Order, item.PasList); } else { //本地 取航空公司政策 decimal tempOldPolicyPoint = item.Order.OldPolicyPoint; item.Order.OldPolicyPoint = item.Order.A7; item.Order.OutOrderPayMoney = d.CreateOrderIntfacePrice(item.Order, item.PasList); item.Order.OldPolicyPoint = tempOldPolicyPoint; } item.Order.A13 = d.CreateOrderIntfacePrice(item.Order, item.PasList);// 后返金额 #endregion #region 添加订单账单明细sql List <string> sqlList = bill.CreateOrderAndTicketPayDetailNew(item.Order, item.PasList); if (sqlList != null && sqlList.Count > 0) { IsBillOK = true; InputParam.ExecSQLList.AddRange(sqlList.ToArray()); } #endregion }//For结束 //订单金额是否有误 bool IsOrderPayZero = false; foreach (OrderMustParamModel item in InputParam.OrderParamModel) { //判断金额是否正确 if (item.Order.PayMoney <= 0 || ((item.Order.PayMoney + item.Order.PayMoney * 0.003M) < item.Order.OrderMoney)) { IsOrderPayZero = true; PbProject.WebCommon.Log.Log.RecordLog("OrderServices", "PayMoneyError|" + ErrMsg + "订单:PayMoney=" + item.Order.PayMoney + " OrderMoney=" + item.Order.OrderMoney + "SQL:" + string.Join("\r\n ", InputParam.ExecSQLList.ToArray()), true, HttpContext.Current.Request); // DataBase.LogCommon.Log.Error("OrderServices", new Exception(ErrMsg + "订单:PayMoney=" + item.Order.PayMoney + " OrderMoney=" + item.Order.OrderMoney + "SQL:" + string.Join("\r\n ", InputParam.ExecSQLList.ToArray()))); break; } } #region 验证和修改订单 if (!IsBillOK) { ErrMsg = "订单生成失败!!"; PbProject.WebCommon.Log.Log.RecordLog("OrderServices", "时间:" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "\t" + ErrMsg + "SQL:" + string.Join("\r\n ", InputParam.ExecSQLList.ToArray()), true, HttpContext.Current.Request); } else { if (!IsOrderPayZero) { //修改订单有关实体信息 IsSuc = orderBLL.UpdateOrder(ref InputParam, out ErrMsg); if (IsSuc) { ErrMsg = "订单生成成功!" + sbTip.ToString(); } else { PbProject.WebCommon.Log.Log.RecordLog("OrderServices", "时间:" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "\t" + ErrMsg + "SQL:" + string.Join("\r\n ", InputParam.ExecSQLList.ToArray()), true, HttpContext.Current.Request); ErrMsg = "订单生成失败!"; } } else { PbProject.WebCommon.Log.Log.RecordLog("OrderServices", "时间:" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "\t" + ErrMsg + "SQL:" + string.Join("\r\n ", InputParam.ExecSQLList.ToArray()), true, HttpContext.Current.Request); ErrMsg = "订单金额错误,生成订单失败!"; } } #endregion } } else { ErrMsg = "未获取到政策数据,生成订单失败!"; } } catch (Exception ex) { PbProject.WebCommon.Log.Log.RecordLog("OrderServices", "时间:" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "\t" + ErrMsg, true, HttpContext.Current.Request); ErrMsg = "订单生成异常," + ex.Message; DataBase.LogCommon.Log.Error("OrderServices" + userLogin.User.id.ToString(), ex); } finally { if (IsSuc) { writer.Write("ok"); } else { writer.WriteEx(567, "confirm Order Error", ErrMsg); } } #endregion } }
/// <summary> /// 取消订单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnCancelOrder_Click(object sender, EventArgs e) { string showMsg = ""; try { //扩展参数 ParamEx pe = new ParamEx(); pe.UsePIDChannel = this.KongZhiXiTong != null && this.KongZhiXiTong.Contains("|48|") ? 2 : 0; //发送指令管理类 SendInsManage SendIns = new SendInsManage(mUser.LoginName, mCompany.UninCode, pe, configparam); string id = Hid_id.Value; //订单id Tb_Ticket_Order Order = new Tb_Ticket_OrderBLL().GetTicketOrderById(id); if (Order != null) ////判断订单状态 { bool restult = true; //白屏预订 新订单等待支付 并且开启退废票(分离、取消)编码的权限 才取消编码 if (Order.OrderSourceType == 1 && Order.OrderStatusCode == 1 && KongZhiXiTong.Contains("|32|")) { #region 1.白屏预订2.新订单等待支付3.开启退废票(分离、取消)编码的权限 判断是否需要取消编码 if (Hid_isCancelPnr.Value == "1") // 取消编码 { Hid_isCancelPnr.Value = "0"; if (Order.PNR != "") { string ErrMsg = ""; PnrAnalysis.PnrModel pnrModel = SendIns.GetPnr(Order.PNR, out ErrMsg); //编码状态不是已经出票的PNR if (pnrModel != null && !pnrModel.PnrStatus.Contains("RR")) { //调用取消编码的方法 restult = SendIns.CancelPnr(Order.PNR, Order.Office); } } showMsg = restult == true ? "取消编码成功!" : showMsg; } else { showMsg = "取消订单,用户需要保留编码!"; } #endregion } else { showMsg = "取消订单"; } //取消订单 restult = new PbProject.Logic.Order.Tb_Ticket_OrderBLL().CancelOrder(Order, mUser, mCompany, showMsg); if (restult) { OrderListDataBind(); showMsg = "取消订单成功!"; } else { showMsg = "取消订单失败!"; } } else { showMsg = "该订单不能取消!!!"; } } catch (Exception ex) { showMsg = "操作失败"; } ScriptManager.RegisterStartupScript(this, GetType(), DateTime.Now.Ticks.ToString(), "showdialog('" + showMsg + "');", true); }
/// <summary> /// 返回数据 /// </summary> /// <param name="fromcity">起飞城市三字码</param> /// <param name="tocity">抵达城市三字码</param> /// <param name="totime">起飞时间</param> /// <param name="arrtime">抵达时间</param> /// <param name="starttime">起飞日期</param> /// <param name="cw">舱位</param> /// <param name="aircode">航空公司</param> /// <param name="aircono">航班号</param> /// <param name="fd">返点</param> /// <param name="strYh">现返</param> /// <param name="hidId">GUID</param> /// <param name="Fare">固定特价</param> /// <param name="TAX">基建</param> /// <param name="RQFare">燃油</param> /// <param name="isGuding">是否固定特价</param> /// <param name="Yprice">是否固定特价</param> private SpecialPrice PlyMatch(UserLoginInfo userInfo, string fromcity, string tocity, string totime, string arrtime, string starttime, string cw, string aircode, string aircono, string fd, string strYh, string hidId, string Fare, string TAX, string RQFare, bool isGuding, string Yprice ) { SpecialPrice sp = new SpecialPrice(); try { string[] strValue = new string[4]; //非固定特价PATA数据 if (!isGuding) { #region pat 数据 // ig|SS MU747/X/30NOV/KMGSHANN1/0730 1025|pat:a&kmg226#1 //发送指令获取 DateTime dt = DateTime.Parse(starttime); string cmd = "SS " + aircode + aircono + "/" + cw + "/" + dt.ToString("R").Substring(4, 7).Replace(" ", "") + dt.Year.ToString().Substring(2) + "/" + fromcity + tocity + "NN1/" + totime.Replace(":", "") + " " + arrtime.Replace(":", "") + "|pat:a"; string zhiling = cmd; string strVale = string.Empty; //---------修改部分---------- if (userInfo.Configparam != null) { //开启使用特价缓存 true 开启 false关闭 bool IsUseSpCache = userInfo.FQP.KongZhiXiTong != null && userInfo.FQP.KongZhiXiTong.Contains("|99|"); //特价缓存 SpecialCabinPriceInfoBLL SpBll = new SpecialCabinPriceInfoBLL(); Tb_SpecialCabin_PriceInfo PriceInfo = null; if (IsUseSpCache) { SpBll.GetSpPrice(aircode, aircono, DateTime.Parse(starttime + " " + totime + ":00"), fromcity, tocity, cw); } if (PriceInfo == null) { //格式化编码内容类 PnrAnalysis.FormatPNR pnrformat = new PnrAnalysis.FormatPNR(); //扩展参数 ParamEx pe = new ParamEx(); pe.UsePIDChannel = userInfo.FQP.KongZhiXiTong != null && userInfo.FQP.KongZhiXiTong.Contains("|48|") ? 2 : 0; SendInsManage SendManage = new SendInsManage(userInfo.User.LoginName, userInfo.Company.UninCode, pe, userInfo.Configparam); string Office = userInfo.Configparam.Office.Split('^')[0]; strVale = SendManage.Send(cmd, ref Office, 15);//发送获取特价指令 string error = ""; decimal spFare = 0m, spABFare = 0m, spRQFare = 0m; //价格实体 PnrAnalysis.PatModel Pat = pnrformat.GetPATInfo(strVale, out error); if (Pat != null && Pat.UninuePatList.Count > 0) { strValue[0] = Pat.UninuePatList[0].Fare; //舱位价 strValue[1] = Pat.UninuePatList[0].TAX; //基建 strValue[2] = Pat.UninuePatList[0].RQFare; //燃油 strValue[3] = Pat.UninuePatList[0].Price; //总计(舱位价+基建+燃油) decimal.TryParse(strValue[0], out spFare); decimal.TryParse(strValue[1], out spABFare); decimal.TryParse(strValue[2], out spRQFare); } else { //-----------------2013-5-6添加---------------------------------------------- //没有PAT出价格 预订一个编码PAT价格后取消PNR 即使编码没有取消 后台程序自动取消 string ErrMsg = ""; if (ConfigIsSet(out ErrMsg)) { //----------构造航段和乘客--------------- List <Tb_Ticket_Passenger> pList = GetPassengerList(); List <Tb_Ticket_SkyWay> skywaylist = new List <Tb_Ticket_SkyWay>(); Tb_Ticket_SkyWay sky = new Tb_Ticket_SkyWay(); sky.CarryCode = aircode; sky.FlightCode = aircono; sky.FromDate = DateTime.Parse(starttime + " " + totime + ":00"); sky.ToDate = DateTime.Parse(starttime + " " + arrtime + ":00"); sky.FromCityCode = fromcity; sky.ToCityCode = tocity; sky.Space = cw; skywaylist.Add(sky); //------------------------- //预订编码 获取价格 RePnrObj pnrObj = GetPnrInfo(aircode, pList, skywaylist, out ErrMsg); string AdultPnr = string.Empty; Log_Pnr logAdultPnr = null; //成人预订信息编码记录 if (pnrObj.AdultYudingList.Count > 0) { AdultPnr = pnrObj.AdultPnr; if (string.IsNullOrEmpty(AdultPnr) || AdultPnr.Trim().Length != 6) { AdultPnr = ""; } //记录编码日志 YuDingPnrLog(pnrObj, pnrObj.AdultYudingList.Keys[0], pnrObj.AdultYudingList.Values[0], AdultPnr, pnrObj.Office, out logAdultPnr); } if (!string.IsNullOrEmpty(pnrObj.AdultPnr)) { //取消编码 if (SendManage.CancelPnr(pnrObj.AdultPnr, pnrObj.Office)) { if (logAdultPnr != null) { //修改状态 logAdultPnr.Flag = true; string tempSql = PbProject.Dal.Mapping.MappingHelper <Log_Pnr> .CreateUpdateModelSql(logAdultPnr, "id"); Manage.ExecuteNonQuerySQLInfo(tempSql); } } } //获取价格 if (pnrObj.PatModelList != null && pnrObj.PatModelList.Length > 0) { Pat = pnrObj.PatModelList[0]; if (Pat != null && Pat.UninuePatList.Count > 0) { strValue[0] = Pat.UninuePatList[0].Fare; //舱位价 strValue[1] = Pat.UninuePatList[0].TAX; //基建 strValue[2] = Pat.UninuePatList[0].RQFare; //燃油 strValue[3] = Pat.UninuePatList[0].Price; //总计(舱位价+基建+燃油) decimal.TryParse(strValue[0], out spFare); decimal.TryParse(strValue[1], out spABFare); decimal.TryParse(strValue[2], out spRQFare); } } } //--------------------------------------------------------------- } if (spFare != 0m) { //存入缓存 SpBll.SaveSpPrice(aircode.ToUpper(), aircono, DateTime.Parse(starttime + " " + totime + ":00"), fromcity, tocity, cw, spFare, spABFare, spRQFare); } } else { strValue[0] = PriceInfo.SpPrice.ToString(); //舱位价 strValue[1] = PriceInfo.SpABFare.ToString(); //基建 strValue[2] = PriceInfo.SpRQFare.ToString(); //燃油 strValue[3] = (PriceInfo.SpPrice + PriceInfo.SpABFare + PriceInfo.SpRQFare).ToString(); } } #endregion } else { strValue[0] = Fare; //舱位价 strValue[1] = TAX; //基建 strValue[2] = RQFare; //燃油 strValue[3] = (decimal.Parse(Fare) + decimal.Parse(TAX) + decimal.Parse(RQFare)).ToString(); } //实付金额 string sjvalue = new PbProject.Logic.Pay.Data(userInfo.Company.UninCode).CreatePassengerPayFee(decimal.Parse(strValue[0]), decimal.Parse(strValue[1]), decimal.Parse(strValue[2]), decimal.Parse(fd), decimal.Parse(strYh), 1).ToString(); string pyj = new PbProject.Logic.Pay.Data(userInfo.Company.UninCode).CreateCommissionCG(decimal.Parse(strValue[0]), decimal.Parse(fd)).ToString(); string ZK = ""; if (Yprice != "0")//如果传的有Y舱价格,则是特价类型的,则计算折扣 { PbProject.Logic.Pay.DataAction plpd = new PbProject.Logic.Pay.DataAction(); //特价时候需要计算折扣,让前台计算加入哪一个折扣范围 decimal tempFare = 0; decimal.TryParse(strValue[0], out tempFare); decimal tempYprice = 0; decimal.TryParse(Yprice, out tempYprice); //计算特价的折扣 ZK = (new PbProject.Logic.Pay.DataAction().FourToFiveNum((tempFare / tempYprice), 4) * 100).ToString("f2"); decimal tempZK = 0; decimal.TryParse(ZK, out tempZK); ZK = plpd.FourToFiveNum(tempZK, 0).ToString(); } if (strValue[0] != "" || strValue[1] != "" || strValue[2] != "" || strValue[3] != "") { decimal tempPrice = 0; decimal.TryParse(strValue[0], out tempPrice); #region pat 有数据 sp.SpacePrice = tempPrice.ToString("f0"); sp.Tax = strValue[1]; sp.RQFare = strValue[2]; sp.TotalPrice = strValue[3]; sp.RealPayPrice = sjvalue; sp.Commission = pyj; sp.GUID = hidId; sp.Discount = ZK; #endregion } else { #region pat 没有数据 #endregion pat 出来没有数据 } //最终sb格式 0舱位价@1基建@2燃油@3总计(舱位价+基建+燃油)@4实付金额@5佣金@6guid@7特价计算的折扣 return(sp); //Response.Write(""); } catch (Exception ex) { return(sp); } }
/// <summary> /// 机票支付 /// </summary> /// <param name="id">订单</param> /// <param name="payWay">支付方式</param> /// <param name="code">网银银行代码</param> private void TicketOrderPay(string id, string payWay, string code) { string msgShow = ""; string url = string.Empty; try { bool result = false; string payDetails = "";//分账明细 #region 获取订单信息 //PayWay 支付方式:1支付宝、2快钱、3汇付、4财付通、5支付宝网银、6快钱网银 、7汇付网银、8财付通网银、 //9支付宝pos、10快钱pos、11汇付pos、12财付通pos、13易宝pos、14账户支付、15收银 //string tempSqlWhere = " OrderId='" + id + "'"; string tempSqlWhere = " id='" + id + "'"; List <Tb_Ticket_Order> bParametersList = new PbProject.Logic.Order.Tb_Ticket_OrderBLL().GetListBySqlWhere(tempSqlWhere); Tb_Ticket_Order mOrder = null; if (bParametersList != null && bParametersList.Count == 1) { mOrder = bParametersList[0]; #region 判断PNR状态是否取消等,取消就不能支付 if (mOrder.OrderStatusCode != 1 && mOrder.OrderStatusCode != 9) { msgShow = "订单异常,不能支付!"; } #endregion if (this.KongZhiXiTong.Contains("|101|")) { //超过 1 小时后的订单能支付 } else { #region 超过1个小时不能支付 if (mOrder.OrderStatusCode == 1) { DateTime dtTime = DateTime.Now; if (dtTime.CompareTo(mOrder.CreateTime.AddHours(1)) > 0) { // 超过1个小时不能支付 msgShow = "超过1个小时的订单不能支付,请重新生成订单进行支付!"; } } #endregion } #region 判断PNR状态是否取消等,取消就不能支付 //扩展参数 ParamEx pe = new ParamEx(); pe.UsePIDChannel = this.KongZhiXiTong != null && this.KongZhiXiTong.Contains("|48|") ? 2 : 0; SendInsManage sendins = new SendInsManage(mUser.LoginName, mCompany.UninCode, pe, this.configparam); string ErrMsg; if (mOrder.OrderSourceType == 1 && mOrder.A9 != "1") { PnrAnalysis.PnrModel PnrModel = sendins.GetPnr(mOrder.PNR, mOrder.Office, out ErrMsg); if (ErrMsg.IndexOf("已被取消") != -1) { msgShow = "此PNR(" + mOrder.PNR + ")状态为异常,请检查PNR状态后再试!"; } else if (PnrModel != null && ErrMsg == "") { if (PnrModel.PassengerNameIsCorrent) { if (KongZhiXiTong != null && KongZhiXiTong.Contains("|23|")) { if ((PnrModel._OldPnrContent.Contains("THIS PNR WAS ENTIRELY CANCELLED") && PnrModel._OldPnrContent.ToUpper().Contains(mOrder.PNR.ToUpper()))) { msgShow = "此PNR(" + mOrder.PNR + ")状态为异常,请检查PNR状态后再试!"; } else { string PnrStatus = PnrModel.PnrStatus; if (string.IsNullOrEmpty(PnrStatus)) { msgShow = "此PNR(" + mOrder.PNR + ")数据异常,请检查PNR状态后再试!"; } else { if (!PnrStatus.Contains("HK") && !PnrStatus.Contains("DK") && !PnrStatus.Contains("RR") && !PnrStatus.Contains("KK")) { msgShow = "此PNR(" + mOrder.PNR + ")状态为:" + PnrStatus + ",请检查PNR状态后再试!"; } } } } } else { msgShow = "此PNR(" + mOrder.PNR + ")中乘机人名字:" + string.Join(",", PnrModel.ErrorPassengerNameList.ToArray()) + " 不正确!"; } } } #endregion 判断PNR状态是否取消等,取消就不能支付 if (msgShow == "") { mOrder.PayWay = int.Parse(payWay); // 切换支付方式:修改订单账单明细数据 result = new PbProject.Logic.Pay.Bill().UpdateOrderAndTicketPayDetail(mOrder); if (result == true) { //获取分账明细 payDetails = new PbProject.Logic.Pay.Bill().PayDetails(payWay, mOrder.OrderId); result = string.IsNullOrEmpty(payDetails) ? false : result; } } } #endregion if (result) { #region 支付 if (payWay == "1" || payWay == "5")//支付宝 { #region 支付参数赋值 AliPayParam aliPayParam = new AliPayParam(); aliPayParam.Body = "机票订单"; aliPayParam.DefaultBank = code; aliPayParam.Extra_common_param = mUser.id.ToString(); //自定义:操作人id aliPayParam.Out_trade_no = mOrder.OrderId; aliPayParam.Royalty_parameters = payDetails; //分账明细 aliPayParam.Subject = "机票订单"; aliPayParam.Total_fee = mOrder.PayMoney.ToString("f2"); if ((!string.IsNullOrEmpty(mOrder.A9) && mOrder.A9 == "1") || string.IsNullOrEmpty(mOrder.PNR)) { //不检查编码 OnErrorNew("不检查编码,PNR:" + mOrder.PNR, false); } else { //需要检查编码 #region 判断PNR tempSqlWhere = " PNR='" + mOrder.PNR + "' and OrderStatusCode=4 and (PayWay=1 or PayWay=5)"; List <Tb_Ticket_Order> orderListNew = new PbProject.Logic.Order.Tb_Ticket_OrderBLL().GetListBySqlWhere(tempSqlWhere); if (orderListNew == null || orderListNew.Count == 0) { //先看该订单支付已经支付过 aliPayParam.Extend_param = "PNR^" + mOrder.PNR; } else { OnErrorNew("该编码已经有支付记录,PNR:" + mOrder.PNR, false); } #endregion } #endregion msgShow = new PbProject.Logic.Pay.AliPay().GetPay(aliPayParam); } else if (payWay == "2" || payWay == "6")//快钱 { PbProject.Logic.Pay.DataAction d = new PbProject.Logic.Pay.DataAction(); decimal tempMoney = d.FourToFiveNum(mOrder.PayMoney * 0.001M, 2) * 100; //手续费 #region 支付参数赋值 _99BillParam billParam = new _99BillParam(); billParam.Bankcode = code; billParam.Detail = payDetails; //分账明细 billParam.Ext = mUser.id.ToString(); //操作人id billParam.Money = tempMoney.ToString("f0"); //供应商收款 billParam.Orderid = mOrder.OrderId; //billParam.Payid = "*****@*****.**"; billParam.Payid = ""; billParam.Paytype = (string.IsNullOrEmpty(code)) ? "00" : "10"; billParam.Pname = "机票订单"; billParam.Price = (mOrder.PayMoney * 100).ToString("f0"); //供应商收款 billParam.Ptype = "1"; #endregion msgShow = new PbProject.Logic.Pay._99Bill().GetPay(billParam); } else if (payWay == "3" || payWay == "7")//汇付天下 { #region 支付参数赋值 ChinaPnrParam chinaPnrParam = new ChinaPnrParam(); chinaPnrParam.Orderid = mOrder.OrderId; //订单号 chinaPnrParam.Price = mOrder.PayMoney.ToString("f2"); //订单总价 chinaPnrParam.Merpriv = mUser.id.ToString(); //自定义字段 chinaPnrParam.Details = payDetails; //分账明细 chinaPnrParam.Pnr = mOrder.PNR; #endregion msgShow = new PbProject.Logic.Pay.ChinaPnr().Buy(chinaPnrParam); } else if (payWay == "4" || payWay == "8" || payWay == "40")// 财付通 { string queryParam = string.Format("orderid={0}&total_tee={1}&userhostaddress={2}&attach={3}&busargs={4}&busdesc={5}&banktype={6}", mOrder.OrderId, (mOrder.PayMoney * 100).ToString("F0"), Request.UserHostAddress, mUser.id.ToString(), payDetails, string.Format("{0}^{1}^{2}^{3}^{4}^{5}", mOrder.PNR, mOrder.Travel, mOrder.PassengerNumber, mUser.id.ToString(), mOrder.CreateUserName, "13800000000"), code); url = string.Format("http://lzh.mypb.cn/Pay/TenPay.aspx?{0}", queryParam); // url = string.Format("TenPay.aspx?{0}", queryParam); } #endregion } else { OnErrorNew("支付错误:" + payDetails, false); msgShow = string.IsNullOrEmpty(msgShow) ? "支付错误" : msgShow; } } catch (Exception ex) { msgShow = "支付异常"; OnErrorNew(msgShow + ex.ToString(), false); } if (!string.IsNullOrEmpty(url)) { Response.Redirect(url); } else { OnErrorNew(msgShow, false); Response.Write(msgShow); } }