/// <summary> /// 防止重复提交!而导致占用配置,在提交电子客票信息线程中使用! /// </summary> /// <param name="pnr"></param> /// <returns></returns> static public bool CheckSubmitedPnrInHashTable(string pnr) { try { if (GlobalVar2.gbHashTableOfTheSubmittingPnr.ContainsKey(pnr)) { DateTime dt = (DateTime)(GlobalVar2.gbHashTableOfTheSubmittingPnr[pnr]); TimeSpan ts = DateTime.Now - dt; int inteval = ts.Minutes; if (inteval > 10) { GlobalVar2.gbHashTableOfTheSubmittingPnr.Remove(pnr); GlobalVar2.gbHashTableOfTheSubmittingPnr.Add(pnr, DateTime.Now); return(false); } EagleAPI.LogWrite("CATCH: CheckSubmitedPnrInHashTable存在相同PNR在HASHTABLE中"); return(true); } else { GlobalVar2.gbHashTableOfTheSubmittingPnr.Add(pnr, DateTime.Now); return(false); } } catch { EagleAPI.LogWrite("CATCH: CheckSubmitedPnrInHashTable"); return(false); } }
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> /// 5、出票 /// </summary> public void DoEtdz() { GlobalVar.b_netdz = true; //EagleAPI.EagleSendOneCmd("^|_^i~rtN3BQC~etdz:9", 1);//测试用 EagleAPI.EagleSendOneCmd(strETCommand, 3); EagleAPI.LogWrite("\r\n" + DateTime.Now.ToShortTimeString() + "NewDecFee向航信发出指令:" + strETCommand); }
public void decfee() { string cny = ""; if (cnystring.Trim().Length >= 30) { return; } try { cny = cnystring.Substring(cnystring.IndexOf("CNY") + 3, cnystring.IndexOf(".00") - (cnystring.IndexOf("CNY") + 3)).Trim(); float c = float.Parse(cny); string pnr = mystring.trim(cnystring); pnr = mystring.right(pnr, 5); if (EagleAPI.etstatic.Pnr.ToLower() != pnr.ToLower())//当返回结果中PNR与操作的PNR不同时 { throw new Exception("返回结果有误"); //EagleAPI.etstatic.Pnr = pnr;//分离式出票,可能产生不同PNR? } } catch (Exception e1) { cny = "0"; EagleString.EagleFileIO.LogWrite("扣款解析票价出错!"); EagleString.EagleFileIO.LogWrite(e1.Message); return; } EagleAPI.LogWrite("\r\n*****开始扣款!"); eTicket.etDecFee df = new ePlus.eTicket.etDecFee(); df.Pnr = EagleAPI.etstatic.Pnr.ToUpper(); df.TotalFC = cny; GlobalVar.GlobalString = "扣款前余额为" + GlobalVar.f_CurMoney + ",当前扣款金额为" + cny + "\n>"; EagleAPI.LogWrite(GlobalVar.GlobalString); for (int i = 0; i < 1; i++) { //if (!df.submitinfo()) //{ // GlobalVar.GlobalString += "扣款失败,系统将会补扣!\r>"; // break; //} try { df.submitinfo(); break; } catch (Exception ee) { GlobalVar.GlobalString += "扣款失败,系统将会补扣!\r>"; GlobalVar.GlobalString += ee.Message + "\r>"; } } EagleAPI.LogWrite("\r\n*****结束扣款!"); }
/// <summary> /// 执行扣款 /// </summary> /// <returns></returns> private void DoDecFee() { string strRet = ""; if (CalcFee()) { if (foOriginallyBalance < foMuPaFee) { throw new Exception("\r\n该用户余额不足,不能出票!\r\n>"); } strRet = InvokeWS(); //strRet = "<eg><cm>RetDecFee</cm><DecStat>DecSucc</DecStat><NewUserYe>300</NewUserYe></eg>"; } else { //throw new Exception("\r\n计算多人总票价出错!\r\n>"); EagleAPI.LogWrite("\r\n计算多人总票价出错!\r\n"); DoEtdz(); } if (strRet == null || strRet == "") { throw new Exception("\r\n调用 WebService 返回不正常!xml:" + strRet + "\r\n>"); } NewPara np1 = new NewPara(strRet); string cm = np1.FindTextByPath("//eg/cm"); string decstat = np1.FindTextByPath("//eg/DecStat"); string money = np1.FindTextByPath("//eg/NewUserYe"); string err = np1.FindTextByPath("//eg/err"); if (cm == "RetDecFee" && decstat == "DecSucc") { GlobalVar.f_CurMoney = money; foCurrentBalance = float.Parse(money); string agrs = "\r\n调用扣款服务" + "<eg66>" + strPnr; strProResult = "\r\n系统开始减款,用户原始余额:" + foOriginallyBalance.ToString("G") + "扣款:" + foMuPaFee.ToString("G"); strProResult += "\r\n" + "用户当前余额:" + foCurrentBalance.ToString("G") + "\r\n"; EagleAPI.LogWrite(agrs + strProResult); GlobalVar.b_NotDoDec = true;//先扣款成功 DoEtdz(); } else { //if (cm == "RetDecFee" && decstat == "Deced") //{ //} //else //{ EagleAPI.LogWrite("cm:" + cm + " err:" + err + "\r\n>"); DoEtdz(); //} } }
/// <summary> /// 清空原指令表,并将指定msgtype的列表复制给原指令表 /// </summary> /// <param name="msgtype"></param> public static void UseTheCommandQueneListBegin(int msgtype) { while (cmdListOperating) { Thread.Sleep(100); EagleAPI.LogWrite("指令列表线程冲突,等待100耗秒"); } cmdListOperating = true; EagleAPI.CLEARCMDLIST(0); switch (msgtype) { case 3: for (int i = 0; i < connect_4_Command.Qall0003.Count; i++) { connect_4_Command.Qall.Add(connect_4_Command.Qall0003[i]); } for (int i = 0; i < connect_4_Command.Qorder0003.Count; i++) { connect_4_Command.Qorder.Add(connect_4_Command.Qorder0003[i]); } for (int i = 0; i < connect_4_Command.Qquery0003.Count; i++) { connect_4_Command.Qquery.Add(connect_4_Command.Qquery0003[i]); } for (int i = 0; i < connect_4_Command.Qsend0003.Count; i++) { connect_4_Command.Qsend.Add(connect_4_Command.Qsend0003[i]); } break; case 7: for (int i = 0; i < connect_4_Command.Qall0007.Count; i++) { connect_4_Command.Qall.Add(connect_4_Command.Qall0007[i]); } for (int i = 0; i < connect_4_Command.Qorder0007.Count; i++) { connect_4_Command.Qorder.Add(connect_4_Command.Qorder0007[i]); } for (int i = 0; i < connect_4_Command.Qquery0007.Count; i++) { connect_4_Command.Qquery.Add(connect_4_Command.Qquery0007[i]); } for (int i = 0; i < connect_4_Command.Qsend0007.Count; i++) { connect_4_Command.Qsend.Add(connect_4_Command.Qsend0007[i]); } break; } }
/// <summary> /// 调用扣款Web服务 /// </summary> private string InvokeWS() { EagleWebService.wsKernal ws = new EagleWebService.wsKernal(GlobalVar.WebServer); NewPara np = new NewPara(); np.AddPara("cm", "DecFee"); np.AddPara("Pnr", strPnr); np.AddPara("TicketPrice", foMuPaFee.ToString()); string strReq = np.GetXML(); string strRet = ws.getEgSoap(strReq); GlobalVar.f_Balance -= (decimal)(foMuPaFee); EagleAPI.LogWrite(strPnr + " DecFee 先扣款成功!\r\n"); return(strRet); }
/// <summary> /// 执行扣款 /// </summary> /// <returns></returns> private void DoDecFee() { string strRet = ""; if (CalcFee()) { if (Convert.ToInt32(this.strOriginallyBalance) < Convert.ToInt32(this.strMuPaFee)) { throw new Exception("\r\n该用户余额不足,不能出票!\r\n>"); } strRet = InvokeWS(); } else { throw new Exception("\r\n计算多人总票价出错!\r\n>"); } if (strRet == null || strRet == "") { throw new Exception("\r\n调用 WebService 返回不正常!xml:" + strRet + "\r\n>"); } NewPara np1 = new NewPara(strRet); string cm = np1.FindTextByPath("//eg/cm"); string decstat = np1.FindTextByPath("//eg/DecStat"); string money = np1.FindTextByPath("//eg/NewUserYe"); string err = np1.FindTextByPath("//eg/err"); if (cm == "RetDecFee" && decstat == "DecSucc") { strCurrentBalance = GlobalVar.f_CurMoney = money; string agrs = "\r\n调用扣款服务" + "<eg66>" + strPnr; strProResult = "\r\n系统开始减款,用户原始余额:" + strOriginallyBalance + "扣款:" + strMuPaFee; strProResult += "\r\n" + "用户当前余额:" + strCurrentBalance + "\r\n"; GlobalVar.b_netdz = true; DoEtdz(); EagleAPI.LogWrite(agrs + strProResult); } else { //if (cm == "RetDecFee" && decstat == "Deced") //{ //} //else //{ throw new Exception("cm:" + cm + " err:" + err + Environment.NewLine); //} } }
public void submitinfoCancelledPnr(string content, string fakeEtno) { try { string NULL = "NULL"; etStatic es = new etStatic(); es.Bunk1 = bunk1; es.Bunk2 = bunk2; es.CityPair1 = cp1; es.CityPair2 = cp2; es.Date1 = date1; es.Date2 = date2; es.DecFeeState = ""; es.etNumber = etnumbers; if (etnumbers.Trim() == "") { es.etNumber = "No TktNum When Submit"; } es.FlightNumber1 = fn1; es.FlightNumber2 = fn2; es.Passengers = passengers; es.Pnr = pnr; es.State = "0"; es.TotalFC = "0"; // string.Format("{0}", float.Parse(totalfc) * etnumbers.Split(';').Length); //if (tb.IndexOf("CNY") >= 0) es.TotalTaxBuild = "0"; // = string.Format("{0}", float.Parse(tb.Substring(3)) * etnumbers.Split(';').Length); //else es.TotalTaxBuild = "0"; // string.Format("{0}", float.Parse(tb.Substring(0)) * etnumbers.Split(';').Length); //if (tf.IndexOf("CNY") >= 0) es.TotalTaxFuel = "0"; // string.Format("{0}", float.Parse(tf.Substring(3)) * etnumbers.Split(';').Length); //else es.TotalTaxFuel = "0"; // string.Format("{0}", float.Parse(tf.Substring(0)) * etnumbers.Split(';').Length); if (es.SubmitInfo()) { EagleAPI.LogWrite(pnr + "PNRCANCELLED提交成功!" + content + "\r\n\r\n"); } return; } catch { } EagleAPI.LogWrite(pnr + "PNRCANCELLED提交失败!" + content + "\r\n\r\n"); }
public bool submitinfo() { try { EagleWebService.wsKernal ws = new EagleWebService.wsKernal(GlobalVar.WebServer); NewPara np = new NewPara(); np.AddPara("cm", "PreSubmitETicket"); np.AddPara("UserID", GlobalVar.loginName); np.AddPara("Pnr", EagleAPI.etstatic.Pnr); np.AddPara("DecFeeState", "0"); string ipid = mystring.substring(GlobalVar.officeNumberCurrent, 0, 6); if (ipid.Length != 6) { if (!GlobalVar.loginLC.bSameAllConfig) { throw new Exception("—预提交—配置号错误?配置号为:" + ipid); } else { ipid = GlobalVar.loginLC.thesameipid; } } np.AddPara("IpId", ipid); if (EagleAPI.etstatic.Pnr.Trim().Length != 5) { throw new Exception("—预提交—PNR错误?PNR为:" + EagleAPI.etstatic.Pnr); } string strReq = np.GetXML(); string strRet = ws.getEgSoap(strReq); if (strRet != "") { NewPara np1 = new NewPara(strRet); if (np1.FindTextByPath("//eg/cm") == "RetPreSubmitETicket" && np1.FindTextByPath("//eg/OperationFlag") == "SaveSucc") { EagleAPI.LogWrite(EagleAPI.etstatic.Pnr + " PreSubmitETicket 预提交成功!\r\n"); return(true); } else if (np1.FindTextByPath("//eg/cm") != "CmErr") { System.Windows.Forms.MessageBox.Show(strReq); } else { return(true); } } else { MessageBox.Show("PreSubmitETicket与服务器数据库连接失败!", "易格服务器错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Source + ex.Message); } return(false); }
/* * >rtwbl03 * 1.LIU/XIANG 2.ZHU/JUN WBL03 * 3. MU2501 Y SA24JAN WUHPVG HK2 0830 0945 E --T1 * 4. MU564 Y MO26JAN PVGPEK HK2 0800 1010 E T1T2 * 5.WUH/T WUH/T 0714-6255100/HUANG SHI LAN XIANG TICKET CO.,LTD/CAOQING ABCDEFG * 6.454545 * 7.TL/2000/29DEC/WUH402 * 8.FC/A/WUH MU PVG 810.00Y MU PEK 1130.00Y CNY1940.00END * 9.FC/IN/WUH MU PVG 80.00YIN10 MU PEK 110.00YIN10 CNY190.00END * 10.SSR ADTK 1E BY WUH13JAN09/1221 OR CXL MU 564 Y26JAN * 11.SSR INFT MU KK1 WUHPVG 2501 Y24JAN BABY/CD 04MAR08/P2 * 12.SSR INFT MU KK1 WUHPVG 2501 Y24JAN BABB/CD 04MAR08/P1 * 13.OSI YY 1INF BABB/CDINF/P1 + * 14.OSI YY 1INF BABY/CDINF/P2 - * 15.RMK CA/DL82W * 16.RMK AUTOMATIC FARE QUOTE * 17.FN/A/FCNY1940.00/SCNY1940.00/C3.00/XCNY160.00/TCNY100.00CN/TCNY60.00YQ/ * ACNY2100.00 * 18.FN/IN/FCNY190.00/SCNY190.00/C0.00/TEXEMPTCN/TEXEMPTYQ/ACNY190.00 * 19.FP/CASH,CNY * 20.FP/IN/CASH,CNY * 21.XN/IN/BABB/CDINF(MAR08)/P1 * 22.XN/IN/BABY/CDINF(MAR08)/P2 * 23.WUH402 */ /// <summary> /// 分析RT命令返回的数据 /// </summary> /// <returns></returns> private bool AnalyseRTReturn() { EagleAPI.LogWrite("\r\n" + "扣款取总人数结果:" + strrtreturn + "\r\n"); string temp = ""; if (strrtreturn == null || strrtreturn == "") { strProResult = "\r\n未取到乘客人数信息,请重新出票!\r\n>"; return(false); } //if(strrtreturn.IndexOf("**ELECTRONIC TICKET PNR**")>-1) //{ // strProResult="\r\nPNR:"+strPnr+"已出过票,不允许再次出票\r\n>"; // return false; //} try { int num = strrtreturn.IndexOf(strPnr.ToUpper() + "\r\n"); if (num == -1) { strProResult = "\r\n取出的乘客人数信息出错,请重新出票\r\n>"; return(false); } temp = strrtreturn.Substring(num + 7); string pasn = temp.Substring(34, 3); int ipans = System.Convert.ToInt32(pasn); if (ipans >= 1 && ipans < 600) { intAdultNum = intPasNum = ipans; EagleAPI.LogWrite("\r\n" + "扣款取总人数:" + intPasNum.ToString() + "\r\n"); //*以下为取儿童信息 string strtemp = ipans > 9 ? "" : " "; int endofpassenger = strrtreturn.IndexOf(this.strPnr.ToUpper()); if (endofpassenger < 0) { strProResult = "\r\n取儿童人数信息非法,请重新出票\r\n>"; return(false); } strtemp = strrtreturn.Substring(0, endofpassenger); int nchild = strtemp.IndexOf("CHD"); if (nchild > 0) { bContainChild = true; string strtemp1 = strtemp.Replace("CHD", ""); nchild = (strtemp.Length - strtemp1.Length) / 3; intChildNum = nchild; intAdultNum = ipans - nchild; if (ipans < nchild) { strProResult = "\r\n取出的儿童人数信息出错,请重新出票\r\n>"; return(false); } bContainChild = true; isChild = intPasNum == intChildNum ? true : false; } else { bContainChild = false; isChild = false; intChildNum = 0; intAdultNum = intPasNum; } // */ /////////////////////////以上判断是否成人,儿童票,取成人及儿童人数完成;下面开始取价格及婴儿项/////////////// string[] arrayPnrStructer = strrtreturn.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); for (int j = 0; j < arrayPnrStructer.Length; j++) { string arraystart = string.Empty; if (arrayPnrStructer[j].Length > 3) { arraystart = arrayPnrStructer[j].Substring(0, 3); if (!(arraystart[2] == '.' && (arraystart[0] == ' ' || arraystart[0] > '0' - 1 && arraystart[0] < '9' + 1) && (arraystart[1] > '0' - 1 && arraystart[1] < '9' + 1))) { if (j > 0) { arrayPnrStructer[j - 1] += arrayPnrStructer[j]; } } } } ArrayList xn = new ArrayList(); ArrayList fn = new ArrayList(); foreach (string st in arrayPnrStructer)//取FN XN项 { if (st.Length < 6) { continue; } if (st.Substring(3, 2) == "FN") { fn.Add(st); } if (st.Substring(3, 2) == "XN") { xn.Add(st); } } if (fn.Count == 0 || (xn.Count > 0 && (fn.Count < 0 || fn.Count < xn.Count))) { strProResult = "\r\n未做票价,或者票未做全,请先做完票价并封口后再出票!\r\n>"; return(false); } for (int k = 0; k < fn.Count; k++) { string tempfnin = fn[k].ToString(); if (tempfnin.IndexOf("FN/A/FCNY") > 0 || tempfnin.IndexOf("FN/FCNY") > 0) { int fnins = tempfnin.IndexOf("ACNY") + 4; if (fnins > 5) { int fnine = tempfnin.Length; if (isChild) { foChildFee = float.Parse(tempfnin.Substring(fnins, fnine - fnins)); } else { foAdultFee = float.Parse(tempfnin.Substring(fnins, fnine - fnins)); } } break; } } if (foChildFee == 0.0 && foAdultFee == 0.0) { strProResult = "\r\n没有权限获取票价,可能是其它配置做的价格,请删除fn项重做票价!\r\n>"; return(false); } //if (isChild&&foChildFee==0.0) //{ // for (int k = 0; k < fn.Count; k++) // { // string tempfnin = fn[k].ToString(); // if (tempfnin.IndexOf("FN/FCNY") > 0) // { // int fnins = tempfnin.IndexOf("ACNY") + 4; // int fnine = tempfnin.Length; // foChildFee = float.Parse(tempfnin.Substring(fnins, fnine - fnins)); // break; // } // } //} if (xn.Count != 0) { intBabynNum = xn.Count; bContainBaby = true; for (int k = 0; k < fn.Count; k++) { string tempfnin = fn[k].ToString(); if (tempfnin.IndexOf("FN/A/IN/") > 0 || tempfnin.IndexOf("FN/IN/") > 0) { int fnins = tempfnin.IndexOf("ACNY") + 4; int fnine = tempfnin.Length; foBabyFee = float.Parse(tempfnin.Substring(fnins, fnine - fnins)); break; } } } return(true); } else { strProResult = "\r\n取出的乘客人数信息非法,请重新出票\r\n>"; return(false); } } catch { strProResult = "\r\n取扣款信息出错,请重新出票\r\n>"; return(false); } }
/// <summary> /// 分析PAT价格返回的价格信息 /// </summary> private bool AnalysePATReturn() { EagleAPI.LogWrite("\r\n" + "扣款取价格结果:" + strpatreturn + "\r\n"); string temp = ""; if (strpatreturn == null || strpatreturn == "") { strProResult = "\r\n未取到机票价格,请重新出票!\r\n>"; return(false); } else { try { int iTstart = strpatreturn.IndexOf("TOTAL:"); if (iTstart > -1) { iTstart += 6; temp = strpatreturn.Substring(iTstart); int iRstart = temp.IndexOf("\r\n"); if (iRstart > -1) { temp = temp.Substring(0, iRstart); double dfc = System.Convert.ToDouble(temp); if (dfc < 10.0) { strProResult = "\r\n取机票价格有误,请再重新出票!\r\n>"; return(false); } else { if (nGetFcFlag == 1) { strAdultFee = temp; } if (nGetFcFlag == 2) { strChildFee = temp; } return(true); } } else { strProResult = "\r\n未取到正确机票价格,请重新出票,如果未做价格请先做价格封口后,再重新出票!\r\n>"; return(false); } } else { strProResult = "\r\n未取到机票价格,如果未做价格请先做价格封口后,再重新出票!\r\n>"; return(false); } } catch (Exception ea) { strProResult = "\r\n取机票价格出错,如果未做价格请先做价格封口后,再重新出票!\r\n>"; return(false); } } }
private void frmMain_Load(object sender, EventArgs e) { ReadCmdSendTypeFromOptionsTxt(); EagleAPI.LogWrite("");//时间间隔 //时间调校 Thread thGetServerTime = new Thread(new ThreadStart(Options.gbOption.isDifferCompareTimeWithServerThan12)); thGetServerTime.Start(); //提示新订单ToolStripMenuItem.Checked = EagleAPI2.initNewOrder(); EagleAPI.LogWrite("");//时间间隔 try { GlobalVar.mainMenu = this.MainMenu; //this.Text = Properties.Resources.MainFormTitle;//commentted by king //EagleAPI.GetPrintConfig(); //EagleAPI.GetOptions(); { //这里控制可用菜单 int iConflict = 0; if (md.b_001) { iConflict++; } if (md.b_006) { iConflict++; } if (md.b_007) { iConflict++; } if (md.b_009) { iConflict++; } Model.md.SetBoolVars(); if (GlobalVar.serverAddr == GlobalVar.ServerAddr.ZhenZhouJiChang) { BookTicket.bIbe = false; } //BookTicket.bIbe = Model.md.b_00E;//IBE this.Visible = Model.md.b_004; #region 终端功能控制 if (Model.md.b_004) { //若有黑屏 this.tsb_WebBrowser.Enabled = !md.b_00H; this.style3.Enabled = Model.md.b_F12; //S3按钮 this.mi_style3.Enabled = Model.md.b_F12; this.pICCToolStripMenuItem.Visible = Model.md.b_001; this.miPrint.Visible = Model.md.b_002; this.miPrintReceipt.Visible = Model.md.b_003; //this.miPrintInsurance.Visible = Model.md.b_005; this.Book.Enabled = Model.md.b_006; //简版 this.toolStripButton_ClearQ.Enabled = Model.md.b_QQQ; //自动清Q this.永安保险ToolStripMenuItem.Visible = Model.md.b_007; this.新华保险ToolStripMenuItem.Visible = Model.md.b_009; this.交通意外伤害保险单ToolStripMenuItem.Visible = Model.md.b_B01;//华安 if (!Model.md.b_B01) { this.华安ToolStripMenuItem.Visible = false; } this.航空旅客人身意外伤害保险单ToolStripMenuItem.Visible = Model.md.b_B02;//人寿 if (!Model.md.b_B02) { this.人寿ToolStripMenuItem.Visible = false; } this.出行无忧ToolStripMenuItem.Visible = Model.md.b_B04; //都帮航意险 this.航翼网航空意外伤害保险单ToolStripMenuItem.Visible = Model.md.b_B03; //都邦出行无忧 this.出行乐ToolStripMenuItem.Visible = Model.md.b_B05; //都帮出行乐 if (!(Model.md.b_B03 || Model.md.b_B04 || Model.md.b_B05)) { this.都邦ToolStripMenuItem.Visible = false; } this.SunShineToolStripMenuItem.Visible = Model.md.b_B07;//一路阳光 if (!(Model.md.b_B07)) { this.阳光ToolStripMenuItem.Visible = false; } this.航翼网会员保险卡ToolStripMenuItem.Visible = Model.md.b_B08;//航翼网会员保险卡 if (!(Model.md.b_B08)) { this.航翼网ToolStripMenuItem.Visible = false; } this.新华人寿ToolStripMenuItem.Visible = Model.md.b_B09; //易格网会员保险卡 this.安邦商行通ToolStripMenuItem.Visible = Model.md.b_B0B; //安邦商行通 this.pICCToolStripMenuItem.Visible = Model.md.b_B0D; //易格PICC if (!(Model.md.b_B09 || Model.md.b_B0B || Model.md.b_B0D)) { this.易格网ToolStripMenuItem.Visible = false; } this.周游列国.Visible = Model.md.b_B06;//周游列国 //if (!(Model.md.b_B06)) this.平安ToolStripMenuItem.Visible = false; this.航空意外险ToolStripMenuItem.Visible = Model.md.b_B0A;//太平洋意外险 if (!(Model.md.b_B0A)) { this.太平洋ToolStripMenuItem.Visible = false; } if (EagleAPI.GetCmdName("etdz", GlobalVar.loginLC.VisuableCommand) == "" || EagleAPI.GetCmdName("etdz", GlobalVar.loginLC.VisuableCommand) == null) { toolStripButton2.Enabled = false; } if (!GlobalVar.bPekGuangShunUser) { toolStripButton1.Visible = toolStripSeparator16.Visible = false; } this.cTICToolStripMenuItem.Visible = Model.md.b_0CTI;//呼叫中心 } //else if (iConflict > 1) //{//冲突,没有黑屏下,不能同时为保险及简版用户 // MessageBox.Show("模块分配冲突,请与管理员联系!"); // Application.Exit(); //} else if (Model.md.b_006) {//没黑屏,仅为简版用户 BookTicket bt = new BookTicket(); bt.Show(); BookTicket.bIbe = !Model.md.b_00F; MessageBox.Show("您的帐户余额为:¥" + GlobalVar.f_CurMoney); } else if (Model.md.b_001) {//没黑屏,仅为PICC保险打印 PrintHyx.PrintPICC2 pp = new ePlus.PrintHyx.PrintPICC2(); pp.Show(); } else if (Model.md.b_007) {//没黑屏,仅为永安保险打印 PrintHyx.Yongan ya = new ePlus.PrintHyx.Yongan(); ya.Show(); } else if (Model.md.b_009) {//新华保险 PrintHyx.NewChina nc = new ePlus.PrintHyx.NewChina(); nc.Show(); } else if (Model.md.b_B01) {//华安保险 PrintHyx.SinoSafe ss = new ePlus.PrintHyx.SinoSafe(); ss.Show(); } else if (Model.md.b_B02) {//人寿航意险 PrintHyx.ChinaLife cl = new ePlus.PrintHyx.ChinaLife(); cl.Show(); } else if (Model.md.b_B03) {//都帮航意险 PrintHyx.DuBang01 db1 = new ePlus.PrintHyx.DuBang01(); db1.Show(); } else if (Model.md.b_B04) {//都帮出行无忧 PrintHyx.DuBang02 db2 = new ePlus.PrintHyx.DuBang02(); db2.Show(); } else if (Model.md.b_B05) {//都帮出行乐 PrintHyx.DuBang02 db3 = new ePlus.PrintHyx.DuBang02(); db3.Dubang03(); db3.Show(); } else if (Model.md.b_B06) { PrintHyx.PingAn01 pa = new ePlus.PrintHyx.PingAn01(); pa.Show(); } else if (Model.md.b_B07) { PrintHyx.Sunshine ins = new ePlus.PrintHyx.Sunshine(); ins.Show(); } else if (Model.md.b_B08) { PrintHyx.Hangyiwang ins = new ePlus.PrintHyx.Hangyiwang(); ins.Show(); } else if (Model.md.b_B09) { PrintHyx.bxLogin bx = new ePlus.PrintHyx.bxLogin(); if (bx.ShowDialog() != DialogResult.OK) { return; } PrintHyx.EagleIns ins = new ePlus.PrintHyx.EagleIns(); ins.Text = ins.lb公司名称.Text = "新华人寿保险股份有限公司意外伤害保险承保告知单"; ins.Show(); } else if (Model.md.b_B0A) { PrintHyx.Pacific ins = new ePlus.PrintHyx.Pacific(); ins.Show(); } else if (Model.md.b_B0B) { PrintHyx.EagleAnbang ea = new ePlus.PrintHyx.EagleAnbang(); ea.Show(); } else if (Model.md.b_003)//只显示行程单打印 { PrintReceipt pr = new PrintReceipt(); pr.Show(); } else {//无模块使用 //MessageBox.Show("您无权使用该系统,请让您的管理员打开必要权限"); //Application.Exit(); } #endregion this.ttsddbBookModel.Text = this.简易模式ToolStripMenuItem.Text; GlobalVar.commandSendtype = GlobalVar.CommandSendType.Fast; // //this.ttsddbBookModel.Text = this.普通模式ToolStripMenuItem.Text; //GlobalVar.commandSendtype = GlobalVar.CommandSendType.A; } #if receipt this.Visible = false; PrintReceipt pr = new PrintReceipt(); pr.Text = "ClawSoft - 行程单打印"; pr.Icon = new Icon(Application.StartupPath + "\\claw.ico"); pr.Show(); #endif if (Options.GlobalVar.QueryType == XMLConfig.QueryType.Eterm) { #region//配置选择按钮增加ip { string[] ipls = GlobalVar.loginLC.IPsString.Split('~'); List <string> lsip = new List <string>(); List <string> addedIP = new List <string>(); for (int i = 0; i < ipls.Length; i++) { string[] cfgs = EagleAPI.GetConfigNumberByIP(ipls[i]).Split('~');//相同IP不同配置也能得到 if (addedIP.Contains(ipls[i])) { continue; } addedIP.Add(ipls[i]); for (int j = 0; j < cfgs.Length; j++) { lsip.Add(cfgs[j]); } } //对cfg排序 lsip.Sort(); mi_CONFIG.DropDownItems.Add("全部配置"); for (int i = 0; i < lsip.Count; i++) { //mi_CONFIG.DropDownItems.Add(EagleAPI.GetConfigNumberByIP(ipls[i])); if (md.b_00I || lsip[i].ToLower().IndexOf("tao") >= 0 || GlobalVar.serverAddr == GlobalVar.ServerAddr.ZhenZhouJiChang || GlobalVar.serverAddr == GlobalVar.ServerAddr.KunMing) { mi_CONFIG.DropDownItems.Add(lsip[i]); } } int theLastOne = lsip.Count - 1; if (lsip.Count > 0) { //应指定当前所连接服务器的可用cfg的最后一个,而不是未排序的ip的最后一个 for (int i = lsip.Count - 1; i > 0; i--) { XmlDocument xd = new XmlDocument(); xd.LoadXml(GlobalVar.loginXml); XmlNode xn = xd.SelectSingleNode("eg").SelectSingleNode("IPS"); for (int j = 0; j < xn.ChildNodes.Count; j++) { if (lsip[i].Trim() == xn.ChildNodes[j].SelectSingleNode("PeiZhi").InnerText.Trim()) { theLastOne = i; break; } } } try { #if 全部配置 ((ToolStripMenuItem)(mi_CONFIG.DropDownItems[theLastOne + 1])).Checked = true;//启动时为最后一个,对黑屏用户有效 mi_CONFIG.Text = mi_CONFIG.DropDownItems[theLastOne + 1].Text; GlobalVar.officeNumberCurrent = mi_CONFIG.Text; #else //bool bSpecifyDefaultConfig = false; //for (int i = 0; i < mi_CONFIG.DropDownItems.Count; i++) //{ //} mi_CONFIG.Text = "全部配置"; ((ToolStripMenuItem)(mi_CONFIG.DropDownItems[0])).Checked = true; #endif } catch { ((ToolStripMenuItem)(mi_CONFIG.DropDownItems[theLastOne])).Checked = true; mi_CONFIG.Text = mi_CONFIG.DropDownItems[theLastOne].Text; GlobalVar.officeNumberCurrent = mi_CONFIG.Text; } } mi_CONFIG.DropDownItems.Add("-"); GlobalAPI.NotGlobal ng = new ePlus.GlobalAPI.NotGlobal(); List <string> ipgroup = ng.GetConfigGroupsBy(lsip); for (int iip = 0; iip < ipgroup.Count; iip++) { //#if RWY // break; //#endif mi_CONFIG.DropDownItems.Add(ipgroup[iip]); } } #endregion //Thread th = new Thread(new ThreadStart(connect)); //th.Start(); connect_1(); } #if !RWY this.Text = GlobalVar.exeTitle + "(服务器位置:" + GlobalVar.loginLC.SrvName + ")"; #endif //if (GlobalVar.loginLC.SrvName.IndexOf("外围") >= 0) BookTicket.bIbe = true; //timerNotice1(); } catch (Exception ex1) { EagleAPI.LogWrite(ex1.Message);//时间间隔 } initStatusBar(); //SetNkgMode(); instance = this; SetIA10(); ShowIA(); //added by king EagleAPI.LogWrite("init finished"); //时间间隔 }
public void submitinfo() { if (!isEticket) { ePlus.eTicket.etCreateFailed etcf = new ePlus.eTicket.etCreateFailed(); etcf.Pnr = pnr; if (etcf.submitinfo()) { EagleAPI.LogWrite("取消电子客票行!"); } return; } try { etStatic es = new etStatic(); es.Bunk1 = bunk1; es.Bunk2 = bunk2; es.CityPair1 = cp1; es.CityPair2 = cp2; es.Date1 = date1; es.Date2 = date2; es.DecFeeState = ""; es.etNumber = (etnumbers.Trim() == "" ? " si" : etnumbers.Trim()); es.FlightNumber1 = fn1; es.FlightNumber2 = fn2; es.Passengers = passengers; es.Pnr = pnr; es.State = "0"; try { es.TotalFC = string.Format("{0}", float.Parse(totalfc) * etnumbers.Split(';').Length); } catch { es.TotalFC = "0"; } try { if (tb.IndexOf("CNY") >= 0) { es.TotalTaxBuild = string.Format("{0}", float.Parse(tb.Substring(3)) * etnumbers.Split(';').Length); } else { es.TotalTaxBuild = string.Format("{0}", float.Parse(tb.Substring(0)) * etnumbers.Split(';').Length); } } catch { es.TotalTaxBuild = "0"; } try { if (tf.IndexOf("CNY") >= 0) { es.TotalTaxFuel = string.Format("{0}", float.Parse(tf.Substring(3)) * etnumbers.Split(';').Length); } else { es.TotalTaxFuel = string.Format("{0}", float.Parse(tf.Substring(0)) * etnumbers.Split(';').Length); } } catch { es.TotalTaxFuel = "0"; } if (es.SubmitInfo()) { EagleAPI.LogWrite(pnr + "提交成功!"); } return; } catch { } EagleAPI.LogWrite(pnr + "提交失败!"); }
/// <summary> /// 分析RT命令返回的数据 /// </summary> /// <returns></returns> private bool AnalyseRTReturn() { EagleAPI.LogWrite("\r\n" + "扣款取总人数结果:" + strrtreturn + "\r\n"); string temp = ""; if (strrtreturn == null || strrtreturn == "") { //if (strPnr.ToLower().Trim() == EagleAPI.etstatic.Pnr.ToLower().Trim()) //{ // strPasNum = EagleAPI.etstatic.Passengers; // try // { // int ipans = System.Convert.ToInt32(strPasNum); // if (ipans >= 1 && ipans < 600) // { // return true; // } // } // catch // { // strProResult = "\r\n没有乘客人数信息,请重新出票!\r\n>"; // return false; // } //} strProResult = "\r\n未取到乘客人数信息,请重新出票!\r\n>"; return(false); } //if(strrtreturn.IndexOf("**ELECTRONIC TICKET PNR**")>-1) //{ // strProResult="\r\nPNR:"+strPnr+"已出过票,不允许再次出票\r\n>"; // return false; //} else { try { int num = strrtreturn.IndexOf(strPnr.ToUpper() + "\r\n"); if (num == -1) { strProResult = "\r\n取出的乘客人数信息出错,请重新出票\r\n>"; return(false); } temp = strrtreturn.Substring(num + 7); string pasn = temp.Substring(34, 3); int ipans = System.Convert.ToInt32(pasn); if (ipans >= 1 && ipans < 600) { strPasNum = pasn; EagleAPI.LogWrite("\r\n" + "扣款取总人数:" + strPasNum + "\r\n"); string strtemp = ipans > 9 ? "" : " "; int endofpassenger = strrtreturn.IndexOf("\r\n" + strtemp + ipans.ToString()); if (endofpassenger < 0) { strProResult = "\r\n取儿童人数信息非法,请重新出票\r\n>"; return(false); } strtemp = strrtreturn.Substring(0, endofpassenger); int nchild = strtemp.IndexOf("CHD"); if (nchild > 0) { isChild = true; string strtemp1 = strtemp.Replace("CHD", ""); nchild = (strtemp1.Length - strtemp.Length) / 3; strChildNum = nchild.ToString(); strAdultNum = (ipans - nchild).ToString(); if (ipans < nchild) { strProResult = "\r\n取出的儿童人数信息出错,请重新出票\r\n>"; return(false); } } else { isChild = false; strChildNum = "0"; strAdultNum = strPasNum; } return(true); } else { strProResult = "\r\n取出的乘客人数信息非法,请重新出票\r\n>"; return(false); } } catch { strProResult = "\r\n取乘客人数信息出错,请重新出票\r\n>"; return(false); } } }
public static streamctrl_enum send(string content, int msgtype) { try { if (GlobalVar.loginName.ToLower() == "bb" && content.ToLower().Contains("etdz")) { return(streamctrl_enum.TEST_ACCOUNT); } #region xepnr操作权限控制 { string t_xepnr = content.ToLower().Trim(); if (t_xepnr.IndexOf("xepnr") == 0 || t_xepnr.IndexOf("~xepnr") >= 0 || t_xepnr.IndexOf("xe") == 0 || t_xepnr.IndexOf("~xe") >= 0) {//并且要在不为ETDZ的情况下,不然在ETDZ的时候,还没有判断就返回了XEPNR:即在ETDZ时不做以下判断 if (EagleAPI.substring(content, 0, 4).ToLower() == "etdz" || content.ToLower().IndexOf("~etdz") >= 0) { ; } else { string t_pnr = EagleAPI.etstatic.Pnr; pnr_statistics ps = new pnr_statistics(); ps.pnr = t_pnr; ps.state = "2"; if (!Model.md.b_00C && t_xepnr.Contains("xepnr")) //不能取消他人PNR,则进行提交判断 { if ((!ps.submit())) //取消失败,则返回失败 { if (t_xepnr.IndexOf("xepnr") == 0 || t_xepnr.IndexOf("~xepnr") >= 0) { return(streamctrl_enum.XEPNR_FAIL); } else { return(streamctrl_enum.XE_FAIL); } } } } } } #endregion if (EagleAPI.substring(content, 0, 4).ToLower() == "etdz" || content.ToLower().IndexOf("~etdz") >= 0) { GlobalVar.b_etdz = true; } GlobalVar.b_pat = (EagleAPI.substring(content, 0, 4).ToLower() == "pat:"); GlobalVar.b_cmd_trfd_AM = ((EagleAPI.substring(content, 0, 7).ToLower() == "trfd:am") || (EagleAPI.substring(content, 0, 7).ToLower() == "trfd am")); GlobalVar.b_cmd_trfd_M = ((EagleAPI.substring(content, 0, 6).ToLower() == "trfd:m") || (EagleAPI.substring(content, 0, 6).ToLower() == "trfd m")); GlobalVar.b_cmd_trfd_L = ((EagleAPI.substring(content, 0, 6).ToLower() == "trfd:l") || (EagleAPI.substring(content, 0, 6).ToLower() == "trfd l")); if (EagleAPI.substring(content, 0, 4).ToLower() == "trfx") { content = content.Replace('*', (char)0x1A); content = content.Replace("/", ""); } if (content == "i" || content == "ig") { GlobalVar.b_etdz = false; GlobalVar.b_enoughMoney = false; GlobalVar.b_endbook = false; } //if(EagleAPI.substring(content,0,1)=="@" || EagleAPI.substring(content,0,1)=="\\")//0926 //bool bEnough = false; #region etdz金额不足控制 if (GlobalVar.b_etdz) { try { bool bIsDecFee = false;//是否扣过款了 if (GlobalVar.newEticket.peaplecount < 1) { GlobalVar.newEticket.peaplecount = 1; } string srvUrl = ""; if (GlobalVar.serverAddr == GlobalVar.ServerAddr.Eagle) { //if (GlobalVar2.gbConnectType == 1) srvUrl = "http://yinge.eg66.com/WS3/egws.asmx"; //if (GlobalVar2.gbConnectType == 2) srvUrl = "http://wangtong.eg66.com/WS3/egws.asmx"; } //else srvUrl = GlobalVar.WebServer; EagleWebService.wsKernal ws = new EagleWebService.wsKernal(srvUrl); NewPara np = new NewPara(); np.AddPara("cm", "IsDecFee"); np.AddPara("pnr", EagleAPI.etstatic.Pnr); string strSent = np.GetXML(); string strreturn = ""; if (GlobalVar.serverAddr == GlobalVar.ServerAddr.Eagle) { strreturn = ws.getEgSoap(strSent); } if (!string.IsNullOrEmpty(strreturn.Trim())) { np = new NewPara(strreturn); string strCm = np.FindTextByPath("//eg/cm"); string strIsDecFee = np.FindTextByPath("//eg/IsDecFee"); if (strCm == "ReIsDecFee" && strIsDecFee.Trim() == "1") { EagleAPI.LogWrite(EagleAPI.etstatic.Pnr + "已经扣过款,不再进行余额检查和扣款!\r\n"); bIsDecFee = true; } } if (!bIsDecFee && (float.Parse(GlobalVar.f_CurMoney) < GlobalVar.f_limitMoneyPerTicket * GlobalVar.newEticket.peaplecount) && float.Parse(GlobalVar.f_CurMoney) < 0)//&& 1==0)float.Parse(GlobalVar.f_CurMoney) < GlobalVar.f_fc || { //余额不足 EagleAPI.LogWrite("<计算是否够金额出票>当前余额为" + GlobalVar.f_CurMoney + ",预计扣款额为" + GlobalVar.f_limitMoneyPerTicket.ToString() + "*" + GlobalVar.newEticket.peaplecount.ToString()); GlobalVar.b_etdz = false; GlobalVar.b_enoughMoney = false; GlobalVar.b_endbook = false; content = "i"; return(streamctrl_enum.NOT_ENOUGH_MONEY); } else { string[] cmdarray = content.Split('~'); bool bHasRtPnrCmd = false; foreach (string c in cmdarray) { if (c.ToLower().Length >= 7 && c.ToLower().IndexOf("rt") == 0) { bHasRtPnrCmd = true; break; } } if ((!bHasRtPnrCmd) && (!GlobalVar.bUsingConfigLonely)) { //return streamctrl_enum.HAS_NO_PNR; } GlobalVar.b_enoughMoney = true; content = content + ""; //初步提交,状态0,预提交 ePlus.eTicket.etPreSubmit etmp = new ePlus.eTicket.etPreSubmit(); bool bsubed = false; for (int iSubmit = 0; iSubmit < 3; iSubmit++) { if (etmp.submitinfo()) { if (GlobalVar.serverAddr == GlobalVar.ServerAddr.KunMing) { int price = EagleString.EagleFileIO.PriceOfPnrInFile(EagleAPI.etstatic.Pnr); GlobalVar.f_Balance -= price; } bsubed = true; break; } } if (!bsubed) { GlobalVar.b_etdz = false; return(streamctrl_enum.PRE_SUBMIT_FAIL); } //预提交成功,则同时提交PNR到PNR统计里 try { pnr_statistics ps = new pnr_statistics(); ps.pnr = EagleAPI.etstatic.Pnr; ps.state = "3"; Thread thSubmitPnr = new Thread(new ThreadStart(ps.submit1)); thSubmitPnr.Start(); } catch { }; } } catch (Exception ex2) { throw new Exception("Ex2 :" + ex2.Message); } } #endregion #region rtxxxxx取当前操作的PNR,注意msgtype=3 { if (msgtype == 3) { string[] arrayTemp = content.Split('~'); for (int i = 0; i < arrayTemp.Length; i++) { if (EagleAPI.substring(arrayTemp[i], 0, 2).ToLower() == "rt" && content.Length >= 7) { EagleAPI.CLEARCMDLIST(msgtype); EagleAPI.etstatic.Pnr = mystring.right(arrayTemp[i].Trim(), 5); } } } } #endregion content = content.Replace((char)0x0A, (char)0x0D);//发送中换行\r转换成\n log.strSend = content;//同Command.SendString connect_4_Command.SendString = content; GlobalVar.b_querryCommand = false; GlobalVar.b_otherCommand = false; return(streamctrl_enum.NONE); } catch (Exception ex) { throw new Exception("StreamControl : " + 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; //置控件 } }
public bool set(string p, string s) { try { isEticket = (s.IndexOf("**ELECTRONIC TICKET PNR**") >= 0); pnr = p; string[] tArray = EagleAPI.GetETNumber(s); if (tArray.Length < 1) { throw new Exception("未取到票号!"); } etnumbers = ""; foreach (string t in tArray) { etnumbers += t + ";"; } while (etnumbers.IndexOf(";;") >= 0) { etnumbers = etnumbers.Replace(";;", ";"); } etnumbers = mystring.trim(etnumbers, ';'); List <string> names = EagleAPI.GetNames(s); string[] cardids = EagleAPI.GetIDCardNo(s); passengers = ""; for (int i = 0; i < names.Count; i++) { passengers += ";" + names[i] + "-" + cardids[i]; } passengers = mystring.trim(passengers, ';'); //float count = (float)etnumbers.Split(':').Length; float count = 1F; try { totalfc = string.Format("{0}", float.Parse(EagleAPI.GetTatol(s).Substring(3)) * count); } catch { totalfc = "0"; } try { tf = string.Format("{0}", float.Parse(EagleAPI.GetTaxFuel(s).Substring(3)) * count); } catch { tf = "0"; } try { tb = string.Format("{0}", float.Parse(EagleAPI.GetTaxBuild(s).Substring(EagleAPI.GetTaxBuild(s)[3] > '9' ? 0 : 3)) * count); } catch { tb = "0"; } fn1 = EagleAPI.GetCarrier(s) + EagleAPI.GetFlight(s); fn2 = EagleAPI.GetCarrier2(s) + EagleAPI.GetFlight2(s); bunk1 = EagleAPI.GetClass(s); bunk2 = EagleAPI.GetClass2(s); date1 = EagleAPI.GetDateStart(s); date2 = EagleAPI.GetDateStart2(s); cp1 = EagleAPI.GetStartCity(s) + EagleAPI.GetEndCity(s); cp2 = EagleAPI.GetEndCity(s) + EagleAPI.GetEndCity2(s); if (cp2.Length < 6 || cp2 == cp1) { cp2 = ""; } } catch (Exception ex) { EagleAPI.LogWrite(ex.Message); return(false); } return(true); }
public void SetAllPolicy(System.Windows.Forms.ListView lv, string date) { try { if (!Model.md.b_026) { return; } int iCount = lv.Items.Count; System.Windows.Forms.ListViewItem[] items = new System.Windows.Forms.ListViewItem[iCount]; string flightnos = ""; for (int i = 0; i < iCount; i++) { string fn = lv.Items[i].SubItems[1].Text; if (fn.Substring(0, 1) == "*") { fn = fn.Substring(1); } flightnos += fn + (i == iCount - 1 ? "" : ","); } string cp = lv.Items[0].SubItems[3].Text; AVResult ar = new AVResult(); ar.avResult = connect_4_Command.AV_String; ar.SetVar(); //ar.SetToListview(lv,DateTime.Parse(date)); Application.DoEvents(); string day = ar.avDate.Substring(0, 2); string mon = ar.avDate.Substring(2, 3); int iDay = int.Parse(day); int iMon = int.Parse(EagleAPI.GetMonthInt(mon)); int iYear = DateTime.Now.Year; if (iMon < DateTime.Now.Month) { iYear++; } string dd = iYear.ToString() + "-" + iMon.ToString() + "-" + iDay.ToString(); ListPolicy.avDate = dd; EagleString.AvResult ar_new = new EagleString.AvResult(ar.avResult, 0, 0); ListPolicy.avDate = ar_new.FlightDate_DT.ToShortDateString(); GlobalVar2.xmlPolicies = WebService.wsGetPolicies(flightnos, dd, cp.Substring(0, 3), cp.Substring(cp.Length - 3)); Hashtable ht = GetHashTableFromXmlString(GlobalVar2.xmlPolicies); for (int i = 0; i < iCount; i++) { items[i] = new System.Windows.Forms.ListViewItem(); items[i].Text = ""; items[i].SubItems.Add("返点"); items[i].SubItems.Add(""); items[i].SubItems.Add("政策"); items[i].SubItems.Add(""); items[i].SubItems.Add(""); items[i].SubItems.Add(""); int countLie = lv.Items[i].SubItems.Count; for (int j = 7; j < countLie; j++)//23为3折舱,35为所有舱 { Application.DoEvents(); try { if (lv.Items[i].SubItems[j].Text.Trim().Length != 2) { items[i].SubItems.Add(""); } else { string p = GetOnePolicy(lv.Items[i].SubItems[3].Text, date, lv.Items[i].SubItems[1].Text, lv.Items[i].SubItems[j].Text[0].ToString(), ht ); items[i].SubItems.Add(p); } } catch { } } } for (int i = 0; i < iCount; i++) { lv.Items.Insert(2 * i + 1, items[i]); } bool b = false; for (int i = 0; i < lv.Items.Count; i += 2) { try { b = !b; if (b) { lv.Items[i].BackColor = lv.Items[i + 1].BackColor = lv.Items[i].BackColor = System.Drawing.Color.Gainsboro; } else { lv.Items[i].BackColor = lv.Items[i + 1].BackColor = lv.Items[i].BackColor = System.Drawing.Color.White; } } catch { } } } catch (Exception ex) { EagleAPI.LogWrite("SetAllPolicy:" + ex.Message); } }