瀏覽代碼

修改晶源计数在数量下方

callm 5 年之前
父節點
當前提交
c5e905035f
共有 1 個文件被更改,包括 31 次插入90 次删除
  1. 31 90
      UAS-出货标签管理(贸易版)/PublicMethod/ExcelHandler.cs

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

@@ -743,7 +743,7 @@ namespace UAS_LabelMachine
                                 }
                                 else if (j == ShowPieceIndex)
                                 {
-                                    row1.Cells[ShowPieceIndex].SetCellValue((rowNum % PageSize==0?PageSize:(rowNum % PageSize))+ 片);
+                                    row1.Cells[ShowPieceIndex].SetCellValue((rowNum % PageSize == 0 ? PageSize : (rowNum % PageSize)) + 片);
                                     row1.Cells[j].CellStyle = styleborder;
                                 }
                                 else if (j == ShowCountIndex)
@@ -1458,6 +1458,8 @@ namespace UAS_LabelMachine
             string 总计 = "";
             string 片 = "";
             string companyname = "";
+            //晶源的需要显示在数量列下面
+            int ShowCountIndex = 2;
             if (dh.getFieldDataByCondition("ProdInout", "pi_exporttype", "pi_inoutno='" + Inoutno + "'").ToString() == "Chinese")
             {
                 小计 = "小计";
@@ -1481,7 +1483,7 @@ namespace UAS_LabelMachine
             //Excel中的Sheet
             ISheet sheet = book.CreateSheet("分页");
             sheet.SetMargin(MarginType.TopMargin, 0.4);
-            sheet.SetMargin(MarginType.BottomMargin, 0.4);
+            sheet.SetMargin(MarginType.BottomMargin, 0.1);
             sheet.SetMargin(MarginType.LeftMargin, 0.4);
             sheet.SetMargin(MarginType.RightMargin, 0.4);
 
@@ -1811,11 +1813,7 @@ namespace UAS_LabelMachine
                                     }
                                     if (DataTable.Columns[j].ColumnName.ToString() == "io_qty")
                                     {
-                                        NumIndex = j;
-                                        if (ShowCountIndex == NumIndex - 4)
-                                        {
-                                            ShowCountIndex = ShowCountIndex + 1;
-                                        }
+                                        NumIndex = j - 4;
                                     }
                                 }
                                 ShowColumnCount = showcount;
@@ -1918,14 +1916,6 @@ 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);
-                    //    }
-                    //}
                     break;
                 case "BatchCode":
                     string LastBatchCode = "";
@@ -1950,7 +1940,7 @@ namespace UAS_LabelMachine
                                 }
                                 else if (j == ShowPieceIndex)
                                 {
-                                    row1.Cells[ShowPieceIndex].SetCellValue(PageNum - 1 + 片);
+                                    row1.Cells[ShowPieceIndex].SetCellValue(PageNum + 片);
                                     row1.Cells[1].CellStyle = ColumnTitleStyle;
                                 }
                                 else if (j == ShowCountIndex)
@@ -1965,7 +1955,7 @@ namespace UAS_LabelMachine
                             }
                             sumCount = 0;
                             //row1 = sheet.CreateRow(PaintIndex);
-                            //sheet.SetRowBreak(PaintIndex - 1);
+                            sheet.SetRowBreak(PaintIndex - 1);
                             sheet.Footer.Center = "第&P页,共&N页";
                             PageNum = 0;
                         }
@@ -2075,11 +2065,7 @@ namespace UAS_LabelMachine
                                     }
                                     if (DataTable.Columns[j].ColumnName.ToString() == "io_qty")
                                     {
-                                        NumIndex = j;
-                                        if (ShowCountIndex == NumIndex - 4)
-                                        {
-                                            ShowCountIndex = ShowCountIndex + 1;
-                                        }
+                                        NumIndex = j - 4;
                                     }
                                 }
                                 ShowColumnCount = showcount;
@@ -2177,14 +2163,6 @@ 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);
-                    //    }
-                    //}
                     break;
                 case "BoxCode":
                     string LastBoxCode = "";
@@ -2209,7 +2187,7 @@ namespace UAS_LabelMachine
                                 }
                                 else if (j == ShowPieceIndex)
                                 {
-                                    row1.Cells[ShowPieceIndex].SetCellValue(PageNum1 - 1 + 片);
+                                    row1.Cells[ShowPieceIndex].SetCellValue(PageNum1 + 片);
                                     row1.Cells[1].CellStyle = ColumnTitleStyle;
                                 }
                                 else if (j == ShowCountIndex)
