Esempio n. 1
0
        private void btGetPNR_Click(object sender, EventArgs e)
        {
            airCode             = "";
            textBox4.Text       = "请稍等……";
            tbAirCode.Text      = tbAirCode.Text.Trim().ToUpper();
            tbFlightNumber.Text = tbFlightNumber.Text.Trim().ToUpper();
            tbDate.Text         = tbDate.Text.Trim().ToUpper();
            if (!EagleAPI.IsRtCode(tbAirCode.Text))
            {
                MessageBox.Show("大编码错误"); return;
            }
            ;
            if (tbFlightNumber.Text == "")
            {
                MessageBox.Show("请输入航班号"); return;
            }
            ;
            if (tbDate.Text.Length != 5)
            {
                MessageBox.Show("请输入正确日期"); return;
            }
            ;
            EagleAPI.CLEARCMDLIST(3);
            string cmd = "RRT:V/" + tbAirCode.Text + "/" + tbFlightNumber.Text + "/" + tbDate.Text;

            EagleAPI.EagleSendCmd(cmd + "~rrt ok~" + cmd, 3);
        }
Esempio n. 2
0
 private void btPATA_Click(object sender, EventArgs e)
 {
     bRtBotton = false;
     EagleAPI.CLEARCMDLIST(3);
     EagleAPI.EagleSendOneCmd("i~rT" + tbPnr.Text.Trim() + "~pat:A");
     pt = pattype.pata;
 }
Esempio n. 3
0
        public void exec()
        {
            GlobalVar.etProcessing = true;
            ////PrintReceipt pr = new PrintReceipt();
            ////pr.Text = "电子客票确认及信息提交";
            ////pr.textBox_订座号.Text = EagleAPI.etstatic.Pnr;
            ////pr.textBox_订座号.ReadOnly = true;
            ////pr.Window_CheckET();
            ////string txtAppend = "";
            ////if (pr.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            ////    txtAppend = ("电子客票数据处理完成!\r\n>");
            ////else
            ////    txtAppend = ("电子客票数据可能未提交,请点菜单->电子客票->电子客票核对!\r\n>");
            ////GlobalVar.stdRichTB.AppendText(txtAppend);
            //if (PrintReceipt.b0007) return;

            //PrintReceipt.b0007 = true;
            //PrintReceipt pr = new PrintReceipt();
            //pr.display过票();
            //pr.Window_ManageET();
            //pr.Text = "电子客票后台核查管理";
            ////pr.Visible = false;
            //pr.setToSubmitForm();
            //pr.Show();
            //pr.Hide();
            Thread et = new Thread(new ThreadStart(eTicket.etrun.runthread));

            et.Start();


            GlobalVar.etProcessing = false;
            EagleAPI.CLEARCMDLIST(3);
            //用于在黑屏上再次显示。。。
            //EagleAPI.EagleSendOneCmd("i~rT:" + EagleAPI.etstatic.Pnr,3);
        }
Esempio n. 4
0
 private void bt取身份证号_Click(object sender, EventArgs e)
 {
     try
     {
         if (GlobalVar.serverAddr == GlobalVar.ServerAddr.HangYiWang)
         {
             GlobalVar.formSendCmdType = GlobalVar.FormSendCommandType.detrF;
             EagleAPI.CLEARCMDLIST(3);
             string etnumber = rb3.Checked ? tbPnr.Text : EagleAPI.GetETNumber(retstring)[cb被保险人姓名.SelectedIndex].Replace(' ', '-');
             //EagleAPI.EagleSendCmd("detr:tn/" + etnumber + ",f");
             tb证件号.Text = "请稍等…………";
         }
         else if (GlobalVar.serverAddr == GlobalVar.ServerAddr.Eagle)
         {
             GlobalVar.formSendCmdType = GlobalVar.FormSendCommandType.detrF;
             EagleAPI.CLEARCMDLIST(3);
             Options.ibe.IbeRt ir       = new Options.ibe.IbeRt(rtXml);
             string            etnumber = ir.getpeopleinfo(2)[cb被保险人姓名.SelectedIndex];//这里不一样(IBE坏了怎么办?)
             EagleAPI.EagleSendCmd("detr:tn/" + etnumber + ",f");
             tb证件号.Text = "请稍等…………";
         }
     }
     catch (Exception ee)
     {
         MessageBox.Show(ee.Message + ",请先提取PNR或票号!");
     }
 }
