private Unit Read_Cost_Unit(ExcelWorksheet sheet, int start_row, Regex div_total, PartType partType)
        {
            int    row  = start_row;
            int    col  = UNIT_NAME_COLSPAN_START_COLUMN_INDEX;
            string cell = readcell_safe(sheet, row, col);
            Match  m    = regUnitName.Match(cell);

            if (!m.Success)
            {
                ExcelParseException ex = new ExcelParseException();
                ex.ExcelRow = row;
                ex.ExcelCol = col;
                ex.Hint     = "유닛 이름은 (1) 처럼 괄호 안의 숫자로 시작해야 하는데, 그러한 문자열을 찾을 수 없습니다.";
                throw new ApplicationException(ex.ToString(), ex);
            }

            Unit unit = new Unit();

            unit.name_in_excel     = cell;
            unit.name_justified    = m.Groups[m.Groups.Count - 1].Value;
            unit.vendor_totalprice = readcell_decimal_safe(sheet, row, (int)ExcelColumns.금액);

            row++;
            PartGroup pg = new PartGroup();

            while (row <= MaxRowCount)
            {
                cell = readcell_safe(sheet, row, col);
                m    = div_total.Match(cell);
                if (m.Success)
                {
                    // division ended
                    break;
                }

                m = regUnitName.Match(cell);
                if (m.Success)
                {
                    // new unit started
                    break;
                }

                ReviewPartInfo rpi = ReadVendorPart(sheet, row);
                rpi.parttype = partType;
                pg.ReviewPartInfos.Add(rpi);
                row++;
            }
            unit.partGroups.Add(pg);

            //
            CurrentWorkingRowIndex = row;
            return(unit);
        }
        private int ReadPartGroup(ExcelWorksheet sheet, int start_row, Unit unit)
        {
            int       row = start_row;
            PartGroup pg  = new PartGroup();

            while (row <= MaxRowCount)
            {
                ReviewPartInfo rpi = ReadVendorPart(sheet, row);
                {
                    // check if 구매품
                    Match m = reg구매품소계.Match(rpi.no);
                    if (m.Success)
                    {
                        pg.name              = rpi.no;
                        pg.PartGroupType     = PartType.구매품;
                        pg.vendor_totalprice = rpi.vendor_totalprice;

                        foreach (ReviewPartInfo item in pg.ReviewPartInfos)
                        {
                            item.parttype = PartType.구매품;
                        }

                        unit.partGroups.Add(pg);
                        break;
                    }
                }

                {
                    // check if 가공품
                    Match m = reg가공품소계.Match(rpi.no);
                    if (m.Success)
                    {
                        pg.name              = rpi.no;
                        pg.PartGroupType     = PartType.가공품;
                        pg.vendor_totalprice = rpi.vendor_totalprice;

                        foreach (ReviewPartInfo item in pg.ReviewPartInfos)
                        {
                            item.parttype = PartType.가공품;
                        }

                        unit.partGroups.Add(pg);
                        break;
                    }
                }

                pg.ReviewPartInfos.Add(rpi);
                row++;
            }
            return(row);
        }
예제 #3
0
        private ReviewPartInfo ReadVendorPart(ExcelWorksheet sheet, int row)
        {
            ReviewPartInfo rpi = new ReviewPartInfo();

            rpi.excel_row_index = row;
            rpi.no                = readcell_safe(sheet, row, (int)ExcelColumns.No);
            rpi.partname          = readcell_safe(sheet, row, (int)ExcelColumns.품명);
            rpi.partspec          = readcell_safe(sheet, row, (int)ExcelColumns.규격);
            rpi.maker             = readcell_safe(sheet, row, (int)ExcelColumns.Maker);
            rpi.vendor_count      = readcell_decimal_safe(sheet, row, (int)ExcelColumns.수량);
            rpi.unit              = readcell_safe(sheet, row, (int)ExcelColumns.단위);
            rpi.vendor_unitprice  = readcell_decimal_safe(sheet, row, (int)ExcelColumns.단가);
            rpi.vendor_totalprice = readcell_decimal_safe(sheet, row, (int)ExcelColumns.금액);
            rpi.vendor_note       = readcell_safe(sheet, row, (int)ExcelColumns.비고);

            //
            rpi.review_count     = readcell_decimal_safe(sheet, row, (int)ExcelColumns.검토수량);
            rpi.review_unitprice = readcell_decimal_safe(sheet, row, (int)ExcelColumns.검토단가);
            rpi.review_note      = readcell_safe(sheet, row, (int)ExcelColumns.검토내용);

            return(rpi);
        }