private void decfeeCheck() { EagleAPI.LogWrite("由于ETDZ未扣款,用IBE检查ETDZ是否成功"); string pnr = EagleAPI.etstatic.Pnr.ToLower(); Options.ibe.ibeInterface rt = new Options.ibe.ibeInterface(); Options.ibe.IbeRt rtRes = new Options.ibe.IbeRt(rt.rt2(pnr)); bool succ = false; string[] tktnos = rtRes.getpeopleinfo(2); if (tktnos[0] == "")//没有电子票号,出票失败,退出检测 { EagleAPI.LogWrite("IBE检查完毕,当前PNR" + pnr + "出票失败"); return; } //成功 EagleAPI.LogWrite("IBE检查完毕,当前PNR" + pnr + "出票成功,开始进行扣款计算!"); //人数 int pCount = tktnos.Length; EagleAPI.LogWrite("人数:" + pCount.ToString()); //航段数 int fCount = rtRes.getflightsegsinfo().Length; EagleAPI.LogWrite("航段数:" + fCount.ToString()); }
/// <summary> /// 取機型 /// </summary> /// <param name="pnr"></param> public string step2(string pnr) { this.Text = "正在获取机型……"; Application.DoEvents(); Options.ibe.ibeInterface ib = new Options.ibe.ibeInterface(); return(ib.dsg(pnr)); }
private void rtPnr() { Options.ibe.ibeInterface ib = new Options.ibe.ibeInterface(); rtXml = ib.rt2(tbPnr.Text); if (rtXml == "") { cb被保险人姓名.Text = "PNR有误或该PNR已取消"; return; } Options.ibe.IbeRt ir = new Options.ibe.IbeRt(rtXml); string[] names = ir.getpeopleinfo(0); cb被保险人姓名.Items.AddRange(names); cb被保险人姓名.Text = names[0]; tb证件号.Text = ir.getpeopleinfo(1)[0]; string[] segments = ir.getflightsegsinfo(); tb航班号.Text = ""; for (int i = 0; i < segments.Length; i++) { string[] fi = segments[i].Split('~'); tb航班号.Text += fi[0]; if (i == 0) { System.Globalization.DateTimeFormatInfo myDTFI = new System.Globalization.CultureInfo("en-us", false).DateTimeFormat; DateTime dt = DateTime.ParseExact(fi[3].Replace(" CST ", " "), "ddd MMM dd HH:mm:ss yyyy", myDTFI); tb乘机日.Text = dt.ToString();// dt.ToShortDateString(); } } }
private void button2_Click(object sender, EventArgs e) { if (textBox1.Text.Trim().Length != 5 || !EagleAPI.IsRtCode(textBox1.Text.Trim())) { //this.textBox1.Text += "错误PNR!"; MessageBox.Show (textBox1.Text + ":错误PNR!PNR只能为五个字节,PNR中不可能有字母0,I,U", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //EagleAPI.EagleSendOneCmd("i~rt:n/" + this.textBox1.Text); try { Options.ibe.ibeInterface ib = new Options.ibe.ibeInterface(); MessageBox.Show(ib.rt(textBox1.Text.Trim(), GlobalVar.serverAddr == GlobalVar.ServerAddr.HangYiWang)); } catch { EagleAPI.EagleSendOneCmd("i~rt:n/" + this.textBox1.Text); } }
/// <summary> /// 取航段信息 /// </summary> /// <param name="pnr"></param> public void step1(string pnr) { this.Text = "正在清理控件……"; Application.DoEvents(); textBox3.Clear(); textBox4.Clear(); textBox5.Clear(); textBox6.Clear(); textBox7.Clear(); textBox8.Clear(); textBox9.Clear(); textBox10.Clear(); textBox11.Clear(); textBox12.Clear(); textBox13.Clear(); textBox14.Clear(); textBox15.Clear(); textBox16.Clear(); textBox17.Clear(); textBox18.Clear(); //for (int i = 0; i < 4; i++) planeStyle[i] = ""; planeStyleList.Clear(); txtName.Text = ""; #if REALIBE string dsgxml = step2(pnr); Options.ibe.ibeInterface ib = new Options.ibe.ibeInterface(); string xml = ib.rt2(pnr, GlobalVar.serverAddr == GlobalVar.ServerAddr.HangYiWang); #else logic.IBEAgent ibeagent = new logic.IBEAgent(); ibeagent.IpID = GlobalVar.CurIPUsing; string xml = ibeagent.wsRT2(pnr.ToUpper()); #endif if (string.IsNullOrEmpty(xml) || xml.Contains("<ibe>err</ibe>")) { EagleWebService.IbeStuff.RefreshIbeUrl(); MessageBox.Show("查询PNR失败!返回信息如下:\n" + xml); return; } this.Text = "正在获取PNR信息……"; Application.DoEvents(); Options.ibe.IbeRt ir = new Options.ibe.IbeRt(xml); ChildCount = 0; nkg乘客信息 = new string[ir.getpeopleinfo(0).Length]; for (int i = 0; i < ir.getpeopleinfo(0).Length; i++) { //if (ir.getpeopleinfo(1)[i] == "") throw new Exception("ErrorCardId"); //commentted by chenqj txtName.Text += ir.getpeopleinfo(0)[i] + "-" + ir.getpeopleinfo(1)[i] + (i == ir.getpeopleinfo(0).Length - 1 ? "" : ";"); if (ir.getpeopleinfo(0)[i].IndexOf("(CHD)") > 0) { ChildCount++; } nkg乘客信息[i] = ir.getpeopleinfo(0)[i] + "-" + ir.getpeopleinfo(1)[i] + "-" + (ir.getpeopleinfo(0)[i].IndexOf("(CHD)") > 0 ? "儿童" : "成人"); } string[] fi = ir.getflightsegsinfo(); nkg航班信息 = new string[fi.Length]; for (int i = 0; i < fi.Length; i++) { string[] segment = fi[i].Split('~'); //more than 4 destinations,modified by chenqj { int index = i * 4 + 3; groupBox1.Controls["textBox" + index.ToString()].Text = segment[0]; //航班號 groupBox1.Controls["textBox" + (++index).ToString()].Text = segment[1]; //艙位 System.Globalization.DateTimeFormatInfo myDTFI = new System.Globalization.CultureInfo("en-us", false).DateTimeFormat; DateTime dt; try { dt = DateTime.ParseExact(segment[3].Replace(" CST ", " "), "ddd MMM dd HH:mm:ss yyyy", myDTFI); } catch { dt = DateTime.Parse(segment[3]); } groupBox1.Controls["textBox" + (++index).ToString()].Text = dt.ToString("yyyy-MM-dd HHmm", myDTFI).ToUpper(); //時間 groupBox1.Controls["textBox" + (++index).ToString()].Text = segment[2]; //日期 #if REALIBE planeStyleList.Add(getPlaneByFlightno(dsgxml, segment[0])); #else planeStyleList.Add(segment[6]); #endif } Application.DoEvents(); { //到达时间segmeng[4]; System.Globalization.DateTimeFormatInfo myDTFI = new System.Globalization.CultureInfo("en-us", false).DateTimeFormat; DateTime leavetime; try { leavetime = DateTime.ParseExact(segment[4].Replace(" CST ", " "), "ddd MMM dd HH:mm:ss yyyy", myDTFI); } catch { leavetime = DateTime.Parse(segment[4]); } string lt = leavetime.ToString("yyyy-MM-dd HHmm", myDTFI).ToUpper(); DateTime arrivetime; try { arrivetime = DateTime.ParseExact(segment[5].Replace(" CST ", " "), "ddd MMM dd HH:mm:ss yyyy", myDTFI); } catch { arrivetime = DateTime.Parse(segment[5]); } string at = arrivetime.ToString("yyyy-MM-dd HHmm", myDTFI).ToUpper(); nkg航班信息[i] = lt.Split(' ')[0] + ","; nkg航班信息[i] += lt.Split(' ')[1].Insert(2, ":") + "(" + segment[2].Substring(0, 3) + ")" + ","; nkg航班信息[i] += at.Split(' ')[1].Insert(2, ":") + "(" + segment[2].Substring(3, 3) + ")" + ","; nkg航班信息[i] += pnr + ","; nkg航班信息[i] += "HK" + ",";//订座状态 nkg航班信息[i] += EagleAPI.GetAirLineName(segment[0].Substring(0, 2)) + ","; nkg航班信息[i] += segment[0] + ","; nkg航班信息[i] += segment[1] + ","; nkg航班信息[i] += "#票价#" + ","; //nkg航班信息[i] += planeStyle[i] + ","; nkg航班信息[i] += planeStyleList[i] + ","; nkg航班信息[i] += "#机建燃油#"; } } //**************************2008-7-16置gbYzpOrder中的航班信息变量**********************************开始 if (GlobalVar2.gbYzpOrder == null) { GlobalVar2.gbYzpOrder = new YzpBtoC.YZPnewOrder(); } GlobalVar2.gbYzpOrder.rFLIGHTINFO = new YzpBtoC.YZPflightINFO[fi.Length]; GlobalVar2.gbYzpOrder.rPASSINFO = new YzpBtoC.YZPpassINFO[ir.getpeopleinfo(0).Length]; for (int count = 0; count < fi.Length; count++) { GlobalVar2.gbYzpOrder.rFLIGHTINFO[count] = new YzpBtoC.YZPflightINFO(); string[] segment = fi[count].Split('~'); GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rFLIGHTNO = segment[0]; GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rFLIGHTDATE = getflightdate(segment[3]); GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rCITYLEAVE = segment[2].Substring(0, 3); GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rCITYARRIVE = segment[2].Substring(3); GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rBUNK = segment[1]; #if REALIBE GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rPLANETYPE = planeStyleList[count]; //planeStyle[count]; GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rTAXBUILD = step5(planeStyleList[count]); //step5(planeStyle[count]); GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rTIMELEAVE = getNormalDateStringFromIBEDate(segment[4]).Split(' ')[1]; GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rTIMEARRIVE = getNormalDateStringFromIBEDate(segment[5]).Split(' ')[1]; #else //GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rPLANETYPE = segment[6]; //GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rTAXOIL = segment[8]; //GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rTAXBUILD = EagleString.EagleFileIO.TaxOfBuildBy(segment[6]).ToString(); //GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rTIMELEAVE = DateTime.Parse(segment[4]).ToString("HHmm"); //GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rTIMEARRIVE = DateTime.Parse(segment[5]).ToString("HHmm"); #endif GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rSTOPSTATION = "略"; GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rAIRLINEID = "1"; GlobalVar2.gbYzpOrder.rFLIGHTINFO[count].rAIRLINEINDEX = count.ToString(); } //**************************2008-7-16置gbYzpOrder中的航班信息变量**********************************结束 }
public void run() { if (GlobalVar.bUsingConfigLonely) { throw new Exception("配置独占中……"); } if (running) { throw new Exception("线程运行中……"); } try { running = true; pnr = getpnr(); /* * etRtResult = ""; * EagleAPI.EagleSendOneCmd("i~rt:n/" + pnr,7);*/ //使用ibe接口 #if REALIBE Options.ibe.ibeInterface ib = new Options.ibe.ibeInterface(); string xml = ib.rt2(pnr, GlobalVar.serverAddr == GlobalVar.ServerAddr.HangYiWang); #else //小魏ibe接口 logic.IBEAgent ibeagent = new logic.IBEAgent(); string xml = ibeagent.wsRT2(pnr.ToUpper()); #endif if (xml == "") { et.pnr = pnr; et.submitinfoCancelledPnr("IBE未取到PNR信息,可能已经取消或没有这个PNR", "NO PNR OR CANCELLED"); etRtResult = ""; bPating = false; running = false; return; } et.init(); Options.ibe.IbeRt ir = new Options.ibe.IbeRt(xml); et.pnr = pnr; string[] tktnos = ir.getpeopleinfo(2); for (int i = 0; i < tktnos.Length; i++) { et.etnumbers += tktnos[i] + (i == tktnos.Length - 1 ? "" : ";"); et.passengers += ir.getpeopleinfo(0)[i] + "-" + ir.getpeopleinfo(1)[i] + (i == tktnos.Length - 1 ? "" : ";"); } string[] fi = ir.getflightsegsinfo(); for (int i = 0; i < fi.Length; i++) { string[] segment = fi[i].Split('~'); if (i == 0) { et.fn1 = segment[0]; et.bunk1 = segment[1]; et.cp1 = segment[2]; System.Globalization.DateTimeFormatInfo myDTFI = new System.Globalization.CultureInfo("en-us", false).DateTimeFormat; try { DateTime dt = DateTime.ParseExact(segment[3].Replace(" CST ", " "), "ddd MMM dd HH:mm:ss yyyy", myDTFI); et.date1 = dt.ToString("ddMMM", myDTFI).ToUpper(); } catch { et.date1 = DateTime.Parse(segment[3]).ToString("ddMMM", myDTFI); } } if (i == 1) { et.fn2 = segment[0]; et.bunk2 = segment[1]; et.cp2 = segment[2]; System.Globalization.DateTimeFormatInfo myDTFI = new System.Globalization.CultureInfo("en-us", false).DateTimeFormat; try { DateTime dt = DateTime.ParseExact(segment[3].Replace(" CST ", " "), "ddd MMM dd HH:mm:ss yyyy", myDTFI); et.date2 = dt.ToString("ddMMM", myDTFI).ToUpper(); } catch { et.date1 = DateTime.Parse(segment[3]).ToString("ddMMM", myDTFI); } } } bPating = true; etRtResult = ""; //EagleAPI.EagleSendOneCmd(string.Format("i~rt{0}~pat:", pnr), 7);//不发送pat,改为直接提交 2009-5-11 by wfb et.pnr = pnr; et.submitinfo(); etRtResult = ""; bPating = false; running = false; } catch (Exception ex) { etRtResult = ""; running = false; throw new Exception(ex.Message + ": 终止线程!"); } }
public void autoEtdz(string pnr, bool isPatOperation) { string prestring = "EEEEEEEEEE "; try { if (!isPatOperation) { EagleAPI.LogWrite(prestring + "开始进行自动出票:"); } Options.ibe.ibeInterface ib = new Options.ibe.ibeInterface(); string rtXml = ib.rt2(pnr); Options.ibe.IbeRt rtResult = new Options.ibe.IbeRt(rtXml); //注:自动出票不检查身份证项,请在出票前输好身份证 //0.检查PNR是否存在 if (!isPatOperation) { EagleAPI.LogWrite("检查PNR是否存在:"); } if (rtXml == "") { throw new Exception("终止出票,原因:PNR不存在!"); } //1.检查是否有票号 if (!isPatOperation) { EagleAPI.LogWrite("检查是否有票号:"); } if (rtResult.getpeopleinfo(2)[0] != "") { throw new Exception("终止出票,原因:已经存在票号"); } //2.根据出发城市,找到对应配置,此步骤以后增加。暂时使用当前配置 string startCity = rtResult.getflightsegsinfo()[0].Split('~')[2].Substring(0, 3); //todo: 找配置,并切换配置…… //3.检验配置是否切换成功,若成功,则应该在返回变量中,处理后面的步骤。 //todo:EagleAPI.EagleSendOneCmd("qt"); //4.根据PNR信息及配置定制指令串 if (!isPatOperation) { EagleAPI.LogWrite("开始生成指令串"); } List <string> cmdString = new List <string>(); cmdString.Add("rt" + pnr); // I.根据人数及航段,指定RR项 int pCount = rtResult.getpeopleinfo(0).Length; { this.nPeople.Value = pCount; Application.DoEvents(); } //置控件 int fCount = rtResult.getflightsegsinfo().Length; { this.nSegment.Value = fCount; Application.DoEvents(); } //置控件 for (int i = 0; i < fCount; i++) { cmdString.Add(string.Format("{0}RR", pCount + i + 1)); } // II.根据航空公司及配置,指定AT/WUH项 int no = pCount + fCount + 3; string atItem = no.ToString() + "aT/" + startCity + "YY"; cmdString.Add(atItem); { tbLocalCity.Text = startCity + "YY"; tbATWUH.Text = atItem; Application.DoEvents(); } //置控件 // III.检查舱位是否为特价舱。来决定PAT项 string[] fInfo = rtResult.getflightsegsinfo(); int normalBunkCount = 0; for (int i = 0; i < fInfo.Length; i++) { if (EagleAPI.isNormalBunk(fInfo[i].Split('~')[0].Substring(0, 2), fInfo[i].Split('~')[1])) { normalBunkCount++; } } bRtBotton = false; EagleAPI.CLEARCMDLIST(3); if (btAutoETDZ.Focused)//原一键出票 { if (cbAutoPat.Checked) { EagleAPI.LogWrite("发送相应的PAT指令"); if (normalBunkCount == fInfo.Length)//全部航段为正常舱位 { if (fCount == 1) { if (isPatOperation) { EagleAPI.EagleSendOneCmd("i~rT" + tbPnr.Text.Trim() + "~pat:"); return; } cmdString.Add("pat:"); } else { switch (fInfo[0].Split('~')[0].Substring(0, 2)) { case "CZ": if (isPatOperation) { EagleAPI.EagleSendOneCmd("i~rT" + tbPnr.Text.Trim() + "~pat:#yzzs"); return; } cmdString.Add("pat:#yzzs"); break; case "MU": if (isPatOperation) { EagleAPI.EagleSendOneCmd("i~rT" + tbPnr.Text.Trim() + "~pat:#muytr"); return; } cmdString.Add("pat:#muytr"); break; case "3U": if (isPatOperation) { EagleAPI.EagleSendOneCmd("i~rT" + tbPnr.Text.Trim() + "~pat:#3UZZ"); return; } cmdString.Add("pat:#3UZZ"); break; default: if (isPatOperation) { EagleAPI.EagleSendOneCmd("i~rT" + tbPnr.Text.Trim() + "~pat:"); return; } cmdString.Add("pat:"); break; } } } else if (normalBunkCount == 0)//全部为特价舱 { if (isPatOperation) { EagleAPI.EagleSendOneCmd("i~rT" + tbPnr.Text.Trim() + "~pat:a"); return; } cmdString.Add("pat:a"); } else//其中一部分为特价舱 { throw new Exception("终止出票,原因:包含正常舱位和特殊舱位!不知道如何PAT!"); } if (!isPatOperation) { cmdString.Add(GlobalVar.strPatItem); } DialogResult dr = MessageBox.Show("PAT指令: " + cmdString[cmdString.Count - 1] + "\r\n" + "票价组: " + cmdString[cmdString.Count - 1] + "\r\n\r\n是否继续出票?", "注意", MessageBoxButtons.YesNo); if (dr == DialogResult.No) { return; } } } else if (button1.Focused)//2008-7-21 一键出票 { if (!isPATed.Checked) { string patStr = ""; if (radioButton1.Checked) { patStr = "pat:"; } if (radioButton2.Checked) { patStr = "pat:A"; } if (radioButton3.Checked) { patStr = "pat:*ch"; } if (radioButton4.Checked) { patStr = "pat:#yzzs"; } if (radioButton5.Checked) { patStr = "pat:#muytr"; } if (radioButton6.Checked) { patStr = "pat:#3UZZ"; } if (!isPatOperation) { cmdString.Add(GlobalVar.strPatItem); } if (isPatOperation) { EagleAPI.EagleSendOneCmd("i~rT" + tbPnr.Text.Trim() + "~" + patStr); return; } cmdString.Add(patStr); DialogResult dr = MessageBox.Show("PAT指令: " + cmdString[cmdString.Count - 1] + "\r\n" + "票价组: " + cmdString[cmdString.Count - 1] + "\r\n\r\n是否继续出票?", "注意", MessageBoxButtons.YesNo); if (dr == DialogResult.No) { return; } } } // IV. 签注EI项 int bunkindex = 0; for (int i = 0; i < fInfo.Length; i++) { int index = EagleAPI.IndexOfBunk(fInfo[i].Split('~')[0].Substring(0, 2), fInfo[i].Split('~')[1]); if (index > bunkindex) { bunkindex = index; } } if (bunkindex < 3) { cbRestrictions.Text = ""; } else if (bunkindex < 6) { cmdString.Add("EI:不得签转"); cbRestrictions.Text = cmdString[cmdString.Count - 1].Substring(3); //置控件 } else if (bunkindex < 16) { cmdString.Add("EI:不得签转更改"); cbRestrictions.Text = cmdString[cmdString.Count - 1].Substring(3); //置控件 } else { cmdString.Add("EI:不得签转更改退票"); cbRestrictions.Text = cmdString[cmdString.Count - 1].Substring(3); //置控件 } Application.DoEvents(); // V.出票ETDZ项 int pn = CreateETicket.GetPrinterNumber(GlobalVar.officeNumberCurrent); cmdString.Add("ETDZ:" + pn.ToString()); tbETDZ.Text = "ETDZ:" + pn.ToString(); //置控件 Application.DoEvents(); if (pn == 0) { throw new Exception("终止出票,原因:未选择配置!"); } string cmd = "i"; for (int i = 0; i < cmdString.Count; i++) { cmd += "~" + cmdString[i]; } EagleAPI.LogWrite(prestring + "得到指令并发送:" + cmd); EagleAPI.EagleSendOneCmd(cmd); } catch (Exception ex) { EagleAPI.LogWrite(prestring + ex.Message); //控件值。 this.tbPAT.Text = ex.Message; //置控件 } }