Esempio n. 5
0
        /// <summary>
        /// 1、发指令取是否出票和人数
        /// </summary>
        private void SendRT()
        {
            string rtCommand = "";

            rtCommand = "i~rt:n/" + strPnr.Trim();
            EagleAPI.CLEARCMDLIST(3);
            GlobalVar.b_rt = true;
            EagleAPI.EagleSendOneCmd(rtCommand);
        }
Esempio n. 6
0
        /// <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;
            }
        }
Esempio n. 7
0
        private void tb_eNumber_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyValue == 13)//回车
            {
                this.tb_eNumber.Text = this.tb_eNumber.Text.ToUpper();
                retstring            = "";

                EagleAPI.CLEARCMDLIST(3);

                cb_name.Items.Clear();
                cb_name.Text = "请稍等……";
                EagleAPI.EagleSendCmd("rT:n/" + tb_eNumber.Text.Trim());
            }
        }
Esempio n. 8
0
 private void btGetCardId_Click(object sender, EventArgs e)
 {
     try
     {
         GlobalVar.formSendCmdType = GlobalVar.FormSendCommandType.detrF;
         EagleAPI.CLEARCMDLIST(3);
         string etnumber = this.radioButton3.Checked?tbPnr.Text:EagleAPI.GetETNumber(retstring)[cbName.SelectedIndex].Replace(' ', '-');
         EagleAPI.EagleSendCmd("detr:tn/" + etnumber + ",f");
         this.tbCardID.Text = "请稍等…………";
     }
     catch (Exception ee)
     {
         MessageBox.Show(ee.Message + ",请先提取PNR或票号!");
     }
 }
Esempio n. 9
0
        static public void PnrTextBoxKeyUp(TextBox tb, ComboBox cb, KeyEventArgs e, ref string retstring, string cmd)
        {
            if (e.KeyValue == 13)//回车
            {
                tb.Text   = tb.Text.ToUpper();
                retstring = "";
                //if (tb.Text.Trim().Length != 5) return;

                EagleAPI.CLEARCMDLIST(3);

                cb.Items.Clear();
                cb.Text = "请稍等……";

                EagleAPI.EagleSendCmd(cmd);
            }
        }
Esempio n. 10
0
        /// <summary>
        /// 清空msgtype的列表后,并将原指令列表复制进去,以保存
        /// </summary>
        /// <param name="msgtype"></param>
        public static void UseTheCommandQueneListEnd(int msgtype)
        {
            EagleAPI.CLEARCMDLIST(msgtype);
            switch (msgtype)
            {
            case 3:

                for (int i = 0; i < connect_4_Command.Qall.Count; i++)
                {
                    connect_4_Command.Qall0003.Add(connect_4_Command.Qall[i]);
                }
                for (int i = 0; i < connect_4_Command.Qorder.Count; i++)
                {
                    connect_4_Command.Qorder0003.Add(connect_4_Command.Qorder[i]);
                }
                for (int i = 0; i < connect_4_Command.Qquery.Count; i++)
                {
                    connect_4_Command.Qquery0003.Add(connect_4_Command.Qquery[i]);
                }
                for (int i = 0; i < connect_4_Command.Qsend.Count; i++)
                {
                    connect_4_Command.Qsend0003.Add(connect_4_Command.Qsend[i]);
                }
                break;

            case 7:
                for (int i = 0; i < connect_4_Command.Qall.Count; i++)
                {
                    connect_4_Command.Qall0007.Add(connect_4_Command.Qall[i]);
                }
                for (int i = 0; i < connect_4_Command.Qorder.Count; i++)
                {
                    connect_4_Command.Qorder0007.Add(connect_4_Command.Qorder[i]);
                }
                for (int i = 0; i < connect_4_Command.Qquery.Count; i++)
                {
                    connect_4_Command.Qquery0007.Add(connect_4_Command.Qquery[i]);
                }
                for (int i = 0; i < connect_4_Command.Qsend.Count; i++)
                {
                    connect_4_Command.Qsend0007.Add(connect_4_Command.Qsend[i]);
                }
                break;
            }
            cmdListOperating = false;
        }
