Browse Source

复核BUG调整

callm 6 years ago
parent
commit
8a9505f088

+ 40 - 0
UAS-出货标签管理(标签复核)/PublicMethod/DataHelper.cs

@@ -1104,6 +1104,46 @@ namespace UAS_LabelMachine
             command.Dispose();
             command.Dispose();
         }
         }
 
 
+        /// <summary>
+        /// 调用存储过程
+        /// </summary>
+        /// <param name="ProcedureName"></param>
+        /// <param name="param"></param>
+        public void CallProcedure(string ProcedureName, DataTable upload)
+        {
+            StringBuilder sql = new StringBuilder();
+            sql.Append("declare barcode BarCodeUpload_arr;begin barcode:=BarCodeUpload_arr(");
+            for (int i = 0; i < upload.Rows.Count; i++)
+            {
+                //特殊语句,传递回拼接的ID给到跟新本地数据
+                sql.Append("BarCodeUpload(");
+                for (int j = 0; j < upload.Columns.Count; j++)
+                {
+                    if(upload.Columns[j].ColumnName=="PIB_ID"|| upload.Columns[j].ColumnName == "PIB_DATECODE"|| upload.Columns[j].ColumnName == "PIB_LOTNO"|| upload.Columns[j].ColumnName == "PIB_IFPICK" || upload.Columns[j].ColumnName == "PIB_IFUPLOAD")
+                    sql.Append("'" + upload.Rows[i][j].ToString() + "',");
+                }
+                sql.Remove(sql.Length - 1, 1);
+                sql.Append("),");
+            }
+            sql.Remove(sql.Length - 1, 1);
+            sql.Append(");sp_uploadbarcode(barcode);END;");
+            command = new OracleCommand();
+            command.Connection = connection;
+            command.CommandText = sql.ToString();
+            try
+            {
+                command.ExecuteNonQuery();
+            }
+            catch (Exception)
+            {
+                connection = new OracleConnection(DBConnectionString);
+                connection.Open();
+                command.Connection = connection;
+                command.ExecuteNonQuery();
+            }
+            command.Dispose();
+        }
+
         /// <summary>
         /// <summary>
         /// 出现异常进行回滚的执行方法
         /// 出现异常进行回滚的执行方法
         /// </summary>
         /// </summary>

+ 10 - 10
UAS-出货标签管理(标签复核)/UAS_出货标签管理.cs

@@ -38,6 +38,8 @@ namespace UAS_LabelMachine
         /// 当前扫描的所在行
         /// 当前扫描的所在行
         /// </summary>
         /// </summary>
         int CurrentRowIndex = 0;
         int CurrentRowIndex = 0;
+
+        bool Checking = false;
         /// <summary>
         /// <summary>
         /// 正则表达式用于项目匹配
         /// 正则表达式用于项目匹配
         /// </summary>
         /// </summary>
@@ -178,10 +180,10 @@ namespace UAS_LabelMachine
         private void SaveGrid_Click(object sender, EventArgs e)
         private void SaveGrid_Click(object sender, EventArgs e)
         {
         {
             DataTable savedt = (LabelInf.DataSource as DataTable);
             DataTable savedt = (LabelInf.DataSource as DataTable);
+            savedt.EndInit();
             if (savedt != null && savedt.GetChanges() != null)
             if (savedt != null && savedt.GetChanges() != null)
             {
             {
-                MidSource.EndEdit();
-                dh.SaveDataTable(savedt.GetChanges(), "ProdioBarCode", "pib_id");
+                dh.CallProcedure("sp_uploadbarcode", savedt.GetChanges());
                 CheckRecheckStatus();
                 CheckRecheckStatus();
                 MessageBox.Show("保存成功!");
                 MessageBox.Show("保存成功!");
             }
             }
@@ -258,12 +260,6 @@ namespace UAS_LabelMachine
                     return;
                     return;
                 }
                 }
                 CollectInputData();
                 CollectInputData();
