Example #1
0
        private void 中规院ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string result = "";

            string[] lines = this.GetLines();
            foreach (string line in lines)
            {
                if (line == "")
                {
                    continue;
                }

                string[] items = line.Split(new char[] { '\t' });

                string path    = items[0];
                string barcode = items[1];

                // 册条码
                if (StringUtil.Between(barcode, "ZGS000001", "ZGS999999") ||
                    StringUtil.Between(barcode, "ZGY000001", "ZGY999999"))
                {
                    continue;
                }

                if (result != "")
                {
                    result += "\r\n";
                }

                result += path + "\t" + barcode;
            }

            this.txtResult.Text = result;
            MessageBox.Show("ok");
        }
Example #2
0
        // 默认的范围比较。注:要进行逐字符比较,这样 01-99,0A 就不在范围内了
        static bool IsInRangeDefault(string text, string range)
        {
            var parts = StringUtil.ParseTwoPart(range, "-");
            var ret   = VerifyChars(parts[0], parts[1], text);

            if (ret == false)
            {
                return(false);
            }
            return(StringUtil.Between(text, parts[0], parts[1]));
        }
Example #3
0
        private void 光华学院ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string result = "";

            string[] lines = this.GetLines();
            foreach (string line in lines)
            {
                if (line == "")
                {
                    continue;
                }

                string[] items = line.Split(new char[] { '\t' });

                string path    = items[0];
                string barcode = items[1];

                /*
                 * 中文图书:7位数字
                 * 报纸:B+6位数字
                 * 中文现刊:X+7位数字
                 * 中文合订刊:HS+6位数字 或者 HZ+6位数字
                 * 西文图书:W+7位数字
                 * 西文现刊:WX+6位数字
                 * 西文合订刊:WH+6位数字
                 */
                // 册条码
                if (StringUtil.Between(barcode, "0000001", "9999999") ||
                    StringUtil.Between(barcode, "B000001", "B999999") ||
                    StringUtil.Between(barcode, "X0000001", "X9999999") ||
                    StringUtil.Between(barcode, "HS000001", "HS999999") ||
                    StringUtil.Between(barcode, "HZ000001", "HZ999999") ||
                    StringUtil.Between(barcode, "W0000001", "W9999999") ||
                    StringUtil.Between(barcode, "WX000001", "WX999999") ||
                    StringUtil.Between(barcode, "WH000001", "WH999999")
                    )
                {
                    continue;
                }


                if (result != "")
                {
                    result += "\r\n";
                }

                result += path + "\t" + barcode;
            }

            this.txtResult.Text = result;
            MessageBox.Show("ok");
        }