@@ -2224,7 +2202,7 @@ namespace UAS_LabelMachine
                             }
                             sumCount = 0;
                             //row1 = sheet.CreateRow(PaintIndex);
-                            //sheet.SetRowBreak(PaintIndex - 1);
+                            sheet.SetRowBreak(PaintIndex - 1);
                             sheet.Footer.Center = "第&P页,共&N页";
                             PageNum1 = 0;
                         }
@@ -2335,11 +2313,7 @@ namespace UAS_LabelMachine
                                     }
                                     if (DataTable.Columns[j].ColumnName.ToString() == "io_qty")
                                     {
-                                        NumIndex = j;
-                                        if (ShowCountIndex == NumIndex - 4)
-                                        {
-                                            ShowCountIndex = ShowCountIndex + 1;
-                                        }
+                                        NumIndex = j - 4;
                                     }
                                 }
                                 ShowColumnCount = showcount;
@@ -2872,9 +2846,9 @@ namespace UAS_LabelMachine
                                 {
                                     row1.Cells[j].SetCellValue(sumCount);
                                 }
-                                else if (j == ShowBoxIndex-4)
+                                else if (j == ShowBoxIndex - 4)
                                 {
-                                    row1.Cells[j].SetCellValue(DataTable.Rows[i]["ch_pbcode"].ToString());
+                                    row1.Cells[j].SetCellValue(DataTable.Rows[i - 1]["ch_pbcode"].ToString());
                                     row1.Cells[j].CellStyle = styleborder;
                                 }
                                 row1.Cells[j].CellStyle = styleborder;
@@ -2896,9 +2870,9 @@ namespace UAS_LabelMachine
                                 {
                                     row1.Cells[j].SetCellValue(sumCount);
                                 }
-                                else if (j == ShowBoxIndex-4)
+                                else if (j == ShowBoxIndex - 4)
                                 {
-                                    row1.Cells[j].SetCellValue(DataTable.Rows[i]["ch_pbcode"].ToString());
+                                    row1.Cells[j].SetCellValue(DataTable.Rows[i - 1]["ch_pbcode"].ToString());
                                     row1.Cells[j].CellStyle = styleborder;
                                 }
                                 row1.Cells[j].CellStyle = styleborder;
@@ -3077,9 +3051,9 @@ namespace UAS_LabelMachine
                                     row1.Cells[ShowPieceIndex].SetCellValue((rowNum % PageSize == 0 ? PageSize : (rowNum % PageSize)) + 片);
                                     row1.Cells[j].CellStyle = styleborder;
                                 }
-                                else if (j == ShowBoxIndex-4)
+                                else if (j == ShowBoxIndex - 4)
                                 {
-                                    row1.Cells[j].SetCellValue(DataTable.Rows[i]["ch_pbcode"].ToString());
+                                    row1.Cells[j].SetCellValue(DataTable.Rows[i - 1]["ch_pbcode"].ToString());
                                     row1.Cells[j].CellStyle = styleborder;
                                 }
                                 else if (j == ShowCountIndex)
@@ -3103,9 +3077,9 @@ namespace UAS_LabelMachine
                                     row1.Cells[ShowPieceIndex].SetCellValue(rowNum % PageSize + 片);
                                     row1.Cells[j].CellStyle = styleborder;
                                 }
-                                else if (j == ShowBoxIndex-4)
+                                else if (j == ShowBoxIndex - 4)
                                 {
-                                    row1.Cells[j].SetCellValue(DataTable.Rows[i]["ch_pbcode"].ToString());
+                                    row1.Cells[j].SetCellValue(DataTable.Rows[i - 1]["ch_pbcode"].ToString());
                                     row1.Cells[j].CellStyle = styleborder;
                                 }
                                 else if (j == ShowCountIndex)
@@ -3146,14 +3120,6 @@ 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);
-                    //    }
-                    //}
                     break;
                 case "BatchCode":
                     string LastBatchCode = "";
@@ -3186,9 +3152,9 @@ namespace UAS_LabelMachine
                                     row1.Cells[j].SetCellValue(sumCount);
                                     row1.Cells[j].CellStyle = styleborder;
                                 }
