Преглед изворни кода

修改特殊客户条码导出

callm пре 5 година
родитељ
комит
67eb61f5a8

+ 0 - 9
UAS-出货标签管理(贸易版)/ExportColumns.cs

@@ -178,7 +178,6 @@ namespace UAS_LabelMachine
 
         private void LoadData()
         {
-            Console.WriteLine(DateTime.Now.ToString("yyyy/MM/dd h:mm:ss.fff"));
             StringBuilder sql = new StringBuilder();
             custcode = dh.getFieldDataByCondition("prodinout", "pi_cardcode", "pi_inoutno='" + inoutno + "'").ToString();
             DataTable SQL1_ = (DataTable)dh.ExecuteSql("select es_filed,es_caption,es_prefix,es_suffix,es_filed1 from CS_EXPORTSETTING where es_type='DataPage' and es_enable=-1 and es_custcode='" + custcode + "' and nvl(es_istitle,0)<>-1 order by es_detno", "select");
@@ -187,23 +186,17 @@ namespace UAS_LabelMachine
             {
                 SQL1_ = (DataTable)dh.ExecuteSql("select es_filed,es_caption,es_prefix,es_suffix,es_filed1 from CS_EXPORTSETTING where es_type='DataPage' and es_enable=-1 and es_custcode is null and nvl(es_istitle,0)<>-1  order by es_detno", "select");
             }
-            Console.WriteLine(DateTime.Now.ToString("yyyy/MM/dd h:mm:ss.fff"));
 
             string es_field1 = "";
             for (int i = 0; i < SQL1_.Rows.Count; i++)
             {
                 es_field1 += SQL1_.Rows[i]["es_prefix"].ToString() + "||" + SQL1_.Rows[i]["es_filed"].ToString() + "||" + SQL1_.Rows[i]["es_suffix"].ToString() + ",";
             }
-            Console.WriteLine(DateTime.Now.ToString("yyyy/MM/dd h:mm:ss.fff"));
 
             //分页信息的DataTable
             string datasql = "";
-            Console.WriteLine(DateTime.Now.ToString("yyyy/MM/dd h:mm:ss.fff"));
             LogicHandler.GetDataSQL(inoutno, es_field1.Substring(0, es_field1.Length - 1), out datasql);
-            Console.WriteLine(DateTime.Now.ToString("yyyy/MM/dd h:mm:ss.fff"));
             DataTable dt = (DataTable)dh.ExecuteSql(datasql, "select");
-            Console.WriteLine(DateTime.Now.ToString("yyyy/MM/dd h:mm:ss.fff"));
-
             for (int i = 0; i < dt.Columns.Count; i++)
             {
                 if (dt.Columns[i].ColumnName == (SQL1_.Rows[i]["es_prefix"].ToString() + "||" + SQL1_.Rows[i]["es_filed"].ToString() + "||" + SQL1_.Rows[i]["es_suffix"].ToString()).ToUpper())
@@ -218,7 +211,6 @@ namespace UAS_LabelMachine
             {
                 SQL_ = (DataTable)dh.ExecuteSql("select es_filed,es_datatype,es_caption,es_prefix,es_suffix,es_filed1 from CS_EXPORTSETTING where es_type='First' and es_enable=-1 and es_custcode is null and  nvl(es_istitle,0)<>-1 order by es_detno", "select");
             }
-            Console.WriteLine(DateTime.Now.ToString("yyyy/MM/dd h:mm:ss.fff"));
 
             string es_field = "";
             for (int i = 0; i < SQL_.Rows.Count; i++)
@@ -237,7 +229,6 @@ namespace UAS_LabelMachine
                     dt1.Columns[i].ColumnName = SQL_.Rows[i]["es_caption"].ToString();
                 }
             }
-            Console.WriteLine(DateTime.Now.ToString("yyyy/MM/dd h:mm:ss.fff"));
 
             if (FirstPage.DataSource != null)
                 FirstPage.DataSource = null;

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

