Ejemplo n.º 1
0
        public static TrainTicketInfo AI_TrainTicket(string path)
        {
            var             Imageinfo = File.ReadAllBytes(path);
            var             result    = client.TrainTicket(Imageinfo);
            TrainTicketInfo Tickinfo  = new TrainTicketInfo();

            Tickinfo.logid               = (string)result["log_id"];
            Tickinfo.ticket_num          = (string)result["words_result"]["ticket_num"];
            Tickinfo.date                = (string)result["words_result"]["date"];
            Tickinfo.name                = FixName((string)result["words_result"]["name"]);
            Tickinfo.seat_category       = (string)result["words_result"]["seat_category"];
            Tickinfo.starting_station    = (string)result["words_result"]["starting_station"];
            Tickinfo.destination_station = (string)result["words_result"]["destination_station"];
            Tickinfo.train_num           = (string)result["words_result"]["train_num"];
            Tickinfo.ticket_rates        = (string)result["words_result"]["ticket_rates"];
            Tickinfo.jianpiao            = String.Format("检票:{0}", TrainTicket.GetRandomLetter().ToString() + new Random().Next(0, 9).ToString());
            Random ran = new Random();
            int    n   = ran.Next(10, 24);
            int    n2  = ran.Next(10, 24);

            Tickinfo.train_starttime = n + ":" + n2;
            int n3 = ran.Next(1, 9);

            Tickinfo.train_che = "0" + n3;
            int n4 = ran.Next(1, 9);

            Tickinfo.train_hao = "0" + n4 + "B";
            Tickinfo.ID        = "384951990042215674";
            if (People_ID.Contains(GetPeopleID(Tickinfo.name)))
            {
                Tickinfo.ID = GetPeopleID(Tickinfo.name).id;
            }
            else
            {
                Tickinfo.ID = "请手动输入";
            }
            Tickinfo.bottomid = GetRandombottomid();
            return(Tickinfo);
        }
Ejemplo n.º 2
0
        public static void TrainTickets()
        {
            JObject result      = null;
            JObject firstresult = null;

            //预先识别检查是否为一张可以识别的火车票
            try
            {
                firstresult = client.GeneralBasic(Imageinfo);
            }
            catch (Exception e)
            {
                MessageBox.Show(string.Format("识别错误{0}", e), "车票识别", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            var resultnum = (int)firstresult["words_result_num"];

            if (resultnum < 15)
            {
                OnTrainTicketError(OrinImage);
                return;
            }
            // 调用火车票识别
            try
            {
                result = client.TrainTicket(Imageinfo);
            }
            catch (Exception e)
            {
                MessageBox.Show(String.Format("识别车票错误\n错误信息{0}", e), "车票识别", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            var Tickinfo = new TrainTicketInfo
            {
                logid               = (string)result["log_id"],
                ticket_num          = (string)result["words_result"]["ticket_num"],
                date                = (string)result["words_result"]["date"],
                name                = FixName((string)result["words_result"]["name"]),
                seat_category       = (string)result["words_result"]["seat_category"],
                starting_station    = (string)result["words_result"]["starting_station"],
                destination_station = (string)result["words_result"]["destination_station"],
                train_num           = (string)result["words_result"]["train_num"],
                ticket_rates        = (string)result["words_result"]["ticket_rates"],
                jianpiao            = String.Format("检票:{0}", TrainTicket.GetRandomLetter().ToString() + new Random().Next(0, 9).ToString())
            };
            Random ran = new Random();
            int    n   = ran.Next(10, 24);
            int    n2  = ran.Next(10, 24);

            Tickinfo.train_starttime = n + ":" + n2;
            int n3 = ran.Next(1, 9);

            Tickinfo.train_che = "0" + n3;
            int n4 = ran.Next(1, 9);

            Tickinfo.train_hao = "0" + n4 + "B";
            Tickinfo.ID        = "362301998123457130";
            if (!String.IsNullOrWhiteSpace(Tickinfo.name))
            {
                if (People_ID.Contains(GetPeopleID(Tickinfo.name)))
                {
                    Tickinfo.ID = GetPeopleID(Tickinfo.name).id;
                }
                else
                {
                    MessageBox.Show(String.Format("找不到{0}这人的身份证\n请手动添加\n或去设置中的身份证设置中进行添加", Tickinfo.name), "车票识别", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }

            Tickinfo.bottomid = GetRandombottomid();
            OnTrainTicketMaked(Tickinfo);

            return;
        }