-                                else if (j == ShowBoxIndex-4)
+                                else if (j == ShowBoxIndex - 4)
                                 {
-                                    row1.Cells[j].SetCellValue(DataTable.Rows[i]["ch_pbcode"].ToString());
+                                    row1.Cells[j].SetCellValue(DataTable.Rows[i - 1]["ch_pbcode"].ToString());
                                     row1.Cells[j].CellStyle = styleborder;
                                 }
                                 else
@@ -3216,9 +3182,9 @@ namespace UAS_LabelMachine
                                     row1.Cells[j].SetCellValue(sumCount);
                                     row1.Cells[j].CellStyle = styleborder;
                                 }
-                                else if (j == ShowBoxIndex-4)
+                                else if (j == ShowBoxIndex - 4)
                                 {
-                                    row1.Cells[j].SetCellValue(DataTable.Rows[i]["ch_pbcode"].ToString());
+                                    row1.Cells[j].SetCellValue(DataTable.Rows[i - 1]["ch_pbcode"].ToString());
                                     row1.Cells[j].CellStyle = styleborder;
                                 }
                                 else
@@ -3458,14 +3424,6 @@ 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);
-                    //    }
-                    //}
                     break;
                 case "BoxCode":
                     string LastBoxCode = "";
@@ -3498,9 +3456,9 @@ namespace UAS_LabelMachine
                                     row1.Cells[j].SetCellValue(sumCount);
                                     row1.Cells[j].CellStyle = styleborder;
                                 }
-                                else if (j == ShowBoxIndex-4)
+                                else if (j == ShowBoxIndex - 4)
                                 {
-                                    row1.Cells[j].SetCellValue(DataTable.Rows[i]["ch_pbcode"].ToString());
+                                    row1.Cells[j].SetCellValue(DataTable.Rows[i - 1]["ch_pbcode"].ToString());
                                     row1.Cells[j].CellStyle = styleborder;
                                 }
                                 else
@@ -3528,9 +3486,9 @@ namespace UAS_LabelMachine
                                     row1.Cells[j].SetCellValue(sumCount);
                                     row1.Cells[j].CellStyle = styleborder;
                                 }
-                                else if (j == ShowBoxIndex-4)
+                                else if (j == ShowBoxIndex - 4)
                                 {
-                                    row1.Cells[j].SetCellValue(DataTable.Rows[i]["ch_pbcode"].ToString());
+                                    row1.Cells[j].SetCellValue(DataTable.Rows[i - 1]["ch_pbcode"].ToString());
                                     row1.Cells[j].CellStyle = styleborder;
                                 }
                                 else
@@ -3706,10 +3664,9 @@ namespace UAS_LabelMachine
                                     row1.Cells[j].SetCellValue(sumCount);
                                     row1.Cells[j].CellStyle = styleborder;
                                 }
-                                else if (j == ShowBoxIndex-4)
+                                else if (j == ShowBoxIndex - 4)
                                 {
-
-                                    row1.Cells[j].SetCellValue(DataTable.Rows[i]["ch_pbcode"].ToString());
+                                    row1.Cells[j].SetCellValue(DataTable.Rows[i - 1]["ch_pbcode"].ToString());
                                     row1.Cells[j].CellStyle = styleborder;
                                 }
                                 else
@@ -3737,9 +3694,9 @@ namespace UAS_LabelMachine
                                     row1.Cells[j].SetCellValue(sumCount);
                                     row1.Cells[j].CellStyle = styleborder;
                                 }
-                                else if (j == ShowBoxIndex-4)
+                                else if (j == ShowBoxIndex - 4)
                                 {
-                                    row1.Cells[j].SetCellValue(DataTable.Rows[i]["ch_pbcode"].ToString());
+                                    row1.Cells[j].SetCellValue(DataTable.Rows[i - 1]["ch_pbcode"].ToString());
                                     row1.Cells[j].CellStyle = styleborder;
                                 }
                                 else
@@ -3781,14 +3738,6 @@ 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);
-                    //    }
-                    //}
                     break;
                 default:
                     break;
@@ -3954,14 +3903,6 @@ namespace UAS_LabelMachine
                     }
                 }
             }
-            for (int i = 0; i < sheet2.LastRowNum; i++)
-            {
-                if (i != 0)
-                {
-                    sheet2.AutoSizeColumn(i);
-                    sheet2.SetColumnWidth(i, sheet2.GetColumnWidth(i) + 1000);
-                }
-            }
             //将book的内容写入内存流中返回
             book.Write(ms);
             return ms;