Browse Source

修改自动换行数据

callm 5 years ago
parent
commit
3f50cdbdb0

+ 116 - 145
UAS-出货标签管理(贸易版)/PublicMethod/ExcelHandler.cs

@@ -488,7 +488,7 @@ namespace UAS_LabelMachine
             row.GetCell(0).CellStyle.SetFont((ffont));
             //ffont.FontHeight = 10;
             //开始绘制的Index
-            int PaintIndex = 0;
+            int PaintIndex = 1;
             int sumCount = 0;
             int totalCount = 0;
             switch (Type)
@@ -584,7 +584,7 @@ namespace UAS_LabelMachine
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pi_title"].Caption + ":" + DataTable.Rows[i]["pi_title"].ToString() + "  "
                                            + DataTable.Columns["ch_level"].Caption + ":" + DataTable.Rows[i]["ch_level"].ToString());
                                     }
-                                    else if (columnNum > 14 && j == columnNum - 14)
+                                    else if (j==6)
                                     {
                                         row1.CreateCell(j);
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pi_inoutno"].Caption + ":" + DataTable.Rows[i]["pi_inoutno"].ToString());
@@ -602,25 +602,17 @@ namespace UAS_LabelMachine
                                 {
                                     if (j == 0)
                                     {
-                                        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());
-                                    }
-                                    else if (j == 3)
-                                    {
-                                        row1.CreateCell(j);
-                                        row1.Cells[j].SetCellValue(DataTable.Columns["pr_size"].Caption + ":" + DataTable.Rows[i]["pr_size"].ToString());
+                                        row1.CreateCell(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());
                                     }
-                                    else if (columnNum > 14 && j == columnNum - 14)
+                                    else if (j == 5)
                                     {
-                                        row1.CreateCell(j);
-                                        row1.Cells[j].SetCellValue(DataTable.Columns["pi_date"].Caption + ":" + DataTable.Rows[i]["pi_date"].ToString());
+                                        row1.CreateCell(j).SetCellValue(DataTable.Columns["pr_size"].Caption + ":" + DataTable.Rows[i]["pr_size"].ToString());
                                     }
-                                    else
+                                    else if (j == 6)
                                     {
-                                        row1.CreateCell(j);
+                                        row1.CreateCell(j).SetCellValue(DataTable.Columns["pi_date"].Caption + ":" + DataTable.Rows[i]["pi_date"].ToString());
                                     }
-                                    row1.GetCell(j).CellStyle = style;
                                 }
                                 //添加列名
                                 row1 = sheet.CreateRow(PaintIndex);
@@ -763,14 +755,14 @@ namespace UAS_LabelMachine
                         pib_id.Add(DataTable.Rows[i]["pib_id"].ToString());
                         pib_outboxcode1.Add(BoxCode.ToString());
                     }
-                    for (int i = 0; i < sheet.LastRowNum; i++)
-                    {
-                        if (i != 0)
-                        {
-                            sheet.AutoSizeColumn(i);
-                            sheet.SetColumnWidth(i, sheet.GetColumnWidth(i) + 1000);
-                        }
-                    }
+                    //for (int i = 0; i < sheet.LastRowNum; i++)
+                    //{
+                    //    //if (i != 0)
+                    //    //{
+                    //    //    sheet.AutoSizeColumn(i);
+                    //    //    sheet.SetColumnWidth(i, sheet.GetColumnWidth(i) + 1000);
+                    //    //}
+                    //}
                     break;
                 case "BatchCode":
                     string LastBatchCode = "";
@@ -830,7 +822,7 @@ namespace UAS_LabelMachine
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pi_title"].Caption + ":" + DataTable.Rows[i]["pi_title"].ToString() + "  "
                                            + DataTable.Columns["ch_level"].Caption + ":" + DataTable.Rows[i]["ch_level"].ToString());
                                     }
