Esempio n. 1
0
        public static STDT AutoIndex(ShowBase sb, out List<STPa> pa, out List<STIV> iv, out List<STIpc> ic, out List<STPR> pr, out List<STQY> qy)
        {
            STDT st = new STDT() { ZTID = sb.ZTID, SiD = sb.SiD, ImportDate = sb.ImportDate };
            pa = new List<STPa>();
            iv = new List<STIV>();
            ic = new List<STIpc>();
            pr = new List<STPR>();
            qy = new List<STQY>();
            //申请号
            if (sb.An != null)
            {
                st.An = sb.An;
                if (sb.Ad.FormatDate().GetYear() != 1800)
                {
                    st.Ad = sb.Ad.FormatDate();
                    st.AdY = Convert.ToInt32(st.Ad.GetYear());
                }
            }
            if (sb.PN != null)
            {
                //公开
                st.PN = sb.PN;
                if (sb.PD.FormatDate().GetYear() != 1800)
                {
                    st.PD = sb.PD.FormatDate();
                    st.PDy = st.PD.GetYear();
                    if (st.PD != null && st.Ad != null)
                    {
                        st.PDyDef = IDataImportAdapter.GetYearDeff(st.PD, st.Ad);
                    }
                }
            }
            if (sb.GN != null)
            {
                //公告
                st.GN = sb.GN;
                if (sb.Gd.FormatDate().GetYear() != 1800)
                {
                    st.Gd = sb.Gd.FormatDate();
                    st.GdY = sb.Gd.GetYear();
                    if (st.Gd != null && st.Ad != null)
                    {
                        st.GdYDef = IDataImportAdapter.GetYearDeff(st.Gd, st.Ad);
                    }
                }
            }
            //PCT
            st.PcTIn = sb.PcDIn.FormatDate();
            st.PcTAn = sb.PcTAn;
            st.PcTAd = sb.PcTAd.FormatDate();
            st.PcTPN = sb.PcTPN;
            st.PcTPD = sb.PcTPN.FormatDate();
            //母案
            st.MAd = sb.MAd;

            //页数字数
            st.DesPageSum = sb.DesPageSum.ToSbyte();
            st.PiCSum = sb.PiCSum.ToSbyte();
            st.ClMPageSum = sb.ClMSum.ToSbyte();
            if (sb.ClM != null)
            {
                st.ClSCharSum = sb.ClM.Length;
            }



            //专利类型
            string type = "";
            string type1 = "";
            char ctype = '1';
            switch (st.An.Length)
            {
                case 8:
                case 9:
                    ctype = st.An[2];
                    break;
                case 12:
                case 13:
                    ctype = st.An[4];
                    break;

            }
            switch (ctype)
            {
                case '1':
                    type = "发明专利";
                    type1 = "发明专利";
                    break;
                case '2':
                    type = "实用新型";
                    type1 = "实用新型";
                    break;
                case '3':
                    type = "外观专利";
                    type1 = "外观专利";
                    break;
                case '8':
                    type = "发明专利";
                    type1 = "发明专利PCT";
                    break;
                case '9':
                    type = "实用新型";
                    type1 = "实用新型PCT";
                    break;
            }

            st.Type = type;
            st.Type1 = type1;

            if (type != "发明专利")
            {
                st.GN = st.PN;
                st.Gd = st.PD;
                st.GdY = st.PDy;
                st.GdYDef = st.GdYDef;
            }

            #region 法律状态
            //因费用终止公告日
            string lg = "";
            if (sb.LG != null)
            {
                if (sb.LG != "")
                {
                    Match mh = regYear.Match(sb.LG);
                    if (mh.Success)
                    {
                        st.LGYear = Convert.ToInt32(mh.Groups["lgdata"].Value.ToString().Left(4));
                    }
                    if (sb.Gd != "")
                    {
                        lg = "授权失效";
                    }
                    else
                    {
                        lg = "无效";
                    }
                }
                else
                {
                    if (type == "实用新型" || type == "外观专利")
                    {
                        lg = "授权有效";
                    }
                    else
                    {
                        if (sb.Gd != "")
                        {
                            lg = "授权有效";
                        }
                        else
                        {
                            lg = "在审";
                        }
                    }

                }
                st.LG = lg;

                int age = 0;
                switch (lg)
                {
                    case "在审":
                        st.IsGongZHi = 0;
                        break;
                    case "授权有效":
                        if (st.AdY.HasValue)
                        {
                            age = DateTime.Now.Year - st.AdY.Value;
                            if (age == 0) age = 1;
                        }
                        st.IsGongZHi = 0;
                        break;
                    case "无效":
                        st.IsGongZHi = 1;
                        break;
                    case "授权失效":
                        if (st.LGYear.HasValue)
                        {
                            age = st.LGYear.Value - st.AdY.Value;
                            if (age == 0) age = 1;
                        }
                        else
                        {
                            Console.WriteLine("x");
                        }
                        st.IsGongZHi = 1;
                        break;
                }
                st.Age = (sbyte)age;
            }
            //if (age == 0) age = 1;

            if (st.Gd != null && st.PD != null)
            {
                st.SCzQ = IDataImportAdapter.GetYearDeff(st.Gd.ToString(), st.PD.ToString());
            }

            #endregion
            int i = 0;
            #region 申请人
            if (sb.Pa != null)
            {
                string[] pas = sb.Pa.Split("、;;".ToArray());
                int tmpsum = 0;
                foreach (var strpa in pas)
                {
                    if (strpa.Trim() == "") continue;
                    i++;
                    STPa tmppa = new STPa() { ZTID = sb.ZTID, SiD = sb.SiD, Pa = strpa, PaType = strpa.GetPaType(), Sort = (SByte)i };
                    if (tmppa.PaType != "个人")
                    {
                        tmpsum++;
                    }
                    pa.Add(tmppa);
                }
                if (pa.Count > 0)
                {
                    st.FPa = pa[0].Pa;
                    st.FPaType = pa[0].PaType;
                    st.PaSum = (SByte)pa.Count;
                }
                if (tmpsum > 1)
                {
                    st.IsHeZUO = (SByte)1;
                }
            }
            #endregion
            #region 发明人
            if (sb.IV != null)
            {
                string[] ins = sb.IV.Split("、;;".ToArray());
                i = 0;
                foreach (var strin in ins)
                {
                    if (strin.Trim() == "") continue;
                    i++;
                    iv.Add(new STIV() { ZTID = sb.ZTID, SiD = sb.SiD, IV = strin, Sort = (SByte)i });
                }
                if (iv.Count > 0)
                {
                    st.FIn = iv[0].IV;
                    st.InSum = (SByte)iv.Count;
                }
            }
            #endregion
            #region IPC
            if (sb.Ipc != null)
            {
                //IPC
                string[] ipcs = sb.Ipc.Split("、;;".ToArray());
                i = 0;
                foreach (var ipc in ipcs)
                {
                    if (ipc.Trim() == "") continue;
                    string atripc = ipc.Replace("  ", " ").FormatIPC();
                    STIpc tmpipc = new STIpc() { ZTID = sb.ZTID, SiD = sb.SiD, Ipc = atripc };
                    if (type == "外观专利")
                    {
                        tmpipc.Ipc3 = atripc.Left(2);
                        tmpipc.Ipc4 = atripc.Left(5);
                        tmpipc.Ipc7 = atripc.Left(7);
                    }
                    else
                    {

                        tmpipc.Ipc1 = atripc.Left(1);
                        tmpipc.Ipc3 = atripc.Left(3);
                        tmpipc.Ipc4 = atripc.Left(4);
                        tmpipc.Ipc7 = atripc.Left(7);
                    }
                    ic.Add(tmpipc);
                }
                if (ic.Count > 0)
                {
                    st.FIpc = ic[0].Ipc;
                    st.IpcSum = (SByte)ic.Count;
                }
            }
            #endregion
            #region 洲国省市区县-经济区域

            if (!string.IsNullOrEmpty(sb.AddR))
            {
                string[] diqu = sb.AddR.AddressToShengShiQuXianAddress();
                st.ShEng1 = diqu[1];
                st.ShI = diqu[2];
                st.QUXian = diqu[3];
            }
            else
            {
                st.ShEng1 = "未知";
                st.ShI = "未知";
                st.QUXian = "未知";


            }
            int tmpindex = sb.ShEng.IndexOf("(");
            string daima = "";
            if (tmpindex >= 0)
            {
                st.ShEng = sb.ShEng.Substring(0, tmpindex);
                try
                {
                    daima = sb.ShEng.Substring(tmpindex + 1, 2);
                }
                catch (Exception)
                {
                    daima = "";
                }
            }
            if (zhouguo.ContainsKey(daima))
            {
                CfGCountry cfgc = zhouguo[daima];
                st.ShEng1 = cfgc.ShEng1;
                st.GJ = cfgc.GJ;
                st.ZHoU = cfgc.ZHoU;
            }
            else
            {
                st.ShEng1 = "未知";
                st.GJ = "未知";
                st.ZHoU = "未知";
            }
            if (st.GJ != "中国")
            {
                st.IsGuOwAi = 1;
            }
            if (string.IsNullOrEmpty(st.GJ))
            {
                st.GJ = "未知";
            }
            if (string.IsNullOrEmpty(st.ZHoU))
            {
                st.ZHoU = "未知";
            }
            if (string.IsNullOrEmpty(st.ShEng))
            {
                st.ShEng = "未知";
            }
            if (string.IsNullOrEmpty(st.ShEng1))
            {
                st.ShEng1 = "未知";
            }
            if (string.IsNullOrEmpty(st.ShI))
            {
                st.ShI = "未知";
            }
            if (string.IsNullOrEmpty(st.QUXian))
            {
                st.QUXian = "未知";
            }

            List<string> Listquyu = new List<string>();
            if (quyu.ContainsKey(st.ZHoU))
            {
                Listquyu.Add(quyu[st.ZHoU]);
            }
            if (quyu.ContainsKey(st.GJ))
            {
                Listquyu.Add(quyu[st.GJ]);
            }
            if (quyu.ContainsKey(st.ShEng))
            {
                Listquyu.Add(quyu[st.ShEng]);
            }
            if (quyu.ContainsKey(st.ShEng1))
            {
                Listquyu.Add(quyu[st.ShEng1]);
            }
            if (quyu.ContainsKey(st.ShI))
            {
                Listquyu.Add(quyu[st.ShI]);
            }
            if (quyu.ContainsKey(st.QUXian))
            {
                Listquyu.Add(quyu[st.QUXian]);
            }
            Listquyu = Listquyu.Distinct().ToList<string>();
            foreach (var s in Listquyu)
            {
                qy.Add(new STQY() { ZTID = sb.ZTID, SiD = sb.SiD, QY = s });
            }
            #endregion
            #region 优先权
            if (sb.PR != null)
            {
                string[] aryprs = sb.PR.Split("\t".ToArray());
                i = 0;
                int opd = 0;
                string oprc = "";
                foreach (var strpr in aryprs)
                {
                    string tmpstrpr = strpr.Trim();
                    if (tmpstrpr == "") continue;
                    i++;
                    string[] itmes = regPr.Split(tmpstrpr);
                    string prcy = itmes[0];

                    string prno = itmes[1];
                    string prdt = "";
                    int tmpopd = DateTime.Now.Year;
                    try
                    {
                        prdt = tmpstrpr.Substring(prcy.Length, tmpstrpr.Length - prcy.Length - prno.Length).FormatDate();
                        tmpopd = Convert.ToInt32(prdt);
                        if (i == 1)
                        {
                            opd = tmpopd;
                            oprc = prcy;
                        }
                        else
                        {
                            if (opd < tmpopd)
                            {
                                opd = tmpopd;
                                oprc = prcy;
                            }
                        }

                        STPR tmpr = new STPR() { ZTID = sb.ZTID, SiD = sb.SiD };
                        tmpr.An = prno;
                        tmpr.Ad = prdt;
                        tmpr.GJ = prcy;

                        pr.Add(tmpr);
                    }
                    catch (Exception ex)
                    {
                        //todonothing;
                        //tmpopd = st.AdY.Value;
                    }


                }
                if (pr.Count > 0)
                {
                    int year = opd.ToString().GetYear();
                    if (year != 1800)
                    {
                        st.OpD = opd.ToString();
                        st.OpDy = opd.ToString().GetYear();
                    }
                    st.OprC = oprc;

                }
            }
            #endregion
            return st;

        }