@@ -902,7 +902,6 @@ namespace UAS_LabelMachine
             objCompilerParameters.ReferencedAssemblies.Add("System.Windows.Forms.dll");
             objCompilerParameters.GenerateExecutable = false;
             objCompilerParameters.GenerateInMemory = true;
-            Console.WriteLine(oContent);
             // 4.CompilerResults
             CompilerResults cr = objCSharpCodePrivoder.CompileAssemblyFromSource(objCompilerParameters, oContent);
             if (cr.Errors.HasErrors)
@@ -924,8 +923,7 @@ namespace UAS_LabelMachine
                 }
                 catch (Exception ex)
                 {
-                    Console.WriteLine(ex.StackTrace);
-                    Console.WriteLine(ex.Message);
+                  
                 }
             }
         }

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

@@ -506,7 +506,7 @@ namespace UAS_LabelMachine
                                     if (j == 0)
                                     {
                                         row1.CreateCell(j);
-                                        row1.Cells[j].SetCellValue(DataTable.Rows[i]["pi_title"].ToString()+"  "+ DataTable.Rows[i]["ch_level"].ToString());
+                                        row1.Cells[j].SetCellValue(DataTable.Rows[i]["pi_title"].ToString() + "  " + DataTable.Rows[i]["ch_level"].ToString());
                                     }
                                     else if (columnNum > 14 && j == columnNum - 14)
                                     {
@@ -564,7 +564,7 @@ namespace UAS_LabelMachine
                                         NumIndex = j;
                                     }
                                     //如果chw_itemname1的值为空,则值为100和0,其中一列不显示,不显示
-                                    if ((NotShowColumn.Contains(DataTable.Columns[j].ColumnName.ToLower())) ||(!ShowChcode && DataTable.Columns[j].ColumnName.ToLower().Contains("ch_code")))
+                                    if ((NotShowColumn.Contains(DataTable.Columns[j].ColumnName.ToLower())) || (!ShowChcode && DataTable.Columns[j].ColumnName.ToLower().Contains("ch_code")))
                                     {
                                         sheet.SetColumnHidden(j - 4, true);
                                     }
@@ -764,7 +764,7 @@ namespace UAS_LabelMachine
                                     }
                                     else
                                         row1.Cells[j - 4].SetCellValue(DataTable.Columns[j].Caption);
-                                    if ((NotShowColumn.Contains(DataTable.Columns[j].ColumnName.ToLower())) ||(!ShowChcode && DataTable.Columns[j].ColumnName.ToLower().Contains("ch_code")))
+                                    if ((NotShowColumn.Contains(DataTable.Columns[j].ColumnName.ToLower())) || (!ShowChcode && DataTable.Columns[j].ColumnName.ToLower().Contains("ch_code")))
                                     {
                                         sheet.SetColumnHidden(j - 4, true);
                                     }
@@ -952,7 +952,7 @@ namespace UAS_LabelMachine
                                     }
                                     else
                                         row1.Cells[j - 4].SetCellValue(DataTable.Columns[j].Caption);
-                                    if ((NotShowColumn.Contains(DataTable.Columns[j].ColumnName.ToLower())) ||(!ShowChcode && DataTable.Columns[j].ColumnName.ToLower().Contains("ch_code")))
+                                    if ((NotShowColumn.Contains(DataTable.Columns[j].ColumnName.ToLower())) || (!ShowChcode && DataTable.Columns[j].ColumnName.ToLower().Contains("ch_code")))
                                     {
                                         sheet.SetColumnHidden(j - 4, true);
                                     }
@@ -1342,24 +1342,36 @@ namespace UAS_LabelMachine
             int rowNum = DataTable.Rows.Count;
             int columnNum = DataTable.Columns.Count;
             //首先画好第一行带颜色的,单独写出来,避免写在循环里面
-            IRow row = sheet.CreateRow(0);
-            //冻结第一行
-            sheet.CreateFreezePane(0, 1, 0, 1);
 