-                                    else if (columnNum > 14 && j == columnNum - 14)
+                                    else if (j==6)
                                     {
                                         row1.CreateCell(j);
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pi_inoutno"].Caption + ":" + DataTable.Rows[i]["pi_inoutno"].ToString());
@@ -848,25 +840,17 @@ namespace UAS_LabelMachine
                                 {
                                     if (j == 0)
                                     {
-                                        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());
-                                    }
-                                    else if (j == 3)
-                                    {
-                                        row1.CreateCell(j);
-                                        row1.Cells[j].SetCellValue(DataTable.Columns["pr_size"].Caption + ":" + DataTable.Rows[i]["pr_size"].ToString());
+                                        row1.CreateCell(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());
                                     }
-                                    else if (columnNum > 14 && j == columnNum - 14)
+                                    else if (j == 5)
                                     {
-                                        row1.CreateCell(j);
-                                        row1.Cells[j].SetCellValue(DataTable.Columns["pi_date"].Caption + ":" + DataTable.Rows[i]["pi_date"].ToString());
+                                        row1.CreateCell(j).SetCellValue(DataTable.Columns["pr_size"].Caption + ":" + DataTable.Rows[i]["pr_size"].ToString());
                                     }
-                                    else
+                                    else if (j == 6)
                                     {
-                                        row1.CreateCell(j);
+                                        row1.CreateCell(j).SetCellValue(DataTable.Columns["pi_date"].Caption + ":" + DataTable.Rows[i]["pi_date"].ToString());
                                     }
-                                    row1.GetCell(j).CellStyle = style;
                                 }
                                 //添加列名
                                 row1 = sheet.CreateRow(PaintIndex);
@@ -996,14 +980,14 @@ namespace UAS_LabelMachine
                         pib_id.Add(DataTable.Rows[i]["pib_id"].ToString());
                         pib_outboxcode1.Add(BoxCode.ToString());
                     }
-                    for (int i = 0; i < sheet.LastRowNum; i++)
-                    {
-                        if (i != 0)
-                        {
-                            sheet.AutoSizeColumn(i);
-                            sheet.SetColumnWidth(i, sheet.GetColumnWidth(i) + 1000);
-                        }
-                    }
+                    //for (int i = 0; i < sheet.LastRowNum; i++)
+                    //{
+                    //    if (i != 0)
+                    //    {
+                    //        sheet.AutoSizeColumn(i);
+                    //        sheet.SetColumnWidth(i, sheet.GetColumnWidth(i) + 1000);
+                    //    }
+                    //}
                     break;
                 case "BoxCode":
                     string LastBoxCode = "";
@@ -1062,7 +1046,7 @@ namespace UAS_LabelMachine
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pi_title"].Caption + ":" + DataTable.Rows[i]["pi_title"].ToString() + "  "
                                            + DataTable.Columns["ch_level"].Caption + ":" + DataTable.Rows[i]["ch_level"].ToString());
                                     }
-                                    else if (columnNum > 14 && j == columnNum - 14)
+                                    else if (j==6)
                                     {
                                         row1.CreateCell(j);
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pi_inoutno"].Caption + ":" + DataTable.Rows[i]["pi_inoutno"].ToString());
@@ -1080,25 +1064,17 @@ namespace UAS_LabelMachine
                                 {
                                     if (j == 0)
                                     {
-                                        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());
+                                        row1.CreateCell(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());
                                     }
-                                    else if (j == 3)
+                                    else if (j == 5)
                                     {
-                                        row1.CreateCell(j);
-                                        row1.Cells[j].SetCellValue(DataTable.Columns["pr_size"].Caption + ":" + DataTable.Rows[i]["pr_size"].ToString());
+                                        row1.CreateCell(j).SetCellValue(DataTable.Columns["pr_size"].Caption + ":" + DataTable.Rows[i]["pr_size"].ToString());
                                     }
-                                    else if (columnNum > 14 && j == columnNum - 14)
+                                    else if (j == 6)
                                     {
-                                        row1.CreateCell(j);
-                                        row1.Cells[j].SetCellValue(DataTable.Columns["pi_date"].Caption + ":" + DataTable.Rows[i]["pi_date"].ToString());
-                                    }
-                                    else
-                                    {
-                                        row1.CreateCell(j);
+                                        row1.CreateCell(j).SetCellValue(DataTable.Columns["pi_date"].Caption + ":" + DataTable.Rows[i]["pi_date"].ToString());
                                     }
-                                    row1.GetCell(j).CellStyle = style;
                                 }
                                 //添加列名
                                 row1 = sheet.CreateRow(PaintIndex);
@@ -1228,14 +1204,14 @@ namespace UAS_LabelMachine
                         pib_id.Add(DataTable.Rows[i]["pib_id"].ToString());
                         pib_outboxcode1.Add(BoxCode.ToString());
                     }