Esempio n. 2
0
        public override bool Import()
        {
            string s = Sr.ReadToEnd().Replace(kunkaojin, "");
            TemplateHelper tmph = new TemplateHelper("");
            string[] arys = regRowSplit.Split(s);
            List<ShowBase> sbs = new List<ShowBase>();
            List<STPa> pas = new List<STPa>();
            List<STIV> ivs = new List<STIV>();
            List<STIpc> ipcs = new List<STIpc>();
            List<STPR> prs = new List<STPR>();
            List<STDT> dts = new List<STDT>();
            List<STDc> dcs = new List<STDc>();
            List<STPNS> pns = new List<STPNS>();
            List<STAnS> ans = new List<STAnS>();
            int count = arys.Length - 1;
            SetMaxProcess(this, count);
            Thimport = new Thread(() =>
            {
                //第一行为空
                for (int i = 1; i <= count; i++)
                {
                    string tmp = regspace.Replace(regcharRNT.Replace(arys[i], ""), " ");
                    tmp = MarkReplece.Replace(tmp, "【$1】").Trim();
                    MatchCollection mhs = rowRege.Matches(tmp);
                    ShowBase sb = new ShowBase();
                    sb.ZTID = ZTId;
                    sb.ImportDate = DateTime.Now;

                    foreach (Match m in mhs)
                    {
                        string colname = m.Groups["colname"].Value.Trim();
                        string val = m.Groups["colval"].Value.Trim().Trim('\t');
                        string mappingcolname = tmph.getMappingColumnName(colname);
                        switch (mappingcolname)
                        {
                            case "AN":
                                sb.SiD = val;
                                break;
                            case "AP":
                                sb.An = val;
                                break;
                            case "TI":
                                sb.Title = val;
                                break;
                            case "ICAI":
                            case "ICCI":
                                if (sb.Ipc == null)
                                {
                                    sb.Ipc = val;
                                }
                                else
                                {
                                    sb.Ipc += ";" + val;
                                }

                                break;
                            case "PA":
                                sb.Pa = val;
                                break;
                            case "CPY":
                                sb.CPY = val;
                                break;
                            case "OPD":
                                sb.OpD = val;
                                break;
                            case "AB":
                                sb.ABs = val;
                                break;
                            case "IN":
                                sb.IV = val;
                                break;
                            case "PN":
                                sb.PN = val;
                                break;
                            case "PR":
                                sb.PR = val;
                                break;
                            case "PD":
                                sb.PD = val;
                                break;
                            case "DC":
                                sb.Dc = val;
                                break;
                            case "DMC":
                                sb.DMc = val;
                                break;
                            case "DS":
                                break;
                            case "YZ":
                                break;
                            case "BY":
                                break;
                            case "CPC":
                                sb.CPc = val;
                                break;
                            case "":
                                break;
                            default:
                                break;
                        }
                    }
                    if (CheckExist(sb.SiD))
                    {
                        if (Skip)
                        {

                            Skip_sum++;
                            continue;
                        }
                        else
                        {
                            DelExist(sb.ZTID.ToString(), sb.SiD.ToString());
                            Overwrite_sum++;
                        }

                    }
                    else
                    {
                        Sids.Add(sb.SiD, true);
                    }
                    sbs.Add(sb);

                    List<STPa> pa = new List<STPa>();
                    List<STIV> iv = new List<STIV>();
                    List<STIpc> ipc = new List<STIpc>();
                    List<STPR> pr = new List<STPR>();
                    List<STAnS> an = new List<STAnS>();
                    List<STPNS> pn = new List<STPNS>();
                    List<STDc> dc = new List<STDc>();
                    dts.Add(WPIIndex.AutoIndex(sb, out pa, out iv, out ipc, out pr, out pn, out an, out dc));
                    pas.AddRange(pa);
                    ivs.AddRange(iv);
                    ipcs.AddRange(ipc);
                    prs.AddRange(pr);
                    pns.AddRange(pn);
                    ans.AddRange(an);
                    dcs.AddRange(dc);
                    if (i % 100 == 0)
                    {

                        //Thread.Sleep(1000);
                        //todo:标引
                        //todo:标引信息入库

                        //todo:基本信息入库
                        //BulkInsert(sbs);
                        BulkInsert(sbs, pas, ivs, ipcs, prs, dts, pns, ans, dcs);
                        sbs.Clear();
                        pas.Clear();
                        ivs.Clear();
                        ipcs.Clear();
                        prs.Clear();
                        dts.Clear();
                        pns.Clear();
                        ans.Clear();
                        dcs.Clear();
                        ShowProcess(this, i, Skip_sum, Overwrite_sum, "导入");

                    }

                }
                if (sbs.Count > 0)
                {
                    BulkInsert(sbs, pas, ivs, ipcs, prs, dts, pns, ans, dcs);
                    sbs.Clear();
                    pas.Clear();
                    ivs.Clear();
                    ipcs.Clear();
                    prs.Clear();
                    dts.Clear();
                    pns.Clear();
                    ans.Clear();
                    dcs.Clear();
                }


                ShowProcess(this, count, Skip_sum, Overwrite_sum, "导入完毕");

                Sr.Close();
                Sr.Dispose();

            });
            Thimport.Start();
            return true;
        }