Example #4
0
        private void 瑞景中学册条码分析ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string[] lines  = this.GetLines();
            string   result = "";

            int count5 = 0;
            int count6 = 0;
            int count7 = 0;
            int count8 = 0;

            int RJDZTS_count = 0;
            int RJRDZL_count = 0;
            int RJTS_count   = 0;
            int RJTS6_count  = 0;
            int rjts_count   = 0;
            int rjtsx_count  = 0;
            int RJQK_count   = 0;

            int    other_count = 0;
            string others      = "";

            foreach (string line1 in lines)
            {
                string line = line1;
                if (line == "")
                {
                    continue;
                }

                if (StringUtil.Between(line, "00000", "99999"))
                {
                    count5++;
                    continue;
                }

                if (StringUtil.Between(line, "000000", "999999"))
                {
                    count6++;
                    continue;
                }

                if (StringUtil.Between(line, "0000000", "9999999"))
                {
                    count7++;
                    continue;
                }

                if (StringUtil.Between(line, "00000000", "99999999"))
                {
                    count8++;
                    continue;
                }


                /*
                 * RJDZTS+5位数字 如RJDZTS00001
                 * RJRDZL+5位数字 如RJRDZL00055
                 * RJTS+5位数字 如RJTS00429
                 * rjts+5位数字 如rjts12744
                 * rjtsx+5位数字 如rjtsx12773
                 * RJQK+5位数字 如RJQK00001
                 */
                if (StringUtil.Between(line, "RJDZTS00000", "RJDZTS99999"))
                {
                    RJDZTS_count++;
                    continue;
                }

                if (StringUtil.Between(line, "RJRDZL00000", "RJRDZL99999"))
                {
                    RJRDZL_count++;
                    continue;
                }

                if (StringUtil.Between(line, "RJTS00000", "RJTS99999"))
                {
                    if (line.Substring(0, 4) == "rjts")
                    {
                        rjts_count++;
                        continue;
                    }

                    RJTS_count++;
                    continue;
                }

                if (StringUtil.Between(line, "RJTS000000", "RJTS999999"))
                {
                    RJTS6_count++;
                    continue;
                }

                //rjtsx
                if (StringUtil.Between(line, "rjtsx00000", "rjtsx99999"))
                {
                    rjtsx_count++;
                    continue;
                }

                //rjtsx
                if (StringUtil.Between(line, "RJQK00000", "RJQK99999"))
                {
                    RJQK_count++;
                    continue;
                }

                other_count++;
                if (others != "")
                {
                    others += "\r\n";
                }
                others += line;
            }

            //输出

            /*
             * int count5 = 0;
             * int count6 = 0;
             * int count7 = 0;
             * int count8 = 0;
             *
             * int RJDZTS_count = 0;
             * int RJRDZL_count = 0;
             * int RJTS_count = 0;
             * int rjts_count = 0;
             * int rjtsx_count = 0;
             * int RJQK_count = 0;
             *
             * int other_count = 0;
             * string others = "";
             */

            result += "5位纯数字\t" + count5 + "\r\n";
            result += "6位纯数字\t" + count6 + "\r\n";
            result += "7位纯数字\t" + count7 + "\r\n";
            result += "8位纯数字\t" + count8 + "\r\n";


            /*
             *                  * RJDZTS+5位数字 如RJDZTS00001
             * RJRDZL+5位数字 如RJRDZL00055
             * RJTS+5位数字 如RJTS00429
             * rjts+5位数字 如rjts12744
             * rjtsx+5位数字 如rjtsx12773
             * RJQK+5位数字 如RJQK00001
             */
            result += "RJDZTS+5位数字\t" + RJDZTS_count + "\r\n";
            result += "RJRDZL+5位数字\t" + RJRDZL_count + "\r\n";
            result += "RJTS+5位数字\t" + RJTS_count + "\r\n";
            result += "rjts+5位数字\t" + rjts_count + "\r\n";
            result += "RJTS+6位数字\t" + RJTS6_count + "\r\n";
            result += "rjtsx+5位数字\t" + rjtsx_count + "\r\n";
            result += "RJQK+5位数字\t" + RJQK_count + "\r\n";

            result += "其它\t" + other_count + "\r\n";

            result += others;

            this.txtResult.Text = result;
            MessageBox.Show("ok");
        }