-                    for (int i = 0; i < sheet.LastRowNum; i++)
-                    {
-                        if (i != 0)
-                        {
-                            sheet.AutoSizeColumn(i);
-                            sheet.SetColumnWidth(i, sheet.GetColumnWidth(i) + 1000);
-                        }
-                    }
+                    //for (int i = 0; i < sheet.LastRowNum; i++)
+                    //{
+                    //    if (i != 0)
+                    //    {
+                    //        sheet.AutoSizeColumn(i);
+                    //        sheet.SetColumnWidth(i, sheet.GetColumnWidth(i) + 1000);
+                    //    }
+                    //}
                     break;
                 default:
                     break;
@@ -1662,13 +1638,12 @@ namespace UAS_LabelMachine
                             row1 = sheet.CreateRow(PaintIndex);
                             sheet.SetRowBreak(PaintIndex - 1);
                             sheet.Footer.Center = "第&P页,共&N页";
-                            PaintIndex = PaintIndex + 1;
                         }
                         //每次到了页数开始分页
                         if (i % PageSize == 0 || i == rowNum - 1)
                         {
                             //第一行添加客户信息   rownum只有一行的情
-                            if (i != rowNum - 1 || rowNum == 1)
+                            if (i != rowNum - 1 || rowNum == 1 || (rowNum - i == rowNum % PageSize))
                             {
                                 //抬头设置
                                 row1 = sheet.CreateRow(PaintIndex);
@@ -1685,7 +1660,7 @@ namespace UAS_LabelMachine
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pi_title"].Caption + ":" + DataTable.Rows[i]["pi_title"].ToString() + "  "
                                            + DataTable.Columns["ch_level"].Caption + ":" + DataTable.Rows[i]["ch_level"].ToString());
                                     }
-                                    else if (columnNum > 14 && j == columnNum - 14)
+                                    else if (columnNum > 15 && j == columnNum - 15)
                                     {
                                         row1.CreateCell(j);
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pi_inoutno"].Caption + ":" + DataTable.Rows[i]["pi_inoutno"].ToString());
@@ -1707,12 +1682,12 @@ namespace UAS_LabelMachine
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pr_orispeccode"].Caption + ":" + DataTable.Rows[i]["pr_orispeccode"].ToString() + "  "
                                   + DataTable.Columns["pi_chipouttype"].Caption + ":" + DataTable.Rows[i]["pi_chipouttype"].ToString());
                                     }
-                                    else if (j == 3)
+                                    else if (j == 4)
                                     {
                                         row1.CreateCell(j);
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pr_size"].Caption + ":" + DataTable.Rows[i]["pr_size"].ToString());
                                     }
-                                    else if (columnNum > 14 && j == columnNum - 14)
+                                    else if (columnNum > 15 && j == columnNum - 15)
                                     {
                                         row1.CreateCell(j);
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pi_date"].Caption + ":" + DataTable.Rows[i]["pi_date"].ToString());
@@ -1866,19 +1841,18 @@ namespace UAS_LabelMachine
                             }
                             sheet.SetRowBreak(PaintIndex);
                             sheet.Footer.Center = "第&P页,共&N页";
-                            PaintIndex = PaintIndex + 1;
                         }
                         pib_id.Add(DataTable.Rows[i]["pib_id"].ToString());
                         pib_outboxcode1.Add(BoxCode.ToString());
                     }
-                    for (int i = 0; i < sheet.LastRowNum; i++)
-                    {
-                        if (i != 0)
-                        {
-                            sheet.AutoSizeColumn(i);
-                            sheet.SetColumnWidth(i, sheet.GetColumnWidth(i) + 1000);
-                        }
-                    }
+                    //for (int i = 0; i < sheet.LastRowNum; i++)
+                    //{
+                    //    if (i != 0)
+                    //    {
+                    //        sheet.AutoSizeColumn(i);
+                    //        sheet.SetColumnWidth(i, sheet.GetColumnWidth(i) + 1000);
+                    //    }
+                    //}
                     break;
                 case "BatchCode":
                     string LastBatchCode = "";