Esempio n. 3
0
        public static STDT AutoIndex(ShowBase sb, STDT st, out List<STPa> pa, out List<STIV> iv, out List<STIpc> ic, out List<STPR> pr, out List<STPNS> pn, out List<STAnS> an, out List<STDc> dc)
        {
            st.ZTID = sb.ZTID;
            st.SiD = sb.SiD;
            pa = new List<STPa>();
            iv = new List<STIV>();
            ic = new List<STIpc>();
            pr = new List<STPR>();
            pn = new List<STPNS>();
            an = new List<STAnS>();
            dc = new List<STDc>();
            int i = 0;

            if (sb.An != null)
            {
                string[] ans = sb.An.Split(';');


                List<string> gjs = new List<string>();
                List<string> tmpans = new List<string>();
                string zhou = "";
                foreach (var stran in ans)
                {
                    if (stran.Trim() == "") continue;

                    i++;

                    string tmpstran = "";
                    string tmpstrad = "";
                    //如果是Cont of|Based on 是优先权或者公开号 不记录
                    if (regnoap.Match(stran.Trim()).Success) continue;
                    string[] arytmpstran = regspace.Replace(regap.Replace(stran.Trim(), "").Trim(), " ").Trim().Split(' ');
                    if (arytmpstran.Length == 2)
                    {
                        tmpstran = arytmpstran[0].Trim();
                        tmpstrad = arytmpstran[1].Trim();
                    }
                    else
                    {
                        tmpstran = arytmpstran[0].Trim();
                    }

                    if (tmpans.Contains(tmpstran)) continue;
                    tmpans.Add(tmpstran);
                    STAnS tmpan = new STAnS() { ZTID = sb.ZTID, SiD = sb.SiD };
                    tmpan.An = tmpstran;
                    if (tmpstrad.GetYear() != 1800)
                    {
                        tmpan.Ad = tmpstrad;
                        tmpan.AdY = tmpstrad.GetYear().ToString();
                    }
                    tmpan.Sort = (SByte)i;
                    string gj = tmpstran.Left(2).ToUpper();
                    if (gj == "WO")
                    {
                        Match mh = regwogj.Match(tmpstran.Substring(2));
                        if (mh.Success)
                        {
                            gj = mh.Groups["gj"].Value;
                            if (!zhouguo.ContainsKey(gj))
                            {
                                gj = "WO";
                            }
                        }
                    }
                    if (!gjs.Contains(gj))
                    {
                        gjs.Add(gj);
                    }
                    if (zhouguo.ContainsKey(gj))
                    {
                        tmpan.GJ = zhouguo[gj].GJ;
                        if (zhou == "")
                        {
                            zhou = zhouguo[gj].ZHoU;
                        }
                    }
                    else
                    {
                        tmpan.GJ = "未知";
                        zhou = "未知";
                    }
                    an.Add(tmpan);
                }
                if (an.Count > 0)
                {
                    st.An = an[0].An;
                    if (an[0].Ad.FormatDate().GetYear() != 1800)
                    {
                        st.Ad = an[0].Ad.FormatDate();
                        if (!noindex.ContainsKey("申请年"))
                        {
                            st.AdY = Convert.ToInt32(st.Ad.GetYear());
                        }
                    }
                    if (!noindex.ContainsKey("国家"))
                    {
                        st.GJ = an[0].GJ;
                    }
                    if (!noindex.ContainsKey("洲际"))
                    {
                        st.ZHoU = zhou;
                    }
                }
                if (gjs.Count > 3)
                {
                    if (gjs.Contains("US") && gjs.Contains("WO") && gjs.Contains("JP"))
                    {
                        if (!noindex.ContainsKey("是否三局"))
                        {
                            st.IsSanJU = 1;
                        }
                    }
                }
                if (gjs.Count > 5)
                {
                    if (gjs.Contains("US") && gjs.Contains("WO") && gjs.Contains("JP") && gjs.Contains("CN") && gjs.Contains("KR"))
                    {
                        if (!noindex.ContainsKey("是否五局"))
                        {
                            st.IsWuJU = 1;
                        }
                    }
                }
                string tmpgjs = "";
                foreach (var x in gjs)
                {
                    tmpgjs += x + ";";
                }
                st.ApGJS = tmpgjs.Trim(';');
                if (!noindex.ContainsKey("同族数量"))
                {
                    st.FMLSum = an.Count;
                }
                if (!noindex.ContainsKey("国家数量"))
                {
                    st.GJSum = (SByte)gjs.Count;
                }
            }
            if (sb.PN != null)
            {
                //公开  
                string[] pns = regPnsplit.Split(sb.PN);
                i = 0;
                List<string> pngjs = new List<string>();
                foreach (var strpn in pns)
                {
                    i++;
                    if (strpn.Trim() == "") continue;
                    string tmpns = strpn.Trim();
                    STPNS tmppn = new STPNS() { ZTID = sb.ZTID, SiD = sb.SiD };
                    string tmpstrpn = "";
                    string tmpstrpd = "";
                    string[] arytmpns = regspace.Replace(tmpns, " ").Split(' ');
                    switch (arytmpns.Length)
                    {
                        case 3:
                            tmpstrpn = arytmpns[0] + arytmpns[1];
                            tmpstrpd = arytmpns[2];
                            break;
                        case 2:
                            tmpstrpn = arytmpns[0];
                            tmpstrpd = arytmpns[1];
                            break;
                        case 1:
                            tmpstrpn = arytmpns[0];
                            break;
                    }
                    tmppn.PN = tmpstrpn;
                    if (tmpstrpd.FormatDate().GetYear() != 1800)
                    {
                        tmppn.PD = tmpstrpd.FormatDate();
                        tmppn.PDy = tmppn.PD.GetYear().ToString();
                    }
                    tmppn.Sort = (SByte)i;
                    string gj = tmppn.PN.Left(2);
                    if (!pngjs.Contains(gj))
                    {
                        pngjs.Add(gj);
                    }
                    if (zhouguo.ContainsKey(gj))
                    {
                        tmppn.GJ = zhouguo[gj].GJ;
                    }
                    else
                    {
                        tmppn.GJ = "未知";
                    }

                    pn.Add(tmppn);

                }
                if (pn.Count > 0)
                {
                    st.PN = pn[0].PN;
                    if (pn[0].PD.GetYear() != 1800)
                    {
                        st.PD = pn[0].PD;
                        if (!noindex.ContainsKey("公开年"))
                        {
                            st.PDy = pn[0].PD.GetYear();
                        }
                    }

                }
                string tmpgjs = "";
                foreach (var x in pngjs)
                {
                    tmpgjs += x + ";";
                }
                st.PNGJS = tmpgjs.Trim(';');

            }
            if (sb.Ipc != null)
            {

                string[] aryipcs = sb.Ipc.Split(';');
                i = 0;
                foreach (var stripc in aryipcs)
                {
                    if (stripc == "") continue;
                    i++;
                    string strtmpipc = stripc.Trim().FormatIPC();
                    STIpc tmpipc = new STIpc() { ZTID = sb.ZTID, SiD = sb.SiD };
                    tmpipc.Ipc = strtmpipc.Trim();
                    tmpipc.Ipc1 = strtmpipc.Left(1);
                    tmpipc.Ipc3 = strtmpipc.Left(3);
                    tmpipc.Ipc4 = strtmpipc.Left(4);
                    tmpipc.Ipc7 = strtmpipc.Left(7);
                    tmpipc.Sort = (SByte)i;
                    ic.Add(tmpipc);
                }
                if (ic.Count > 0)
                {
                    if (!noindex.ContainsKey("主IPC"))
                    {
                        st.FIpc = ic[0].Ipc;
                    }
                    if (!noindex.ContainsKey("IPC数量"))
                    {
                        st.IpcSum = (SByte)ic.Count;
                    }
                }
            }

            if (sb.Pa != null)
            {
                //申请人
                string[] pas = sb.Pa.Split("(".ToArray());
                int tmpsum = 0;
                foreach (var strpa in pas)
                {
                    if (strpa.Trim() == "") continue;
                    i++;
                    string[] arystrpa = strpa.Split(')');
                    string tmppa = "";
                    string cpy = "";
                    if (arystrpa.Length == 2)
                    {
                        tmppa = arystrpa[1].Trim();
                        cpy = arystrpa[0].Trim();
                    }
                    else
                    {
                        tmppa = arystrpa[1].Trim();
                    }
                    STPa tmpobjpa = new STPa() { ZTID = sb.ZTID, SiD = sb.SiD, Pa = tmppa, CPY = cpy, Sort = (SByte)i };
                    if (!string.IsNullOrEmpty(cpy))
                    {
                        if (tmpobjpa.CPY.IndexOf("-I") >= 0)
                        {

                        }
                        else
                        {
                            tmpsum++;
                        }
                    }
                    pa.Add(tmpobjpa);

                }
                if (pa.Count > 0)
                {
                    if (!noindex.ContainsKey("主申请人"))
                    {
                        st.FPa = pa[0].Pa;
                    }
                    if (!noindex.ContainsKey("是否合作申请"))
                    {
                        st.PaSum = (SByte)pa.Count;
                    }
                }
                if (tmpsum > 1)
                {
                    if (!noindex.ContainsKey("申请年"))
                    {
                        st.IsHeZUO = 1;
                    }
                }
            }
            if (sb.IV != null)
            {
                //发明人
                string[] ins = sb.IV.Split("、;;".ToArray());
                i = 0;
                foreach (var strin in ins)
                {
                    if (strin.Trim() == "") continue;
                    i++;
                    iv.Add(new STIV() { ZTID = sb.ZTID, SiD = sb.SiD, IV = strin.Trim(), Sort = (SByte)i });
                }
                if (iv.Count > 0)
                {
                    if (!noindex.ContainsKey("主发明人"))
                    {
                        st.FIn = iv[0].IV;
                    }
                    if (!noindex.ContainsKey("发明人数量"))
                    {
                        st.InSum = (SByte)iv.Count;
                    }
                }
            }
            if (sb.Dc != null)
            {
                //德温特分类
                List<string> arydc = sb.Dc.Split(" ".ToArray()).ToList<string>();
                List<string> listdc = new List<string>();
                for (int j = 0; j < arydc.Count; j++)
                {
                    if (arydc[j].Length > 3)
                    {
                        for (int tmp = 0; tmp < arydc[j].Length; tmp += 3)
                        {
                            listdc.Add(arydc[j].Substring(tmp, 3));
                        }
                    }
                    else
                    {
                        listdc.Add(arydc[j]);
                    }
                }
                listdc = listdc.Distinct<string>().ToList<string>();
                i = 0;
                foreach (var strdc in listdc)
                {
                    if (strdc.Trim() == "") continue;
                    i++;
                    dc.Add(new STDc() { ZTID = sb.ZTID, SiD = sb.SiD, Dc = strdc, Sort = (SByte)i });
                }
                if (dc.Count > 0)
                {
                    if (!noindex.ContainsKey("DC数量"))
                    {
                        st.DMcSum = (SByte)dc.Count;
                    }
                    if (!noindex.ContainsKey("主DC"))
                    {
                        st.FDMc = dc[0].Dc;
                    }
                }

            }
            if (sb.PR != null)
            {
                //优先权
                string[] aryprs = sb.PR.Split(";".ToArray());
                i = 0;
                foreach (var strpr in aryprs)
                {
                    string tmpstrpr = strpr.Trim();
                    if (tmpstrpr == "") continue;
                    i++;
                    string[] items = tmpstrpr.Split(' ');
                    if (items.Length == 2)
                    {
                        string prno = items[0];
                        string prdt = items[1];
                        string gj = items[0].Substring(0, 2).ToUpper();
                        if (gj == "WO")
                        {
                            Match mh = regwogj.Match(prno.Substring(2));
                            if (mh.Success)
                            {
                                gj = mh.Groups["gj"].Value;
                                if (!zhouguo.ContainsKey(gj))
                                {
                                    gj = "WO";
                                }
                            }
                        }
                        STPR tmpr = new STPR() { ZTID = sb.ZTID, SiD = sb.SiD };
                        tmpr.An = prno;
                        tmpr.Ad = prdt;
                        if (zhouguo.ContainsKey(gj))
                        {
                            tmpr.GJ = zhouguo[gj].GJ;
                        }
                        else
                        {
                            tmpr.GJ = "未知";
                        }
                        pr.Add(tmpr);
                    }
                }
            }
            if (sb.OpD != null)
            {
                if (sb.OpD.FormatDate().GetYear() != 1800)
                {
                    if (!noindex.ContainsKey("最早优先权日"))
                    {
                        st.OpD = sb.OpD.FormatDate();
                    }
                    if (!noindex.ContainsKey("最早优先权年"))
                    {
                        st.OpDy = st.OpD.ToString().GetYear();
                    }
                }
            }
            if (pr.Count > 0)
            {
                if (!noindex.ContainsKey("最早优先权国"))
                {
                    st.OprC = pr[0].GJ;
                }
            }



            return st;

        }
