我现在接到这么个项目,有两个功能,一:检测条形码,如果有重码,给出提示。二:检测出漏码。
详细解释一下:比如我输入了100个条形码,而且这100个里面有ABC001么个条形码,再次输入,程序就回给出提示(这个很简单,已经解决)。漏码的意思是,001-100这么一百个条码,可能缺少059、096等等,程序要实现把缺少的条码找出来。只求一个算法,就是漏码。由于条码是字符串,而且还带字母,怎么做到在某个范围里面遍历以及找出缺少的那一字符串?或者有别的更好的算法?先悬赏50哈,有很给力的算法,再加分。

解决方案 »

  1.   

    就是连续的一段条码,比如说
    ABCD001 
    ABCD002
    ABCD003
    ……
    ABCD100这样一百个,可能缺少ABCD008,然后找出来
      

  2.   

    先把逻辑理清楚再谈算法...算法不是空谈的...假如你的字符串有规律就找出规律然后顺序验证,并不是难事...比如ABC001,假如前三位固定或字母累进后三位数字累进就很简单,分两个部分顺序累进验证就得了...
      

  3.   

    list保存数据,foreach遍历
    正则\d 获取数字保存到list
    循环判断连续
      

  4.   

    比如说这样遍历for(string s=0001;s<=1000;s++;)  (我知道这样肯定不行的,就是这个思路做的话,int类型这样做肯定对的,换字符串不晓得怎么做)
      

  5.   

    List<string> scanCodeList = new List<string>();
            private void scan()
            {
                //扫描一次加一个
                string currentScanCode = "";// Scaner.getCurrentScanCode();
                if (scanCodeList.Contains(currentScanCode)) MessageBox.Show("重码");
                else scanCodeList.Add(currentScanCode);
            }        //            一维条码:
            //EAN 8 (2 or 5 digit supplement)
            //EAN 13(2 or 5 digit supplement)
            //Codabar (Monarch, NW-7, USD-4, 2 of 7 code)
            //Code 39 Standard
            //Code 39 Extended
            //Code 93 Standard
            //Code 93 Extended
            //Code 128
            //AbcCodabar
            //2/5 Datalogic,Code25, 2 of 5
            //Code 11 (USD-8)
            //Code25, 2 of 5, ITF
            //Code25, 2/5 Matrix
            //Code25, 2/5 Industrial
            //Code25, 2/5 IATA
            //Code25, 2/5 INVERT
            //ITF6, ITF14 (SSC14), ITF16
            //ISBN (International Standard Book Number)
            //ISSN (International Standard Serial Number)
            //ISMN (International Standard Music Number)
            //UPC-A (with or without supplements)
            //UPC-E0 (with or without supplements)
            //UPC-E1 (with or without supplements)
            //UPC-Shipping
            //PostNet (ZIP, ZIP+4, DPBC)
            //OPC (Optical Industry Association)
            //UCC/EAN 128        //二维条码主要有PDF417码、Code49码、Code 16k码、Data MatxiCode码等
            private void checkForgetCode()
            { 
     
            }