|
|
@@ -278,6 +278,10 @@ namespace UAS_LabelMachine
|
|
|
HSSFWorkbook book = new HSSFWorkbook();
|
|
|
//Excel中的Sheet
|
|
|
ISheet sheet = book.CreateSheet("分页");
|
|
|
+ sheet.SetMargin(MarginType.TopMargin, 0.5);
|
|
|
+ sheet.SetMargin(MarginType.BottomMargin, 0.5);
|
|
|
+ sheet.SetMargin(MarginType.LeftMargin, 0.5);
|
|
|
+ sheet.SetMargin(MarginType.RightMargin, 0.5);
|
|
|
//芯片号需要作为更新盒号的条件
|
|
|
bool ShowChcode = true;
|
|
|
//更新箱号
|
|
|
@@ -351,30 +355,6 @@ namespace UAS_LabelMachine
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- //if (box[j].Name.ToLower() == "percent" && !box[j].Checked)
|
|
|
- //{
|
|
|
- // 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"))
|
|
|
- // {
|
|
|
- // DataTable.Columns.RemoveAt(i);
|
|
|
- // break;
|
|
|
- // }
|
|
|
- //}
|
|
|
- //if (box[j].Text.ToLower() == "ts" && !box[j].Checked)
|
|
|
- //{
|
|
|
- // if (DataTable.Columns[i].ColumnName.ToLower() == ("ts1") || DataTable.Columns[i].ColumnName.ToLower() == ("ts2") || DataTable.Columns[i].ColumnName.ToLower() == ("ts3"))
|
|
|
- // {
|
|
|
- // DataTable.Columns.RemoveAt(i);
|
|
|
- // break;
|
|
|
- // }
|
|
|
- //}
|
|
|
- //if (box[j].Text.ToLower() == "bvceo" && !box[j].Checked)
|
|
|
- //{
|
|
|
- // if (DataTable.Columns[i].ColumnName.ToLower() == "bvceo1" || DataTable.Columns[i].ColumnName.ToLower() == ("bvceo2") || DataTable.Columns[i].ColumnName.ToLower() == ("bvceo3"))
|
|
|
- // {
|
|
|
- // DataTable.Columns.RemoveAt(i);
|
|
|
- // break;
|
|
|
- // }
|
|
|
- //}
|
|
|
}
|
|
|
}
|
|
|
//获取行数量和列数量
|
|
|
@@ -405,6 +385,7 @@ namespace UAS_LabelMachine
|
|
|
string First_OrderCode = "";
|
|
|
string First_Prspec = "";
|
|
|
string First_Batch = "";
|
|
|
+ int NumIndex = 0;
|
|
|
ArrayList<string> First_WID = new ArrayList<string>();
|
|
|
for (int i = 0; i < rowNum; i++)
|
|
|
{
|
|
|
@@ -453,19 +434,14 @@ namespace UAS_LabelMachine
|
|
|
BoxCode = BoxCode + 1;
|
|
|
for (int j = 0; j < columnNum - 4; j++)
|
|
|
{
|
|
|
+ row1.CreateCell(j);
|
|
|
if (j == 0)
|
|
|
{
|
|
|
- row1.CreateCell(j);
|
|
|
row1.Cells[j].SetCellValue("小计");
|
|
|
}
|
|
|
- else if (j == 2)
|
|
|
- {
|
|
|
- row1.CreateCell(j);
|
|
|
- row1.Cells[j].SetCellValue(sumCount);
|
|
|
- }
|
|
|
- else
|
|
|
+ else if (DataTable.Columns[j].ColumnName=="io_qty")
|
|
|
{
|
|
|
- row1.CreateCell(j);
|
|
|
+ row1.Cells[NumIndex - 4].SetCellValue(sumCount);
|
|
|
}
|
|
|
row1.Cells[j].CellStyle = styleborder;
|
|
|
}
|
|
|
@@ -532,6 +508,7 @@ namespace UAS_LabelMachine
|
|
|
//添加列名
|
|
|
row1 = sheet.CreateRow(PaintIndex);
|
|
|
PaintIndex = PaintIndex + 1;
|
|
|
+ //计数列所在的索引
|
|
|
for (int j = 4; j < columnNum; j++)
|
|
|
{
|
|
|
row1.CreateCell(j - 4);
|
|
|
@@ -546,8 +523,13 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
else
|
|
|
row1.Cells[j - 4].SetCellValue(DataTable.Columns[j].Caption);
|
|
|
+
|
|
|
+ if (DataTable.Columns[j].ColumnName.ToString() == "io_qty")
|
|
|
+ {
|
|
|
+ NumIndex = j;
|
|
|
+ }
|
|
|
//如果chw_itemname1的值为空,则值为100和0,其中一列不显示,不显示
|
|
|
- if (DataTable.Columns[j].ColumnName.ToLower().Contains("chw_itemname") || DataTable.Columns[j].ColumnName.ToLower().Contains("pr_orispeccode") || DataTable.Columns[j].ColumnName.ToLower().Contains("pd_ordercode"))
|
|
|
+ if (DataTable.Columns[j].ColumnName.ToLower().Contains("chw_itemname") || DataTable.Columns[j].ColumnName.ToLower().Contains("pr_orispeccode") || DataTable.Columns[j].ColumnName.ToLower().Contains("pd_ordercode") || DataTable.Columns[j].ColumnName.ToLower().Contains("pr_size") || DataTable.Columns[j].ColumnName.ToLower().Contains("me_desc")||(!ShowChcode && DataTable.Columns[j].ColumnName.ToLower().Contains("ch_code")))
|
|
|
{
|
|
|
sheet.SetColumnHidden(j - 4, true);
|
|
|
}
|
|
|
@@ -592,19 +574,14 @@ namespace UAS_LabelMachine
|
|
|
PaintIndex = PaintIndex + 1;
|
|
|
for (int j = 0; j < columnNum - 4; j++)
|
|
|
{
|
|
|
+ row1.CreateCell(j);
|
|
|
if (j == 0)
|
|
|
{
|
|
|
- row1.CreateCell(j);
|
|
|
row1.Cells[j].SetCellValue("小计");
|
|
|
}
|
|
|
- else if (j == 2)
|
|
|
+ else if (DataTable.Columns[j].ColumnName=="io_qty")
|
|
|
{
|
|
|
- row1.CreateCell(j);
|
|
|
- row1.Cells[j].SetCellValue(sumCount);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- row1.CreateCell(j);
|
|
|
+ row1.Cells[j - 4].SetCellValue(sumCount);
|
|
|
}
|
|
|
row1.Cells[j].CellStyle = styleborder;
|
|
|
}
|
|
|
@@ -671,19 +648,14 @@ namespace UAS_LabelMachine
|
|
|
BoxCode = BoxCode + 1;
|
|
|
for (int j = 0; j < columnNum - 4; j++)
|
|
|
{
|
|
|
+ row1.CreateCell(j);
|
|
|
if (j == 0)
|
|
|
{
|
|
|
- row1.CreateCell(j);
|
|
|
row1.Cells[j].SetCellValue("小计");
|
|
|
}
|
|
|
- else if (j == 2)
|
|
|
+ else if (DataTable.Columns[j].ColumnName == "io_qty")
|
|
|
{
|
|
|
- row1.CreateCell(j);
|
|
|
- row1.Cells[j].SetCellValue(sumCount);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- row1.CreateCell(j);
|
|
|
+ row1.Cells[j - 4].SetCellValue(sumCount);
|
|
|
}
|
|
|
row1.Cells[j].CellStyle = styleborder;
|
|
|
}
|
|
|
@@ -755,7 +727,7 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
else
|
|
|
row1.Cells[j - 4].SetCellValue(DataTable.Columns[j].Caption);
|
|
|
- if (DataTable.Columns[j].ColumnName.ToLower().Contains("chw_itemname") || DataTable.Columns[j].ColumnName.ToLower().Contains("pr_orispeccode") || DataTable.Columns[j].ColumnName.ToLower().Contains("pd_ordercode"))
|
|
|
+ if (DataTable.Columns[j].ColumnName.ToLower().Contains("chw_itemname") || DataTable.Columns[j].ColumnName.ToLower().Contains("pr_orispeccode") || DataTable.Columns[j].ColumnName.ToLower().Contains("pd_ordercode") || DataTable.Columns[j].ColumnName.ToLower().Contains("pr_size") || DataTable.Columns[j].ColumnName.ToLower().Contains("me_desc") || (!ShowChcode && DataTable.Columns[j].ColumnName.ToLower().Contains("ch_code")))
|
|
|
{
|
|
|
sheet.SetColumnHidden(j - 4, true);
|
|
|
}
|
|
|
@@ -787,19 +759,14 @@ namespace UAS_LabelMachine
|
|
|
PaintIndex = PaintIndex + 1;
|
|
|
for (int j = 0; j < columnNum - 4; j++)
|
|
|
{
|
|
|
+ row1.CreateCell(j);
|
|
|
if (j == 0)
|
|
|
{
|
|
|
- row1.CreateCell(j);
|
|
|
row1.Cells[j].SetCellValue("小计");
|
|
|
}
|
|
|
- else if (j == 2)
|
|
|
+ else if (DataTable.Columns[j].ColumnName == "io_qty")
|
|
|
{
|
|
|
- row1.CreateCell(j);
|
|
|
- row1.Cells[j].SetCellValue(sumCount);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- row1.CreateCell(j);
|
|
|
+ row1.Cells[j - 4].SetCellValue(sumCount);
|
|
|
}
|
|
|
row1.Cells[j].CellStyle = styleborder;
|
|
|
}
|
|
|
@@ -866,19 +833,14 @@ namespace UAS_LabelMachine
|
|
|
BoxCode = BoxCode + 1;
|
|
|
for (int j = 0; j < columnNum - 4; j++)
|
|
|
{
|
|
|
+ row1.CreateCell(j);
|
|
|
if (j == 0)
|
|
|
{
|
|
|
- row1.CreateCell(j);
|
|
|
row1.Cells[j].SetCellValue("小计");
|
|
|
}
|
|
|
- else if (j == 2)
|
|
|
- {
|
|
|
- row1.CreateCell(j);
|
|
|
- row1.Cells[j].SetCellValue(sumCount);
|
|
|
- }
|
|
|
- else
|
|
|
+ else if (DataTable.Columns[j].ColumnName == "io_qty")
|
|
|
{
|
|
|
- row1.CreateCell(j);
|
|
|
+ row1.Cells[j - 4].SetCellValue(sumCount);
|
|
|
}
|
|
|
row1.Cells[j].CellStyle = styleborder;
|
|
|
}
|
|
|
@@ -961,7 +923,7 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
else
|
|
|
row1.Cells[j - 4].SetCellValue(DataTable.Columns[j].Caption);
|
|
|
- if (DataTable.Columns[j].ColumnName.ToLower().Contains("chw_itemname") || DataTable.Columns[j].ColumnName.ToLower().Contains("pr_orispeccode") || DataTable.Columns[j].ColumnName.ToLower().Contains("pd_ordercode"))
|
|
|
+ if (DataTable.Columns[j].ColumnName.ToLower().Contains("chw_itemname") || DataTable.Columns[j].ColumnName.ToLower().Contains("pr_orispeccode") || DataTable.Columns[j].ColumnName.ToLower().Contains("pd_ordercode") || DataTable.Columns[j].ColumnName.ToLower().Contains("pr_size") || DataTable.Columns[j].ColumnName.ToLower().Contains("me_desc") || (!ShowChcode && DataTable.Columns[j].ColumnName.ToLower().Contains("ch_code")))
|
|
|
{
|
|
|
sheet.SetColumnHidden(j - 4, true);
|
|
|
}
|
|
|
@@ -993,19 +955,14 @@ namespace UAS_LabelMachine
|
|
|
PaintIndex = PaintIndex + 1;
|
|
|
for (int j = 0; j < columnNum - 4; j++)
|
|
|
{
|
|
|
+ row1.CreateCell(j);
|
|
|
if (j == 0)
|
|
|
{
|
|
|
- row1.CreateCell(j);
|
|
|
row1.Cells[j].SetCellValue("小计");
|
|
|
}
|
|
|
- else if (j == 2)
|
|
|
+ else if (DataTable.Columns[j].ColumnName == "io_qty")
|
|
|
{
|
|
|
- row1.CreateCell(j);
|
|
|
- row1.Cells[j].SetCellValue(sumCount);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- row1.CreateCell(j);
|
|
|
+ row1.Cells[j - 4].SetCellValue(sumCount);
|
|
|
}
|
|
|
row1.Cells[j].CellStyle = styleborder;
|
|
|
}
|