public void OnCreateOrder() { //if (_QXValue.Contains("|62|"))//控制是否自动生成订单 //{ List <PbProject.Model.Tb_Ticket_SkyWay> skyList = new PbProject.Logic.Order.Tb_Ticket_SkyWayBLL().GetSkyWayListBySQLWhere("OrderId='" + _order.OrderId + "'"); string RTContent = skyList[0].NewPnrContent.Replace("\r", "").Replace("\t", "").Replace("\n", ""); PnrAnalysis.FormatPNR ss = new PnrAnalysis.FormatPNR(); string PATContent = ss.RemoveHideChar(skyList[0].Pat).Replace("\r", "").Replace("\t", "").Replace("\n", ""); //string RTContent = RepalaceChar(skyList[0].Pat); //OnErrorNew(1, "51book开始生成订单", "51book生成订单"); DataSet dsReson = _51bookSerive.bookCreatePolicyOrderByPNR(_51bookAccout, _order.PNR, _order.PolicyId, _51bookUrl, _51bookUrl, _mUser.UserName, _51bookAg, RTContent, PATContent); string mes51bookCreate = "table's count:" + dsReson.Tables.Count + "&"; for (int i = 0; i < dsReson.Tables[0].Rows.Count; i++) { for (int j = 0; j < dsReson.Tables[0].Columns.Count; j++) { mes51bookCreate = mes51bookCreate + dsReson.Tables[0].Columns[i].ColumnName + ":" + dsReson.Tables[0].Rows[i][j].ToString() + "/";//DataTable转化成String类型 } } mes51bookCreate = "table1's name:" + dsReson.Tables[0].TableName + "/table1's content:" + mes51bookCreate; if (dsReson.Tables[0].Columns.Contains("ErorrMessage")) { CreateLog(_order.OrderId, "预定", mes51bookCreate, 1); //OnErrorNew(1, "51book生成订单失败", "51book生成订单"); } else { if (dsReson.Tables[0].Rows[0]["sequenceNo"].ToString() != "") { CreateLog(_order.OrderId, "预定", "51book生成订单成功!", 3); //OnErrorNew(1, "51book生成订单成功", "51book生成订单"); if (dsReson.Tables[0].Rows[0]["settlePrice"].ToString() == "") { dsReson.Tables[0].Rows[0]["settlePrice"] = "0"; } OnPay(Convert.ToDecimal(dsReson.Tables[0].Rows[0]["settlePrice"].ToString()), dsReson.Tables[0].Rows[0]["sequenceNo"].ToString(), mes51bookCreate); } } //OnErrorNew(1, mesPMCreate, "PMdataset"); //} }
public void OnCreateOrder() { //if (_QXValue.Contains("|62|"))//控制是否自动生成订单 //{ List <PbProject.Model.Tb_Ticket_SkyWay> skyList = new PbProject.Logic.Order.Tb_Ticket_SkyWayBLL().GetSkyWayListBySQLWhere("OrderId='" + _order.OrderId + "'"); string RTContent = skyList[0].NewPnrContent.Replace("\r", "").Replace("\t", "").Replace("\n", ""); PnrAnalysis.FormatPNR ss = new PnrAnalysis.FormatPNR(); string PATContent = ss.RemoveHideChar(skyList[0].Pat).Replace("\r", "").Replace("\t", "").Replace("\n", ""); //string RTContent = RepalaceChar(skyList[0].Pat); string PNRinfo = "O|P|" + _order.PNR + "^F^" + _order.BigCode + "|" + skyList[0].FromDate.ToString("yyyy-MM-dd") + "|" + skyList[0].FromCityCode + "|" + skyList[0].FromCityName + "|" + skyList[0].ToCityCode + "|" + skyList[0].ToCityName + "|" + skyList[0].CarryCode + skyList[0].FlightCode + "^N||" + skyList[0].FromDate.ToShortTimeString() + "|" + skyList[0].ToDate.ToShortTimeString() + "|" + skyList[0].Space + "|" + skyList[0].Discount + "||" + _order.PMFee / _order.PassengerName.Split('/').Length + "|" + (skyList[0].ABFee + skyList[0].FuelFee) + "|" + _order.PassengerName.Split('/').Length + "|" + _order.PassengerName.Replace("/", "@"); DataSet dsReson = _todayService.CreateOrderByPNR(_todayAccout2, _order.PNR, _order.JinriGYCode, (_order.PolicyPoint * 100).ToString(), _order.PolicyId, PNRinfo, "0"); string mestodayCreate = "table's count:" + dsReson.Tables.Count + "&"; for (int i = 0; i < dsReson.Tables[0].Rows.Count; i++) { for (int j = 0; j < dsReson.Tables[0].Columns.Count; j++) { mestodayCreate = mestodayCreate + dsReson.Tables[0].Columns[i].ColumnName + ":" + dsReson.Tables[0].Rows[i][j].ToString() + "/";//DataTable转化成String类型 } } mestodayCreate = "table1's name:" + dsReson.Tables[0].TableName + "/table1's content:" + mestodayCreate; if (dsReson != null) { if (dsReson.Tables[0].Rows[0]["OrderNo"].ToString() != "") { CreateLog(_order.OrderId, "预定", "今日生成订单成功", 3); if (dsReson.Tables[0].Rows[0]["PayMoney"].ToString() == "") { dsReson.Tables[0].Rows[0]["PayMoney"] = "0"; } OnPay(Convert.ToDecimal(dsReson.Tables[0].Rows[0]["PayMoney"].ToString()), dsReson.Tables[0].Rows[0]["OrderNo"].ToString(), mestodayCreate); } else { CreateLog(_order.OrderId, "预定", "今日生成订单失败", 3); CreateLog(_order.OrderId, "预定", "今日生成订单失败:" + mestodayCreate, 1); } } //} }
/// <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); }
public List <PbProject.Model.Tb_Ticket_Policy> GetPolicy(bool ChangePnr) { List <PbProject.Model.Tb_Ticket_Policy> mPolicyList = new List <Tb_Ticket_Policy>(); try { //if (_QXValue.Contains("")) //{ List <PbProject.Model.Tb_Ticket_SkyWay> SkyList = new PbProject.Logic.Order.Tb_Ticket_SkyWayBLL().GetSkyWayListBySQLWhere("OrderId='" + _order.OrderId + "'"); string CompanyCode = _51bookAccout; string CompanySign = _51bookAg; string travel = "OW"; string time = SkyList[0].FromDate.ToShortDateString(); if (SkyList.Count > 1) { travel = "RT"; time = SkyList[1].FromDate.ToShortDateString(); } DataSet ds51 = new DataSet(); PnrAnalysis.FormatPNR ss = new PnrAnalysis.FormatPNR(); string pnrTxt = ss.RemoveHideChar(SkyList[0].NewPnrContent).Replace("\r", "").Replace("\t", "").Replace("\n", ""); string patTxt = ss.RemoveHideChar(SkyList[0].Pat).Replace("\r", "").Replace("\t", "").Replace("\n", ""); //string pnrTxt = RepalaceChar(SkyList[0].Pat); int stau = 0; try { ds51 = _51bookSerive.bookGetPolicyDataByPNR(CompanyCode, _order.PNR, CompanySign, pnrTxt, patTxt); } catch (Exception e) { stau = 1; //OnError(e.ToString(), "PiaoBao.BLLLogic.Policy.InterFacePol.Get51BookPol"); } if (stau == 1) { try { ds51 = _51bookSerive.bookGetPolicyDataByPNR(CompanyCode, _order.PNR, CompanySign, pnrTxt, patTxt); } catch (Exception e) { stau = 1; //OnError(e.ToString(), "PiaoBao.BLLLogic.Policy.InterFacePol.Get51BookPol"); } } if (ds51.Tables.Count > 0) { if (ds51.Tables[0].Rows.Count > 0) { try { string where = "startDate<='" + SkyList[0].FromDate.ToShortDateString() + "' and expiredDate>='" + SkyList[0].ToDate.ToShortDateString() + "' "; where += " and printTicketStartDate<='" + DateTime.Now.ToShortDateString() + "' and printTicketExpiredDate>='" + DateTime.Now.ToShortDateString() + "'"; where += " and routeType = '" + travel + "' and needSwitchPNR='false'"; mPolicyList = Merger51DT(ds51.Tables[0].Select(), travel, SkyList[0].FromDate.ToShortDateString(), time, _mTopcom, ChangePnr); //updateInterFcae(ds51); } catch (Exception ex) { //errorData51book = "1"; //OnError(ex.ToString(), "PiaoBao.BLLLogic.Policy.InterFacePol.Get51BookPol"); } } } //} } catch (Exception ex) { //OnError("整体线程异常," + ex.ToString(), "PiaoBao.BLLLogic.Policy.InterFacePol.Get51BookPol"); } return(mPolicyList); }
public void Test() { /* * BSP出票步骤 * 1.发送RT指令检查编码是否已出票,已出票解析出票号和对应的乘客姓名 * 2.编码没有出票,发送RT指令解析编码中的多余项Xe掉,这个需要多次翻页Xe,最后再次发送RT解析航段序号和出票时限序号记录 * 3.判断编码是成人还是儿童,分别发送PAT获取成人或者儿童的PAT价格信息,对比PAT中是否存在要出票的价格,不存在结束出票,出票失败.存在获取出票价格的PAT序号 * 4.将出票的价格填进编码,发送指令:RT编码|PAT价格|SFC:序号|@ * 5.检查价格是否填入编码,发送出票指令:RT编码|XE出票时限序号|出票航段序号RR|ETDZ 打票机号 * 6.检查返回数据中是否含有票号和该编码,有出票成功解析出票号 但是这个没有关联对应的乘客,按顺序获取。 没有票号再次发送RT编码指令 从返回结果中获取票号,没有则失败 */ //string strIP = "210.14.139.29"; //string strPort = "2232"; //string strCpOffice = "CTU186"; //string strPrintNo = "10"; //string strPnr = "abcdef"; //string strCpPrice = "100"; PnrAnalysis.FormatPNR format = new PnrAnalysis.FormatPNR(); // string strData = @"1.邵文龙 HVH5JJ 2. SC1194 L FR11JUL CKGTNA HK1 0810 1005 E //3.CTU/T CTU/T 028-5566222/CTU QI MING INDUSTRY CO.,LTD/TONG LILI ABCDEFG //4.TL/0540/11JUL/CTU324 //5.SSR FOID SC HK1 NI08-70019/P1 //6.OSI SC CTCM13640550770/P1 //7.OSI SC CTCT13981780660 //8.RMK CA/NCVTX6 //9.CTU324 //>PAT:A //01 L FARE:CNY770.00 TAX:CNY50.00 YQ:CNY120.00 TOTAL:940.00 //SFC:01 "; //string msg = ""; //PnrAnalysis.PnrModel pnrmodel = format.GetPNRInfo("HVH5JJ", strData, false, out msg); // string RegPasSSRPattern = @"\s*(?<=SSR FOID)\s*(?<carry>\w{2})\s*(?<state>[A-Za-z]{2}\d{0,3})\s*(\/)?NI\s*(?<SSRNum>[\w|\(|\)|\-]+)/P(?<Num>\d+)\s*"; //string ssr = "SSR FOID SC HK1 NI08-70019/P1"; string strdata = @" **ELECTRONIC TICKET PNR** 1.宋欣芮 2.于佳呈 HF4485 3. CA4153 A SU06JUL14CTUURC RR2 1615 1950 E T2T2 4.URC/T URC/T0991-3677114/WULUMUQITITONGBAITONGJIPIAODAILIYOUXIANGONGSI/ /HUANGZHENPING ABCDEFG 5.0993-2833333 6.TL/1515/06JUL14/URC302 7.SSR FOID CA HK1 NI653127199207132212/P2 8.SSR FOID CA HK1 NI653101199306232020/P1 9.SSR OTHS 1E 1 PNR RR AND PRINTED 10.SSR OTHS 1E 1 CAAIRLINES ET PNR 11.SSR ADTK 1E BY URC05JUL14/1601 OR CXL CA ALL SEGS + 12.SSR TKNE CA HK1 CTUURC 4153 A06JUL 9992342455793/1/P1 - 13.SSR TKNE CA HK1 CTUURC 4153 A06JUL 9992342455794/1/P2 14.OSI CA CTCM18721531432/P1 15.OSI CA CTCM15199832222/P2 16.OSI CA CTCT13070099773 17.OSI 1E CAET TN/9992342455793-9992342455794 18.RMK CA/MK8MNS 19.RMK TJ AUTH URC221 20.URC302 "; // string errMsg=""; // PnrAnalysis.PnrModel pnrmodel = format.GetPNRInfo("HF4485", strdata, false, out errMsg); }
public void OnCreateOrder() { //if (_QXValue.Contains("|62|"))//控制是否自动生成订单 //{ List <PbProject.Model.Tb_Ticket_SkyWay> skyList = new PbProject.Logic.Order.Tb_Ticket_SkyWayBLL().GetSkyWayListBySQLWhere("OrderId='" + _order.OrderId + "'"); string RTContent = skyList[0].NewPnrContent.Replace("\r", "").Replace("\t", "").Replace("\n", ""); PnrAnalysis.FormatPNR ss = new PnrAnalysis.FormatPNR(); string PATContent = ss.RemoveHideChar(skyList[0].Pat).Replace("\r", "").Replace("\t", "").Replace("\n", ""); #region 处理高低开 if (!_order.Space.Contains("1"))//不为子舱位 { string bb = ""; PnrAnalysis.PatModel sss = ss.GetPATInfo(skyList[0].NewPnrContent, out bb); if (sss.ChildPat != null) { for (int i = 0; i < sss.PatList.Count; i++) { if (sss.PatList[i].SeatGroup == sss.ChildPat.SeatGroup) { sss.PatList.Remove(sss.PatList[i]); break; } } PnrAnalysis.PatInfo patFirst = sss.PatList[0]; PnrAnalysis.PatInfo patLast = sss.PatList[sss.PatList.Count - 1]; //if (_QXValue.Contains("|60|"))//低开开关是否打开 //{ PATContent = ss.NewPatData(patFirst); //} //else //{ // PATContent = ss.NewPatData(patLast); //} bool IsOnePrice = false; RTContent = ss.RemoveChildSeat(RTContent, out IsOnePrice); } } #endregion //OnErrorNew(1, "票盟开始生成订单", "票盟生成订单"); DataSet dsReson = _pmService.CreateOrderByPAT(_order.PolicyId, _order.BigCode, HttpUtility.UrlEncode(RTContent), HttpUtility.UrlEncode(PATContent), "0", _pmAccout, _pmAg); string mesPMCreate = "table's count:" + dsReson.Tables.Count + "&"; if (dsReson.Tables.Count <= 1) { for (int i = 0; i < dsReson.Tables[0].Rows.Count; i++) { for (int j = 0; j < dsReson.Tables[0].Columns.Count; j++) { mesPMCreate = mesPMCreate + dsReson.Tables[0].Columns[i].ColumnName + ":" + dsReson.Tables[0].Rows[i][j].ToString() + "/";//DataTable转化成String类型 } } mesPMCreate = "table1's name:" + dsReson.Tables[0].TableName + "/table1's content:" + mesPMCreate; CreateLog(_order.OrderId, "预定", mesPMCreate, 1); //OnErrorNew(1, "票盟生成订单失败", "票盟生成订单"); } else { mesPMCreate = mesPMCreate + "&"; for (int i = 0; i < dsReson.Tables[1].Rows.Count; i++) { for (int j = 0; j < dsReson.Tables[1].Columns.Count; j++) { mesPMCreate = mesPMCreate + dsReson.Tables[1].Columns[i].ColumnName + ":" + dsReson.Tables[1].Rows[i][j].ToString() + "/"; } } mesPMCreate = "table2's name:" + dsReson.Tables[0].TableName + "/table2's content:" + mesPMCreate; if (dsReson.Tables[0].Rows[0]["statuscode"].ToString() == "0") { CreateLog(_order.OrderId, "预定", "票盟生成订单成功!", 3); OnPay(Convert.ToDecimal(dsReson.Tables[1].Rows[0]["payfee"].ToString()), dsReson.Tables[1].Rows[0]["orderid"].ToString(), mesPMCreate); //OnErrorNew(1, "票盟生成订单成功", "票盟生成订单"); } else { //票盟生成订单失败 //OnErrorNew(1, 票盟生成订单失败, "票盟生成订单"); CreateLog(_order.OrderId, "预定", "票盟生成订单失败:" + mesPMCreate, 3); } } //OnErrorNew(1, mesPMCreate, "PMdataset"); //} }