Esempio n. 4
0
        public static STDT AutoIndex(ShowBase sb, STDT st, out List<STPa> pa, out List<STIV> iv, out List<STIpc> ic, out List<STPR> pr, out List<STFML> fml, out List<STCPc> cpc)
        {
            st.ZTID = sb.ZTID;
            st.SiD = sb.SiD;

            pa = new List<STPa>();
            iv = new List<STIV>();
            ic = new List<STIpc>();
            pr = new List<STPR>();
            fml = new List<STFML>();
            cpc = new List<STCPc>();
            int i = 0;
            //申请号
            if (sb.An != null)
            {
                string[] ans = sb.An.Trim().Split(' ');
                switch (ans.Length)
                {
                    case 2:
                        st.An = ans[0];
                        if (ans[1].FormatDate().GetYear() != 1800)
                        {
                            st.Ad = ans[1].FormatDate();
                            if (!noindex.ContainsKey("申请年"))
                            {
                                st.AdY = st.Ad.GetYear();
                            }
                        }
                        break;
                    case 1:
                        st.An = ans[0];
                        st.Ad = sb.Ad.FormatDate();
                        if (!noindex.ContainsKey("申请年"))
                        {
                            st.AdY = st.Ad.GetYear();
                        }
                        break;
                }
            }
            if (sb.PN != null)
            {
                //公开 
                string[] pns = sb.PN.Trim().Split(' ');
                switch (pns.Length)
                {
                    case 3:
                        st.PN = pns[0] + pns[1];
                        if (pns[2].FormatDate().GetYear() != 1800)
                        {
                            st.PD = pns[2].FormatDate();
                            if (!noindex.ContainsKey("公开年"))
                            {
                                st.PDy = st.PD.GetYear();
                            }
                        }
                        break;
                    case 2:
                        st.PN = pns[0];
                        if (pns[1].FormatDate().GetYear() != 1800)
                        {
                            st.PD = pns[1].FormatDate();
                            if (!noindex.ContainsKey("公开年"))
                            {
                                st.PDy = st.PD.GetYear();
                            }
                        }
                        break;
                    case 1:
                        st.PN = pns[0];
                        st.PD = sb.PD.FormatDate();
                        if (!noindex.ContainsKey("公开年"))
                        {
                            st.PDy = st.PD.GetYear();
                        }
                        break;
                }
            }
            string gj = st.An.Left(2).ToUpper();
            gj = st.An.Substring(0, 2).ToUpper();
            if (gj == "WO")
            {
                Match mh = regwogj.Match(st.An.Substring(2));
                if (mh.Success)
                {
                    gj = mh.Groups["gj"].Value;
                    if (!zhouguo.ContainsKey(gj))
                    {
                        gj = "WO";
                    }
                }

            }

            if (zhouguo.ContainsKey(gj))
            {
                if (!noindex.ContainsKey("国家"))
                {
                    st.GJ = zhouguo[gj].GJ;
                }
                if (!noindex.ContainsKey("洲际"))
                {
                    st.ZHoU = zhouguo[gj].ZHoU;
                }
            }
            else
            {
                if (!noindex.ContainsKey("国家"))
                {
                    st.GJ = "未知";
                }
                if (!noindex.ContainsKey("洲际"))
                {
                    st.ZHoU = "未知";
                }
            }
            if (sb.FaMN != null)
            {
                fml.Add(new STFML() { ZTID = sb.ZTID, SiD = sb.SiD, FMLid = Convert.ToInt32(sb.FaMN) });
            }
            if (sb.Ipc != null)
            {
                //IPC           
                string[] aryipcs = sb.Ipc.Split(';');
                i = 0;
                foreach (var stripc in aryipcs)
                {
                    if (stripc == "") continue;
                    i++;
                    string strtmpipc = stripc.Trim().FormatIPC();
                    STIpc tmpipc = new STIpc() { ZTID = sb.ZTID, SiD = sb.SiD };
                    tmpipc.Ipc = strtmpipc.Trim();
                    tmpipc.Ipc1 = strtmpipc.Left(1);
                    tmpipc.Ipc3 = strtmpipc.Left(3);
                    tmpipc.Ipc4 = strtmpipc.Left(4);
                    tmpipc.Ipc7 = strtmpipc.Left(7);
                    tmpipc.Sort = (SByte)i;
                    ic.Add(tmpipc);
                }
                if (ic.Count > 0)
                {
                    if (!noindex.ContainsKey("主IPC"))
                    {
                        st.FIpc = ic[0].Ipc;
                    }
                    if (!noindex.ContainsKey("IPC数量"))
                    {
                        st.IpcSum = (SByte)ic.Count;
                    }
                }
            }
            if (sb.CPc != null)
            {
                //IPC           
                string[] arycpcs = sb.CPc.Split(';');
                i = 0;
                foreach (var strcpc in arycpcs)
                {
                    if (strcpc == "") continue;
                    i++;
                    string strtmpcpc = strcpc.Trim().FormatIPC();
                    STCPc tmpcpc = new STCPc() { ZTID = sb.ZTID, SiD = sb.SiD };
                    tmpcpc.CPc = strtmpcpc.Trim();
                    tmpcpc.CPc1 = strtmpcpc.Left(1);
                    tmpcpc.CPc3 = strtmpcpc.Left(3);
                    tmpcpc.CPc4 = strtmpcpc.Left(4);
                    tmpcpc.CPc7 = strtmpcpc.Left(7);
                    tmpcpc.Sort = (SByte)i;
                    cpc.Add(tmpcpc);
                }
                if (cpc.Count > 0)
                {
                    if (!noindex.ContainsKey("主CPC"))
                    {
                        st.FCPc = cpc[0].CPc;
                    }
                    if (!noindex.ContainsKey("CPC数量"))
                    {
                        st.CPcSum = (SByte)ic.Count;
                    }
                }
            }

            if (sb.Pa != null)
            {
                //申请人
                string[] pas = sb.Pa.Split(";".ToArray());
                foreach (var strpa in pas)
                {
                    if (strpa.Trim() == "") continue;
                    i++;
                    pa.Add(new STPa() { ZTID = sb.ZTID, SiD = sb.SiD, Pa = strpa.Trim(), Sort = (SByte)i });
                }
                if (pa.Count > 0)
                {
                    if (!noindex.ContainsKey("主申请人"))
                    {
                        st.FPa = pa[0].Pa;
                    }
                    if (!noindex.ContainsKey("申请人数量"))
                    {
                        st.PaSum = (SByte)pa.Count;
                    }
                }
                if (pa.Count > 1)
                {
                    if (!noindex.ContainsKey("是否合作申请"))
                    {
                        st.IsHeZUO = 1;
                    }
                }
            }
            if (sb.IV != null)
            {
                //发明人
                string[] ins = sb.IV.Split("、;;".ToArray());
                i = 0;
                foreach (var strin in ins)
                {
                    if (strin.Trim() == "") continue;
                    i++;
                    iv.Add(new STIV() { ZTID = sb.ZTID, SiD = sb.SiD, IV = strin.Trim(), Sort = (SByte)i });
                }
                if (iv.Count > 0)
                {
                    if (!noindex.ContainsKey("主发明人"))
                    {
                        st.FIn = iv[0].IV;
                    }
                    if (!noindex.ContainsKey("发明人数量"))
                    {
                        st.InSum = (SByte)iv.Count;
                    }
                }
            }
            if (!string.IsNullOrEmpty(sb.PR))
            {
                //优先权
                string[] aryprs = sb.PR.Split(";".ToArray());
                i = 0;
                foreach (var strpr in aryprs)
                {
                    string tmpstrpr = strpr.Trim();
                    if (tmpstrpr == "") continue;
                    i++;
                    string[] items = tmpstrpr.Split(' ');
                    if (items.Length == 2)
                    {

                        string prno = items[0];
                        string prdt = items[1];
                        gj = items[0].Substring(0, 2).ToUpper();
                        if (gj == "WO")
                        {
                            Match mh = regwogj.Match(prno.Substring(2));
                            if (mh.Success)
                            {
                                gj = mh.Groups["gj"].Value;
                                if (!zhouguo.ContainsKey(gj))
                                {
                                    gj = "WO";
                                }
                            }
                        }
                        if (zhouguo.ContainsKey(gj))
                        {
                            CfGCountry cfgc = zhouguo[gj];
                            gj = cfgc.GJ;
                        }

                        STPR tmpr = new STPR() { ZTID = sb.ZTID, SiD = sb.SiD };

                        tmpr.An = prno;
                        tmpr.Ad = prdt;
                        tmpr.GJ = gj;
                        pr.Add(tmpr);
                    }
                }
            }
            if (sb.OpD != null)
            {
                if (sb.OpD.FormatDate().GetYear() != 1800)
                {
                    if (!noindex.ContainsKey("最早优先权日"))
                    {
                        st.OpD = sb.OpD.FormatDate();
                    }
                    if (!noindex.ContainsKey("最早优先权年"))
                    {
                        st.OpDy = st.OpD.ToString().GetYear();
                    }
                }
            }
            if (pr.Count > 0)
            {
                if (!noindex.ContainsKey("最早优先权国"))
                {
                    st.OprC = pr[0].GJ;
                }
            }



            return st;

        }
