예제 #1
0
파일: Person.cs 프로젝트: daqi5258/WorkFlow
        public List <DetailArrange> das; //子项目信息

        /*
         * public List<DetailArrange> addDA(DetailArrange da )
         * {
         *  if (!das.Contains(da))
         *  {
         *      das.Add(da);
         *  }
         *  return das;
         * }
         */
        public List <DetailArrange> deteleDA(DetailArrange da)
        {
            if (das.Contains(da))
            {
                das.Remove(da);
            }
            return(das);
        }
예제 #2
0
        public PersonArrange GetPersonDetail(String filepath)
        {
            PersonArrange pa = new PersonArrange();

            //string[] files1 = Directory.GetFiles(filepath + @"\项师-工作目录\1 ISO\ISO表格\人员安排表", "*人员安排*.xls*", SearchOption.AllDirectories);
            string[] files1 = Directory.GetFiles(filepath, "*人员安排*.xls*", SearchOption.AllDirectories);
            try
            {
                Console.WriteLine(files1[0]);
                workbook = WorkbookFactory.Create(files1[0]);
            }
            catch (Exception e)
            {
                Console.WriteLine("\n" + e.ToString());
            }
            if (workbook is null)
            {
                Console.WriteLine("workbook is null");
                return(pa);
            }
            ISheet sheet = workbook.GetSheetAt(0);

            pa.project_name      = sheet.GetRow(0).GetCell(3) == null ? "" : sheet.GetRow(0).GetCell(3).ToString();
            pa.construct_company = sheet.GetRow(1).GetCell(3) == null ? "" : sheet.GetRow(1).GetCell(3).ToString();
            pa.project_id        = sheet.GetRow(2).GetCell(3) == null ? "" : sheet.GetRow(2).GetCell(3).ToString();
            pa.person_project    = sheet.GetRow(3).GetCell(3) == null ? "" : sheet.GetRow(3).GetCell(3).ToString();

            pa.person_1 = sheet.GetRow(6).GetCell(4) == null?"": sheet.GetRow(6).GetCell(4).ToString();
            pa.person_2 = sheet.GetRow(6).GetCell(7) == null ? "" : sheet.GetRow(6).GetCell(7).ToString();
            pa.person_3 = sheet.GetRow(6).GetCell(10) == null ? "" : sheet.GetRow(6).GetCell(10).ToString();
            pa.person_4 = sheet.GetRow(6).GetCell(13) == null ? "" : sheet.GetRow(6).GetCell(13).ToString();
            pa.person_5 = sheet.GetRow(6).GetCell(16) == null ? "" : sheet.GetRow(6).GetCell(16).ToString();

            List <DetailArrange> lda = new List <DetailArrange>();

            for (int i = 8; i < sheet.LastRowNum; i++)
            {
                if (sheet.GetRow(i) != null)
                {
                    //Console.WriteLine("i=" + i + ",v=" + sheet.GetRow(i).GetCell(0));
                    DetailArrange dat = new DetailArrange
                    {
                        flag            = Value(sheet.GetRow(i).GetCell(0)),
                        project_detail  = Value(sheet.GetRow(i).GetCell(1)),
                        project_type    = Value(sheet.GetRow(i).GetCell(2)),
                        detail_no       = Value(sheet.GetRow(i).GetCell(3)),
                        person_design_1 = Value(sheet.GetRow(i).GetCell(4)),
                        person_verify_1 = Value(sheet.GetRow(i).GetCell(5)),
                        person_check_1  = Value(sheet.GetRow(i).GetCell(6)),
                        person_design_2 = Value(sheet.GetRow(i).GetCell(7)),
                        person_verify_2 = Value(sheet.GetRow(i).GetCell(8)),
                        person_check_2  = Value(sheet.GetRow(i).GetCell(9)),
                        person_design_3 = Value(sheet.GetRow(i).GetCell(10)),
                        person_verify_3 = Value(sheet.GetRow(i).GetCell(11)),
                        person_check_3  = Value(sheet.GetRow(i).GetCell(12)),
                        person_design_4 = Value(sheet.GetRow(i).GetCell(13)),
                        person_verify_4 = Value(sheet.GetRow(i).GetCell(14)),
                        person_check_4  = Value(sheet.GetRow(i).GetCell(15)),
                        person_design_5 = Value(sheet.GetRow(i).GetCell(16)),
                        person_verify_5 = Value(sheet.GetRow(i).GetCell(17)),
                        person_check_5  = Value(sheet.GetRow(i).GetCell(18))
                    };
                    lda.Add(dat);
                }
            }
            pa.setDAS(lda);
            //Console.WriteLine("\n sht_num="+sheet.LastRowNum+",project_id="+pa.project_id+",p1="+pa.person_1+",p2="+pa.person_2+",rowId="+rowId+",p="+pa.das[1].person_design_1);
            return(pa);
        }