Example #5
0
        private void btnAccessNo_Click(object sender, EventArgs e)
        {
            this.toolStripStatusLabel_info.Text = "开始";

            string[] lines  = this.GetLines();
            string   result = "";

            //string match = "^[0-9]*([.][0-9]*)$";// this.txtMatch.Text.Trim();

            //空索取号的
            List <string> emptyList = new List <string>();

            //没有斜撇
            List <string> noXpList = new List <string>();

            //有斜撇,但左或右没有值
            List <string> hasXpNoValueList = new List <string>();

            //左右有空格的
            List <string> hasKgList = new List <string>();



            List <string> leftWrongList  = new List <string>();
            List <string> rightWrongList = new List <string>();

            // 其它
            List <string> otherList = new List <string>();

            foreach (string line in lines)
            {
                if (line == "")
                {
                    continue;
                }

                string path     = line;
                string accessNo = "";

                int nIndex = line.IndexOf('\t');
                if (nIndex > 0)
                {
                    path     = line.Substring(0, nIndex);
                    accessNo = line.Substring(nIndex + 1);
                }

                this.toolStripStatusLabel_info.Text = "处理 " + line;
                Application.DoEvents();


                string retLine = path + "\t" + accessNo;

                // 无索取号的
                if (accessNo == "")
                {
                    emptyList.Add(retLine);
                    continue;
                }

                int nTemp = accessNo.IndexOf('/');
                if (nTemp == -1)
                {
                    //索取号不包括/
                    noXpList.Add(retLine);
                    continue;
                }

                string left  = accessNo.Substring(0, nTemp);
                string right = accessNo.Substring(nTemp + 1);
                if (left == "" || right == "")
                {
                    //有斜撇,但左或右没有值
                    hasXpNoValueList.Add(retLine);
                    continue;
                }

                string left1  = left.Trim();
                string right1 = right.Trim();
                if (left1 != left || right1 != right)
                {
                    //左右有空格的
                    hasKgList.Add(retLine);
                    continue;
                }

                // 左侧不是字母的
                string firstLeft = left.Substring(0, 1);
                if (StringUtil.Between(firstLeft, "A", "Z") == false)
                {
                    leftWrongList.Add(retLine);
                    continue;
                }

                // 右边不合适
                try
                {
                    double d = Convert.ToDouble(right);
                    continue;
                }
                catch
                {
                    string firstRight = right.Substring(0, 1);
                    if (StringUtil.Between(firstRight, "A", "Z") == false)
                    {
                        nTemp = right.IndexOf(":");
                        if (nTemp == -1)
                        {
                            nTemp = right.IndexOf(":");
                        }
                        if (nTemp == -1)
                        {
                            nTemp = right.IndexOf("=");
                        }
                        if (nTemp == -1)
                        {
                            nTemp = right.IndexOf(";");
                        }
                        if (nTemp == -1)
                        {
                            nTemp = right.IndexOf(";");
                        }


                        if (nTemp > 0)
                        {
                            string strFirst = right.Substring(0, nTemp);
                            //string strEnd = right.Substring(nTemp + 1);
                            try
                            {
                                int n = Convert.ToInt32(strFirst);
                                continue;
                            }
                            catch
                            { }
                        }

                        rightWrongList.Add(retLine);
                        continue;
                    }
                    else
                    {
                        continue;
                    }
                }

                //
                otherList.Add(retLine);
            }



            //空索取号的
            result += "##索取号为空的" + emptyList.Count + "条";
            foreach (string li in emptyList)
            {
                if (result != "")
                {
                    result += "\r\n";
                }
                result += li;
            }
            //没有斜
            result += "\r\n##没有斜的" + noXpList.Count + "条";
            foreach (string li in noXpList)
            {
                if (result != "")
                {
                    result += "\r\n";
                }
                result += li;
            }
            //有斜,但左或右没值
            result += "\r\n##有斜,但左或右没值的" + hasXpNoValueList.Count + "条";
            foreach (string li in hasXpNoValueList)
            {
                if (result != "")
                {
                    result += "\r\n";
                }
                result += li;
            }

            //左边错误
            result += "\r\n##左边错误的" + leftWrongList.Count + "条";
            foreach (string li in leftWrongList)
            {
                if (result != "")
                {
                    result += "\r\n";
                }
                result += li;
            }


            //右边错误
            result += "\r\n##右边错误" + rightWrongList.Count + "条";
            foreach (string li in rightWrongList)
            {
                if (result != "")
                {
                    result += "\r\n";
                }
                result += li;
            }

            //其它
            result += "\r\n##其它" + otherList.Count + "条";
            foreach (string li in otherList)
            {
                if (result != "")
                {
                    result += "\r\n";
                }
                result += li;
            }

            this.txtResult.Text = result;

            MessageBox.Show("ok");
            this.toolStripStatusLabel_info.Text = "结束";
        }
Example #6
0
        static bool IsInRange(string text, string range)
        {
            var parts = StringUtil.ParseTwoPart(range, "-");

            return(StringUtil.Between(text, parts[0], parts[1]));
        }