Esempio n. 11
0
 /// <summary>
 /// 发送结束后,指示全局变量GlobalVar.b_pnCommand,GlobalVar.b_rtCommand,GlobalVar.b_etdz,GlobalVar.b_etdz_A
 /// </summary>
 /// <param name="content"></param>
 public static void send_end(string content, int msgtype)
 {
     GlobalVar.b_pnCommand = (EagleAPI.substring(content, 0, 2).ToUpper() == "PN");
     if (connect_4_Command.Qorder.Count < 1)
     {
         GlobalVar.b_rtCommand = false;
     }
     else
     {
         GlobalVar.b_rtCommand = (EagleAPI.substring(connect_4_Command.Qorder[connect_4_Command.Qorder.Count - 1], 0, 2).ToUpper() == "RT");
     }
     if (GlobalVar.b_etdz && EagleAPI.etstatic.Pnr.Trim().Length == 5)
     {
         EagleAPI.CLEARCMDLIST(msgtype);
         GlobalVar.b_etdz   = false;
         GlobalVar.b_etdz_A = true;
     }
 }
Esempio n. 12
0
        private void tbPnr_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyValue == 13)//回车
            {
                this.tbPnr.Text = this.tbPnr.Text.ToUpper();
                retstring       = "";
                if (tbPnr.Text.Trim().Length != 5)
                {
                    return;
                }

                EagleAPI.CLEARCMDLIST(3);

                cbName.Items.Clear();
                cbName.Text = "请稍等……";

                EagleAPI.EagleSendCmd("rT:n/" + tbPnr.Text.Trim());
            }
        }
Esempio n. 13
0
        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);
            }
        }
Esempio n. 14
0
        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;                                           //置控件
            }
        }
Esempio n. 15
0
 private void bt查看PNR_Click(object sender, EventArgs e)
 {
     bRtBotton = true;
     EagleAPI.CLEARCMDLIST(3);
     EagleAPI.EagleSendOneCmd("i~rT" + tbPnr.Text.Trim());
 }
Esempio n. 16
0
        private void ReceiveData(object obj)
        {
            User user = (User)obj;

            userCurrent = user;
            TcpClient client = user.client;
            //是否正常退出接收线程
            bool normalExit = false;
            //用于控制是否退出循环
            bool exitWhile = false;

            while (exitWhile == false)
            {
                string receiveString = null;
                try
                {
                    //从网络流中读出字符串
                    //此方法会自动判断字符串长度前缀,并根据长度前缀读出字符串
                    receiveString = user.br.ReadString();
                }
                catch
                {
                    //底层套接字不存在时会出现异常
                    //MessageBox.Show("接收数据失败");
                }
                if (receiveString == null)
                {
                    if (normalExit == false)
                    {
                        //如果停止了监听,Connected为false
                        if (client.Connected == true)
                        {
                            //SetListBox(string.Format("与[{0}]失去联系,已终止接收该用户信息", client.Client.RemoteEndPoint));
                        }
                    }
                    break;
                }
                //SetListBox(string.Format("来自[{0}]:{1}", user.client.Client.RemoteEndPoint, receiveString));
                string[] splitString = receiveString.Split(',');
                string   sendString  = "";
                //MessageBox.Show(user.client.Client.RemoteEndPoint.ToString());
                switch (splitString[0])
                {
                case "Login":
                    //格式:Login
                    //sendString = "Hello,我是服务器,你好!";
                    //SendToClient(user, sendString);
                    //GlobalVar.stdRichTB.AppendText("本地财务软件登陆");
                    break;

                case "Logout":
                    //格式:Logout
                    //SetListBox(string.Format("[{0}]退出", user.client.Client.RemoteEndPoint));
                    normalExit = true;
                    exitWhile  = true;
                    break;

                case "Talk":
                    //格式:Talk,对话内容
                    //SetListBox(string.Format("[{0}]说:{1}", client.Client.RemoteEndPoint,
                    //receiveString.Substring(splitString[0].Length + 1)));
                    break;

                default:
                    //SetListBox("什么意思啊:" + receiveString);
                    //SendToClient(user, "f**k you too");
                    GlobalVar.cwRecvString = receiveString;
                    EagleAPI.CLEARCMDLIST(3);
                    EagleAPI.EagleSendCmd(receiveString, 3);
                    break;
                }
            }
            userList.Remove(user);
            client.Close();
            //SetListBox(string.Format("当前连接用户数:{0}", userList.Count));
        }