@@ -1944,7 +1918,7 @@ namespace UAS_LabelMachine
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pi_title"].Caption + ":" + DataTable.Rows[i]["pi_title"].ToString() + "  "
                                            + DataTable.Columns["ch_level"].Caption + ":" + DataTable.Rows[i]["ch_level"].ToString());
                                     }
-                                    else if (columnNum > 14 && j == columnNum - 14)
+                                    else if (columnNum > 15 && j == columnNum - 15)
                                     {
                                         row1.CreateCell(j);
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pi_inoutno"].Caption + ":" + DataTable.Rows[i]["pi_inoutno"].ToString());
@@ -1966,12 +1940,12 @@ namespace UAS_LabelMachine
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pr_orispeccode"].Caption + ":" + DataTable.Rows[i]["pr_orispeccode"].ToString() + "  "
                                   + DataTable.Columns["pi_chipouttype"].Caption + ":" + DataTable.Rows[i]["pi_chipouttype"].ToString());
                                     }
-                                    else if (j == 3)
+                                    else if (j == 4)
                                     {
                                         row1.CreateCell(j);
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pr_size"].Caption + ":" + DataTable.Rows[i]["pr_size"].ToString());
                                     }
-                                    else if (columnNum > 14 && j == columnNum - 14)
+                                    else if (columnNum > 15 && j == columnNum - 15)
                                     {
                                         row1.CreateCell(j);
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pi_date"].Caption + ":" + DataTable.Rows[i]["pi_date"].ToString());
@@ -2112,20 +2086,19 @@ namespace UAS_LabelMachine
                             }
                             sheet.SetRowBreak(PaintIndex);
                             sheet.Footer.Center = "第&P页,共&N页";
-                            PaintIndex = PaintIndex + 1;
                             PageNum = 1;
                         }
                         pib_id.Add(DataTable.Rows[i]["pib_id"].ToString());
                         pib_outboxcode1.Add(BoxCode.ToString());
                     }
-                    for (int i = 0; i < sheet.LastRowNum; i++)
-                    {
-                        if (i != 0)
-                        {
-                            sheet.AutoSizeColumn(i);
-                            sheet.SetColumnWidth(i, sheet.GetColumnWidth(i) + 1000);
-                        }
-                    }
+                    //for (int i = 0; i < sheet.LastRowNum; i++)
+                    //{
+                    //    if (i != 0)
+                    //    {
+                    //        sheet.AutoSizeColumn(i);
+                    //        sheet.SetColumnWidth(i, sheet.GetColumnWidth(i) + 1000);
+                    //    }
+                    //}
                     break;
                 case "BoxCode":
                     string LastBoxCode = "";
@@ -2191,7 +2164,7 @@ namespace UAS_LabelMachine
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pi_title"].Caption + ":" + DataTable.Rows[i]["pi_title"].ToString() + "  "
                                            + DataTable.Columns["ch_level"].Caption + ":" + DataTable.Rows[i]["ch_level"].ToString());
                                     }
-                                    else if (columnNum > 14 && j == columnNum - 14)
+                                    else if (columnNum > 15 && j == columnNum - 15)
                                     {
                                         row1.CreateCell(j);
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pi_inoutno"].Caption + ":" + DataTable.Rows[i]["pi_inoutno"].ToString());
@@ -2213,12 +2186,12 @@ namespace UAS_LabelMachine
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pr_orispeccode"].Caption + ":" + DataTable.Rows[i]["pr_orispeccode"].ToString() + "  "
                                         + DataTable.Columns["pi_chipouttype"].Caption + ":" + DataTable.Rows[i]["pi_chipouttype"].ToString());
                                     }
-                                    else if (j == 3)
+                                    else if (j == 4)
                                     {
                                         row1.CreateCell(j);
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pr_size"].Caption + ":" + DataTable.Rows[i]["pr_size"].ToString());
                                     }
-                                    else if (columnNum > 14 && j == columnNum - 14)
+                                    else if (columnNum > 15 && j == columnNum - 15)
                                     {
                                         row1.CreateCell(j);
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pi_date"].Caption + ":" + DataTable.Rows[i]["pi_date"].ToString());
@@ -2359,20 +2332,19 @@ namespace UAS_LabelMachine
                             }
                             sheet.SetRowBreak(PaintIndex);
                             sheet.Footer.Center = "第&P页,共&N页";