Esempio n. 5
0
        public bool EPODocImport()
        {

            List<ShowBase> sbs = new List<ShowBase>();
            List<STPa> pas = new List<STPa>();
            List<STIV> ivs = new List<STIV>();
            List<STIpc> ipcs = new List<STIpc>();
            List<STPR> prs = new List<STPR>();
            List<STDT> dts = new List<STDT>();
            List<STFML> fmls = new List<STFML>();
            List<STCPc> cpcs = new List<STCPc>();

            int count = dt.Rows.Count;
            SetMaxProcess(this, count);
            Thimport = new Thread(() =>
            {

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ShowBase sb = new ShowBase();
                    sb.ZTID = ZTId;
                    sb.ImportDate = DateTime.Now;
                    STDT st = new STDT() { ZTID = sb.ZTID, ImportDate = sb.ImportDate };

                    #region 处理一条数据
                    foreach (DataColumn col in dt.Columns)
                    {
                        string colname = col.ColumnName;
                        string val = dt.Rows[i][col].ToString();
                        if (!Template.ColumnMapping.ContainsKey(colname)) continue;
                        ColumnMapping mapping = Template.ColumnMapping[colname];
                        string mappingcolname = mapping.SystemColumnShowName;
                        string tbname = mapping.Tablename;
                        int? intval = null;
                        sbyte? sbval = null;
                        sbyte ssb = 0;
                        if (SByte.TryParse(val.Replace("是", "1"), out ssb))
                        {
                            sbval = ssb;
                        }

                        int iit = 0;
                        if (int.TryParse(val, out iit))
                        {
                            intval = iit;
                        }

                        #region STDT
                        if (tbname.ToUpper() == "ST_DT")
                        {
                            switch (mappingcolname)
                            {
                                case "申请年":
                                    st.AdY = intval;
                                    break;
                                case "公开年":
                                    st.PDy = intval;
                                    break;
                                case "最早优先权年":
                                    st.OpDy = intval;
                                    break;
                                case "主申请人":
                                    st.FPa = val;
                                    break;
                                case "主发明人":
                                    st.FIn = val;
                                    break;
                                case "主IPC":
                                    st.FIpc = val;
                                    break;
                                case "主CPC":
                                    st.FCPc = val;
                                    break;
                                case "是否合作申请":
                                    st.IsHeZUO = sbval;
                                    break;
                                case "洲际":
                                    st.ZHoU = val;
                                    break;
                                case "国家":
                                    st.GJ = val;
                                    break;
                                case "公开年差":
                                    st.PDyDef = intval;
                                    break;
                                case "申请人数量":
                                    st.PaSum = sbval;
                                    break;
                                case "发明人数量":
                                    st.InSum = sbval;
                                    break;
                                case "IPC数量":
                                    st.IpcSum = sbval;
                                    break;
                                case "CPC数量":
                                    st.CPcSum = sbval;
                                    break;
                                case "引证数量":
                                    st.YZSum = sbval;
                                    break;
                                case "被引证数量":
                                    st.ByZSum = sbval;
                                    break;
                                default:
                                    break;

                            }
                        }
                        #endregion
                        #region SHOWBASE
                        switch (mappingcolname)
                        {
                            case "AN":
                            case "入藏号":
                                sb.SiD = val;
                                break;
                            case "申请号":
                                sb.An = val;
                                break;
                            case "申请日":
                                sb.Ad = val;
                                break;
                            case "标题":
                                sb.Title = val;
                                break;
                            case "IPC":
                                if (sb.Ipc == null)
                                {
                                    sb.Ipc = val;
                                }
                                else
                                {
                                    sb.Ipc += ";" + val;
                                }
                                break;
                            case "CPC":
                                if (sb.CPc == null)
                                {
                                    sb.CPc = val;
                                }
                                else
                                {
                                    sb.CPc += ";" + val;
                                }

                                break;
                            case "申请人":
                                sb.Pa = val;
                                break;
                            case "申请人代码":
                                sb.CPY = val;
                                break;
                            case "最早优先权日":
                                sb.OpD = val;
                                break;
                            case "摘要":
                                sb.ABs = val;
                                break;
                            case "发明人":
                                sb.IV = val;
                                break;
                            case "公开号":
                                sb.PN = val;
                                break;
                            case "优先权":
                                sb.PR = val;
                                break;
                            case "公开日":
                                sb.PD = val;
                                break;
                            case "DS":
                                sb.DS = val;
                                break;
                            case "FAMN":
                                sb.FaMN = val;
                                break;
                            case "CT":
                                sb.Ct = val;
                                break;
                            case "CTNP":
                                sb.CtNP = val;
                                break;
                            case "FI":
                                sb.FI = val;
                                break;
                            case "FT":
                                sb.FT = val;
                                break;
                            case "RF":
                                sb.RF = val;
                                break;
                            case "RFAP":
                                sb.RFaP = val;
                                break;
                            case "RFNP":
                                sb.RFNP = val;
                                break;
                            case "EC":
                                sb.Ec = val;
                                break;

                        }
                        #endregion
                    }
                    #endregion
                    #region 标引
                    if (CheckExist(sb.SiD))
                    {
                        if (Skip)
                        {

                            Skip_sum++;
                            continue;
                        }
                        else
                        {
                            DelExist(sb.ZTID.ToString(), sb.SiD.ToString());
                            Overwrite_sum++;
                        }

                    }
                    else
                    {
                        Sids.Add(sb.SiD, true);
                    }
                    sbs.Add(sb);

                    List<STPa> pa = new List<STPa>();
                    List<STIV> iv = new List<STIV>();
                    List<STIpc> ipc = new List<STIpc>();
                    List<STPR> pr = new List<STPR>();
                    List<STFML> fml = new List<STFML>();
                    List<STCPc> cpc = new List<STCPc>();
                    st = XLSEPODOCIndex.AutoIndex(sb, st, out pa, out iv, out ipc, out pr, out fml, out cpc);
                    dts.Add(st);
                    pas.AddRange(pa);
                    ivs.AddRange(iv);
                    ipcs.AddRange(ipc);
                    prs.AddRange(pr);
                    fmls.AddRange(fml);
                    cpcs.AddRange(cpc);
                    #endregion

                    if (i % 100 == 0)
                    {

                        EPODOCBulkInsert(sbs, pas, ivs, ipcs, prs, fml, dts, cpcs);
                        sbs.Clear();
                        pas.Clear();
                        ivs.Clear();
                        ipcs.Clear();
                        prs.Clear();
                        dts.Clear();
                        fmls.Clear();
                        cpcs.Clear();
                        ShowProcess(this, i, Skip_sum, Overwrite_sum, "导入");
                    }

                }

                if (sbs.Count > 0)
                {
                    EPODOCBulkInsert(sbs, pas, ivs, ipcs, prs, fmls, dts, cpcs);
                    sbs.Clear();
                    pas.Clear();
                    ivs.Clear();
                    ipcs.Clear();
                    prs.Clear();
                    dts.Clear();
                    fmls.Clear();
                    cpcs.Clear();
                }

                ShowProcess(this, count, Skip_sum, Overwrite_sum, "导入完毕");


            });
            Thimport.Start();
            return true;
        }
