private void GetCatagorySetValues(DataTable dt, EstinateOverViewTableCellsSet cellsSet, ref ProjectCostCatagorySet catagorySet) { DataView dv = dt.DefaultView; int c_jz = Convert.ToInt32(cellsSet.JZGC_Cell.cell.Column); //建筑列 int c_sb = Convert.ToInt32(cellsSet.SBGZ_Cell.cell.Column); //设备列 int c_az = Convert.ToInt32(cellsSet.AZGC_Cell.cell.Column); //安装列 int c_other = Convert.ToInt32(cellsSet.Other_Cell_X.cell.Column); //其他列 int cell_hj = Convert.ToInt32(cellsSet.HJ_Cell.cell.Column); //合计列 catagorySet = new ProjectCostCatagorySet(); //配电站3层 if (cellsSet.PDZ_Cell.cell.Row is null) { } else { int r = Convert.ToInt32(cellsSet.PDZ_Cell.cell.Row); string pd_jz = ""; string pd_az = ""; string pd_sb = ""; pd_az = dv[r][c_az].ToString(); pd_jz = dv[r][c_jz].ToString(); pd_sb = dv[r][c_sb].ToString(); catagorySet.pcc_pd_az.costValue = (string.IsNullOrEmpty(pd_az) ? 0 : Convert.ToDouble(pd_az)); catagorySet.pcc_pd_jz.costValue = (string.IsNullOrEmpty(pd_jz) ? 0 : Convert.ToDouble(pd_jz)); catagorySet.pcc_pd_sb.costValue = (string.IsNullOrEmpty(pd_sb) ? 0 : Convert.ToDouble(pd_sb)); } //通信自动化3层 if (!(cellsSet.TXAuto_Cell.cell.Row is null)) { int r = Convert.ToInt32(cellsSet.TXAuto_Cell.cell.Row); string tx_jz = ""; string tx_az = ""; string tx_sb = ""; tx_az = dv[r][c_az].ToString(); tx_jz = dv[r][c_jz].ToString(); tx_sb = dv[r][c_sb].ToString(); catagorySet.pcc_pd_az.costValue = (string.IsNullOrEmpty(tx_az) ? 0 : Convert.ToDouble(tx_az)); catagorySet.pcc_pd_jz.costValue = (string.IsNullOrEmpty(tx_jz) ? 0 : Convert.ToDouble(tx_jz)); catagorySet.pcc_pd_sb.costValue = (string.IsNullOrEmpty(tx_sb) ? 0 : Convert.ToDouble(tx_sb)); } //架空线路1层 if (!(cellsSet.JKXL_Cell.cell.Row is null)) { int r = Convert.ToInt32(cellsSet.JKXL_Cell.cell.Row); string jk_hj = ""; jk_hj = dv[r][cell_hj].ToString(); catagorySet.pcc_jk.costValue = (string.IsNullOrEmpty(jk_hj) ? 0 : Convert.ToDouble(jk_hj)); } //电缆线路1层 if (!(cellsSet.DLXL_Cell.cell.Row is null)) { int r = Convert.ToInt32(cellsSet.DLXL_Cell.cell.Row); string dl_hj = ""; dl_hj = dv[r][cell_hj].ToString(); catagorySet.pcc_dl.costValue = (string.IsNullOrEmpty(dl_hj) ? 0 : Convert.ToDouble(dl_hj)); } //年价差。 if (!(cellsSet.NJC_Cell.cell.Row is null)) { int r = Convert.ToInt32(cellsSet.NJC_Cell.cell.Row); string njc_hj = ""; njc_hj = dv[r][cell_hj].ToString(); njc = (string.IsNullOrEmpty(njc_hj) ? 0 : Convert.ToDouble(njc_hj)); } //建设场地征用及清理费 if (!(cellsSet.Other_JSCDQL_Cell.cell.Row is null)) { int r = Convert.ToInt32(cellsSet.Other_JSCDQL_Cell.cell.Row); string jscd = ""; jscd = dv[r][cell_hj].ToString(); catagorySet.pcc_other_cd.costValue = (string.IsNullOrEmpty(jscd) ? 0 : Convert.ToDouble(jscd)); } //生产准备费=生产准备费(电缆工程)+生产准备费(非电缆工程)+基本预备费+生产准备费 string sczb_dl = ""; string sczb_fdl = ""; string sczb_jbyb = ""; string sczb = ""; if (!(cellsSet.Other_SCZB_DL_Cell.cell.Row is null)) { int r = Convert.ToInt32(cellsSet.Other_SCZB_DL_Cell.cell.Row); sczb_dl = dv[r][cell_hj].ToString(); } if (!(cellsSet.Other_SCZB_FDL_Cell.cell.Row is null)) { int r = Convert.ToInt32(cellsSet.Other_SCZB_FDL_Cell.cell.Row); sczb_fdl = dv[r][cell_hj].ToString(); } if (!(cellsSet.JBYB_Cell.cell.Row is null)) { int r = Convert.ToInt32(cellsSet.JBYB_Cell.cell.Row); sczb_jbyb = dv[r][cell_hj].ToString(); } if (!(cellsSet.Other_SCZB_Cell.cell.Row is null)) { int r = Convert.ToInt32(cellsSet.Other_SCZB_Cell.cell.Row); sczb = dv[r][cell_hj].ToString(); } catagorySet.pcc_other_sczb.costValue = ((string.IsNullOrEmpty(sczb_dl) ? 0 : Convert.ToDouble(sczb_dl)) + (string.IsNullOrEmpty(sczb_fdl) ? 0 : Convert.ToDouble(sczb_fdl)) + (string.IsNullOrEmpty(sczb_jbyb) ? 0 : Convert.ToDouble(sczb_jbyb)) + (string.IsNullOrEmpty(sczb) ? 0 : Convert.ToDouble(sczb))); //贷款利息 if (!(cellsSet.DKLX_Cell.cell.Row is null)) { int r = Convert.ToInt32(cellsSet.DKLX_Cell.cell.Row); string dklx = ""; dklx = dv[r][cell_hj].ToString(); catagorySet.pcc_other_dklx.costValue = (string.IsNullOrEmpty(dklx) ? 0 : Convert.ToDouble(dklx)); } //动态投资 if (!(cellsSet.GCDT_Cell.cell.Row is null)) { int r = Convert.ToInt32(cellsSet.GCDT_Cell.cell.Row); string all = ""; all = dv[r][cell_hj].ToString(); catagorySet.pcc_all.costValue = (string.IsNullOrEmpty(all) ? 0 : Convert.ToDouble(all)); } if (isWanYuan == true || ((isWanYuan == null) & catagorySet.pcc_all.costValue < 10000)) { catagorySet.pcc_all.costValue *= 10000; catagorySet.pcc_dl.costValue *= 10000; catagorySet.pcc_jk.costValue *= 10000; catagorySet.pcc_pd_az.costValue *= 10000; catagorySet.pcc_pd_jz.costValue *= 10000; catagorySet.pcc_pd_sb.costValue *= 10000; catagorySet.pcc_tx_az.costValue *= 10000; catagorySet.pcc_tx_jz.costValue *= 10000; catagorySet.pcc_tx_sb.costValue *= 10000; njc *= 10000; catagorySet.pcc_other_cd.costValue *= 10000; catagorySet.pcc_other_sczb.costValue *= 10000; catagorySet.pcc_other_dklx.costValue *= 10000; } }
////给cellsSet赋值:总概算 //private void GetEstinateOverViewTableValues(DataTable dt, ref EstinateOverViewTableCellsSet cellsSet) //{ // ExcelHelper excel = new ExcelHelper(); // int[] topcell = excel.CellindexContain(dt, "工程或费用名称"); // //rows // int? r_pd = excel.RowIndexContain(dt, "配电站", topcell[1]); // int? r_tx = excel.RowIndexContain(dt, "通信及调度自动化", topcell[1]); // int? r_jkxl = excel.RowIndexContain(dt, "架空线路", topcell[1]); // int? r_dlxl = excel.RowIndexContain(dt, "电缆线路", topcell[1]); // int? r_njc = excel.RowIndexContain(dt, "当地编制年价差", topcell[1]); // int? r_other = excel.RowIndexContain(dt, "其他费用", topcell[1]); // int? r_jbyb = excel.RowIndexContain(dt, "基本预备费", topcell[1]); // int? r_dklx = excel.RowIndexContain(dt, "贷款利息", topcell[1]); // //other费用项 // int? r_jscd = excel.RowIndexContain(dt, "建设场地征用及清理费", topcell[1]); // int? r_sczb_dl = excel.RowIndexContain(dt, "生产准备费(电缆工程)", topcell[1]); // int? r_sczb_fdl = excel.RowIndexContain(dt, "生产准备费(非电缆工程)", topcell[1]); // int? r_all = excel.RowIndexContain(dt, "工程动态投资", topcell[1]); // //columns // int? c_jzgc = excel.ColumnIndexContain(dt, "建筑工程费", topcell[0]); // int? c_sbgz = excel.ColumnIndexContain(dt, "设备购置费", topcell[0]); // int? c_azgc = excel.ColumnIndexContain(dt, "安装工程费", topcell[0]); // int? c_other = excel.ColumnIndexContain(dt, "其他费用", topcell[0]); // int? c_sum = excel.ColumnIndexContain(dt, "合计", topcell[0]); // cellsSet = new EstinateOverViewTableCellsSet(); // cellsSet.PDZ_Cell.cell = new ExcelCellCoordinate(r_pd, topcell[1]); // cellsSet.TXAuto_Cell.cell = new ExcelCellCoordinate(r_tx, topcell[1]); // cellsSet.JKXL_Cell.cell = new ExcelCellCoordinate(r_jkxl, topcell[1]); // cellsSet.DLXL_Cell.cell = new ExcelCellCoordinate(r_dlxl, topcell[1]); // cellsSet.NJC_Cell.cell = new ExcelCellCoordinate(r_njc, topcell[1]); // cellsSet.Other_Cell_Y.cell = new ExcelCellCoordinate(r_other, topcell[1]); // cellsSet.JBYB_Cell.cell = new ExcelCellCoordinate(r_jbyb, topcell[1]); // cellsSet.DKLX_Cell.cell = new ExcelCellCoordinate(r_dklx, topcell[1]); // cellsSet.Other_JSCDQL_Cell.cell = new ExcelCellCoordinate(r_jscd, topcell[1]); // cellsSet.Other_SCZB_DL_Cell.cell = new ExcelCellCoordinate(r_sczb_dl, topcell[1]); // cellsSet.Other_SCZB_FDL_Cell.cell = new ExcelCellCoordinate(r_sczb_fdl, topcell[1]); // cellsSet.JZGC_Cell.cell = new ExcelCellCoordinate(topcell[0], c_jzgc); // cellsSet.SBGZ_Cell.cell = new ExcelCellCoordinate(topcell[0], c_sbgz); // cellsSet.AZGC_Cell.cell = new ExcelCellCoordinate(topcell[0], c_azgc); // cellsSet.Other_Cell_X.cell = new ExcelCellCoordinate(topcell[0], c_other); // cellsSet.HJ_Cell.cell = new ExcelCellCoordinate(topcell[0], c_sum); // cellsSet.GCDT_Cell.cell = new ExcelCellCoordinate(r_all, topcell[1]); //} ////catagorySet赋值:总概算 //private void GetCatagorySetValues(DataTable dt, EstinateOverViewTableCellsSet cellsSet, ref ProjectCostCatagorySet catagorySet) //{ // DataView dv = dt.DefaultView; // int c_jz = Convert.ToInt32(cellsSet.AZGC_Cell.cell.Column);//建筑列 // int c_sb = Convert.ToInt32(cellsSet.SBGZ_Cell.cell.Column);//设备列 // int c_az = Convert.ToInt32(cellsSet.AZGC_Cell.cell.Column);//安装列 // int c_other = Convert.ToInt32(cellsSet.Other_Cell_X.cell.Column);//其他列 // int cell_hj = Convert.ToInt32(cellsSet.HJ_Cell.cell.Column);//合计列 // catagorySet = new ProjectCostCatagorySet(); // //配电站3层 // if (cellsSet.PDZ_Cell.cell.Row is null) // { // } // else // { // int r = Convert.ToInt32(cellsSet.PDZ_Cell.cell.Row); // string pd_jz = ""; // string pd_az = ""; // string pd_sb = ""; // pd_az = dv[r][c_az].ToString(); // pd_jz = dv[r][c_jz].ToString(); // pd_sb = dv[r][c_sb].ToString(); // catagorySet.pcc_pd_az.costValue = (string.IsNullOrEmpty(pd_az) ? 0 : Convert.ToDouble(pd_az)) * 10000; // catagorySet.pcc_pd_jz.costValue = (string.IsNullOrEmpty(pd_jz) ? 0 : Convert.ToDouble(pd_jz)) * 10000; // catagorySet.pcc_pd_sb.costValue = (string.IsNullOrEmpty(pd_sb) ? 0 : Convert.ToDouble(pd_sb)) * 10000; // } // //通信自动化3层 // if (!(cellsSet.TXAuto_Cell.cell.Row is null)) // { // int r = Convert.ToInt32(cellsSet.TXAuto_Cell.cell.Row); // string tx_jz = ""; // string tx_az = ""; // string tx_sb = ""; // tx_az = dv[r][c_az].ToString(); // tx_jz = dv[r][c_jz].ToString(); // tx_sb = dv[r][c_sb].ToString(); // catagorySet.pcc_pd_az.costValue = (string.IsNullOrEmpty(tx_az) ? 0 : Convert.ToDouble(tx_az)) * 10000; // catagorySet.pcc_pd_jz.costValue = (string.IsNullOrEmpty(tx_jz) ? 0 : Convert.ToDouble(tx_jz)) * 10000; // catagorySet.pcc_pd_sb.costValue = (string.IsNullOrEmpty(tx_sb) ? 0 : Convert.ToDouble(tx_sb)) * 10000; // } // //架空线路1层 // if (!(cellsSet.JKXL_Cell.cell.Row is null)) // { // int r = Convert.ToInt32(cellsSet.JKXL_Cell.cell.Row); // string jk_hj = ""; // jk_hj = dv[r][cell_hj].ToString(); // catagorySet.pcc_jk.costValue = (string.IsNullOrEmpty(jk_hj) ? 0 : Convert.ToDouble(jk_hj)) * 10000; // } // //电缆线路1层 // if (!(cellsSet.DLXL_Cell.cell.Row is null)) // { // int r = Convert.ToInt32(cellsSet.DLXL_Cell.cell.Row); // string dl_hj = ""; // dl_hj = dv[r][cell_hj].ToString(); // catagorySet.pcc_dl.costValue = (string.IsNullOrEmpty(dl_hj) ? 0 : Convert.ToDouble(dl_hj)) * 10000; // } // //年价差。 // if (!(cellsSet.NJC_Cell.cell.Row is null)) // { // int r = Convert.ToInt32(cellsSet.NJC_Cell.cell.Row); // string njc_hj = ""; // njc_hj = dv[r][cell_hj].ToString(); // njc = (string.IsNullOrEmpty(njc_hj) ? 0 : Convert.ToDouble(njc_hj)) * 10000; // } // //建设场地征用及清理费 // if (!(cellsSet.Other_JSCDQL_Cell.cell.Row is null)) // { // int r = Convert.ToInt32(cellsSet.Other_JSCDQL_Cell.cell.Row); // string jscd = ""; // jscd = dv[r][cell_hj].ToString(); // catagorySet.pcc_other_cd.costValue = (string.IsNullOrEmpty(jscd) ? 0 : Convert.ToDouble(jscd)) * 10000; // } // //生产准备费=生产准备费(电缆工程)+生产准备费(非电缆工程)+基本预备费 // string sczb_dl = ""; // string sczb_fdl = ""; // string sczb_jbyb = ""; // if (!(cellsSet.Other_SCZB_DL_Cell.cell.Row is null)) // { // int r = Convert.ToInt32(cellsSet.Other_SCZB_DL_Cell.cell.Row); // sczb_dl = dv[r][cell_hj].ToString(); // } // if (!(cellsSet.Other_SCZB_FDL_Cell.cell.Row is null)) // { // int r = Convert.ToInt32(cellsSet.Other_SCZB_FDL_Cell.cell.Row); // sczb_fdl = dv[r][cell_hj].ToString(); // } // if (!(cellsSet.JBYB_Cell.cell.Row is null)) // { // int r = Convert.ToInt32(cellsSet.JBYB_Cell.cell.Row); // sczb_jbyb = dv[r][cell_hj].ToString(); // } // catagorySet.pcc_other_sczb.costValue = ((string.IsNullOrEmpty(sczb_dl) ? 0 : Convert.ToDouble(sczb_dl)) + (string.IsNullOrEmpty(sczb_fdl) ? 0 : Convert.ToDouble(sczb_fdl)) + (string.IsNullOrEmpty(sczb_jbyb) ? 0 : Convert.ToDouble(sczb_jbyb))) * 10000; // //贷款利息 // if (!(cellsSet.DKLX_Cell.cell.Row is null)) // { // int r = Convert.ToInt32(cellsSet.DKLX_Cell.cell.Row); // string dklx = ""; // dklx = dv[r][cell_hj].ToString(); // catagorySet.pcc_other_dklx.costValue = (string.IsNullOrEmpty(dklx) ? 0 : Convert.ToDouble(dklx)) * 10000; // } // //动态投资 // if (!(cellsSet.GCDT_Cell.cell.Row is null)) // { // int r = Convert.ToInt32(cellsSet.GCDT_Cell.cell.Row); // string all = ""; // all = dv[r][cell_hj].ToString(); // catagorySet.pcc_all.costValue = (string.IsNullOrEmpty(all) ? 0 : Convert.ToDouble(all)) * 10000; // } //} //catagorySet赋值:总概算 //-----------------debug:万元单位判断-------------------------------------------------- //给cellsSet赋值:总概算 private void GetEstinateOverViewTableValues(DataTable dt, ref EstinateOverViewTableCellsSet cellsSet) { ExcelHelper excel = new ExcelHelper(); //-------------------------debug:从总概算页获取工程名称-------------------------------------------- int[] title = excel.CellindexContain(dt, "概算书"); proc.ProjectName = string.IsNullOrEmpty(proc.ProjectName) & (!(title is null)) ? dt.DefaultView[title[0]][title[1]].ToString().Replace("概算书", "").Trim() : proc.ProjectName; proc.ProjectCode = string.IsNullOrEmpty(proc.ProjectCode) ? "" : proc.ProjectCode; //------------------------------------------------------------------------------------------------- this.ProjectName = proc.ProjectName; //---------------------------debug:万元还是元?---------------------------------------------------------------------- int[] unit = excel.CellindexContain(dt, "金额单位"); if (unit is null) { isWanYuan = null; } else { isWanYuan = dt.DefaultView[unit[0]][unit[1]].ToString().Contains("万元"); } //------------------------------------------------------------------------------------------------- //rows int[] topcell = excel.CellindexContain(dt, "工程或费用名称"); int? r_pd = excel.RowIndexContain(dt, "配电站", topcell[1]); int? r_tx = excel.RowIndexContain(dt, "通信及调度自动化", topcell[1]); int? r_jkxl = excel.RowIndexContain(dt, "架空线路", topcell[1]); int? r_dlxl = excel.RowIndexContain(dt, "电缆线路", topcell[1]); int? r_njc = excel.RowIndexContain(dt, "当地编制年价差", topcell[1]); int? r_other = excel.RowIndexContain(dt, "其他费用", topcell[1]); int? r_jbyb = excel.RowIndexContain(dt, "基本预备费", topcell[1]); int? r_dklx = excel.RowIndexContain(dt, "贷款利息", topcell[1]); //other费用项 int?r_jscd = excel.RowIndexContain(dt, "建设场地征用及清理费", topcell[1]); int?r_sczb_dl = excel.RowIndexContain(dt, "生产准备费(电缆工程)", topcell[1]); int?r_sczb_fdl = excel.RowIndexContain(dt, "生产准备费(非电缆工程)", topcell[1]); int?r_sczb = excel.RowIndex(dt, "生产准备费", topcell[1]); int?r_all = excel.RowIndexContain(dt, "工程动态投资", topcell[1]); //columns int?c_jzgc = excel.ColumnIndexContain(dt, "建筑工程费", topcell[0]); int?c_sbgz = excel.ColumnIndexContain(dt, "设备购置费", topcell[0]); int?c_azgc = excel.ColumnIndexContain(dt, "安装工程费", topcell[0]); int?c_other = excel.ColumnIndexContain(dt, "其他费用", topcell[0]); int?c_sum = excel.ColumnIndexContain(dt, "合计", topcell[0]); cellsSet = new EstinateOverViewTableCellsSet(); cellsSet.PDZ_Cell.cell = new ExcelCellCoordinate(r_pd, topcell[1]); cellsSet.TXAuto_Cell.cell = new ExcelCellCoordinate(r_tx, topcell[1]); cellsSet.JKXL_Cell.cell = new ExcelCellCoordinate(r_jkxl, topcell[1]); cellsSet.DLXL_Cell.cell = new ExcelCellCoordinate(r_dlxl, topcell[1]); cellsSet.NJC_Cell.cell = new ExcelCellCoordinate(r_njc, topcell[1]); cellsSet.Other_Cell_Y.cell = new ExcelCellCoordinate(r_other, topcell[1]); cellsSet.JBYB_Cell.cell = new ExcelCellCoordinate(r_jbyb, topcell[1]); cellsSet.DKLX_Cell.cell = new ExcelCellCoordinate(r_dklx, topcell[1]); cellsSet.Other_JSCDQL_Cell.cell = new ExcelCellCoordinate(r_jscd, topcell[1]); cellsSet.Other_SCZB_DL_Cell.cell = new ExcelCellCoordinate(r_sczb_dl, topcell[1]); cellsSet.Other_SCZB_FDL_Cell.cell = new ExcelCellCoordinate(r_sczb_fdl, topcell[1]); cellsSet.Other_SCZB_Cell.cell = new ExcelCellCoordinate(r_sczb, topcell[1]); cellsSet.JZGC_Cell.cell = new ExcelCellCoordinate(topcell[0], c_jzgc); cellsSet.SBGZ_Cell.cell = new ExcelCellCoordinate(topcell[0], c_sbgz); cellsSet.AZGC_Cell.cell = new ExcelCellCoordinate(topcell[0], c_azgc); cellsSet.Other_Cell_X.cell = new ExcelCellCoordinate(topcell[0], c_other); cellsSet.HJ_Cell.cell = new ExcelCellCoordinate(topcell[0], c_sum); cellsSet.GCDT_Cell.cell = new ExcelCellCoordinate(r_all, topcell[1]); }