-                            PaintIndex = PaintIndex + 1;
                             PageNum1 = 1;
                         }
                         pib_id.Add(DataTable.Rows[i]["pib_id"].ToString());
                         pib_outboxcode1.Add(BoxCode.ToString());
                     }
-                    for (int i = 0; i < sheet.LastRowNum; i++)
-                    {
-                        if (i != 0)
-                        {
-                            sheet.AutoSizeColumn(i);
-                            sheet.SetColumnWidth(i, sheet.GetColumnWidth(i) + 1000);
-                        }
-                    }
+                    //for (int i = 0; i < sheet.LastRowNum; i++)
+                    //{
+                    //    if (i != 0)
+                    //    {
+                    //        sheet.AutoSizeColumn(i);
+                    //        sheet.SetColumnWidth(i, sheet.GetColumnWidth(i) + 1000);
+                    //    }
+                    //}
                     break;
                 default:
                     break;
@@ -2715,7 +2687,7 @@ namespace UAS_LabelMachine
             row.GetCell(0).CellStyle.SetFont((ffont));
             //ffont.FontHeight = 10;
             //开始绘制的Index
-            int PaintIndex = 0;
+            int PaintIndex = 1;
             int sumCount = 0;
             int totalCount = 0;
             switch (Type)
@@ -2830,7 +2802,7 @@ namespace UAS_LabelMachine
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pi_title"].Caption + ":" + DataTable.Rows[i]["pi_title"].ToString() + "  "
                                            + DataTable.Columns["ch_level"].Caption + ":" + DataTable.Rows[i]["ch_level"].ToString());
                                     }
-                                    else if (columnNum > 14 && j == columnNum - 14)
+                                    else if (columnNum > 15 && j == columnNum - 15)
                                     {
                                         row1.CreateCell(j);
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pi_inoutno"].Caption + ":" + DataTable.Rows[i]["pi_inoutno"].ToString());
@@ -2849,15 +2821,15 @@ namespace UAS_LabelMachine
                                     if (j == 0)
                                     {
                                         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());
+                                        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());
                                     }
-                                    else if (j == 3)
+                                    else if (j == 4)
                                     {
                                         row1.CreateCell(j);
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pr_size"].Caption + ":" + DataTable.Rows[i]["pr_size"].ToString());
                                     }
-                                    else if (columnNum > 14 && j == columnNum - 14)
+                                    else if (columnNum > 15 && j == columnNum - 15)
                                     {
                                         row1.CreateCell(j);
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pi_date"].Caption + ":" + DataTable.Rows[i]["pi_date"].ToString());
@@ -3029,14 +3001,14 @@ namespace UAS_LabelMachine
                         pib_id.Add(DataTable.Rows[i]["pib_id"].ToString());
                         pib_outboxcode1.Add(BoxCode.ToString());
                     }
-                    for (int i = 0; i < sheet.LastRowNum; i++)
-                    {
-                        if (i != 0)
-                        {
-                            sheet.AutoSizeColumn(i);
-                            sheet.SetColumnWidth(i, sheet.GetColumnWidth(i) + 1000);
-                        }
-                    }
+                    //for (int i = 0; i < sheet.LastRowNum; i++)
+                    //{
+                    //    if (i != 0)
+                    //    {
+                    //        sheet.AutoSizeColumn(i);
+                    //        sheet.SetColumnWidth(i, sheet.GetColumnWidth(i) + 1000);
+                    //    }
+                    //}
                     break;
                 case "BatchCode":
                     string LastBatchCode = "";
@@ -3120,7 +3092,7 @@ namespace UAS_LabelMachine
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pi_title"].Caption + ":" + DataTable.Rows[i]["pi_title"].ToString() + "  "
                                            + DataTable.Columns["ch_level"].Caption + ":" + DataTable.Rows[i]["ch_level"].ToString());
                                     }
-                                    else if (columnNum > 14 && j == columnNum - 14)
+                                    else if (columnNum > 15 && j == columnNum - 15)
                                     {
                                         row1.CreateCell(j);
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pi_inoutno"].Caption + ":" + DataTable.Rows[i]["pi_inoutno"].ToString());
@@ -3142,12 +3114,12 @@ namespace UAS_LabelMachine
                                         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());
                                     }
