Beispiel #1
0
        public void Import(string filaname)
        {
            this.m_FileName = filaname;
            if (this.m_IsClear)
            {
                //this.ClerSub();
            }
            this.GetTable();
            bool            flag  = false;
            _Method_Sub     sub   = this.GetSub();
            _Entity_SubInfo info  = new _Entity_SubInfo();
            int             count = 1;

            foreach (DataRow item in this.table.Rows)
            {
                if (ToolKit.ParseInt(item[0]) > 0)
                {
                    flag = true;
                }
                if (flag)
                {
                    if (item[0] == DBNull.Value && item[1] == DBNull.Value && item[2] == DBNull.Value && item[3] == DBNull.Value)
                    {
                        return;
                    }
                    int     XH   = ToolKit.ParseInt(item[0]);
                    string  XMBM = item[1].ToString();
                    string  XMMC = item[2].ToString();
                    string  DW   = item[3].ToString();
                    decimal GCL  = ToolKit.ParseDecimal(item[4]);
                    if (XH > 0)//清单
                    {
                        if (XMBM.Length > 9)
                        {
                            string    xmbm = XMBM.Substring(0, 9);
                            DataRow[] rows = this.Unit.Property.Libraries.ListGallery.LibraryDataSet.Tables["清单表"].Select(string.Format("QINGDBH='{0}'", xmbm));
                            if (rows.Length > 0)
                            {
                                info = new _Entity_SubInfo();
                                _Methods.SetFixedInfo(info, rows[0], this.Unit.Property.Libraries.ListGallery.FullName, this.Unit.StructSource.ModelSubSegments, "ZYLB");
                                info.XH   = XH;
                                info.XMBM = XMBM;
                                info.XMMC = XMMC;
                                info.DW   = DW;
                                info.GCL  = GCL;
                                int m = GLODSOFT.QDJJ.BUSINESS._Methods.GetCountByBH(xmbm, this.Unit.StructSource.ModelSubSegments);
                                info.BEIZHU = GLODSOFT.QDJJ.BUSINESS._Methods.GetQDbeizhu(xmbm, m, "EXCL");
                                sub.Create(-1, info);
                            }
                            else//补充清单
                            {
                                info         = new _Entity_SubInfo();
                                info.XH      = XH;
                                info.XMBM    = XMBM;
                                info.OLDXMBM = xmbm;
                                info.XMMC    = XMMC;
                                info.DW      = DW;
                                info.LB      = "清单";
                                info.ZJWZ    = "999999";
                                info.GCL     = GCL;
                                int m = GLODSOFT.QDJJ.BUSINESS._Methods.GetCountByBH(xmbm, this.Unit.StructSource.ModelSubSegments);
                                info.BEIZHU = GLODSOFT.QDJJ.BUSINESS._Methods.GetQDbeizhu(xmbm, m, "EXCL");
                                sub.Create(-1, info);
                            }
                        }
                        else//补充清单
                        {
                            info         = new _Entity_SubInfo();
                            info.XH      = XH;
                            info.XMBM    = XMBM;
                            info.OLDXMBM = XMBM;
                            info.XMMC    = XMMC;
                            info.DW      = DW;
                            info.LB      = "清单";
                            info.ZJWZ    = "999999";
                            info.GCL     = GCL;
                            int m = GLODSOFT.QDJJ.BUSINESS._Methods.GetCountByBH(XMBM, this.Unit.StructSource.ModelSubSegments);
                            info.BEIZHU = GLODSOFT.QDJJ.BUSINESS._Methods.GetQDbeizhu(XMBM, m, "EXCL");
                            sub.Create(-1, info);
                        }
                    }
                    else//子目的处理
                    {
                        string xmbm = XMBM.Replace("换", "");
                        xmbm = xmbm.Split(' ')[0];
                        DataRow[]      rows = this.Unit.Property.Libraries.FixedLibrary.LibraryDataSet.Tables["定额表"].Select(string.Format("DINGEH='{0}'", xmbm));
                        _Methods_Fixed fix  = new _Methods_Fixed(this.CurrentBusiness, this.Unit, info);
                        if (rows.Length > 0)
                        {
                            _Entity_SubInfo sinfo = new _Entity_SubInfo();
                            _Methods.SetSubheadingsInfo(sinfo, rows[0], this.Unit.Property.Libraries.FixedLibrary.FullName);
                            // _ObjectSource.GetObject(sinfo, rows[0]);
                            sinfo.XH      = XH;
                            sinfo.XMBM    = XMBM;
                            sinfo.XMMC    = XMMC;
                            sinfo.DW      = DW;
                            sinfo.LB      = "子目";
                            sinfo.GCL     = GCL;
                            sinfo.OLDXMBM = xmbm;
                            sinfo.BEIZHU  = GLODSOFT.QDJJ.BUSINESS._Methods.GetDEbeizhu("EXCL", count, info.OLDXMBM);
                            fix.Create(false, -1, sinfo);
                            count++;
                        }
                        else
                        {
                            _Entity_SubInfo sinfo = new _Entity_SubInfo();
                            sinfo.XH      = XH;
                            sinfo.XMBM    = XMBM;
                            sinfo.OLDXMBM = xmbm;
                            sinfo.XMMC    = XMMC;
                            sinfo.DW      = DW;
                            sinfo.GCL     = GCL;
                            sinfo.LB      = "子目";
                            sinfo.BEIZHU  = GLODSOFT.QDJJ.BUSINESS._Methods.GetDEbeizhu("EXCL", count, info.OLDXMBM);
                            fix.Create(false, -1, sinfo);
                            count++;
                        }
                    }
                }
            }
        }