-                DataTable savedt = (LabelInf.DataSource as DataTable);
-                if (savedt != null && savedt.GetChanges() != null)
-                {
-                    MidSource.EndEdit();
-                    dh.SaveDataTable(savedt.GetChanges(), "ProdioBarCode", "pib_id");
-                }
             }
             }
         }
         }
 
 
@@ -294,7 +290,11 @@ namespace UAS_LabelMachine
                     string orispeccode = LabelInf.Rows[i].Cells["pr_orispeccode"].Value.ToString();
                     string orispeccode = LabelInf.Rows[i].Cells["pr_orispeccode"].Value.ToString();
                     if ((MatchStr(arr[j].ToString(), "MPN").Contains(orispeccode) || MatchStr(arr[j].ToString(), "MPN").Trim().Replace(" ", "").Contains(orispeccode) || orispeccode == MatchStr(arr[j].ToString(), "MPN") || LabelInf.Rows[i].Cells["pd_custprodcode"].Value.ToString() == MatchStr(arr[j].ToString(), "CPN")) && LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() != "True")
                     if ((MatchStr(arr[j].ToString(), "MPN").Contains(orispeccode) || MatchStr(arr[j].ToString(), "MPN").Trim().Replace(" ", "").Contains(orispeccode) || orispeccode == MatchStr(arr[j].ToString(), "MPN") || LabelInf.Rows[i].Cells["pd_custprodcode"].Value.ToString() == MatchStr(arr[j].ToString(), "CPN")) && LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() != "True")
                     {
                     {
-                        CurrentRowIndex = i;
+                        if (!Checking)
+                        {
+                            CurrentRowIndex = i;
+                            Checking = true;
+                        }
                         if (CurrentRowIndex - 5 > 0)
                         if (CurrentRowIndex - 5 > 0)
                             LabelInf.FirstDisplayedScrollingRowIndex = CurrentRowIndex - 5;
                             LabelInf.FirstDisplayedScrollingRowIndex = CurrentRowIndex - 5;
                         else
                         else
@@ -417,6 +417,7 @@ namespace UAS_LabelMachine
                     dh.ExecuteSql("update prodiobarcode set pib_datecode='" + datecode + "',pib_lotno='" + lotno + "',pib_ifpick=-1 where pib_id='" + pib_id + "'", "update");
                     dh.ExecuteSql("update prodiobarcode set pib_datecode='" + datecode + "',pib_lotno='" + lotno + "',pib_ifpick=-1 where pib_id='" + pib_id + "'", "update");
                     CheckRecheckStatus();
                     CheckRecheckStatus();
                     LabelInf.Invalidate();
                     LabelInf.Invalidate();
+                    Checking = false;
                 }
                 }
                 //采集未通过的时候
                 //采集未通过的时候
                 else
                 else
@@ -517,7 +518,6 @@ namespace UAS_LabelMachine
                             cell = LabelInf.Rows[CurrentRowIndex].Cells["pr_orispeccode"];
                             cell = LabelInf.Rows[CurrentRowIndex].Cells["pr_orispeccode"];
                             Matchstr = MatchStr(data[j], "MPN");
                             Matchstr = MatchStr(data[j], "MPN");
                             //采集的供应商号不匹配的话
                             //采集的供应商号不匹配的话
-                            Console.WriteLine(Matchstr.Trim().Replace(" ", ""));
                             if (cell.Value.ToString() == Matchstr || Matchstr.Trim().Replace(" ", "").Contains(cell.Value.ToString()) || Matchstr.Contains(cell.Value.ToString()))
                             if (cell.Value.ToString() == Matchstr || Matchstr.Trim().Replace(" ", "").Contains(cell.Value.ToString()) || Matchstr.Contains(cell.Value.ToString()))
                             {
                             {
                                 ErrorType.Add("OK_MPN");
                                 ErrorType.Add("OK_MPN");