-                                    else if (j == 3)
+                                    else if (j == 4)
                                     {
                                         row1.CreateCell(j);
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pr_size"].Caption + ":" + DataTable.Rows[i]["pr_size"].ToString());
                                     }
-                                    else if (columnNum > 14 && j == columnNum - 14)
+                                    else if (columnNum > 15 && j == columnNum - 15)
                                     {
                                         row1.CreateCell(j);
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pi_date"].Caption + ":" + DataTable.Rows[i]["pi_date"].ToString());
@@ -3310,14 +3282,14 @@ namespace UAS_LabelMachine
                         pib_id.Add(DataTable.Rows[i]["pib_id"].ToString());
                         pib_outboxcode1.Add(BoxCode.ToString());
                     }
-                    for (int i = 0; i < sheet.LastRowNum; i++)
-                    {
-                        if (i != 0)
-                        {
-                            sheet.AutoSizeColumn(i);
-                            sheet.SetColumnWidth(i, sheet.GetColumnWidth(i) + 1000);
-                        }
-                    }
+                    //for (int i = 0; i < sheet.LastRowNum; i++)
+                    //{
+                    //    if (i != 0)
+                    //    {
+                    //        sheet.AutoSizeColumn(i);
+                    //        sheet.SetColumnWidth(i, sheet.GetColumnWidth(i) + 1000);
+                    //    }
+                    //}
                     break;
                 case "BoxCode":
                     string LastBoxCode = "";
@@ -3400,7 +3372,7 @@ namespace UAS_LabelMachine
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pi_title"].Caption + ":" + DataTable.Rows[i]["pi_title"].ToString() + "  "
                                            + DataTable.Columns["ch_level"].Caption + ":" + DataTable.Rows[i]["ch_level"].ToString());
                                     }
-                                    else if (columnNum > 14 && j == columnNum - 14)
+                                    else if (columnNum > 15 && j == columnNum - 15)
                                     {
                                         row1.CreateCell(j);
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pi_inoutno"].Caption + ":" + DataTable.Rows[i]["pi_inoutno"].ToString());
@@ -3422,12 +3394,12 @@ namespace UAS_LabelMachine
                                         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());
                                     }
-                                    else if (j == 3)
+                                    else if (j == 4)
                                     {
                                         row1.CreateCell(j);
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pr_size"].Caption + ":" + DataTable.Rows[i]["pr_size"].ToString());
                                     }
-                                    else if (columnNum > 14 && j == columnNum - 14)
+                                    else if (columnNum > 15 && j == columnNum - 15)
                                     {
                                         row1.CreateCell(j);
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pi_date"].Caption + ":" + DataTable.Rows[i]["pi_date"].ToString());
@@ -3436,7 +3408,6 @@ namespace UAS_LabelMachine
                                     {
                                         row1.CreateCell(j);
                                     }
-                                    row1.GetCell(j).CellStyle = style;
                                 }
                                 //添加列名
                                 row1 = sheet.CreateRow(PaintIndex);
@@ -3590,14 +3561,14 @@ namespace UAS_LabelMachine
                         pib_id.Add(DataTable.Rows[i]["pib_id"].ToString());
                         pib_outboxcode1.Add(BoxCode.ToString());
                     }
-                    for (int i = 0; i < sheet.LastRowNum; i++)
-                    {
-                        if (i != 0)
-                        {
-                            sheet.AutoSizeColumn(i);
-                            sheet.SetColumnWidth(i, sheet.GetColumnWidth(i) + 1000);
-                        }
-                    }
+                    //for (int i = 0; i < sheet.LastRowNum; i++)
+                    //{
+                    //    if (i != 0)
+                    //    {
+                    //        sheet.AutoSizeColumn(i);
+                    //        sheet.SetColumnWidth(i, sheet.GetColumnWidth(i) + 1000);
+                    //    }
+                    //}
                     break;
                 default:
                     break;

+ 1 - 1
UAS-出货标签管理(贸易版)/UAS_出货标签管理.cs

@@ -2375,7 +2375,7 @@ namespace UAS_LabelMachine
                             ex.StartPosition = FormStartPosition.CenterScreen;
                             ex.ShowDialog();
                             break;
-                        case "SZSI":
+                        case "SZSI_P":
                             ex.StartPosition = FormStartPosition.CenterScreen;
                             ex.ShowDialog();
                             break;