-            row.HeightInPoints = RowHeight;
-            //固定第一行
-            //row.RowStyle.IsLocked=true;
-            //给第一行的标签赋值样式和值
-            // ffont.FontHeight = 13;
-            row.CreateCell(0);
-            row.Cells[0].SetCellValue("                                       深爱半导体股份有限公司芯片出货清单");
-
-            row.GetCell(0).CellStyle.SetFont((ffont));
             //ffont.FontHeight = 10;
             //开始绘制的Index
             int PaintIndex = 1;
             int sumCount = 0;
             int totalCount = 0;
+            //Title的字体
+
+
+
+            HSSFFont titlefont = (HSSFFont)book.CreateFont();
+            titlefont.FontName = "宋体";
+            titlefont.FontHeight = 270;
+            titlefont.Boldweight = (short)FontBoldWeight.Bold;
+
+            HSSFFont ColumnTitle = (HSSFFont)book.CreateFont();
+            ColumnTitle.FontName = "宋体";
+            ColumnTitle.Boldweight = (short)FontBoldWeight.Bold;
+
+            ICellStyle ColumnTitleStyle = book.CreateCellStyle();
+            ColumnTitleStyle.SetFont(ColumnTitle);
+
+            ColumnTitleStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
+            ColumnTitleStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
+            ColumnTitleStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
+            ColumnTitleStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
+
+            ICellStyle TitleStyle = book.CreateCellStyle();
+            TitleStyle.SetFont(titlefont);
+
             switch (Type)
             {
                 case "FixRow":
@@ -1373,9 +1385,13 @@ namespace UAS_LabelMachine
                     ArrayList<string> First_WID = new ArrayList<string>();
                     for (int i = 0; i < rowNum; i++)
                     {
-                        IRow row1 = sheet.CreateRow(PaintIndex);
-                        PaintIndex = PaintIndex + 1;
-                        row1.HeightInPoints = RowHeight;
+                        IRow row1 = null;
+                        if (PaintIndex != 1)
+                        {
+                            row1 = sheet.CreateRow(PaintIndex);
+                            PaintIndex = PaintIndex + 1;
+                            row1.HeightInPoints = RowHeight;
+                        }
                         //不包含的订单号
                         if (DataTable.Columns.Contains("pd_ordercode") && !First_OrderCode.Contains(DataTable.Rows[i]["pd_ordercode"].ToString()))
                         {
@@ -1423,9 +1439,14 @@ namespace UAS_LabelMachine
                                 {
                                     row1.Cells[j].SetCellValue("小计");
                                 }
-                                else if (DataTable.Columns[j].ColumnName == "io_qty")
+                                else if (j == 1)
                                 {
-                                    row1.Cells[NumIndex - 4].SetCellValue(sumCount);
+                                    row1.Cells[1].SetCellValue((i % PageSize == 0 ? PageSize : i) + "片");
+                                    row1.Cells[1].CellStyle = ColumnTitleStyle;
+                                }
+                                else if (j == 2)
+                                {
+                                    row1.Cells[2].SetCellValue(sumCount);
                                 }
                                 row1.Cells[j].CellStyle = styleborder;
                             }
@@ -1441,6 +1462,14 @@ namespace UAS_LabelMachine
                             //第一行添加客户信息   rownum只有一行的情
                             if (i != rowNum - 1 || rowNum == 1)
                             {
+                                //抬头设置
+                                row1 = sheet.CreateRow(PaintIndex);
+                                PaintIndex = PaintIndex + 1;
+                                row1.CreateCell(0).SetCellValue("                            深爱半导体股份有限公司芯片出货清单");
+                                row1.GetCell(0).CellStyle = TitleStyle;
+                                row1 = sheet.CreateRow(PaintIndex);
+                                PaintIndex = PaintIndex + 1;
+                                //特殊客户添加一列空行
                                 for (int j = 0; j < columnNum - 3; j++)
                                 {
                                     if (j == 0)
@@ -1467,7 +1496,7 @@ namespace UAS_LabelMachine
                                     if (j == 0)
                                     {
                                         row1.CreateCell(j);
-                                        row1.Cells[j].SetCellValue(DataTable.Rows[i]["pr_orispeccode"].ToString() + DataTable.Rows[i]["me_desc"].ToString() + DataTable.Rows[i]["pr_size"].ToString());
+                                        row1.Cells[j].SetCellValue(DataTable.Rows[i]["pr_orispeccode"].ToString() + DataTable.Rows[i]["me_desc"].ToString() + "   " + DataTable.Rows[i]["pr_size"].ToString() + "   销售部门:市场部");
                                     }
                                     else if (columnNum > 14 && j == columnNum - 14)
                                     {
@@ -1480,6 +1509,10 @@ namespace UAS_LabelMachine
                                     }
                                     row1.GetCell(j).CellStyle = style;
                                 }
+
+                                //特殊客户添加一列空行
+                                row1 = sheet.CreateRow(PaintIndex);
+                                PaintIndex = PaintIndex + 1;
                                 //添加列名
                                 row1 = sheet.CreateRow(PaintIndex);
                                 PaintIndex = PaintIndex + 1;
@@ -1487,7 +1520,7 @@ namespace UAS_LabelMachine
                                 for (int j = 4; j < columnNum; j++)
                                 {
                                     row1.CreateCell(j - 4);
-                                    row1.Cells[j - 4].CellStyle = styleborder;
+                                    row1.Cells[j - 4].CellStyle = ColumnTitleStyle;
                                     if (DataTable.Columns[j].ColumnName.ToLower() == "chw_percent1")
                                     {
                                         row1.Cells[j - 4].SetCellValue(DataTable.Rows[i]["chw_itemname1"].ToString());
@@ -1554,47 +1587,18 @@ namespace UAS_LabelMachine
                                 {
                                     row1.Cells[j].SetCellValue("小计");
                                 }
-                                else if (DataTable.Columns[j].ColumnName == "io_qty")
+                                else if (j == 1)
                                 {
-                                    row1.Cells[j - 4].SetCellValue(sumCount);
-                                }
-                                row1.Cells[j].CellStyle = styleborder;
-                            }
-                            row1 = sheet.CreateRow(PaintIndex);
-                            for (int j = 0; j < columnNum - 3; j++)
-                            {
-                                if (j == 0)
-                                {
-                                    row1.CreateCell(j);
-                                    row1.Cells[j].SetCellValue("备注");
+                                    row1.Cells[1].SetCellValue((i % PageSize == 0 ? PageSize : (i % PageSize + 1)) + "片");
+                                    row1.Cells[1].CellStyle = ColumnTitleStyle;
                                 }
                                 else if (j == 2)
                                 {
-                                    row1.CreateCell(j);
-                                    row1.Cells[j].SetCellValue(totalCount);
+                                    row1.Cells[2].SetCellValue(sumCount);
                                 }
-                                //原本是j == columnNum - 5因为还有spec和order两列隐藏列,所以需要在往后移动
-                                else if (j == columnNum - 6)
-                                {
-                                    row1.CreateCell(j);
-                                    row1.Cells[j].SetCellValue(rowNum);
-                                }
-                                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("片");
-                                }
-                                else
-                                {
-                                    row1.CreateCell(j);
-                                }
-                                row1.Cells[j].CellStyle = style;
+                                row1.Cells[j].CellStyle = styleborder;
                             }
+                            row1 = sheet.CreateRow(PaintIndex);
                             sheet.SetRowBreak(PaintIndex);
                             sheet.Footer.Center = "第&P页,共&N页";
                             PaintIndex = PaintIndex + 1;
@@ -1613,12 +1617,14 @@ namespace UAS_LabelMachine
                     break;
                 case "BatchCode":
                     string LastBatchCode = "";
+                    int PageNum = 0;
                     for (int i = 0; i < rowNum; i++)
                     {
                         IRow row1 = sheet.CreateRow(PaintIndex);
                         PaintIndex = PaintIndex + 1;
                         row1.HeightInPoints = RowHeight;
                         //如果批号不相等的时候
+                        PageNum = PageNum + 1;
                         if (LastBatchCode != "" && LastBatchCode != DataTable.Rows[i]["ch_splitbatch"].ToString())
                         {
                             BoxCode = BoxCode + 1;
@@ -1628,24 +1634,41 @@ namespace UAS_LabelMachine
                                 if (j == 0)
                                 {
                                     row1.Cells[j].SetCellValue("小计");
+                                    row1.Cells[j].CellStyle = styleborder;
                                 }
-                                else if (DataTable.Columns[j].ColumnName == "io_qty")
+                                else if (j == 1)
                                 {
-                                    row1.Cells[j - 4].SetCellValue(sumCount);
+                                    row1.Cells[1].SetCellValue(PageNum - 1 + "片");
+                                    row1.Cells[1].CellStyle = ColumnTitleStyle;
+                                }
+                                else if (j == 2)
+                                {
+                                    row1.Cells[2].SetCellValue(sumCount);
+                                    row1.Cells[j].CellStyle = styleborder;
+                                }
+                                else
+                                {
+                                    row1.Cells[j].CellStyle = styleborder;
                                 }
-                                row1.Cells[j].CellStyle = styleborder;
                             }
                             sumCount = 0;
                             row1 = sheet.CreateRow(PaintIndex);
                             sheet.SetRowBreak(PaintIndex - 1);
                             sheet.Footer.Center = "第&P页,共&N页";
                             PaintIndex = PaintIndex + 1;
+                            PageNum = 1;
                         }
                         //每次到了页数开始分页
-                        if (LastBatchCode == "" || (LastBatchCode != "" && LastBatchCode != DataTable.Rows[i]["ch_splitbatch"].ToString()) || i == rowNum - 1)
+                        if (LastBatchCode == "" || (LastBatchCode != "" && LastBatchCode != DataTable.Rows[i]["ch_splitbatch"].ToString()))
                         {
                             LastBatchCode = DataTable.Rows[i]["ch_splitbatch"].ToString();
                             //第一行添加客户信息
+                            row1 = sheet.CreateRow(PaintIndex);
+                            PaintIndex = PaintIndex + 1;
+                            row1.CreateCell(0).SetCellValue("                            深爱半导体股份有限公司芯片出货清单");
+                            row1.GetCell(0).CellStyle = TitleStyle;
+                            row1 = sheet.CreateRow(PaintIndex);
+                            PaintIndex = PaintIndex + 1;
                             if (i != rowNum - 1)
                             {
                                 for (int j = 0; j < columnNum - 3; j++)
@@ -1674,7 +1697,7 @@ namespace UAS_LabelMachine
                                     if (j == 0)
                                     {
                                         row1.CreateCell(j);
-                                        row1.Cells[j].SetCellValue(DataTable.Rows[i]["pr_orispeccode"].ToString() + DataTable.Rows[i]["me_desc"].ToString() + DataTable.Rows[i]["pr_size"].ToString());
+                                        row1.Cells[j].SetCellValue(DataTable.Rows[i]["pr_orispeccode"].ToString() + DataTable.Rows[i]["me_desc"].ToString() + "   " + DataTable.Rows[i]["pr_size"].ToString() + "   销售部门:市场部");
                                     }
                                     else if (columnNum > 14 && j == columnNum - 14)
                                     {
@@ -1693,7 +1716,7 @@ namespace UAS_LabelMachine
                                 for (int j = 4; j < columnNum; j++)
                                 {
                                     row1.CreateCell(j - 4);
-                                    row1.Cells[j - 4].CellStyle = styleborder;
+                                    row1.Cells[j - 4].CellStyle = ColumnTitleStyle;
                                     if (DataTable.Columns[j].ColumnName.ToLower() == "chw_percent1")
                                     {
                                         row1.Cells[j - 4].SetCellValue(DataTable.Rows[i]["chw_itemname1"].ToString());
@@ -1740,51 +1763,29 @@ namespace UAS_LabelMachine
                                 if (j == 0)
                                 {
                                     row1.Cells[j].SetCellValue("小计");
+                                    row1.Cells[j].CellStyle = styleborder;
                                 }
-                                else if (DataTable.Columns[j].ColumnName == "io_qty")
+                                else if (j == 1)
                                 {
-                                    row1.Cells[j - 4].SetCellValue(sumCount);
-                                }
-                                row1.Cells[j].CellStyle = styleborder;
-                            }
-                            //创建备注内容
-                            row1 = sheet.CreateRow(PaintIndex);
-                            for (int j = 0; j < columnNum - 3; j++)
-                            {
-                                if (j == 0)
-                                {
-                                    row1.CreateCell(j);
-                                    row1.Cells[j].SetCellValue("备注");
+                                    row1.Cells[1].SetCellValue(PageNum + "片");
+                                    row1.Cells[1].CellStyle = ColumnTitleStyle;
                                 }
                                 else if (j == 2)
                                 {
-                                    row1.CreateCell(j);
-                                    row1.Cells[j].SetCellValue(totalCount);
-                                }
-                                else if (j == columnNum - 6)
-                                {
-                                    row1.CreateCell(j);
-                                    row1.Cells[j].SetCellValue(rowNum);
-                                }
-                                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("片");
+                                    row1.Cells[2].SetCellValue(sumCount);
+                                    row1.Cells[j].CellStyle = styleborder;
                                 }
                                 else
                                 {
-                                    row1.CreateCell(j);
+                                    row1.Cells[j].CellStyle = styleborder;
                                 }
-                                row1.Cells[j].CellStyle = style;
                             }
+                            //创建备注内容
+                            row1 = sheet.CreateRow(PaintIndex);
                             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());
@@ -1800,11 +1801,13 @@ namespace UAS_LabelMachine
                     break;
                 case "BoxCode":
                     string LastBoxCode = "";
+                    int PageNum1 = 0;
                     for (int i = 0; i < rowNum; i++)
                     {
                         IRow row1 = sheet.CreateRow(PaintIndex);
                         PaintIndex = PaintIndex + 1;
                         row1.HeightInPoints = RowHeight;
+                        PageNum1 = PageNum1 + 1;
                         //如果批号不相等的时候
                         if (LastBoxCode != "" && LastBoxCode != DataTable.Rows[i]["CH_PBCODE"].ToString())
                         {
@@ -1815,23 +1818,40 @@ namespace UAS_LabelMachine
                                 if (j == 0)
                                 {
                                     row1.Cells[j].SetCellValue("小计");
+                                    row1.Cells[j].CellStyle = styleborder;
                                 }
-                                else if (DataTable.Columns[j].ColumnName == "io_qty")
+                                else if (j == 1)
                                 {
-                                    row1.Cells[j - 4].SetCellValue(sumCount);
+                                    row1.Cells[1].SetCellValue(PageNum1 - 1 + "片");
+                                    row1.Cells[1].CellStyle = ColumnTitleStyle;
+                                }
+                                else if (j == 2)
+                                {
+                                    row1.Cells[2].SetCellValue(sumCount);
+                                    row1.Cells[j].CellStyle = styleborder;
+                                }
+                                else
+                                {
+                                    row1.Cells[j].CellStyle = styleborder;
                                 }
-                                row1.Cells[j].CellStyle = styleborder;
                             }
                             sumCount = 0;
                             row1 = sheet.CreateRow(PaintIndex);
                             sheet.SetRowBreak(PaintIndex - 1);
                             sheet.Footer.Center = "第&P页,共&N页";
                             PaintIndex = PaintIndex + 1;
+                            PageNum1 = 1;
                         }
                         //每次到了页数开始分页
-                        if (LastBoxCode == "" || (LastBoxCode != "" && LastBoxCode != DataTable.Rows[i]["ch_pbcode"].ToString()) || i == rowNum - 1)
+                        if (LastBoxCode == "" || (LastBoxCode != "" && LastBoxCode != DataTable.Rows[i]["ch_pbcode"].ToString()))
                         {
                             LastBoxCode = DataTable.Rows[i]["CH_PBCODE"].ToString();
+                            row1 = sheet.CreateRow(PaintIndex);
+                            PaintIndex = PaintIndex + 1;
+                            row1.CreateCell(0).SetCellValue("                            深爱半导体股份有限公司芯片出货清单");
+                            row1.GetCell(0).CellStyle = TitleStyle;
+                            row1 = sheet.CreateRow(PaintIndex);
+                            PaintIndex = PaintIndex + 1;
                             //第一行添加客户信息
                             if (i != rowNum - 1)
                             {
@@ -1861,7 +1881,7 @@ namespace UAS_LabelMachine
                                     if (j == 0)
                                     {
                                         row1.CreateCell(j);
-                                        row1.Cells[j].SetCellValue(DataTable.Rows[i]["pr_orispeccode"].ToString() + DataTable.Rows[i]["me_desc"].ToString() + DataTable.Rows[i]["pr_size"].ToString());
+                                        row1.Cells[j].SetCellValue(DataTable.Rows[i]["pr_orispeccode"].ToString() + DataTable.Rows[i]["me_desc"].ToString() + "   " + DataTable.Rows[i]["pr_size"].ToString() + "   销售部门:市场部");
                                     }
                                     else if (columnNum > 14 && j == columnNum - 14)
                                     {
@@ -1881,7 +1901,7 @@ namespace UAS_LabelMachine
                                 {
                                     //设定固定的列名
                                     row1.CreateCell(j - 4);
-                                    row1.Cells[j - 4].CellStyle = styleborder;
+                                    row1.Cells[j - 4].CellStyle = ColumnTitleStyle;
                                     if (DataTable.Columns[j].ColumnName.ToLower() == "chw_percent1")
                                     {
                                         row1.Cells[j - 4].SetCellValue(DataTable.Rows[i]["chw_itemname1"].ToString());
@@ -1928,51 +1948,28 @@ namespace UAS_LabelMachine
                                 if (j == 0)
                                 {
                                     row1.Cells[j].SetCellValue("小计");
+                                    row1.Cells[j].CellStyle = styleborder;
                                 }
-                                else if (DataTable.Columns[j].ColumnName == "io_qty")
+                                else if (j == 1)
                                 {
-                                    row1.Cells[j - 4].SetCellValue(sumCount);
-                                }
-                                row1.Cells[j].CellStyle = styleborder;
-                            }
-                            row1 = sheet.CreateRow(PaintIndex);
-
-                            for (int j = 0; j < columnNum - 3; j++)
-                            {
-                                if (j == 0)
-                                {
-                                    row1.CreateCell(j);
-                                    row1.Cells[j].SetCellValue("备注");
+                                    row1.Cells[1].SetCellValue(PageNum1 + "片");
+                                    row1.Cells[1].CellStyle = ColumnTitleStyle;
                                 }
                                 else if (j == 2)
                                 {
-                                    row1.CreateCell(j);
-                                    row1.Cells[j].SetCellValue(totalCount);
-                                }
-                                else if (j == columnNum - 6)
-                                {
-                                    row1.CreateCell(j);
-                                    row1.Cells[j].SetCellValue(rowNum);
-                                }
-                                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("片");
+                                    row1.Cells[2].SetCellValue(sumCount);
+                                    row1.Cells[j].CellStyle = styleborder;
                                 }
                                 else
                                 {
-                                    row1.CreateCell(j);
+                                    row1.Cells[j].CellStyle = styleborder;
                                 }
-                                row1.Cells[j].CellStyle = style;
                             }
+                            row1 = sheet.CreateRow(PaintIndex);
                             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());
@@ -1997,6 +1994,7 @@ namespace UAS_LabelMachine
             totalCount = 0;
             PaintIndex = 1;
             ISheet sheet2 = book.CreateSheet("首页");
+            IRow row = sheet.CreateRow(0);
             row = sheet2.CreateRow(0);
             row.CreateCell(0);
             row.Cells[0].SetCellValue("                            深爱半导体股份有限公司芯片出货清单");