Esempio n. 6
0
        public bool CNImport()
        {
            XLSCPRSIndex.initmp(Template);
            List<DAL.ShowBase> sbs = new List<DAL.ShowBase>();
            List<DAL.STPa> pas = new List<DAL.STPa>();
            List<DAL.STIV> ivs = new List<DAL.STIV>();
            List<DAL.STIpc> ipcs = new List<DAL.STIpc>();
            List<DAL.STPR> prs = new List<DAL.STPR>();
            List<DAL.STDT> dts = new List<DAL.STDT>();
            List<DAL.STQY> qys = new List<DAL.STQY>();

            int count = dt.Rows.Count;
            SetMaxProcess(this, count);
            Thimport = new Thread(() =>
            {
                #region 处理一个DataTable
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ShowBase sb = new ShowBase();
                    sb.ZTID = ZTId;
                    sb.ImportDate = DateTime.Now;
                    STDT st = new STDT() { ZTID = sb.ZTID, ImportDate = sb.ImportDate };
                    #region 处理一条数据
                    foreach (DataColumn col in dt.Columns)
                    {

                        string colname = col.ColumnName;
                        string val = dt.Rows[i][col].ToString();
                        if (!Template.ColumnMapping.ContainsKey(colname)) continue;
                        ColumnMapping mapping = Template.ColumnMapping[colname];
                        string mappingcolname = mapping.SystemColumnShowName;
                        string tbname = mapping.Tablename;
                        int? intval = null;
                        sbyte? sbval = null;
                        sbyte ssb = 0;
                        if (SByte.TryParse(val.Replace("是", "1"), out ssb))
                        {
                            sbval = ssb;
                        }

                        int iit = 0;
                        if (int.TryParse(val, out iit))
                        {
                            intval = iit;
                        }

                        #region STDT
                        if (tbname.ToUpper() == "ST_DT")
                        {

                            switch (mappingcolname)
                            {
                                case "申请年":
                                    st.AdY = intval;
                                    break;
                                case "公开年":
                                    st.PDy = intval;
                                    break;
                                case "授权年":
                                    st.GdY = intval;
                                    break;
                                case "主申请人":
                                    st.FPa = val;
                                    break;
                                case "主发明人":
                                    st.FIn = val;
                                    break;
                                case "主IPC":
                                    st.FIpc = val;
                                    break;
                                case "权利要求1字数":
                                    st.ClSCharSum = intval;
                                    break;
                                case "专利类型":
                                    st.Type = val;
                                    break;
                                case "专利类型(含PCT)":
                                    st.Type1 = val;
                                    break;
                                case "主申请人类型":
                                    st.FPaType = val;
                                    break;
                                case "是否合作申请":
                                    st.IsHeZUO = sbval;
                                    break;
                                case "洲际":
                                    st.ZHoU = val;
                                    break;
                                case "是否国外来华":
                                    st.IsGuOwAi = sbval;
                                    break;
                                case "国家":
                                    st.GJ = val;
                                    break;
                                case "省":
                                    st.ShEng = val;
                                    break;
                                case "省(计划单列市)":
                                    st.ShEng1 = val;
                                    break;
                                case "市":
                                    st.ShI = val;
                                    break;
                                case "区县":
                                    st.QUXian = val;
                                    break;
                                case "经济区域":
                                    st.QUYU = val;
                                    break;
                                case "最终法律状态":
                                    st.LG = val;
                                    break;
                                case "法律截止年":
                                    st.LGYear = intval; ;
                                    break;
                                case "公开年差":
                                    st.PDyDef = intval; ;
                                    break;
                                case "授权年差":
                                    st.GdYDef = intval; ;
                                    break;
                                case "专利年龄":
                                    st.Age = sbval;
                                    break;
                                case "是否公知技术":
                                    st.IsGongZHi = sbval;
                                    break;
                                case "申请人数量":
                                    st.PaSum = sbval;
                                    break;
                                case "发明人数量":
                                    st.InSum = sbval;
                                    break;
                                case "IPC数量":
                                    st.IpcSum = sbval;
                                    break;
                                default:
                                    break;

                            }
                        }
                        #endregion
                        #region showbase
                        switch (mappingcolname)
                        {
                            case "申请号":
                                sb.An = val;
                                sb.SiD = val;
                                break;
                            case "发明名称":
                            case "标题":
                                sb.Title = val;
                                break;
                            case "摘要":
                                sb.ABs = val;
                                break;
                            case "权利要求":
                                sb.ClM = val;
                                break;
                            case "国际分类号":
                                sb.Ipc = val;
                                break;
                            case "范畴分类号":
                                sb.FCfL = val;
                                break;
                            case "省":
                            case "国家/省市":
                                sb.ShEng = val;
                                break;
                            case "申请人":
                                sb.Pa = val;
                                break;
                            case "联系地址":
                                sb.AddR = val;
                                break;
                            case "邮编":
                                sb.Zip = val;
                                break;
                            case "代理机构":
                                sb.DLJG = val;
                                break;
                            case "代理人":
                                sb.DLr = val;
                                break;
                            case "代理机构地址":
                                sb.DLJGAddR = val;
                                break;
                            case "发明人":
                                sb.IV = val;
                                break;
                            case "申请日":
                                sb.Ad = val;
                                break;
                            case "公开号":
                                sb.PN = val;
                                break;
                            case "公开日":
                                sb.PD = val;
                                break;
                            case "公告日":
                            case "授权日":
                                if (string.IsNullOrEmpty(sb.Gd))
                                {
                                    sb.Gd = val;
                                }
                                break;
                            case "授权号":
                            case "公告号":
                                if (string.IsNullOrEmpty(sb.GN))
                                {
                                    sb.GN = val;
                                }
                                break;
                            case "优先权":
                                sb.PR = val;
                                break;
                            case "审批历史":
                                sb.LG = val;
                                break;
                            case "附图数":
                                sb.PiCSum = val;
                                break;
                            case "页数":
                                sb.DesPageSum = val;
                                break;
                            case "权利要求项数":
                                sb.ClMSum = val;
                                break;
                        }
                        #endregion

                    }
                    #endregion
                    if (CheckExist(sb.SiD))
                    {
                        if (Skip)
                        {

                            Skip_sum++;
                            continue;
                        }
                        else
                        {
                            DelExist(sb.ZTID.ToString(), sb.SiD.ToString());
                            Overwrite_sum++;
                        }

                    }
                    else
                    {
                        Sids.Add(sb.SiD, true);
                    }
                    sbs.Add(sb);

                    List<STPa> pa = new List<STPa>();
                    List<STIV> iv = new List<STIV>();
                    List<STIpc> ipc = new List<STIpc>();
                    List<STPR> pr = new List<STPR>();
                    List<STQY> qy = new List<STQY>();

                    st = XLSCPRSIndex.AutoIndex(sb, st, out pa, out iv, out ipc, out pr, out qy);
                    dts.Add(st);
                    pas.AddRange(pa);
                    ivs.AddRange(iv);
                    ipcs.AddRange(ipc);
                    prs.AddRange(pr);
                    qys.AddRange(qy);

                    if (i % 100 == 0)
                    {
                        //todo:基本信息入库
                        CNBulkInsert(sbs, pas, ivs, ipcs, prs, dts, qys);
                        sbs.Clear();
                        pas.Clear();
                        ivs.Clear();
                        ipcs.Clear();
                        prs.Clear();
                        dts.Clear();
                        qys.Clear();
                        ShowProcess(this, i, Skip_sum, Overwrite_sum, "导入");
                    }

                }
                #endregion

                if (sbs.Count > 0)
                {
                    CNBulkInsert(sbs, pas, ivs, ipcs, prs, dts, qys);
                    sbs.Clear();
                    pas.Clear();
                    ivs.Clear();
                    ipcs.Clear();
                    prs.Clear();
                    dts.Clear();
                    qys.Clear();
                }
                log.Info(string.Format("导入完毕: 专题库:{0},ID:{1},类型:,{2}总量:{3},跳过:{4}", ztName, ZTId, Type, count, Skip_sum));
                ShowProcess(this, count, Skip_sum, Overwrite_sum, "导入完毕");

            });
            Thimport.Start();
            return true;
        }
