Browse Source

Bug调整,片号不能使用字符串包含的方式

callm 6 years ago
parent
commit
e88bcbd43b

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

@@ -824,5 +824,15 @@ namespace UAS_LabelMachine
             }
             return sql.Substring(0, sql.Length - 1);
         }
+
+        public static string GetArrStr(ArrayList<string> arr, string Split)
+        {
+            string Str = "";
+            for (int i = 0; i < arr.ToArray().Length; i++)
+            {
+                Str += arr.ToArray()[i] + Split;
+            }
+            return Str;
+        }
     }
 }

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

@@ -14,7 +14,7 @@ namespace UAS_LabelMachine
         //海创外网地址
         private readonly string ConnectionStrings = "Data Source=172.16.0.22/orcl;User ID=SZSI_TEST;PassWord=select!#%*(";
         //海创ERP地址
-        public static readonly string ERPAddesss = "http://172.16.0.22:8099/ERP/";
+        public static readonly string ERPAddesss = "http://172.16.0.20:8099/ERP/";
         //海创FTP
         public static readonly string FTPAddress = "ftp://172.16.0.20|vsftpd|shenaftp";
 

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

@@ -333,38 +333,37 @@ namespace UAS_LabelMachine
             switch (Type)
             {
                 case "FixRow":
-                 
+                    //清理系统取出来的数据
                     BaseUtil.CleanDataTableData(FirstDT);
-
                     //首页参数拼接
                     string First_OrderCode = "";
                     string First_Prspec = "";
                     string First_Batch = "";
-                    string First_WID = "";
+                    ArrayList<string> First_WID = new ArrayList<string>();
                     for (int i = 0; i < rowNum; i++)
                     {
                         IRow row1 = sheet.CreateRow(PaintIndex);
                         PaintIndex = PaintIndex + 1;
                         row1.HeightInPoints = 20;
                         //不包含的订单号
-                        if (!First_OrderCode.Contains(DataTable.Rows[i]["pd_ordercode"].ToString()))
+                        if (DataTable.Columns.Contains("pd_ordercode") && !First_OrderCode.Contains(DataTable.Rows[i]["pd_ordercode"].ToString()))
                         {
                             First_OrderCode += DataTable.Rows[i]["pd_ordercode"].ToString() + " ";
                         }
                         //不包含的物料型号
-                        if (!First_Prspec.Contains(DataTable.Rows[i]["pr_spec"].ToString()))
+                        if (DataTable.Columns.Contains("pr_spec") && !First_Prspec.Contains(DataTable.Rows[i]["pr_spec"].ToString()))
                         {
                             First_Prspec += DataTable.Rows[i]["pr_spec"].ToString() + " ";
                         }
                         //不包含扩撒批号
-                        if (!First_Batch.Contains(DataTable.Rows[i]["扩散批号"].ToString()))
+                        if (DataTable.Columns.Contains("扩散批号") && !First_Batch.Contains(DataTable.Rows[i]["扩散批号"].ToString()))
                         {
                             First_Batch += DataTable.Rows[i]["扩散批号"].ToString() + " ";
                         }
                         //不包含Wafer_id
-                        if (!First_WID.Contains(DataTable.Rows[i]["Wafer_ID"].ToString()))
+                        if (DataTable.Columns.Contains("Wafer_ID") &&!First_WID.Contains(DataTable.Rows[i]["Wafer_ID"].ToString()))
                         {
-                            First_WID += DataTable.Rows[i]["Wafer_ID"].ToString() + " ";
+                            First_WID.Add(DataTable.Rows[i]["Wafer_ID"].ToString());
                         }
                         if (i / PageSize >= 1 && i % PageSize == 0)
                         {
@@ -376,14 +375,14 @@ namespace UAS_LabelMachine
                             dr["pd_ordercode"] = First_OrderCode;
                             dr["pr_spec"] = First_Prspec;
                             dr["ch_splitbatch"] = First_Batch;
-                            dr["ch_waterid"] = First_WID;
+                            dr["ch_waterid"] = BaseUtil.GetArrStr(First_WID," ");
                             dr["num"] = PageSize;
                             dr["io_qty"] = sumCount;
                             FirstDT.Rows.Add(dr);
                             First_OrderCode = "";
                             First_Prspec = "";
                             First_Batch = "";
-                            First_WID = "";
+                            First_WID.Clear();
                             for (int j = 0; j < columnNum - 4; j++)
                             {
                                 if (j == 0)
@@ -409,8 +408,8 @@ namespace UAS_LabelMachine
                         //每次到了页数开始分页
                         if (i % PageSize == 0 || i == rowNum - 1)
                         {
-                            //第一行添加客户信息
-                            if (i != rowNum - 1)
+                            //第一行添加客户信息   rownum只有一行的情
+                            if (i != rowNum - 1 || rowNum == 1)
                             {
                                 for (int j = 0; j < columnNum - 3; j++)
                                 {
@@ -505,8 +504,8 @@ namespace UAS_LabelMachine
                             dr["pd_ordercode"] = First_OrderCode;
                             dr["pr_spec"] = First_Prspec;
                             dr["ch_splitbatch"] = First_Batch;
-                            dr["ch_waterid"] = First_WID;
-                            dr["num"] =(i% PageSize)+1;
+                            dr["ch_waterid"] = BaseUtil.GetArrStr(First_WID, " ");
+                            dr["num"] = (i % PageSize) + 1;
                             dr["io_qty"] = sumCount;
                             FirstDT.Rows.Add(dr);
                             row1 = sheet.CreateRow(PaintIndex);
@@ -544,7 +543,8 @@ namespace UAS_LabelMachine
                                     row1.CreateCell(j);
                                     row1.Cells[j].SetCellValue(totalCount);
                                 }
-                                else if (j == columnNum - 5)
+                                //原本是j == columnNum - 5因为还有spec和order两列隐藏列,所以需要在往后移动
+                                else if (j == columnNum - 7)
                                 {
                                     row1.CreateCell(j);
                                     row1.Cells[j].SetCellValue(rowNum);
@@ -729,7 +729,7 @@ namespace UAS_LabelMachine
                                     row1.CreateCell(j);
                                     row1.Cells[j].SetCellValue(totalCount);
                                 }
-                                else if (j == columnNum - 5)
+                                else if (j == columnNum - 7)
                                 {
                                     row1.CreateCell(j);
                                     row1.Cells[j].SetCellValue(rowNum);
@@ -915,7 +915,7 @@ namespace UAS_LabelMachine
                                     row1.CreateCell(j);
                                     row1.Cells[j].SetCellValue(totalCount);
                                 }
-                                else if (j == columnNum - 5)
+                                else if (j == columnNum - 7)
                                 {
                                     row1.CreateCell(j);
                                     row1.Cells[j].SetCellValue(rowNum);