|
|
@@ -56,8 +56,6 @@ namespace UAS_LabelMachine
|
|
|
return filePath;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 导入Excel
|
|
|
/// </summary>
|
|
|
@@ -188,7 +186,6 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 将DataTable形式的数据转成Excel格式的,然后用字节流的形式写入文件
|
|
|
/// </summary>
|
|
|
@@ -265,7 +262,6 @@ namespace UAS_LabelMachine
|
|
|
return ms;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 将DataTable形式的数据转成Excel格式的,然后用字节流的形式写入文件
|
|
|
/// </summary>
|
|
|
@@ -281,7 +277,6 @@ namespace UAS_LabelMachine
|
|
|
HSSFWorkbook book = new HSSFWorkbook();
|
|
|
//Excel中的Sheet
|
|
|
ISheet sheet = book.CreateSheet("分页");
|
|
|
-
|
|
|
|
|
|
ICellStyle style = book.CreateCellStyle();
|
|
|
style.VerticalAlignment = VerticalAlignment.Center;
|
|
|
@@ -303,7 +298,6 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
if (DataTable.Columns[i].ColumnName.ToLower().Contains("ch_bluefilm"))
|
|
|
{
|
|
|
- Console.WriteLine(DataTable.Columns[i].ColumnName.ToLower());
|
|
|
DataTable.Columns.RemoveAt(i);
|
|
|
break;
|
|
|
}
|
|
|
@@ -312,7 +306,6 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
if (DataTable.Columns[i].ColumnName.ToLower().Contains("ch_code"))
|
|
|
{
|
|
|
- Console.WriteLine(DataTable.Columns[i].ColumnName.ToLower());
|
|
|
DataTable.Columns.RemoveAt(i);
|
|
|
break;
|
|
|
}
|
|
|
@@ -321,7 +314,6 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
if (DataTable.Columns[i].ColumnName.ToLower().Contains("ch_splitbatch"))
|
|
|
{
|
|
|
- Console.WriteLine(DataTable.Columns[i].ColumnName.ToLower());
|
|
|
DataTable.Columns.RemoveAt(i);
|
|
|
break;
|
|
|
}
|
|
|
@@ -330,7 +322,6 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
if (DataTable.Columns[i].ColumnName.ToLower().Contains("ch_waterid"))
|
|
|
{
|
|
|
- Console.WriteLine(DataTable.Columns[i].ColumnName.ToLower());
|
|
|
DataTable.Columns.RemoveAt(i);
|
|
|
break;
|
|
|
}
|
|
|
@@ -339,7 +330,6 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
if (DataTable.Columns[i].ColumnName.ToLower().Contains("ch_pbcode"))
|
|
|
{
|
|
|
- Console.WriteLine(DataTable.Columns[i].ColumnName.ToLower());
|
|
|
DataTable.Columns.RemoveAt(i);
|
|
|
break;
|
|
|
}
|
|
|
@@ -348,7 +338,6 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
if (DataTable.Columns[i].ColumnName.ToLower().Contains("ch_remark"))
|
|
|
{
|
|
|
- Console.WriteLine(DataTable.Columns[i].ColumnName.ToLower());
|
|
|
DataTable.Columns.RemoveAt(i);
|
|
|
break;
|
|
|
}
|
|
|
@@ -357,7 +346,6 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
if (DataTable.Columns[i].ColumnName.ToLower().Contains("chw_percent1") || DataTable.Columns[i].ColumnName.ToLower().Contains("chw_percent2") || DataTable.Columns[i].ColumnName.ToLower().Contains("chw_itemname1") || DataTable.Columns[i].ColumnName.ToLower().Contains("chw_itemname2"))
|
|
|
{
|
|
|
- Console.WriteLine(DataTable.Columns[i].ColumnName.ToLower());
|
|
|
DataTable.Columns.RemoveAt(i);
|
|
|
break;
|
|
|
}
|
|
|
@@ -372,7 +360,7 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
if (box[j].Name.ToLower() == "bvceo" && !box[j].Checked)
|
|
|
{
|
|
|
- if (DataTable.Columns[i].ColumnName.ToLower()=="bvceo1" || DataTable.Columns[i].ColumnName.ToLower() == ("bvceo2") || DataTable.Columns[i].ColumnName.ToLower() == ("bvceo3"))
|
|
|
+ if (DataTable.Columns[i].ColumnName.ToLower() == "bvceo1" || DataTable.Columns[i].ColumnName.ToLower() == ("bvceo2") || DataTable.Columns[i].ColumnName.ToLower() == ("bvceo3"))
|
|
|
{
|
|
|
DataTable.Columns.RemoveAt(i);
|
|
|
break;
|
|
|
@@ -493,7 +481,12 @@ namespace UAS_LabelMachine
|
|
|
row1.CreateCell(j);
|
|
|
row1.Cells[j].SetCellValue(DataTable.Rows[i]["pi_title"].ToString());
|
|
|
}
|
|
|
- else if (j == columnNum - 4)
|
|
|
+ else if (j > 5 && j == columnNum - 5)
|
|
|
+ {
|
|
|
+ row1.CreateCell(j);
|
|
|
+ row1.Cells[j].SetCellValue(DataTable.Rows[i]["pi_inoutno"].ToString());
|
|
|
+ }
|
|
|
+ else if (columnNum > 5 && j == columnNum - 5)
|
|
|
{
|
|
|
row1.CreateCell(j);
|
|
|
row1.Cells[j].SetCellValue(DataTable.Rows[i]["pi_inoutno"].ToString());
|
|
|
@@ -514,7 +507,12 @@ namespace UAS_LabelMachine
|
|
|
row1.CreateCell(j);
|
|
|
row1.Cells[j].SetCellValue(DataTable.Rows[i]["pr_spec"].ToString());
|
|
|
}
|
|
|
- else if (j == columnNum - 4)
|
|
|
+ else if (columnNum > 5 && j == columnNum - 5)
|
|
|
+ {
|
|
|
+ row1.CreateCell(j);
|
|
|
+ row1.Cells[j].SetCellValue(DataTable.Rows[i]["pi_date"].ToString());
|
|
|
+ }
|
|
|
+ else if (columnNum<=5&&j == columnNum - 4)
|
|
|
{
|
|
|
row1.CreateCell(j);
|
|
|
row1.Cells[j].SetCellValue(DataTable.Rows[i]["pi_date"].ToString());
|
|
|
@@ -620,12 +618,17 @@ namespace UAS_LabelMachine
|
|
|
row1.Cells[j].SetCellValue(totalCount);
|
|
|
}
|
|
|
//原本是j == columnNum - 5因为还有spec和order两列隐藏列,所以需要在往后移动
|
|
|
- else if (j == columnNum - 7)
|
|
|
+ else if (j == columnNum - 6)
|
|
|
{
|
|
|
row1.CreateCell(j);
|
|
|
row1.Cells[j].SetCellValue(rowNum);
|
|
|
}
|
|
|
- else if (j == columnNum - 4)
|
|
|
+ else if (j > 5 && j == columnNum - 5)
|
|
|
+ {
|
|
|
+ row1.CreateCell(j);
|
|
|
+ row1.Cells[j].SetCellValue("片");
|
|
|
+ }
|
|
|
+ else if (columnNum > 5 && j == columnNum - 5)
|
|
|
{
|
|
|
row1.CreateCell(j);
|
|
|
row1.Cells[j].SetCellValue("片");
|
|
|
@@ -790,7 +793,7 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
row1.Cells[j].CellStyle = styleborder;
|
|
|
}
|
|
|
-
|
|
|
+ //创建备注内容
|
|
|
row1 = sheet.CreateRow(PaintIndex);
|
|
|
PaintIndex = PaintIndex + 1;
|
|
|
for (int j = 0; j < columnNum - 3; j++)
|
|
|
@@ -805,12 +808,17 @@ namespace UAS_LabelMachine
|
|
|
row1.CreateCell(j);
|
|
|
row1.Cells[j].SetCellValue(totalCount);
|
|
|
}
|
|
|
- else if (j == columnNum - 7)
|
|
|
+ else if (j == columnNum - 6)
|
|
|
{
|
|
|
row1.CreateCell(j);
|
|
|
row1.Cells[j].SetCellValue(rowNum);
|
|
|
}
|
|
|
- else if (j == columnNum - 4)
|
|
|
+ else if (j > 5 && j == columnNum - 5)
|
|
|
+ {
|
|
|
+ row1.CreateCell(j);
|
|
|
+ row1.Cells[j].SetCellValue("片");
|
|
|
+ }
|
|
|
+ else if (columnNum > 5 && j == columnNum - 5)
|
|
|
{
|
|
|
row1.CreateCell(j);
|
|
|
row1.Cells[j].SetCellValue("片");
|
|
|
@@ -879,7 +887,12 @@ namespace UAS_LabelMachine
|
|
|
row1.CreateCell(j);
|
|
|
row1.Cells[j].SetCellValue(DataTable.Rows[i]["pi_title"].ToString());
|
|
|
}
|
|
|
- else if (j == columnNum - 4)
|
|
|
+ else if (j > 5 && j == columnNum - 5)
|
|
|
+ {
|
|
|
+ row1.CreateCell(j);
|
|
|
+ row1.Cells[j].SetCellValue(DataTable.Rows[i]["pi_inoutno"].ToString());
|
|
|
+ }
|
|
|
+ else if (columnNum > 5 && j == columnNum - 5)
|
|
|
{
|
|
|
row1.CreateCell(j);
|
|
|
row1.Cells[j].SetCellValue(DataTable.Rows[i]["pi_inoutno"].ToString());
|
|
|
@@ -900,7 +913,12 @@ namespace UAS_LabelMachine
|
|
|
row1.CreateCell(j);
|
|
|
row1.Cells[j].SetCellValue(DataTable.Rows[i]["pr_spec"].ToString());
|
|
|
}
|
|
|
- else if (j == columnNum - 4)
|
|
|
+ else if (j > 5 && j == columnNum - 5)
|
|
|
+ {
|
|
|
+ row1.CreateCell(j);
|
|
|
+ row1.Cells[j].SetCellValue(DataTable.Rows[i]["pi_date"].ToString());
|
|
|
+ }
|
|
|
+ else if (columnNum > 5 && j == columnNum - 5)
|
|
|
{
|
|
|
row1.CreateCell(j);
|
|
|
row1.Cells[j].SetCellValue(DataTable.Rows[i]["pi_date"].ToString());
|
|
|
@@ -1033,7 +1051,6 @@ namespace UAS_LabelMachine
|
|
|
row.GetCell(0).CellStyle = style;
|
|
|
rowNum = FirstDT.Rows.Count;
|
|
|
//不需要显示的列移除
|
|
|
-
|
|
|
for (int i = FirstDT.Columns.Count - 1; i > 0; i--)
|
|
|
{
|
|
|
for (int j = 0; j < box.Length; j++)
|
|
|
@@ -1041,19 +1058,18 @@ namespace UAS_LabelMachine
|
|
|
if (box[j].Name == "FirstPage_WID" && !box[j].Checked)
|
|
|
{
|
|
|
if (FirstDT.Columns[i].ColumnName.ToLower().Contains("ch_waterid"))
|
|
|
-
|
|
|
{
|
|
|
FirstDT.Columns.RemoveAt(i);
|
|
|
}
|
|
|
}
|
|
|
- if (box[j].Name == "FirstPage_YIELD")
|
|
|
+ if (box[j].Name == "FirstPage_YIELD" && !box[j].Checked)
|
|
|
{
|
|
|
if (FirstDT.Columns[i].ColumnName.ToLower().Contains("ch_yeild"))
|
|
|
{
|
|
|
FirstDT.Columns.RemoveAt(i);
|
|
|
}
|
|
|
}
|
|
|
- if (box[j].Name == "FirstPage_REMARK")
|
|
|
+ if (box[j].Name == "FirstPage_REMARK" && !box[j].Checked)
|
|
|
{
|
|
|
if (FirstDT.Columns[i].ColumnName.ToLower().Contains("ch_remark"))
|
|
|
{
|
|
|
@@ -1064,34 +1080,6 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
columnNum = FirstDT.Columns.Count;
|
|
|
|
|
|
- //for (int i = 0; i < columnNum; i++)
|
|
|
- //{
|
|
|
- // if (FirstDT.Columns[i].ColumnName.ToLower().Contains("pd_ordercode"))
|
|
|
- // {
|
|
|
- // FirstDT.Columns[i].ColumnName = "订单号";
|
|
|
- // }
|
|
|
- // if (FirstDT.Columns[i].ColumnName.ToLower().Contains("pr_spec"))
|
|
|
- // {
|
|
|
- // FirstDT.Columns[i].ColumnName = "产品型号";
|
|
|
- // }
|
|
|
- // if (FirstDT.Columns[i].ColumnName.ToLower().Contains("ch_splitbatch"))
|
|
|
- // {
|
|
|
- // FirstDT.Columns[i].ColumnName = "批号";
|
|
|
- // }
|
|
|
- // if (FirstDT.Columns[i].ColumnName.ToLower().Contains("ch_waterid"))
|
|
|
- // {
|
|
|
- // FirstDT.Columns[i].ColumnName = "片号";
|
|
|
- // }
|
|
|
- // if (FirstDT.Columns[i].ColumnName.ToLower().Contains("num"))
|
|
|
- // {
|
|
|
- // FirstDT.Columns[i].ColumnName = "片数";
|
|
|
- // }
|
|
|
- // if (FirstDT.Columns[i].ColumnName.ToLower().Contains("io_qty"))
|
|
|
- // {
|
|
|
- // FirstDT.Columns[i].ColumnName = "管芯数";
|
|
|
- // }
|
|
|
- //}
|
|
|
-
|
|
|
for (int i = 0; i < rowNum; i++)
|
|
|
{
|
|
|
IRow row1 = sheet2.CreateRow(PaintIndex);
|
|
|
@@ -1107,10 +1095,15 @@ namespace UAS_LabelMachine
|
|
|
row1.CreateCell(j);
|
|
|
row1.Cells[j].SetCellValue(FirstDT.Rows[i]["pi_title"].ToString());
|
|
|
}
|
|
|
- else if (j == columnNum - 4)
|
|
|
+ else if (j > 5 && j == columnNum - 5)
|
|
|
{
|
|
|
row1.CreateCell(j);
|
|
|
- row1.Cells[j].SetCellValue(FirstDT.Rows[i]["pi_inoutno"].ToString());
|
|
|
+ row1.Cells[j].SetCellValue(DataTable.Rows[i]["pi_inoutno"].ToString());
|
|
|
+ }
|
|
|
+ else if (columnNum > 5 && j == columnNum - 5)
|
|
|
+ {
|
|
|
+ row1.CreateCell(j);
|
|
|
+ row1.Cells[j].SetCellValue(DataTable.Rows[i]["pi_inoutno"].ToString());
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -1128,10 +1121,15 @@ namespace UAS_LabelMachine
|
|
|
row1.CreateCell(j);
|
|
|
row1.Cells[j].SetCellValue(FirstDT.Rows[i]["pr_spec"].ToString());
|
|
|
}
|
|
|
- else if (j == columnNum - 4)
|
|
|
+ else if (j > 5 && j == columnNum - 5)
|
|
|
+ {
|
|
|
+ row1.CreateCell(j);
|
|
|
+ row1.Cells[j].SetCellValue(DataTable.Rows[i]["pi_date"].ToString());
|
|
|
+ }
|
|
|
+ else if (columnNum > 5 && j == columnNum - 5)
|
|
|
{
|
|
|
row1.CreateCell(j);
|
|
|
- row1.Cells[j].SetCellValue(FirstDT.Rows[i]["pi_date"].ToString());
|
|
|
+ row1.Cells[j].SetCellValue(DataTable.Rows[i]["pi_date"].ToString());
|
|
|
}
|
|
|
else
|
|
|
{
|