Esempio n. 7
0
        public bool WPIImport()
        {
            XLSWPIIndex.initmp(Template);
            List<ShowBase> sbs = new List<ShowBase>();
            List<STPa> pas = new List<STPa>();
            List<STIV> ivs = new List<STIV>();
            List<STIpc> ipcs = new List<STIpc>();
            List<STPR> prs = new List<STPR>();
            List<STDT> dts = new List<STDT>();
            List<STDc> dcs = new List<STDc>();
            List<STPNS> pns = new List<STPNS>();
            List<STAnS> ans = new List<STAnS>();

            int count = dt.Rows.Count;
            SetMaxProcess(this, count);
            Thimport = new Thread(() =>
            {
                //
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ShowBase sb = new ShowBase();
                    sb.ZTID = ZTId;
                    sb.ImportDate = DateTime.Now;
                    STDT st = new STDT() { ZTID = sb.ZTID, SiD = sb.SiD, ImportDate = sb.ImportDate };

                    #region 一行记录
                    foreach (DataColumn col in dt.Columns)
                    {

                        string colname = col.ColumnName;
                        string val = dt.Rows[i][col].ToString();
                        if (!Template.ColumnMapping.ContainsKey(colname)) continue;
                        ColumnMapping mapping = Template.ColumnMapping[colname];
                        string mappingcolname = mapping.SystemColumnShowName;
                        string tbname = mapping.Tablename;

                        int? intval = null;
                        sbyte? sbval = null;

                        int iit = 0;
                        sbyte ssb = 0;
                        if (sbyte.TryParse(val, out ssb))
                        {
                            sbval = ssb;
                        }
                        if (int.TryParse(val, out iit))
                        {
                            intval = iit;
                        }
                        #region STDT

                        if (tbname.ToUpper() == "ST_DT")
                        {
                            switch (mappingcolname)
                            {
                                case "申请年":
                                    st.AdY = intval;
                                    break;
                                case "公开年":
                                    st.AdY = intval;
                                    break;
                                case "最早优先权年":
                                    st.OpDy = intval;
                                    break;
                                case "主申请人":
                                    st.FPa = val;
                                    break;
                                case "主发明人":
                                    st.FIn = val;
                                    break;
                                case "主IPC":
                                    st.FIpc = val;
                                    break;
                                case "主CPC":
                                    st.FCPc = val;
                                    break;
                                case "主DC":
                                    st.FDMc = val;
                                    break;
                                case "是否合作申请":
                                    st.IsHeZUO = sbval;
                                    break;
                                case "洲际":
                                    st.ZHoU = val;
                                    break;
                                case "是否三局":
                                    st.IsSanJU = sbval;
                                    break;
                                case "是否五局":
                                    st.IsWuJU = sbval;
                                    break;
                                case "国家":
                                    st.GJ = val;
                                    break;
                                case "公开年差":
                                    st.PDyDef = intval;
                                    break;
                                case "申请人数量":
                                    st.PaSum = sbval;
                                    break;
                                case "发明人数量":
                                    st.InSum = sbval;
                                    break;
                                case "IPC数量":
                                    st.IpcSum = sbval;
                                    break;
                                case "CPC数量":
                                    st.CPcSum = sbval;
                                    break;
                                case "DC数量":
                                    st.DMcSum = sbval;
                                    break;
                                case "同族数量":
                                    st.FMLSum = sbval;
                                    break;
                                case "国家数量":
                                    st.GJSum = sbval;
                                    break;
                                case "引证数量":
                                    st.YZSum = sbval;
                                    break;
                                case "被引证数量":
                                    st.ByZSum = sbval;
                                    break;
                                default:
                                    break;
                            }
                        }
                        #endregion
                        #region SHOWBASE
                        switch (mappingcolname)
                        {
                            case "AN":
                            case "入藏号":
                                sb.SiD = val;
                                break;
                            case "申请号(原始)":
                            case "申请号":
                                sb.An = val;
                                break;
                            case "标题":
                            case "专利名称":
                                sb.Title = val;
                                break;
                            case "IPC":
                                if (sb.Ipc == null)
                                {
                                    sb.Ipc = val;
                                }
                                else
                                {
                                    sb.Ipc += ";" + val;
                                }

                                break;
                            case "申请人":
                                sb.Pa = val;
                                break;
                            case "申请人代码":
                                sb.CPY = val;
                                break;
                            case "最早优先权日":
                                sb.OpD = val;
                                break;
                            case "摘要":
                                sb.ABs = val;
                                break;
                            case "发明人":
                                sb.IV = val;
                                break;
                            case "公开号(原始)":
                            case "公开号":
                                sb.PN = val;
                                break;
                            case "优先权":
                                sb.PR = val;
                                break;
                            case "公开日":
                                sb.PD = val;
                                break;
                            case "DC":
                                sb.Dc = val;
                                break;
                            case "DMC":
                                sb.DMc = val;
                                break;
                            case "DS":
                                break;
                            case "YZ":
                                break;
                            case "BY":
                                break;
                            case "CPC":
                                sb.CPc = val;
                                break;
                            default:
                                break;
                        }
                        #endregion
                    }
                    #endregion
                    if (CheckExist(sb.SiD))
                    {
                        if (Skip)
                        {

                            Skip_sum++;
                            continue;
                        }
                        else
                        {
                            DelExist(sb.ZTID.ToString(), sb.SiD.ToString());
                            Overwrite_sum++;
                        }

                    }
                    else
                    {
                        Sids.Add(sb.SiD, true);
                    }
                    sbs.Add(sb);

                    List<STPa> pa = new List<STPa>();
                    List<STIV> iv = new List<STIV>();
                    List<STIpc> ipc = new List<STIpc>();
                    List<STPR> pr = new List<STPR>();
                    List<STAnS> an = new List<STAnS>();
                    List<STPNS> pn = new List<STPNS>();
                    List<STDc> dc = new List<STDc>();
                    st = XLSWPIIndex.AutoIndex(sb, st, out pa, out iv, out ipc, out pr, out pn, out an, out dc);
                    dts.Add(st);
                    pas.AddRange(pa);
                    ivs.AddRange(iv);
                    ipcs.AddRange(ipc);
                    prs.AddRange(pr);
                    pns.AddRange(pn);
                    ans.AddRange(an);
                    dcs.AddRange(dc);
                    if (i % 100 == 0)
                    {
                        WPIBulkInsert(sbs, pas, ivs, ipcs, prs, dts, pns, ans, dcs);
                        sbs.Clear();
                        pas.Clear();
                        ivs.Clear();
                        ipcs.Clear();
                        prs.Clear();
                        dts.Clear();
                        pns.Clear();
                        ans.Clear();
                        dcs.Clear();
                        ShowProcess(this, i, Skip_sum, Overwrite_sum, "导入");

                    }

                }
                if (sbs.Count > 0)
                {
                    WPIBulkInsert(sbs, pas, ivs, ipcs, prs, dts, pns, ans, dcs);
                    sbs.Clear();
                    pas.Clear();
                    ivs.Clear();
                    ipcs.Clear();
                    prs.Clear();
                    dts.Clear();
                    pns.Clear();
                    ans.Clear();
                    dcs.Clear();
                }

                ShowProcess(this, count, Skip_sum, Overwrite_sum, "导入完毕");
            });
            Thimport.Start();
            return true;
        }
