|
|
@@ -77,8 +77,9 @@ namespace UAS_LabelMachine
|
|
|
string filePath = @FolderPath + "\\" + FileName + ".xls";
|
|
|
int counter = 1;
|
|
|
string filename = FileName + ".xls";
|
|
|
- while (File.Exists(filePath)) {
|
|
|
- filename = string.Format("{0}({1}){2}", FileName , counter, ".xls"); //文件名+(count)+后缀
|
|
|
+ while (File.Exists(filePath))
|
|
|
+ {
|
|
|
+ filename = string.Format("{0}({1}){2}", FileName, counter, ".xls"); //文件名+(count)+后缀
|
|
|
filePath = Path.Combine(FolderPath, filename); //保存路径
|
|
|
counter++; //count+1
|
|
|
}
|
|
|
@@ -313,14 +314,12 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
小计 = "小计";
|
|
|
总计 = "总计";
|
|
|
- 片 = "片";
|
|
|
companyname = "深爱半导体股份有限公司芯片出货清单";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
小计 = "total";
|
|
|
总计 = "total";
|
|
|
- 片 = "slice";
|
|
|
companyname = "SHENZHEN SI SEMICONDUCTORS CO.,LTD";
|
|
|
}
|
|
|
//转换为序列
|
|
|
@@ -383,16 +382,13 @@ namespace UAS_LabelMachine
|
|
|
NotShowColumn.Add("pr_orispeccode1");
|
|
|
NotShowColumn.Add("pi_title");
|
|
|
NotShowColumn.Add("pi_chipouttype");
|
|
|
+ NotShowColumn.Add("pi_date");
|
|
|
+
|
|
|
+ int ShowColumnCount = 0;
|
|
|
//展示的内容列
|
|
|
- int ShowColumnsCount = 0;
|
|
|
//设置列的宽度,根据首行的列的内容的长度来设置
|
|
|
for (int i = DataTable.Columns.Count - 1; i > 0; i--)
|
|
|
{
|
|
|
- //统计显示的列数
|
|
|
- if (!NotShowColumn.Contains(DataTable.Columns[i].ColumnName.ToLower()))
|
|
|
- {
|
|
|
- ShowColumnsCount = ShowColumnsCount + 1;
|
|
|
- }
|
|
|
for (int j = 0; j < box.Length; j++)
|
|
|
{
|
|
|
if (box[j].Name.ToLower() == "ch_bluefilm" && !box[j].Checked)
|
|
|
@@ -464,7 +460,7 @@ namespace UAS_LabelMachine
|
|
|
row.GetCell(0).CellStyle.SetFont((ffont));
|
|
|
//ffont.FontHeight = 10;
|
|
|
//开始绘制的Index
|
|
|
- int PaintIndex = 1;
|
|
|
+ int PaintIndex = 0;
|
|
|
int sumCount = 0;
|
|
|
int totalCount = 0;
|
|
|
switch (Type)
|
|
|
@@ -523,7 +519,7 @@ namespace UAS_LabelMachine
|
|
|
First_Batch = "";
|
|
|
First_WID.Clear();
|
|
|
BoxCode = BoxCode + 1;
|
|
|
- for (int j = 0; j < columnNum - 4; j++)
|
|
|
+ for (int j = 0; j < ShowColumnCount; j++)
|
|
|
{
|
|
|
row1.CreateCell(j);
|
|
|
if (j == 0)
|
|
|
@@ -601,17 +597,20 @@ namespace UAS_LabelMachine
|
|
|
//添加列名
|
|
|
row1 = sheet.CreateRow(PaintIndex);
|
|
|
PaintIndex = PaintIndex + 1;
|
|
|
- //计数列所在的索引
|
|
|
+ //计数列所在的索引
|
|
|
+ int showcount = 0;
|
|
|
for (int j = 4; j < columnNum; j++)
|
|
|
{
|
|
|
if (DataTable.Columns[j].ColumnName.ToLower() == "chw_percent1")
|
|
|
{
|
|
|
+ showcount = showcount + 1;
|
|
|
row1.CreateCell(j - 4);
|
|
|
row1.Cells[j - 4].CellStyle = ColumnTitleStyle;
|
|
|
row1.Cells[j - 4].SetCellValue(DataTable.Rows[i]["chw_itemname1"].ToString());
|
|
|
}
|
|
|
else if (DataTable.Columns[j].ColumnName.ToLower() == "chw_percent2")
|
|
|
{
|
|
|
+ showcount = showcount + 1;
|
|
|
row1.CreateCell(j - 4);
|
|
|
row1.Cells[j - 4].CellStyle = ColumnTitleStyle;
|
|
|
row1.Cells[j - 4].SetCellValue(DataTable.Rows[i]["chw_itemname2"].ToString());
|
|
|
@@ -623,6 +622,7 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ showcount = showcount + 1;
|
|
|
row1.CreateCell(j - 4);
|
|
|
row1.Cells[j - 4].CellStyle = ColumnTitleStyle;
|
|
|
row1.Cells[j - 4].SetCellValue(DataTable.Columns[j].Caption);
|
|
|
@@ -633,6 +633,7 @@ namespace UAS_LabelMachine
|
|
|
NumIndex = j;
|
|
|
}
|
|
|
}
|
|
|
+ ShowColumnCount = showcount;
|
|
|
row1 = sheet.CreateRow(PaintIndex);
|
|
|
PaintIndex = PaintIndex + 1;
|
|
|
}
|
|
|
@@ -680,7 +681,7 @@ namespace UAS_LabelMachine
|
|
|
FirstDT.Rows.Add(dr);
|
|
|
row1 = sheet.CreateRow(PaintIndex);
|
|
|
PaintIndex = PaintIndex + 1;
|
|
|
- for (int j = 0; j < columnNum - 4; j++)
|
|
|
+ for (int j = 0; j < ShowColumnCount; j++)
|
|
|
{
|
|
|
row1.CreateCell(j);
|
|
|
if (j == 0)
|
|
|
@@ -756,7 +757,7 @@ namespace UAS_LabelMachine
|
|
|
if (LastBatchCode != "" && LastBatchCode != DataTable.Rows[i]["ch_splitbatch"].ToString())
|
|
|
{
|
|
|
BoxCode = BoxCode + 1;
|
|
|
- for (int j = 0; j < columnNum - 4; j++)
|
|
|
+ for (int j = 0; j < ShowColumnCount; j++)
|
|
|
{
|
|
|
|
|
|
row1.CreateCell(j);
|
|
|
@@ -791,7 +792,7 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
LastBatchCode = DataTable.Rows[i]["ch_splitbatch"].ToString();
|
|
|
//第一行添加客户信息
|
|
|
- if (i != rowNum - 1)
|
|
|
+ //if (i != rowNum - 1)
|
|
|
{
|
|
|
for (int j = 0; j < columnNum - 3; j++)
|
|
|
{
|
|
|
@@ -842,16 +843,19 @@ namespace UAS_LabelMachine
|
|
|
//添加列名
|
|
|
row1 = sheet.CreateRow(PaintIndex);
|
|
|
PaintIndex = PaintIndex + 1;
|
|
|
+ int showcount = 0;
|
|
|
for (int j = 4; j < columnNum; j++)
|
|
|
{
|
|
|
if (DataTable.Columns[j].ColumnName.ToLower() == "chw_percent1")
|
|
|
{
|
|
|
+ showcount = showcount + 1;
|
|
|
row1.CreateCell(j - 4);
|
|
|
row1.Cells[j - 4].CellStyle = ColumnTitleStyle;
|
|
|
row1.Cells[j - 4].SetCellValue(DataTable.Rows[i]["chw_itemname1"].ToString());
|
|
|
}
|
|
|
else if (DataTable.Columns[j].ColumnName.ToLower() == "chw_percent2")
|
|
|
{
|
|
|
+ showcount = showcount + 1;
|
|
|
row1.CreateCell(j - 4);
|
|
|
row1.Cells[j - 4].CellStyle = ColumnTitleStyle;
|
|
|
row1.Cells[j - 4].SetCellValue(DataTable.Rows[i]["chw_itemname2"].ToString());
|
|
|
@@ -863,11 +867,13 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ showcount = showcount + 1;
|
|
|
row1.CreateCell(j - 4);
|
|
|
row1.Cells[j - 4].CellStyle = ColumnTitleStyle;
|
|
|
row1.Cells[j - 4].SetCellValue(DataTable.Columns[j].Caption);
|
|
|
}
|
|
|
}
|
|
|
+ ShowColumnCount = showcount;
|
|
|
row1 = sheet.CreateRow(PaintIndex);
|
|
|
PaintIndex = PaintIndex + 1;
|
|
|
}
|
|
|
@@ -902,7 +908,7 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
row1 = sheet.CreateRow(PaintIndex);
|
|
|
PaintIndex = PaintIndex + 1;
|
|
|
- for (int j = 0; j < columnNum - 4; j++)
|
|
|
+ for (int j = 0; j < ShowColumnCount; j++)
|
|
|
{
|
|
|
row1.CreateCell(j);
|
|
|
if (j == 0)
|
|
|
@@ -985,7 +991,7 @@ namespace UAS_LabelMachine
|
|
|
if (LastBoxCode != "" && LastBoxCode != DataTable.Rows[i]["CH_PBCODE"].ToString())
|
|
|
{
|
|
|
BoxCode = BoxCode + 1;
|
|
|
- for (int j = 0; j < columnNum - 4; j++)
|
|
|
+ for (int j = 0; j < ShowColumnCount; j++)
|
|
|
{
|
|
|
row1.CreateCell(j);
|
|
|
if (j == 0)
|
|
|
@@ -1018,7 +1024,7 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
LastBoxCode = DataTable.Rows[i]["CH_PBCODE"].ToString();
|
|
|
//第一行添加客户信息
|
|
|
- if (i != rowNum - 1)
|
|
|
+ //if (i != rowNum - 1)
|
|
|
{
|
|
|
for (int j = 0; j < columnNum - 3; j++)
|
|
|
{
|
|
|
@@ -1069,16 +1075,19 @@ namespace UAS_LabelMachine
|
|
|
//添加列名
|
|
|
row1 = sheet.CreateRow(PaintIndex);
|
|
|
PaintIndex = PaintIndex + 1;
|
|
|
+ int showcount = 0;
|
|
|
for (int j = 4; j < columnNum; j++)
|
|
|
{
|
|
|
if (DataTable.Columns[j].ColumnName.ToLower() == "chw_percent1")
|
|
|
{
|
|
|
+ showcount = showcount + 1;
|
|
|
row1.CreateCell(j - 4);
|
|
|
row1.Cells[j - 4].CellStyle = ColumnTitleStyle;
|
|
|
row1.Cells[j - 4].SetCellValue(DataTable.Rows[i]["chw_itemname1"].ToString());
|
|
|
}
|
|
|
else if (DataTable.Columns[j].ColumnName.ToLower() == "chw_percent2")
|
|
|
{
|
|
|
+ showcount = showcount + 1;
|
|
|
row1.CreateCell(j - 4);
|
|
|
row1.Cells[j - 4].CellStyle = ColumnTitleStyle;
|
|
|
row1.Cells[j - 4].SetCellValue(DataTable.Rows[i]["chw_itemname2"].ToString());
|
|
|
@@ -1090,11 +1099,13 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ showcount = showcount + 1;
|
|
|
row1.CreateCell(j - 4);
|
|
|
row1.Cells[j - 4].CellStyle = ColumnTitleStyle;
|
|
|
row1.Cells[j - 4].SetCellValue(DataTable.Columns[j].Caption);
|
|
|
}
|
|
|
}
|
|
|
+ ShowColumnCount = showcount;
|
|
|
row1 = sheet.CreateRow(PaintIndex);
|
|
|
PaintIndex = PaintIndex + 1;
|
|
|
}
|
|
|
@@ -1129,7 +1140,7 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
row1 = sheet.CreateRow(PaintIndex);
|
|
|
PaintIndex = PaintIndex + 1;
|
|
|
- for (int j = 0; j < columnNum - 4; j++)
|
|
|
+ for (int j = 0; j < ShowColumnCount; j++)
|
|
|
{
|
|
|
row1.CreateCell(j);
|
|
|
if (j == 0)
|
|
|
@@ -1412,6 +1423,10 @@ namespace UAS_LabelMachine
|
|
|
sheet.SetMargin(MarginType.BottomMargin, 0.4);
|
|
|
sheet.SetMargin(MarginType.LeftMargin, 0.4);
|
|
|
sheet.SetMargin(MarginType.RightMargin, 0.4);
|
|
|
+
|
|
|
+ sheet.PrintSetup.NoColor = true;
|
|
|
+ sheet.PrintSetup.Landscape = true;
|
|
|
+ sheet.PrintSetup.PaperSize = (short)PaperSize.A4;
|
|
|
//芯片号需要作为更新盒号的条件
|
|
|
HSSFFont ffont = (HSSFFont)book.CreateFont();
|
|
|
ffont.FontName = "宋体";
|
|
|
@@ -1447,18 +1462,12 @@ namespace UAS_LabelMachine
|
|
|
NotShowColumn.Add("pr_orispeccode");
|
|
|
NotShowColumn.Add("pr_orispeccode1");
|
|
|
NotShowColumn.Add("pi_title");
|
|
|
+ NotShowColumn.Add("pi_date");
|
|
|
NotShowColumn.Add("pi_chipouttype");
|
|
|
|
|
|
- //展示的内容列
|
|
|
- int ShowColumnsCount = 0;
|
|
|
//设置列的宽度,根据首行的列的内容的长度来设置
|
|
|
for (int i = DataTable.Columns.Count - 1; i > 0; i--)
|
|
|
{
|
|
|
- //统计显示的列数
|
|
|
- if (!NotShowColumn.Contains(DataTable.Columns[i].ColumnName.ToLower()))
|
|
|
- {
|
|
|
- ShowColumnsCount = ShowColumnsCount + 1;
|
|
|
- }
|
|
|
for (int j = 0; j < box.Length; j++)
|
|
|
{
|
|
|
if (box[j].Name.ToLower() == "ch_bluefilm" && !box[j].Checked)
|
|
|
@@ -1518,13 +1527,11 @@ namespace UAS_LabelMachine
|
|
|
|
|
|
//ffont.FontHeight = 10;
|
|
|
//开始绘制的Index
|
|
|
- int PaintIndex = 1;
|
|
|
+ int PaintIndex = 0;
|
|
|
int sumCount = 0;
|
|
|
int totalCount = 0;
|
|
|
//Title的字体
|
|
|
|
|
|
-
|
|
|
-
|
|
|
HSSFFont titlefont = (HSSFFont)book.CreateFont();
|
|
|
titlefont.FontName = "宋体";
|
|
|
titlefont.FontHeight = 270;
|
|
|
@@ -1544,7 +1551,8 @@ namespace UAS_LabelMachine
|
|
|
|
|
|
ICellStyle TitleStyle = book.CreateCellStyle();
|
|
|
TitleStyle.SetFont(titlefont);
|
|
|
-
|
|
|
+ int ShowColumnCount = 0;
|
|
|
+ IRow row1 = null;
|
|
|
switch (Type)
|
|
|
{
|
|
|
case "FixRow":
|
|
|
@@ -1558,8 +1566,7 @@ namespace UAS_LabelMachine
|
|
|
ArrayList<string> First_WID = new ArrayList<string>();
|
|
|
for (int i = 0; i < rowNum; i++)
|
|
|
{
|
|
|
- IRow row1 = null;
|
|
|
- if (PaintIndex != 1)
|
|
|
+ if (PaintIndex != 0)
|
|
|
{
|
|
|
row1 = sheet.CreateRow(PaintIndex);
|
|
|
PaintIndex = PaintIndex + 1;
|
|
|
@@ -1605,7 +1612,7 @@ namespace UAS_LabelMachine
|
|
|
First_Batch = "";
|
|
|
First_WID.Clear();
|
|
|
BoxCode = BoxCode + 1;
|
|
|
- for (int j = 0; j < columnNum - 4; j++)
|
|
|
+ for (int j = 0; j < ShowColumnCount; j++)
|
|
|
{
|
|
|
row1.CreateCell(j);
|
|
|
if (j == 0)
|
|
|
@@ -1642,7 +1649,6 @@ namespace UAS_LabelMachine
|
|
|
row1.GetCell(0).CellStyle = TitleStyle;
|
|
|
row1 = sheet.CreateRow(PaintIndex);
|
|
|
PaintIndex = PaintIndex + 1;
|
|
|
- //特殊客户添加一列空行
|
|
|
for (int j = 0; j < columnNum - 3; j++)
|
|
|
{
|
|
|
if (j == 0)
|
|
|
@@ -1671,7 +1677,7 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
row1.CreateCell(j);
|
|
|
row1.Cells[j].SetCellValue(DataTable.Columns["pr_orispeccode"].Caption + ":" + DataTable.Rows[i]["pr_orispeccode"].ToString() + " "
|
|
|
- + "(" + DataTable.Rows[i]["me_desc"].ToString() + ") " + DataTable.Columns["pi_chipouttype"].Caption + ":" + DataTable.Rows[i]["pi_chipouttype"].ToString());
|
|
|
+ + DataTable.Columns["pi_chipouttype"].Caption + ":" + DataTable.Rows[i]["pi_chipouttype"].ToString());
|
|
|
}
|
|
|
else if (j == 3)
|
|
|
{
|
|
|
@@ -1692,20 +1698,28 @@ namespace UAS_LabelMachine
|
|
|
//特殊客户添加一列空行
|
|
|
row1 = sheet.CreateRow(PaintIndex);
|
|
|
PaintIndex = PaintIndex + 1;
|
|
|
+ for (int j = 0; j < columnNum; j++)
|
|
|
+ {
|
|
|
+ row1.CreateCell(j).SetCellValue("");
|
|
|
+ }
|
|
|
//添加列名
|
|
|
row1 = sheet.CreateRow(PaintIndex);
|
|
|
PaintIndex = PaintIndex + 1;
|
|
|
//计数列所在的索引
|
|
|
+ int showcount = 0;
|
|
|
+ //前面有4列标题内容,数据库设置的,需要从4开始索引
|
|
|
for (int j = 4; j < columnNum; j++)
|
|
|
{
|
|
|
if (DataTable.Columns[j].ColumnName.ToLower() == "chw_percent1")
|
|
|
{
|
|
|
+ showcount = showcount + 1;
|
|
|
row1.CreateCell(j - 4);
|
|
|
row1.Cells[j - 4].CellStyle = ColumnTitleStyle;
|
|
|
row1.Cells[j - 4].SetCellValue(DataTable.Rows[i]["chw_itemname1"].ToString());
|
|
|
}
|
|
|
else if (DataTable.Columns[j].ColumnName.ToLower() == "chw_percent2")
|
|
|
{
|
|
|
+ showcount = showcount + 1;
|
|
|
row1.CreateCell(j - 4);
|
|
|
row1.Cells[j - 4].CellStyle = ColumnTitleStyle;
|
|
|
row1.Cells[j - 4].SetCellValue(DataTable.Rows[i]["chw_itemname2"].ToString());
|
|
|
@@ -1717,6 +1731,7 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ showcount = showcount + 1;
|
|
|
row1.CreateCell(j - 4);
|
|
|
row1.Cells[j - 4].CellStyle = ColumnTitleStyle;
|
|
|
row1.Cells[j - 4].SetCellValue(DataTable.Columns[j].Caption);
|
|
|
@@ -1726,6 +1741,7 @@ namespace UAS_LabelMachine
|
|
|
NumIndex = j;
|
|
|
}
|
|
|
}
|
|
|
+ ShowColumnCount = showcount;
|
|
|
row1 = sheet.CreateRow(PaintIndex);
|
|
|
PaintIndex = PaintIndex + 1;
|
|
|
}
|
|
|
@@ -1773,7 +1789,7 @@ namespace UAS_LabelMachine
|
|
|
FirstDT.Rows.Add(dr);
|
|
|
row1 = sheet.CreateRow(PaintIndex);
|
|
|
PaintIndex = PaintIndex + 1;
|
|
|
- for (int j = 0; j < columnNum - 4; j++)
|
|
|
+ for (int j = 0; j < ShowColumnCount; j++)
|
|
|
{
|
|
|
row1.CreateCell(j);
|
|
|
if (j == 0)
|
|
|
@@ -1841,15 +1857,16 @@ namespace UAS_LabelMachine
|
|
|
int PageNum = 0;
|
|
|
for (int i = 0; i < rowNum; i++)
|
|
|
{
|
|
|
- IRow row1 = sheet.CreateRow(PaintIndex);
|
|
|
- PaintIndex = PaintIndex + 1;
|
|
|
+ row1 = sheet.CreateRow(PaintIndex);
|
|
|
+ if (i != 0)
|
|
|
+ PaintIndex = PaintIndex + 1;
|
|
|
row1.HeightInPoints = RowHeight;
|
|
|
//如果批号不相等的时候
|
|
|
PageNum = PageNum + 1;
|
|
|
if (LastBatchCode != "" && LastBatchCode != DataTable.Rows[i]["ch_splitbatch"].ToString())
|
|
|
{
|
|
|
BoxCode = BoxCode + 1;
|
|
|
- for (int j = 0; j < columnNum - 4; j++)
|
|
|
+ for (int j = 0; j < ShowColumnCount; j++)
|
|
|
{
|
|
|
row1.CreateCell(j);
|
|
|
if (j == 0)
|
|
|
@@ -1873,10 +1890,9 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
}
|
|
|
sumCount = 0;
|
|
|
- row1 = sheet.CreateRow(PaintIndex);
|
|
|
- sheet.SetRowBreak(PaintIndex - 1);
|
|
|
+ //row1 = sheet.CreateRow(PaintIndex);
|
|
|
+ //sheet.SetRowBreak(PaintIndex - 1);
|
|
|
sheet.Footer.Center = "第&P页,共&N页";
|
|
|
- PaintIndex = PaintIndex + 1;
|
|
|
PageNum = 1;
|
|
|
}
|
|
|
//每次到了页数开始分页
|
|
|
@@ -1890,7 +1906,7 @@ namespace UAS_LabelMachine
|
|
|
row1.GetCell(0).CellStyle = TitleStyle;
|
|
|
row1 = sheet.CreateRow(PaintIndex);
|
|
|
PaintIndex = PaintIndex + 1;
|
|
|
- if (i != rowNum - 1)
|
|
|
+ //if (i != rowNum - 1)
|
|
|
{
|
|
|
for (int j = 0; j < columnNum - 3; j++)
|
|
|
{
|
|
|
@@ -1920,7 +1936,7 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
row1.CreateCell(j);
|
|
|
row1.Cells[j].SetCellValue(DataTable.Columns["pr_orispeccode"].Caption + ":" + DataTable.Rows[i]["pr_orispeccode"].ToString() + " "
|
|
|
- + "(" + DataTable.Rows[i]["me_desc"].ToString() + ") " + DataTable.Columns["pi_chipouttype"].Caption + ":" + DataTable.Rows[i]["pi_chipouttype"].ToString());
|
|
|
+ + DataTable.Columns["pi_chipouttype"].Caption + ":" + DataTable.Rows[i]["pi_chipouttype"].ToString());
|
|
|
}
|
|
|
else if (j == 3)
|
|
|
{
|
|
|
@@ -1941,19 +1957,26 @@ namespace UAS_LabelMachine
|
|
|
//特殊客户添加一列空行
|
|
|
row1 = sheet.CreateRow(PaintIndex);
|
|
|
PaintIndex = PaintIndex + 1;
|
|
|
+ for (int j = 0; j < columnNum; j++)
|
|
|
+ {
|
|
|
+ row1.CreateCell(j).SetCellValue("");
|
|
|
+ }
|
|
|
//添加列名
|
|
|
row1 = sheet.CreateRow(PaintIndex);
|
|
|
PaintIndex = PaintIndex + 1;
|
|
|
+ int showcount = 0;
|
|
|
for (int j = 4; j < columnNum; j++)
|
|
|
{
|
|
|
if (DataTable.Columns[j].ColumnName.ToLower() == "chw_percent1")
|
|
|
{
|
|
|
+ showcount = showcount + 1;
|
|
|
row1.CreateCell(j - 4);
|
|
|
row1.Cells[j - 4].CellStyle = ColumnTitleStyle;
|
|
|
row1.Cells[j - 4].SetCellValue(DataTable.Rows[i]["chw_itemname1"].ToString());
|
|
|
}
|
|
|
else if (DataTable.Columns[j].ColumnName.ToLower() == "chw_percent2")
|
|
|
{
|
|
|
+ showcount = showcount + 1;
|
|
|
row1.CreateCell(j - 4);
|
|
|
row1.Cells[j - 4].CellStyle = ColumnTitleStyle;
|
|
|
row1.Cells[j - 4].SetCellValue(DataTable.Rows[i]["chw_itemname2"].ToString());
|
|
|
@@ -1965,11 +1988,13 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ showcount = showcount + 1;
|
|
|
row1.CreateCell(j - 4);
|
|
|
row1.Cells[j - 4].CellStyle = ColumnTitleStyle;
|
|
|
row1.Cells[j - 4].SetCellValue(DataTable.Columns[j].Caption);
|
|
|
}
|
|
|
}
|
|
|
+ ShowColumnCount = showcount;
|
|
|
row1 = sheet.CreateRow(PaintIndex);
|
|
|
PaintIndex = PaintIndex + 1;
|
|
|
}
|
|
|
@@ -2000,12 +2025,11 @@ namespace UAS_LabelMachine
|
|
|
row1.Cells[j - 4].SetCellValue(i + 1);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
if (i == rowNum - 1)
|
|
|
{
|
|
|
row1 = sheet.CreateRow(PaintIndex);
|
|
|
PaintIndex = PaintIndex + 1;
|
|
|
- for (int j = 0; j < columnNum - 4; j++)
|
|
|
+ for (int j = 0; j < ShowColumnCount; j++)
|
|
|
{
|
|
|
row1.CreateCell(j);
|
|
|
if (j == 0)
|
|
|
@@ -2080,15 +2104,16 @@ namespace UAS_LabelMachine
|
|
|
int PageNum1 = 0;
|
|
|
for (int i = 0; i < rowNum; i++)
|
|
|
{
|
|
|
- IRow row1 = sheet.CreateRow(PaintIndex);
|
|
|
- PaintIndex = PaintIndex + 1;
|
|
|
+ row1 = sheet.CreateRow(PaintIndex);
|
|
|
+ if (i != 0)
|
|
|
+ PaintIndex = PaintIndex + 1;
|
|
|
row1.HeightInPoints = RowHeight;
|
|
|
PageNum1 = PageNum1 + 1;
|
|
|
- //如果批号不相等的时候
|
|
|
+ //如果箱号不相等的时候
|
|
|
if (LastBoxCode != "" && LastBoxCode != DataTable.Rows[i]["CH_PBCODE"].ToString())
|
|
|
{
|
|
|
BoxCode = BoxCode + 1;
|
|
|
- for (int j = 0; j < columnNum - 4; j++)
|
|
|
+ for (int j = 0; j < ShowColumnCount; j++)
|
|
|
{
|
|
|
row1.CreateCell(j);
|
|
|
if (j == 0)
|
|
|
@@ -2112,10 +2137,9 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
}
|
|
|
sumCount = 0;
|
|
|
- row1 = sheet.CreateRow(PaintIndex);
|
|
|
- sheet.SetRowBreak(PaintIndex - 1);
|
|
|
+ //row1 = sheet.CreateRow(PaintIndex);
|
|
|
+ //sheet.SetRowBreak(PaintIndex - 1);
|
|
|
sheet.Footer.Center = "第&P页,共&N页";
|
|
|
- PaintIndex = PaintIndex + 1;
|
|
|
PageNum1 = 1;
|
|
|
}
|
|
|
//每次到了页数开始分页
|
|
|
@@ -2129,7 +2153,7 @@ namespace UAS_LabelMachine
|
|
|
row1 = sheet.CreateRow(PaintIndex);
|
|
|
PaintIndex = PaintIndex + 1;
|
|
|
//第一行添加客户信息
|
|
|
- if (i != rowNum - 1)
|
|
|
+ //if (i != rowNum - 1)
|
|
|
{
|
|
|
for (int j = 0; j < columnNum - 3; j++)
|
|
|
{
|
|
|
@@ -2159,7 +2183,7 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
row1.CreateCell(j);
|
|
|
row1.Cells[j].SetCellValue(DataTable.Columns["pr_orispeccode"].Caption + ":" + DataTable.Rows[i]["pr_orispeccode"].ToString() + " "
|
|
|
- + "(" + DataTable.Rows[i]["me_desc"].ToString() + ") " + DataTable.Columns["pi_chipouttype"].Caption + ":" + DataTable.Rows[i]["pi_chipouttype"].ToString());
|
|
|
+ + DataTable.Columns["pi_chipouttype"].Caption + ":" + DataTable.Rows[i]["pi_chipouttype"].ToString());
|
|
|
}
|
|
|
else if (j == 3)
|
|
|
{
|
|
|
@@ -2180,19 +2204,27 @@ namespace UAS_LabelMachine
|
|
|
//特殊客户添加一列空行
|
|
|
row1 = sheet.CreateRow(PaintIndex);
|
|
|
PaintIndex = PaintIndex + 1;
|
|
|
+ for (int j = 0; j < columnNum; j++)
|
|
|
+ {
|
|
|
+ row1.CreateCell(j).SetCellValue("");
|
|
|
+ }
|
|
|
//添加列名
|
|
|
row1 = sheet.CreateRow(PaintIndex);
|
|
|
PaintIndex = PaintIndex + 1;
|
|
|
+ int showcount = 0;
|
|
|
+
|
|
|
for (int j = 4; j < columnNum; j++)
|
|
|
{
|
|
|
if (DataTable.Columns[j].ColumnName.ToLower() == "chw_percent1")
|
|
|
{
|
|
|
+ showcount = showcount + 1;
|
|
|
row1.CreateCell(j - 4);
|
|
|
row1.Cells[j - 4].CellStyle = ColumnTitleStyle;
|
|
|
row1.Cells[j - 4].SetCellValue(DataTable.Rows[i]["chw_itemname1"].ToString());
|
|
|
}
|
|
|
else if (DataTable.Columns[j].ColumnName.ToLower() == "chw_percent2")
|
|
|
{
|
|
|
+ showcount = showcount + 1;
|
|
|
row1.CreateCell(j - 4);
|
|
|
row1.Cells[j - 4].CellStyle = ColumnTitleStyle;
|
|
|
row1.Cells[j - 4].SetCellValue(DataTable.Rows[i]["chw_itemname2"].ToString());
|
|
|
@@ -2204,11 +2236,13 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ showcount = showcount + 1;
|
|
|
row1.CreateCell(j - 4);
|
|
|
row1.Cells[j - 4].CellStyle = ColumnTitleStyle;
|
|
|
row1.Cells[j - 4].SetCellValue(DataTable.Columns[j].Caption);
|
|
|
}
|
|
|
}
|
|
|
+ ShowColumnCount = showcount;
|
|
|
row1 = sheet.CreateRow(PaintIndex);
|
|
|
PaintIndex = PaintIndex + 1;
|
|
|
}
|
|
|
@@ -2243,7 +2277,7 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
row1 = sheet.CreateRow(PaintIndex);
|
|
|
PaintIndex = PaintIndex + 1;
|
|
|
- for (int j = 0; j < columnNum - 4; j++)
|
|
|
+ for (int j = 0; j < ShowColumnCount; j++)
|
|
|
{
|
|
|
row1.CreateCell(j);
|
|
|
if (j == 0)
|
|
|
@@ -2321,10 +2355,9 @@ namespace UAS_LabelMachine
|
|
|
//填充首页
|
|
|
sumCount = 0;
|
|
|
totalCount = 0;
|
|
|
- PaintIndex = 1;
|
|
|
+ PaintIndex = 0;
|
|
|
ISheet sheet2 = book.CreateSheet("首页");
|
|
|
- IRow row = sheet.CreateRow(0);
|
|
|
- row = sheet2.CreateRow(0);
|
|
|
+ IRow row = sheet2.CreateRow(0);
|
|
|
row.CreateCell(0);
|
|
|
row.Cells[0].SetCellValue(" " + companyname);
|
|
|
row.GetCell(0).CellStyle = style;
|
|
|
@@ -2360,7 +2393,7 @@ namespace UAS_LabelMachine
|
|
|
columnNum = FirstDT.Columns.Count;
|
|
|
for (int i = 0; i < rowNum; i++)
|
|
|
{
|
|
|
- IRow row1 = sheet2.CreateRow(PaintIndex);
|
|
|
+ row1 = sheet2.CreateRow(PaintIndex);
|
|
|
PaintIndex = PaintIndex + 1;
|
|
|
row1.HeightInPoints = RowHeight;
|
|
|
//只需要绘制一行
|