callm 2 сар өмнө
parent
commit
68fefb2a36

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

@@ -4811,7 +4811,6 @@ namespace UAS_LabelMachine
         private MemoryStream HETONGGUANGDIAN(DataTable FirstDT, DataTable DataTable, string Type, string Inoutno, int PageSize, List<CheckBox> conditionbox)
         {
             string 小计 = "";
-            string 批小计 = "";
             string 总计 = "";
             string 片 = "";
             string companyname = "";
@@ -4822,13 +4821,11 @@ namespace UAS_LabelMachine
             {
                 小计 = "小计";
                 总计 = "总计";
-                批小计 = "批小计";
                 片 = "片";
                 companyname = "深爱半导体股份有限公司芯片出货清单";
             }
             else
             {
-                批小计 = "BatchTotal";
                 小计 = "total";
                 总计 = "total";
                 companyname = "SHENZHEN SI SEMICONDUCTORS  CO.,LTD";
@@ -4857,7 +4854,7 @@ namespace UAS_LabelMachine
             int BoxCode = 1;
             ICellStyle style = book.CreateCellStyle();
             style.VerticalAlignment = VerticalAlignment.Center;
-            style.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
+            style.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Left;
             style.SetFont(ffont);
             ICellStyle styleborder = book.CreateCellStyle();
             styleborder.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
@@ -4879,6 +4876,8 @@ namespace UAS_LabelMachine
             ColumnTitleStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
             ColumnTitleStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
             ColumnTitleStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
+            ColumnTitleStyle.VerticalAlignment = VerticalAlignment.Center;
+            ColumnTitleStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Center;
 
             List<string> NotShowColumn = new List<string>();
             NotShowColumn.Add("ch_level");
@@ -4999,7 +4998,6 @@ namespace UAS_LabelMachine
                     {
                         IRow 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()))
                         {
@@ -5044,31 +5042,9 @@ namespace UAS_LabelMachine
                             First_Batch = "";
                             First_WID.Clear();
                             BoxCode = BoxCode + 1;
-                            for (int j = 0; j < ShowColumnCount; j++)
-                            {
-                                row1.CreateCell(j);
-                                if (j == 0)
-                                {
-                                    row1.Cells[j].SetCellValue(批小计);
-                                }
-                                else if (j == ShowPieceIndex)
-                                {
-                                    row1.Cells[ShowPieceIndex].SetCellValue((i % PageSize == 0 ? PageSize : i));
-                                    row1.Cells[j].CellStyle = styleborder;
-                                }
-                                else if (j == ShowCountIndex)
-                                {
-                                    row1.Cells[j].SetCellValue(sumCount);
-                                }
-                                else if (j == ShowBoxIndex - 4)
-                                {
-                                    row1.Cells[j].SetCellValue(LastBox);
-                                    row1.Cells[j].CellStyle = styleborder;
-                                }
-                                row1.Cells[j].CellStyle = styleborder;
-                            }
-                            row1 = sheet.CreateRow(PaintIndex);
-                            PaintIndex = PaintIndex + 1;
+                         
+                          
+                            row1.HeightInPoints = RowHeight;
                             for (int j = 0; j < ShowColumnCount; j++)
                             {
                                 row1.CreateCell(j);
@@ -5290,32 +5266,6 @@ namespace UAS_LabelMachine
                             row1 = sheet.CreateRow(PaintIndex);
                             PaintIndex = PaintIndex + 1;
                             for (int j = 0; j < ShowColumnCount; j++)
-                            {
-                                row1.CreateCell(j);
-                                if (j == 0)
-                                {
-                                    row1.Cells[j].SetCellValue(批小计);
-                                }
-                                else if (j == ShowPieceIndex)
-                                {
-                                    row1.Cells[ShowPieceIndex].SetCellValue((rowNum % PageSize == 0 ? PageSize : (rowNum % PageSize)));
-                                    row1.Cells[j].CellStyle = styleborder;
-                                }
-                                else if (j == ShowBoxIndex - 4)
-                                {
-                                    row1.Cells[j].SetCellValue(LastBox);
-                                    row1.Cells[j].CellStyle = styleborder;
-                                }
-                                else if (j == ShowCountIndex)
-                                {
-                                    row1.Cells[j].SetCellValue(sumCount);
-                                }
-
-                                row1.Cells[j].CellStyle = styleborder;
-                            }
-                            row1 = sheet.CreateRow(PaintIndex);
-                            PaintIndex = PaintIndex + 1;
-                            for (int j = 0; j < ShowColumnCount; j++)
                             {
                                 row1.CreateCell(j);
                                 if (j == 0)
@@ -5384,36 +5334,6 @@ namespace UAS_LabelMachine
                         {
                             BoxCode = BoxCode + 1;
                             for (int j = 0; j < ShowColumnCount; j++)
-                            {
-                                row1.CreateCell(j);
-                                if (j == 0)
-                                {
-                                    row1.Cells[j].SetCellValue(批小计);
-                                    row1.Cells[j].CellStyle = styleborder;
-                                }
-                                else if (j == ShowPieceIndex)
-                                {
-                                    row1.Cells[ShowPieceIndex].SetCellValue(PageNum);
-                                    row1.Cells[j].CellStyle = styleborder;
-                                }
-                                else if (j == ShowCountIndex)
-                                {
-                                    row1.Cells[j].SetCellValue(sumCount);
-                                    row1.Cells[j].CellStyle = styleborder;
-                                }
-                                else if (j == ShowBoxIndex - 4)
-                                {
-                                    row1.Cells[j].SetCellValue(LastBox);
-                                    row1.Cells[j].CellStyle = styleborder;
-                                }
-                                else
-                                {
-                                    row1.Cells[j].CellStyle = styleborder;
-                                }
-                            }
-                            row1 = sheet.CreateRow(PaintIndex);
-                            PaintIndex = PaintIndex + 1;
-                            for (int j = 0; j < ShowColumnCount; j++)
                             {
                                 row1.CreateCell(j);
                                 if (j == 0)
@@ -5464,6 +5384,11 @@ 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 (j == 4)
+                                    {
+                                        row1.CreateCell(j);
+                                        row1.Cells[j].SetCellValue("出货日期" + ":" + DataTable.Rows[i]["pi_date"].ToString());
+                                    }
                                     else if (j == ShowDataIndex)
                                     {
                                         row1.CreateCell(j);
@@ -5483,19 +5408,14 @@ 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 == ShowSizeIndex)
+                                    else if (j == 4)
                                     {
                                         row1.CreateCell(j);
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pr_size"].Caption + ":" + DataTable.Rows[i]["pr_size"].ToString());
                                     }
-                                    else if (j == ShowDataIndex)
-                                    {
-                                        row1.CreateCell(j);
-                                        row1.Cells[j].SetCellValue(DataTable.Columns["pi_date"].Caption + ":" + DataTable.Rows[i]["pi_date"].ToString());
-                                    }
                                     else
                                     {
                                         row1.CreateCell(j);
@@ -5621,31 +5541,6 @@ namespace UAS_LabelMachine
                         }
                         if (i == rowNum - 1)
                         {
-                            row1 = sheet.CreateRow(PaintIndex);
-                            PaintIndex = PaintIndex + 1;
-                            for (int j = 0; j < ShowColumnCount; j++)
-                            {
-                                row1.CreateCell(j);
-                                if (j == 0)
-                                {
-                                    row1.Cells[j].SetCellValue(批小计);
-                                    row1.Cells[j].CellStyle = styleborder;
-                                }
-                                else if (j == ShowPieceIndex)
-                                {
-                                    row1.Cells[ShowPieceIndex].SetCellValue(PageNum + 1);
-                                    row1.Cells[j].CellStyle = styleborder;
-                                }
-                                else if (j == ShowCountIndex)
-                                {
-                                    row1.Cells[j].SetCellValue(sumCount);
-                                    row1.Cells[j].CellStyle = styleborder;
-                                }
-                                else
-                                {
-                                    row1.Cells[j].CellStyle = styleborder;
-                                }
-                            }
                             row1 = sheet.CreateRow(PaintIndex);
                             PaintIndex = PaintIndex + 1;
                             for (int j = 0; j < ShowColumnCount; j++)
@@ -5720,36 +5615,6 @@ namespace UAS_LabelMachine
                         {
                             BoxCode = BoxCode + 1;
                             for (int j = 0; j < ShowColumnCount; j++)
-                            {
-                                row1.CreateCell(j);
-                                if (j == 0)
-                                {
-                                    row1.Cells[j].SetCellValue(批小计);
-                                    row1.Cells[j].CellStyle = styleborder;
-                                }
-                                else if (j == ShowPieceIndex)
-                                {
-                                    row1.Cells[ShowPieceIndex].SetCellValue(PageNum1);
-                                    row1.Cells[j].CellStyle = styleborder;
-                                }
-                                else if (j == ShowCountIndex)
-                                {
-                                    row1.Cells[j].SetCellValue(sumCount);
-                                    row1.Cells[j].CellStyle = styleborder;
-                                }
-                                else if (j == ShowBoxIndex - 4)
-                                {
-                                    row1.Cells[j].SetCellValue(LastBox);
-                                    row1.Cells[j].CellStyle = styleborder;
-                                }
-                                else
-                                {
-                                    row1.Cells[j].CellStyle = styleborder;
-                                }
-                            }
-                            row1 = sheet.CreateRow(PaintIndex);
-                            PaintIndex = PaintIndex + 1;
-                            for (int j = 0; j < ShowColumnCount; j++)
                             {
                                 row1.CreateCell(j);
                                 if (j == 0)
@@ -5799,6 +5664,11 @@ 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 (j == 4)
+                                    {
+                                        row1.CreateCell(j);
+                                        row1.Cells[j].SetCellValue("出货日期" + ":" + DataTable.Rows[i]["pi_date"].ToString());
+                                    }
                                     else if (j == ShowDataIndex)
                                     {
                                         row1.CreateCell(j);
@@ -5818,23 +5688,19 @@ 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 == ShowSizeIndex)
+                                    else if (j == 4)
                                     {
                                         row1.CreateCell(j);
                                         row1.Cells[j].SetCellValue(DataTable.Columns["pr_size"].Caption + ":" + DataTable.Rows[i]["pr_size"].ToString());
                                     }
-                                    else if (j == ShowDataIndex)
-                                    {
-                                        row1.CreateCell(j);
-                                        row1.Cells[j].SetCellValue(DataTable.Columns["pi_date"].Caption + ":" + DataTable.Rows[i]["pi_date"].ToString());
-                                    }
                                     else
                                     {
                                         row1.CreateCell(j);
                                     }
+                                    row1.GetCell(j).CellStyle = style;
                                 }
                                 //添加列名
                                 row1 = sheet.CreateRow(PaintIndex);
@@ -5960,36 +5826,6 @@ namespace UAS_LabelMachine
                             row1 = sheet.CreateRow(PaintIndex);
                             PaintIndex = PaintIndex + 1;
                             for (int j = 0; j < ShowColumnCount; j++)
-                            {
-                                row1.CreateCell(j);
-                                if (j == 0)
-                                {
-                                    row1.Cells[j].SetCellValue(批小计);
-                                    row1.Cells[j].CellStyle = styleborder;
-                                }
-                                else if (j == ShowPieceIndex)
-                                {
-                                    row1.Cells[ShowPieceIndex].SetCellValue(PageNum1);
-                                    row1.Cells[j].CellStyle = styleborder;
-                                }
-                                else if (j == ShowCountIndex)
-                                {
-                                    row1.Cells[j].SetCellValue(sumCount);
-                                    row1.Cells[j].CellStyle = styleborder;
-                                }
-                                else if (j == ShowBoxIndex - 4)
-                                {
-                                    row1.Cells[j].SetCellValue(LastBox);
-                                    row1.Cells[j].CellStyle = styleborder;
-                                }
-                                else
-                                {
-                                    row1.Cells[j].CellStyle = styleborder;
-                                }
-                            }
-                            row1 = sheet.CreateRow(PaintIndex);
-                            PaintIndex = PaintIndex + 1;
-                            for (int j = 0; j < ShowColumnCount; j++)
                             {
                                 row1.CreateCell(j);
                                 if (j == 0)
@@ -6301,36 +6137,6 @@ namespace UAS_LabelMachine
                             row1 = sheet.CreateRow(PaintIndex);
                             PaintIndex = PaintIndex + 1;
                             for (int j = 0; j < ShowColumnCount; j++)
-                            {
-                                row1.CreateCell(j);
-                                if (j == 0)
-                                {
-                                    row1.Cells[j].SetCellValue(批小计);
-                                    row1.Cells[j].CellStyle = styleborder;
-                                }
-                                else if (j == ShowPieceIndex)
-                                {
-                                    row1.Cells[ShowPieceIndex].SetCellValue(PageNum2);
-                                    row1.Cells[j].CellStyle = styleborder;
-                                }
-                                else if (j == ShowCountIndex)
-                                {
-                                    row1.Cells[j].SetCellValue(sumCount);
-                                    row1.Cells[j].CellStyle = styleborder;
-                                }
-                                else if (j == ShowBoxIndex - 4)
-                                {
-                                    row1.Cells[j].SetCellValue(LastBox);
-                                    row1.Cells[j].CellStyle = styleborder;
-                                }
-                                else
-                                {
-                                    row1.Cells[j].CellStyle = styleborder;
-                                }
-                            }
-                            row1 = sheet.CreateRow(PaintIndex);
-                            PaintIndex = PaintIndex + 1;
-                            for (int j = 0; j < ShowColumnCount; j++)
                             {
                                 row1.CreateCell(j);
                                 if (j == 0)