瀏覽代碼

导出为数量的时候支持导出片数

章政 5 年之前
父節點
當前提交
30671d6d47

+ 2 - 2
UAS-出货标签管理(贸易版)/PublicMethod/DataHelper.cs

@@ -12,9 +12,9 @@ namespace UAS_LabelMachine
     {
 
         //深爱地址
-        private readonly string ConnectionStrings = "Data Source=172.16.0.22/orcl;User ID=SZSI_TEST;PassWord=select!#%*(";
+        private readonly string ConnectionStrings = "Data Source=172.16.0.22/orcl;User ID=SZSI_P;PassWord=select!#%*(";
 
-        private readonly string IPConnectionStrings = "Data Source=172.16.0.22/orcl;User ID=SZSI_TEST;PassWord=select!#%*(";
+        private readonly string IPConnectionStrings = "Data Source=172.16.0.22/orcl;User ID=SZSI_P;PassWord=select!#%*(";
         //深爱ERP地址
         public static readonly string ERPAddesss = "http://172.16.0.20:8099/ERP/";
         //深爱FTP

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

@@ -349,6 +349,7 @@ namespace UAS_LabelMachine
             string 总计 = "";
             string 片 = "";
             string companyname = "";
+            Dictionary<int, double> PercentSum = new Dictionary<int, double>();
             if (dh.getFieldDataByCondition("ProdInout", "pi_exporttype", "pi_inoutno='" + Inoutno + "'").ToString() == "Chinese")
             {
                 小计 = "小计";
@@ -361,6 +362,11 @@ namespace UAS_LabelMachine
                 总计 = "total";
                 companyname = "SHENZHEN SI SEMICONDUCTORS  CO.,LTD";
             }
+            bool CountQty = false;
+            if (dh.getFieldDataByCondition("ProdInout", "pi_exporttype1", "pi_inoutno='" + Inoutno + "'").ToString() == "QTY")
+            {
+                CountQty = true;
+            }
             //转换为序列
             CheckBox[] box = conditionbox.ToArray();
             //创建内存流
@@ -586,6 +592,16 @@ namespace UAS_LabelMachine
                                 {
                                     row1.Cells[j].SetCellValue(sumCount);
                                 }
+                                if (CountQty)
+                                {
+                                    for (int k = 0; k < PercentSum.Count; k++)
+                                    {
+                                        if (PercentSum.ContainsKey(j))
+                                        {
+                                            row1.Cells[j].SetCellValue(PercentSum[j]);
+                                        }
+                                    }
+                                }
                                 row1.Cells[j].CellStyle = styleborder;
                             }
                             sumCount = 0;
@@ -647,6 +663,7 @@ namespace UAS_LabelMachine
                                 {
                                     if (DataTable.Columns[j].ColumnName.ToLower() == "chw_percent1")
                                     {
+                                        PercentSum.Add(j - 4, 0);
                                         showcount = showcount + 1;
                                         row1.CreateCell(j - 4);
                                         row1.Cells[j - 4].CellStyle = ColumnTitleStyle;
@@ -654,6 +671,7 @@ namespace UAS_LabelMachine
                                     }
                                     else if (DataTable.Columns[j].ColumnName.ToLower() == "chw_percent2")
                                     {
+                                        PercentSum.Add(j - 4, 0);
                                         showcount = showcount + 1;
                                         row1.CreateCell(j - 4);
                                         row1.Cells[j - 4].CellStyle = ColumnTitleStyle;
@@ -661,6 +679,7 @@ namespace UAS_LabelMachine
                                     }
                                     else if (DataTable.Columns[j].ColumnName.ToLower() == "chw_percent3")
                                     {
+                                        PercentSum.Add(j - 4, 0);
                                         showcount = showcount + 1;
                                         row1.CreateCell(j - 4);
                                         row1.Cells[j - 4].CellStyle = ColumnTitleStyle;
@@ -668,6 +687,7 @@ namespace UAS_LabelMachine
                                     }
                                     else if (DataTable.Columns[j].ColumnName.ToLower() == "chw_percent4")
                                     {
+                                        PercentSum.Add(j - 4, 0);
                                         showcount = showcount + 1;
                                         row1.CreateCell(j - 4);
                                         row1.Cells[j - 4].CellStyle = ColumnTitleStyle;
@@ -675,6 +695,7 @@ namespace UAS_LabelMachine
                                     }
                                     else if (DataTable.Columns[j].ColumnName.ToLower() == "chw_percent5")
                                     {
+                                        PercentSum.Add(j - 4, 0);
                                         showcount = showcount + 1;
                                         row1.CreateCell(j - 4);
                                         row1.Cells[j - 4].CellStyle = ColumnTitleStyle;
@@ -724,6 +745,13 @@ namespace UAS_LabelMachine
                                 if (double.TryParse(Data, out Num))
                                 {
                                     row1.Cells[j - 4].SetCellValue(Num);
+                                    for (int k = 0; k < PercentSum.Count; k++)
+                                    {
+                                        if (PercentSum.ContainsKey(j - 4))
+                                        {
+                                            PercentSum[j - 4] += Num;
+                                        }
+                                    }
                                 }
                                 else
                                 {
@@ -784,7 +812,16 @@ namespace UAS_LabelMachine
                                 {
                                     row1.Cells[j].SetCellValue(sumCount);
                                 }
-
+                                if (CountQty)
+                                {
+                                    for (int k = 0; k < PercentSum.Count; k++)
+                                    {
+                                        if (PercentSum.ContainsKey(j))
+                                        {
+                                            row1.Cells[j].SetCellValue(PercentSum[j]/PercentSum.Count);
+                                        }
+                                    }
+                                }
                                 row1.Cells[j].CellStyle = styleborder;
                             }
                             row1 = sheet.CreateRow(PaintIndex);