//画execl
public static MemoryStream ContractWorkFlowToExecl(NPOIModel li, string strSheetName,out string ApprovalFormPath)
{
System.IO.MemoryStream ms = new System.IO.MemoryStream();
try
{
NPOI.HSSF.UserModel.HSSFWorkbook book = new NPOI.HSSF.UserModel.HSSFWorkbook();
NPOI.SS.UserModel.ISheet sheet = book.CreateSheet(strSheetName);
var BaseName = (List<string>)li.BaseColnum[0];
var JBXXName = (List<string>)li.JBXXColnum[0];
var TZXXName = (List<string>)li.TZXXColnum[0];
var JJXXName = new List<string>();
var ZLXXName = new List<string>();
var BLXXName = new List<string>();
var PJXXName = new List<string>();
if (li.JJXXColnum.Count() > 0)
{
JJXXName = (List<string>)li.JJXXColnum[0];
}
if (li.JJXXColnum.Count() > 0)
{
ZLXXName = (List<string>)li.ZLXXColnum[0];
}
if (li.JJXXColnum.Count() > 0)
{
BLXXName = (List<string>)li.BLXXColnum[0];
}
if (li.JJXXColnum.Count() > 0)
{
PJXXName = (List<string>)li.PJXXColnum[0];
}
//设置一个合并单元格区域,使用上下左右定义CellRangeAddress区域
//CellRangeAddress四个参数为:起始行,结束行,起始列,结束列
sheet.AddMergedRegion(new CellRangeAddress(0, 0, 0, 12));
sheet.AddMergedRegion(new CellRangeAddress(1, 1, 0, 12));
sheet.AddMergedRegion(new CellRangeAddress(2, 2, 0, 3));
sheet.AddMergedRegion(new CellRangeAddress(2, 2, 4, 7));
sheet.AddMergedRegion(new CellRangeAddress(2, 2, 8, 12));
sheet.AddMergedRegion(new CellRangeAddress(3, 3, 0, 3));
sheet.AddMergedRegion(new CellRangeAddress(3, 3, 4, 7));
sheet.AddMergedRegion(new CellRangeAddress(3, 3, 8, 12));
sheet.AddMergedRegion(new CellRangeAddress(4, 4, 0, 3));
sheet.AddMergedRegion(new CellRangeAddress(4, 4, 4, 7));
sheet.AddMergedRegion(new CellRangeAddress(4, 4, 8, 12));
sheet.AddMergedRegion(new CellRangeAddress(5, 5, 0, 3));
sheet.AddMergedRegion(new CellRangeAddress(5, 5, 4, 7));
sheet.AddMergedRegion(new CellRangeAddress(5, 5, 8, 12));
sheet.AddMergedRegion(new CellRangeAddress(6, 6, 0, 3));
sheet.AddMergedRegion(new CellRangeAddress(6, 6, 4, 7));
sheet.AddMergedRegion(new CellRangeAddress(6, 6, 8, 12));
sheet.AddMergedRegion(new CellRangeAddress(7, 7, 0, 3));
sheet.AddMergedRegion(new CellRangeAddress(7, 7, 4, 7));
sheet.AddMergedRegion(new CellRangeAddress(7, 7, 8, 12));
sheet.AddMergedRegion(new CellRangeAddress(8, 8, 0, 3));
sheet.AddMergedRegion(new CellRangeAddress(8, 8, 4, 7));
sheet.AddMergedRegion(new CellRangeAddress(8, 8, 8, 12));
sheet.AddMergedRegion(new CellRangeAddress(9, 9, 0, 3));
sheet.AddMergedRegion(new CellRangeAddress(9, 9, 4, 7));
sheet.AddMergedRegion(new CellRangeAddress(9, 9, 8, 12));
sheet.AddMergedRegion(new CellRangeAddress(10, 10, 0, 12));
for (int i = 0; i <= (JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : (int)(JBXXName.Count() / 3 + 1)); i++)
{
sheet.AddMergedRegion(new CellRangeAddress(11 + i, 11 + i, 0, 3));
sheet.AddMergedRegion(new CellRangeAddress(11 + i, 11 + i, 4, 7));
sheet.AddMergedRegion(new CellRangeAddress(11 + i, 11 + i, 8, 12));
}
if (TZXXName.Count() > 0)
{
int RowIndex = 11 + (JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : (int)(JBXXName.Count() / 3 + 1));
sheet.AddMergedRegion(new CellRangeAddress(RowIndex, RowIndex, 0, 12));
for (int i = 0; i <= (TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : (int)(TZXXName.Count() / 3 + 1)); i++)
{
sheet.AddMergedRegion(new CellRangeAddress(RowIndex + i, RowIndex + i, 0, 3));
sheet.AddMergedRegion(new CellRangeAddress(RowIndex + i, RowIndex + i, 4, 7));
sheet.AddMergedRegion(new CellRangeAddress(RowIndex + i, RowIndex + i, 8, 12));
}
}
if (JJXXName.Count() > 0)
{
int RowIndex = 11 + (JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : (int)(TZXXName.Count() / 3 + 1));
//;
sheet.AddMergedRegion(new CellRangeAddress(RowIndex, RowIndex, 0, 12));
for (int i = 0; i <= (JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : (int)(JJXXName.Count() / 3 + 1)); i++)
{
sheet.AddMergedRegion(new CellRangeAddress(RowIndex + i, RowIndex + i, 0, 1));
sheet.AddMergedRegion(new CellRangeAddress(RowIndex + i, RowIndex + i, 2, 3));
sheet.AddMergedRegion(new CellRangeAddress(RowIndex + i, RowIndex + i, 4, 5));
}
}
if (PJXXName.Count() > 0)
{
int RowIndex = 11 + (JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : (int)(JJXXName.Count() / 3 + 1));
sheet.AddMergedRegion(new CellRangeAddress(RowIndex, RowIndex, 0, 12));
for (int i = 0; i <= (PJXXName.Count() % 3 == 0 ? (int)(PJXXName.Count() / 3) : (int)(PJXXName.Count() / 3 + 1)); i++)
{
sheet.AddMergedRegion(new CellRangeAddress(RowIndex + i, RowIndex + i, 0, 1));
sheet.AddMergedRegion(new CellRangeAddress(RowIndex + i, RowIndex + i, 2, 3));
sheet.AddMergedRegion(new CellRangeAddress(RowIndex + i, RowIndex + i, 4, 5));
}
}
if (ZLXXName.Count() > 0)
{
int RowIndex = 11 + (JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : (int)(JJXXName.Count() / 3 + 1)) + (PJXXName.Count() % 3 == 0 ? (int)(PJXXName.Count() / 3) : (int)(PJXXName.Count() / 3 + 1));
sheet.AddMergedRegion(new CellRangeAddress(RowIndex, RowIndex, 0, 12));
for (int i = 0; i <= (ZLXXName.Count() % 3 == 0 ? (int)(ZLXXName.Count() / 3) : (int)(ZLXXName.Count() / 3 + 1)); i++)
{
sheet.AddMergedRegion(new CellRangeAddress(RowIndex + i, RowIndex + i, 0, 1));
sheet.AddMergedRegion(new CellRangeAddress(RowIndex + i, RowIndex + i, 2, 3));
sheet.AddMergedRegion(new CellRangeAddress(RowIndex + i, RowIndex + i, 4, 5));
}
}
if (BLXXName.Count() > 0)
{
int RowIndex = 11 + (JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : (int)(JJXXName.Count() / 3 + 1)) + (PJXXName.Count() % 3 == 0 ? (int)(PJXXName.Count() / 3) : (int)(PJXXName.Count() / 3 + 1)) + (ZLXXName.Count() % 3 == 0 ? (int)(ZLXXName.Count() / 3) : (int)(ZLXXName.Count() / 3 + 1));
sheet.AddMergedRegion(new CellRangeAddress(RowIndex, RowIndex, 0, 12));
for (int i = 0; i <= (BLXXName.Count() % 3 == 0 ? (int)(BLXXName.Count() / 3) : (int)(BLXXName.Count() / 3 + 1)); i++)
{
sheet.AddMergedRegion(new CellRangeAddress(RowIndex + i, RowIndex + i, 0, 1));
sheet.AddMergedRegion(new CellRangeAddress(RowIndex + i, RowIndex + i, 2, 3));
sheet.AddMergedRegion(new CellRangeAddress(RowIndex + i, RowIndex + i, 4, 5));
}
}
////设置单元格的高度
////设置单元格的宽度
//sheet.SetColumnWidth(0, 30 * 256);
#region 样式
ICellStyle styleA = book.CreateCellStyle();
//设置单元格的样式:水平对齐居中
styleA.Alignment = HorizontalAlignment.Left;
styleA.VerticalAlignment = VerticalAlignment.None;//垂直居中
styleA.BorderTop = BorderStyle.Thin;
styleA.BorderBottom = BorderStyle.Thin;
styleA.BorderLeft = BorderStyle.Thin;
styleA.BorderRight = BorderStyle.Thin;
styleA.WrapText = true;//自动换行
styleA.IsLocked = false;
IFont font1 = book.CreateFont();//字体
font1.Color = HSSFColor.Black.Index;//字体颜色
font1.Boldweight = (Int16)FontBoldWeight.Bold;//字体加粗
styleA.SetFont(font1);
ICellStyle styleB = book.CreateCellStyle();
//设置单元格的样式:水平对齐居中
styleB.Alignment = HorizontalAlignment.Left;
styleB.VerticalAlignment = VerticalAlignment.None;//垂直居中
styleB.BorderTop = BorderStyle.Thin;
styleB.BorderBottom = BorderStyle.Thin;
styleB.BorderLeft = BorderStyle.Thin;
styleB.BorderRight = BorderStyle.Thin;
styleB.WrapText = true;//自动换行
styleB.IsLocked = false;
IFont fontB = book.CreateFont();//字体
fontB.Color = HSSFColor.Black.Index;//字体颜色
styleB.SetFont(fontB);
ICellStyle styleC = book.CreateCellStyle();
//设置单元格的样式:水平对齐居中
styleC.Alignment = HorizontalAlignment.Center;
styleC.BorderTop = BorderStyle.Thin;
styleC.BorderBottom = BorderStyle.Thin;
styleC.BorderLeft = BorderStyle.Thin;
styleC.BorderRight = BorderStyle.Thin;
styleC.WrapText = true;//自动换行
styleC.IsLocked = false;
IFont fontC = book.CreateFont();//字体
fontC.Color = HSSFColor.Black.Index;//字体颜色
fontC.Boldweight = (Int16)FontBoldWeight.Bold;
fontC.FontHeight = 240;
styleC.SetFont(fontC);
ICellStyle styleD = book.CreateCellStyle();
//设置单元格的样式:水平对齐居中
styleD.Alignment = HorizontalAlignment.Left;
styleD.BorderTop = BorderStyle.Thin;
styleD.BorderBottom = BorderStyle.Thin;
styleD.BorderLeft = BorderStyle.Thin;
styleD.BorderRight = BorderStyle.Thin;
styleD.FillForegroundColor = HSSFColor.BlueGrey.Index;
styleD.FillPattern = FillPattern.SolidForeground;
styleD.WrapText = true;//自动换行
styleC.IsLocked = false;
IFont fontD = book.CreateFont();//字体
fontD.Color = HSSFColor.White.Index;//字体颜色
fontD.Boldweight = (Int16)FontBoldWeight.Bold;
fontD.FontHeight = 240;
styleD.SetFont(fontD);
#endregion
NPOI.SS.UserModel.IRow row = sheet.CreateRow(0);
for(int c = 0; c <= 12; c++)
{
if(c==0)
{
NPOI.SS.UserModel.ICell cell = row.CreateCell(c, CellType.String);
cell.SetCellValue("合同会签单");
cell.CellStyle = styleC;
}
else
{
NPOI.SS.UserModel.ICell cell = row.CreateCell(c, CellType.String);
cell.SetCellValue("");
cell.CellStyle = styleC;
}
}
NPOI.SS.UserModel.IRow row1 = sheet.CreateRow(1);
NPOI.SS.UserModel.ICell cell1 = row1.CreateCell(0, CellType.String);
cell1.SetCellValue("基础信息");
cell1.CellStyle = styleD;
var BaseCount = 0;
for (int rowIndex = 2; rowIndex < 10; rowIndex++)
{
NPOI.SS.UserModel.IRow rowN = sheet.CreateRow(rowIndex);
for (int c = 0; c <= 12; c++)
{
if (BaseCount < BaseName.Count() && !((c & 1) == 1) && (c != 2 && c != 6 && c != 10 && c != 12))
{
var diValue = (Dictionary<string, object>)li.BaseValue[0];
var Value = diValue[BaseName[BaseCount]];
var cellValue = new HSSFRichTextString(BaseName[BaseCount].ToString() + ":" + Value);
var index = BaseName[BaseCount].ToString() + ":" + Value;
cellValue.ApplyFont(0, index.IndexOf(":") + 1, font1);
if (index.IndexOf(":") < index.Split(':')[1].Length)
{
cellValue.ApplyFont(index.IndexOf(":") + 1, index.Split(':')[1].Length, fontB);
}
NPOI.SS.UserModel.ICell cellBaseInfo = rowN.CreateCell(c, CellType.String);
var result = sheet.GetRow(rowIndex).GetCell(c).IsMergedCell;
//var ss=sheet()
cellBaseInfo.SetCellValue(cellValue);
cellBaseInfo.CellStyle = styleA;
BaseCount++;
}
else
{
NPOI.SS.UserModel.ICell cellBaseInfo = rowN.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue("");
cellBaseInfo.CellStyle = styleA;
}
//cell.SetCellValue(liName[i].ToString());
}
}
NPOI.SS.UserModel.IRow row11 = sheet.CreateRow(10);
NPOI.SS.UserModel.ICell cell11 = row11.CreateCell(0, CellType.String);
cell11.SetCellValue("基本信息");
cell11.CellStyle = styleD;
var JBXXCount = 0;
for (int rowIndex = 11; rowIndex < 12 + (JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : (int)(JBXXName.Count() / 3 + 1)); rowIndex++)
{
NPOI.SS.UserModel.IRow rowN = sheet.CreateRow(rowIndex);
for (int c = 0; c <= 12; c++)
{
if (JBXXCount < JBXXName.Count() && !((c & 1) == 1) && (c != 2 && c != 6 && c != 10 && c != 12))
{
var diValue = (Dictionary<string, object>)li.JBXXValue[0];
var Value = diValue[JBXXName[JBXXCount]];
var cellValue = new HSSFRichTextString(JBXXName[JBXXCount].ToString() + ":" + Value);
var index = JBXXName[JBXXCount].ToString() + ":" + Value;
cellValue.ApplyFont(0, index.IndexOf(":") + 1, font1);
if (index.IndexOf(":") < index.Split(':')[1].Length)
{
cellValue.ApplyFont(index.IndexOf(":") + 1, index.Split(':')[1].Length, fontB);
}
NPOI.SS.UserModel.ICell cellBaseInfo = rowN.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(cellValue);
cellBaseInfo.CellStyle = styleA;
JBXXCount++;
}
else
{
NPOI.SS.UserModel.ICell cellBaseInfo = rowN.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue("");
cellBaseInfo.CellStyle = styleA;
}
//cell.SetCellValue(liName[i].ToString());
}
}
if (TZXXName.Count() > 0)
{
NPOI.SS.UserModel.IRow row12 = sheet.CreateRow(11 + (JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : (int)(JBXXName.Count() / 3 + 1)));
NPOI.SS.UserModel.ICell cell12 = row12.CreateCell(0, CellType.String);
cell12.SetCellValue("特征信息");
cell12.CellStyle = styleD;
var TZXXCount = 0;
for (int rowIndex = 12 + (JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : (int)(JBXXName.Count() / 3 + 1)); rowIndex < 12 + (JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : (int)(TZXXName.Count() / 3 + 1)); rowIndex++)
{
NPOI.SS.UserModel.IRow rowN = sheet.CreateRow(rowIndex);
for (int c = 0; c <= 12; c++)
{
if (TZXXCount < TZXXName.Count() && !((c & 1) == 1) && (c != 2 && c != 6 && c != 10 && c != 12))
{
var diValue = (Dictionary<string, object>)li.TZXXValue[0];
var Value = diValue[TZXXName[TZXXCount]];
var cellValue = new HSSFRichTextString(TZXXName[TZXXCount].ToString() + ":" + Value);
var index = TZXXName[TZXXCount].ToString() + ":" + Value;
cellValue.ApplyFont(0, index.IndexOf(":") + 1, font1);
if (index.IndexOf(":") < index.Split(':')[1].Length)
{
cellValue.ApplyFont(index.IndexOf(":") + 1, index.Split(':')[1].Length, fontB);
}
NPOI.SS.UserModel.ICell cellBaseInfo = rowN.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(cellValue);
cellBaseInfo.CellStyle = styleA;
TZXXCount++;
}
else
{
NPOI.SS.UserModel.ICell cellBaseInfo = rowN.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue("");
cellBaseInfo.CellStyle = styleA;
}
//cell.SetCellValue(liName[i].ToString());
}
}
}
if (JJXXName.Count() > 0)
{
NPOI.SS.UserModel.IRow row13 = sheet.CreateRow(11 + (JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : (int)(TZXXName.Count() / 3 + 1)));
NPOI.SS.UserModel.ICell cell13 = row13.CreateCell(0, CellType.String);
cell13.SetCellValue("基金信息");
cell13.CellStyle = styleD;
var JJXXCount = 0;
for (int rowIndex = 12 + (JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : (int)(TZXXName.Count() / 3 + 1)); rowIndex < 13 + (JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : (int)(JJXXName.Count() / 3 + 1)); rowIndex++)
{
NPOI.SS.UserModel.IRow rowN = sheet.CreateRow(rowIndex);
for (int c = 0; c <= 12; c++)
{
if (JJXXCount < JJXXName.Count() && !((c & 1) == 1) && (c != 2 && c != 6 && c != 10 && c != 12))
{
var diValue = (Dictionary<string, object>)li.JJXXValue[0];
var Value = diValue[JJXXName[JJXXCount]];
var cellValue = new HSSFRichTextString(JJXXName[JJXXCount].ToString() + ":" + Value);
var index = JJXXName[JJXXCount].ToString() + ":" + Value;
cellValue.ApplyFont(0, index.IndexOf(":") + 1, font1);
if (index.IndexOf(":") < index.Split(':')[1].Length)
{
cellValue.ApplyFont(index.IndexOf(":") + 1, index.Split(':')[1].Length, fontB);
}
NPOI.SS.UserModel.ICell cellBaseInfo = rowN.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(cellValue);
cellBaseInfo.CellStyle = styleA;
JJXXCount++;
}
else
{
NPOI.SS.UserModel.ICell cellBaseInfo = rowN.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue("");
cellBaseInfo.CellStyle = styleA;
}
//cell.SetCellValue(liName[i].ToString());
}
}
}
if (PJXXName.Count() > 0)
{
NPOI.SS.UserModel.IRow row14 = sheet.CreateRow(11 + (JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : (int)(JJXXName.Count() / 3 + 1)));
NPOI.SS.UserModel.ICell cell14 = row14.CreateCell(0, CellType.String);
cell14.SetCellValue("票据信息");
cell14.CellStyle = styleD;
var PJXXCount = 0;
for (int rowIndex = 12 + (JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : (int)(JJXXName.Count() / 3 + 1)); rowIndex < 13 + (JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : (int)(JJXXName.Count() / 3 + 1)) + (PJXXName.Count() % 3 == 0 ? (int)(PJXXName.Count() / 3) : (int)(PJXXName.Count() / 3 + 1)); rowIndex++)
{
NPOI.SS.UserModel.IRow rowN = sheet.CreateRow(rowIndex);
for (int c = 0; c <= 12; c++)
{
if (PJXXCount < PJXXName.Count() && !((c & 1) == 1) && (c != 2 && c != 6 && c != 10 && c != 12))
{
var diValue = (Dictionary<string, object>)li.PJXXValue[0];
var Value = diValue[PJXXName[PJXXCount]];
var cellValue = new HSSFRichTextString(PJXXName[PJXXCount].ToString() + ":" + Value);
var index = PJXXName[PJXXCount].ToString() + ":" + Value;
cellValue.ApplyFont(0, index.IndexOf(":") + 1, font1);
if (index.IndexOf(":") < index.Split(':')[1].Length)
{
cellValue.ApplyFont(index.IndexOf(":") + 1, index.Split(':')[1].Length, fontB);
}
NPOI.SS.UserModel.ICell cellBaseInfo = rowN.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(cellValue);
cellBaseInfo.CellStyle = styleA;
PJXXCount++;
}
else
{
NPOI.SS.UserModel.ICell cellBaseInfo = rowN.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue("");
cellBaseInfo.CellStyle = styleA;
}
//cell.SetCellValue(liName[i].ToString());
}
}
}
if (ZLXXName.Count() > 0)
{
NPOI.SS.UserModel.IRow row14 = sheet.CreateRow(11 + (JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : (int)(JJXXName.Count() / 3 + 1)) + (PJXXName.Count() % 3 == 0 ? (int)(PJXXName.Count() / 3) : (int)(PJXXName.Count() / 3 + 1)));
NPOI.SS.UserModel.ICell cell14 = row14.CreateCell(0, CellType.String);
cell14.SetCellValue("土地/租赁信息");
cell14.CellStyle = styleD;
var ZLXXCount = 0;
for (int rowIndex = 12 + (JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : (int)(JJXXName.Count() / 3 + 1)) + (PJXXName.Count() % 3 == 0 ? (int)(PJXXName.Count() / 3) : (int)(PJXXName.Count() / 3 + 1)); rowIndex < 13 + (JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : (int)(JJXXName.Count() / 3 + 1)) + (PJXXName.Count() % 3 == 0 ? (int)(PJXXName.Count() / 3) : (int)(PJXXName.Count() / 3 + 1)) + (ZLXXName.Count() % 3 == 0 ? (int)(ZLXXName.Count() / 3) : (int)(ZLXXName.Count() / 3 + 1)); rowIndex++)
{
NPOI.SS.UserModel.IRow rowN = sheet.CreateRow(rowIndex);
for (int c = 0; c <= 12; c++)
{
if (ZLXXCount < ZLXXName.Count() && !((c & 1) == 1) && (c != 2 && c != 6 && c != 10 && c != 12))
{
var diValue = (Dictionary<string, object>)li.ZLXXValue[0];
var Value = diValue[ZLXXName[ZLXXCount]];
var cellValue = new HSSFRichTextString(ZLXXName[ZLXXCount].ToString() + ":" + Value);
var index = ZLXXName[ZLXXCount].ToString() + ":" + Value;
cellValue.ApplyFont(0, index.IndexOf(":") + 1, font1);
if (index.IndexOf(":") < index.Split(':')[1].Length)
{
cellValue.ApplyFont(index.IndexOf(":") + 1, index.Split(':')[1].Length, fontB);
}
NPOI.SS.UserModel.ICell cellBaseInfo = rowN.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(cellValue);
cellBaseInfo.CellStyle = styleA;
ZLXXCount++;
}
else
{
NPOI.SS.UserModel.ICell cellBaseInfo = rowN.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue("");
cellBaseInfo.CellStyle = styleA;
}
//cell.SetCellValue(liName[i].ToString());
}
}
}
if (BLXXName.Count() > 0)
{
NPOI.SS.UserModel.IRow row14 = sheet.CreateRow(11 + (JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : (int)(JJXXName.Count() / 3 + 1)) + (PJXXName.Count() % 3 == 0 ? (int)(PJXXName.Count() / 3) : (int)(PJXXName.Count() / 3 + 1)) + (ZLXXName.Count() % 3 == 0 ? (int)(ZLXXName.Count() / 3) : (int)(ZLXXName.Count() / 3 + 1)));
NPOI.SS.UserModel.ICell cell14 = row14.CreateCell(0, CellType.String);
cell14.SetCellValue("融资保理信息");
cell14.CellStyle = styleD;
var BLXXCount = 0;
for (int rowIndex = 12 + (JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : (int)(JJXXName.Count() / 3 + 1)) + (PJXXName.Count() % 3 == 0 ? (int)(PJXXName.Count() / 3) : (int)(PJXXName.Count() / 3 + 1)) + (ZLXXName.Count() % 3 == 0 ? (int)(ZLXXName.Count() / 3) : (int)(ZLXXName.Count() / 3 + 1)); rowIndex < 13 + (JBXXName.Count() > 0 && JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : JBXXName.Count() == 0 ? 0 : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() > 0 && TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : TZXXName.Count() == 0 ? 0 : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() > 0 && JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : JJXXName.Count() == 0 ? 0 : (int)(JJXXName.Count() / 3 + 1)) + (PJXXName.Count() > 0 && PJXXName.Count() % 3 == 0 ? (int)(PJXXName.Count() / 3) : PJXXName.Count() == 0 ? 0 : (int)(PJXXName.Count() / 3 + 1)) + (ZLXXName.Count() > 0 && ZLXXName.Count() % 3 == 0 ? (int)(ZLXXName.Count() / 3) : ZLXXName.Count() == 0 ? 0 : (int)(ZLXXName.Count() / 3 + 1)) + (BLXXName.Count() > 0 && BLXXName.Count() % 3 == 0 ? (int)(BLXXName.Count() / 3) : BLXXName.Count() == 0 ? 0 : (int)(BLXXName.Count() / 3 + 1)); rowIndex++)
{
NPOI.SS.UserModel.IRow rowN = sheet.CreateRow(rowIndex);
for (int c = 0; c <= 12; c++)
{
if (BLXXCount < BLXXName.Count() && !((c & 1) == 1) && (c != 2 && c != 6 && c != 10 && c != 12))
{
var diValue = (Dictionary<string, object>)li.BLXXValue[0];
var Value = diValue[BLXXName[BLXXCount]];
var cellValue = new HSSFRichTextString(BLXXName[BLXXCount].ToString() + ":" + Value);
var index = BLXXName[BLXXCount].ToString() + ":" + Value;
cellValue.ApplyFont(0, index.IndexOf(":") + 1, font1);
if (index.IndexOf(":") < index.Split(':')[1].Length)
{
cellValue.ApplyFont(index.IndexOf(":") + 1, index.Split(':')[1].Length, fontB);
}
NPOI.SS.UserModel.ICell cellBaseInfo = rowN.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(cellValue);
cellBaseInfo.CellStyle = styleA;
BLXXCount++;
}
else
{
NPOI.SS.UserModel.ICell cellBaseInfo = rowN.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue("");
cellBaseInfo.CellStyle = styleA;
}
//cell.SetCellValue(liName[i].ToString());
}
}
}
//我方签约单位
if (li.ContractPartiesunitValue.Count() > 0)
{
var ContractPartiesunitColnum = (List<string>)li.ContractPartiesunitColnum[0];
int titleIndex = 11 + (TZXXName.Count() > 0 ? 1 : 0) + (JJXXName.Count() > 0 ? 1 : 0) + (PJXXName.Count() > 0 ? 1 : 0) + (ZLXXName.Count() > 0 ? 1 : 0) + (BLXXName.Count() > 0 ? 1 : 0) + (JBXXName.Count() > 0 && JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : JBXXName.Count() == 0 ? 0 : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() > 0 && TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : TZXXName.Count() == 0 ? 0 : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() > 0 && JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : JJXXName.Count() == 0 ? 0 : (int)(JJXXName.Count() / 3 + 1)) + (PJXXName.Count() > 0 && PJXXName.Count() % 3 == 0 ? (int)(PJXXName.Count() / 3) : PJXXName.Count() == 0 ? 0 : (int)(PJXXName.Count() / 3 + 1)) + (ZLXXName.Count() > 0 && ZLXXName.Count() % 3 == 0 ? (int)(ZLXXName.Count() / 3) : ZLXXName.Count() == 0 ? 0 : (int)(ZLXXName.Count() / 3 + 1)) + (BLXXName.Count() > 0 && BLXXName.Count() % 3 == 0 ? (int)(BLXXName.Count() / 3) : BLXXName.Count() == 0 ? 0 : (int)(BLXXName.Count() / 3 + 1));
NPOI.SS.UserModel.IRow row18 = sheet.CreateRow(titleIndex);
NPOI.SS.UserModel.ICell cell18 = row18.CreateCell(0, CellType.String);
cell18.SetCellValue("我方签约单位");
cell18.CellStyle = styleD;
sheet.AddMergedRegion(new CellRangeAddress(titleIndex, titleIndex, 0, 12));
int rowCellIndex = 12 + (TZXXName.Count() > 0 ? 1 : 0) + (JJXXName.Count() > 0 ? 1 : 0) + (PJXXName.Count() > 0 ? 1 : 0) + (ZLXXName.Count() > 0 ? 1 : 0) + (BLXXName.Count() > 0 ? 1 : 0) + (JBXXName.Count() > 0 && JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : JBXXName.Count() == 0 ? 0 : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() > 0 && TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : TZXXName.Count() == 0 ? 0 : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() > 0 && JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : JJXXName.Count() == 0 ? 0 : (int)(JJXXName.Count() / 3 + 1)) + (PJXXName.Count() > 0 && PJXXName.Count() % 3 == 0 ? (int)(PJXXName.Count() / 3) : PJXXName.Count() == 0 ? 0 : (int)(PJXXName.Count() / 3 + 1)) + (ZLXXName.Count() > 0 && ZLXXName.Count() % 3 == 0 ? (int)(ZLXXName.Count() / 3) : ZLXXName.Count() == 0 ? 0 : (int)(ZLXXName.Count() / 3 + 1)) + (BLXXName.Count() > 0 && BLXXName.Count() % 3 == 0 ? (int)(BLXXName.Count() / 3) : BLXXName.Count() == 0 ? 0 : (int)(BLXXName.Count() / 3 + 1));
NPOI.SS.UserModel.IRow row19 = sheet.CreateRow(rowCellIndex);
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 0, 3));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 4, 7));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 8, 12));
for (int c = 0; c <= 12; c++)
{
if (c <= 3)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row19.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(ContractPartiesunitColnum[ContractPartiesunitColnum.Count() - ContractPartiesunitColnum.Count()]);
cellBaseInfo.CellStyle = styleA;
}
else if (c >= 4 && c <= 7)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row19.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(ContractPartiesunitColnum[ContractPartiesunitColnum.Count() - (ContractPartiesunitColnum.Count() - 1)]);
cellBaseInfo.CellStyle = styleA;
}
else if (c >= 8 && c <= 12)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row19.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(ContractPartiesunitColnum[ContractPartiesunitColnum.Count() - (ContractPartiesunitColnum.Count() - 2)]);
cellBaseInfo.CellStyle = styleA;
}
}
var ContractPartiesunitValueCount = 0;
for (int rowIndex = rowCellIndex + 1; rowIndex < rowCellIndex + li.ContractPartiesunitValue.Count() + 1; rowIndex++)
{
var diValue = (Dictionary<string, object>)li.ContractPartiesunitValue[ContractPartiesunitValueCount];
NPOI.SS.UserModel.IRow row24 = sheet.CreateRow(rowIndex);
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 3));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 4, 7));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 8, 12));
for (int c = 0; c <= 12; c++)
{
if (c <= 3)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[ContractPartiesunitColnum[ContractPartiesunitColnum.Count() - ContractPartiesunitColnum.Count()]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else if (c >= 4 && c <= 7)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[ContractPartiesunitColnum[ContractPartiesunitColnum.Count() - (ContractPartiesunitColnum.Count() - 1)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else if (c >= 8 && c <= 12)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[ContractPartiesunitColnum[ContractPartiesunitColnum.Count() - (ContractPartiesunitColnum.Count() - 2)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
}
ContractPartiesunitValueCount++;
}
}
////实际履约主体
if (li.SJLYDWValue.Count() > 0)
{
var SJLYDWColnum = (List<string>)li.SJLYDWColnum[0];
int titleIndex = 11 + (TZXXName.Count() > 0 ? 1 : 0) + (JJXXName.Count() > 0 ? 1 : 0) + (PJXXName.Count() > 0 ? 1 : 0) + (ZLXXName.Count() > 0 ? 1 : 0) + (BLXXName.Count() > 0 ? 1 : 0) + (li.ContractPartiesunitValue.Count() > 0 ? 1 : 0) + (JBXXName.Count() > 0 && JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : JBXXName.Count() == 0 ? 0 : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() > 0 && TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : TZXXName.Count() == 0 ? 0 : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() > 0 && JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : JJXXName.Count() == 0 ? 0 : (int)(JJXXName.Count() / 3 + 1)) + (PJXXName.Count() > 0 && PJXXName.Count() % 3 == 0 ? (int)(PJXXName.Count() / 3) : PJXXName.Count() == 0 ? 0 : (int)(PJXXName.Count() / 3 + 1)) + (ZLXXName.Count() > 0 && ZLXXName.Count() % 3 == 0 ? (int)(ZLXXName.Count() / 3) : ZLXXName.Count() == 0 ? 0 : (int)(ZLXXName.Count() / 3 + 1)) + (BLXXName.Count() > 0 && BLXXName.Count() % 3 == 0 ? (int)(BLXXName.Count() / 3) : BLXXName.Count() == 0 ? 0 : (int)(BLXXName.Count() / 3 + 1)) + (li.ContractPartiesunitValue.Count() > 0 ? li.ContractPartiesunitColnum.Count() : 0) + li.ContractPartiesunitValue.Count();
NPOI.SS.UserModel.IRow row20 = sheet.CreateRow(titleIndex);
NPOI.SS.UserModel.ICell cell20 = row20.CreateCell(0, CellType.String);
cell20.SetCellValue("实际履约主体");
cell20.CellStyle = styleD;
sheet.AddMergedRegion(new CellRangeAddress(titleIndex, titleIndex, 0, 12));
int rowCellIndex = 12 + (TZXXName.Count() > 0 ? 1 : 0) + (JJXXName.Count() > 0 ? 1 : 0) + (PJXXName.Count() > 0 ? 1 : 0) + (ZLXXName.Count() > 0 ? 1 : 0) + (BLXXName.Count() > 0 ? 1 : 0) + (li.ContractPartiesunitValue.Count() > 0 ? 1 : 0) + (JBXXName.Count() > 0 && JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : JBXXName.Count() == 0 ? 0 : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() > 0 && TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : TZXXName.Count() == 0 ? 0 : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() > 0 && JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : JJXXName.Count() == 0 ? 0 : (int)(JJXXName.Count() / 3 + 1)) + (PJXXName.Count() > 0 && PJXXName.Count() % 3 == 0 ? (int)(PJXXName.Count() / 3) : PJXXName.Count() == 0 ? 0 : (int)(PJXXName.Count() / 3 + 1)) + (ZLXXName.Count() > 0 && ZLXXName.Count() % 3 == 0 ? (int)(ZLXXName.Count() / 3) : ZLXXName.Count() == 0 ? 0 : (int)(ZLXXName.Count() / 3 + 1)) + (BLXXName.Count() > 0 && BLXXName.Count() % 3 == 0 ? (int)(BLXXName.Count() / 3) : BLXXName.Count() == 0 ? 0 : (int)(BLXXName.Count() / 3 + 1)) + (li.ContractPartiesunitValue.Count() > 0 ? li.ContractPartiesunitColnum.Count() : 0) + li.ContractPartiesunitValue.Count();
NPOI.SS.UserModel.IRow row21 = sheet.CreateRow(rowCellIndex);
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 0, 1));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 2, 4));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 5, 7));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 8, 9));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 10, 12));
for (int c = 0; c <= 12; c++)
{
if (c <= 1)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row21.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(SJLYDWColnum[SJLYDWColnum.Count() - SJLYDWColnum.Count()]);
cellBaseInfo.CellStyle = styleA;
}
else if (c <= 4)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row21.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(SJLYDWColnum[SJLYDWColnum.Count() - (SJLYDWColnum.Count() - 1)]);
cellBaseInfo.CellStyle = styleA;
}
else if (c <= 7)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row21.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(SJLYDWColnum[SJLYDWColnum.Count() - (SJLYDWColnum.Count() - 2)]);
cellBaseInfo.CellStyle = styleA;
}
else if (c <= 9)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row21.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(SJLYDWColnum[SJLYDWColnum.Count() - (SJLYDWColnum.Count() - 3)]);
cellBaseInfo.CellStyle = styleA;
}
else if (c <= 12)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row21.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(SJLYDWColnum[SJLYDWColnum.Count() - (SJLYDWColnum.Count() - 4)]);
cellBaseInfo.CellStyle = styleA;
}
}
var SJLYDWValueCount = 0;
for (int rowIndex = rowCellIndex + 1; rowIndex < rowCellIndex + li.SJLYDWValue.Count() + 1; rowIndex++)
{
var diValue = (Dictionary<string, object>)li.SJLYDWValue[SJLYDWValueCount];
NPOI.SS.UserModel.IRow row24 = sheet.CreateRow(rowIndex);
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 1));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 2, 4));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 5, 7));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 8, 9));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 10, 12));
for (int c = 0; c <= 12; c++)
{
if (c <= 1)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[SJLYDWColnum[SJLYDWColnum.Count() - SJLYDWColnum.Count()]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else if (c <= 4)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[SJLYDWColnum[SJLYDWColnum.Count() - (SJLYDWColnum.Count() - 1)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else if (c <= 7)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[SJLYDWColnum[SJLYDWColnum.Count() - (SJLYDWColnum.Count() - 2)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else if (c <= 9)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[SJLYDWColnum[SJLYDWColnum.Count() - (SJLYDWColnum.Count() - 3)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else if (c <= 12)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[SJLYDWColnum[SJLYDWColnum.Count() - (SJLYDWColnum.Count() - 4)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
}
SJLYDWValueCount++;
}
}
////保证金信息
if (li.BZJXXValue.Count() > 0)
{
var BZJXXColnum = (List<string>)li.BZJXXColnum[0];
int titleIndex = 11 + (TZXXName.Count() > 0 ? 1 : 0) + (JJXXName.Count() > 0 ? 1 : 0) + (PJXXName.Count() > 0 ? 1 : 0) + (ZLXXName.Count() > 0 ? 1 : 0) + (BLXXName.Count() > 0 ? 1 : 0) + (li.ContractPartiesunitValue.Count() > 0 ? 1 : 0) + (li.SJLYDWValue.Count() > 0 ? 1 : 0) + (JBXXName.Count() > 0 && JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : JBXXName.Count() == 0 ? 0 : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() > 0 && TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : TZXXName.Count() == 0 ? 0 : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() > 0 && JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : JJXXName.Count() == 0 ? 0 : (int)(JJXXName.Count() / 3 + 1)) + (PJXXName.Count() > 0 && PJXXName.Count() % 3 == 0 ? (int)(PJXXName.Count() / 3) : PJXXName.Count() == 0 ? 0 : (int)(PJXXName.Count() / 3 + 1)) + (ZLXXName.Count() > 0 && ZLXXName.Count() % 3 == 0 ? (int)(ZLXXName.Count() / 3) : ZLXXName.Count() == 0 ? 0 : (int)(ZLXXName.Count() / 3 + 1)) + (BLXXName.Count() > 0 && BLXXName.Count() % 3 == 0 ? (int)(BLXXName.Count() / 3) : BLXXName.Count() == 0 ? 0 : (int)(BLXXName.Count() / 3 + 1)) + (li.ContractPartiesunitValue.Count() > 0 ? li.ContractPartiesunitColnum.Count() : 0) + (li.SJLYDWValue.Count() > 0 ? li.SJLYDWColnum.Count() : 0) + li.ContractPartiesunitValue.Count() + li.SJLYDWValue.Count();
NPOI.SS.UserModel.IRow row22 = sheet.CreateRow(titleIndex);
NPOI.SS.UserModel.ICell cell22 = row22.CreateCell(0, CellType.String);
cell22.SetCellValue("保证金信息");
cell22.CellStyle = styleD;
sheet.AddMergedRegion(new CellRangeAddress(titleIndex, titleIndex, 0, 12));
int rowCellIndex = 12 + (TZXXName.Count() > 0 ? 1 : 0) + (JJXXName.Count() > 0 ? 1 : 0) + (PJXXName.Count() > 0 ? 1 : 0) + (ZLXXName.Count() > 0 ? 1 : 0) + (BLXXName.Count() > 0 ? 1 : 0) + (li.ContractPartiesunitValue.Count() > 0 ? 1 : 0) + (li.SJLYDWValue.Count() > 0 ? 1 : 0) + (JBXXName.Count() > 0 && JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : JBXXName.Count() == 0 ? 0 : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() > 0 && TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : TZXXName.Count() == 0 ? 0 : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() > 0 && JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : JJXXName.Count() == 0 ? 0 : (int)(JJXXName.Count() / 3 + 1)) + (PJXXName.Count() > 0 && PJXXName.Count() % 3 == 0 ? (int)(PJXXName.Count() / 3) : PJXXName.Count() == 0 ? 0 : (int)(PJXXName.Count() / 3 + 1)) + (ZLXXName.Count() > 0 && ZLXXName.Count() % 3 == 0 ? (int)(ZLXXName.Count() / 3) : ZLXXName.Count() == 0 ? 0 : (int)(ZLXXName.Count() / 3 + 1)) + (BLXXName.Count() > 0 && BLXXName.Count() % 3 == 0 ? (int)(BLXXName.Count() / 3) : BLXXName.Count() == 0 ? 0 : (int)(BLXXName.Count() / 3 + 1)) + (li.ContractPartiesunitValue.Count() > 0 ? li.ContractPartiesunitColnum.Count() : 0) + (li.SJLYDWValue.Count() > 0 ? li.SJLYDWColnum.Count() : 0) + li.ContractPartiesunitValue.Count() + li.SJLYDWValue.Count();
NPOI.SS.UserModel.IRow row23 = sheet.CreateRow(rowCellIndex);
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 0, 1));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 2, 4));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 5, 7));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 8, 9));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 10, 12));
for (int c = 0; c <= 12; c++)
{
//NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
//cellBaseInfo.SetCellValue(BZJXXColnum[c]);
//cellBaseInfo.CellStyle = styleA;
if (c <= 1)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(BZJXXColnum[BZJXXColnum.Count() - BZJXXColnum.Count()]);
cellBaseInfo.CellStyle = styleA;
}
else if (c <= 4)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(BZJXXColnum[BZJXXColnum.Count() - (BZJXXColnum.Count() - 1)]);
cellBaseInfo.CellStyle = styleA;
}
else if (c <= 7)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(BZJXXColnum[BZJXXColnum.Count() - (BZJXXColnum.Count() - 2)]);
cellBaseInfo.CellStyle = styleA;
}
else if (c <= 9)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(BZJXXColnum[BZJXXColnum.Count() - (BZJXXColnum.Count() - 3)]);
cellBaseInfo.CellStyle = styleA;
}
else if (c <= 12)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(BZJXXColnum[BZJXXColnum.Count() - (BZJXXColnum.Count() - 4)]);
cellBaseInfo.CellStyle = styleA;
}
}
var BZJXXValueCount = 0;
for (int rowIndex = rowCellIndex + 1; rowIndex < rowCellIndex + li.BZJXXValue.Count() + 1; rowIndex++)
{
var diValue = (Dictionary<string, object>)li.BZJXXValue[BZJXXValueCount];
NPOI.SS.UserModel.IRow row24 = sheet.CreateRow(rowIndex);
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 1));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 2, 4));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 5, 7));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 8, 9));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 10, 12));
for (int c = 0; c <= 12; c++)
{
if (c <= 1)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[BZJXXColnum[BZJXXColnum.Count() - BZJXXColnum.Count()]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else if (c <= 4)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[BZJXXColnum[BZJXXColnum.Count() - (BZJXXColnum.Count() - 1)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else if (c <= 7)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[BZJXXColnum[BZJXXColnum.Count() - (BZJXXColnum.Count() - 2)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else if (c <= 12)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[BZJXXColnum[BZJXXColnum.Count() - (BZJXXColnum.Count() - 3)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
}
BZJXXValueCount++;
}
}
//担保信息
if (li.DBXXValue.Count() > 0)
{
var DBXXColnum = (List<string>)li.DBXXColnum[0];
int titleIndex = 11 + (TZXXName.Count() > 0 ? 1 : 0) + (JJXXName.Count() > 0 ? 1 : 0) + (PJXXName.Count() > 0 ? 1 : 0) + (ZLXXName.Count() > 0 ? 1 : 0) + (BLXXName.Count() > 0 ? 1 : 0) + (li.ContractPartiesunitValue.Count() > 0 ? 1 : 0) + (li.SJLYDWValue.Count() > 0 ? 1 : 0) + (li.BZJXXValue.Count > 0 ? 1 : 0) + (JBXXName.Count() > 0 && JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : JBXXName.Count() == 0 ? 0 : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() > 0 && TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : TZXXName.Count() == 0 ? 0 : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() > 0 && JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : JJXXName.Count() == 0 ? 0 : (int)(JJXXName.Count() / 3 + 1)) + (PJXXName.Count() > 0 && PJXXName.Count() % 3 == 0 ? (int)(PJXXName.Count() / 3) : PJXXName.Count() == 0 ? 0 : (int)(PJXXName.Count() / 3 + 1)) + (ZLXXName.Count() > 0 && ZLXXName.Count() % 3 == 0 ? (int)(ZLXXName.Count() / 3) : ZLXXName.Count() == 0 ? 0 : (int)(ZLXXName.Count() / 3 + 1)) + (BLXXName.Count() > 0 && BLXXName.Count() % 3 == 0 ? (int)(BLXXName.Count() / 3) : BLXXName.Count() == 0 ? 0 : (int)(BLXXName.Count() / 3 + 1)) + (li.ContractPartiesunitValue.Count() > 0 ? li.ContractPartiesunitColnum.Count() : 0) + (li.SJLYDWValue.Count() > 0 ? li.SJLYDWColnum.Count() : 0) + (li.BZJXXValue.Count() > 0 ? li.BZJXXColnum.Count() : 0) + li.ContractPartiesunitValue.Count() + li.SJLYDWValue.Count() + li.BZJXXValue.Count();
NPOI.SS.UserModel.IRow row22 = sheet.CreateRow(titleIndex);
NPOI.SS.UserModel.ICell cell22 = row22.CreateCell(0, CellType.String);
cell22.SetCellValue("担保信息");
cell22.CellStyle = styleD;
sheet.AddMergedRegion(new CellRangeAddress(titleIndex, titleIndex, 0, 12));
int rowCellIndex = 12 + (TZXXName.Count() > 0 ? 1 : 0) + (JJXXName.Count() > 0 ? 1 : 0) + (PJXXName.Count() > 0 ? 1 : 0) + (ZLXXName.Count() > 0 ? 1 : 0) + (BLXXName.Count() > 0 ? 1 : 0) + (li.ContractPartiesunitValue.Count() > 0 ? 1 : 0) + (li.SJLYDWValue.Count() > 0 ? 1 : 0) + (li.BZJXXValue.Count > 0 ? 1 : 0) + (JBXXName.Count() > 0 && JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : JBXXName.Count() == 0 ? 0 : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() > 0 && TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : TZXXName.Count() == 0 ? 0 : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() > 0 && JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : JJXXName.Count() == 0 ? 0 : (int)(JJXXName.Count() / 3 + 1)) + (PJXXName.Count() > 0 && PJXXName.Count() % 3 == 0 ? (int)(PJXXName.Count() / 3) : PJXXName.Count() == 0 ? 0 : (int)(PJXXName.Count() / 3 + 1)) + (ZLXXName.Count() > 0 && ZLXXName.Count() % 3 == 0 ? (int)(ZLXXName.Count() / 3) : ZLXXName.Count() == 0 ? 0 : (int)(ZLXXName.Count() / 3 + 1)) + (BLXXName.Count() > 0 && BLXXName.Count() % 3 == 0 ? (int)(BLXXName.Count() / 3) : BLXXName.Count() == 0 ? 0 : (int)(BLXXName.Count() / 3 + 1)) + (li.ContractPartiesunitValue.Count() > 0 ? li.ContractPartiesunitColnum.Count() : 0) + (li.SJLYDWValue.Count() > 0 ? li.SJLYDWColnum.Count() : 0) + (li.BZJXXValue.Count() > 0 ? li.BZJXXColnum.Count() : 0) + li.ContractPartiesunitValue.Count() + li.SJLYDWValue.Count() + li.BZJXXValue.Count();
NPOI.SS.UserModel.IRow row23 = sheet.CreateRow(rowCellIndex);
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 0, 1));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 2, 4));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 5, 6));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 7, 8));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 9, 12));
for (int c = 0; c <= 12; c++)
{
//NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
//cellBaseInfo.SetCellValue(DBXXColnum[c]);
//cellBaseInfo.CellStyle = styleA;
if (c <= 1)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(DBXXColnum[DBXXColnum.Count() - DBXXColnum.Count()]);
cellBaseInfo.CellStyle = styleA;
}
else if (c <= 4)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(DBXXColnum[DBXXColnum.Count() - (DBXXColnum.Count() - 1)]);
cellBaseInfo.CellStyle = styleA;
}
else if (c <= 6)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(DBXXColnum[DBXXColnum.Count() - (DBXXColnum.Count() - 2)]);
cellBaseInfo.CellStyle = styleA;
}
else if (c <= 8)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(DBXXColnum[DBXXColnum.Count() - (DBXXColnum.Count() - 3)]);
cellBaseInfo.CellStyle = styleA;
}
else if (c <= 12)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(DBXXColnum[DBXXColnum.Count() - (DBXXColnum.Count() - 4)]);
cellBaseInfo.CellStyle = styleA;
}
}
var DBXXValueCount = 0;
for (int rowIndex = rowCellIndex + 1; rowIndex < rowCellIndex + li.DBXXValue.Count() + 1; rowIndex++)
{
var diValue = (Dictionary<string, object>)li.DBXXValue[DBXXValueCount];
NPOI.SS.UserModel.IRow row24 = sheet.CreateRow(rowIndex);
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 1));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 2, 4));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 5, 6));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 7, 8));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 9, 12));
for (int c = 0; c <= 12; c++)
{
if (c <= 1)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[DBXXColnum[DBXXColnum.Count() - DBXXColnum.Count()]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else if (c <= 4)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[DBXXColnum[DBXXColnum.Count() - (DBXXColnum.Count() - 1)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else if (c <= 6)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[DBXXColnum[DBXXColnum.Count() - (DBXXColnum.Count() - 2)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else if (c <= 8)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[DBXXColnum[DBXXColnum.Count() - (DBXXColnum.Count() - 3)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else if (c <= 12)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[DBXXColnum[DBXXColnum.Count() - (DBXXColnum.Count() - 4)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
}
DBXXValueCount++;
}
}
////股东信息
if (li.GDXXValue.Count() > 0)
{
var GDXXColnum = (List<string>)li.GDXXColnum[0];
int titleIndex = 11 + (TZXXName.Count() > 0 ? 1 : 0) + (JJXXName.Count() > 0 ? 1 : 0) + (PJXXName.Count() > 0 ? 1 : 0) + (ZLXXName.Count() > 0 ? 1 : 0) + (BLXXName.Count() > 0 ? 1 : 0) + (li.ContractPartiesunitValue.Count() > 0 ? 1 : 0) + (li.SJLYDWValue.Count() > 0 ? 1 : 0) + (li.BZJXXValue.Count > 0 ? 1 : 0) + (li.DBXXValue.Count() > 0 ? 1 : 0) + (JBXXName.Count() > 0 && JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : JBXXName.Count() == 0 ? 0 : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() > 0 && TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : TZXXName.Count() == 0 ? 0 : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() > 0 && JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : JJXXName.Count() == 0 ? 0 : (int)(JJXXName.Count() / 3 + 1)) + (PJXXName.Count() > 0 && PJXXName.Count() % 3 == 0 ? (int)(PJXXName.Count() / 3) : PJXXName.Count() == 0 ? 0 : (int)(PJXXName.Count() / 3 + 1)) + (ZLXXName.Count() > 0 && ZLXXName.Count() % 3 == 0 ? (int)(ZLXXName.Count() / 3) : ZLXXName.Count() == 0 ? 0 : (int)(ZLXXName.Count() / 3 + 1)) + (BLXXName.Count() > 0 && BLXXName.Count() % 3 == 0 ? (int)(BLXXName.Count() / 3) : BLXXName.Count() == 0 ? 0 : (int)(BLXXName.Count() / 3 + 1)) + (li.ContractPartiesunitValue.Count() > 0 ? li.ContractPartiesunitColnum.Count() : 0) + (li.SJLYDWValue.Count() > 0 ? li.SJLYDWColnum.Count() : 0) + (li.BZJXXValue.Count() > 0 ? li.BZJXXColnum.Count() : 0) + (li.DBXXValue.Count() > 0 ? li.DBXXColnum.Count() : 0) + li.ContractPartiesunitValue.Count() + li.SJLYDWValue.Count() + li.BZJXXValue.Count() + li.DBXXValue.Count();
NPOI.SS.UserModel.IRow row22 = sheet.CreateRow(titleIndex);
NPOI.SS.UserModel.ICell cell22 = row22.CreateCell(0, CellType.String);
cell22.SetCellValue("股东信息");
cell22.CellStyle = styleD;
sheet.AddMergedRegion(new CellRangeAddress(titleIndex, titleIndex, 0, 12));
int rowCellIndex = 12 + (TZXXName.Count() > 0 ? 1 : 0) + (JJXXName.Count() > 0 ? 1 : 0) + (PJXXName.Count() > 0 ? 1 : 0) + (ZLXXName.Count() > 0 ? 1 : 0) + (BLXXName.Count() > 0 ? 1 : 0) + (li.ContractPartiesunitValue.Count() > 0 ? 1 : 0) + (li.SJLYDWValue.Count() > 0 ? 1 : 0) + (li.BZJXXValue.Count > 0 ? 1 : 0) + (li.DBXXValue.Count() > 0 ? 1 : 0) + (JBXXName.Count() > 0 && JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : JBXXName.Count() == 0 ? 0 : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() > 0 && TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : TZXXName.Count() == 0 ? 0 : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() > 0 && JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : JJXXName.Count() == 0 ? 0 : (int)(JJXXName.Count() / 3 + 1)) + (PJXXName.Count() > 0 && PJXXName.Count() % 3 == 0 ? (int)(PJXXName.Count() / 3) : PJXXName.Count() == 0 ? 0 : (int)(PJXXName.Count() / 3 + 1)) + (ZLXXName.Count() > 0 && ZLXXName.Count() % 3 == 0 ? (int)(ZLXXName.Count() / 3) : ZLXXName.Count() == 0 ? 0 : (int)(ZLXXName.Count() / 3 + 1)) + (BLXXName.Count() > 0 && BLXXName.Count() % 3 == 0 ? (int)(BLXXName.Count() / 3) : BLXXName.Count() == 0 ? 0 : (int)(BLXXName.Count() / 3 + 1)) + (li.ContractPartiesunitValue.Count() > 0 ? li.ContractPartiesunitColnum.Count() : 0) + (li.SJLYDWValue.Count() > 0 ? li.SJLYDWColnum.Count() : 0) + (li.BZJXXValue.Count() > 0 ? li.BZJXXColnum.Count() : 0) + (li.DBXXValue.Count() > 0 ? li.DBXXColnum.Count() : 0) + li.ContractPartiesunitValue.Count() + li.SJLYDWValue.Count() + li.BZJXXValue.Count() + li.DBXXValue.Count();
NPOI.SS.UserModel.IRow row23 = sheet.CreateRow(rowCellIndex);
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 0, 1));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 2, 3));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 4, 5));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 6, 7));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 8, 9));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 10, 12));
for (int c = 0; c <= 12; c++)
{
//NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
//cellBaseInfo.SetCellValue(GDXXColnum[c]);
//cellBaseInfo.CellStyle = styleA;
if (c <= 1)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(GDXXColnum[GDXXColnum.Count() - GDXXColnum.Count()]);
cellBaseInfo.CellStyle = styleA;
}
else if (c <= 3)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(GDXXColnum[GDXXColnum.Count() - (GDXXColnum.Count() - 1)]);
cellBaseInfo.CellStyle = styleA;
}
else if (c <= 5)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(GDXXColnum[GDXXColnum.Count() - (GDXXColnum.Count() - 2)]);
cellBaseInfo.CellStyle = styleA;
}
else if (c <= 7)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(GDXXColnum[GDXXColnum.Count() - (GDXXColnum.Count() - 3)]);
cellBaseInfo.CellStyle = styleA;
}
else if (c <= 9)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(GDXXColnum[GDXXColnum.Count() - (GDXXColnum.Count() - 4)]);
cellBaseInfo.CellStyle = styleA;
}
else if (c <= 12)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(GDXXColnum[GDXXColnum.Count() - (GDXXColnum.Count() - 5)]);
cellBaseInfo.CellStyle = styleA;
}
}
var GDXXValueCount = 0;
for (int rowIndex = rowCellIndex + 1; rowIndex < rowCellIndex + li.GDXXValue.Count() + 1; rowIndex++)
{
var diValue = (Dictionary<string, object>)li.GDXXValue[GDXXValueCount];
NPOI.SS.UserModel.IRow row24 = sheet.CreateRow(rowIndex);
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 1));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 2, 3));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 4, 5));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 6, 7));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 8, 9));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 10, 12));
for (int c = 0; c <= 12; c++)
{
if (c <= 1)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[GDXXColnum[GDXXColnum.Count() - GDXXColnum.Count()]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else if (c <= 3)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[GDXXColnum[GDXXColnum.Count() - (GDXXColnum.Count() - 1)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else if (c <= 5)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[GDXXColnum[GDXXColnum.Count() - (GDXXColnum.Count() - 2)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else if (c <= 7)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[GDXXColnum[GDXXColnum.Count() - (GDXXColnum.Count() - 3)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else if (c <= 9)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[GDXXColnum[GDXXColnum.Count() - (GDXXColnum.Count() - 4)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else if (c <= 12)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[GDXXColnum[GDXXColnum.Count() - (GDXXColnum.Count() - 5)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
}
GDXXValueCount++;
}
}
////保险信息
if (li.BXXXValue.Count() > 0)
{
var BXXXColnum = (List<string>)li.BXXXColnum[0];
int titleIndex = 11 + (TZXXName.Count() > 0 ? 1 : 0) + (JJXXName.Count() > 0 ? 1 : 0) + (PJXXName.Count() > 0 ? 1 : 0) + (ZLXXName.Count() > 0 ? 1 : 0) + (BLXXName.Count() > 0 ? 1 : 0) + (li.ContractPartiesunitValue.Count() > 0 ? 1 : 0) + (li.SJLYDWValue.Count() > 0 ? 1 : 0) + (li.BZJXXValue.Count > 0 ? 1 : 0) + (li.DBXXValue.Count() > 0 ? 1 : 0) + (li.GDXXValue.Count() > 0 ? 1 : 0) + (JBXXName.Count() > 0 && JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : JBXXName.Count() == 0 ? 0 : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() > 0 && TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : TZXXName.Count() == 0 ? 0 : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() > 0 && JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : JJXXName.Count() == 0 ? 0 : (int)(JJXXName.Count() / 3 + 1)) + (PJXXName.Count() > 0 && PJXXName.Count() % 3 == 0 ? (int)(PJXXName.Count() / 3) : PJXXName.Count() == 0 ? 0 : (int)(PJXXName.Count() / 3 + 1)) + (ZLXXName.Count() > 0 && ZLXXName.Count() % 3 == 0 ? (int)(ZLXXName.Count() / 3) : ZLXXName.Count() == 0 ? 0 : (int)(ZLXXName.Count() / 3 + 1)) + (BLXXName.Count() > 0 && BLXXName.Count() % 3 == 0 ? (int)(BLXXName.Count() / 3) : BLXXName.Count() == 0 ? 0 : (int)(BLXXName.Count() / 3 + 1)) + (li.ContractPartiesunitValue.Count() > 0 ? li.ContractPartiesunitColnum.Count() : 0) + (li.SJLYDWValue.Count() > 0 ? li.SJLYDWColnum.Count() : 0) + (li.BZJXXValue.Count() > 0 ? li.BZJXXColnum.Count() + li.DBXXColnum.Count() : 0) + (li.GDXXValue.Count() > 0 ? li.GDXXColnum.Count() : 0) + li.ContractPartiesunitValue.Count() + li.SJLYDWValue.Count() + li.BZJXXValue.Count() + li.DBXXValue.Count() + li.GDXXValue.Count();
NPOI.SS.UserModel.IRow row22 = sheet.CreateRow(titleIndex);
NPOI.SS.UserModel.ICell cell22 = row22.CreateCell(0, CellType.String);
cell22.SetCellValue("保险信息");
cell22.CellStyle = styleD;
sheet.AddMergedRegion(new CellRangeAddress(titleIndex, titleIndex, 0, 12));
int rowCellIndex = 12 + (TZXXName.Count() > 0 ? 1 : 0) + (JJXXName.Count() > 0 ? 1 : 0) + (PJXXName.Count() > 0 ? 1 : 0) + (ZLXXName.Count() > 0 ? 1 : 0) + (BLXXName.Count() > 0 ? 1 : 0) + (li.ContractPartiesunitValue.Count() > 0 ? 1 : 0) + (li.SJLYDWValue.Count() > 0 ? 1 : 0) + (li.BZJXXValue.Count > 0 ? 1 : 0) + (li.DBXXValue.Count() > 0 ? 1 : 0) + (li.GDXXValue.Count() > 0 ? 1 : 0) + (JBXXName.Count() > 0 && JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : JBXXName.Count() == 0 ? 0 : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() > 0 && TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : TZXXName.Count() == 0 ? 0 : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() > 0 && JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : JJXXName.Count() == 0 ? 0 : (int)(JJXXName.Count() / 3 + 1)) + (PJXXName.Count() > 0 && PJXXName.Count() % 3 == 0 ? (int)(PJXXName.Count() / 3) : PJXXName.Count() == 0 ? 0 : (int)(PJXXName.Count() / 3 + 1)) + (ZLXXName.Count() > 0 && ZLXXName.Count() % 3 == 0 ? (int)(ZLXXName.Count() / 3) : ZLXXName.Count() == 0 ? 0 : (int)(ZLXXName.Count() / 3 + 1)) + (BLXXName.Count() > 0 && BLXXName.Count() % 3 == 0 ? (int)(BLXXName.Count() / 3) : BLXXName.Count() == 0 ? 0 : (int)(BLXXName.Count() / 3 + 1)) + (li.ContractPartiesunitValue.Count() > 0 ? li.ContractPartiesunitColnum.Count() : 0) + (li.SJLYDWValue.Count() > 0 ? li.SJLYDWColnum.Count() : 0) + (li.BZJXXValue.Count() > 0 ? li.BZJXXColnum.Count() + li.DBXXColnum.Count() : 0) + (li.GDXXValue.Count() > 0 ? li.GDXXColnum.Count() : 0) + li.ContractPartiesunitValue.Count() + li.SJLYDWValue.Count() + li.BZJXXValue.Count() + li.DBXXValue.Count() + li.GDXXValue.Count();
NPOI.SS.UserModel.IRow row23 = sheet.CreateRow(rowCellIndex);
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 0, 3));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 4, 7));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 8, 12));
for (int c = 0; c <= 12; c++)
{
//NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
//cellBaseInfo.SetCellValue(BXXXColnum[c]);
//cellBaseInfo.CellStyle = styleA;
if (c <= 3)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(BXXXColnum[BXXXColnum.Count() - BXXXColnum.Count()]);
cellBaseInfo.CellStyle = styleA;
}
else if (c >= 4 && c <= 7)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(BXXXColnum[BXXXColnum.Count() - (BXXXColnum.Count() - 1)]);
cellBaseInfo.CellStyle = styleA;
}
else if (c >= 8 && c <= 12)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(BXXXColnum[BXXXColnum.Count() - (BXXXColnum.Count() - 2)]);
cellBaseInfo.CellStyle = styleA;
}
}
var BXXXValueCount = 0;
for (int rowIndex = rowCellIndex + 1; rowIndex < rowCellIndex + li.BXXXValue.Count() + 1; rowIndex++)
{
var diValue = (Dictionary<string, object>)li.BXXXValue[BXXXValueCount];
NPOI.SS.UserModel.IRow row24 = sheet.CreateRow(rowIndex);
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 3));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 4, 7));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 8, 12));
for (int c = 0; c <= 12; c++)
{
if (c <= 3)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[BXXXColnum[BXXXColnum.Count() - BXXXColnum.Count()]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else if (c >= 4 && c <= 7)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[BXXXColnum[BXXXColnum.Count() - (BXXXColnum.Count() - 1)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else if (c >= 8 && c <= 12)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[BXXXColnum[BXXXColnum.Count() - (BXXXColnum.Count() - 2)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
}
BXXXValueCount++;
}
}
////担保信息
if (li.DBXX2Value.Count() > 0)
{
var DBXX2Colnum = (List<string>)li.DBXX2Colnum[0];
int titleIndex = 11 + (TZXXName.Count() > 0 ? 1 : 0) + (JJXXName.Count() > 0 ? 1 : 0) + (PJXXName.Count() > 0 ? 1 : 0) + (ZLXXName.Count() > 0 ? 1 : 0) + (BLXXName.Count() > 0 ? 1 : 0) + (li.ContractPartiesunitValue.Count() > 0 ? 1 : 0) + (li.SJLYDWValue.Count() > 0 ? 1 : 0) + (li.BZJXXValue.Count > 0 ? 1 : 0) + (li.DBXXValue.Count() > 0 ? 1 : 0) + (li.GDXXValue.Count() > 0 ? 1 : 0) + (li.BXXXValue.Count() > 0 ? 1 : 0) + (JBXXName.Count() > 0 && JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : JBXXName.Count() == 0 ? 0 : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() > 0 && TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : TZXXName.Count() == 0 ? 0 : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() > 0 && JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : JJXXName.Count() == 0 ? 0 : (int)(JJXXName.Count() / 3 + 1)) + (PJXXName.Count() > 0 && PJXXName.Count() % 3 == 0 ? (int)(PJXXName.Count() / 3) : PJXXName.Count() == 0 ? 0 : (int)(PJXXName.Count() / 3 + 1)) + (ZLXXName.Count() > 0 && ZLXXName.Count() % 3 == 0 ? (int)(ZLXXName.Count() / 3) : ZLXXName.Count() == 0 ? 0 : (int)(ZLXXName.Count() / 3 + 1)) + (BLXXName.Count() > 0 && BLXXName.Count() % 3 == 0 ? (int)(BLXXName.Count() / 3) : BLXXName.Count() == 0 ? 0 : (int)(BLXXName.Count() / 3 + 1)) + (li.ContractPartiesunitValue.Count() > 0 ? li.ContractPartiesunitColnum.Count() : 0) + (li.SJLYDWValue.Count() > 0 ? li.SJLYDWColnum.Count() : 0) + (li.BZJXXValue.Count() > 0 ? li.BZJXXColnum.Count() : 0) + (li.DBXXValue.Count() > 0 ? li.DBXXColnum.Count() : 0) + (li.GDXXValue.Count() > 0 ? li.GDXXColnum.Count() : 0) + (li.BXXXValue.Count() > 0 ? li.BXXXColnum.Count() : 0) + li.ContractPartiesunitValue.Count() + li.SJLYDWValue.Count() + li.BZJXXValue.Count() + li.DBXXValue.Count() + li.GDXXColnum.Count() + li.BXXXValue.Count();
NPOI.SS.UserModel.IRow row22 = sheet.CreateRow(titleIndex);
NPOI.SS.UserModel.ICell cell22 = row22.CreateCell(0, CellType.String);
cell22.SetCellValue("担保信息");
cell22.CellStyle = styleD;
sheet.AddMergedRegion(new CellRangeAddress(titleIndex, titleIndex, 0, 12));
int rowCellIndex = 12 + (TZXXName.Count() > 0 ? 1 : 0) + (JJXXName.Count() > 0 ? 1 : 0) + (PJXXName.Count() > 0 ? 1 : 0) + (ZLXXName.Count() > 0 ? 1 : 0) + (BLXXName.Count() > 0 ? 1 : 0) + (li.ContractPartiesunitValue.Count() > 0 ? 1 : 0) + (li.SJLYDWValue.Count() > 0 ? 1 : 0) + (li.BZJXXValue.Count > 0 ? 1 : 0) + (li.DBXXValue.Count() > 0 ? 1 : 0) + (li.GDXXValue.Count() > 0 ? 1 : 0) + (li.BXXXValue.Count() > 0 ? 1 : 0) + (JBXXName.Count() > 0 && JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : JBXXName.Count() == 0 ? 0 : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() > 0 && TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : TZXXName.Count() == 0 ? 0 : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() > 0 && JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : JJXXName.Count() == 0 ? 0 : (int)(JJXXName.Count() / 3 + 1)) + (PJXXName.Count() > 0 && PJXXName.Count() % 3 == 0 ? (int)(PJXXName.Count() / 3) : PJXXName.Count() == 0 ? 0 : (int)(PJXXName.Count() / 3 + 1)) + (ZLXXName.Count() > 0 && ZLXXName.Count() % 3 == 0 ? (int)(ZLXXName.Count() / 3) : ZLXXName.Count() == 0 ? 0 : (int)(ZLXXName.Count() / 3 + 1)) + (BLXXName.Count() > 0 && BLXXName.Count() % 3 == 0 ? (int)(BLXXName.Count() / 3) : BLXXName.Count() == 0 ? 0 : (int)(BLXXName.Count() / 3 + 1)) + (li.ContractPartiesunitValue.Count() > 0 ? li.ContractPartiesunitColnum.Count() : 0) + (li.SJLYDWValue.Count() > 0 ? li.SJLYDWColnum.Count() : 0) + (li.BZJXXValue.Count() > 0 ? li.BZJXXColnum.Count() : 0) + (li.DBXXValue.Count() > 0 ? li.DBXXColnum.Count() : 0) + (li.GDXXValue.Count() > 0 ? li.GDXXColnum.Count() : 0) + (li.BXXXValue.Count() > 0 ? li.BXXXColnum.Count() : 0) + li.ContractPartiesunitValue.Count() + li.SJLYDWValue.Count() + li.BZJXXValue.Count() + li.DBXXValue.Count() + li.GDXXColnum.Count() + li.BXXXValue.Count();
NPOI.SS.UserModel.IRow row23 = sheet.CreateRow(rowCellIndex);
for (int c = 0; c < DBXX2Colnum.Count(); c++)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(DBXX2Colnum[c]);
cellBaseInfo.CellStyle = styleA;
}
var DBXX2ValueCount = 0;
for (int rowIndex = rowCellIndex + 1; rowIndex < rowCellIndex + li.DBXX2Value.Count() + 1; rowIndex++)
{
var diValue = (Dictionary<string, object>)li.DBXX2Value[DBXX2ValueCount];
NPOI.SS.UserModel.IRow row24 = sheet.CreateRow(rowIndex);
for (int c = 0; c <= 12; c++)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[DBXX2Colnum[DBXX2Colnum.Count() - DBXX2Colnum.Count()]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
DBXX2ValueCount++;
}
}
////合同支付信息:付款单位信息
if (li.FKDWValue.Count() > 0)
{
var FKDWColnum = (List<string>)li.FKDWColnum[0];
int titleIndex = 11 + (TZXXName.Count() > 0 ? 1 : 0) + (JJXXName.Count() > 0 ? 1 : 0) + (PJXXName.Count() > 0 ? 1 : 0) + (ZLXXName.Count() > 0 ? 1 : 0) + (BLXXName.Count() > 0 ? 1 : 0) + (li.ContractPartiesunitValue.Count() > 0 ? 1 : 0) + (li.SJLYDWValue.Count() > 0 ? 1 : 0) + (li.BZJXXValue.Count > 0 ? 1 : 0) + (li.DBXXValue.Count() > 0 ? 1 : 0) + (li.GDXXValue.Count() > 0 ? 1 : 0) + (li.BXXXValue.Count() > 0 ? 1 : 0) + (li.DBXX2Value.Count() > 0 ? 1 : 0) + (JBXXName.Count() > 0 && JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : JBXXName.Count() == 0 ? 0 : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() > 0 && TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : TZXXName.Count() == 0 ? 0 : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() > 0 && JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : JJXXName.Count() == 0 ? 0 : (int)(JJXXName.Count() / 3 + 1)) + (PJXXName.Count() > 0 && PJXXName.Count() % 3 == 0 ? (int)(PJXXName.Count() / 3) : PJXXName.Count() == 0 ? 0 : (int)(PJXXName.Count() / 3 + 1)) + (ZLXXName.Count() > 0 && ZLXXName.Count() % 3 == 0 ? (int)(ZLXXName.Count() / 3) : ZLXXName.Count() == 0 ? 0 : (int)(ZLXXName.Count() / 3 + 1)) + (BLXXName.Count() > 0 && BLXXName.Count() % 3 == 0 ? (int)(BLXXName.Count() / 3) : BLXXName.Count() == 0 ? 0 : (int)(BLXXName.Count() / 3 + 1)) + (li.ContractPartiesunitValue.Count() > 0 ? li.ContractPartiesunitColnum.Count() : 0) + (li.SJLYDWValue.Count() > 0 ? li.SJLYDWColnum.Count() : 0) + (li.BZJXXValue.Count() > 0 ? li.BZJXXColnum.Count() : 0) + (li.DBXXValue.Count() > 0 ? li.DBXXColnum.Count() : 0) + (li.GDXXValue.Count() > 0 ? li.GDXXColnum.Count() : 0) + (li.BXXXValue.Count() > 0 ? li.BXXXColnum.Count() : 0) + (li.DBXX2Value.Count() > 0 ? li.DBXX2Colnum.Count() : 0) + li.ContractPartiesunitValue.Count() + li.SJLYDWValue.Count() + li.BZJXXValue.Count() + li.DBXXValue.Count() + li.GDXXValue.Count() + li.BXXXValue.Count() + li.DBXX2Value.Count();
NPOI.SS.UserModel.IRow row22 = sheet.CreateRow(titleIndex);
NPOI.SS.UserModel.ICell cell22 = row22.CreateCell(0, CellType.String);
cell22.SetCellValue("合同支付信息:付款单位信息");
cell22.CellStyle = styleD;
sheet.AddMergedRegion(new CellRangeAddress(titleIndex, titleIndex, 0, 12));
int rowCellIndex = 12 + (TZXXName.Count() > 0 ? 1 : 0) + (JJXXName.Count() > 0 ? 1 : 0) + (PJXXName.Count() > 0 ? 1 : 0) + (ZLXXName.Count() > 0 ? 1 : 0) + (BLXXName.Count() > 0 ? 1 : 0) + (li.ContractPartiesunitValue.Count() > 0 ? 1 : 0) + (li.SJLYDWValue.Count() > 0 ? 1 : 0) + (li.BZJXXValue.Count > 0 ? 1 : 0) + (li.DBXXValue.Count() > 0 ? 1 : 0) + (li.GDXXValue.Count() > 0 ? 1 : 0) + (li.BXXXValue.Count() > 0 ? 1 : 0) + (li.DBXX2Value.Count() > 0 ? 1 : 0) + (JBXXName.Count() > 0 && JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : JBXXName.Count() == 0 ? 0 : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() > 0 && TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : TZXXName.Count() == 0 ? 0 : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() > 0 && JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : JJXXName.Count() == 0 ? 0 : (int)(JJXXName.Count() / 3 + 1)) + (PJXXName.Count() > 0 && PJXXName.Count() % 3 == 0 ? (int)(PJXXName.Count() / 3) : PJXXName.Count() == 0 ? 0 : (int)(PJXXName.Count() / 3 + 1)) + (ZLXXName.Count() > 0 && ZLXXName.Count() % 3 == 0 ? (int)(ZLXXName.Count() / 3) : ZLXXName.Count() == 0 ? 0 : (int)(ZLXXName.Count() / 3 + 1)) + (BLXXName.Count() > 0 && BLXXName.Count() % 3 == 0 ? (int)(BLXXName.Count() / 3) : BLXXName.Count() == 0 ? 0 : (int)(BLXXName.Count() / 3 + 1)) + (li.ContractPartiesunitValue.Count() > 0 ? li.ContractPartiesunitColnum.Count() : 0) + (li.SJLYDWValue.Count() > 0 ? li.SJLYDWColnum.Count() : 0) + (li.BZJXXValue.Count() > 0 ? li.BZJXXColnum.Count() : 0) + (li.DBXXValue.Count() > 0 ? li.DBXXColnum.Count() : 0) + (li.GDXXValue.Count() > 0 ? li.GDXXColnum.Count() : 0) + (li.BXXXValue.Count() > 0 ? li.BXXXColnum.Count() : 0) + (li.DBXX2Value.Count() > 0 ? li.DBXX2Colnum.Count() : 0) + li.ContractPartiesunitValue.Count() + li.SJLYDWValue.Count() + li.BZJXXValue.Count() + li.DBXXValue.Count() + li.GDXXValue.Count() + li.BXXXValue.Count() + li.DBXX2Value.Count();
NPOI.SS.UserModel.IRow row23 = sheet.CreateRow(rowCellIndex);
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 0, 1));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 2, 4));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 5, 6));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 7, 8));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 9, 12));
for (int c = 0; c <= 12; c++)
{
//NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
//cellBaseInfo.SetCellValue(FKDWColnum[c]);
//cellBaseInfo.CellStyle = styleA;
if (c <= 1)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(FKDWColnum[FKDWColnum.Count() - FKDWColnum.Count()]);
cellBaseInfo.CellStyle = styleA;
}
else if (c <= 4)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(FKDWColnum[FKDWColnum.Count() - (FKDWColnum.Count() - 1)]);
cellBaseInfo.CellStyle = styleA;
}
else if (c <= 6)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(FKDWColnum[FKDWColnum.Count() - (FKDWColnum.Count() - 2)]);
cellBaseInfo.CellStyle = styleA;
}
else if (c <= 8)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(FKDWColnum[FKDWColnum.Count() - (FKDWColnum.Count() - 3)]);
cellBaseInfo.CellStyle = styleA;
}
else if (c <= 12)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(FKDWColnum[FKDWColnum.Count() - (FKDWColnum.Count() - 4)]);
cellBaseInfo.CellStyle = styleA;
}
}
var FKDWValueCount = 0;
for (int rowIndex = rowCellIndex + 1; rowIndex < rowCellIndex + li.FKDWValue.Count() + 1; rowIndex++)
{
var diValue = (Dictionary<string, object>)li.FKDWValue[FKDWValueCount];
NPOI.SS.UserModel.IRow row24 = sheet.CreateRow(rowIndex);
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 1));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 2, 4));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 5, 6));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 7, 8));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 9, 12));
for (int c = 0; c <= 12; c++)
{
if (c <= 1)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[FKDWColnum[FKDWColnum.Count() - FKDWColnum.Count()]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else if (c <= 4)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[FKDWColnum[FKDWColnum.Count() - (FKDWColnum.Count() - 1)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else if (c <= 6)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[FKDWColnum[FKDWColnum.Count() - (FKDWColnum.Count() - 2)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else if (c <= 8)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[FKDWColnum[FKDWColnum.Count() - (FKDWColnum.Count() - 3)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else if (c <= 12)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[FKDWColnum[FKDWColnum.Count() - (FKDWColnum.Count() - 4)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
}
FKDWValueCount++;
}
}
////合同对方信息
if (li.HTDFValue.Count() > 0)
{
var HTDFColnum = (List<string>)li.HTDFColnum[0];
int titleIndex = 11 + (TZXXName.Count() > 0 ? 1 : 0) + (JJXXName.Count() > 0 ? 1 : 0) + (PJXXName.Count() > 0 ? 1 : 0) + (ZLXXName.Count() > 0 ? 1 : 0) + (BLXXName.Count() > 0 ? 1 : 0) + (li.ContractPartiesunitValue.Count() > 0 ? 1 : 0) + (li.SJLYDWValue.Count() > 0 ? 1 : 0) + (li.BZJXXValue.Count > 0 ? 1 : 0) + (li.DBXXValue.Count() > 0 ? 1 : 0) + (li.GDXXValue.Count() > 0 ? 1 : 0) + (li.BXXXValue.Count() > 0 ? 1 : 0) + (li.DBXX2Value.Count() > 0 ? 1 : 0) + (li.FKDWValue.Count() > 0 ? 1 : 0) + (JBXXName.Count() > 0 && JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : JBXXName.Count() == 0 ? 0 : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() > 0 && TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : TZXXName.Count() == 0 ? 0 : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() > 0 && JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : JJXXName.Count() == 0 ? 0 : (int)(JJXXName.Count() / 3 + 1)) + (PJXXName.Count() > 0 && PJXXName.Count() % 3 == 0 ? (int)(PJXXName.Count() / 3) : PJXXName.Count() == 0 ? 0 : (int)(PJXXName.Count() / 3 + 1)) + (ZLXXName.Count() > 0 && ZLXXName.Count() % 3 == 0 ? (int)(ZLXXName.Count() / 3) : ZLXXName.Count() == 0 ? 0 : (int)(ZLXXName.Count() / 3 + 1)) + (BLXXName.Count() > 0 && BLXXName.Count() % 3 == 0 ? (int)(BLXXName.Count() / 3) : BLXXName.Count() == 0 ? 0 : (int)(BLXXName.Count() / 3 + 1)) + (li.ContractPartiesunitValue.Count() > 0 ? li.ContractPartiesunitColnum.Count() : 0) + (li.SJLYDWValue.Count() > 0 ? li.SJLYDWColnum.Count() : 0) + (li.BZJXXValue.Count() > 0 ? li.BZJXXColnum.Count() : 0) + (li.DBXXValue.Count() > 0 ? li.DBXXColnum.Count() : 0) + (li.GDXXValue.Count() > 0 ? li.GDXXColnum.Count() : 0) + (li.BXXXValue.Count() > 0 ? li.BXXXColnum.Count() : 0) + (li.DBXX2Value.Count() > 0 ? li.DBXX2Colnum.Count() : 0) + (li.FKDWValue.Count() > 0 ? li.FKDWColnum.Count() : 0) + li.ContractPartiesunitValue.Count() + li.SJLYDWValue.Count() + li.BZJXXValue.Count() + li.DBXXValue.Count() + li.GDXXValue.Count() + li.BXXXValue.Count() + li.DBXX2Value.Count() + li.FKDWValue.Count();
NPOI.SS.UserModel.IRow row22 = sheet.CreateRow(titleIndex);
NPOI.SS.UserModel.ICell cell22 = row22.CreateCell(0, CellType.String);
cell22.SetCellValue("合同对方信息");
cell22.CellStyle = styleD;
sheet.AddMergedRegion(new CellRangeAddress(titleIndex, titleIndex, 0, 12));
int rowCellIndex = 12 + (TZXXName.Count() > 0 ? 1 : 0) + (JJXXName.Count() > 0 ? 1 : 0) + (PJXXName.Count() > 0 ? 1 : 0) + (ZLXXName.Count() > 0 ? 1 : 0) + (BLXXName.Count() > 0 ? 1 : 0) + (li.ContractPartiesunitValue.Count() > 0 ? 1 : 0) + (li.SJLYDWValue.Count() > 0 ? 1 : 0) + (li.BZJXXValue.Count > 0 ? 1 : 0) + (li.DBXXValue.Count() > 0 ? 1 : 0) + (li.GDXXValue.Count() > 0 ? 1 : 0) + (li.BXXXValue.Count() > 0 ? 1 : 0) + (li.DBXX2Value.Count() > 0 ? 1 : 0) + (li.FKDWValue.Count() > 0 ? 1 : 0) + (JBXXName.Count() > 0 && JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : JBXXName.Count() == 0 ? 0 : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() > 0 && TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : TZXXName.Count() == 0 ? 0 : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() > 0 && JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : JJXXName.Count() == 0 ? 0 : (int)(JJXXName.Count() / 3 + 1)) + (PJXXName.Count() > 0 && PJXXName.Count() % 3 == 0 ? (int)(PJXXName.Count() / 3) : PJXXName.Count() == 0 ? 0 : (int)(PJXXName.Count() / 3 + 1)) + (ZLXXName.Count() > 0 && ZLXXName.Count() % 3 == 0 ? (int)(ZLXXName.Count() / 3) : ZLXXName.Count() == 0 ? 0 : (int)(ZLXXName.Count() / 3 + 1)) + (BLXXName.Count() > 0 && BLXXName.Count() % 3 == 0 ? (int)(BLXXName.Count() / 3) : BLXXName.Count() == 0 ? 0 : (int)(BLXXName.Count() / 3 + 1)) + (li.ContractPartiesunitValue.Count() > 0 ? li.ContractPartiesunitColnum.Count() : 0) + (li.SJLYDWValue.Count() > 0 ? li.SJLYDWColnum.Count() : 0) + (li.BZJXXValue.Count() > 0 ? li.BZJXXColnum.Count() : 0) + (li.DBXXValue.Count() > 0 ? li.DBXXColnum.Count() : 0) + (li.GDXXValue.Count() > 0 ? li.GDXXColnum.Count() : 0) + (li.BXXXValue.Count() > 0 ? li.BXXXColnum.Count() : 0) + (li.DBXX2Value.Count() > 0 ? li.DBXX2Colnum.Count() : 0) + (li.FKDWValue.Count() > 0 ? li.FKDWColnum.Count() : 0) + li.ContractPartiesunitValue.Count() + li.SJLYDWValue.Count() + li.BZJXXValue.Count() + li.DBXXValue.Count() + li.GDXXValue.Count() + li.BXXXValue.Count() + li.DBXX2Value.Count() + li.FKDWValue.Count();
NPOI.SS.UserModel.IRow row23 = sheet.CreateRow(rowCellIndex);
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 0, 1));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 2, 4));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 5, 6));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 7, 8));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 9, 12));
for (int c = 0; c <= 12; c++)
{
//NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
//cellBaseInfo.SetCellValue(HTDFColnum[c]);
//cellBaseInfo.CellStyle = styleA;
if (c <= 1)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(HTDFColnum[HTDFColnum.Count() - HTDFColnum.Count()]);
cellBaseInfo.CellStyle = styleA;
}
else if (c <= 4)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(HTDFColnum[HTDFColnum.Count() - (HTDFColnum.Count() - 1)]);
cellBaseInfo.CellStyle = styleA;
}
else if (c <= 6)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(HTDFColnum[HTDFColnum.Count() - (HTDFColnum.Count() - 2)]);
cellBaseInfo.CellStyle = styleA;
}
else if (c <= 8)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(HTDFColnum[HTDFColnum.Count() - (HTDFColnum.Count() - 3)]);
cellBaseInfo.CellStyle = styleA;
}
else if (c <= 12)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(HTDFColnum[HTDFColnum.Count() - (HTDFColnum.Count() - 4)]);
cellBaseInfo.CellStyle = styleA;
}
}
var HTDFValueCount = 0;
for (int rowIndex = rowCellIndex + 1; rowIndex < rowCellIndex + li.HTDFValue.Count() + 1; rowIndex++)
{
var diValue = (Dictionary<string, object>)li.HTDFValue[HTDFValueCount];
NPOI.SS.UserModel.IRow row24 = sheet.CreateRow(rowIndex);
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 1));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 2, 4));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 5, 6));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 7, 8));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 9, 12));
for (int c = 0; c <= 12; c++)
{
if (c <= 1)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[HTDFColnum[HTDFColnum.Count() - HTDFColnum.Count()]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else if (c <= 4)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[HTDFColnum[HTDFColnum.Count() - (HTDFColnum.Count() - 1)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else if (c <= 6)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[HTDFColnum[HTDFColnum.Count() - (HTDFColnum.Count() - 2)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else if (c <= 8)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[HTDFColnum[HTDFColnum.Count() - (HTDFColnum.Count() - 3)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else if (c <= 12)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[HTDFColnum[HTDFColnum.Count() - (HTDFColnum.Count() - 4)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
}
HTDFValueCount++;
}
}
////合同支付信息:收款单位信息
if (li.SKDWValue.Count() > 0)
{
var SKDWColnum = (List<string>)li.SKDWColnum[0];
int titleIndex = 11 + (TZXXName.Count() > 0 ? 1 : 0) + (JJXXName.Count() > 0 ? 1 : 0) + (PJXXName.Count() > 0 ? 1 : 0) + (ZLXXName.Count() > 0 ? 1 : 0) + (BLXXName.Count() > 0 ? 1 : 0) + (li.ContractPartiesunitValue.Count() > 0 ? 1 : 0) + (li.SJLYDWValue.Count() > 0 ? 1 : 0) + (li.BZJXXValue.Count > 0 ? 1 : 0) + (li.DBXXValue.Count() > 0 ? 1 : 0) + (li.GDXXValue.Count() > 0 ? 1 : 0) + (li.BXXXValue.Count() > 0 ? 1 : 0) + (li.DBXX2Value.Count() > 0 ? 1 : 0) + (li.FKDWValue.Count() > 0 ? 1 : 0) + (li.HTDFValue.Count() > 0 ? 1 : 0) + (JBXXName.Count() > 0 && JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : JBXXName.Count() == 0 ? 0 : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() > 0 && TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : TZXXName.Count() == 0 ? 0 : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() > 0 && JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : JJXXName.Count() == 0 ? 0 : (int)(JJXXName.Count() / 3 + 1)) + (PJXXName.Count() > 0 && PJXXName.Count() % 3 == 0 ? (int)(PJXXName.Count() / 3) : PJXXName.Count() == 0 ? 0 : (int)(PJXXName.Count() / 3 + 1)) + (ZLXXName.Count() > 0 && ZLXXName.Count() % 3 == 0 ? (int)(ZLXXName.Count() / 3) : ZLXXName.Count() == 0 ? 0 : (int)(ZLXXName.Count() / 3 + 1)) + (BLXXName.Count() > 0 && BLXXName.Count() % 3 == 0 ? (int)(BLXXName.Count() / 3) : BLXXName.Count() == 0 ? 0 : (int)(BLXXName.Count() / 3 + 1)) + (li.ContractPartiesunitValue.Count() > 0 ? li.ContractPartiesunitColnum.Count() : 0) + (li.SJLYDWValue.Count() > 0 ? li.SJLYDWColnum.Count() : 0) + (li.BZJXXValue.Count() > 0 ? li.BZJXXColnum.Count() : 0) + (li.DBXXValue.Count() > 0 ? li.DBXXColnum.Count() : 0) + (li.GDXXValue.Count() > 0 ? li.GDXXColnum.Count() : 0) + (li.BXXXValue.Count() > 0 ? li.BXXXColnum.Count() : 0) + (li.DBXX2Value.Count() > 0 ? li.DBXX2Colnum.Count() : 0) + (li.FKDWValue.Count() > 0 ? li.FKDWColnum.Count() : 0) + (li.HTDFValue.Count() > 0 ? li.HTDFColnum.Count() : 0) + li.ContractPartiesunitValue.Count() + li.SJLYDWValue.Count() + li.BZJXXValue.Count() + li.DBXXValue.Count() + li.GDXXValue.Count() + li.BXXXValue.Count() + li.DBXX2Value.Count() + li.FKDWValue.Count() + li.HTDFValue.Count();
NPOI.SS.UserModel.IRow row22 = sheet.CreateRow(titleIndex);
NPOI.SS.UserModel.ICell cell22 = row22.CreateCell(0, CellType.String);
cell22.SetCellValue("合同支付信息:收款单位信息");
cell22.CellStyle = styleD;
sheet.AddMergedRegion(new CellRangeAddress(titleIndex, titleIndex, 0, 12));
int rowCellIndex = 12 + (TZXXName.Count() > 0 ? 1 : 0) + (JJXXName.Count() > 0 ? 1 : 0) + (PJXXName.Count() > 0 ? 1 : 0) + (ZLXXName.Count() > 0 ? 1 : 0) + (BLXXName.Count() > 0 ? 1 : 0) + (li.ContractPartiesunitValue.Count() > 0 ? 1 : 0) + (li.SJLYDWValue.Count() > 0 ? 1 : 0) + (li.BZJXXValue.Count > 0 ? 1 : 0) + (li.DBXXValue.Count() > 0 ? 1 : 0) + (li.GDXXValue.Count() > 0 ? 1 : 0) + (li.BXXXValue.Count() > 0 ? 1 : 0) + (li.DBXX2Value.Count() > 0 ? 1 : 0) + (li.FKDWValue.Count() > 0 ? 1 : 0) + (li.HTDFValue.Count() > 0 ? 1 : 0) + (JBXXName.Count() > 0 && JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : JBXXName.Count() == 0 ? 0 : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() > 0 && TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : TZXXName.Count() == 0 ? 0 : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() > 0 && JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : JJXXName.Count() == 0 ? 0 : (int)(JJXXName.Count() / 3 + 1)) + (PJXXName.Count() > 0 && PJXXName.Count() % 3 == 0 ? (int)(PJXXName.Count() / 3) : PJXXName.Count() == 0 ? 0 : (int)(PJXXName.Count() / 3 + 1)) + (ZLXXName.Count() > 0 && ZLXXName.Count() % 3 == 0 ? (int)(ZLXXName.Count() / 3) : ZLXXName.Count() == 0 ? 0 : (int)(ZLXXName.Count() / 3 + 1)) + (BLXXName.Count() > 0 && BLXXName.Count() % 3 == 0 ? (int)(BLXXName.Count() / 3) : BLXXName.Count() == 0 ? 0 : (int)(BLXXName.Count() / 3 + 1)) + (li.ContractPartiesunitValue.Count() > 0 ? li.ContractPartiesunitColnum.Count() : 0) + (li.SJLYDWValue.Count() > 0 ? li.SJLYDWColnum.Count() : 0) + (li.BZJXXValue.Count() > 0 ? li.BZJXXColnum.Count() : 0) + (li.DBXXValue.Count() > 0 ? li.DBXXColnum.Count() : 0) + (li.GDXXValue.Count() > 0 ? li.GDXXColnum.Count() : 0) + (li.BXXXValue.Count() > 0 ? li.BXXXColnum.Count() : 0) + (li.DBXX2Value.Count() > 0 ? li.DBXX2Colnum.Count() : 0) + (li.FKDWValue.Count() > 0 ? li.FKDWColnum.Count() : 0) + (li.HTDFValue.Count() > 0 ? li.HTDFColnum.Count() : 0) + li.ContractPartiesunitValue.Count() + li.SJLYDWValue.Count() + li.BZJXXValue.Count() + li.DBXXValue.Count() + li.GDXXValue.Count() + li.BXXXValue.Count() + li.DBXX2Value.Count() + li.FKDWValue.Count() + li.HTDFValue.Count();
NPOI.SS.UserModel.IRow row23 = sheet.CreateRow(rowCellIndex);
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 11, 12));
for (int c = 0; c <= 12; c++)
{
if (c >= 11 && c <= 12)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(SKDWColnum[SKDWColnum.Count() - (SKDWColnum.Count() - 11)]);
cellBaseInfo.CellStyle = styleA;
}
else
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(SKDWColnum[c]);
cellBaseInfo.CellStyle = styleA;
}
}
var SKDWValueCount = 0;
for (int rowIndex = rowCellIndex + 1; rowIndex < rowCellIndex + li.SKDWValue.Count() + 1; rowIndex++)
{
var diValue = (Dictionary<string, object>)li.SKDWValue[SKDWValueCount];
NPOI.SS.UserModel.IRow row24 = sheet.CreateRow(rowIndex);
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 11, 12));
for (int c = 0; c <= 12; c++)
{
if (c >= 11 && c <= 12)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[SKDWColnum[SKDWColnum.Count() - (SKDWColnum.Count() - 11)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[SKDWColnum[c]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
}
SKDWValueCount++;
}
}
if (li.WorkFlowValue.Count() > 0)
{
var WorkFlowColnum = (List<string>)li.WorkFlowColnum[0];
int titleIndex = 11 + (TZXXName.Count() > 0 ? 1 : 0) + (JJXXName.Count() > 0 ? 1 : 0) + (PJXXName.Count() > 0 ? 1 : 0) + (ZLXXName.Count() > 0 ? 1 : 0) + (BLXXName.Count() > 0 ? 1 : 0) + (li.ContractPartiesunitValue.Count() > 0 ? 1 : 0) + (li.SJLYDWValue.Count() > 0 ? 1 : 0) + (li.BZJXXValue.Count > 0 ? 1 : 0) + (li.DBXXValue.Count() > 0 ? 1 : 0) + (li.GDXXValue.Count() > 0 ? 1 : 0) + (li.BXXXValue.Count() > 0 ? 1 : 0) + (li.DBXX2Value.Count() > 0 ? 1 : 0) + (li.FKDWValue.Count() > 0 ? 1 : 0) + (li.HTDFValue.Count() > 0 ? 1 : 0) + (li.SKDWValue.Count() > 0 ? 1 : 0) + (JBXXName.Count() > 0 && JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : JBXXName.Count() == 0 ? 0 : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() > 0 && TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : TZXXName.Count() == 0 ? 0 : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() > 0 && JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : JJXXName.Count() == 0 ? 0 : (int)(JJXXName.Count() / 3 + 1)) + (PJXXName.Count() > 0 && PJXXName.Count() % 3 == 0 ? (int)(PJXXName.Count() / 3) : PJXXName.Count() == 0 ? 0 : (int)(PJXXName.Count() / 3 + 1)) + (ZLXXName.Count() > 0 && ZLXXName.Count() % 3 == 0 ? (int)(ZLXXName.Count() / 3) : ZLXXName.Count() == 0 ? 0 : (int)(ZLXXName.Count() / 3 + 1)) + (BLXXName.Count() > 0 && BLXXName.Count() % 3 == 0 ? (int)(BLXXName.Count() / 3) : BLXXName.Count() == 0 ? 0 : (int)(BLXXName.Count() / 3 + 1)) + (li.ContractPartiesunitValue.Count() > 0 ? li.ContractPartiesunitColnum.Count() : 0) + (li.SJLYDWValue.Count() > 0 ? li.SJLYDWColnum.Count() : 0) + (li.BZJXXValue.Count() > 0 ? li.BZJXXColnum.Count() : 0) + (li.DBXXValue.Count() > 0 ? li.DBXXColnum.Count() : 0) + (li.GDXXValue.Count() > 0 ? li.GDXXColnum.Count() : 0) + (li.BXXXValue.Count() > 0 ? li.BXXXColnum.Count() : 0) + (li.DBXX2Value.Count() > 0 ? li.DBXX2Colnum.Count() : 0) + (li.FKDWValue.Count() > 0 ? li.FKDWColnum.Count() : 0) + (li.HTDFValue.Count() > 0 ? li.HTDFColnum.Count() : 0) + (li.SKDWValue.Count() > 0 ? li.SKDWColnum.Count() : 0) + li.ContractPartiesunitValue.Count() + li.SJLYDWValue.Count() + li.BZJXXValue.Count() + li.DBXXValue.Count() + li.GDXXValue.Count() + li.BXXXValue.Count() + li.DBXX2Value.Count() + li.FKDWValue.Count() + li.HTDFValue.Count() + li.SKDWValue.Count();
NPOI.SS.UserModel.IRow row22 = sheet.CreateRow(titleIndex);
NPOI.SS.UserModel.ICell cell22 = row22.CreateCell(0, CellType.String);
cell22.SetCellValue("审批日志");
cell22.CellStyle = styleD;
sheet.AddMergedRegion(new CellRangeAddress(titleIndex, titleIndex, 0, 12));
int rowCellIndex = 12 + (TZXXName.Count() > 0 ? 1 : 0) + (JJXXName.Count() > 0 ? 1 : 0) + (PJXXName.Count() > 0 ? 1 : 0) + (ZLXXName.Count() > 0 ? 1 : 0) + (BLXXName.Count() > 0 ? 1 : 0) + (li.ContractPartiesunitValue.Count() > 0 ? 1 : 0) + (li.SJLYDWValue.Count() > 0 ? 1 : 0) + (li.BZJXXValue.Count > 0 ? 1 : 0) + (li.DBXXValue.Count() > 0 ? 1 : 0) + (li.GDXXValue.Count() > 0 ? 1 : 0) + (li.BXXXValue.Count() > 0 ? 1 : 0) + (li.DBXX2Value.Count() > 0 ? 1 : 0) + (li.FKDWValue.Count() > 0 ? 1 : 0) + (li.HTDFValue.Count() > 0 ? 1 : 0) + (li.SKDWValue.Count() > 0 ? 1 : 0) + (JBXXName.Count() > 0 && JBXXName.Count() % 3 == 0 ? (int)(JBXXName.Count() / 3) : JBXXName.Count() == 0 ? 0 : (int)(JBXXName.Count() / 3 + 1)) + (TZXXName.Count() > 0 && TZXXName.Count() % 3 == 0 ? (int)(TZXXName.Count() / 3) : TZXXName.Count() == 0 ? 0 : (int)(TZXXName.Count() / 3 + 1)) + (JJXXName.Count() > 0 && JJXXName.Count() % 3 == 0 ? (int)(JJXXName.Count() / 3) : JJXXName.Count() == 0 ? 0 : (int)(JJXXName.Count() / 3 + 1)) + (PJXXName.Count() > 0 && PJXXName.Count() % 3 == 0 ? (int)(PJXXName.Count() / 3) : PJXXName.Count() == 0 ? 0 : (int)(PJXXName.Count() / 3 + 1)) + (ZLXXName.Count() > 0 && ZLXXName.Count() % 3 == 0 ? (int)(ZLXXName.Count() / 3) : ZLXXName.Count() == 0 ? 0 : (int)(ZLXXName.Count() / 3 + 1)) + (BLXXName.Count() > 0 && BLXXName.Count() % 3 == 0 ? (int)(BLXXName.Count() / 3) : BLXXName.Count() == 0 ? 0 : (int)(BLXXName.Count() / 3 + 1)) + (li.ContractPartiesunitValue.Count() > 0 ? li.ContractPartiesunitColnum.Count() : 0) + (li.SJLYDWValue.Count() > 0 ? li.SJLYDWColnum.Count() : 0) + (li.BZJXXValue.Count() > 0 ? li.BZJXXColnum.Count() : 0) + (li.DBXXValue.Count() > 0 ? li.DBXXColnum.Count() : 0) + (li.GDXXValue.Count() > 0 ? li.GDXXColnum.Count() : 0) + (li.BXXXValue.Count() > 0 ? li.BXXXColnum.Count() : 0) + (li.DBXX2Value.Count() > 0 ? li.DBXX2Colnum.Count() : 0) + (li.FKDWValue.Count() > 0 ? li.FKDWColnum.Count() : 0) + (li.HTDFValue.Count() > 0 ? li.HTDFColnum.Count() : 0) + (li.SKDWValue.Count() > 0 ? li.SKDWColnum.Count() : 0) + li.ContractPartiesunitValue.Count() + li.SJLYDWValue.Count() + li.BZJXXValue.Count() + li.DBXXValue.Count() + li.GDXXValue.Count() + li.BXXXValue.Count() + li.DBXX2Value.Count() + li.FKDWValue.Count() + li.HTDFValue.Count() + li.SKDWValue.Count();
NPOI.SS.UserModel.IRow row23 = sheet.CreateRow(rowCellIndex);
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 0, 2));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 3, 4));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 5, 6));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 7, 10));
sheet.AddMergedRegion(new CellRangeAddress(rowCellIndex, rowCellIndex, 11, 12));
for (int c = 0; c <= 12; c++)
{
//NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
//cellBaseInfo.SetCellValue(WorkFlowColnum[c]);
//cellBaseInfo.CellStyle = styleA;
if (c <= 2)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(WorkFlowColnum[WorkFlowColnum.Count() - WorkFlowColnum.Count()]);
cellBaseInfo.CellStyle = styleA;
}
else if (c <= 4)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(WorkFlowColnum[WorkFlowColnum.Count() - (WorkFlowColnum.Count() - 1)]);
cellBaseInfo.CellStyle = styleA;
}
else if (c <= 6)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(WorkFlowColnum[WorkFlowColnum.Count() - (WorkFlowColnum.Count() - 2)]);
cellBaseInfo.CellStyle = styleA;
}
else if (c <= 10)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(WorkFlowColnum[WorkFlowColnum.Count() - (WorkFlowColnum.Count() - 3)]);
cellBaseInfo.CellStyle = styleA;
}
else if (c <= 12)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row23.CreateCell(c, CellType.String);
cellBaseInfo.SetCellValue(WorkFlowColnum[WorkFlowColnum.Count() - (WorkFlowColnum.Count() - 4)]);
cellBaseInfo.CellStyle = styleA;
}
}
var WorkFlowValueCount = 0;
for (int rowIndex = rowCellIndex + 1; rowIndex < rowCellIndex + li.WorkFlowValue.Count() + 1; rowIndex++)
{
var diValue = (Dictionary<string, object>)li.WorkFlowValue[WorkFlowValueCount];
NPOI.SS.UserModel.IRow row24 = sheet.CreateRow(rowIndex);
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 2));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 3, 4));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 5, 6));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 7, 10));
sheet.AddMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 11, 12));
for (int c = 0; c <= 12; c++)
{
if (c <= 2)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[WorkFlowColnum[WorkFlowColnum.Count() - WorkFlowColnum.Count()]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else if (c <= 4)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[WorkFlowColnum[WorkFlowColnum.Count() - (WorkFlowColnum.Count() - 1)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else if (c <= 6)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[WorkFlowColnum[WorkFlowColnum.Count() - (WorkFlowColnum.Count() - 2)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else if (c <= 10)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[WorkFlowColnum[WorkFlowColnum.Count() - (WorkFlowColnum.Count() - 3)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
else if (c <= 12)
{
NPOI.SS.UserModel.ICell cellBaseInfo = row24.CreateCell(c, CellType.String);
var v = diValue[WorkFlowColnum[WorkFlowColnum.Count() - (WorkFlowColnum.Count() - 4)]];
cellBaseInfo.SetCellValue(v == null ? "" : v.ToString());
cellBaseInfo.CellStyle = styleB;
}
}
WorkFlowValueCount++;
}
}
var filehost = System.Web.HttpRuntime.AppDomainAppPath + "doc\\WorkModelForm\\ContractRegisterForm\\ContractTraceProcessing\\ApprovalForm\\"+DateTime.Now.ToString("yyyyMM") + "\\";
if (!Directory.Exists(filehost))
{
Directory.CreateDirectory(filehost);
}
var wholefilepath = filehost + li.FileName+".xlsx";
var path = wholefilepath.Replace("\\", "/");
string[] sArray = Regex.Split(path, "WebSite", RegexOptions.IgnoreCase);
ApprovalFormPath = "~" + sArray[1];
FileStream file = new FileStream(path, FileMode.Create);
book.Write(file);
file.Close();
}
catch (Exception ex)
{
throw ex;
}
return ms;
}
//取数据
public static NPOIModel GetContractWorkFlowData(int BaseID)
{
var db = Shj.Entity.DataFactory.Create();
ContractQuery query = new ContractQuery();
query.BaseID = BaseID;
var getCondata = Contract.getData(query);
NPOIModel liResult = new NPOIModel();
liResult.BaseColnum = new List<object>();
liResult.BaseValue = new List<object>();
liResult.JBXXColnum = new List<object>();
liResult.JBXXValue = new List<object>();
liResult.TZXXColnum = new List<object>();
liResult.TZXXValue = new List<object>();
liResult.JJXXColnum = new List<object>();
liResult.JJXXValue = new List<object>();
liResult.PJXXColnum = new List<object>();
liResult.PJXXValue = new List<object>();
liResult.ZLXXColnum = new List<object>();
liResult.ZLXXValue = new List<object>();
liResult.BLXXColnum = new List<object>();
liResult.BLXXValue = new List<object>();
liResult.ContractPartiesunitColnum = new List<object>();
liResult.ContractPartiesunitValue = new List<object>();
liResult.SJLYDWColnum = new List<object>();
liResult.SJLYDWValue = new List<object>();
liResult.DBXXColnum = new List<object>();
liResult.DBXXValue = new List<object>();
liResult.DBXX2Colnum = new List<object>();
liResult.DBXX2Value = new List<object>();
liResult.GDXXColnum = new List<object>();
liResult.GDXXValue = new List<object>();
liResult.BZJXXColnum = new List<object>();
liResult.BZJXXValue = new List<object>();
liResult.BXXXColnum = new List<object>();
liResult.BXXXValue = new List<object>();
liResult.HTDFColnum = new List<object>();
liResult.HTDFValue = new List<object>();
liResult.FKDWColnum = new List<object>();
liResult.FKDWValue = new List<object>();
liResult.SKDWColnum = new List<object>();
liResult.SKDWValue = new List<object>();
liResult.WorkFlowColnum = new List<object>();
liResult.WorkFlowValue = new List<object>();
liResult.FileName = getCondata.BaseInfo.ID + "_" + getCondata.BaseInfo.Code;
//根据合同类型先获取哪些字段需要显示
var getFieldData = ContractField.getFieldData(getCondata.BaseInfo.GrpTypeCode);
string sqlConn = System.Configuration.ConfigurationManager.ConnectionStrings["Shj_Contract_DB"].ConnectionString;
var dicdata = db.Shj_Sys_DicData.Where(a => a.Status != -1).ToList();
var Currency = MD_Currency.ListAll();
var getGrpTypeName = db.shj_Grp_ContractType.Where(a => a.SecondLevelCode == getCondata.BaseInfo.GrpTypeCode).FirstOrDefault();
var Language = MD_LanguageClient.List();
var Addvs = MD_ADDVS.ListAll();
var Country = MD_Country.ListAll();
var InvoiceType = MD_InvoiceTypeClient.List();
try
{
if (getCondata.BaseInfo != null)
{
var BaseTitle = new List<string>();
BaseTitle.Add("合同名称");
BaseTitle.Add("合同编号");
BaseTitle.Add("管理编号");
BaseTitle.Add("所属单位");
BaseTitle.Add("所属部门");
BaseTitle.Add("是否科研项目合同");
BaseTitle.Add("所属项目");
BaseTitle.Add("合同金额");
BaseTitle.Add("税率(%)");
BaseTitle.Add("不含税金额");
BaseTitle.Add("总合同金额");
BaseTitle.Add("税额");
BaseTitle.Add("币种");
BaseTitle.Add("签订时间");
BaseTitle.Add("经办人");
BaseTitle.Add("负责人");
BaseTitle.Add("合同外文名称");
BaseTitle.Add("合同范本使用情况");
BaseTitle.Add("集团主数据编码");
BaseTitle.Add("收支类型");
BaseTitle.Add("集团一级分类");
BaseTitle.Add("集团二级分类");
BaseTitle.Add("是否用局总部章");
BaseTitle.Add("董事长签名章");
liResult.BaseColnum.Add(BaseTitle);
var getOwnerDeptName = db.Shj_Sys_Dept.Where(a => a.Dep_ID == getCondata.BaseInfo.OwnerDeptID).FirstOrDefault();
var BaseValue = new Dictionary<string, object>();
BaseValue.Add("合同名称", getCondata.BaseInfo.ProcessedName);
BaseValue.Add("合同编号", getCondata.BaseInfo.Code);
BaseValue.Add("管理编号", getCondata.BaseInfo.BusinessCode);
if (getOwnerDeptName != null)
{
BaseValue.Add("所属单位", getOwnerDeptName.Dep_Name);
}
BaseValue.Add("所属部门", getCondata.OwnerProjectName);
BaseValue.Add("是否科研项目合同", getCondata.BaseInfo.IsScientificPro == "1" ? "是" : getCondata.BaseInfo.IsScientificPro == "0" ? "否" : "");
BaseValue.Add("所属项目", getCondata.BaseInfo.ProrjectNames);
BaseValue.Add("合同金额", getCondata.BaseInfo.Amount);
BaseValue.Add("税率(%)", getCondata.BaseInfo.GrpTypeCode == "0105" || getCondata.BaseInfo.GrpTypeCode == "0106" ? getCondata.BaseInfo.SubContractTax : getCondata.BaseInfo.Tax.ToString());
BaseValue.Add("不含税金额", getCondata.BaseInfo.NoTaxAmount);
BaseValue.Add("总合同金额", getCondata.BaseInfo.TotalAmount);
BaseValue.Add("税额", getCondata.BaseInfo.TaxAmount);
BaseValue.Add("币种", Currency.Where(a => a.ZCURRENCYCODE == getCondata.BaseInfo.ProcessedCurrency).Select(a => a.ZCURRENCYNAME).FirstOrDefault());
BaseValue.Add("签订时间", getCondata.BaseInfo.SignTime);
BaseValue.Add("经办人", getCondata.BaseInfo.Operator);
BaseValue.Add("负责人", getCondata.BaseInfo.Principal);
BaseValue.Add("合同外文名称", getCondata.BaseInfo.CONNAME);
BaseValue.Add("合同范本使用情况", dicdata.Where(a => a.Category == "DM_HTFB" && a.Code == getCondata.BaseInfo.CONMODELUSECONDITION).Select(a => a.Value).FirstOrDefault());
BaseValue.Add("集团主数据编码", getCondata.BaseInfo.CONMAINCODE);
BaseValue.Add("收支类型", dicdata.Where(a => a.Category == "Indecrease" && a.Code == getCondata.BaseInfo.DeOrIncrease).Select(a => a.Value).FirstOrDefault());
if (getGrpTypeName != null)
{
BaseValue.Add("集团一级分类", getGrpTypeName.FirstLevel);
BaseValue.Add("集团二级分类", getGrpTypeName.SecondLevel);
}
BaseValue.Add("是否用局总部章", getCondata.BaseInfo.IsCompanySeal == 1 ? "是" : getCondata.BaseInfo.IsCompanySeal == 0 ? "否" : "");
BaseValue.Add("董事长签名章", getCondata.BaseInfo.IsChairmanSeal == "1" ? "是" : getCondata.BaseInfo.IsChairmanSeal == "0" ? "否" : "");
liResult.BaseValue.Add(BaseValue);
}
//基本信息
if (getFieldData.rows.Where(a => a.FieldLayout == "jbxx").Count() > 0)
{
var JBXXTitle = new List<string>();
var JBXXValue = new Dictionary<string, object>();
StringBuilder sqlQuery = new StringBuilder();
sqlQuery.Append("select * from Shj_Grp_ContractJBXX where BaseID=" + BaseID);
DataTable getjbxx = new DataTable();
getjbxx = SQLHelper.ExecuteDataset(sqlConn, sqlQuery.ToString());
getjbxx.Rows[0]["CONLANGUAGE"] = Language.Where(a => a.id == getjbxx.Rows[0]["CONLANGUAGE"].ToString()).Select(a => a.text).FirstOrDefault();
getjbxx.Rows[0]["CONPERFORMCOUNTRY"] = Country.Where(a => a.ZCOUNTRYCODE == getjbxx.Rows[0]["CONPERFORMCOUNTRY"].ToString()).Select(a => a.ZCOUNTRYNAME).FirstOrDefault();
getjbxx.Rows[0]["CONPERFORMPROVINCES"] = Addvs.Where(a => a.ZADDVSCODE == getjbxx.Rows[0]["CONPERFORMPROVINCES"].ToString()).Select(a => a.ZADDVSNAME).FirstOrDefault();
getjbxx.Rows[0]["CONPERFORMCITY"] = Addvs.Where(a => a.ZADDVSCODE == getjbxx.Rows[0]["CONLANGUAGE"].ToString()).Select(a => a.ZADDVSNAME).FirstOrDefault();
getjbxx.Rows[0]["CONPERFORMXIAN"] = Addvs.Where(a => a.ZADDVSCODE == getjbxx.Rows[0]["CONLANGUAGE"].ToString()).Select(a => a.ZADDVSNAME).FirstOrDefault();
getjbxx.Rows[0]["DISPUTESOLUTIONWAY"] = dicdata.Where(a => a.Category == "DM_ZYJJFS" && a.Code == getjbxx.Rows[0]["DISPUTESOLUTIONWAY"].ToString()).Select(a => a.Value).FirstOrDefault();
getjbxx.Rows[0]["ISYZDW"] = getjbxx.Rows[0]["ISYZDW"].ToString() == "1" ? "是" : getjbxx.Rows[0]["ISYZDW"].ToString() == "0" ? "否" : "";
getjbxx.Rows[0]["PERFORMSCHEDULE"] = dicdata.Where(a => a.Category == "DM_LYJD" && a.Code == getjbxx.Rows[0]["PERFORMSCHEDULE"].ToString()).Select(a => a.Value).FirstOrDefault();
getjbxx.Rows[0]["QYFTYPE"] = dicdata.Where(a => a.Category == "DM_QYFTYPE" && a.Code == getjbxx.Rows[0]["QYFTYPE"].ToString()).Select(a => a.Value).FirstOrDefault();
getjbxx.Rows[0]["PERFORMSTAGE"] = dicdata.Where(a => a.Category == "DM_LYJDStage" && a.Code == getjbxx.Rows[0]["PERFORMSTAGE"].ToString()).Select(a => a.Value).FirstOrDefault();
//getjbxx.Rows[0]["IS_ADD_PROTOCOL"] = ;
getjbxx.Rows[0]["SUBCONTRACT_CODE"] = db.Shj_Sys_ExternalDic.Where(a => a.Category == "ZSUBCONTRACT" && a.Code == getjbxx.Rows[0]["SUBCONTRACT_CODE"].ToString()).Select(a => a.Value).FirstOrDefault();
foreach (var item in getFieldData.rows.Where(a => a.FieldLayout == "jbxx"))
{
JBXXTitle.Add(item.FieldName);
if (item.FieldCode == "IS_ADD_PROTOCOL")
{
JBXXValue.Add(item.FieldName, getjbxx.Rows[0]["IS_ADD_PROTOCOL"].ToString() == "" ? "" : getjbxx.Rows[0]["IS_ADD_PROTOCOL"].ToString() == "1" ? "是" : getjbxx.Rows[0]["IS_ADD_PROTOCOL"].ToString() == "0" ? "否" : "");
}
else
{
JBXXValue.Add(item.FieldName, getjbxx.Rows[0][item.FieldCode]);
}
}
liResult.JBXXColnum.Add(JBXXTitle);
liResult.JBXXValue.Add(JBXXValue);
}
//特征信息
if (getFieldData.rows.Where(a => a.FieldLayout == "tzxx").Count() > 0)
{
var TZXXTitle = new List<string>();
var TZXXValue = new Dictionary<string, object>();
StringBuilder sqlQuery = new StringBuilder();
sqlQuery.Append("select * from Shj_Grp_ContractTZXX where BaseID=" + BaseID);
DataTable gettzxx = new DataTable();
gettzxx = SQLHelper.ExecuteDataset(sqlConn, sqlQuery.ToString());
gettzxx.Rows[0]["RATEMETHOD"] = dicdata.Where(a => a.Category == "DM_HLFS" && a.Code == gettzxx.Rows[0]["RATEMETHOD"].ToString()).Select(a => a.Value).FirstOrDefault();
gettzxx.Rows[0]["PAYMETHOD"] = dicdata.Where(a => a.Category == "DM_JKFS" && a.Code == gettzxx.Rows[0]["PAYMETHOD"].ToString()).Select(a => a.Value).FirstOrDefault();
gettzxx.Rows[0]["INVOICETYPE"] = InvoiceType.Where(a => a.id == gettzxx.Rows[0]["INVOICETYPE"].ToString()).Select(a => a.text).FirstOrDefault();
gettzxx.Rows[0]["ISSFYYFK"] = gettzxx.Rows[0]["ISSFYYFK"].ToString() == "1" ? "是" : gettzxx.Rows[0]["ISSFYYFK"].ToString() == "0" ? "否" : "";
gettzxx.Rows[0]["ISSFYBZJ"] = gettzxx.Rows[0]["ISSFYBZJ"].ToString() == "1" ? "是" : gettzxx.Rows[0]["ISSFYBZJ"].ToString() == "0" ? "否" : "";
gettzxx.Rows[0]["ISCOALITION"] = gettzxx.Rows[0]["ISCOALITION"].ToString() == "1" ? "是" : gettzxx.Rows[0]["ISCOALITION"].ToString() == "0" ? "否" : "";
gettzxx.Rows[0]["ISMATADJUSTMENT"] = gettzxx.Rows[0]["ISMATADJUSTMENT"].ToString() == "1" ? "是" : gettzxx.Rows[0]["ISMATADJUSTMENT"].ToString() == "0" ? "否" : "";
gettzxx.Rows[0]["FINISHVERIFYMETHOD"] = dicdata.Where(a => a.Category == "DM_JSSHFS" && a.Code == gettzxx.Rows[0]["FINISHVERIFYMETHOD"].ToString()).Select(a => a.Value).FirstOrDefault();
gettzxx.Rows[0]["PAYMENTMETHOD"] = dicdata.Where(a => a.Category == "DM_FKLX" && a.Code == gettzxx.Rows[0]["PAYMENTMETHOD"].ToString()).Select(a => a.Value).FirstOrDefault();
gettzxx.Rows[0]["ISSFYDB"] = gettzxx.Rows[0]["ISSFYDB"].ToString() == "1" ? "是" : gettzxx.Rows[0]["ISSFYDB"].ToString() == "0" ? "否" : "";
gettzxx.Rows[0]["PURCHASEMETHOD"] = dicdata.Where(a => a.Category == "DM_CGFS" && a.Code == gettzxx.Rows[0]["PURCHASEMETHOD"].ToString()).Select(a => a.Value).FirstOrDefault();
gettzxx.Rows[0]["ISAGREEMENT"] = gettzxx.Rows[0]["ISAGREEMENT"].ToString() == "1" ? "是" : gettzxx.Rows[0]["ISAGREEMENT"].ToString() == "0" ? "否" : "";
gettzxx.Rows[0]["VALIDPERIOD"] = dicdata.Where(a => a.Category == "DM_YXQX" && a.Code == gettzxx.Rows[0]["VALIDPERIOD"].ToString()).Select(a => a.Value).FirstOrDefault();
gettzxx.Rows[0]["DELIVERYMETHOD"] = dicdata.Where(a => a.Category == "DM_JHFS" && a.Code == gettzxx.Rows[0]["DELIVERYMETHOD"].ToString()).Select(a => a.Value).FirstOrDefault();
gettzxx.Rows[0]["AITT"] = dicdata.Where(a => a.Category == "DM_SYGJMYSY" && a.Code == gettzxx.Rows[0]["AITT"].ToString()).Select(a => a.Value).FirstOrDefault();
gettzxx.Rows[0]["PRICINGMETHOD"] = dicdata.Where(a => a.Category == "DM_DJFS" && a.Code == gettzxx.Rows[0]["PRICINGMETHOD"].ToString()).Select(a => a.Value).FirstOrDefault();
gettzxx.Rows[0]["REGISTERAMTCURRENCY"] = Currency.Where(a => a.ZCURRENCYCODE == gettzxx.Rows[0]["REGISTERAMTCURRENCY"].ToString()).Select(a => a.ZCURRENCYNAME).FirstOrDefault();
gettzxx.Rows[0]["ISGQXXBG"] = gettzxx.Rows[0]["ISGQXXBG"].ToString() == "1" ? "是" : gettzxx.Rows[0]["ISGQXXBG"].ToString() == "0" ? "否" : "";
gettzxx.Rows[0]["CREDITTYPE"] = dicdata.Where(a => a.Category == "DM_SXZL" && a.Code == gettzxx.Rows[0]["CREDITTYPE"].ToString()).Select(a => a.Value).FirstOrDefault();
gettzxx.Rows[0]["SYFS"] = dicdata.Where(a => a.Category == "DM_SYFS" && a.Code == gettzxx.Rows[0]["SYFS"].ToString()).Select(a => a.Value).FirstOrDefault();
gettzxx.Rows[0]["ISSJZF"] = gettzxx.Rows[0]["ISSJZF"].ToString() == "1" ? "是" : gettzxx.Rows[0]["ISSJZF"].ToString() == "0" ? "否" : "";
gettzxx.Rows[0]["ISZSQ"] = gettzxx.Rows[0]["ISZSQ"].ToString() == "1" ? "是" : gettzxx.Rows[0]["ISZSQ"].ToString() == "0" ? "否" : "";
gettzxx.Rows[0]["ISZYSX"] = gettzxx.Rows[0]["ISZYSX"].ToString() == "1" ? "是" : gettzxx.Rows[0]["ISZYSX"].ToString() == "0" ? "否" : "";
gettzxx.Rows[0]["FINANCELEASINGMODEL"] = dicdata.Where(a => a.Category == "DM_RZZPMS" && a.Code == gettzxx.Rows[0]["FINANCELEASINGMODEL"].ToString()).Select(a => a.Value).FirstOrDefault();
gettzxx.Rows[0]["LEASEGS"] = dicdata.Where(a => a.Category == "DM_ZPWGS" && a.Code == gettzxx.Rows[0]["LEASEGS"].ToString()).Select(a => a.Value).FirstOrDefault();
gettzxx.Rows[0]["ISCZFYXGMXZQ"] = gettzxx.Rows[0]["ISCZFYXGMXZQ"].ToString() == "1" ? "是" : gettzxx.Rows[0]["ISCZFYXGMXZQ"].ToString() == "0" ? "否" : "";
gettzxx.Rows[0]["ISCZRZZZLXZQ"] = gettzxx.Rows[0]["ISCZRZZZLXZQ"].ToString() == "1" ? "是" : gettzxx.Rows[0]["ISCZRZZZLXZQ"].ToString() == "0" ? "否" : "";
gettzxx.Rows[0]["RENTCALCULATION"] = dicdata.Where(a => a.Category == "DM_ZJJSFS" && a.Code == gettzxx.Rows[0]["RENTCALCULATION"].ToString()).Select(a => a.Value).FirstOrDefault();
gettzxx.Rows[0]["DERIVEDTOOLTYPE"] = dicdata.Where(a => a.Category == "DM_YSJRGJLX" && a.Code == gettzxx.Rows[0]["DERIVEDTOOLTYPE"].ToString()).Select(a => a.Value).FirstOrDefault();
gettzxx.Rows[0]["DERIVEDOBJECT"] = dicdata.Where(a => a.Category == "DM_YSDX" && a.Code == gettzxx.Rows[0]["DERIVEDOBJECT"].ToString()).Select(a => a.Value).FirstOrDefault();
gettzxx.Rows[0]["BILLKIND"] = dicdata.Where(a => a.Category == "DM_PJLX" && a.Code == gettzxx.Rows[0]["BILLKIND"].ToString()).Select(a => a.Value).FirstOrDefault();
gettzxx.Rows[0]["ISFRANCHISE"] = gettzxx.Rows[0]["ISFRANCHISE"].ToString() == "1" ? "是" : gettzxx.Rows[0]["ISFRANCHISE"].ToString() == "0" ? "否" : "";
gettzxx.Rows[0]["ISZCYJ"] = gettzxx.Rows[0]["ISZCYJ"].ToString() == "1" ? "是" : gettzxx.Rows[0]["ISZCYJ"].ToString() == "0" ? "否" : "";
gettzxx.Rows[0]["RETURNMETHOD"] = dicdata.Where(a => a.Category == "DM_HBFS" && a.Code == gettzxx.Rows[0]["RETURNMETHOD"].ToString()).Select(a => a.Value).FirstOrDefault();
gettzxx.Rows[0]["ISJXKH"] = gettzxx.Rows[0]["ISJXKH"].ToString() == "1" ? "是" : gettzxx.Rows[0]["ISJXKH"].ToString() == "0" ? "否" : "";
gettzxx.Rows[0]["SAFEKIND"] = dicdata.Where(a => a.Category == "DM_XZ" && a.Code == gettzxx.Rows[0]["SAFEKIND"].ToString()).Select(a => a.Value).FirstOrDefault();
gettzxx.Rows[0]["ISXYDK"] = gettzxx.Rows[0]["ISXYDK"].ToString() == "1" ? "是" : gettzxx.Rows[0]["ISXYDK"].ToString() == "0" ? "否" : "";
gettzxx.Rows[0]["REPAYMENTWAY"] = dicdata.Where(a => a.Category == "DM_HKFS" && a.Code == gettzxx.Rows[0]["REPAYMENTWAY"].ToString()).Select(a => a.Value).FirstOrDefault();
//gettzxx.Rows[0]["WORK_BOND_FORM"] = dicdata.Where(a => a.Category == "DM_DBXS" && a.Code == gettzxx.Rows[0]["WORK_BOND_FORM"].ToString()).Select(a => a.Value);
gettzxx.Rows[0]["CLCGJCJB"] = dicdata.Where(a => a.Category == "CLCGJCJB" && a.Code == gettzxx.Rows[0]["CLCGJCJB"].ToString()).Select(a => a.Value).FirstOrDefault();
gettzxx.Rows[0]["PAYCURRENCY"] = Currency.Where(a => a.ZCURRENCYCODE == gettzxx.Rows[0]["PAYCURRENCY"].ToString()).Select(a => a.ZCURRENCYNAME).FirstOrDefault();
// gettzxx.Rows[0]["HAS_RETENTION_MONEY"] = gettzxx.Rows[0]["HAS_RETENTION_MONEY"].ToString() == "1" ? "是" : gettzxx.Rows[0]["HAS_RETENTION_MONEY"].ToString() == "0" ? "否" : "";
//gettzxx.Rows[0]["HAS_OTHER_MONEY"] = gettzxx.Rows[0]["HAS_OTHER_MONEY"].ToString() == "1" ? "是" : gettzxx.Rows[0]["HAS_OTHER_MONEY"].ToString() == "0" ? "否" : "";
gettzxx.Rows[0]["INTERESTRATETZZQ"] = dicdata.Where(a => a.Category == "DM_LLTZZQ" && a.Code == gettzxx.Rows[0]["INTERESTRATETZZQ"].ToString()).Select(a => a.Value).FirstOrDefault();
gettzxx.Rows[0]["CURRENCY"] = Currency.Where(a => a.ZCURRENCYCODE == gettzxx.Rows[0]["CURRENCY"].ToString()).Select(a => a.ZCURRENCYNAME).FirstOrDefault();
foreach (var item in getFieldData.rows.Where(a => a.FieldLayout == "tzxx"))
{
TZXXTitle.Add(item.FieldName);
if (item.FieldCode == "HAS_WORK_AMT")
{
TZXXValue.Add(item.FieldName, gettzxx.Rows[0]["HAS_WORK_AMT"].ToString() == "1" ? "是" : gettzxx.Rows[0]["HAS_WORK_AMT"].ToString() == "0" ? "否" : "");
}
else if (item.FieldCode == "WORK_BOND_FORM")
{
TZXXValue.Add(item.FieldName, gettzxx.Rows[0]["WORK_BOND_FORM"].ToString() == "1" ? "是" : gettzxx.Rows[0]["WORK_BOND_FORM"].ToString() == "0" ? "否" : "");
}
else if (item.FieldCode == "HAS_RETENTION_MONEY")
{
TZXXValue.Add(item.FieldName, gettzxx.Rows[0]["HAS_RETENTION_MONEY"].ToString() == "1" ? "是" : gettzxx.Rows[0]["HAS_RETENTION_MONEY"].ToString() == "0" ? "否" : "");
}
else if (item.FieldCode == "HAS_OTHER_MONEY")
{
TZXXValue.Add(item.FieldName, gettzxx.Rows[0]["HAS_OTHER_MONEY"].ToString() == "1" ? "是" : gettzxx.Rows[0]["HAS_OTHER_MONEY"].ToString() == "0" ? "否" : "");
}
else
{
TZXXValue.Add(item.FieldName, gettzxx.Rows[0][item.FieldCode]);
}
}
liResult.TZXXColnum.Add(TZXXTitle);
liResult.TZXXValue.Add(TZXXValue);
}
// 基金信息
if (getFieldData.rows.Where(a => a.FieldLayout == "jjxx").Count() > 0)
{
var JJXXTitle = new List<string>();
var JJXXValue = new Dictionary<string, object>();
StringBuilder sqlQuery = new StringBuilder();
sqlQuery.Append("select * from Shj_Grp_ContractJJXX where BaseID=" + BaseID);
DataTable getjjxx = new DataTable();
getjjxx = SQLHelper.ExecuteDataset(sqlConn, sqlQuery.ToString());
getjjxx.Rows[0]["FUNDTYPE"] = dicdata.Where(a => a.Category == "DM_JJHTYWLX" && a.Code == getjjxx.Rows[0]["FUNDTYPE"].ToString()).Select(a => a.Value).FirstOrDefault();
getjjxx.Rows[0]["ISTRUSTEESHIP"] = getjjxx.Rows[0]["ISTRUSTEESHIP"].ToString() == "1" ? "是" : getjjxx.Rows[0]["ISTRUSTEESHIP"].ToString() == "0" ? "否" : "";
foreach (var item in getFieldData.rows.Where(a => a.FieldLayout == "jjxx"))
{
JJXXTitle.Add(item.FieldName);
JJXXValue.Add(item.FieldName, getjjxx.Rows[0][item.FieldCode]);
}
liResult.JJXXColnum.Add(JJXXTitle);
liResult.JJXXValue.Add(JJXXValue);
}
//票据信息
if (getFieldData.rows.Where(a => a.FieldLayout == "pjxx").Count() > 0)
{
var PJXXTitle = new List<string>();
var PJXXValue = new Dictionary<string, object>();
StringBuilder sqlQuery = new StringBuilder();
sqlQuery.Append("select * from Shj_Grp_ContractPJXX where BaseID=" + BaseID);
DataTable getpjxx = new DataTable();
getpjxx = SQLHelper.ExecuteDataset(sqlConn, sqlQuery.ToString());
getpjxx.Rows[0]["ISFEE"] = getpjxx.Rows[0]["ISFEE"].ToString() == "1" ? "是" : getpjxx.Rows[0]["ISFEE"].ToString() == "0" ? "否" : "";
getpjxx.Rows[0]["FEEPAYTYPE"] = dicdata.Where(a => a.Category == "DM_SXFZFFS" && a.Code == getpjxx.Rows[0]["FEEPAYTYPE"].ToString()).Select(a => a.Value).FirstOrDefault();
getpjxx.Rows[0]["ISRISKFEE"] = getpjxx.Rows[0]["ISRISKFEE"].ToString() == "1" ? "是" : getpjxx.Rows[0]["ISRISKFEE"].ToString() == "0" ? "否" : "";
getpjxx.Rows[0]["ISKFEEPAYTYPE"] = dicdata.Where(a => a.Category == "DM_FXGLFFKF" && a.Code == getpjxx.Rows[0]["ISKFEEPAYTYPE"].ToString()).Select(a => a.Value).FirstOrDefault();
foreach (var item in getFieldData.rows.Where(a => a.FieldLayout == "pjxx"))
{
PJXXTitle.Add(item.FieldName);
PJXXValue.Add(item.FieldName, getpjxx.Rows[0][item.FieldCode]);
}
liResult.PJXXColnum.Add(PJXXTitle);
liResult.PJXXValue.Add(PJXXValue);
}
//租赁信息
if (getFieldData.rows.Where(a => a.FieldLayout == "zlxx").Count() > 0)
{
var ZLXXTitle = new List<string>();
var ZLXXValue = new Dictionary<string, object>();
StringBuilder sqlQuery = new StringBuilder();
sqlQuery.Append("select * from Shj_Grp_ContractZLXX where BaseID=" + BaseID);
DataTable getzlxx = new DataTable();
getzlxx = SQLHelper.ExecuteDataset(sqlConn, sqlQuery.ToString());
getzlxx.Rows[0]["LANDOWNERSHIP"] = dicdata.Where(a => a.Category == "DM_TDSYQXZ" && a.Code == getzlxx.Rows[0]["LANDOWNERSHIP"].ToString()).Select(a => a.Value).FirstOrDefault();
getzlxx.Rows[0]["LANDUSETYPE"] = dicdata.Where(a => a.Category == "DM_TDYTFL" && a.Code == getzlxx.Rows[0]["LANDUSETYPE"].ToString()).Select(a => a.Value).FirstOrDefault();
getzlxx.Rows[0]["RENTPERIOD"] = dicdata.Where(a => a.Category == "DM_ZLQX" && a.Code == getzlxx.Rows[0]["RENTPERIOD"].ToString()).Select(a => a.Value).FirstOrDefault();
foreach (var item in getFieldData.rows.Where(a => a.FieldLayout == "zlxx"))
{
ZLXXTitle.Add(item.FieldName);
ZLXXValue.Add(item.FieldName, getzlxx.Rows[0][item.FieldCode]);
}
liResult.ZLXXColnum.Add(ZLXXTitle);
liResult.ZLXXValue.Add(ZLXXValue);
}
//保理信息
if (getFieldData.rows.Where(a => a.FieldLayout == "blxx").Count() > 0)
{
var BLXXTitle = new List<string>();
var BLXXValue = new Dictionary<string, object>();
StringBuilder sqlQuery = new StringBuilder();
sqlQuery.Append("select * from Shj_Grp_ContractBLXX where BaseID=" + BaseID);
DataTable getblxx = new DataTable();
getblxx = SQLHelper.ExecuteDataset(sqlConn, sqlQuery.ToString());
getblxx.Rows[0]["FACTYPE"] = dicdata.Where(a => a.Category == "DM_BLSXEDLX" && a.Code == getblxx.Rows[0]["FACTYPE"].ToString()).Select(a => a.Value).FirstOrDefault();
getblxx.Rows[0]["FINANCEMETHOD"] = dicdata.Where(a => a.Category == "DM_BLRZFS" && a.Code == getblxx.Rows[0]["FINANCEMETHOD"].ToString()).Select(a => a.Value).FirstOrDefault();
getblxx.Rows[0]["INTERESTRATETYPE"] = dicdata.Where(a => a.Category == "DM_LLLX" && a.Code == getblxx.Rows[0]["INTERESTRATETYPE"].ToString()).Select(a => a.Value).FirstOrDefault();
getblxx.Rows[0]["INTERESTRATEZL"] = dicdata.Where(a => a.Category == "DM_LLZL" && a.Code == getblxx.Rows[0]["INTERESTRATEZL"].ToString()).Select(a => a.Value).FirstOrDefault();
foreach (var item in getFieldData.rows.Where(a => a.FieldLayout == "blxx"))
{
BLXXTitle.Add(item.FieldName);
BLXXValue.Add(item.FieldName, getblxx.Rows[0][item.FieldCode]);
}
liResult.BLXXColnum.Add(BLXXTitle);
liResult.BLXXValue.Add(BLXXValue);
}
//我方签约单位
var ContractPartiesunitTitle = new List<string>();
ContractPartiesunitTitle.Add("签约单位编码");
ContractPartiesunitTitle.Add("签约单位名称");
ContractPartiesunitTitle.Add("签约单位类型");
liResult.ContractPartiesunitColnum.Add(ContractPartiesunitTitle);
ContractPartiesunitQuery ContractPartiesunitparam = new ContractPartiesunitQuery();
ContractPartiesunitparam.BaseID = BaseID;
var getCpdata = ContractPartiesunit.getCP(ContractPartiesunitparam);
foreach (var item in getCpdata.rows)
{
var ContractPartiesunitValue = new Dictionary<string, object>();
ContractPartiesunitValue.Add("签约单位编码", item.PARTIESUNITID);
ContractPartiesunitValue.Add("签约单位名称", item.PARTIESUNITNAME);
ContractPartiesunitValue.Add("签约单位类型", item.PARTIESUNITTypeName);
liResult.ContractPartiesunitValue.Add(ContractPartiesunitValue);
}
//实际履约主体
var SJLYDWTitle = new List<string>();
SJLYDWTitle.Add("实际履约主体编码");
SJLYDWTitle.Add("实际履约主体名称");
SJLYDWTitle.Add("实际履约主体编号");
SJLYDWTitle.Add("核算单位编码");
SJLYDWTitle.Add("核算单位名称");
liResult.SJLYDWColnum.Add(SJLYDWTitle);
ContractSJLYDWQuery SJLYDWParam = new ContractSJLYDWQuery();
SJLYDWParam.BaseID = BaseID;
var getSJLYDWdata = ContractSJLYDW.getSJLYDW(SJLYDWParam);
foreach (var item in getSJLYDWdata.rows)
{
var SJLYDWValue = new Dictionary<string, object>();
SJLYDWValue.Add("实际履约主体编码", item.SJLYDWID);
SJLYDWValue.Add("实际履约主体名称", item.SJLYDWNAME);
SJLYDWValue.Add("实际履约主体编号", item.SJLYDWCODE);
SJLYDWValue.Add("核算单位编码", item.AccountUnitCode);
SJLYDWValue.Add("核算单位名称", item.AccountUnitName);
liResult.SJLYDWValue.Add(SJLYDWValue);
}
//保证金信息
var BZJXXTitle = new List<string>();
BZJXXTitle.Add("保证金");
BZJXXTitle.Add("保证金比例");
BZJXXTitle.Add("保证金金额");
BZJXXTitle.Add("保证金退还条件");
BZJXXTitle.Add("保证金抵扣方式");
liResult.BZJXXColnum.Add(BZJXXTitle);
ContractBZJXXQuery BZJXXParam = new ContractBZJXXQuery();
BZJXXParam.BaseID = BaseID;
var getBZJXXdata = ContractBZJXX.getBZJXX(BZJXXParam);
foreach (var item in getBZJXXdata.rows)
{
var BZJXXValue = new Dictionary<string, object>();
BZJXXValue.Add("保证金", item.GUARANTYTYPEName);
BZJXXValue.Add("保证金比例", item.GUARANTYPROPORT);
BZJXXValue.Add("保证金金额", item.GUARANTYAMT);
BZJXXValue.Add("保证金退还条件", item.GUARANTYXJZFBHTHTJ);
BZJXXValue.Add("保证金抵扣方式", item.DEDUCTName);
liResult.BZJXXValue.Add(BZJXXValue);
}
//担保信息
var DBXXTitle = new List<string>();
DBXXTitle.Add("担保类别");
DBXXTitle.Add("担保形式");
DBXXTitle.Add("担保比例");
DBXXTitle.Add("担保金额");
DBXXTitle.Add("退还条件");
liResult.DBXXColnum.Add(DBXXTitle);
ContractDBXXQuery DBXXParam = new ContractDBXXQuery();
DBXXParam.BaseID = BaseID;
var getDBXXdata = ContractDBXX.getDBXX(DBXXParam);
foreach (var item in getDBXXdata.rows)
{
var DBXXValue = new Dictionary<string, object>();
DBXXValue.Add("担保类别", item.GUARANTYCLASSIFYName);
DBXXValue.Add("担保形式", item.GUARANTYFORMName);
DBXXValue.Add("担保比例", item.GUARANTYPROPORT);
DBXXValue.Add("担保金额", item.GUARANTYAMT);
DBXXValue.Add("退还条件", item.BACKRULE);
liResult.DBXXValue.Add(DBXXValue);
}
//股东信息
var GDXXTitle = new List<string>();
GDXXTitle.Add("隐名股东名称");
GDXXTitle.Add("隐名股东编码");
GDXXTitle.Add("代持股东名称");
GDXXTitle.Add("代持股东编码");
GDXXTitle.Add("代持股权比例");
GDXXTitle.Add("股东类型");
liResult.GDXXColnum.Add(GDXXTitle);
ContractGDXXQuery GDXXParam = new ContractGDXXQuery();
GDXXParam.BaseID = BaseID;
var getGDXXdata = ContractGDXX.getGDXX(GDXXParam);
foreach (var item in getGDXXdata.rows)
{
var GDXXValue = new Dictionary<string, object>();
GDXXValue.Add("隐名股东名称", item.HIDESHAREHOLDERNAME);
GDXXValue.Add("隐名股东编码", item.HIDESHAREHOLDERID);
GDXXValue.Add("代持股东名称", item.SHAREHOLDERNAME);
GDXXValue.Add("代持股东编码", item.SHAREHOLDERID);
GDXXValue.Add("代持股权比例", item.SHAREHOLDERRATIO);
GDXXValue.Add("股东类型", item.TRANSFERTYPEName);
liResult.GDXXValue.Add(GDXXValue);
}
//保险信息
var BXXXTitle = new List<string>();
BXXXTitle.Add("险种名称");
BXXXTitle.Add("保险金额");
BXXXTitle.Add("免赔额");
liResult.BXXXColnum.Add(BXXXTitle);
ContractBXXXQuery BXXXParam = new ContractBXXXQuery();
BXXXParam.BaseID = BaseID;
var getBXXXdata = ContractBXXX.getBXXX(BXXXParam);
foreach (var item in getBXXXdata.rows)
{
var BXXXValue = new Dictionary<string, object>();
BXXXValue.Add("险种名称", item.INSURANCENAME);
BXXXValue.Add("保险金额", item.INSURANCEAMT);
BXXXValue.Add("免赔额", item.DEDUCTIBLE);
liResult.BXXXValue.Add(BXXXValue);
}
//担保信息
var DBXX2Title = new List<string>();
DBXX2Title.Add("被担保合同名称");
DBXX2Title.Add("担保方编码");
DBXX2Title.Add("担保方名称");
DBXX2Title.Add("担保性质");
DBXX2Title.Add("担保类型");
DBXX2Title.Add("担保期间");
DBXX2Title.Add("担保金额");
DBXX2Title.Add("担保金额规则");
DBXX2Title.Add("担保种类");
DBXX2Title.Add("是否反担保");
DBXX2Title.Add("担保方式");
DBXX2Title.Add("抵押品/质押品类型");
DBXX2Title.Add("抵押品/质押品资产金额");
liResult.DBXX2Colnum.Add(DBXX2Title);
ContractDBXX2Query DBXX2Param = new ContractDBXX2Query();
DBXX2Param.BaseID = BaseID;
var getDBXX2data = ContractDBXX2.getDBXX2(DBXX2Param);
foreach (var item in getDBXX2data.rows)
{
var DBXX2Value = new Dictionary<string, object>();
DBXX2Value.Add("被担保合同名称", item.GUARANTYCONName);
DBXX2Value.Add("担保方编码", item.GUARANTYUNITID);
DBXX2Value.Add("担保方名称", item.GUARANTYUNIT);
DBXX2Value.Add("担保性质", item.GUARANTYNATUREName);
DBXX2Value.Add("担保类型", item.GUARANTYTYPEName);
DBXX2Value.Add("担保期间", item.GUARANTYCYCLE);
DBXX2Value.Add("担保金额", item.GUARANTYAMT);
DBXX2Value.Add("担保金额规则", item.GUARANTYRULE);
DBXX2Value.Add("担保种类", item.GUARANTYZLName);
DBXX2Value.Add("是否反担保", item.ISFDBName);
DBXX2Value.Add("担保方式", item.GUARANTYWAY);
DBXX2Value.Add("抵押品/质押品类型", item.COLLATERALTYPEName);
DBXX2Value.Add("抵押品/质押品资产金额", item.COLLATERALAMT);
liResult.DBXX2Value.Add(DBXX2Value);
}
//合同支付信息:付款单位信息
var FKDWTitle = new List<string>();
FKDWTitle.Add("支出方");
FKDWTitle.Add("支出方ID");
FKDWTitle.Add("实际付款人");
FKDWTitle.Add("实际付款人ID");
FKDWTitle.Add("应付合同金额");
liResult.FKDWColnum.Add(FKDWTitle);
ContractFKDWQuery FKDWParam = new ContractFKDWQuery();
FKDWParam.BaseID = BaseID;
var getFKDWdata = ContractFKDW.getFKDW(FKDWParam);
foreach (var item in getFKDWdata.rows)
{
var FKDWValue = new Dictionary<string, object>();
FKDWValue.Add("支出方", item.DRAWEE);
FKDWValue.Add("支出方ID", item.DRAWEEID);
FKDWValue.Add("实际付款人", item.ACTDRAWEE);
FKDWValue.Add("实际付款人ID", item.ACTDRAWEEID);
FKDWValue.Add("应付合同金额", item.AMT);
liResult.FKDWValue.Add(FKDWValue);
}
//合同对方信息
var HTDFTitle = new List<string>();
HTDFTitle.Add("往来单位名称");
HTDFTitle.Add("往来单位编码");
HTDFTitle.Add("签约方类型");
HTDFTitle.Add("是否业主单位");
HTDFTitle.Add("合同相对方是否有授权人");
liResult.HTDFColnum.Add(HTDFTitle);
ContractHTDFQuery HTDFParam = new ContractHTDFQuery();
HTDFParam.BaseID = BaseID;
var getHTDFdata = ContractHTDF.getHTDF(HTDFParam);
foreach (var item in getHTDFdata.rows)
{
var HTDFValue = new Dictionary<string, object>();
HTDFValue.Add("往来单位名称", item.ORGUNITNAME);
HTDFValue.Add("往来单位编码", item.ORGUNITID);
HTDFValue.Add("签约方类型", item.QYFTYPEName);
HTDFValue.Add("是否业主单位", item.ISYZDWName);
HTDFValue.Add("合同相对方是否有授权人", item.ISSQRName);
liResult.HTDFValue.Add(HTDFValue);
}
//合同支付信息:收款单位信息
var SKDWTitle = new List<string>();
SKDWTitle.Add("收入方");
SKDWTitle.Add("收入方ID");
SKDWTitle.Add("实际收款人");
SKDWTitle.Add("实际收款人ID");
SKDWTitle.Add("收款人账户信息");
SKDWTitle.Add("开户行国别");
SKDWTitle.Add("收入方ID");
SKDWTitle.Add("收款人账户-开户行");
SKDWTitle.Add("收款人账户-账户名称");
SKDWTitle.Add("收款人账户-账号");
SKDWTitle.Add("SwiftCode");
SKDWTitle.Add("应收合同金额");
liResult.SKDWColnum.Add(SKDWTitle);
ContractSKDWQuery SKDWParam = new ContractSKDWQuery();
SKDWParam.BaseID = BaseID;
var getSKDWdata = ContractSKDW.getSKDW(SKDWParam);
foreach (var item in getSKDWdata.rows)
{
var SKDWValue = new Dictionary<string, object>();
SKDWValue.Add("收入方", item.PAYEE);
SKDWValue.Add("收入方ID", item.PAYEEID);
SKDWValue.Add("实际收款人", item.ACTPAYEE);
SKDWValue.Add("实际收款人ID", item.ACTPAYEEID);
SKDWValue.Add("收款人账户信息", item.PAYEEACCOUNTYPEName);
SKDWValue.Add("开户行国别", item.BANKCOUNTRYNAME);
SKDWValue.Add("收款人账户-开户行", item.PAYEEACCOUNBANK);
SKDWValue.Add("收款人账户-账户名称", item.PAYEEACCOUNNAME);
SKDWValue.Add("收款人账户-账号", item.PAYEEACCOUNNUMBER);
SKDWValue.Add("SwiftCode", item.SWIFTCODE);
SKDWValue.Add("应收合同金额", item.AMT);
liResult.SKDWValue.Add(SKDWValue);
}
//审批信息
var WorkFlowTitle = new List<string>();
WorkFlowTitle.Add("审批节点名称");
WorkFlowTitle.Add("审批人");
WorkFlowTitle.Add("审批动作");
WorkFlowTitle.Add("审批意见");
WorkFlowTitle.Add("审批时间");
liResult.WorkFlowColnum.Add(WorkFlowTitle);
List<SPRZEntity> SPRZ = new List<SPRZEntity>();
if (getCondata.BaseInfo.WorkFlowID > 0 && !string.IsNullOrEmpty(getCondata.FlowNo))
{
int FlowNoInt = Convert.ToInt32(getCondata.FlowNo);
string trackTableName = "ND" + FlowNoInt + "Track";
StringBuilder sb = new StringBuilder();
//这段SQL是查询当前流程审批意见集合
sb.AppendLine("select cast(n.mypk as varchar) as SPRZID,w.FlowName as RWMC,n.NDFromT as JDMC, ");
sb.AppendLine("case when u.Usr_Name!='' and u.Usr_Name is not null then u.Usr_Name else n.EmpFromT end as SPR, ");
//审批意见超过500截取至最多500的长度
sb.AppendLine("n.ActionTypeText as SPDZ, ");
sb.AppendLine(" case when n.NodeData='' or n.NodeData is null then '无' ");
sb.AppendLine("when len(n.NodeData)>500 then SUBSTRING(n.NodeData,0,500) else n.NodeData end as SPYJ, ");
sb.AppendLine("n.RDT as KSRQ,n.RDT as SPRQ ");
sb.AppendLine("from " + trackTableName + " n ");
sb.AppendLine("join WF_GenerWorkFlow w on n.WorkID=w.WorkID ");
sb.AppendLine("left join shj_sys_user u on u.Usr_Code=n.EmpFrom");
sb.AppendLine("where n.WorkID=" + getCondata.BaseInfo.WorkFlowID.ToString() + " order by n.rdt desc ");
DataTable getSPXX = new DataTable();
getSPXX = SQLHelper.ExecuteDataset(sqlConn, sb.ToString());
//getblxx.Rows[0][item.FieldCode];
foreach (DataRow item in getSPXX.Rows)
{
var WorkFlowValue = new Dictionary<string, object>();
WorkFlowValue.Add("审批节点名称", item["JDMC"].ToString());
WorkFlowValue.Add("审批人", item["SPR"].ToString());
WorkFlowValue.Add("审批动作", item["SPDZ"].ToString());
WorkFlowValue.Add("审批意见", item["SPYJ"].ToString());
WorkFlowValue.Add("审批时间", item["SPRQ"].ToString());
liResult.WorkFlowValue.Add(WorkFlowValue);
}
}
}
catch (Exception ex)
{
Logger.Write(typeof(NPOIModel), ex);
liResult.ErrorMessage = ex.Message;
return liResult;
}
return liResult;
}
public class NPOIModel
{
public List<object> BaseColnum { get; set; }
public List<object> BaseValue { get; set; }
public List<object> JBXXColnum { get; set; }
public List<object> JBXXValue { get; set; }
public List<object> JJXXColnum { get; set; }
public List<object> JJXXValue { get; set; }
public List<object> PJXXColnum { get; set; }
public List<object> PJXXValue { get; set; }
public List<object> TZXXColnum { get; set; }
public List<object> TZXXValue { get; set; }
public List<object> ZLXXColnum { get; set; }
public List<object> ZLXXValue { get; set; }
public List<object> BLXXColnum { get; set; }
public List<object> BLXXValue { get; set; }
//我方签约单位
public List<object> ContractPartiesunitColnum { get; set; }
public List<object> ContractPartiesunitValue { get; set; }
//实际履约主体
public List<object> SJLYDWColnum { get; set; }
public List<object> SJLYDWValue { get; set; }
//保证金信息
public List<object> BZJXXColnum { get; set; }
public List<object> BZJXXValue { get; set; }
//担保信息
public List<object> DBXXColnum { get; set; }
public List<object> DBXXValue { get; set; }
//股东信息
public List<object> GDXXColnum { get; set; }
public List<object> GDXXValue { get; set; }
//保险信息
public List<object> BXXXColnum { get; set; }
public List<object> BXXXValue { get; set; }
//担保信息
public List<object> DBXX2Colnum { get; set; }
public List<object> DBXX2Value { get; set; }
//合同支付信息:付款单位信息
public List<object> FKDWColnum { get; set; }
public List<object> FKDWValue { get; set; }
//合同对方信息
public List<object> HTDFColnum { get; set; }
public List<object> HTDFValue { get; set; }
//合同支付信息:收款单位信息
public List<object> SKDWColnum { get; set; }
public List<object> SKDWValue { get; set; }
//审批信息
public List<object> WorkFlowColnum { get; set; }
public List<object> WorkFlowValue { get; set; }
public string ErrorMessage { get; set; }
public string FileName { get; set; }
}
public class SPRZEntity
{
public string SPRZID { get; set; }
public string RWMC { get; set; }
public string JDMC { get; set; }
public string SPR { get; set; }
public string SPDZ { get; set; }
public string SPYJ { get; set; }
public string KSRQ { get; set; }
public string SPRQ { get; set; }
}
public sealed class SQLHelper
{
public static int ExecuteNonQuery(string connectionString, string SqlString)
{
SqlConnection connection = new SqlConnection(connectionString);
using (SqlCommand command = new SqlCommand(SqlString, connection))
{
connection.Open();
SqlTransaction ts = connection.BeginTransaction();
try
{
command.Transaction = ts;
command.CommandTimeout = 600;
int commandResult = command.ExecuteNonQuery();
ts.Commit();
return commandResult;
}
catch (Exception ex)
{
ts.Rollback();
throw ex;
}
finally
{
if (connection != null)
connection.Close();
}
}
}
public static int ExecuteScalar(string connectionString, string SqlString)
{
SqlConnection connection = new SqlConnection(connectionString);
using (SqlCommand command = new SqlCommand(SqlString, connection))
{
connection.Open();
SqlTransaction ts = connection.BeginTransaction();
try
{
command.Transaction = ts;
command.CommandTimeout = 600;
object commandResult = command.ExecuteScalar();
ts.Commit();
return Convert.ToInt32(commandResult);
}
catch (Exception ex)
{
ts.Rollback();
throw ex;
}
finally
{
if (connection != null)
connection.Close();
}
}
}
public static DataTable ExecuteDataset(string connectionString, string queryString)
{
using (SqlConnection connection = new SqlConnection(connectionString))
{
using (SqlCommand command = new SqlCommand(queryString, connection))
{
using (SqlDataAdapter adapter = new SqlDataAdapter(command))
{
try
{
connection.Open();
DataTable dt = new DataTable();
adapter.Fill(dt);
return dt;
}
catch (Exception ex)
{
//WriterTextLog.WriteEntry("StackTrace:" + ex.StackTrace + " Message:" + ex.Message);
throw ex;
}
finally
{
if (connection != null)
connection.Close();
}
}
}
}
}
}
763

被折叠的 条评论
为什么被折叠?