Esempio n. 8
0
        public override bool Import()
        {
            string s = Sr.ReadToEnd();

            TemplateHelper tmph = new TemplateHelper("");
            string[] arys = regRowSplit.Split(s);
            List<DAL.ShowBase> sbs = new List<DAL.ShowBase>();
            List<DAL.STPa> pas = new List<DAL.STPa>();
            List<DAL.STIV> ivs = new List<DAL.STIV>();
            List<DAL.STIpc> ipcs = new List<DAL.STIpc>();
            List<DAL.STPR> prs = new List<DAL.STPR>();
            List<DAL.STDT> dts = new List<DAL.STDT>();
            List<DAL.STQY> qys = new List<DAL.STQY>();

            int count = arys.Length - 1;
            SetMaxProcess(this, count);
            Thimport = new Thread(() =>
            {
                //第一行为空
                for (int i = 1; i <= arys.Length - 1; i++)
                {
                    string tmp = regspace.Replace(regcharRNT.Replace(arys[i].Trim(), ""), "");
                    foreach (string x in otherstring)
                    {
                        tmp = tmp.Replace(x, "");
                    }
                    tmp = RemoveZaoZi(tmp);
                    MatchCollection mhs = rowRege.Matches(tmp);
                    ShowBase sb = new ShowBase();
                    sb.ZTID = ZTId;
                    sb.ImportDate = DateTime.Now;

                    foreach (Match m in mhs)
                    {
                        string colname = m.Groups["colname"].Value;
                        string val = m.Groups["colval"].Value.Trim().Trim('\t');
                        string mappingcolname = tmph.getMappingColumnName(colname);
                        switch (mappingcolname)
                        {
                            case "申请号":
                                sb.An = val;
                                sb.SiD = val;
                                break;
                            case "发明名称":
                                sb.Title = val;
                                break;
                            case "摘要":
                                sb.ABs = val;
                                break;
                            case "权利要求":
                                sb.ClM = val;
                                break;
                            case "国际分类号":
                                sb.Ipc = val;
                                break;
                            case "范畴分类号":
                                sb.FCfL = val;
                                break;
                            case "国家/省市":
                                sb.ShEng = val;
                                break;
                            case "申请人":
                                sb.Pa = val;
                                break;
                            case "联系地址":
                                sb.AddR = val;
                                break;
                            case "邮编":
                                sb.Zip = val;
                                break;
                            case "代理机构":
                                sb.DLJG = val;
                                break;
                            case "代理人":
                                sb.DLr = val;
                                break;
                            case "代理机构地址":
                                sb.DLJGAddR = val;
                                break;
                            case "发明人":
                                sb.IV = val;
                                break;
                            case "申请日":
                                sb.Ad = val;
                                break;
                            case "公开号":
                                sb.PN = val;
                                break;
                            case "公开日":
                                sb.PD = val;
                                break;
                            //case "授权公告日":
                            //    sb.Gd = val;
                            //    break;
                            case "公告日":
                                sb.Gd = val;
                                break;
                            //case "授权日":
                            //    sb.Gd = val;
                            //    break;
                            case "公告号":
                                sb.GN = val;
                                break;
                            case "优先权":
                                sb.PR = val;
                                break;
                            case "审批历史":
                                sb.LG = val;
                                break;
                            case "附图数":
                                sb.PiCSum = val;
                                break;
                            case "页数":
                                sb.DesPageSum = val;
                                break;
                            case "权利要求项数":
                                sb.ClMSum = val;
                                break;
                        }
                    }
                    if (CheckExist(sb.SiD))
                    {
                        if (Skip)
                        {

                            Skip_sum++;
                            continue;
                        }
                        else
                        {
                            DelExist(sb.ZTID.ToString(), sb.SiD.ToString());
                            Overwrite_sum++;
                        }

                    }
                    else
                    {
                        Sids.Add(sb.SiD, true);
                    }
                    sbs.Add(sb);

                    List<STPa> pa = new List<STPa>();
                    List<STIV> iv = new List<STIV>();
                    List<STIpc> ipc = new List<STIpc>();
                    List<STPR> pr = new List<STPR>();
                    List<STQY> qy = new List<STQY>();
                    dts.Add(CPRSIndex.AutoIndex(sb, out pa, out iv, out ipc, out pr, out qy));
                    pas.AddRange(pa);
                    ivs.AddRange(iv);
                    ipcs.AddRange(ipc);
                    prs.AddRange(pr);
                    qys.AddRange(qy);

                    if (i % 100 == 0)
                    {

                        //Thread.Sleep(1000);
                        //todo:标引
                        //todo:标引信息入库

                        //todo:基本信息入库
                        BulkInsert(sbs, pas, ivs, ipcs, prs, dts, qys);
                        sbs.Clear();
                        pas.Clear();
                        ivs.Clear();
                        ipcs.Clear();
                        prs.Clear();
                        dts.Clear();
                        qys.Clear();
                        ShowProcess(this, i, Skip_sum, Overwrite_sum, "导入");
                    }

                }
                if (sbs.Count > 0)
                {
                    BulkInsert(sbs, pas, ivs, ipcs, prs, dts, qys);
                    sbs.Clear();
                    pas.Clear();
                    ivs.Clear();
                    ipcs.Clear();
                    prs.Clear();
                    dts.Clear();
                    qys.Clear();
                }

                log.Info(string.Format("导入完毕: 专题库:{0},ID:{1},类型:,{2}总量:{3},跳过:{4}", ztName, ZTId, Type, count, Skip_sum));
                ShowProcess(this, count, Skip_sum, Overwrite_sum, "导入完毕");

                Sr.Close();
                Sr.Dispose();


            });
            Thimport.Start();
            return true;
        }